@dotobokuri/fleet-console 1.32.0 → 1.34.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.
Files changed (65) hide show
  1. package/dist/cli.mjs +578 -451
  2. package/dist/client/assets/{_baseUniq-BcB5wmG1.js → _baseUniq-kpxXKqaz.js} +1 -1
  3. package/dist/client/assets/{arc-DdDM-o2K.js → arc-Cf0soLes.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-CIF7NLBh.js → architectureDiagram-Q4EWVU46-DiRqbCQ7.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-uTDIsi9C.js → blockDiagram-DXYQGD6D-DC25h3LU.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-B-L5_peH.js → c4Diagram-AHTNJAMY-BJLnKoD4.js} +1 -1
  7. package/dist/client/assets/channel-Deg6stWj.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-R3NuBeMM.js → chunk-4BX2VUAB-DWUk4gCy.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-GqEsM9Hl.js → chunk-4TB4RGXK-DW4Ee9nw.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-D4a7-QMt.js → chunk-55IACEB6-8z_Na955.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-CFnwIApt.js → chunk-EDXVE4YY-C3Z4nalr.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-Bx6k_N10.js → chunk-FMBD7UC4-UIVDEAE7.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-2QjCvEfI.js → chunk-OYMX7WX6-DpFWa4G9.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-SRIQm3h2.js → chunk-QZHKN3VN-BJndYOsb.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-D3j-Ehhn.js → chunk-YZCP3GAM-DJcSuWBd.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-CpidLq53.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-CpidLq53.js +1 -0
  18. package/dist/client/assets/clone-CPyCexwP.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-BDRpmFTS.js → cose-bilkent-S5V4N54A-C3m_quy1.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-CNnBa0oO.js → dagre-KV5264BT-DzDFWezD.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-DmLR5VLJ.js → diagram-5BDNPKRD-D3OFrOF_.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-D9-S4gAC.js → diagram-G4DWMVQ6-CgCqSaI7.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-BgkkFSRH.js → diagram-MMDJMWI5-CnJzOV_w.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-CRwM_tDY.js → diagram-TYMM5635-BrUz8pH4.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-DU-pow1m.js → erDiagram-SMLLAGMA-C1IvCMgN.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-B91EFbjc.js → flowDiagram-DWJPFMVM-DCrfhs19.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-B-gUVWSs.js → ganttDiagram-T4ZO3ILL-ChQcD1Li.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-TBkviHit.js → gitGraphDiagram-UUTBAWPF-C5aEYdTT.js} +1 -1
  29. package/dist/client/assets/{graph-Da2r3MMt.js → graph-CpGaCv1x.js} +1 -1
  30. package/dist/client/assets/index-DKrNZlfG.css +1 -0
  31. package/dist/client/assets/index-aW5PuGmI.js +452 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-CAdIgU9C.js → infoDiagram-42DDH7IO-BMhiz3U-.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DKMRplux.js → ishikawaDiagram-UXIWVN3A-5_f4rhFk.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-CPR33z10.js → journeyDiagram-VCZTEJTY-BHP2UyTZ.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-CDsviLfH.js → kanban-definition-6JOO6SKY-edTTflKa.js} +1 -1
  36. package/dist/client/assets/{layout-CkN1-8C9.js → layout-B7z9q0n7.js} +1 -1
  37. package/dist/client/assets/{linear-BxLFCpuS.js → linear-BDNnEnhj.js} +1 -1
  38. package/dist/client/assets/{mermaid.core-DA-WJY50.js → mermaid.core-DDcMYg9W.js} +4 -4
  39. package/dist/client/assets/{min-BsISxNaF.js → min-D6WC647e.js} +1 -1
  40. package/dist/client/assets/{mindmap-definition-QFDTVHPH-B-IUTdhh.js → mindmap-definition-QFDTVHPH-lvrJFtla.js} +1 -1
  41. package/dist/client/assets/{pieDiagram-DEJITSTG-hwSroJDA.js → pieDiagram-DEJITSTG-D1h_ZTUL.js} +1 -1
  42. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-DDt9AzF7.js → quadrantDiagram-34T5L4WZ-DSAYqOT0.js} +1 -1
  43. package/dist/client/assets/{requirementDiagram-MS252O5E-C5Xj9gqW.js → requirementDiagram-MS252O5E-BtNZUJPU.js} +1 -1
  44. package/dist/client/assets/{sankeyDiagram-XADWPNL6-ZwBDrthi.js → sankeyDiagram-XADWPNL6-Ci2wj876.js} +1 -1
  45. package/dist/client/assets/{sequenceDiagram-FGHM5R23-DmyMDdrv.js → sequenceDiagram-FGHM5R23-ES3fQi8m.js} +1 -1
  46. package/dist/client/assets/{stateDiagram-FHFEXIEX-VD5zvoai.js → stateDiagram-FHFEXIEX-BAJV8Z8I.js} +1 -1
  47. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CiX1nm_r.js +1 -0
  48. package/dist/client/assets/{timeline-definition-GMOUNBTQ-DP8udMAZ.js → timeline-definition-GMOUNBTQ-Bl7xwJpF.js} +1 -1
  49. package/dist/client/assets/{vennDiagram-DHZGUBPP-CiBN7TbR.js → vennDiagram-DHZGUBPP-Csv3w_qu.js} +1 -1
  50. package/dist/client/assets/{wardley-RL74JXVD-BtqeTzop.js → wardley-RL74JXVD-CaXvusTS.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-DaRdj2RP.js → wardleyDiagram-NUSXRM2D-DfKsNCHq.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-5P7HB3ND-jlgNCyFB.js → xychartDiagram-5P7HB3ND-BmDHSI31.js} +1 -1
  53. package/dist/client/index.html +2 -2
  54. package/dist/fleet-plugins/file-explorer/routes.mjs +102 -5
  55. package/dist/fleet-plugins/repository/routes.mjs +106 -4
  56. package/dist/fleet-plugins/skills/routes.mjs +93 -42
  57. package/dist/fleet-plugins/terminal/routes.mjs +1003 -917
  58. package/package.json +1 -1
  59. package/dist/client/assets/channel-BamKwHPs.js +0 -1
  60. package/dist/client/assets/classDiagram-6PBFFD2Q-sEh9Glhk.js +0 -1
  61. package/dist/client/assets/classDiagram-v2-HSJHXN6E-sEh9Glhk.js +0 -1
  62. package/dist/client/assets/clone-iMU-qXwc.js +0 -1
  63. package/dist/client/assets/index-5-y-ZMI6.js +0 -451
  64. package/dist/client/assets/index-BBOlVlPk.css +0 -1
  65. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CFTLlJ0p.js +0 -1
@@ -0,0 +1,452 @@
1
+ function x5(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jse(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function i(){var s=!1;try{s=this instanceof i}catch{}return s?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 s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),n}var t_={exports:{}},Uu={};var Ok;function vD(){if(Ok)return Uu;Ok=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,s,o){var l=null;if(o!==void 0&&(l=""+o),s.key!==void 0&&(l=""+s.key),"key"in s){o={};for(var d in s)d!=="key"&&(o[d]=s[d])}else o=s;return s=o.ref,{$$typeof:e,type:i,key:l,ref:s!==void 0?s:null,props:o}}return Uu.Fragment=t,Uu.jsx=n,Uu.jsxs=n,Uu}var Ik;function bD(){return Ik||(Ik=1,t_.exports=vD()),t_.exports}var u=bD();const wD=cw(u),SD=x5({__proto__:null,default:wD},[u]);var n_={exports:{}},vt={};var Dk;function xD(){if(Dk)return vt;Dk=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=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"),y=Symbol.for("react.activity"),b=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function L(R,W,G){this.props=R,this.context=W,this.refs=k,this.updater=G||S}L.prototype.isReactComponent={},L.prototype.setState=function(R,W){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,W,"setState")},L.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function F(){}F.prototype=L.prototype;function q(R,W,G){this.props=R,this.context=W,this.refs=k,this.updater=G||S}var T=q.prototype=new F;T.constructor=q,x(T,L.prototype),T.isPureReactComponent=!0;var $=Array.isArray;function I(){}var N={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function K(R,W,G){var U=G.ref;return{$$typeof:e,type:R,key:W,ref:U!==void 0?U:null,props:G}}function Q(R,W){return K(R.type,W,R.props)}function Y(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function B(R){var W={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(G){return W[G]})}var M=/\/+/g;function D(R,W){return typeof R=="object"&&R!==null&&R.key!=null?B(""+R.key):W.toString(36)}function j(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(I,I):(R.status="pending",R.then(function(W){R.status==="pending"&&(R.status="fulfilled",R.value=W)},function(W){R.status==="pending"&&(R.status="rejected",R.reason=W)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function A(R,W,G,U,ee){var ne=typeof R;(ne==="undefined"||ne==="boolean")&&(R=null);var me=!1;if(R===null)me=!0;else switch(ne){case"bigint":case"string":case"number":me=!0;break;case"object":switch(R.$$typeof){case e:case t:me=!0;break;case m:return me=R._init,A(me(R._payload),W,G,U,ee)}}if(me)return ee=ee(R),me=U===""?"."+D(R,0):U,$(ee)?(G="",me!=null&&(G=me.replace(M,"$&/")+"/"),A(ee,W,G,"",function(Ye){return Ye})):ee!=null&&(Y(ee)&&(ee=Q(ee,G+(ee.key==null||R&&R.key===ee.key?"":(""+ee.key).replace(M,"$&/")+"/")+me)),W.push(ee)),1;me=0;var Me=U===""?".":U+":";if($(R))for(var ve=0;ve<R.length;ve++)U=R[ve],ne=Me+D(U,ve),me+=A(U,W,G,ne,ee);else if(ve=w(R),typeof ve=="function")for(R=ve.call(R),ve=0;!(U=R.next()).done;)U=U.value,ne=Me+D(U,ve++),me+=A(U,W,G,ne,ee);else if(ne==="object"){if(typeof R.then=="function")return A(j(R),W,G,U,ee);throw W=String(R),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return me}function O(R,W,G){if(R==null)return R;var U=[],ee=0;return A(R,U,"","",function(ne){return W.call(G,ne,ee++)}),U}function C(R){if(R._status===-1){var W=R._result;W=W(),W.then(function(G){(R._status===0||R._status===-1)&&(R._status=1,R._result=G)},function(G){(R._status===0||R._status===-1)&&(R._status=2,R._result=G)}),R._status===-1&&(R._status=0,R._result=W)}if(R._status===1)return R._result.default;throw R._result}var z=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},P={map:O,forEach:function(R,W,G){O(R,function(){W.apply(this,arguments)},G)},count:function(R){var W=0;return O(R,function(){W++}),W},toArray:function(R){return O(R,function(W){return W})||[]},only:function(R){if(!Y(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return vt.Activity=y,vt.Children=P,vt.Component=L,vt.Fragment=n,vt.Profiler=s,vt.PureComponent=q,vt.StrictMode=i,vt.Suspense=f,vt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,vt.__COMPILER_RUNTIME={__proto__:null,c:function(R){return N.H.useMemoCache(R)}},vt.cache=function(R){return function(){return R.apply(null,arguments)}},vt.cacheSignal=function(){return null},vt.cloneElement=function(R,W,G){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var U=x({},R.props),ee=R.key;if(W!=null)for(ne in W.key!==void 0&&(ee=""+W.key),W)!V.call(W,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&W.ref===void 0||(U[ne]=W[ne]);var ne=arguments.length-2;if(ne===1)U.children=G;else if(1<ne){for(var me=Array(ne),Me=0;Me<ne;Me++)me[Me]=arguments[Me+2];U.children=me}return K(R.type,ee,U)},vt.createContext=function(R){return R={$$typeof:l,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:o,_context:R},R},vt.createElement=function(R,W,G){var U,ee={},ne=null;if(W!=null)for(U in W.key!==void 0&&(ne=""+W.key),W)V.call(W,U)&&U!=="key"&&U!=="__self"&&U!=="__source"&&(ee[U]=W[U]);var me=arguments.length-2;if(me===1)ee.children=G;else if(1<me){for(var Me=Array(me),ve=0;ve<me;ve++)Me[ve]=arguments[ve+2];ee.children=Me}if(R&&R.defaultProps)for(U in me=R.defaultProps,me)ee[U]===void 0&&(ee[U]=me[U]);return K(R,ne,ee)},vt.createRef=function(){return{current:null}},vt.forwardRef=function(R){return{$$typeof:d,render:R}},vt.isValidElement=Y,vt.lazy=function(R){return{$$typeof:m,_payload:{_status:-1,_result:R},_init:C}},vt.memo=function(R,W){return{$$typeof:p,type:R,compare:W===void 0?null:W}},vt.startTransition=function(R){var W=N.T,G={};N.T=G;try{var U=R(),ee=N.S;ee!==null&&ee(G,U),typeof U=="object"&&U!==null&&typeof U.then=="function"&&U.then(I,z)}catch(ne){z(ne)}finally{W!==null&&G.types!==null&&(W.types=G.types),N.T=W}},vt.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},vt.use=function(R){return N.H.use(R)},vt.useActionState=function(R,W,G){return N.H.useActionState(R,W,G)},vt.useCallback=function(R,W){return N.H.useCallback(R,W)},vt.useContext=function(R){return N.H.useContext(R)},vt.useDebugValue=function(){},vt.useDeferredValue=function(R,W){return N.H.useDeferredValue(R,W)},vt.useEffect=function(R,W){return N.H.useEffect(R,W)},vt.useEffectEvent=function(R){return N.H.useEffectEvent(R)},vt.useId=function(){return N.H.useId()},vt.useImperativeHandle=function(R,W,G){return N.H.useImperativeHandle(R,W,G)},vt.useInsertionEffect=function(R,W){return N.H.useInsertionEffect(R,W)},vt.useLayoutEffect=function(R,W){return N.H.useLayoutEffect(R,W)},vt.useMemo=function(R,W){return N.H.useMemo(R,W)},vt.useOptimistic=function(R,W){return N.H.useOptimistic(R,W)},vt.useReducer=function(R,W,G){return N.H.useReducer(R,W,G)},vt.useRef=function(R){return N.H.useRef(R)},vt.useState=function(R){return N.H.useState(R)},vt.useSyncExternalStore=function(R,W,G){return N.H.useSyncExternalStore(R,W,G)},vt.useTransition=function(){return N.H.useTransition()},vt.version="19.2.7",vt}var jk;function uw(){return jk||(jk=1,n_.exports=xD()),n_.exports}var _=uw();const CD=cw(_),Rp=x5({__proto__:null,default:CD},[_]),kD="fc-operation-body";let Pi=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function C5(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Pi(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(AD).filter(i=>i!==null):[]}function Mp(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)||k5(t))throw new Pi(500,"Invalid operation response");return t}function k5(e){return zv(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function ED({children:e,className:t}){return u.jsx("div",{className:RD(kD,t),children:e})}function AD(e){if(!E5(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(TD).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function TD(e){return!E5(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 E5(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 RD(...e){return e.filter(t=>!!t).join(" ")}const MD=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Pi,OperationBody:ED,assertOperationNode:Mp,fetchOperationCatalog:C5,hasForbiddenBrowserPayloadKey:k5},Symbol.toStringTag,{value:"Module"}));function LD(e){return e}function ND(e){return e}function A5(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,s)=>fetch(i_(n,i),s).then(PD),subscribe:(n,i,s)=>{const o=new EventSource(i_(n,i));o.onmessage=s;const l=()=>o.close();return t.add(l),()=>{l(),t.delete(l)}},resync:e},lifecycle:{onDispose:n=>(t.add(n),()=>t.delete(n))},terminal:{requestTicket:async(n,i,s,o)=>{const l=await fetch(i_(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:s}),signal:o});if(!l.ok)throw new Pi(l.status,`Terminal ticket request failed: ${l.status}`);const d=await l.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new Pi(l.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 Pi(i.status,`Operation create failed: ${i.status}`);const s=await i.json();return Mp(s.operation)},rename:async(n,i)=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:i})});if(!s.ok)throw new Pi(s.status,`Operation rename failed: ${s.status}`);const o=await s.json();return Mp(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Pi(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>$D(n,i),write:(n,i)=>FD(n,i)},settings:{read:async n=>{const i=await fetch(Bk(n));if(!i.ok)throw new Pi(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 s=await fetch(Bk(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new Pi(s.status,`Plugin settings write failed: ${s.status}`)}},status:{set:()=>{},clear:()=>{}}}}function T5(e,t){return _.useSyncExternalStore(e,t,t)}function OD(){const[e,t]=_.useState([]),n=_.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Pi(i.status,`Operations request failed: ${i.status}`);const s=await i.json();t(Array.isArray(s.operations)?s.operations.map(Mp):[])},[]);return _.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function ID(e,t){return _.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function DD(e,t){return _.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function jD(e,t,n){const[i,s]=_.useState(()=>e.read(t,n)),o=_.useCallback(l=>{s(l),e.write(t,l)},[e,t]);return[i,o]}function BD(e,t){return _.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function PD(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Pi(e.status,`Plugin request failed: ${e.status}`,t)}return e}function i_(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Pi(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Pi(400,"Invalid plugin path");return`/plugins/${e}${n}`}const zD=/^[a-z0-9][a-z0-9._-]*$/;function Bk(e){if(!zD.test(e))throw new Pi(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function $D(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 FD(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const HD=Object.freeze(Object.defineProperty({__proto__:null,React:Rp,createClientCapabilities:A5,defineOperationKind:ND,definePlugin:LD,useOperationStatus:BD,useOperations:OD,usePluginApi:ID,usePluginSettings:DD,usePluginStorage:jD,useStoreSnapshot:T5},Symbol.toStringTag,{value:"Module"}));var r_={exports:{}},ji={};var Pk;function UD(){if(Pk)return ji;Pk=1;var e=uw();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},s=Symbol.for("react.portal");function o(f,p,m){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:y==null?null:""+y,children:f,containerInfo:p,implementation:m}}var l=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 ji.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ji.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)},ji.flushSync=function(f){var p=l.T,m=i.p;try{if(l.T=null,i.p=2,f)return f()}finally{l.T=p,i.p=m,i.d.f()}},ji.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))},ji.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},ji.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,y=d(m,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,w=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?i.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:w}):m==="script"&&i.d.X(f,{crossOrigin:y,integrity:b,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},ji.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)},ji.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,y=d(m,p.crossOrigin);i.d.L(f,m,{crossOrigin:y,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})}},ji.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)},ji.requestFormReset=function(f){i.d.r(f)},ji.unstable_batchedUpdates=function(f,p){return f(p)},ji.useFormState=function(f,p,m){return l.H.useFormState(f,p,m)},ji.useFormStatus=function(){return l.H.useHostTransitionStatus()},ji.version="19.2.7",ji}var zk;function R5(){if(zk)return r_.exports;zk=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(),r_.exports=UD(),r_.exports}var xa=R5();const Lp=6,WD=232,qD=160,GD=8,KD=500;function VD(e,t,n){return Math.min(Math.max(e,t),n)}function YD(e){const t=[];for(let n=0;n<e.length;n+=1)e[n]?.disabled||t.push(n);return t}function XD(e,t,n){const i=Math.max(0,GD),s=Math.max(0,window.innerWidth),o=Math.max(0,window.innerHeight),l=Math.max(0,s-2*i),d=Math.max(0,e.width),f=Math.min(n?Math.max(qD,d):d,l),p=n?e.right-f:e.left,m=VD(p,i,Math.max(i,s-f-i));return t==="down"?{position:"fixed",left:m,width:f,top:Math.max(0,e.bottom+Lp)}:{position:"fixed",left:m,width:f,bottom:Math.max(0,o-e.top+Lp)}}function ZD(e){const t=window.innerHeight-e.bottom-Lp,n=e.top-Lp;return t<WD&&n>t?"up":"down"}function M5({value:e,options:t,onChange:n,disabled:i=!1,id:s,compact:o=!1}){const l=_.useId(),d=s??`fc-select-${l.replace(/:/g,"")}`,f=_.useMemo(()=>t.map((O,C)=>`${d}-option-${C}-${O.value}`),[d,t]),p=_.useRef(null),m=_.useRef(null),y=_.useRef(null),[b,w]=_.useState(!1),[S,x]=_.useState(-1),[k,L]=_.useState("down"),[F,q]=_.useState({}),T=_.useRef(""),$=_.useRef(void 0),I=_.useMemo(()=>YD(t),[t]),N=_.useCallback(()=>{T.current="",$.current!==void 0&&(clearTimeout($.current),$.current=void 0)},[]),V=_.useCallback(()=>{w(!1),x(-1),N()},[N]),K=_.useCallback(O=>{n(O),V(),m.current?.focus()},[V,n]),Q=_.useCallback(()=>{const O=m.current;if(!O)return;const C=O.getBoundingClientRect(),z=ZD(C);L(z),q(XD(C,z,o))},[o]),Y=_.useCallback((O=!0)=>{if(i||b)return;w(!0);const C=t.findIndex(z=>z.value===e&&!z.disabled);O&&C>=0?x(C):x(I[0]??-1)},[i,I,b,t,e]),B=_.useCallback(O=>{if(!I.length)return;const C=I.indexOf(S),z=C>=0?C:O>0?-1:0,P=I[(z+O+I.length)%I.length];P!==void 0&&x(P)},[S,I]);_.useLayoutEffect(()=>{if(b)return Q(),window.addEventListener("resize",Q),window.addEventListener("scroll",Q,!0),()=>{window.removeEventListener("resize",Q),window.removeEventListener("scroll",Q,!0)}},[b,Q]),_.useEffect(()=>{if(!b)return;const O=z=>{const P=z.target;p.current?.contains(P)||y.current?.contains(P)||V()},C=z=>{if(z.key==="Escape"){z.stopPropagation(),V(),m.current?.focus();return}if(z.key==="Tab"){V();return}if(z.key==="ArrowDown"){z.preventDefault(),B(1);return}if(z.key==="ArrowUp"){z.preventDefault(),B(-1);return}if(z.key==="Home"){z.preventDefault();const P=I[0];P!==void 0&&x(P);return}if(z.key==="End"){z.preventDefault();const P=I.at(-1);P!==void 0&&x(P);return}if(z.key==="Enter"||z.key===" "){z.preventDefault(),z.stopPropagation();const P=t[S];P&&!P.disabled&&K(P.value);return}if(z.key.length===1&&/\S/u.test(z.key)){T.current+=z.key.toLowerCase(),clearTimeout($.current),$.current=setTimeout(()=>{T.current=""},KD);const P=T.current,R=I.map(W=>t[W]).find(W=>W?.label.toLowerCase().startsWith(P));if(R){const W=t.indexOf(R);W>=0&&x(W)}}};return document.addEventListener("pointerdown",O,!0),document.addEventListener("keydown",C,!0),()=>{document.removeEventListener("pointerdown",O,!0),document.removeEventListener("keydown",C,!0)}},[S,V,K,I,b,B,t]),_.useEffect(()=>()=>N(),[N]),_.useEffect(()=>{if(!b||S<0)return;const O=f[S];if(!O)return;document.getElementById(O)?.scrollIntoView?.({block:"nearest"})},[S,b,f]);const M=b&&S>=0?f[S]:void 0,D=_.useCallback(O=>{b||["ArrowDown","ArrowUp","Enter"," "].includes(O.key)&&(O.preventDefault(),Y(O.key!=="ArrowDown"),O.key==="ArrowDown"&&B(1))},[b,B,Y]),j=_.useCallback(()=>{i||(b?V():Y(!0))},[V,i,b,Y]),A=_.useCallback(O=>{const C=t[O];return{id:f[O]??`${d}-option-${O}`,role:"option",className:"fc-select__option","data-active":S===O?"true":"false","aria-selected":C?.value===e,"aria-disabled":C?.disabled?!0:void 0,onPointerEnter:()=>x(O),onClick:()=>{C&&!C.disabled&&K(C.value)}}},[S,K,d,f,t,e]);return{isOpen:b,activeOptionId:M,placement:k,rootRef:p,triggerRef:m,popupRef:y,listboxId:d,rootProps:{ref:p,className:"fc-select"},triggerProps:{ref:m,type:"button",role:"combobox",className:"fc-select__trigger",disabled:i,"aria-haspopup":"listbox","aria-expanded":b,"aria-controls":d,"aria-activedescendant":M,onClick:j,onKeyDown:D},listboxProps:{ref:y,id:d,role:"listbox",className:o?"fc-select__popup fc-select__popup--compact":"fc-select__popup","data-open":b?"true":"false","data-placement":k,style:F},getOptionProps:A}}function Oi({value:e,options:t,onChange:n,disabled:i=!1,compact:s=!1,className:o,id:l,label:d,"aria-labelledby":f}){const p=M5({value:e,options:t,onChange:n,disabled:i,id:l,compact:s}),m=t.find(w=>w.value===e),y=[p.rootProps.className,s?"fc-select--compact":"",o??""].filter(Boolean).join(" "),b=f?{"aria-labelledby":f}:d?{"aria-label":d}:{};return u.jsxs("div",{ref:p.rootRef,className:y,children:[u.jsxs("button",{...p.triggerProps,...b,children:[u.jsx("span",{className:"fc-select__value",children:m?.label??""}),u.jsx("span",{className:"fc-select__caret","aria-hidden":"true",children:"⌄"})]}),p.isOpen?xa.createPortal(u.jsx("ul",{...p.listboxProps,...b,children:t.map((w,S)=>u.jsx("li",{...p.getOptionProps(S),children:w.label},w.value))}),document.body):null]})}function JD(e){return e}function QD({title:e,description:t,children:n}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:n})]})}function e4({label:e,hint:t,children:n}){const i=_.useId(),s=_.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?s:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:s,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:n})]})}function t4({checked:e,onChange:t,label:n,disabled:i=!1}){const s=_.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:s,children:[u.jsx("input",{id:s,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:i,"aria-label":n?void 0:"Toggle setting",onChange:o=>t(o.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?u.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function n4({value:e,options:t,onChange:n,label:i,disabled:s=!1}){const o=_.useId(),l=t.map(f=>({value:f.value,label:f.label})),d=u.jsx(Oi,{value:e,options:l,onChange:n,disabled:s,label:i?void 0:"Select setting","aria-labelledby":i?o:void 0});return i?u.jsxs("label",{className:"fc-settings-select",children:[u.jsx("span",{className:"fc-settings-select__label",id:o,children:i}),d]}):u.jsx("div",{className:"fc-settings-select",children:d})}function i4({label:e,hint:t,children:n}){const i=_.useId(),s=_.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?s:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:s,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:n})]})}const r4=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:QD,SettingsField:i4,SettingsRow:e4,SettingsSelect:n4,SettingsToggle:t4,defineSettingsSection:JD},Symbol.toStringTag,{value:"Module"}));function s4(e){return e}const a4=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:s4},Symbol.toStringTag,{value:"Module"})),o4=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Np extends _.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??o4:this.props.children}}const l4=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Np,React:Rp,Select:Oi,default:Rp,useSelect:M5},Symbol.toStringTag,{value:"Module"}));var s_={exports:{}},Wu={},a_={exports:{}},o_={};var $k;function c4(){return $k||($k=1,(function(e){function t(A,O){var C=A.length;A.push(O);e:for(;0<C;){var z=C-1>>>1,P=A[z];if(0<s(P,O))A[z]=O,A[C]=P,C=z;else break e}}function n(A){return A.length===0?null:A[0]}function i(A){if(A.length===0)return null;var O=A[0],C=A.pop();if(C!==O){A[0]=C;e:for(var z=0,P=A.length,R=P>>>1;z<R;){var W=2*(z+1)-1,G=A[W],U=W+1,ee=A[U];if(0>s(G,C))U<P&&0>s(ee,G)?(A[z]=ee,A[U]=C,z=U):(A[z]=G,A[W]=C,z=W);else if(U<P&&0>s(ee,C))A[z]=ee,A[U]=C,z=U;else break e}}return O}function s(A,O){var C=A.sortIndex-O.sortIndex;return C!==0?C:A.id-O.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 l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var f=[],p=[],m=1,y=null,b=3,w=!1,S=!1,x=!1,k=!1,L=typeof setTimeout=="function"?setTimeout:null,F=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function T(A){for(var O=n(p);O!==null;){if(O.callback===null)i(p);else if(O.startTime<=A)i(p),O.sortIndex=O.expirationTime,t(f,O);else break;O=n(p)}}function $(A){if(x=!1,T(A),!S)if(n(f)!==null)S=!0,I||(I=!0,B());else{var O=n(p);O!==null&&j($,O.startTime-A)}}var I=!1,N=-1,V=5,K=-1;function Q(){return k?!0:!(e.unstable_now()-K<V)}function Y(){if(k=!1,I){var A=e.unstable_now();K=A;var O=!0;try{e:{S=!1,x&&(x=!1,F(N),N=-1),w=!0;var C=b;try{t:{for(T(A),y=n(f);y!==null&&!(y.expirationTime>A&&Q());){var z=y.callback;if(typeof z=="function"){y.callback=null,b=y.priorityLevel;var P=z(y.expirationTime<=A);if(A=e.unstable_now(),typeof P=="function"){y.callback=P,T(A),O=!0;break t}y===n(f)&&i(f),T(A)}else i(f);y=n(f)}if(y!==null)O=!0;else{var R=n(p);R!==null&&j($,R.startTime-A),O=!1}}break e}finally{y=null,b=C,w=!1}O=void 0}}finally{O?B():I=!1}}}var B;if(typeof q=="function")B=function(){q(Y)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,D=M.port2;M.port1.onmessage=Y,B=function(){D.postMessage(null)}}else B=function(){L(Y,0)};function j(A,O){N=L(function(){A(e.unstable_now())},O)}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(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(A){switch(b){case 1:case 2:case 3:var O=3;break;default:O=b}var C=b;b=O;try{return A()}finally{b=C}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(A,O){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var C=b;b=A;try{return O()}finally{b=C}},e.unstable_scheduleCallback=function(A,O,C){var z=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?z+C:z):C=z,A){case 1:var P=-1;break;case 2:P=250;break;case 5:P=1073741823;break;case 4:P=1e4;break;default:P=5e3}return P=C+P,A={id:m++,callback:O,priorityLevel:A,startTime:C,expirationTime:P,sortIndex:-1},C>z?(A.sortIndex=C,t(p,A),n(f)===null&&A===n(p)&&(x?(F(N),N=-1):x=!0,j($,C-z))):(A.sortIndex=P,t(f,A),S||w||(S=!0,I||(I=!0,B()))),A},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(A){var O=b;return function(){var C=b;b=O;try{return A.apply(this,arguments)}finally{b=C}}}})(o_)),o_}var Fk;function u4(){return Fk||(Fk=1,a_.exports=c4()),a_.exports}var Hk;function d4(){if(Hk)return Wu;Hk=1;var e=u4(),t=uw(),n=R5();function i(r){var a="https://react.dev/errors/"+r;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)a+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var a=r,c=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(c=a.return),r=a.return;while(r)}return a.tag===3?c:null}function l(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function d(r){if(r.tag===31){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function f(r){if(o(r)!==r)throw Error(i(188))}function p(r){var a=r.alternate;if(!a){if(a=o(r),a===null)throw Error(i(188));return a!==r?null:r}for(var c=r,h=a;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(h=g.return,h!==null){c=h;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return f(g),r;if(v===h)return f(g),a;v=v.sibling}throw Error(i(188))}if(c.return!==h.return)c=g,h=v;else{for(var E=!1,H=g.child;H;){if(H===c){E=!0,c=g,h=v;break}if(H===h){E=!0,h=g,c=v;break}H=H.sibling}if(!E){for(H=v.child;H;){if(H===c){E=!0,c=v,h=g;break}if(H===h){E=!0,h=v,c=g;break}H=H.sibling}if(!E)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:a}function m(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r;for(r=r.child;r!==null;){if(a=m(r),a!==null)return a;r=r.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),q=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),Q=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function B(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var M=Symbol.for("react.client.reference");function D(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===M?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case x:return"Fragment";case L:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case I:return"SuspenseList";case K:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case q:return r.displayName||"Context";case F:return(r._context.displayName||"Context")+".Consumer";case T:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case N:return a=r.displayName||null,a!==null?a:D(r.type)||"Memo";case V:a=r._payload,r=r._init;try{return D(r(a))}catch{}}return null}var j=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C={pending:!1,data:null,method:null,action:null},z=[],P=-1;function R(r){return{current:r}}function W(r){0>P||(r.current=z[P],z[P]=null,P--)}function G(r,a){P++,z[P]=r.current,r.current=a}var U=R(null),ee=R(null),ne=R(null),me=R(null);function Me(r,a){switch(G(ne,a),G(ee,r),G(U,null),a.nodeType){case 9:case 11:r=(r=a.documentElement)&&(r=r.namespaceURI)?nk(r):0;break;default:if(r=a.tagName,a=a.namespaceURI)a=nk(a),r=ik(a,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}W(U),G(U,r)}function ve(){W(U),W(ee),W(ne)}function Ye(r){r.memoizedState!==null&&G(me,r);var a=U.current,c=ik(a,r.type);a!==c&&(G(ee,r),G(U,c))}function qe(r){ee.current===r&&(W(U),W(ee)),me.current===r&&(W(me),zu._currentValue=C)}var yt,$e;function We(r){if(yt===void 0)try{throw Error()}catch(c){var a=c.stack.trim().match(/\n( *(at )?)/);yt=a&&a[1]||"",$e=-1<c.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+yt+r+$e}var mt=!1;function ot(r,a){if(!r||mt)return"";mt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(pe){var ue=pe}Reflect.construct(r,[],xe)}else{try{xe.call()}catch(pe){ue=pe}r.call(xe.prototype)}}else{try{throw Error()}catch(pe){ue=pe}(xe=r())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(pe){if(pe&&ue&&typeof pe.stack=="string")return[pe.stack,ue.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(),E=v[0],H=v[1];if(E&&H){var J=E.split(`
4
+ `),ce=H.split(`
5
+ `);for(g=h=0;h<J.length&&!J[h].includes("DetermineComponentFrameRoot");)h++;for(;g<ce.length&&!ce[g].includes("DetermineComponentFrameRoot");)g++;if(h===J.length||g===ce.length)for(h=J.length-1,g=ce.length-1;1<=h&&0<=g&&J[h]!==ce[g];)g--;for(;1<=h&&0<=g;h--,g--)if(J[h]!==ce[g]){if(h!==1||g!==1)do if(h--,g--,0>g||J[h]!==ce[g]){var _e=`
6
+ `+J[h].replace(" at new "," at ");return r.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",r.displayName)),_e}while(1<=h&&0<=g);break}}}finally{mt=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?We(c):""}function Nt(r,a){switch(r.tag){case 26:case 27:case 5:return We(r.type);case 16:return We("Lazy");case 13:return r.child!==a&&a!==null?We("Suspense Fallback"):We("Suspense");case 19:return We("SuspenseList");case 0:case 15:return ot(r.type,!1);case 11:return ot(r.type.render,!1);case 1:return ot(r.type,!0);case 31:return We("Activity");default:return""}}function Ot(r){try{var a="",c=null;do a+=Nt(r,c),c=r,r=r.return;while(r);return a}catch(h){return`
7
+ Error generating stack: `+h.message+`
8
+ `+h.stack}}var kt=Object.prototype.hasOwnProperty,ye=e.unstable_scheduleCallback,ze=e.unstable_cancelCallback,Je=e.unstable_shouldYield,It=e.unstable_requestPaint,Ke=e.unstable_now,en=e.unstable_getCurrentPriorityLevel,we=e.unstable_ImmediatePriority,De=e.unstable_UserBlockingPriority,de=e.unstable_NormalPriority,Pe=e.unstable_LowPriority,st=e.unstable_IdlePriority,ft=e.log,Dt=e.unstable_setDisableYieldValue,Gt=null,_t=null;function Tt(r){if(typeof ft=="function"&&Dt(r),_t&&typeof _t.setStrictMode=="function")try{_t.setStrictMode(Gt,r)}catch{}}var Ne=Math.clz32?Math.clz32:oe,jt=Math.log,se=Math.LN2;function oe(r){return r>>>=0,r===0?32:31-(jt(r)/se|0)|0}var ge=256,Ee=262144,je=4194304;function at(r){var a=r&42;if(a!==0)return a;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Z(r,a,c){var h=r.pendingLanes;if(h===0)return 0;var g=0,v=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var H=h&134217727;return H!==0?(h=H&~v,h!==0?g=at(h):(E&=H,E!==0?g=at(E):c||(c=H&~r,c!==0&&(g=at(c))))):(H=h&~v,H!==0?g=at(H):E!==0?g=at(E):c||(c=h&~r,c!==0&&(g=at(c)))),g===0?0:a!==0&&a!==g&&(a&v)===0&&(v=g&-g,c=a&-a,v>=c||v===32&&(c&4194048)!==0)?a:g}function he(r,a){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&a)===0}function ke(r,a){switch(r){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 Ge(){var r=je;return je<<=1,(je&62914560)===0&&(je=4194304),r}function St(r){for(var a=[],c=0;31>c;c++)a.push(r);return a}function Pt(r,a){r.pendingLanes|=a,a!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Fe(r,a,c,h,g,v){var E=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var H=r.entanglements,J=r.expirationTimes,ce=r.hiddenUpdates;for(c=E&~c;0<c;){var _e=31-Ne(c),xe=1<<_e;H[_e]=0,J[_e]=-1;var ue=ce[_e];if(ue!==null)for(ce[_e]=null,_e=0;_e<ue.length;_e++){var pe=ue[_e];pe!==null&&(pe.lane&=-536870913)}c&=~xe}h!==0&&Oe(r,h,0),v!==0&&g===0&&r.tag!==0&&(r.suspendedLanes|=v&~(E&~a))}function Oe(r,a,c){r.pendingLanes|=a,r.suspendedLanes&=~a;var h=31-Ne(a);r.entangledLanes|=a,r.entanglements[h]=r.entanglements[h]|1073741824|c&261930}function Qe(r,a){var c=r.entangledLanes|=a;for(r=r.entanglements;c;){var h=31-Ne(c),g=1<<h;g&a|r[h]&a&&(r[h]|=a),c&=~g}}function _n(r,a){var c=a&-a;return c=(c&42)!==0?1:gt(c),(c&(r.suspendedLanes|a))!==0?0:c}function gt(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Rn(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function $i(){var r=O.p;return r!==0?r:(r=window.event,r===void 0?32:Ek(r.type))}function Lr(r,a){var c=O.p;try{return O.p=r,a()}finally{O.p=c}}var Ii=Math.random().toString(36).slice(2),Ft="__reactFiber$"+Ii,Kt="__reactProps$"+Ii,Qi="__reactContainer$"+Ii,gs="__reactEvents$"+Ii,Hs="__reactListeners$"+Ii,is="__reactHandles$"+Ii,Us="__reactResources$"+Ii,pr="__reactMarker$"+Ii;function et(r){delete r[Ft],delete r[Kt],delete r[gs],delete r[Hs],delete r[is]}function X(r){var a=r[Ft];if(a)return a;for(var c=r.parentNode;c;){if(a=c[Qi]||c[Ft]){if(c=a.alternate,a.child!==null||c!==null&&c.child!==null)for(r=uk(r);r!==null;){if(c=r[Ft])return c;r=uk(r)}return a}r=c,c=r.parentNode}return null}function Se(r){if(r=r[Ft]||r[Qi]){var a=r.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return r}return null}function Be(r){var a=r.tag;if(a===5||a===26||a===27||a===6)return r.stateNode;throw Error(i(33))}function Bt(r){var a=r[Us];return a||(a=r[Us]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Rt(r){r[pr]=!0}var ln=new Set,ie={};function Ie(r,a){fe(r,a),fe(r+"Capture",a)}function fe(r,a){for(ie[r]=a,r=0;r<a.length;r++)ln.add(a[r])}var Te=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]*$"),Ae={},dt={};function xt(r){return kt.call(dt,r)?!0:kt.call(Ae,r)?!1:Te.test(r)?dt[r]=!0:(Ae[r]=!0,!1)}function rn(r,a,c){if(xt(a))if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){r.removeAttribute(a);return}}r.setAttribute(a,""+c)}}function Yn(r,a,c){if(c===null)r.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(a);return}r.setAttribute(a,""+c)}}function Fn(r,a,c,h){if(h===null)r.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(a,c,""+h)}}function Vt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function nt(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function sn(r,a,c){var h=Object.getOwnPropertyDescriptor(r.constructor.prototype,a);if(!r.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var g=h.get,v=h.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return g.call(this)},set:function(E){c=""+E,v.call(this,E)}}),Object.defineProperty(r,a,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function Xn(r){if(!r._valueTracker){var a=nt(r)?"checked":"value";r._valueTracker=sn(r,a,""+r[a])}}function Di(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var c=a.getValue(),h="";return r&&(h=nt(r)?r.checked?"true":"false":r.value),r=h,r!==c?(a.setValue(r),!0):!1}function Zn(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var ys=/[\n"\\]/g;function Hn(r){return r.replace(ys,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Ws(r,a,c,h,g,v,E,H){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),a!=null?E==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+Vt(a)):r.value!==""+Vt(a)&&(r.value=""+Vt(a)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),a!=null?Un(r,E,Vt(a)):c!=null?Un(r,E,Vt(c)):h!=null&&r.removeAttribute("value"),g==null&&v!=null&&(r.defaultChecked=!!v),g!=null&&(r.checked=g&&typeof g!="function"&&typeof g!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?r.name=""+Vt(H):r.removeAttribute("name")}function rs(r,a,c,h,g,v,E,H){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),a!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){Xn(r);return}c=c!=null?""+Vt(c):"",a=a!=null?""+Vt(a):c,H||a===r.value||(r.value=a),r.defaultValue=a}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,r.checked=H?r.checked:!!h,r.defaultChecked=!!h,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),Xn(r)}function Un(r,a,c){a==="number"&&Zn(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Wn(r,a,c,h){if(r=r.options,a){a={};for(var g=0;g<c.length;g++)a["$"+c[g]]=!0;for(c=0;c<r.length;c++)g=a.hasOwnProperty("$"+r[c].value),r[c].selected!==g&&(r[c].selected=g),g&&h&&(r[c].defaultSelected=!0)}else{for(c=""+Vt(c),a=null,g=0;g<r.length;g++){if(r[g].value===c){r[g].selected=!0,h&&(r[g].defaultSelected=!0);return}a!==null||r[g].disabled||(a=r[g])}a!==null&&(a.selected=!0)}}function Al(r,a,c){if(a!=null&&(a=""+Vt(a),a!==r.value&&(r.value=a),c==null)){r.defaultValue!==a&&(r.defaultValue=a);return}r.defaultValue=c!=null?""+Vt(c):""}function qs(r,a,c,h){if(a==null){if(h!=null){if(c!=null)throw Error(i(92));if(j(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),a=c}c=Vt(a),r.defaultValue=c,h=r.textContent,h===c&&h!==""&&h!==null&&(r.value=h),Xn(r)}function lt(r,a){if(a){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=a;return}}r.textContent=a}var Tl=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function On(r,a,c){var h=a.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?r.setProperty(a,""):a==="float"?r.cssFloat="":r[a]="":h?r.setProperty(a,c):typeof c!="number"||c===0||Tl.has(a)?a==="float"?r.cssFloat=c:r[a]=(""+c).trim():r[a]=c+"px"}function tn(r,a,c){if(a!=null&&typeof a!="object")throw Error(i(62));if(r=r.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?r.setProperty(h,""):h==="float"?r.cssFloat="":r[h]="");for(var g in a)h=a[g],a.hasOwnProperty(g)&&c[g]!==h&&On(r,g,h)}else for(var v in a)a.hasOwnProperty(v)&&On(r,v,a[v])}function _s(r){if(r.indexOf("-")===-1)return!1;switch(r){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 Gs=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"]]),eu=/^[\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 Aa(r){return eu.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Le(){}var Xe=null;function bt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ht=null,Mn=null;function Nr(r){var a=Se(r);if(a&&(r=a.stateNode)){var c=r[Kt]||null;e:switch(r=a.stateNode,a.type){case"input":if(Ws(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),a=c.name,c.type==="radio"&&a!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Hn(""+a)+'"][type="radio"]'),a=0;a<c.length;a++){var h=c[a];if(h!==r&&h.form===r.form){var g=h[Kt]||null;if(!g)throw Error(i(90));Ws(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<c.length;a++)h=c[a],h.form===r.form&&Di(h)}break e;case"textarea":Al(r,c.value,c.defaultValue);break e;case"select":a=c.value,a!=null&&Wn(r,!!c.multiple,a,!1)}}}var tu=!1;function ph(r,a,c){if(tu)return r(a,c);tu=!0;try{var h=r(a);return h}finally{if(tu=!1,(Ht!==null||Mn!==null)&&(tf(),Ht&&(a=Ht,r=Mn,Mn=Ht=null,Nr(a),r)))for(a=0;a<r.length;a++)Nr(r[a])}}function nu(r,a){var c=r.stateNode;if(c===null)return null;var h=c[Kt]||null;if(h===null)return null;c=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)||(r=r.type,h=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!h;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(i(231,a,typeof c));return c}var Ks=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tg=!1;if(Ks)try{var iu={};Object.defineProperty(iu,"passive",{get:function(){tg=!0}}),window.addEventListener("test",iu,iu),window.removeEventListener("test",iu,iu)}catch{tg=!1}var Ta=null,ng=null,mh=null;function i1(){if(mh)return mh;var r,a=ng,c=a.length,h,g="value"in Ta?Ta.value:Ta.textContent,v=g.length;for(r=0;r<c&&a[r]===g[r];r++);var E=c-r;for(h=1;h<=E&&a[c-h]===g[v-h];h++);return mh=g.slice(r,1<h?1-h:void 0)}function gh(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function yh(){return!0}function r1(){return!1}function er(r){function a(c,h,g,v,E){this._reactName=c,this._targetInst=g,this.type=h,this.nativeEvent=v,this.target=E,this.currentTarget=null;for(var H in r)r.hasOwnProperty(H)&&(c=r[H],this[H]=c?c(v):v[H]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?yh:r1,this.isPropagationStopped=r1,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=yh)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=yh)},persist:function(){},isPersistent:yh}),a}var Mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_h=er(Mo),ru=y({},Mo,{view:0,detail:0}),yI=er(ru),ig,rg,su,vh=y({},ru,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ag,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==su&&(su&&r.type==="mousemove"?(ig=r.screenX-su.screenX,rg=r.screenY-su.screenY):rg=ig=0,su=r),ig)},movementY:function(r){return"movementY"in r?r.movementY:rg}}),s1=er(vh),_I=y({},vh,{dataTransfer:0}),vI=er(_I),bI=y({},ru,{relatedTarget:0}),sg=er(bI),wI=y({},Mo,{animationName:0,elapsedTime:0,pseudoElement:0}),SI=er(wI),xI=y({},Mo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),CI=er(xI),kI=y({},Mo,{data:0}),a1=er(kI),EI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AI={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"},TI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RI(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=TI[r])?!!a[r]:!1}function ag(){return RI}var MI=y({},ru,{key:function(r){if(r.key){var a=EI[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=gh(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?AI[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ag,charCode:function(r){return r.type==="keypress"?gh(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?gh(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),LI=er(MI),NI=y({},vh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),o1=er(NI),OI=y({},ru,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ag}),II=er(OI),DI=y({},Mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),jI=er(DI),BI=y({},vh,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),PI=er(BI),zI=y({},Mo,{newState:0,oldState:0}),$I=er(zI),FI=[9,13,27,32],og=Ks&&"CompositionEvent"in window,au=null;Ks&&"documentMode"in document&&(au=document.documentMode);var HI=Ks&&"TextEvent"in window&&!au,l1=Ks&&(!og||au&&8<au&&11>=au),c1=" ",u1=!1;function d1(r,a){switch(r){case"keyup":return FI.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function h1(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rl=!1;function UI(r,a){switch(r){case"compositionend":return h1(a);case"keypress":return a.which!==32?null:(u1=!0,c1);case"textInput":return r=a.data,r===c1&&u1?null:r;default:return null}}function WI(r,a){if(Rl)return r==="compositionend"||!og&&d1(r,a)?(r=i1(),mh=ng=Ta=null,Rl=!1,r):null;switch(r){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 l1&&a.locale!=="ko"?null:a.data;default:return null}}var qI={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 f1(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!qI[r.type]:a==="textarea"}function p1(r,a,c,h){Ht?Mn?Mn.push(h):Mn=[h]:Ht=h,a=cf(a,"onChange"),0<a.length&&(c=new _h("onChange","change",null,c,h),r.push({event:c,listeners:a}))}var ou=null,lu=null;function GI(r){XC(r,0)}function bh(r){var a=Be(r);if(Di(a))return r}function m1(r,a){if(r==="change")return a}var g1=!1;if(Ks){var lg;if(Ks){var cg="oninput"in document;if(!cg){var y1=document.createElement("div");y1.setAttribute("oninput","return;"),cg=typeof y1.oninput=="function"}lg=cg}else lg=!1;g1=lg&&(!document.documentMode||9<document.documentMode)}function _1(){ou&&(ou.detachEvent("onpropertychange",v1),lu=ou=null)}function v1(r){if(r.propertyName==="value"&&bh(lu)){var a=[];p1(a,lu,r,bt(r)),ph(GI,a)}}function KI(r,a,c){r==="focusin"?(_1(),ou=a,lu=c,ou.attachEvent("onpropertychange",v1)):r==="focusout"&&_1()}function VI(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return bh(lu)}function YI(r,a){if(r==="click")return bh(a)}function XI(r,a){if(r==="input"||r==="change")return bh(a)}function ZI(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var mr=typeof Object.is=="function"?Object.is:ZI;function cu(r,a){if(mr(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var c=Object.keys(r),h=Object.keys(a);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var g=c[h];if(!kt.call(a,g)||!mr(r[g],a[g]))return!1}return!0}function b1(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function w1(r,a){var c=b1(r);r=0;for(var h;c;){if(c.nodeType===3){if(h=r+c.textContent.length,r<=a&&h>=a)return{node:c,offset:a-r};r=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=b1(c)}}function S1(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?S1(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function x1(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var a=Zn(r.document);a instanceof r.HTMLIFrameElement;){try{var c=typeof a.contentWindow.location.href=="string"}catch{c=!1}if(c)r=a.contentWindow;else break;a=Zn(r.document)}return a}function ug(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}var JI=Ks&&"documentMode"in document&&11>=document.documentMode,Ml=null,dg=null,uu=null,hg=!1;function C1(r,a,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;hg||Ml==null||Ml!==Zn(h)||(h=Ml,"selectionStart"in h&&ug(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}),uu&&cu(uu,h)||(uu=h,h=cf(dg,"onSelect"),0<h.length&&(a=new _h("onSelect","select",null,a,c),r.push({event:a,listeners:h}),a.target=Ml)))}function Lo(r,a){var c={};return c[r.toLowerCase()]=a.toLowerCase(),c["Webkit"+r]="webkit"+a,c["Moz"+r]="moz"+a,c}var Ll={animationend:Lo("Animation","AnimationEnd"),animationiteration:Lo("Animation","AnimationIteration"),animationstart:Lo("Animation","AnimationStart"),transitionrun:Lo("Transition","TransitionRun"),transitionstart:Lo("Transition","TransitionStart"),transitioncancel:Lo("Transition","TransitionCancel"),transitionend:Lo("Transition","TransitionEnd")},fg={},k1={};Ks&&(k1=document.createElement("div").style,"AnimationEvent"in window||(delete Ll.animationend.animation,delete Ll.animationiteration.animation,delete Ll.animationstart.animation),"TransitionEvent"in window||delete Ll.transitionend.transition);function No(r){if(fg[r])return fg[r];if(!Ll[r])return r;var a=Ll[r],c;for(c in a)if(a.hasOwnProperty(c)&&c in k1)return fg[r]=a[c];return r}var E1=No("animationend"),A1=No("animationiteration"),T1=No("animationstart"),QI=No("transitionrun"),e6=No("transitionstart"),t6=No("transitioncancel"),R1=No("transitionend"),M1=new Map,pg="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(" ");pg.push("scrollEnd");function ss(r,a){M1.set(r,a),Ie(a,[r])}var wh=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Or=[],Nl=0,mg=0;function Sh(){for(var r=Nl,a=mg=Nl=0;a<r;){var c=Or[a];Or[a++]=null;var h=Or[a];Or[a++]=null;var g=Or[a];Or[a++]=null;var v=Or[a];if(Or[a++]=null,h!==null&&g!==null){var E=h.pending;E===null?g.next=g:(g.next=E.next,E.next=g),h.pending=g}v!==0&&L1(c,g,v)}}function xh(r,a,c,h){Or[Nl++]=r,Or[Nl++]=a,Or[Nl++]=c,Or[Nl++]=h,mg|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function gg(r,a,c,h){return xh(r,a,c,h),Ch(r)}function Oo(r,a){return xh(r,null,null,a),Ch(r)}function L1(r,a,c){r.lanes|=c;var h=r.alternate;h!==null&&(h.lanes|=c);for(var g=!1,v=r.return;v!==null;)v.childLanes|=c,h=v.alternate,h!==null&&(h.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(g=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,g&&a!==null&&(g=31-Ne(c),r=v.hiddenUpdates,h=r[g],h===null?r[g]=[a]:h.push(a),a.lane=c|536870912),v):null}function Ch(r){if(50<Nu)throw Nu=0,ky=null,Error(i(185));for(var a=r.return;a!==null;)r=a,a=r.return;return r.tag===3?r.stateNode:null}var Ol={};function n6(r,a,c,h){this.tag=r,this.key=c,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 gr(r,a,c,h){return new n6(r,a,c,h)}function yg(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Vs(r,a){var c=r.alternate;return c===null?(c=gr(r.tag,a,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=a,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,a=r.dependencies,c.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function N1(r,a){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=a,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,a=c.dependencies,r.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),r}function kh(r,a,c,h,g,v){var E=0;if(h=r,typeof r=="function")yg(r)&&(E=1);else if(typeof r=="string")E=oD(r,c,U.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case K:return r=gr(31,c,a,g),r.elementType=K,r.lanes=v,r;case x:return Io(c.children,g,v,a);case k:E=8,g|=24;break;case L:return r=gr(12,c,a,g|2),r.elementType=L,r.lanes=v,r;case $:return r=gr(13,c,a,g),r.elementType=$,r.lanes=v,r;case I:return r=gr(19,c,a,g),r.elementType=I,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case q:E=10;break e;case F:E=9;break e;case T:E=11;break e;case N:E=14;break e;case V:E=16,h=null;break e}E=29,c=Error(i(130,r===null?"null":typeof r,"")),h=null}return a=gr(E,c,a,g),a.elementType=r,a.type=h,a.lanes=v,a}function Io(r,a,c,h){return r=gr(7,r,h,a),r.lanes=c,r}function _g(r,a,c){return r=gr(6,r,null,a),r.lanes=c,r}function O1(r){var a=gr(18,null,null,0);return a.stateNode=r,a}function vg(r,a,c){return a=gr(4,r.children!==null?r.children:[],r.key,a),a.lanes=c,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}var I1=new WeakMap;function Ir(r,a){if(typeof r=="object"&&r!==null){var c=I1.get(r);return c!==void 0?c:(a={value:r,source:a,stack:Ot(a)},I1.set(r,a),a)}return{value:r,source:a,stack:Ot(a)}}var Il=[],Dl=0,Eh=null,du=0,Dr=[],jr=0,Ra=null,vs=1,bs="";function Ys(r,a){Il[Dl++]=du,Il[Dl++]=Eh,Eh=r,du=a}function D1(r,a,c){Dr[jr++]=vs,Dr[jr++]=bs,Dr[jr++]=Ra,Ra=r;var h=vs;r=bs;var g=32-Ne(h)-1;h&=~(1<<g),c+=1;var v=32-Ne(a)+g;if(30<v){var E=g-g%5;v=(h&(1<<E)-1).toString(32),h>>=E,g-=E,vs=1<<32-Ne(a)+g|c<<g|h,bs=v+r}else vs=1<<v|c<<g|h,bs=r}function bg(r){r.return!==null&&(Ys(r,1),D1(r,1,0))}function wg(r){for(;r===Eh;)Eh=Il[--Dl],Il[Dl]=null,du=Il[--Dl],Il[Dl]=null;for(;r===Ra;)Ra=Dr[--jr],Dr[jr]=null,bs=Dr[--jr],Dr[jr]=null,vs=Dr[--jr],Dr[jr]=null}function j1(r,a){Dr[jr++]=vs,Dr[jr++]=bs,Dr[jr++]=Ra,vs=a.id,bs=a.overflow,Ra=r}var Ci=null,vn=null,qt=!1,Ma=null,Br=!1,Sg=Error(i(519));function La(r){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw hu(Ir(a,r)),Sg}function B1(r){var a=r.stateNode,c=r.type,h=r.memoizedProps;switch(a[Ft]=r,a[Kt]=h,c){case"dialog":$t("cancel",a),$t("close",a);break;case"iframe":case"object":case"embed":$t("load",a);break;case"video":case"audio":for(c=0;c<Iu.length;c++)$t(Iu[c],a);break;case"source":$t("error",a);break;case"img":case"image":case"link":$t("error",a),$t("load",a);break;case"details":$t("toggle",a);break;case"input":$t("invalid",a),rs(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":$t("invalid",a);break;case"textarea":$t("invalid",a),qs(a,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||a.textContent===""+c||h.suppressHydrationWarning===!0||ek(a.textContent,c)?(h.popover!=null&&($t("beforetoggle",a),$t("toggle",a)),h.onScroll!=null&&$t("scroll",a),h.onScrollEnd!=null&&$t("scrollend",a),h.onClick!=null&&(a.onclick=Le),a=!0):a=!1,a||La(r,!0)}function P1(r){for(Ci=r.return;Ci;)switch(Ci.tag){case 5:case 31:case 13:Br=!1;return;case 27:case 3:Br=!0;return;default:Ci=Ci.return}}function jl(r){if(r!==Ci)return!1;if(!qt)return P1(r),qt=!0,!1;var a=r.tag,c;if((c=a!==3&&a!==27)&&((c=a===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||$y(r.type,r.memoizedProps)),c=!c),c&&vn&&La(r),P1(r),a===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));vn=ck(r)}else if(a===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));vn=ck(r)}else a===27?(a=vn,qa(r.type)?(r=qy,qy=null,vn=r):vn=a):vn=Ci?zr(r.stateNode.nextSibling):null;return!0}function Do(){vn=Ci=null,qt=!1}function xg(){var r=Ma;return r!==null&&(rr===null?rr=r:rr.push.apply(rr,r),Ma=null),r}function hu(r){Ma===null?Ma=[r]:Ma.push(r)}var Cg=R(null),jo=null,Xs=null;function Na(r,a,c){G(Cg,a._currentValue),a._currentValue=c}function Zs(r){r._currentValue=Cg.current,W(Cg)}function kg(r,a,c){for(;r!==null;){var h=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),r===c)break;r=r.return}}function Eg(r,a,c,h){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var v=g.dependencies;if(v!==null){var E=g.child;v=v.firstContext;e:for(;v!==null;){var H=v;v=g;for(var J=0;J<a.length;J++)if(H.context===a[J]){v.lanes|=c,H=v.alternate,H!==null&&(H.lanes|=c),kg(v.return,c,r),h||(E=null);break e}v=H.next}}else if(g.tag===18){if(E=g.return,E===null)throw Error(i(341));E.lanes|=c,v=E.alternate,v!==null&&(v.lanes|=c),kg(E,c,r),E=null}else E=g.child;if(E!==null)E.return=g;else for(E=g;E!==null;){if(E===r){E=null;break}if(g=E.sibling,g!==null){g.return=E.return,E=g;break}E=E.return}g=E}}function Bl(r,a,c,h){r=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 E=g.alternate;if(E===null)throw Error(i(387));if(E=E.memoizedProps,E!==null){var H=g.type;mr(g.pendingProps.value,E.value)||(r!==null?r.push(H):r=[H])}}else if(g===me.current){if(E=g.alternate,E===null)throw Error(i(387));E.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(r!==null?r.push(zu):r=[zu])}g=g.return}r!==null&&Eg(a,r,c,h),a.flags|=262144}function Ah(r){for(r=r.firstContext;r!==null;){if(!mr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Bo(r){jo=r,Xs=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function ki(r){return z1(jo,r)}function Th(r,a){return jo===null&&Bo(r),z1(r,a)}function z1(r,a){var c=a._currentValue;if(a={context:a,memoizedValue:c,next:null},Xs===null){if(r===null)throw Error(i(308));Xs=a,r.dependencies={lanes:0,firstContext:a},r.flags|=524288}else Xs=Xs.next=a;return c}var i6=typeof AbortController<"u"?AbortController:function(){var r=[],a=this.signal={aborted:!1,addEventListener:function(c,h){r.push(h)}};this.abort=function(){a.aborted=!0,r.forEach(function(c){return c()})}},r6=e.unstable_scheduleCallback,s6=e.unstable_NormalPriority,Jn={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ag(){return{controller:new i6,data:new Map,refCount:0}}function fu(r){r.refCount--,r.refCount===0&&r6(s6,function(){r.controller.abort()})}var pu=null,Tg=0,Pl=0,zl=null;function a6(r,a){if(pu===null){var c=pu=[];Tg=0,Pl=Ly(),zl={status:"pending",value:void 0,then:function(h){c.push(h)}}}return Tg++,a.then($1,$1),a}function $1(){if(--Tg===0&&pu!==null){zl!==null&&(zl.status="fulfilled");var r=pu;pu=null,Pl=0,zl=null;for(var a=0;a<r.length;a++)(0,r[a])()}}function o6(r,a){var c=[],h={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return r.then(function(){h.status="fulfilled",h.value=a;for(var g=0;g<c.length;g++)(0,c[g])(a)},function(g){for(h.status="rejected",h.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),h}var F1=A.S;A.S=function(r,a){CC=Ke(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&a6(r,a),F1!==null&&F1(r,a)};var Po=R(null);function Rg(){var r=Po.current;return r!==null?r:gn.pooledCache}function Rh(r,a){a===null?G(Po,Po.current):G(Po,a.pool)}function H1(){var r=Rg();return r===null?null:{parent:Jn._currentValue,pool:r}}var $l=Error(i(460)),Mg=Error(i(474)),Mh=Error(i(542)),Lh={then:function(){}};function U1(r){return r=r.status,r==="fulfilled"||r==="rejected"}function W1(r,a,c){switch(c=r[c],c===void 0?r.push(a):c!==a&&(a.then(Le,Le),a=c),a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,G1(r),r;default:if(typeof a.status=="string")a.then(Le,Le);else{if(r=gn,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=a,r.status="pending",r.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 r=a.reason,G1(r),r}throw $o=a,$l}}function zo(r){try{var a=r._init;return a(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?($o=c,$l):c}}var $o=null;function q1(){if($o===null)throw Error(i(459));var r=$o;return $o=null,r}function G1(r){if(r===$l||r===Mh)throw Error(i(483))}var Fl=null,mu=0;function Nh(r){var a=mu;return mu+=1,Fl===null&&(Fl=[]),W1(Fl,r,a)}function gu(r,a){a=a.props.ref,r.ref=a!==void 0?a:null}function Oh(r,a){throw a.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(a),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r)))}function K1(r){function a(re,te){if(r){var le=re.deletions;le===null?(re.deletions=[te],re.flags|=16):le.push(te)}}function c(re,te){if(!r)return null;for(;te!==null;)a(re,te),te=te.sibling;return null}function h(re){for(var te=new Map;re!==null;)re.key!==null?te.set(re.key,re):te.set(re.index,re),re=re.sibling;return te}function g(re,te){return re=Vs(re,te),re.index=0,re.sibling=null,re}function v(re,te,le){return re.index=le,r?(le=re.alternate,le!==null?(le=le.index,le<te?(re.flags|=67108866,te):le):(re.flags|=67108866,te)):(re.flags|=1048576,te)}function E(re){return r&&re.alternate===null&&(re.flags|=67108866),re}function H(re,te,le,be){return te===null||te.tag!==6?(te=_g(le,re.mode,be),te.return=re,te):(te=g(te,le),te.return=re,te)}function J(re,te,le,be){var it=le.type;return it===x?_e(re,te,le.props.children,be,le.key):te!==null&&(te.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===V&&zo(it)===te.type)?(te=g(te,le.props),gu(te,le),te.return=re,te):(te=kh(le.type,le.key,le.props,null,re.mode,be),gu(te,le),te.return=re,te)}function ce(re,te,le,be){return te===null||te.tag!==4||te.stateNode.containerInfo!==le.containerInfo||te.stateNode.implementation!==le.implementation?(te=vg(le,re.mode,be),te.return=re,te):(te=g(te,le.children||[]),te.return=re,te)}function _e(re,te,le,be,it){return te===null||te.tag!==7?(te=Io(le,re.mode,be,it),te.return=re,te):(te=g(te,le),te.return=re,te)}function xe(re,te,le){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=_g(""+te,re.mode,le),te.return=re,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case w:return le=kh(te.type,te.key,te.props,null,re.mode,le),gu(le,te),le.return=re,le;case S:return te=vg(te,re.mode,le),te.return=re,te;case V:return te=zo(te),xe(re,te,le)}if(j(te)||B(te))return te=Io(te,re.mode,le,null),te.return=re,te;if(typeof te.then=="function")return xe(re,Nh(te),le);if(te.$$typeof===q)return xe(re,Th(re,te),le);Oh(re,te)}return null}function ue(re,te,le,be){var it=te!==null?te.key:null;if(typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint")return it!==null?null:H(re,te,""+le,be);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case w:return le.key===it?J(re,te,le,be):null;case S:return le.key===it?ce(re,te,le,be):null;case V:return le=zo(le),ue(re,te,le,be)}if(j(le)||B(le))return it!==null?null:_e(re,te,le,be,null);if(typeof le.then=="function")return ue(re,te,Nh(le),be);if(le.$$typeof===q)return ue(re,te,Th(re,le),be);Oh(re,le)}return null}function pe(re,te,le,be,it){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return re=re.get(le)||null,H(te,re,""+be,it);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case w:return re=re.get(be.key===null?le:be.key)||null,J(te,re,be,it);case S:return re=re.get(be.key===null?le:be.key)||null,ce(te,re,be,it);case V:return be=zo(be),pe(re,te,le,be,it)}if(j(be)||B(be))return re=re.get(le)||null,_e(te,re,be,it,null);if(typeof be.then=="function")return pe(re,te,le,Nh(be),it);if(be.$$typeof===q)return pe(re,te,le,Th(te,be),it);Oh(te,be)}return null}function Ve(re,te,le,be){for(var it=null,Yt=null,Ze=te,Et=te=0,Wt=null;Ze!==null&&Et<le.length;Et++){Ze.index>Et?(Wt=Ze,Ze=null):Wt=Ze.sibling;var Xt=ue(re,Ze,le[Et],be);if(Xt===null){Ze===null&&(Ze=Wt);break}r&&Ze&&Xt.alternate===null&&a(re,Ze),te=v(Xt,te,Et),Yt===null?it=Xt:Yt.sibling=Xt,Yt=Xt,Ze=Wt}if(Et===le.length)return c(re,Ze),qt&&Ys(re,Et),it;if(Ze===null){for(;Et<le.length;Et++)Ze=xe(re,le[Et],be),Ze!==null&&(te=v(Ze,te,Et),Yt===null?it=Ze:Yt.sibling=Ze,Yt=Ze);return qt&&Ys(re,Et),it}for(Ze=h(Ze);Et<le.length;Et++)Wt=pe(Ze,re,Et,le[Et],be),Wt!==null&&(r&&Wt.alternate!==null&&Ze.delete(Wt.key===null?Et:Wt.key),te=v(Wt,te,Et),Yt===null?it=Wt:Yt.sibling=Wt,Yt=Wt);return r&&Ze.forEach(function(Xa){return a(re,Xa)}),qt&&Ys(re,Et),it}function ct(re,te,le,be){if(le==null)throw Error(i(151));for(var it=null,Yt=null,Ze=te,Et=te=0,Wt=null,Xt=le.next();Ze!==null&&!Xt.done;Et++,Xt=le.next()){Ze.index>Et?(Wt=Ze,Ze=null):Wt=Ze.sibling;var Xa=ue(re,Ze,Xt.value,be);if(Xa===null){Ze===null&&(Ze=Wt);break}r&&Ze&&Xa.alternate===null&&a(re,Ze),te=v(Xa,te,Et),Yt===null?it=Xa:Yt.sibling=Xa,Yt=Xa,Ze=Wt}if(Xt.done)return c(re,Ze),qt&&Ys(re,Et),it;if(Ze===null){for(;!Xt.done;Et++,Xt=le.next())Xt=xe(re,Xt.value,be),Xt!==null&&(te=v(Xt,te,Et),Yt===null?it=Xt:Yt.sibling=Xt,Yt=Xt);return qt&&Ys(re,Et),it}for(Ze=h(Ze);!Xt.done;Et++,Xt=le.next())Xt=pe(Ze,re,Et,Xt.value,be),Xt!==null&&(r&&Xt.alternate!==null&&Ze.delete(Xt.key===null?Et:Xt.key),te=v(Xt,te,Et),Yt===null?it=Xt:Yt.sibling=Xt,Yt=Xt);return r&&Ze.forEach(function(_D){return a(re,_D)}),qt&&Ys(re,Et),it}function dn(re,te,le,be){if(typeof le=="object"&&le!==null&&le.type===x&&le.key===null&&(le=le.props.children),typeof le=="object"&&le!==null){switch(le.$$typeof){case w:e:{for(var it=le.key;te!==null;){if(te.key===it){if(it=le.type,it===x){if(te.tag===7){c(re,te.sibling),be=g(te,le.props.children),be.return=re,re=be;break e}}else if(te.elementType===it||typeof it=="object"&&it!==null&&it.$$typeof===V&&zo(it)===te.type){c(re,te.sibling),be=g(te,le.props),gu(be,le),be.return=re,re=be;break e}c(re,te);break}else a(re,te);te=te.sibling}le.type===x?(be=Io(le.props.children,re.mode,be,le.key),be.return=re,re=be):(be=kh(le.type,le.key,le.props,null,re.mode,be),gu(be,le),be.return=re,re=be)}return E(re);case S:e:{for(it=le.key;te!==null;){if(te.key===it)if(te.tag===4&&te.stateNode.containerInfo===le.containerInfo&&te.stateNode.implementation===le.implementation){c(re,te.sibling),be=g(te,le.children||[]),be.return=re,re=be;break e}else{c(re,te);break}else a(re,te);te=te.sibling}be=vg(le,re.mode,be),be.return=re,re=be}return E(re);case V:return le=zo(le),dn(re,te,le,be)}if(j(le))return Ve(re,te,le,be);if(B(le)){if(it=B(le),typeof it!="function")throw Error(i(150));return le=it.call(le),ct(re,te,le,be)}if(typeof le.then=="function")return dn(re,te,Nh(le),be);if(le.$$typeof===q)return dn(re,te,Th(re,le),be);Oh(re,le)}return typeof le=="string"&&le!==""||typeof le=="number"||typeof le=="bigint"?(le=""+le,te!==null&&te.tag===6?(c(re,te.sibling),be=g(te,le),be.return=re,re=be):(c(re,te),be=_g(le,re.mode,be),be.return=re,re=be),E(re)):c(re,te)}return function(re,te,le,be){try{mu=0;var it=dn(re,te,le,be);return Fl=null,it}catch(Ze){if(Ze===$l||Ze===Mh)throw Ze;var Yt=gr(29,Ze,null,re.mode);return Yt.lanes=be,Yt.return=re,Yt}}}var Fo=K1(!0),V1=K1(!1),Oa=!1;function Lg(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ng(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Ia(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Da(r,a,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(nn&2)!==0){var g=h.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),h.pending=a,a=Ch(r),L1(r,null,c),a}return xh(r,h,a,c),Ch(r)}function yu(r,a,c){if(a=a.updateQueue,a!==null&&(a=a.shared,(c&4194048)!==0)){var h=a.lanes;h&=r.pendingLanes,c|=h,a.lanes=c,Qe(r,c)}}function Og(r,a){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=E:v=v.next=E,c=c.next}while(c!==null);v===null?g=v=a:v=v.next=a}else g=v=a;c={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=a:r.next=a,c.lastBaseUpdate=a}var Ig=!1;function _u(){if(Ig){var r=zl;if(r!==null)throw r}}function vu(r,a,c,h){Ig=!1;var g=r.updateQueue;Oa=!1;var v=g.firstBaseUpdate,E=g.lastBaseUpdate,H=g.shared.pending;if(H!==null){g.shared.pending=null;var J=H,ce=J.next;J.next=null,E===null?v=ce:E.next=ce,E=J;var _e=r.alternate;_e!==null&&(_e=_e.updateQueue,H=_e.lastBaseUpdate,H!==E&&(H===null?_e.firstBaseUpdate=ce:H.next=ce,_e.lastBaseUpdate=J))}if(v!==null){var xe=g.baseState;E=0,_e=ce=J=null,H=v;do{var ue=H.lane&-536870913,pe=ue!==H.lane;if(pe?(Ut&ue)===ue:(h&ue)===ue){ue!==0&&ue===Pl&&(Ig=!0),_e!==null&&(_e=_e.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Ve=r,ct=H;ue=a;var dn=c;switch(ct.tag){case 1:if(Ve=ct.payload,typeof Ve=="function"){xe=Ve.call(dn,xe,ue);break e}xe=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=ct.payload,ue=typeof Ve=="function"?Ve.call(dn,xe,ue):Ve,ue==null)break e;xe=y({},xe,ue);break e;case 2:Oa=!0}}ue=H.callback,ue!==null&&(r.flags|=64,pe&&(r.flags|=8192),pe=g.callbacks,pe===null?g.callbacks=[ue]:pe.push(ue))}else pe={lane:ue,tag:H.tag,payload:H.payload,callback:H.callback,next:null},_e===null?(ce=_e=pe,J=xe):_e=_e.next=pe,E|=ue;if(H=H.next,H===null){if(H=g.shared.pending,H===null)break;pe=H,H=pe.next,pe.next=null,g.lastBaseUpdate=pe,g.shared.pending=null}}while(!0);_e===null&&(J=xe),g.baseState=J,g.firstBaseUpdate=ce,g.lastBaseUpdate=_e,v===null&&(g.shared.lanes=0),$a|=E,r.lanes=E,r.memoizedState=xe}}function Y1(r,a){if(typeof r!="function")throw Error(i(191,r));r.call(a)}function X1(r,a){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)Y1(c[r],a)}var Hl=R(null),Ih=R(0);function Z1(r,a){r=aa,G(Ih,r),G(Hl,a),aa=r|a.baseLanes}function Dg(){G(Ih,aa),G(Hl,Hl.current)}function jg(){aa=Ih.current,W(Hl),W(Ih)}var yr=R(null),Pr=null;function ja(r){var a=r.alternate;G(qn,qn.current&1),G(yr,r),Pr===null&&(a===null||Hl.current!==null||a.memoizedState!==null)&&(Pr=r)}function Bg(r){G(qn,qn.current),G(yr,r),Pr===null&&(Pr=r)}function J1(r){r.tag===22?(G(qn,qn.current),G(yr,r),Pr===null&&(Pr=r)):Ba()}function Ba(){G(qn,qn.current),G(yr,yr.current)}function _r(r){W(yr),Pr===r&&(Pr=null),W(qn)}var qn=R(0);function Dh(r){for(var a=r;a!==null;){if(a.tag===13){var c=a.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Uy(c)||Wy(c)))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===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Js=0,Ct=null,cn=null,Qn=null,jh=!1,Ul=!1,Ho=!1,Bh=0,bu=0,Wl=null,l6=0;function In(){throw Error(i(321))}function Pg(r,a){if(a===null)return!1;for(var c=0;c<a.length&&c<r.length;c++)if(!mr(r[c],a[c]))return!1;return!0}function zg(r,a,c,h,g,v){return Js=v,Ct=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=r===null||r.memoizedState===null?Dx:ey,Ho=!1,v=c(h,g),Ho=!1,Ul&&(v=ex(a,c,h,g)),Q1(r),v}function Q1(r){A.H=xu;var a=cn!==null&&cn.next!==null;if(Js=0,Qn=cn=Ct=null,jh=!1,bu=0,Wl=null,a)throw Error(i(300));r===null||ei||(r=r.dependencies,r!==null&&Ah(r)&&(ei=!0))}function ex(r,a,c,h){Ct=r;var g=0;do{if(Ul&&(Wl=null),bu=0,Ul=!1,25<=g)throw Error(i(301));if(g+=1,Qn=cn=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}A.H=jx,v=a(c,h)}while(Ul);return v}function c6(){var r=A.H,a=r.useState()[0];return a=typeof a.then=="function"?wu(a):a,r=r.useState()[0],(cn!==null?cn.memoizedState:null)!==r&&(Ct.flags|=1024),a}function $g(){var r=Bh!==0;return Bh=0,r}function Fg(r,a,c){a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~c}function Hg(r){if(jh){for(r=r.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}jh=!1}Js=0,Qn=cn=Ct=null,Ul=!1,bu=Bh=0,Wl=null}function Fi(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qn===null?Ct.memoizedState=Qn=r:Qn=Qn.next=r,Qn}function Gn(){if(cn===null){var r=Ct.alternate;r=r!==null?r.memoizedState:null}else r=cn.next;var a=Qn===null?Ct.memoizedState:Qn.next;if(a!==null)Qn=a,cn=r;else{if(r===null)throw Ct.alternate===null?Error(i(467)):Error(i(310));cn=r,r={memoizedState:cn.memoizedState,baseState:cn.baseState,baseQueue:cn.baseQueue,queue:cn.queue,next:null},Qn===null?Ct.memoizedState=Qn=r:Qn=Qn.next=r}return Qn}function Ph(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function wu(r){var a=bu;return bu+=1,Wl===null&&(Wl=[]),r=W1(Wl,r,a),a=Ct,(Qn===null?a.memoizedState:Qn.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?Dx:ey),r}function zh(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return wu(r);if(r.$$typeof===q)return ki(r)}throw Error(i(438,String(r)))}function Ug(r){var a=null,c=Ct.updateQueue;if(c!==null&&(a=c.memoCache),a==null){var h=Ct.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),c===null&&(c=Ph(),Ct.updateQueue=c),c.memoCache=a,c=a.data[a.index],c===void 0)for(c=a.data[a.index]=Array(r),h=0;h<r;h++)c[h]=Q;return a.index++,c}function Qs(r,a){return typeof a=="function"?a(r):a}function $h(r){var a=Gn();return Wg(a,cn,r)}function Wg(r,a,c){var h=r.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var g=r.baseQueue,v=h.pending;if(v!==null){if(g!==null){var E=g.next;g.next=v.next,v.next=E}a.baseQueue=g=v,h.pending=null}if(v=r.baseState,g===null)r.memoizedState=v;else{a=g.next;var H=E=null,J=null,ce=a,_e=!1;do{var xe=ce.lane&-536870913;if(xe!==ce.lane?(Ut&xe)===xe:(Js&xe)===xe){var ue=ce.revertLane;if(ue===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),xe===Pl&&(_e=!0);else if((Js&ue)===ue){ce=ce.next,ue===Pl&&(_e=!0);continue}else xe={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},J===null?(H=J=xe,E=v):J=J.next=xe,Ct.lanes|=ue,$a|=ue;xe=ce.action,Ho&&c(v,xe),v=ce.hasEagerState?ce.eagerState:c(v,xe)}else ue={lane:xe,revertLane:ce.revertLane,gesture:ce.gesture,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},J===null?(H=J=ue,E=v):J=J.next=ue,Ct.lanes|=xe,$a|=xe;ce=ce.next}while(ce!==null&&ce!==a);if(J===null?E=v:J.next=H,!mr(v,r.memoizedState)&&(ei=!0,_e&&(c=zl,c!==null)))throw c;r.memoizedState=v,r.baseState=E,r.baseQueue=J,h.lastRenderedState=v}return g===null&&(h.lanes=0),[r.memoizedState,h.dispatch]}function qg(r){var a=Gn(),c=a.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var h=c.dispatch,g=c.pending,v=a.memoizedState;if(g!==null){c.pending=null;var E=g=g.next;do v=r(v,E.action),E=E.next;while(E!==g);mr(v,a.memoizedState)||(ei=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),c.lastRenderedState=v}return[v,h]}function tx(r,a,c){var h=Ct,g=Gn(),v=qt;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=a();var E=!mr((cn||g).memoizedState,c);if(E&&(g.memoizedState=c,ei=!0),g=g.queue,Vg(rx.bind(null,h,g,r),[r]),g.getSnapshot!==a||E||Qn!==null&&Qn.memoizedState.tag&1){if(h.flags|=2048,ql(9,{destroy:void 0},ix.bind(null,h,g,c,a),null),gn===null)throw Error(i(349));v||(Js&127)!==0||nx(h,a,c)}return c}function nx(r,a,c){r.flags|=16384,r={getSnapshot:a,value:c},a=Ct.updateQueue,a===null?(a=Ph(),Ct.updateQueue=a,a.stores=[r]):(c=a.stores,c===null?a.stores=[r]:c.push(r))}function ix(r,a,c,h){a.value=c,a.getSnapshot=h,sx(a)&&ax(r)}function rx(r,a,c){return c(function(){sx(a)&&ax(r)})}function sx(r){var a=r.getSnapshot;r=r.value;try{var c=a();return!mr(r,c)}catch{return!0}}function ax(r){var a=Oo(r,2);a!==null&&sr(a,r,2)}function Gg(r){var a=Fi();if(typeof r=="function"){var c=r;if(r=c(),Ho){Tt(!0);try{c()}finally{Tt(!1)}}}return a.memoizedState=a.baseState=r,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:r},a}function ox(r,a,c,h){return r.baseState=c,Wg(r,cn,typeof h=="function"?h:Qs)}function u6(r,a,c,h,g){if(Uh(r))throw Error(i(485));if(r=a.action,r!==null){var v={payload:g,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){v.listeners.push(E)}};A.T!==null?c(!0):v.isTransition=!1,h(v),c=a.pending,c===null?(v.next=a.pending=v,lx(a,v)):(v.next=c.next,a.pending=c.next=v)}}function lx(r,a){var c=a.action,h=a.payload,g=r.state;if(a.isTransition){var v=A.T,E={};A.T=E;try{var H=c(g,h),J=A.S;J!==null&&J(E,H),cx(r,a,H)}catch(ce){Kg(r,a,ce)}finally{v!==null&&E.types!==null&&(v.types=E.types),A.T=v}}else try{v=c(g,h),cx(r,a,v)}catch(ce){Kg(r,a,ce)}}function cx(r,a,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){ux(r,a,h)},function(h){return Kg(r,a,h)}):ux(r,a,c)}function ux(r,a,c){a.status="fulfilled",a.value=c,dx(a),r.state=c,a=r.pending,a!==null&&(c=a.next,c===a?r.pending=null:(c=c.next,a.next=c,lx(r,c)))}function Kg(r,a,c){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=c,dx(a),a=a.next;while(a!==h)}r.action=null}function dx(r){r=r.listeners;for(var a=0;a<r.length;a++)(0,r[a])()}function hx(r,a){return a}function fx(r,a){if(qt){var c=gn.formState;if(c!==null){e:{var h=Ct;if(qt){if(vn){t:{for(var g=vn,v=Br;g.nodeType!==8;){if(!v){g=null;break t}if(g=zr(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){vn=zr(g.nextSibling),h=g.data==="F!";break e}}La(h)}h=!1}h&&(a=c[0])}}return c=Fi(),c.memoizedState=c.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:hx,lastRenderedState:a},c.queue=h,c=Nx.bind(null,Ct,h),h.dispatch=c,h=Gg(!1),v=Qg.bind(null,Ct,!1,h.queue),h=Fi(),g={state:a,dispatch:null,action:r,pending:null},h.queue=g,c=u6.bind(null,Ct,g,v,c),g.dispatch=c,h.memoizedState=r,[a,c,!1]}function px(r){var a=Gn();return mx(a,cn,r)}function mx(r,a,c){if(a=Wg(r,a,hx)[0],r=$h(Qs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=wu(a)}catch(E){throw E===$l?Mh:E}else h=a;a=Gn();var g=a.queue,v=g.dispatch;return c!==a.memoizedState&&(Ct.flags|=2048,ql(9,{destroy:void 0},d6.bind(null,g,c),null)),[h,v,r]}function d6(r,a){r.action=a}function gx(r){var a=Gn(),c=cn;if(c!==null)return mx(a,c,r);Gn(),a=a.memoizedState,c=Gn();var h=c.queue.dispatch;return c.memoizedState=r,[a,h,!1]}function ql(r,a,c,h){return r={tag:r,create:c,deps:h,inst:a,next:null},a=Ct.updateQueue,a===null&&(a=Ph(),Ct.updateQueue=a),c=a.lastEffect,c===null?a.lastEffect=r.next=r:(h=c.next,c.next=r,r.next=h,a.lastEffect=r),r}function yx(){return Gn().memoizedState}function Fh(r,a,c,h){var g=Fi();Ct.flags|=r,g.memoizedState=ql(1|a,{destroy:void 0},c,h===void 0?null:h)}function Hh(r,a,c,h){var g=Gn();h=h===void 0?null:h;var v=g.memoizedState.inst;cn!==null&&h!==null&&Pg(h,cn.memoizedState.deps)?g.memoizedState=ql(a,v,c,h):(Ct.flags|=r,g.memoizedState=ql(1|a,v,c,h))}function _x(r,a){Fh(8390656,8,r,a)}function Vg(r,a){Hh(2048,8,r,a)}function h6(r){Ct.flags|=4;var a=Ct.updateQueue;if(a===null)a=Ph(),Ct.updateQueue=a,a.events=[r];else{var c=a.events;c===null?a.events=[r]:c.push(r)}}function vx(r){var a=Gn().memoizedState;return h6({ref:a,nextImpl:r}),function(){if((nn&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function bx(r,a){return Hh(4,2,r,a)}function wx(r,a){return Hh(4,4,r,a)}function Sx(r,a){if(typeof a=="function"){r=r();var c=a(r);return function(){typeof c=="function"?c():a(null)}}if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function xx(r,a,c){c=c!=null?c.concat([r]):null,Hh(4,4,Sx.bind(null,a,r),c)}function Yg(){}function Cx(r,a){var c=Gn();a=a===void 0?null:a;var h=c.memoizedState;return a!==null&&Pg(a,h[1])?h[0]:(c.memoizedState=[r,a],r)}function kx(r,a){var c=Gn();a=a===void 0?null:a;var h=c.memoizedState;if(a!==null&&Pg(a,h[1]))return h[0];if(h=r(),Ho){Tt(!0);try{r()}finally{Tt(!1)}}return c.memoizedState=[h,a],h}function Xg(r,a,c){return c===void 0||(Js&1073741824)!==0&&(Ut&261930)===0?r.memoizedState=a:(r.memoizedState=c,r=EC(),Ct.lanes|=r,$a|=r,c)}function Ex(r,a,c,h){return mr(c,a)?c:Hl.current!==null?(r=Xg(r,c,h),mr(r,a)||(ei=!0),r):(Js&42)===0||(Js&1073741824)!==0&&(Ut&261930)===0?(ei=!0,r.memoizedState=c):(r=EC(),Ct.lanes|=r,$a|=r,a)}function Ax(r,a,c,h,g){var v=O.p;O.p=v!==0&&8>v?v:8;var E=A.T,H={};A.T=H,Qg(r,!1,a,c);try{var J=g(),ce=A.S;if(ce!==null&&ce(H,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var _e=o6(J,h);Su(r,a,_e,wr(r))}else Su(r,a,h,wr(r))}catch(xe){Su(r,a,{then:function(){},status:"rejected",reason:xe},wr())}finally{O.p=v,E!==null&&H.types!==null&&(E.types=H.types),A.T=E}}function f6(){}function Zg(r,a,c,h){if(r.tag!==5)throw Error(i(476));var g=Tx(r).queue;Ax(r,g,a,C,c===null?f6:function(){return Rx(r),c(h)})}function Tx(r){var a=r.memoizedState;if(a!==null)return a;a={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:C},next:null};var c={};return a.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qs,lastRenderedState:c},next:null},r.memoizedState=a,r=r.alternate,r!==null&&(r.memoizedState=a),a}function Rx(r){var a=Tx(r);a.next===null&&(a=r.alternate.memoizedState),Su(r,a.next.queue,{},wr())}function Jg(){return ki(zu)}function Mx(){return Gn().memoizedState}function Lx(){return Gn().memoizedState}function p6(r){for(var a=r.return;a!==null;){switch(a.tag){case 24:case 3:var c=wr();r=Ia(c);var h=Da(a,r,c);h!==null&&(sr(h,a,c),yu(h,a,c)),a={cache:Ag()},r.payload=a;return}a=a.return}}function m6(r,a,c){var h=wr();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Uh(r)?Ox(a,c):(c=gg(r,a,c,h),c!==null&&(sr(c,r,h),Ix(c,a,h)))}function Nx(r,a,c){var h=wr();Su(r,a,c,h)}function Su(r,a,c,h){var g={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Uh(r))Ox(a,g);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var E=a.lastRenderedState,H=v(E,c);if(g.hasEagerState=!0,g.eagerState=H,mr(H,E))return xh(r,a,g,0),gn===null&&Sh(),!1}catch{}if(c=gg(r,a,g,h),c!==null)return sr(c,r,h),Ix(c,a,h),!0}return!1}function Qg(r,a,c,h){if(h={lane:2,revertLane:Ly(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Uh(r)){if(a)throw Error(i(479))}else a=gg(r,c,h,2),a!==null&&sr(a,r,2)}function Uh(r){var a=r.alternate;return r===Ct||a!==null&&a===Ct}function Ox(r,a){Ul=jh=!0;var c=r.pending;c===null?a.next=a:(a.next=c.next,c.next=a),r.pending=a}function Ix(r,a,c){if((c&4194048)!==0){var h=a.lanes;h&=r.pendingLanes,c|=h,a.lanes=c,Qe(r,c)}}var xu={readContext:ki,use:zh,useCallback:In,useContext:In,useEffect:In,useImperativeHandle:In,useLayoutEffect:In,useInsertionEffect:In,useMemo:In,useReducer:In,useRef:In,useState:In,useDebugValue:In,useDeferredValue:In,useTransition:In,useSyncExternalStore:In,useId:In,useHostTransitionStatus:In,useFormState:In,useActionState:In,useOptimistic:In,useMemoCache:In,useCacheRefresh:In};xu.useEffectEvent=In;var Dx={readContext:ki,use:zh,useCallback:function(r,a){return Fi().memoizedState=[r,a===void 0?null:a],r},useContext:ki,useEffect:_x,useImperativeHandle:function(r,a,c){c=c!=null?c.concat([r]):null,Fh(4194308,4,Sx.bind(null,a,r),c)},useLayoutEffect:function(r,a){return Fh(4194308,4,r,a)},useInsertionEffect:function(r,a){Fh(4,2,r,a)},useMemo:function(r,a){var c=Fi();a=a===void 0?null:a;var h=r();if(Ho){Tt(!0);try{r()}finally{Tt(!1)}}return c.memoizedState=[h,a],h},useReducer:function(r,a,c){var h=Fi();if(c!==void 0){var g=c(a);if(Ho){Tt(!0);try{c(a)}finally{Tt(!1)}}}else g=a;return h.memoizedState=h.baseState=g,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:g},h.queue=r,r=r.dispatch=m6.bind(null,Ct,r),[h.memoizedState,r]},useRef:function(r){var a=Fi();return r={current:r},a.memoizedState=r},useState:function(r){r=Gg(r);var a=r.queue,c=Nx.bind(null,Ct,a);return a.dispatch=c,[r.memoizedState,c]},useDebugValue:Yg,useDeferredValue:function(r,a){var c=Fi();return Xg(c,r,a)},useTransition:function(){var r=Gg(!1);return r=Ax.bind(null,Ct,r.queue,!0,!1),Fi().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,a,c){var h=Ct,g=Fi();if(qt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=a(),gn===null)throw Error(i(349));(Ut&127)!==0||nx(h,a,c)}g.memoizedState=c;var v={value:c,getSnapshot:a};return g.queue=v,_x(rx.bind(null,h,v,r),[r]),h.flags|=2048,ql(9,{destroy:void 0},ix.bind(null,h,v,c,a),null),c},useId:function(){var r=Fi(),a=gn.identifierPrefix;if(qt){var c=bs,h=vs;c=(h&~(1<<32-Ne(h)-1)).toString(32)+c,a="_"+a+"R_"+c,c=Bh++,0<c&&(a+="H"+c.toString(32)),a+="_"}else c=l6++,a="_"+a+"r_"+c.toString(32)+"_";return r.memoizedState=a},useHostTransitionStatus:Jg,useFormState:fx,useActionState:fx,useOptimistic:function(r){var a=Fi();a.memoizedState=a.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=c,a=Qg.bind(null,Ct,!0,c),c.dispatch=a,[r,a]},useMemoCache:Ug,useCacheRefresh:function(){return Fi().memoizedState=p6.bind(null,Ct)},useEffectEvent:function(r){var a=Fi(),c={impl:r};return a.memoizedState=c,function(){if((nn&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},ey={readContext:ki,use:zh,useCallback:Cx,useContext:ki,useEffect:Vg,useImperativeHandle:xx,useInsertionEffect:bx,useLayoutEffect:wx,useMemo:kx,useReducer:$h,useRef:yx,useState:function(){return $h(Qs)},useDebugValue:Yg,useDeferredValue:function(r,a){var c=Gn();return Ex(c,cn.memoizedState,r,a)},useTransition:function(){var r=$h(Qs)[0],a=Gn().memoizedState;return[typeof r=="boolean"?r:wu(r),a]},useSyncExternalStore:tx,useId:Mx,useHostTransitionStatus:Jg,useFormState:px,useActionState:px,useOptimistic:function(r,a){var c=Gn();return ox(c,cn,r,a)},useMemoCache:Ug,useCacheRefresh:Lx};ey.useEffectEvent=vx;var jx={readContext:ki,use:zh,useCallback:Cx,useContext:ki,useEffect:Vg,useImperativeHandle:xx,useInsertionEffect:bx,useLayoutEffect:wx,useMemo:kx,useReducer:qg,useRef:yx,useState:function(){return qg(Qs)},useDebugValue:Yg,useDeferredValue:function(r,a){var c=Gn();return cn===null?Xg(c,r,a):Ex(c,cn.memoizedState,r,a)},useTransition:function(){var r=qg(Qs)[0],a=Gn().memoizedState;return[typeof r=="boolean"?r:wu(r),a]},useSyncExternalStore:tx,useId:Mx,useHostTransitionStatus:Jg,useFormState:gx,useActionState:gx,useOptimistic:function(r,a){var c=Gn();return cn!==null?ox(c,cn,r,a):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Ug,useCacheRefresh:Lx};jx.useEffectEvent=vx;function ty(r,a,c,h){a=r.memoizedState,c=c(h,a),c=c==null?a:y({},a,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var ny={enqueueSetState:function(r,a,c){r=r._reactInternals;var h=wr(),g=Ia(h);g.payload=a,c!=null&&(g.callback=c),a=Da(r,g,h),a!==null&&(sr(a,r,h),yu(a,r,h))},enqueueReplaceState:function(r,a,c){r=r._reactInternals;var h=wr(),g=Ia(h);g.tag=1,g.payload=a,c!=null&&(g.callback=c),a=Da(r,g,h),a!==null&&(sr(a,r,h),yu(a,r,h))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var c=wr(),h=Ia(c);h.tag=2,a!=null&&(h.callback=a),a=Da(r,h,c),a!==null&&(sr(a,r,c),yu(a,r,c))}};function Bx(r,a,c,h,g,v,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(h,v,E):a.prototype&&a.prototype.isPureReactComponent?!cu(c,h)||!cu(g,v):!0}function Px(r,a,c,h){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(c,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(c,h),a.state!==r&&ny.enqueueReplaceState(a,a.state,null)}function Uo(r,a){var c=a;if("ref"in a){c={};for(var h in a)h!=="ref"&&(c[h]=a[h])}if(r=r.defaultProps){c===a&&(c=y({},c));for(var g in r)c[g]===void 0&&(c[g]=r[g])}return c}function zx(r){wh(r)}function $x(r){console.error(r)}function Fx(r){wh(r)}function Wh(r,a){try{var c=r.onUncaughtError;c(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function Hx(r,a,c){try{var h=r.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function iy(r,a,c){return c=Ia(c),c.tag=3,c.payload={element:null},c.callback=function(){Wh(r,a)},c}function Ux(r){return r=Ia(r),r.tag=3,r}function Wx(r,a,c,h){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=h.value;r.payload=function(){return g(v)},r.callback=function(){Hx(a,c,h)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){Hx(a,c,h),typeof g!="function"&&(Fa===null?Fa=new Set([this]):Fa.add(this));var H=h.stack;this.componentDidCatch(h.value,{componentStack:H!==null?H:""})})}function g6(r,a,c,h,g){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=c.alternate,a!==null&&Bl(a,c,g,!0),c=yr.current,c!==null){switch(c.tag){case 31:case 13:return Pr===null?nf():c.alternate===null&&Dn===0&&(Dn=3),c.flags&=-257,c.flags|=65536,c.lanes=g,h===Lh?c.flags|=16384:(a=c.updateQueue,a===null?c.updateQueue=new Set([h]):a.add(h),Ty(r,h,g)),!1;case 22:return c.flags|=65536,h===Lh?c.flags|=16384:(a=c.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=a):(c=a.retryQueue,c===null?a.retryQueue=new Set([h]):c.add(h)),Ty(r,h,g)),!1}throw Error(i(435,c.tag))}return Ty(r,h,g),nf(),!1}if(qt)return a=yr.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,h!==Sg&&(r=Error(i(422),{cause:h}),hu(Ir(r,c)))):(h!==Sg&&(a=Error(i(423),{cause:h}),hu(Ir(a,c))),r=r.current.alternate,r.flags|=65536,g&=-g,r.lanes|=g,h=Ir(h,c),g=iy(r.stateNode,h,g),Og(r,g),Dn!==4&&(Dn=2)),!1;var v=Error(i(520),{cause:h});if(v=Ir(v,c),Lu===null?Lu=[v]:Lu.push(v),Dn!==4&&(Dn=2),a===null)return!0;h=Ir(h,c),c=a;do{switch(c.tag){case 3:return c.flags|=65536,r=g&-g,c.lanes|=r,r=iy(c.stateNode,h,r),Og(c,r),!1;case 1:if(a=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Fa===null||!Fa.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=Ux(g),Wx(g,r,c,h),Og(c,g),!1}c=c.return}while(c!==null);return!1}var ry=Error(i(461)),ei=!1;function Ei(r,a,c,h){a.child=r===null?V1(a,null,c,h):Fo(a,r.child,c,h)}function qx(r,a,c,h,g){c=c.render;var v=a.ref;if("ref"in h){var E={};for(var H in h)H!=="ref"&&(E[H]=h[H])}else E=h;return Bo(a),h=zg(r,a,c,E,v,g),H=$g(),r!==null&&!ei?(Fg(r,a,g),ea(r,a,g)):(qt&&H&&bg(a),a.flags|=1,Ei(r,a,h,g),a.child)}function Gx(r,a,c,h,g){if(r===null){var v=c.type;return typeof v=="function"&&!yg(v)&&v.defaultProps===void 0&&c.compare===null?(a.tag=15,a.type=v,Kx(r,a,v,h,g)):(r=kh(c.type,null,h,a,a.mode,g),r.ref=a.ref,r.return=a,a.child=r)}if(v=r.child,!hy(r,g)){var E=v.memoizedProps;if(c=c.compare,c=c!==null?c:cu,c(E,h)&&r.ref===a.ref)return ea(r,a,g)}return a.flags|=1,r=Vs(v,h),r.ref=a.ref,r.return=a,a.child=r}function Kx(r,a,c,h,g){if(r!==null){var v=r.memoizedProps;if(cu(v,h)&&r.ref===a.ref)if(ei=!1,a.pendingProps=h=v,hy(r,g))(r.flags&131072)!==0&&(ei=!0);else return a.lanes=r.lanes,ea(r,a,g)}return sy(r,a,c,h,g)}function Vx(r,a,c,h){var g=h.children,v=r!==null?r.memoizedState:null;if(r===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|c:c,r!==null){for(h=a.child=r.child,g=0;h!==null;)g=g|h.lanes|h.childLanes,h=h.sibling;h=g&~v}else h=0,a.child=null;return Yx(r,a,v,c,h)}if((c&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},r!==null&&Rh(a,v!==null?v.cachePool:null),v!==null?Z1(a,v):Dg(),J1(a);else return h=a.lanes=536870912,Yx(r,a,v!==null?v.baseLanes|c:c,c,h)}else v!==null?(Rh(a,v.cachePool),Z1(a,v),Ba(),a.memoizedState=null):(r!==null&&Rh(a,null),Dg(),Ba());return Ei(r,a,g,c),a.child}function Cu(r,a){return r!==null&&r.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Yx(r,a,c,h,g){var v=Rg();return v=v===null?null:{parent:Jn._currentValue,pool:v},a.memoizedState={baseLanes:c,cachePool:v},r!==null&&Rh(a,null),Dg(),J1(a),r!==null&&Bl(r,a,h,!0),a.childLanes=g,null}function qh(r,a){return a=Kh({mode:a.mode,children:a.children},r.mode),a.ref=r.ref,r.child=a,a.return=r,a}function Xx(r,a,c){return Fo(a,r.child,null,c),r=qh(a,a.pendingProps),r.flags|=2,_r(a),a.memoizedState=null,r}function y6(r,a,c){var h=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,r===null){if(qt){if(h.mode==="hidden")return r=qh(a,h),a.lanes=536870912,Cu(null,r);if(Bg(a),(r=vn)?(r=lk(r,Br),r=r!==null&&r.data==="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Ra!==null?{id:vs,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},c=O1(r),c.return=a,a.child=c,Ci=a,vn=null)):r=null,r===null)throw La(a);return a.lanes=536870912,null}return qh(a,h)}var v=r.memoizedState;if(v!==null){var E=v.dehydrated;if(Bg(a),g)if(a.flags&256)a.flags&=-257,a=Xx(r,a,c);else if(a.memoizedState!==null)a.child=r.child,a.flags|=128,a=null;else throw Error(i(558));else if(ei||Bl(r,a,c,!1),g=(c&r.childLanes)!==0,ei||g){if(h=gn,h!==null&&(E=_n(h,c),E!==0&&E!==v.retryLane))throw v.retryLane=E,Oo(r,E),sr(h,r,E),ry;nf(),a=Xx(r,a,c)}else r=v.treeContext,vn=zr(E.nextSibling),Ci=a,qt=!0,Ma=null,Br=!1,r!==null&&j1(a,r),a=qh(a,h),a.flags|=4096;return a}return r=Vs(r.child,{mode:h.mode,children:h.children}),r.ref=a.ref,a.child=r,r.return=a,r}function Gh(r,a){var c=a.ref;if(c===null)r!==null&&r.ref!==null&&(a.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(a.flags|=4194816)}}function sy(r,a,c,h,g){return Bo(a),c=zg(r,a,c,h,void 0,g),h=$g(),r!==null&&!ei?(Fg(r,a,g),ea(r,a,g)):(qt&&h&&bg(a),a.flags|=1,Ei(r,a,c,g),a.child)}function Zx(r,a,c,h,g,v){return Bo(a),a.updateQueue=null,c=ex(a,h,c,g),Q1(r),h=$g(),r!==null&&!ei?(Fg(r,a,v),ea(r,a,v)):(qt&&h&&bg(a),a.flags|=1,Ei(r,a,c,v),a.child)}function Jx(r,a,c,h,g){if(Bo(a),a.stateNode===null){var v=Ol,E=c.contextType;typeof E=="object"&&E!==null&&(v=ki(E)),v=new c(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=ny,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},Lg(a),E=c.contextType,v.context=typeof E=="object"&&E!==null?ki(E):Ol,v.state=a.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(ty(a,c,E,h),v.state=a.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(E=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),E!==v.state&&ny.enqueueReplaceState(v,v.state,null),vu(a,h,v,g),_u(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(r===null){v=a.stateNode;var H=a.memoizedProps,J=Uo(c,H);v.props=J;var ce=v.context,_e=c.contextType;E=Ol,typeof _e=="object"&&_e!==null&&(E=ki(_e));var xe=c.getDerivedStateFromProps;_e=typeof xe=="function"||typeof v.getSnapshotBeforeUpdate=="function",H=a.pendingProps!==H,_e||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(H||ce!==E)&&Px(a,v,h,E),Oa=!1;var ue=a.memoizedState;v.state=ue,vu(a,h,v,g),_u(),ce=a.memoizedState,H||ue!==ce||Oa?(typeof xe=="function"&&(ty(a,c,xe,h),ce=a.memoizedState),(J=Oa||Bx(a,c,J,h,ue,ce,E))?(_e||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=ce),v.props=h,v.state=ce,v.context=E,h=J):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,Ng(r,a),E=a.memoizedProps,_e=Uo(c,E),v.props=_e,xe=a.pendingProps,ue=v.context,ce=c.contextType,J=Ol,typeof ce=="object"&&ce!==null&&(J=ki(ce)),H=c.getDerivedStateFromProps,(ce=typeof H=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E!==xe||ue!==J)&&Px(a,v,h,J),Oa=!1,ue=a.memoizedState,v.state=ue,vu(a,h,v,g),_u();var pe=a.memoizedState;E!==xe||ue!==pe||Oa||r!==null&&r.dependencies!==null&&Ah(r.dependencies)?(typeof H=="function"&&(ty(a,c,H,h),pe=a.memoizedState),(_e=Oa||Bx(a,c,_e,h,ue,pe,J)||r!==null&&r.dependencies!==null&&Ah(r.dependencies))?(ce||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,pe,J),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,pe,J)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&ue===r.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ue===r.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=pe),v.props=h,v.state=pe,v.context=J,h=_e):(typeof v.componentDidUpdate!="function"||E===r.memoizedProps&&ue===r.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ue===r.memoizedState||(a.flags|=1024),h=!1)}return v=h,Gh(r,a),h=(a.flags&128)!==0,v||h?(v=a.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,r!==null&&h?(a.child=Fo(a,r.child,null,g),a.child=Fo(a,null,c,g)):Ei(r,a,c,g),a.memoizedState=v.state,r=a.child):r=ea(r,a,g),r}function Qx(r,a,c,h){return Do(),a.flags|=256,Ei(r,a,c,h),a.child}var ay={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function oy(r){return{baseLanes:r,cachePool:H1()}}function ly(r,a,c){return r=r!==null?r.childLanes&~c:0,a&&(r|=br),r}function eC(r,a,c){var h=a.pendingProps,g=!1,v=(a.flags&128)!==0,E;if((E=v)||(E=r!==null&&r.memoizedState===null?!1:(qn.current&2)!==0),E&&(g=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,r===null){if(qt){if(g?ja(a):Ba(),(r=vn)?(r=lk(r,Br),r=r!==null&&r.data!=="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Ra!==null?{id:vs,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},c=O1(r),c.return=a,a.child=c,Ci=a,vn=null)):r=null,r===null)throw La(a);return Wy(r)?a.lanes=32:a.lanes=536870912,null}var H=h.children;return h=h.fallback,g?(Ba(),g=a.mode,H=Kh({mode:"hidden",children:H},g),h=Io(h,g,c,null),H.return=a,h.return=a,H.sibling=h,a.child=H,h=a.child,h.memoizedState=oy(c),h.childLanes=ly(r,E,c),a.memoizedState=ay,Cu(null,h)):(ja(a),cy(a,H))}var J=r.memoizedState;if(J!==null&&(H=J.dehydrated,H!==null)){if(v)a.flags&256?(ja(a),a.flags&=-257,a=uy(r,a,c)):a.memoizedState!==null?(Ba(),a.child=r.child,a.flags|=128,a=null):(Ba(),H=h.fallback,g=a.mode,h=Kh({mode:"visible",children:h.children},g),H=Io(H,g,c,null),H.flags|=2,h.return=a,H.return=a,h.sibling=H,a.child=h,Fo(a,r.child,null,c),h=a.child,h.memoizedState=oy(c),h.childLanes=ly(r,E,c),a.memoizedState=ay,a=Cu(null,h));else if(ja(a),Wy(H)){if(E=H.nextSibling&&H.nextSibling.dataset,E)var ce=E.dgst;E=ce,h=Error(i(419)),h.stack="",h.digest=E,hu({value:h,source:null,stack:null}),a=uy(r,a,c)}else if(ei||Bl(r,a,c,!1),E=(c&r.childLanes)!==0,ei||E){if(E=gn,E!==null&&(h=_n(E,c),h!==0&&h!==J.retryLane))throw J.retryLane=h,Oo(r,h),sr(E,r,h),ry;Uy(H)||nf(),a=uy(r,a,c)}else Uy(H)?(a.flags|=192,a.child=r.child,a=null):(r=J.treeContext,vn=zr(H.nextSibling),Ci=a,qt=!0,Ma=null,Br=!1,r!==null&&j1(a,r),a=cy(a,h.children),a.flags|=4096);return a}return g?(Ba(),H=h.fallback,g=a.mode,J=r.child,ce=J.sibling,h=Vs(J,{mode:"hidden",children:h.children}),h.subtreeFlags=J.subtreeFlags&65011712,ce!==null?H=Vs(ce,H):(H=Io(H,g,c,null),H.flags|=2),H.return=a,h.return=a,h.sibling=H,a.child=h,Cu(null,h),h=a.child,H=r.child.memoizedState,H===null?H=oy(c):(g=H.cachePool,g!==null?(J=Jn._currentValue,g=g.parent!==J?{parent:J,pool:J}:g):g=H1(),H={baseLanes:H.baseLanes|c,cachePool:g}),h.memoizedState=H,h.childLanes=ly(r,E,c),a.memoizedState=ay,Cu(r.child,h)):(ja(a),c=r.child,r=c.sibling,c=Vs(c,{mode:"visible",children:h.children}),c.return=a,c.sibling=null,r!==null&&(E=a.deletions,E===null?(a.deletions=[r],a.flags|=16):E.push(r)),a.child=c,a.memoizedState=null,c)}function cy(r,a){return a=Kh({mode:"visible",children:a},r.mode),a.return=r,r.child=a}function Kh(r,a){return r=gr(22,r,null,a),r.lanes=0,r}function uy(r,a,c){return Fo(a,r.child,null,c),r=cy(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function tC(r,a,c){r.lanes|=a;var h=r.alternate;h!==null&&(h.lanes|=a),kg(r.return,a,c)}function dy(r,a,c,h,g,v){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:g,treeForkCount:v}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=h,E.tail=c,E.tailMode=g,E.treeForkCount=v)}function nC(r,a,c){var h=a.pendingProps,g=h.revealOrder,v=h.tail;h=h.children;var E=qn.current,H=(E&2)!==0;if(H?(E=E&1|2,a.flags|=128):E&=1,G(qn,E),Ei(r,a,h,c),h=qt?du:0,!H&&r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&tC(r,c,a);else if(r.tag===19)tC(r,c,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(g){case"forwards":for(c=a.child,g=null;c!==null;)r=c.alternate,r!==null&&Dh(r)===null&&(g=c),c=c.sibling;c=g,c===null?(g=a.child,a.child=null):(g=c.sibling,c.sibling=null),dy(a,!1,g,c,v,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=a.child,a.child=null;g!==null;){if(r=g.alternate,r!==null&&Dh(r)===null){a.child=g;break}r=g.sibling,g.sibling=c,c=g,g=r}dy(a,!0,c,null,v,h);break;case"together":dy(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function ea(r,a,c){if(r!==null&&(a.dependencies=r.dependencies),$a|=a.lanes,(c&a.childLanes)===0)if(r!==null){if(Bl(r,a,c,!1),(c&a.childLanes)===0)return null}else return null;if(r!==null&&a.child!==r.child)throw Error(i(153));if(a.child!==null){for(r=a.child,c=Vs(r,r.pendingProps),a.child=c,c.return=a;r.sibling!==null;)r=r.sibling,c=c.sibling=Vs(r,r.pendingProps),c.return=a;c.sibling=null}return a.child}function hy(r,a){return(r.lanes&a)!==0?!0:(r=r.dependencies,!!(r!==null&&Ah(r)))}function _6(r,a,c){switch(a.tag){case 3:Me(a,a.stateNode.containerInfo),Na(a,Jn,r.memoizedState.cache),Do();break;case 27:case 5:Ye(a);break;case 4:Me(a,a.stateNode.containerInfo);break;case 10:Na(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Bg(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(ja(a),a.flags|=128,null):(c&a.child.childLanes)!==0?eC(r,a,c):(ja(a),r=ea(r,a,c),r!==null?r.sibling:null);ja(a);break;case 19:var g=(r.flags&128)!==0;if(h=(c&a.childLanes)!==0,h||(Bl(r,a,c,!1),h=(c&a.childLanes)!==0),g){if(h)return nC(r,a,c);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),G(qn,qn.current),h)break;return null;case 22:return a.lanes=0,Vx(r,a,c,a.pendingProps);case 24:Na(a,Jn,r.memoizedState.cache)}return ea(r,a,c)}function iC(r,a,c){if(r!==null)if(r.memoizedProps!==a.pendingProps)ei=!0;else{if(!hy(r,c)&&(a.flags&128)===0)return ei=!1,_6(r,a,c);ei=(r.flags&131072)!==0}else ei=!1,qt&&(a.flags&1048576)!==0&&D1(a,du,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(r=zo(a.elementType),a.type=r,typeof r=="function")yg(r)?(h=Uo(r,h),a.tag=1,a=Jx(null,a,r,h,c)):(a.tag=0,a=sy(null,a,r,h,c));else{if(r!=null){var g=r.$$typeof;if(g===T){a.tag=11,a=qx(null,a,r,h,c);break e}else if(g===N){a.tag=14,a=Gx(null,a,r,h,c);break e}}throw a=D(r)||r,Error(i(306,a,""))}}return a;case 0:return sy(r,a,a.type,a.pendingProps,c);case 1:return h=a.type,g=Uo(h,a.pendingProps),Jx(r,a,h,g,c);case 3:e:{if(Me(a,a.stateNode.containerInfo),r===null)throw Error(i(387));h=a.pendingProps;var v=a.memoizedState;g=v.element,Ng(r,a),vu(a,h,null,c);var E=a.memoizedState;if(h=E.cache,Na(a,Jn,h),h!==v.cache&&Eg(a,[Jn],c,!0),_u(),h=E.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=Qx(r,a,h,c);break e}else if(h!==g){g=Ir(Error(i(424)),a),hu(g),a=Qx(r,a,h,c);break e}else for(r=a.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,vn=zr(r.firstChild),Ci=a,qt=!0,Ma=null,Br=!0,c=V1(a,null,h,c),a.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(Do(),h===g){a=ea(r,a,c);break e}Ei(r,a,h,c)}a=a.child}return a;case 26:return Gh(r,a),r===null?(c=pk(a.type,null,a.pendingProps,null))?a.memoizedState=c:qt||(c=a.type,r=a.pendingProps,h=uf(ne.current).createElement(c),h[Ft]=a,h[Kt]=r,Ai(h,c,r),Rt(h),a.stateNode=h):a.memoizedState=pk(a.type,r.memoizedProps,a.pendingProps,r.memoizedState),null;case 27:return Ye(a),r===null&&qt&&(h=a.stateNode=dk(a.type,a.pendingProps,ne.current),Ci=a,Br=!0,g=vn,qa(a.type)?(qy=g,vn=zr(h.firstChild)):vn=g),Ei(r,a,a.pendingProps.children,c),Gh(r,a),r===null&&(a.flags|=4194304),a.child;case 5:return r===null&&qt&&((g=h=vn)&&(h=V6(h,a.type,a.pendingProps,Br),h!==null?(a.stateNode=h,Ci=a,vn=zr(h.firstChild),Br=!1,g=!0):g=!1),g||La(a)),Ye(a),g=a.type,v=a.pendingProps,E=r!==null?r.memoizedProps:null,h=v.children,$y(g,v)?h=null:E!==null&&$y(g,E)&&(a.flags|=32),a.memoizedState!==null&&(g=zg(r,a,c6,null,null,c),zu._currentValue=g),Gh(r,a),Ei(r,a,h,c),a.child;case 6:return r===null&&qt&&((r=c=vn)&&(c=Y6(c,a.pendingProps,Br),c!==null?(a.stateNode=c,Ci=a,vn=null,r=!0):r=!1),r||La(a)),null;case 13:return eC(r,a,c);case 4:return Me(a,a.stateNode.containerInfo),h=a.pendingProps,r===null?a.child=Fo(a,null,h,c):Ei(r,a,h,c),a.child;case 11:return qx(r,a,a.type,a.pendingProps,c);case 7:return Ei(r,a,a.pendingProps,c),a.child;case 8:return Ei(r,a,a.pendingProps.children,c),a.child;case 12:return Ei(r,a,a.pendingProps.children,c),a.child;case 10:return h=a.pendingProps,Na(a,a.type,h.value),Ei(r,a,h.children,c),a.child;case 9:return g=a.type._context,h=a.pendingProps.children,Bo(a),g=ki(g),h=h(g),a.flags|=1,Ei(r,a,h,c),a.child;case 14:return Gx(r,a,a.type,a.pendingProps,c);case 15:return Kx(r,a,a.type,a.pendingProps,c);case 19:return nC(r,a,c);case 31:return y6(r,a,c);case 22:return Vx(r,a,c,a.pendingProps);case 24:return Bo(a),h=ki(Jn),r===null?(g=Rg(),g===null&&(g=gn,v=Ag(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),a.memoizedState={parent:h,cache:g},Lg(a),Na(a,Jn,g)):((r.lanes&c)!==0&&(Ng(r,a),vu(a,null,null,c),_u()),g=r.memoizedState,v=a.memoizedState,g.parent!==h?(g={parent:h,cache:h},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),Na(a,Jn,h)):(h=v.cache,Na(a,Jn,h),h!==g.cache&&Eg(a,[Jn],c,!0))),Ei(r,a,a.pendingProps.children,c),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function ta(r){r.flags|=4}function fy(r,a,c,h,g){if((a=(r.mode&32)!==0)&&(a=!1),a){if(r.flags|=16777216,(g&335544128)===g)if(r.stateNode.complete)r.flags|=8192;else if(MC())r.flags|=8192;else throw $o=Lh,Mg}else r.flags&=-16777217}function rC(r,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!vk(a))if(MC())r.flags|=8192;else throw $o=Lh,Mg}function Vh(r,a){a!==null&&(r.flags|=4),r.flags&16384&&(a=r.tag!==22?Ge():536870912,r.lanes|=a,Yl|=a)}function ku(r,a){if(!qt)switch(r.tailMode){case"hidden":a=r.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:h.sibling=null}}function bn(r){var a=r.alternate!==null&&r.alternate.child===r.child,c=0,h=0;if(a)for(var g=r.child;g!==null;)c|=g.lanes|g.childLanes,h|=g.subtreeFlags&65011712,h|=g.flags&65011712,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)c|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=h,r.childLanes=c,a}function v6(r,a,c){var h=a.pendingProps;switch(wg(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bn(a),null;case 1:return bn(a),null;case 3:return c=a.stateNode,h=null,r!==null&&(h=r.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),Zs(Jn),ve(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(jl(a)?ta(a):r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,xg())),bn(a),null;case 26:var g=a.type,v=a.memoizedState;return r===null?(ta(a),v!==null?(bn(a),rC(a,v)):(bn(a),fy(a,g,null,h,c))):v?v!==r.memoizedState?(ta(a),bn(a),rC(a,v)):(bn(a),a.flags&=-16777217):(r=r.memoizedProps,r!==h&&ta(a),bn(a),fy(a,g,r,h,c)),null;case 27:if(qe(a),c=ne.current,g=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==h&&ta(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return bn(a),null}r=U.current,jl(a)?B1(a):(r=dk(g,h,c),a.stateNode=r,ta(a))}return bn(a),null;case 5:if(qe(a),g=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==h&&ta(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return bn(a),null}if(v=U.current,jl(a))B1(a);else{var E=uf(ne.current);switch(v){case 1:v=E.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=E.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=E.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?E.createElement("select",{is:h.is}):E.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?E.createElement(g,{is:h.is}):E.createElement(g)}}v[Ft]=a,v[Kt]=h;e:for(E=a.child;E!==null;){if(E.tag===5||E.tag===6)v.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=v;e:switch(Ai(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&&ta(a)}}return bn(a),fy(a,a.type,r===null?null:r.memoizedProps,a.pendingProps,c),null;case 6:if(r&&a.stateNode!=null)r.memoizedProps!==h&&ta(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(r=ne.current,jl(a)){if(r=a.stateNode,c=a.memoizedProps,h=null,g=Ci,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}r[Ft]=a,r=!!(r.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||ek(r.nodeValue,c)),r||La(a,!0)}else r=uf(r).createTextNode(h),r[Ft]=a,a.stateNode=r}return bn(a),null;case 31:if(c=a.memoizedState,r===null||r.memoizedState!==null){if(h=jl(a),c!==null){if(r===null){if(!h)throw Error(i(318));if(r=a.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Ft]=a}else Do(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;bn(a),r=!1}else c=xg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return a.flags&256?(_r(a),a):(_r(a),null);if((a.flags&128)!==0)throw Error(i(558))}return bn(a),null;case 13:if(h=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(g=jl(a),h!==null&&h.dehydrated!==null){if(r===null){if(!g)throw Error(i(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[Ft]=a}else Do(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;bn(a),g=!1}else g=xg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(_r(a),a):(_r(a),null)}return _r(a),(a.flags&128)!==0?(a.lanes=c,a):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(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)),c!==r&&c&&(a.child.flags|=8192),Vh(a,a.updateQueue),bn(a),null);case 4:return ve(),r===null&&Dy(a.stateNode.containerInfo),bn(a),null;case 10:return Zs(a.type),bn(a),null;case 19:if(W(qn),h=a.memoizedState,h===null)return bn(a),null;if(g=(a.flags&128)!==0,v=h.rendering,v===null)if(g)ku(h,!1);else{if(Dn!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(v=Dh(r),v!==null){for(a.flags|=128,ku(h,!1),r=v.updateQueue,a.updateQueue=r,Vh(a,r),a.subtreeFlags=0,r=c,c=a.child;c!==null;)N1(c,r),c=c.sibling;return G(qn,qn.current&1|2),qt&&Ys(a,h.treeForkCount),a.child}r=r.sibling}h.tail!==null&&Ke()>Qh&&(a.flags|=128,g=!0,ku(h,!1),a.lanes=4194304)}else{if(!g)if(r=Dh(v),r!==null){if(a.flags|=128,g=!0,r=r.updateQueue,a.updateQueue=r,Vh(a,r),ku(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!qt)return bn(a),null}else 2*Ke()-h.renderingStartTime>Qh&&c!==536870912&&(a.flags|=128,g=!0,ku(h,!1),a.lanes=4194304);h.isBackwards?(v.sibling=a.child,a.child=v):(r=h.last,r!==null?r.sibling=v:a.child=v,h.last=v)}return h.tail!==null?(r=h.tail,h.rendering=r,h.tail=r.sibling,h.renderingStartTime=Ke(),r.sibling=null,c=qn.current,G(qn,g?c&1|2:c&1),qt&&Ys(a,h.treeForkCount),r):(bn(a),null);case 22:case 23:return _r(a),jg(),h=a.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(c&536870912)!==0&&(a.flags&128)===0&&(bn(a),a.subtreeFlags&6&&(a.flags|=8192)):bn(a),c=a.updateQueue,c!==null&&Vh(a,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==c&&(a.flags|=2048),r!==null&&W(Po),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Zs(Jn),bn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function b6(r,a){switch(wg(a),a.tag){case 1:return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return Zs(Jn),ve(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 26:case 27:case 5:return qe(a),null;case 31:if(a.memoizedState!==null){if(_r(a),a.alternate===null)throw Error(i(340));Do()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 13:if(_r(a),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Do()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return W(qn),null;case 4:return ve(),null;case 10:return Zs(a.type),null;case 22:case 23:return _r(a),jg(),r!==null&&W(Po),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 24:return Zs(Jn),null;case 25:return null;default:return null}}function sC(r,a){switch(wg(a),a.tag){case 3:Zs(Jn),ve();break;case 26:case 27:case 5:qe(a);break;case 4:ve();break;case 31:a.memoizedState!==null&&_r(a);break;case 13:_r(a);break;case 19:W(qn);break;case 10:Zs(a.type);break;case 22:case 23:_r(a),jg(),r!==null&&W(Po);break;case 24:Zs(Jn)}}function Eu(r,a){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&r)===r){h=void 0;var v=c.create,E=c.inst;h=v(),E.destroy=h}c=c.next}while(c!==g)}}catch(H){on(a,a.return,H)}}function Pa(r,a,c){try{var h=a.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&r)===r){var E=h.inst,H=E.destroy;if(H!==void 0){E.destroy=void 0,g=a;var J=c,ce=H;try{ce()}catch(_e){on(g,J,_e)}}}h=h.next}while(h!==v)}}catch(_e){on(a,a.return,_e)}}function aC(r){var a=r.updateQueue;if(a!==null){var c=r.stateNode;try{X1(a,c)}catch(h){on(r,r.return,h)}}}function oC(r,a,c){c.props=Uo(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){on(r,a,h)}}function Au(r,a){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=r.stateNode;break;case 30:h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(g){on(r,a,g)}}function ws(r,a){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(g){on(r,a,g)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){on(r,a,g)}else c.current=null}function lC(r){var a=r.type,c=r.memoizedProps,h=r.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(g){on(r,r.return,g)}}function py(r,a,c){try{var h=r.stateNode;H6(h,r.type,c,a),h[Kt]=a}catch(g){on(r,r.return,g)}}function cC(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&qa(r.type)||r.tag===4}function my(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||cC(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&qa(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function gy(r,a,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,a?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,a):(a=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,a.appendChild(r),c=c._reactRootContainer,c!=null||a.onclick!==null||(a.onclick=Le));else if(h!==4&&(h===27&&qa(r.type)&&(c=r.stateNode,a=null),r=r.child,r!==null))for(gy(r,a,c),r=r.sibling;r!==null;)gy(r,a,c),r=r.sibling}function Yh(r,a,c){var h=r.tag;if(h===5||h===6)r=r.stateNode,a?c.insertBefore(r,a):c.appendChild(r);else if(h!==4&&(h===27&&qa(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Yh(r,a,c),r=r.sibling;r!==null;)Yh(r,a,c),r=r.sibling}function uC(r){var a=r.stateNode,c=r.memoizedProps;try{for(var h=r.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);Ai(a,h,c),a[Ft]=r,a[Kt]=c}catch(v){on(r,r.return,v)}}var na=!1,ti=!1,yy=!1,dC=typeof WeakSet=="function"?WeakSet:Set,fi=null;function w6(r,a){if(r=r.containerInfo,Py=yf,r=x1(r),ug(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var E=0,H=-1,J=-1,ce=0,_e=0,xe=r,ue=null;t:for(;;){for(var pe;xe!==c||g!==0&&xe.nodeType!==3||(H=E+g),xe!==v||h!==0&&xe.nodeType!==3||(J=E+h),xe.nodeType===3&&(E+=xe.nodeValue.length),(pe=xe.firstChild)!==null;)ue=xe,xe=pe;for(;;){if(xe===r)break t;if(ue===c&&++ce===g&&(H=E),ue===v&&++_e===h&&(J=E),(pe=xe.nextSibling)!==null)break;xe=ue,ue=xe.parentNode}xe=pe}c=H===-1||J===-1?null:{start:H,end:J}}else c=null}c=c||{start:0,end:0}}else c=null;for(zy={focusedElem:r,selectionRange:c},yf=!1,fi=a;fi!==null;)if(a=fi,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,fi=r;else for(;fi!==null;){switch(a=fi,v=a.alternate,r=a.flags,a.tag){case 0:if((r&4)!==0&&(r=a.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)g=r[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=a,g=v.memoizedProps,v=v.memoizedState,h=c.stateNode;try{var Ve=Uo(c.type,g);r=h.getSnapshotBeforeUpdate(Ve,v),h.__reactInternalSnapshotBeforeUpdate=r}catch(ct){on(c,c.return,ct)}}break;case 3:if((r&1024)!==0){if(r=a.stateNode.containerInfo,c=r.nodeType,c===9)Hy(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Hy(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(i(163))}if(r=a.sibling,r!==null){r.return=a.return,fi=r;break}fi=a.return}}function hC(r,a,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:ra(r,c),h&4&&Eu(5,c);break;case 1:if(ra(r,c),h&4)if(r=c.stateNode,a===null)try{r.componentDidMount()}catch(E){on(c,c.return,E)}else{var g=Uo(c.type,a.memoizedProps);a=a.memoizedState;try{r.componentDidUpdate(g,a,r.__reactInternalSnapshotBeforeUpdate)}catch(E){on(c,c.return,E)}}h&64&&aC(c),h&512&&Au(c,c.return);break;case 3:if(ra(r,c),h&64&&(r=c.updateQueue,r!==null)){if(a=null,c.child!==null)switch(c.child.tag){case 27:case 5:a=c.child.stateNode;break;case 1:a=c.child.stateNode}try{X1(r,a)}catch(E){on(c,c.return,E)}}break;case 27:a===null&&h&4&&uC(c);case 26:case 5:ra(r,c),a===null&&h&4&&lC(c),h&512&&Au(c,c.return);break;case 12:ra(r,c);break;case 31:ra(r,c),h&4&&mC(r,c);break;case 13:ra(r,c),h&4&&gC(r,c),h&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=M6.bind(null,c),X6(r,c))));break;case 22:if(h=c.memoizedState!==null||na,!h){a=a!==null&&a.memoizedState!==null||ti,g=na;var v=ti;na=h,(ti=a)&&!v?sa(r,c,(c.subtreeFlags&8772)!==0):ra(r,c),na=g,ti=v}break;case 30:break;default:ra(r,c)}}function fC(r){var a=r.alternate;a!==null&&(r.alternate=null,fC(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&et(a)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var kn=null,tr=!1;function ia(r,a,c){for(c=c.child;c!==null;)pC(r,a,c),c=c.sibling}function pC(r,a,c){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Gt,c)}catch{}switch(c.tag){case 26:ti||ws(c,a),ia(r,a,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:ti||ws(c,a);var h=kn,g=tr;qa(c.type)&&(kn=c.stateNode,tr=!1),ia(r,a,c),ju(c.stateNode),kn=h,tr=g;break;case 5:ti||ws(c,a);case 6:if(h=kn,g=tr,kn=null,ia(r,a,c),kn=h,tr=g,kn!==null)if(tr)try{(kn.nodeType===9?kn.body:kn.nodeName==="HTML"?kn.ownerDocument.body:kn).removeChild(c.stateNode)}catch(v){on(c,a,v)}else try{kn.removeChild(c.stateNode)}catch(v){on(c,a,v)}break;case 18:kn!==null&&(tr?(r=kn,ak(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),ic(r)):ak(kn,c.stateNode));break;case 4:h=kn,g=tr,kn=c.stateNode.containerInfo,tr=!0,ia(r,a,c),kn=h,tr=g;break;case 0:case 11:case 14:case 15:Pa(2,c,a),ti||Pa(4,c,a),ia(r,a,c);break;case 1:ti||(ws(c,a),h=c.stateNode,typeof h.componentWillUnmount=="function"&&oC(c,a,h)),ia(r,a,c);break;case 21:ia(r,a,c);break;case 22:ti=(h=ti)||c.memoizedState!==null,ia(r,a,c),ti=h;break;default:ia(r,a,c)}}function mC(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ic(r)}catch(c){on(a,a.return,c)}}}function gC(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ic(r)}catch(c){on(a,a.return,c)}}function S6(r){switch(r.tag){case 31:case 13:case 19:var a=r.stateNode;return a===null&&(a=r.stateNode=new dC),a;case 22:return r=r.stateNode,a=r._retryCache,a===null&&(a=r._retryCache=new dC),a;default:throw Error(i(435,r.tag))}}function Xh(r,a){var c=S6(r);a.forEach(function(h){if(!c.has(h)){c.add(h);var g=L6.bind(null,r,h);h.then(g,g)}})}function nr(r,a){var c=a.deletions;if(c!==null)for(var h=0;h<c.length;h++){var g=c[h],v=r,E=a,H=E;e:for(;H!==null;){switch(H.tag){case 27:if(qa(H.type)){kn=H.stateNode,tr=!1;break e}break;case 5:kn=H.stateNode,tr=!1;break e;case 3:case 4:kn=H.stateNode.containerInfo,tr=!0;break e}H=H.return}if(kn===null)throw Error(i(160));pC(v,E,g),kn=null,tr=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)yC(a,r),a=a.sibling}var as=null;function yC(r,a){var c=r.alternate,h=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:nr(a,r),ir(r),h&4&&(Pa(3,r,r.return),Eu(3,r),Pa(5,r,r.return));break;case 1:nr(a,r),ir(r),h&512&&(ti||c===null||ws(c,c.return)),h&64&&na&&(r=r.updateQueue,r!==null&&(h=r.callbacks,h!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var g=as;if(nr(a,r),ir(r),h&512&&(ti||c===null||ws(c,c.return)),h&4){var v=c!==null?c.memoizedState:null;if(h=r.memoizedState,c===null)if(h===null)if(r.stateNode===null){e:{h=r.type,c=r.memoizedProps,g=g.ownerDocument||g;t:switch(h){case"title":v=g.getElementsByTagName("title")[0],(!v||v[pr]||v[Ft]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(h),g.head.insertBefore(v,g.querySelector("head > title"))),Ai(v,h,c),v[Ft]=r,Rt(v),h=v;break e;case"link":var E=yk("link","href",g).get(h+(c.href||""));if(E){for(var H=0;H<E.length;H++)if(v=E[H],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){E.splice(H,1);break t}}v=g.createElement(h),Ai(v,h,c),g.head.appendChild(v);break;case"meta":if(E=yk("meta","content",g).get(h+(c.content||""))){for(H=0;H<E.length;H++)if(v=E[H],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){E.splice(H,1);break t}}v=g.createElement(h),Ai(v,h,c),g.head.appendChild(v);break;default:throw Error(i(468,h))}v[Ft]=r,Rt(v),h=v}r.stateNode=h}else _k(g,r.type,r.stateNode);else r.stateNode=gk(g,h,r.memoizedProps);else v!==h?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,h===null?_k(g,r.type,r.stateNode):gk(g,h,r.memoizedProps)):h===null&&r.stateNode!==null&&py(r,r.memoizedProps,c.memoizedProps)}break;case 27:nr(a,r),ir(r),h&512&&(ti||c===null||ws(c,c.return)),c!==null&&h&4&&py(r,r.memoizedProps,c.memoizedProps);break;case 5:if(nr(a,r),ir(r),h&512&&(ti||c===null||ws(c,c.return)),r.flags&32){g=r.stateNode;try{lt(g,"")}catch(Ve){on(r,r.return,Ve)}}h&4&&r.stateNode!=null&&(g=r.memoizedProps,py(r,g,c!==null?c.memoizedProps:g)),h&1024&&(yy=!0);break;case 6:if(nr(a,r),ir(r),h&4){if(r.stateNode===null)throw Error(i(162));h=r.memoizedProps,c=r.stateNode;try{c.nodeValue=h}catch(Ve){on(r,r.return,Ve)}}break;case 3:if(ff=null,g=as,as=df(a.containerInfo),nr(a,r),as=g,ir(r),h&4&&c!==null&&c.memoizedState.isDehydrated)try{ic(a.containerInfo)}catch(Ve){on(r,r.return,Ve)}yy&&(yy=!1,_C(r));break;case 4:h=as,as=df(r.stateNode.containerInfo),nr(a,r),ir(r),as=h;break;case 12:nr(a,r),ir(r);break;case 31:nr(a,r),ir(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Xh(r,h)));break;case 13:nr(a,r),ir(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Jh=Ke()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Xh(r,h)));break;case 22:g=r.memoizedState!==null;var J=c!==null&&c.memoizedState!==null,ce=na,_e=ti;if(na=ce||g,ti=_e||J,nr(a,r),ti=_e,na=ce,ir(r),h&8192)e:for(a=r.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(c===null||J||na||ti||Wo(r)),c=null,a=r;;){if(a.tag===5||a.tag===26){if(c===null){J=c=a;try{if(v=J.stateNode,g)E=v.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{H=J.stateNode;var xe=J.memoizedProps.style,ue=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;H.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(Ve){on(J,J.return,Ve)}}}else if(a.tag===6){if(c===null){J=a;try{J.stateNode.nodeValue=g?"":J.memoizedProps}catch(Ve){on(J,J.return,Ve)}}}else if(a.tag===18){if(c===null){J=a;try{var pe=J.stateNode;g?ok(pe,!0):ok(J.stateNode,!1)}catch(Ve){on(J,J.return,Ve)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===r)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break e;for(;a.sibling===null;){if(a.return===null||a.return===r)break e;c===a&&(c=null),a=a.return}c===a&&(c=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=r.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Xh(r,c))));break;case 19:nr(a,r),ir(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,Xh(r,h)));break;case 30:break;case 21:break;default:nr(a,r),ir(r)}}function ir(r){var a=r.flags;if(a&2){try{for(var c,h=r.return;h!==null;){if(cC(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var g=c.stateNode,v=my(r);Yh(r,v,g);break;case 5:var E=c.stateNode;c.flags&32&&(lt(E,""),c.flags&=-33);var H=my(r);Yh(r,H,E);break;case 3:case 4:var J=c.stateNode.containerInfo,ce=my(r);gy(r,ce,J);break;default:throw Error(i(161))}}catch(_e){on(r,r.return,_e)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function _C(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var a=r;_C(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),r=r.sibling}}function ra(r,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)hC(r,a.alternate,a),a=a.sibling}function Wo(r){for(r=r.child;r!==null;){var a=r;switch(a.tag){case 0:case 11:case 14:case 15:Pa(4,a,a.return),Wo(a);break;case 1:ws(a,a.return);var c=a.stateNode;typeof c.componentWillUnmount=="function"&&oC(a,a.return,c),Wo(a);break;case 27:ju(a.stateNode);case 26:case 5:ws(a,a.return),Wo(a);break;case 22:a.memoizedState===null&&Wo(a);break;case 30:Wo(a);break;default:Wo(a)}r=r.sibling}}function sa(r,a,c){for(c=c&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,g=r,v=a,E=v.flags;switch(v.tag){case 0:case 11:case 15:sa(g,v,c),Eu(4,v);break;case 1:if(sa(g,v,c),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ce){on(h,h.return,ce)}if(h=v,g=h.updateQueue,g!==null){var H=h.stateNode;try{var J=g.shared.hiddenCallbacks;if(J!==null)for(g.shared.hiddenCallbacks=null,g=0;g<J.length;g++)Y1(J[g],H)}catch(ce){on(h,h.return,ce)}}c&&E&64&&aC(v),Au(v,v.return);break;case 27:uC(v);case 26:case 5:sa(g,v,c),c&&h===null&&E&4&&lC(v),Au(v,v.return);break;case 12:sa(g,v,c);break;case 31:sa(g,v,c),c&&E&4&&mC(g,v);break;case 13:sa(g,v,c),c&&E&4&&gC(g,v);break;case 22:v.memoizedState===null&&sa(g,v,c),Au(v,v.return);break;case 30:break;default:sa(g,v,c)}a=a.sibling}}function _y(r,a){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&fu(c))}function vy(r,a){r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&fu(r))}function os(r,a,c,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)vC(r,a,c,h),a=a.sibling}function vC(r,a,c,h){var g=a.flags;switch(a.tag){case 0:case 11:case 15:os(r,a,c,h),g&2048&&Eu(9,a);break;case 1:os(r,a,c,h);break;case 3:os(r,a,c,h),g&2048&&(r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&fu(r)));break;case 12:if(g&2048){os(r,a,c,h),r=a.stateNode;try{var v=a.memoizedProps,E=v.id,H=v.onPostCommit;typeof H=="function"&&H(E,a.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(J){on(a,a.return,J)}}else os(r,a,c,h);break;case 31:os(r,a,c,h);break;case 13:os(r,a,c,h);break;case 23:break;case 22:v=a.stateNode,E=a.alternate,a.memoizedState!==null?v._visibility&2?os(r,a,c,h):Tu(r,a):v._visibility&2?os(r,a,c,h):(v._visibility|=2,Gl(r,a,c,h,(a.subtreeFlags&10256)!==0||!1)),g&2048&&_y(E,a);break;case 24:os(r,a,c,h),g&2048&&vy(a.alternate,a);break;default:os(r,a,c,h)}}function Gl(r,a,c,h,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=r,E=a,H=c,J=h,ce=E.flags;switch(E.tag){case 0:case 11:case 15:Gl(v,E,H,J,g),Eu(8,E);break;case 23:break;case 22:var _e=E.stateNode;E.memoizedState!==null?_e._visibility&2?Gl(v,E,H,J,g):Tu(v,E):(_e._visibility|=2,Gl(v,E,H,J,g)),g&&ce&2048&&_y(E.alternate,E);break;case 24:Gl(v,E,H,J,g),g&&ce&2048&&vy(E.alternate,E);break;default:Gl(v,E,H,J,g)}a=a.sibling}}function Tu(r,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var c=r,h=a,g=h.flags;switch(h.tag){case 22:Tu(c,h),g&2048&&_y(h.alternate,h);break;case 24:Tu(c,h),g&2048&&vy(h.alternate,h);break;default:Tu(c,h)}a=a.sibling}}var Ru=8192;function Kl(r,a,c){if(r.subtreeFlags&Ru)for(r=r.child;r!==null;)bC(r,a,c),r=r.sibling}function bC(r,a,c){switch(r.tag){case 26:Kl(r,a,c),r.flags&Ru&&r.memoizedState!==null&&lD(c,as,r.memoizedState,r.memoizedProps);break;case 5:Kl(r,a,c);break;case 3:case 4:var h=as;as=df(r.stateNode.containerInfo),Kl(r,a,c),as=h;break;case 22:r.memoizedState===null&&(h=r.alternate,h!==null&&h.memoizedState!==null?(h=Ru,Ru=16777216,Kl(r,a,c),Ru=h):Kl(r,a,c));break;default:Kl(r,a,c)}}function wC(r){var a=r.alternate;if(a!==null&&(r=a.child,r!==null)){a.child=null;do a=r.sibling,r.sibling=null,r=a;while(r!==null)}}function Mu(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];fi=h,xC(h,r)}wC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)SC(r),r=r.sibling}function SC(r){switch(r.tag){case 0:case 11:case 15:Mu(r),r.flags&2048&&Pa(9,r,r.return);break;case 3:Mu(r);break;case 12:Mu(r);break;case 22:var a=r.stateNode;r.memoizedState!==null&&a._visibility&2&&(r.return===null||r.return.tag!==13)?(a._visibility&=-3,Zh(r)):Mu(r);break;default:Mu(r)}}function Zh(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var c=0;c<a.length;c++){var h=a[c];fi=h,xC(h,r)}wC(r)}for(r=r.child;r!==null;){switch(a=r,a.tag){case 0:case 11:case 15:Pa(8,a,a.return),Zh(a);break;case 22:c=a.stateNode,c._visibility&2&&(c._visibility&=-3,Zh(a));break;default:Zh(a)}r=r.sibling}}function xC(r,a){for(;fi!==null;){var c=fi;switch(c.tag){case 0:case 11:case 15:Pa(8,c,a);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:fu(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,fi=h;else e:for(c=r;fi!==null;){h=fi;var g=h.sibling,v=h.return;if(fC(h),h===c){fi=null;break e}if(g!==null){g.return=v,fi=g;break e}fi=v}}}var x6={getCacheForType:function(r){var a=ki(Jn),c=a.data.get(r);return c===void 0&&(c=r(),a.data.set(r,c)),c},cacheSignal:function(){return ki(Jn).controller.signal}},C6=typeof WeakMap=="function"?WeakMap:Map,nn=0,gn=null,zt=null,Ut=0,an=0,vr=null,za=!1,Vl=!1,by=!1,aa=0,Dn=0,$a=0,qo=0,wy=0,br=0,Yl=0,Lu=null,rr=null,Sy=!1,Jh=0,CC=0,Qh=1/0,ef=null,Fa=null,oi=0,Ha=null,Xl=null,oa=0,xy=0,Cy=null,kC=null,Nu=0,ky=null;function wr(){return(nn&2)!==0&&Ut!==0?Ut&-Ut:A.T!==null?Ly():$i()}function EC(){if(br===0)if((Ut&536870912)===0||qt){var r=Ee;Ee<<=1,(Ee&3932160)===0&&(Ee=262144),br=r}else br=536870912;return r=yr.current,r!==null&&(r.flags|=32),br}function sr(r,a,c){(r===gn&&(an===2||an===9)||r.cancelPendingCommit!==null)&&(Zl(r,0),Ua(r,Ut,br,!1)),Pt(r,c),((nn&2)===0||r!==gn)&&(r===gn&&((nn&2)===0&&(qo|=c),Dn===4&&Ua(r,Ut,br,!1)),Ss(r))}function AC(r,a,c){if((nn&6)!==0)throw Error(i(327));var h=!c&&(a&127)===0&&(a&r.expiredLanes)===0||he(r,a),g=h?A6(r,a):Ay(r,a,!0),v=h;do{if(g===0){Vl&&!h&&Ua(r,a,0,!1);break}else{if(c=r.current.alternate,v&&!k6(c)){g=Ay(r,a,!1),v=!1;continue}if(g===2){if(v=a,r.errorRecoveryDisabledLanes&v)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var H=r;g=Lu;var J=H.current.memoizedState.isDehydrated;if(J&&(Zl(H,E).flags|=256),E=Ay(H,E,!1),E!==2){if(by&&!J){H.errorRecoveryDisabledLanes|=v,qo|=v,g=4;break e}v=rr,rr=g,v!==null&&(rr===null?rr=v:rr.push.apply(rr,v))}g=E}if(v=!1,g!==2)continue}}if(g===1){Zl(r,0),Ua(r,a,0,!0);break}e:{switch(h=r,v=g,v){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:Ua(h,a,br,!za);break e;case 2:rr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(g=Jh+300-Ke(),10<g)){if(Ua(h,a,br,!za),Z(h,0,!0)!==0)break e;oa=a,h.timeoutHandle=rk(TC.bind(null,h,c,rr,ef,Sy,a,br,qo,Yl,za,v,"Throttled",-0,0),g);break e}TC(h,c,rr,ef,Sy,a,br,qo,Yl,za,v,null,-0,0)}}break}while(!0);Ss(r)}function TC(r,a,c,h,g,v,E,H,J,ce,_e,xe,ue,pe){if(r.timeoutHandle=-1,xe=a.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Le},bC(a,v,xe);var Ve=(v&62914560)===v?Jh-Ke():(v&4194048)===v?CC-Ke():0;if(Ve=cD(xe,Ve),Ve!==null){oa=v,r.cancelPendingCommit=Ve(jC.bind(null,r,a,v,c,h,g,E,H,J,_e,xe,null,ue,pe)),Ua(r,v,E,!ce);return}}jC(r,a,v,c,h,g,E,H,J)}function k6(r){for(var a=r;;){var c=a.tag;if((c===0||c===11||c===15)&&a.flags&16384&&(c=a.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var g=c[h],v=g.getSnapshot;g=g.value;try{if(!mr(v(),g))return!1}catch{return!1}}if(c=a.child,a.subtreeFlags&16384&&c!==null)c.return=a,a=c;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Ua(r,a,c,h){a&=~wy,a&=~qo,r.suspendedLanes|=a,r.pingedLanes&=~a,h&&(r.warmLanes|=a),h=r.expirationTimes;for(var g=a;0<g;){var v=31-Ne(g),E=1<<v;h[v]=-1,g&=~E}c!==0&&Oe(r,c,a)}function tf(){return(nn&6)===0?(Ou(0),!1):!0}function Ey(){if(zt!==null){if(an===0)var r=zt.return;else r=zt,Xs=jo=null,Hg(r),Fl=null,mu=0,r=zt;for(;r!==null;)sC(r.alternate,r),r=r.return;zt=null}}function Zl(r,a){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,q6(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),oa=0,Ey(),gn=r,zt=c=Vs(r.current,null),Ut=a,an=0,vr=null,za=!1,Vl=he(r,a),by=!1,Yl=br=wy=qo=$a=Dn=0,rr=Lu=null,Sy=!1,(a&8)!==0&&(a|=a&32);var h=r.entangledLanes;if(h!==0)for(r=r.entanglements,h&=a;0<h;){var g=31-Ne(h),v=1<<g;a|=r[g],h&=~v}return aa=a,Sh(),c}function RC(r,a){Ct=null,A.H=xu,a===$l||a===Mh?(a=q1(),an=3):a===Mg?(a=q1(),an=4):an=a===ry?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,vr=a,zt===null&&(Dn=1,Wh(r,Ir(a,r.current)))}function MC(){var r=yr.current;return r===null?!0:(Ut&4194048)===Ut?Pr===null:(Ut&62914560)===Ut||(Ut&536870912)!==0?r===Pr:!1}function LC(){var r=A.H;return A.H=xu,r===null?xu:r}function NC(){var r=A.A;return A.A=x6,r}function nf(){Dn=4,za||(Ut&4194048)!==Ut&&yr.current!==null||(Vl=!0),($a&134217727)===0&&(qo&134217727)===0||gn===null||Ua(gn,Ut,br,!1)}function Ay(r,a,c){var h=nn;nn|=2;var g=LC(),v=NC();(gn!==r||Ut!==a)&&(ef=null,Zl(r,a)),a=!1;var E=Dn;e:do try{if(an!==0&&zt!==null){var H=zt,J=vr;switch(an){case 8:Ey(),E=6;break e;case 3:case 2:case 9:case 6:yr.current===null&&(a=!0);var ce=an;if(an=0,vr=null,Jl(r,H,J,ce),c&&Vl){E=0;break e}break;default:ce=an,an=0,vr=null,Jl(r,H,J,ce)}}E6(),E=Dn;break}catch(_e){RC(r,_e)}while(!0);return a&&r.shellSuspendCounter++,Xs=jo=null,nn=h,A.H=g,A.A=v,zt===null&&(gn=null,Ut=0,Sh()),E}function E6(){for(;zt!==null;)OC(zt)}function A6(r,a){var c=nn;nn|=2;var h=LC(),g=NC();gn!==r||Ut!==a?(ef=null,Qh=Ke()+500,Zl(r,a)):Vl=he(r,a);e:do try{if(an!==0&&zt!==null){a=zt;var v=vr;t:switch(an){case 1:an=0,vr=null,Jl(r,a,v,1);break;case 2:case 9:if(U1(v)){an=0,vr=null,IC(a);break}a=function(){an!==2&&an!==9||gn!==r||(an=7),Ss(r)},v.then(a,a);break e;case 3:an=7;break e;case 4:an=5;break e;case 7:U1(v)?(an=0,vr=null,IC(a)):(an=0,vr=null,Jl(r,a,v,7));break;case 5:var E=null;switch(zt.tag){case 26:E=zt.memoizedState;case 5:case 27:var H=zt;if(E?vk(E):H.stateNode.complete){an=0,vr=null;var J=H.sibling;if(J!==null)zt=J;else{var ce=H.return;ce!==null?(zt=ce,rf(ce)):zt=null}break t}}an=0,vr=null,Jl(r,a,v,5);break;case 6:an=0,vr=null,Jl(r,a,v,6);break;case 8:Ey(),Dn=6;break e;default:throw Error(i(462))}}T6();break}catch(_e){RC(r,_e)}while(!0);return Xs=jo=null,A.H=h,A.A=g,nn=c,zt!==null?0:(gn=null,Ut=0,Sh(),Dn)}function T6(){for(;zt!==null&&!Je();)OC(zt)}function OC(r){var a=iC(r.alternate,r,aa);r.memoizedProps=r.pendingProps,a===null?rf(r):zt=a}function IC(r){var a=r,c=a.alternate;switch(a.tag){case 15:case 0:a=Zx(c,a,a.pendingProps,a.type,void 0,Ut);break;case 11:a=Zx(c,a,a.pendingProps,a.type.render,a.ref,Ut);break;case 5:Hg(a);default:sC(c,a),a=zt=N1(a,aa),a=iC(c,a,aa)}r.memoizedProps=r.pendingProps,a===null?rf(r):zt=a}function Jl(r,a,c,h){Xs=jo=null,Hg(a),Fl=null,mu=0;var g=a.return;try{if(g6(r,g,a,c,Ut)){Dn=1,Wh(r,Ir(c,r.current)),zt=null;return}}catch(v){if(g!==null)throw zt=g,v;Dn=1,Wh(r,Ir(c,r.current)),zt=null;return}a.flags&32768?(qt||h===1?r=!0:Vl||(Ut&536870912)!==0?r=!1:(za=r=!0,(h===2||h===9||h===3||h===6)&&(h=yr.current,h!==null&&h.tag===13&&(h.flags|=16384))),DC(a,r)):rf(a)}function rf(r){var a=r;do{if((a.flags&32768)!==0){DC(a,za);return}r=a.return;var c=v6(a.alternate,a,aa);if(c!==null){zt=c;return}if(a=a.sibling,a!==null){zt=a;return}zt=a=r}while(a!==null);Dn===0&&(Dn=5)}function DC(r,a){do{var c=b6(r.alternate,r);if(c!==null){c.flags&=32767,zt=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!a&&(r=r.sibling,r!==null)){zt=r;return}zt=r=c}while(r!==null);Dn=6,zt=null}function jC(r,a,c,h,g,v,E,H,J){r.cancelPendingCommit=null;do sf();while(oi!==0);if((nn&6)!==0)throw Error(i(327));if(a!==null){if(a===r.current)throw Error(i(177));if(v=a.lanes|a.childLanes,v|=mg,Fe(r,c,v,E,H,J),r===gn&&(zt=gn=null,Ut=0),Xl=a,Ha=r,oa=c,xy=v,Cy=g,kC=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,N6(de,function(){return FC(),null})):(r.callbackNode=null,r.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=A.T,A.T=null,g=O.p,O.p=2,E=nn,nn|=4;try{w6(r,a,c)}finally{nn=E,O.p=g,A.T=h}}oi=1,BC(),PC(),zC()}}function BC(){if(oi===1){oi=0;var r=Ha,a=Xl,c=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||c){c=A.T,A.T=null;var h=O.p;O.p=2;var g=nn;nn|=4;try{yC(a,r);var v=zy,E=x1(r.containerInfo),H=v.focusedElem,J=v.selectionRange;if(E!==H&&H&&H.ownerDocument&&S1(H.ownerDocument.documentElement,H)){if(J!==null&&ug(H)){var ce=J.start,_e=J.end;if(_e===void 0&&(_e=ce),"selectionStart"in H)H.selectionStart=ce,H.selectionEnd=Math.min(_e,H.value.length);else{var xe=H.ownerDocument||document,ue=xe&&xe.defaultView||window;if(ue.getSelection){var pe=ue.getSelection(),Ve=H.textContent.length,ct=Math.min(J.start,Ve),dn=J.end===void 0?ct:Math.min(J.end,Ve);!pe.extend&&ct>dn&&(E=dn,dn=ct,ct=E);var re=w1(H,ct),te=w1(H,dn);if(re&&te&&(pe.rangeCount!==1||pe.anchorNode!==re.node||pe.anchorOffset!==re.offset||pe.focusNode!==te.node||pe.focusOffset!==te.offset)){var le=xe.createRange();le.setStart(re.node,re.offset),pe.removeAllRanges(),ct>dn?(pe.addRange(le),pe.extend(te.node,te.offset)):(le.setEnd(te.node,te.offset),pe.addRange(le))}}}}for(xe=[],pe=H;pe=pe.parentNode;)pe.nodeType===1&&xe.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<xe.length;H++){var be=xe[H];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}yf=!!Py,zy=Py=null}finally{nn=g,O.p=h,A.T=c}}r.current=a,oi=2}}function PC(){if(oi===2){oi=0;var r=Ha,a=Xl,c=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||c){c=A.T,A.T=null;var h=O.p;O.p=2;var g=nn;nn|=4;try{hC(r,a.alternate,a)}finally{nn=g,O.p=h,A.T=c}}oi=3}}function zC(){if(oi===4||oi===3){oi=0,It();var r=Ha,a=Xl,c=oa,h=kC;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?oi=5:(oi=0,Xl=Ha=null,$C(r,r.pendingLanes));var g=r.pendingLanes;if(g===0&&(Fa=null),Rn(c),a=a.stateNode,_t&&typeof _t.onCommitFiberRoot=="function")try{_t.onCommitFiberRoot(Gt,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=A.T,g=O.p,O.p=2,A.T=null;try{for(var v=r.onRecoverableError,E=0;E<h.length;E++){var H=h[E];v(H.value,{componentStack:H.stack})}}finally{A.T=a,O.p=g}}(oa&3)!==0&&sf(),Ss(r),g=r.pendingLanes,(c&261930)!==0&&(g&42)!==0?r===ky?Nu++:(Nu=0,ky=r):Nu=0,Ou(0)}}function $C(r,a){(r.pooledCacheLanes&=a)===0&&(a=r.pooledCache,a!=null&&(r.pooledCache=null,fu(a)))}function sf(){return BC(),PC(),zC(),FC()}function FC(){if(oi!==5)return!1;var r=Ha,a=xy;xy=0;var c=Rn(oa),h=A.T,g=O.p;try{O.p=32>c?32:c,A.T=null,c=Cy,Cy=null;var v=Ha,E=oa;if(oi=0,Xl=Ha=null,oa=0,(nn&6)!==0)throw Error(i(331));var H=nn;if(nn|=4,SC(v.current),vC(v,v.current,E,c),nn=H,Ou(0,!1),_t&&typeof _t.onPostCommitFiberRoot=="function")try{_t.onPostCommitFiberRoot(Gt,v)}catch{}return!0}finally{O.p=g,A.T=h,$C(r,a)}}function HC(r,a,c){a=Ir(c,a),a=iy(r.stateNode,a,2),r=Da(r,a,2),r!==null&&(Pt(r,2),Ss(r))}function on(r,a,c){if(r.tag===3)HC(r,r,c);else for(;a!==null;){if(a.tag===3){HC(a,r,c);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Fa===null||!Fa.has(h))){r=Ir(c,r),c=Ux(2),h=Da(a,c,2),h!==null&&(Wx(c,h,a,r),Pt(h,2),Ss(h));break}}a=a.return}}function Ty(r,a,c){var h=r.pingCache;if(h===null){h=r.pingCache=new C6;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(c)||(by=!0,g.add(c),r=R6.bind(null,r,a,c),a.then(r,r))}function R6(r,a,c){var h=r.pingCache;h!==null&&h.delete(a),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,gn===r&&(Ut&c)===c&&(Dn===4||Dn===3&&(Ut&62914560)===Ut&&300>Ke()-Jh?(nn&2)===0&&Zl(r,0):wy|=c,Yl===Ut&&(Yl=0)),Ss(r)}function UC(r,a){a===0&&(a=Ge()),r=Oo(r,a),r!==null&&(Pt(r,a),Ss(r))}function M6(r){var a=r.memoizedState,c=0;a!==null&&(c=a.retryLane),UC(r,c)}function L6(r,a){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,g=r.memoizedState;g!==null&&(c=g.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(a),UC(r,c)}function N6(r,a){return ye(r,a)}var af=null,Ql=null,Ry=!1,of=!1,My=!1,Wa=0;function Ss(r){r!==Ql&&r.next===null&&(Ql===null?af=Ql=r:Ql=Ql.next=r),of=!0,Ry||(Ry=!0,I6())}function Ou(r,a){if(!My&&of){My=!0;do for(var c=!1,h=af;h!==null;){if(r!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var E=h.suspendedLanes,H=h.pingedLanes;v=(1<<31-Ne(42|r)+1)-1,v&=g&~(E&~H),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,KC(h,v))}else v=Ut,v=Z(h,h===gn?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||he(h,v)||(c=!0,KC(h,v));h=h.next}while(c);My=!1}}function O6(){WC()}function WC(){of=Ry=!1;var r=0;Wa!==0&&W6()&&(r=Wa);for(var a=Ke(),c=null,h=af;h!==null;){var g=h.next,v=qC(h,a);v===0?(h.next=null,c===null?af=g:c.next=g,g===null&&(Ql=c)):(c=h,(r!==0||(v&3)!==0)&&(of=!0)),h=g}oi!==0&&oi!==5||Ou(r),Wa!==0&&(Wa=0)}function qC(r,a){for(var c=r.suspendedLanes,h=r.pingedLanes,g=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var E=31-Ne(v),H=1<<E,J=g[E];J===-1?((H&c)===0||(H&h)!==0)&&(g[E]=ke(H,a)):J<=a&&(r.expiredLanes|=H),v&=~H}if(a=gn,c=Ut,c=Z(r,r===a?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),h=r.callbackNode,c===0||r===a&&(an===2||an===9)||r.cancelPendingCommit!==null)return h!==null&&h!==null&&ze(h),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||he(r,c)){if(a=c&-c,a===r.callbackPriority)return a;switch(h!==null&&ze(h),Rn(c)){case 2:case 8:c=De;break;case 32:c=de;break;case 268435456:c=st;break;default:c=de}return h=GC.bind(null,r),c=ye(c,h),r.callbackPriority=a,r.callbackNode=c,a}return h!==null&&h!==null&&ze(h),r.callbackPriority=2,r.callbackNode=null,2}function GC(r,a){if(oi!==0&&oi!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(sf()&&r.callbackNode!==c)return null;var h=Ut;return h=Z(r,r===gn?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),h===0?null:(AC(r,h,a),qC(r,Ke()),r.callbackNode!=null&&r.callbackNode===c?GC.bind(null,r):null)}function KC(r,a){if(sf())return null;AC(r,a,!0)}function I6(){G6(function(){(nn&6)!==0?ye(we,O6):WC()})}function Ly(){if(Wa===0){var r=Pl;r===0&&(r=ge,ge<<=1,(ge&261888)===0&&(ge=256)),Wa=r}return Wa}function VC(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Aa(""+r)}function YC(r,a){var c=a.ownerDocument.createElement("input");return c.name=a.name,c.value=a.value,r.id&&c.setAttribute("form",r.id),a.parentNode.insertBefore(c,a),r=new FormData(r),c.parentNode.removeChild(c),r}function D6(r,a,c,h,g){if(a==="submit"&&c&&c.stateNode===g){var v=VC((g[Kt]||null).action),E=h.submitter;E&&(a=(a=E[Kt]||null)?VC(a.formAction):E.getAttribute("formAction"),a!==null&&(v=a,E=null));var H=new _h("action","action",null,h,g);r.push({event:H,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Wa!==0){var J=E?YC(g,E):new FormData(g);Zg(c,{pending:!0,data:J,method:g.method,action:v},null,J)}}else typeof v=="function"&&(H.preventDefault(),J=E?YC(g,E):new FormData(g),Zg(c,{pending:!0,data:J,method:g.method,action:v},v,J))},currentTarget:g}]})}}for(var Ny=0;Ny<pg.length;Ny++){var Oy=pg[Ny],j6=Oy.toLowerCase(),B6=Oy[0].toUpperCase()+Oy.slice(1);ss(j6,"on"+B6)}ss(E1,"onAnimationEnd"),ss(A1,"onAnimationIteration"),ss(T1,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(QI,"onTransitionRun"),ss(e6,"onTransitionStart"),ss(t6,"onTransitionCancel"),ss(R1,"onTransitionEnd"),fe("onMouseEnter",["mouseout","mouseover"]),fe("onMouseLeave",["mouseout","mouseover"]),fe("onPointerEnter",["pointerout","pointerover"]),fe("onPointerLeave",["pointerout","pointerover"]),Ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Iu="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(" "),P6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Iu));function XC(r,a){a=(a&4)!==0;for(var c=0;c<r.length;c++){var h=r[c],g=h.event;h=h.listeners;e:{var v=void 0;if(a)for(var E=h.length-1;0<=E;E--){var H=h[E],J=H.instance,ce=H.currentTarget;if(H=H.listener,J!==v&&g.isPropagationStopped())break e;v=H,g.currentTarget=ce;try{v(g)}catch(_e){wh(_e)}g.currentTarget=null,v=J}else for(E=0;E<h.length;E++){if(H=h[E],J=H.instance,ce=H.currentTarget,H=H.listener,J!==v&&g.isPropagationStopped())break e;v=H,g.currentTarget=ce;try{v(g)}catch(_e){wh(_e)}g.currentTarget=null,v=J}}}}function $t(r,a){var c=a[gs];c===void 0&&(c=a[gs]=new Set);var h=r+"__bubble";c.has(h)||(ZC(a,r,2,!1),c.add(h))}function Iy(r,a,c){var h=0;a&&(h|=4),ZC(c,r,h,a)}var lf="_reactListening"+Math.random().toString(36).slice(2);function Dy(r){if(!r[lf]){r[lf]=!0,ln.forEach(function(c){c!=="selectionchange"&&(P6.has(c)||Iy(c,!1,r),Iy(c,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[lf]||(a[lf]=!0,Iy("selectionchange",!1,a))}}function ZC(r,a,c,h){switch(Ek(a)){case 2:var g=hD;break;case 8:g=fD;break;default:g=Xy}c=g.bind(null,a,c,r),g=void 0,!tg||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),h?g!==void 0?r.addEventListener(a,c,{capture:!0,passive:g}):r.addEventListener(a,c,!0):g!==void 0?r.addEventListener(a,c,{passive:g}):r.addEventListener(a,c,!1)}function jy(r,a,c,h,g){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var E=h.tag;if(E===3||E===4){var H=h.stateNode.containerInfo;if(H===g)break;if(E===4)for(E=h.return;E!==null;){var J=E.tag;if((J===3||J===4)&&E.stateNode.containerInfo===g)return;E=E.return}for(;H!==null;){if(E=X(H),E===null)return;if(J=E.tag,J===5||J===6||J===26||J===27){h=v=E;continue e}H=H.parentNode}}h=h.return}ph(function(){var ce=v,_e=bt(c),xe=[];e:{var ue=M1.get(r);if(ue!==void 0){var pe=_h,Ve=r;switch(r){case"keypress":if(gh(c)===0)break e;case"keydown":case"keyup":pe=LI;break;case"focusin":Ve="focus",pe=sg;break;case"focusout":Ve="blur",pe=sg;break;case"beforeblur":case"afterblur":pe=sg;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=s1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=vI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=II;break;case E1:case A1:case T1:pe=SI;break;case R1:pe=jI;break;case"scroll":case"scrollend":pe=yI;break;case"wheel":pe=PI;break;case"copy":case"cut":case"paste":pe=CI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=o1;break;case"toggle":case"beforetoggle":pe=$I}var ct=(a&4)!==0,dn=!ct&&(r==="scroll"||r==="scrollend"),re=ct?ue!==null?ue+"Capture":null:ue;ct=[];for(var te=ce,le;te!==null;){var be=te;if(le=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||le===null||re===null||(be=nu(te,re),be!=null&&ct.push(Du(te,be,le))),dn)break;te=te.return}0<ct.length&&(ue=new pe(ue,Ve,null,c,_e),xe.push({event:ue,listeners:ct}))}}if((a&7)===0){e:{if(ue=r==="mouseover"||r==="pointerover",pe=r==="mouseout"||r==="pointerout",ue&&c!==Xe&&(Ve=c.relatedTarget||c.fromElement)&&(X(Ve)||Ve[Qi]))break e;if((pe||ue)&&(ue=_e.window===_e?_e:(ue=_e.ownerDocument)?ue.defaultView||ue.parentWindow:window,pe?(Ve=c.relatedTarget||c.toElement,pe=ce,Ve=Ve?X(Ve):null,Ve!==null&&(dn=o(Ve),ct=Ve.tag,Ve!==dn||ct!==5&&ct!==27&&ct!==6)&&(Ve=null)):(pe=null,Ve=ce),pe!==Ve)){if(ct=s1,be="onMouseLeave",re="onMouseEnter",te="mouse",(r==="pointerout"||r==="pointerover")&&(ct=o1,be="onPointerLeave",re="onPointerEnter",te="pointer"),dn=pe==null?ue:Be(pe),le=Ve==null?ue:Be(Ve),ue=new ct(be,te+"leave",pe,c,_e),ue.target=dn,ue.relatedTarget=le,be=null,X(_e)===ce&&(ct=new ct(re,te+"enter",Ve,c,_e),ct.target=le,ct.relatedTarget=dn,be=ct),dn=be,pe&&Ve)t:{for(ct=z6,re=pe,te=Ve,le=0,be=re;be;be=ct(be))le++;be=0;for(var it=te;it;it=ct(it))be++;for(;0<le-be;)re=ct(re),le--;for(;0<be-le;)te=ct(te),be--;for(;le--;){if(re===te||te!==null&&re===te.alternate){ct=re;break t}re=ct(re),te=ct(te)}ct=null}else ct=null;pe!==null&&JC(xe,ue,pe,ct,!1),Ve!==null&&dn!==null&&JC(xe,dn,Ve,ct,!0)}}e:{if(ue=ce?Be(ce):window,pe=ue.nodeName&&ue.nodeName.toLowerCase(),pe==="select"||pe==="input"&&ue.type==="file")var Yt=m1;else if(f1(ue))if(g1)Yt=XI;else{Yt=VI;var Ze=KI}else pe=ue.nodeName,!pe||pe.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ce&&_s(ce.elementType)&&(Yt=m1):Yt=YI;if(Yt&&(Yt=Yt(r,ce))){p1(xe,Yt,c,_e);break e}Ze&&Ze(r,ue,ce),r==="focusout"&&ce&&ue.type==="number"&&ce.memoizedProps.value!=null&&Un(ue,"number",ue.value)}switch(Ze=ce?Be(ce):window,r){case"focusin":(f1(Ze)||Ze.contentEditable==="true")&&(Ml=Ze,dg=ce,uu=null);break;case"focusout":uu=dg=Ml=null;break;case"mousedown":hg=!0;break;case"contextmenu":case"mouseup":case"dragend":hg=!1,C1(xe,c,_e);break;case"selectionchange":if(JI)break;case"keydown":case"keyup":C1(xe,c,_e)}var Et;if(og)e:{switch(r){case"compositionstart":var Wt="onCompositionStart";break e;case"compositionend":Wt="onCompositionEnd";break e;case"compositionupdate":Wt="onCompositionUpdate";break e}Wt=void 0}else Rl?d1(r,c)&&(Wt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Wt="onCompositionStart");Wt&&(l1&&c.locale!=="ko"&&(Rl||Wt!=="onCompositionStart"?Wt==="onCompositionEnd"&&Rl&&(Et=i1()):(Ta=_e,ng="value"in Ta?Ta.value:Ta.textContent,Rl=!0)),Ze=cf(ce,Wt),0<Ze.length&&(Wt=new a1(Wt,r,null,c,_e),xe.push({event:Wt,listeners:Ze}),Et?Wt.data=Et:(Et=h1(c),Et!==null&&(Wt.data=Et)))),(Et=HI?UI(r,c):WI(r,c))&&(Wt=cf(ce,"onBeforeInput"),0<Wt.length&&(Ze=new a1("onBeforeInput","beforeinput",null,c,_e),xe.push({event:Ze,listeners:Wt}),Ze.data=Et)),D6(xe,r,ce,c,_e)}XC(xe,a)})}function Du(r,a,c){return{instance:r,listener:a,currentTarget:c}}function cf(r,a){for(var c=a+"Capture",h=[];r!==null;){var g=r,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=nu(r,c),g!=null&&h.unshift(Du(r,g,v)),g=nu(r,a),g!=null&&h.push(Du(r,g,v))),r.tag===3)return h;r=r.return}return[]}function z6(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function JC(r,a,c,h,g){for(var v=a._reactName,E=[];c!==null&&c!==h;){var H=c,J=H.alternate,ce=H.stateNode;if(H=H.tag,J!==null&&J===h)break;H!==5&&H!==26&&H!==27||ce===null||(J=ce,g?(ce=nu(c,v),ce!=null&&E.unshift(Du(c,ce,J))):g||(ce=nu(c,v),ce!=null&&E.push(Du(c,ce,J)))),c=c.return}E.length!==0&&r.push({event:a,listeners:E})}var $6=/\r\n?/g,F6=/\u0000|\uFFFD/g;function QC(r){return(typeof r=="string"?r:""+r).replace($6,`
9
+ `).replace(F6,"")}function ek(r,a){return a=QC(a),QC(r)===a}function un(r,a,c,h,g,v){switch(c){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||lt(r,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&lt(r,""+h);break;case"className":Yn(r,"class",h);break;case"tabIndex":Yn(r,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Yn(r,c,h);break;case"style":tn(r,h,v);break;case"data":if(a!=="object"){Yn(r,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||c!=="href")){r.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){r.removeAttribute(c);break}h=Aa(""+h),r.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){r.setAttribute(c,"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"&&(c==="formAction"?(a!=="input"&&un(r,a,"name",g.name,g,null),un(r,a,"formEncType",g.formEncType,g,null),un(r,a,"formMethod",g.formMethod,g,null),un(r,a,"formTarget",g.formTarget,g,null)):(un(r,a,"encType",g.encType,g,null),un(r,a,"method",g.method,g,null),un(r,a,"target",g.target,g,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){r.removeAttribute(c);break}h=Aa(""+h),r.setAttribute(c,h);break;case"onClick":h!=null&&(r.onclick=Le);break;case"onScroll":h!=null&&$t("scroll",r);break;case"onScrollEnd":h!=null&&$t("scrollend",r);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(g.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"multiple":r.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":r.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"){r.removeAttribute("xlink:href");break}c=Aa(""+h),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);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"?r.setAttribute(c,""+h):r.removeAttribute(c);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"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":h===!0?r.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?r.setAttribute(c,h):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?r.setAttribute(c,h):r.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?r.removeAttribute(c):r.setAttribute(c,h);break;case"popover":$t("beforetoggle",r),$t("toggle",r),rn(r,"popover",h);break;case"xlinkActuate":Fn(r,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":Fn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":Fn(r,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":Fn(r,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":Fn(r,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":Fn(r,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":Fn(r,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":Fn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":Fn(r,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":rn(r,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Gs.get(c)||c,rn(r,c,h))}}function By(r,a,c,h,g,v){switch(c){case"style":tn(r,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(g.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof h=="string"?lt(r,h):(typeof h=="number"||typeof h=="bigint")&&lt(r,""+h);break;case"onScroll":h!=null&&$t("scroll",r);break;case"onScrollEnd":h!=null&&$t("scrollend",r);break;case"onClick":h!=null&&(r.onclick=Le);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ie.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),a=c.slice(2,g?c.length-7:void 0),v=r[Kt]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(a,v,g),typeof h=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(a,h,g);break e}c in r?r[c]=h:h===!0?r.setAttribute(c,""):rn(r,c,h)}}}function Ai(r,a,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$t("error",r),$t("load",r);var h=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var E=c[v];if(E!=null)switch(v){case"src":h=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:un(r,a,v,E,c,null)}}g&&un(r,a,"srcSet",c.srcSet,c,null),h&&un(r,a,"src",c.src,c,null);return;case"input":$t("invalid",r);var H=v=E=g=null,J=null,ce=null;for(h in c)if(c.hasOwnProperty(h)){var _e=c[h];if(_e!=null)switch(h){case"name":g=_e;break;case"type":E=_e;break;case"checked":J=_e;break;case"defaultChecked":ce=_e;break;case"value":v=_e;break;case"defaultValue":H=_e;break;case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(i(137,a));break;default:un(r,a,h,_e,c,null)}}rs(r,v,H,J,ce,E,g,!1);return;case"select":$t("invalid",r),h=E=v=null;for(g in c)if(c.hasOwnProperty(g)&&(H=c[g],H!=null))switch(g){case"value":v=H;break;case"defaultValue":E=H;break;case"multiple":h=H;default:un(r,a,g,H,c,null)}a=v,c=E,r.multiple=!!h,a!=null?Wn(r,!!h,a,!1):c!=null&&Wn(r,!!h,c,!0);return;case"textarea":$t("invalid",r),v=g=h=null;for(E in c)if(c.hasOwnProperty(E)&&(H=c[E],H!=null))switch(E){case"value":h=H;break;case"defaultValue":g=H;break;case"children":v=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(i(91));break;default:un(r,a,E,H,c,null)}qs(r,h,g,v);return;case"option":for(J in c)c.hasOwnProperty(J)&&(h=c[J],h!=null)&&(J==="selected"?r.selected=h&&typeof h!="function"&&typeof h!="symbol":un(r,a,J,h,c,null));return;case"dialog":$t("beforetoggle",r),$t("toggle",r),$t("cancel",r),$t("close",r);break;case"iframe":case"object":$t("load",r);break;case"video":case"audio":for(h=0;h<Iu.length;h++)$t(Iu[h],r);break;case"image":$t("error",r),$t("load",r);break;case"details":$t("toggle",r);break;case"embed":case"source":case"link":$t("error",r),$t("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ce in c)if(c.hasOwnProperty(ce)&&(h=c[ce],h!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:un(r,a,ce,h,c,null)}return;default:if(_s(a)){for(_e in c)c.hasOwnProperty(_e)&&(h=c[_e],h!==void 0&&By(r,a,_e,h,c,void 0));return}}for(H in c)c.hasOwnProperty(H)&&(h=c[H],h!=null&&un(r,a,H,h,c,null))}function H6(r,a,c,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,E=null,H=null,J=null,ce=null,_e=null;for(pe in c){var xe=c[pe];if(c.hasOwnProperty(pe)&&xe!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":J=xe;default:h.hasOwnProperty(pe)||un(r,a,pe,null,h,xe)}}for(var ue in h){var pe=h[ue];if(xe=c[ue],h.hasOwnProperty(ue)&&(pe!=null||xe!=null))switch(ue){case"type":v=pe;break;case"name":g=pe;break;case"checked":ce=pe;break;case"defaultChecked":_e=pe;break;case"value":E=pe;break;case"defaultValue":H=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(i(137,a));break;default:pe!==xe&&un(r,a,ue,pe,h,xe)}}Ws(r,E,H,J,ce,_e,v,g);return;case"select":pe=E=H=ue=null;for(v in c)if(J=c[v],c.hasOwnProperty(v)&&J!=null)switch(v){case"value":break;case"multiple":pe=J;default:h.hasOwnProperty(v)||un(r,a,v,null,h,J)}for(g in h)if(v=h[g],J=c[g],h.hasOwnProperty(g)&&(v!=null||J!=null))switch(g){case"value":ue=v;break;case"defaultValue":H=v;break;case"multiple":E=v;default:v!==J&&un(r,a,g,v,h,J)}a=H,c=E,h=pe,ue!=null?Wn(r,!!c,ue,!1):!!h!=!!c&&(a!=null?Wn(r,!!c,a,!0):Wn(r,!!c,c?[]:"",!1));return;case"textarea":pe=ue=null;for(H in c)if(g=c[H],c.hasOwnProperty(H)&&g!=null&&!h.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:un(r,a,H,null,h,g)}for(E in h)if(g=h[E],v=c[E],h.hasOwnProperty(E)&&(g!=null||v!=null))switch(E){case"value":ue=g;break;case"defaultValue":pe=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&un(r,a,E,g,h,v)}Al(r,ue,pe);return;case"option":for(var Ve in c)ue=c[Ve],c.hasOwnProperty(Ve)&&ue!=null&&!h.hasOwnProperty(Ve)&&(Ve==="selected"?r.selected=!1:un(r,a,Ve,null,h,ue));for(J in h)ue=h[J],pe=c[J],h.hasOwnProperty(J)&&ue!==pe&&(ue!=null||pe!=null)&&(J==="selected"?r.selected=ue&&typeof ue!="function"&&typeof ue!="symbol":un(r,a,J,ue,h,pe));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 ct in c)ue=c[ct],c.hasOwnProperty(ct)&&ue!=null&&!h.hasOwnProperty(ct)&&un(r,a,ct,null,h,ue);for(ce in h)if(ue=h[ce],pe=c[ce],h.hasOwnProperty(ce)&&ue!==pe&&(ue!=null||pe!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(i(137,a));break;default:un(r,a,ce,ue,h,pe)}return;default:if(_s(a)){for(var dn in c)ue=c[dn],c.hasOwnProperty(dn)&&ue!==void 0&&!h.hasOwnProperty(dn)&&By(r,a,dn,void 0,h,ue);for(_e in h)ue=h[_e],pe=c[_e],!h.hasOwnProperty(_e)||ue===pe||ue===void 0&&pe===void 0||By(r,a,_e,ue,h,pe);return}}for(var re in c)ue=c[re],c.hasOwnProperty(re)&&ue!=null&&!h.hasOwnProperty(re)&&un(r,a,re,null,h,ue);for(xe in h)ue=h[xe],pe=c[xe],!h.hasOwnProperty(xe)||ue===pe||ue==null&&pe==null||un(r,a,xe,ue,h,pe)}function tk(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function U6(){if(typeof performance.getEntriesByType=="function"){for(var r=0,a=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var g=c[h],v=g.transferSize,E=g.initiatorType,H=g.duration;if(v&&H&&tk(E)){for(E=0,H=g.responseEnd,h+=1;h<c.length;h++){var J=c[h],ce=J.startTime;if(ce>H)break;var _e=J.transferSize,xe=J.initiatorType;_e&&tk(xe)&&(J=J.responseEnd,E+=_e*(J<H?1:(H-ce)/(J-ce)))}if(--h,a+=8*(v+E)/(g.duration/1e3),r++,10<r)break}}if(0<r)return a/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Py=null,zy=null;function uf(r){return r.nodeType===9?r:r.ownerDocument}function nk(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ik(r,a){if(r===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&a==="foreignObject"?0:r}function $y(r,a){return r==="textarea"||r==="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 Fy=null;function W6(){var r=window.event;return r&&r.type==="popstate"?r===Fy?!1:(Fy=r,!0):(Fy=null,!1)}var rk=typeof setTimeout=="function"?setTimeout:void 0,q6=typeof clearTimeout=="function"?clearTimeout:void 0,sk=typeof Promise=="function"?Promise:void 0,G6=typeof queueMicrotask=="function"?queueMicrotask:typeof sk<"u"?function(r){return sk.resolve(null).then(r).catch(K6)}:rk;function K6(r){setTimeout(function(){throw r})}function qa(r){return r==="head"}function ak(r,a){var c=a,h=0;do{var g=c.nextSibling;if(r.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(h===0){r.removeChild(g),ic(a);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")ju(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,ju(c);for(var v=c.firstChild;v;){var E=v.nextSibling,H=v.nodeName;v[pr]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=E}}else c==="body"&&ju(r.ownerDocument.body);c=g}while(c);ic(a)}function ok(r,a){var c=r;r=0;do{var h=c.nextSibling;if(c.nodeType===1?a?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(a?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=h}while(c)}function Hy(r){var a=r.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var c=a;switch(a=a.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Hy(c),et(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function V6(r,a,c,h){for(;r.nodeType===1;){var g=c;if(r.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(h){if(!r[pr])switch(a){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==g.rel||r.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||r.getAttribute("title")!==(g.title==null?null:g.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(g.src==null?null:g.src)||r.getAttribute("type")!==(g.type==null?null:g.type)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(a==="input"&&r.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=zr(r.nextSibling),r===null)break}return null}function Y6(r,a,c){if(a==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=zr(r.nextSibling),r===null))return null;return r}function lk(r,a){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!a||(r=zr(r.nextSibling),r===null))return null;return r}function Uy(r){return r.data==="$?"||r.data==="$~"}function Wy(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function X6(r,a){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=a;else if(r.data!=="$?"||c.readyState!=="loading")a();else{var h=function(){a(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),r._reactRetry=h}}function zr(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return r}var qy=null;function ck(r){r=r.nextSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(a===0)return zr(r.nextSibling);a--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||a++}r=r.nextSibling}return null}function uk(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(a===0)return r;a--}else c!=="/$"&&c!=="/&"||a++}r=r.previousSibling}return null}function dk(r,a,c){switch(a=uf(c),r){case"html":if(r=a.documentElement,!r)throw Error(i(452));return r;case"head":if(r=a.head,!r)throw Error(i(453));return r;case"body":if(r=a.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function ju(r){for(var a=r.attributes;a.length;)r.removeAttributeNode(a[0]);et(r)}var $r=new Map,hk=new Set;function df(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var la=O.d;O.d={f:Z6,r:J6,D:Q6,C:eD,L:tD,m:nD,X:rD,S:iD,M:sD};function Z6(){var r=la.f(),a=tf();return r||a}function J6(r){var a=Se(r);a!==null&&a.tag===5&&a.type==="form"?Rx(a):la.r(r)}var ec=typeof document>"u"?null:document;function fk(r,a,c){var h=ec;if(h&&typeof a=="string"&&a){var g=Hn(a);g='link[rel="'+r+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),hk.has(g)||(hk.add(g),r={rel:r,crossOrigin:c,href:a},h.querySelector(g)===null&&(a=h.createElement("link"),Ai(a,"link",r),Rt(a),h.head.appendChild(a)))}}function Q6(r){la.D(r),fk("dns-prefetch",r,null)}function eD(r,a){la.C(r,a),fk("preconnect",r,a)}function tD(r,a,c){la.L(r,a,c);var h=ec;if(h&&r&&a){var g='link[rel="preload"][as="'+Hn(a)+'"]';a==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+Hn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+Hn(c.imageSizes)+'"]')):g+='[href="'+Hn(r)+'"]';var v=g;switch(a){case"style":v=tc(r);break;case"script":v=nc(r)}$r.has(v)||(r=y({rel:"preload",href:a==="image"&&c&&c.imageSrcSet?void 0:r,as:a},c),$r.set(v,r),h.querySelector(g)!==null||a==="style"&&h.querySelector(Bu(v))||a==="script"&&h.querySelector(Pu(v))||(a=h.createElement("link"),Ai(a,"link",r),Rt(a),h.head.appendChild(a)))}}function nD(r,a){la.m(r,a);var c=ec;if(c&&r){var h=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+Hn(h)+'"][href="'+Hn(r)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=nc(r)}if(!$r.has(v)&&(r=y({rel:"modulepreload",href:r},a),$r.set(v,r),c.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Pu(v)))return}h=c.createElement("link"),Ai(h,"link",r),Rt(h),c.head.appendChild(h)}}}function iD(r,a,c){la.S(r,a,c);var h=ec;if(h&&r){var g=Bt(h).hoistableStyles,v=tc(r);a=a||"default";var E=g.get(v);if(!E){var H={loading:0,preload:null};if(E=h.querySelector(Bu(v)))H.loading=5;else{r=y({rel:"stylesheet",href:r,"data-precedence":a},c),(c=$r.get(v))&&Gy(r,c);var J=E=h.createElement("link");Rt(J),Ai(J,"link",r),J._p=new Promise(function(ce,_e){J.onload=ce,J.onerror=_e}),J.addEventListener("load",function(){H.loading|=1}),J.addEventListener("error",function(){H.loading|=2}),H.loading|=4,hf(E,a,h)}E={type:"stylesheet",instance:E,count:1,state:H},g.set(v,E)}}}function rD(r,a){la.X(r,a);var c=ec;if(c&&r){var h=Bt(c).hoistableScripts,g=nc(r),v=h.get(g);v||(v=c.querySelector(Pu(g)),v||(r=y({src:r,async:!0},a),(a=$r.get(g))&&Ky(r,a),v=c.createElement("script"),Rt(v),Ai(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function sD(r,a){la.M(r,a);var c=ec;if(c&&r){var h=Bt(c).hoistableScripts,g=nc(r),v=h.get(g);v||(v=c.querySelector(Pu(g)),v||(r=y({src:r,async:!0,type:"module"},a),(a=$r.get(g))&&Ky(r,a),v=c.createElement("script"),Rt(v),Ai(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function pk(r,a,c,h){var g=(g=ne.current)?df(g):null;if(!g)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(a=tc(c.href),c=Bt(g).hoistableStyles,h=c.get(a),h||(h={type:"style",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=tc(c.href);var v=Bt(g).hoistableStyles,E=v.get(r);if(E||(g=g.ownerDocument||g,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,E),(v=g.querySelector(Bu(r)))&&!v._p&&(E.instance=v,E.state.loading=5),$r.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},$r.set(r,c),v||aD(g,r,c,E.state))),a&&h===null)throw Error(i(528,""));return E}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=c.async,c=c.src,typeof c=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=nc(c),c=Bt(g).hoistableScripts,h=c.get(a),h||(h={type:"script",instance:null,count:0,state:null},c.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function tc(r){return'href="'+Hn(r)+'"'}function Bu(r){return'link[rel="stylesheet"]['+r+"]"}function mk(r){return y({},r,{"data-precedence":r.precedence,precedence:null})}function aD(r,a,c,h){r.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=r.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),Ai(a,"link",c),Rt(a),r.head.appendChild(a))}function nc(r){return'[src="'+Hn(r)+'"]'}function Pu(r){return"script[async]"+r}function gk(r,a,c){if(a.count++,a.instance===null)switch(a.type){case"style":var h=r.querySelector('style[data-href~="'+Hn(c.href)+'"]');if(h)return a.instance=h,Rt(h),h;var g=y({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),Rt(h),Ai(h,"style",g),hf(h,c.precedence,r),a.instance=h;case"stylesheet":g=tc(c.href);var v=r.querySelector(Bu(g));if(v)return a.state.loading|=4,a.instance=v,Rt(v),v;h=mk(c),(g=$r.get(g))&&Gy(h,g),v=(r.ownerDocument||r).createElement("link"),Rt(v);var E=v;return E._p=new Promise(function(H,J){E.onload=H,E.onerror=J}),Ai(v,"link",h),a.state.loading|=4,hf(v,c.precedence,r),a.instance=v;case"script":return v=nc(c.src),(g=r.querySelector(Pu(v)))?(a.instance=g,Rt(g),g):(h=c,(g=$r.get(v))&&(h=y({},c),Ky(h,g)),r=r.ownerDocument||r,g=r.createElement("script"),Rt(g),Ai(g,"link",h),r.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,hf(h,c.precedence,r));return a.instance}function hf(r,a,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,E=0;E<h.length;E++){var H=h[E];if(H.dataset.precedence===a)v=H;else if(v!==g)break}v?v.parentNode.insertBefore(r,v.nextSibling):(a=c.nodeType===9?c.head:c,a.insertBefore(r,a.firstChild))}function Gy(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.title==null&&(r.title=a.title)}function Ky(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.integrity==null&&(r.integrity=a.integrity)}var ff=null;function yk(r,a,c){if(ff===null){var h=new Map,g=ff=new Map;g.set(c,h)}else g=ff,h=g.get(c),h||(h=new Map,g.set(c,h));if(h.has(r))return h;for(h.set(r,null),c=c.getElementsByTagName(r),g=0;g<c.length;g++){var v=c[g];if(!(v[pr]||v[Ft]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var E=v.getAttribute(a)||"";E=r+E;var H=h.get(E);H?H.push(v):h.set(E,[v])}}return h}function _k(r,a,c){r=r.ownerDocument||r,r.head.insertBefore(c,a==="title"?r.querySelector("head > title"):null)}function oD(r,a,c){if(c===1||a.itemProp!=null)return!1;switch(r){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"?(r=a.disabled,typeof a.precedence=="string"&&r==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 vk(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function lD(r,a,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=tc(h.href),v=a.querySelector(Bu(g));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(r.count++,r=pf.bind(r),a.then(r,r)),c.state.loading|=4,c.instance=v,Rt(v);return}v=a.ownerDocument||a,h=mk(h),(g=$r.get(g))&&Gy(h,g),v=v.createElement("link"),Rt(v);var E=v;E._p=new Promise(function(H,J){E.onload=H,E.onerror=J}),Ai(v,"link",h),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,a),(a=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=pf.bind(r),a.addEventListener("load",c),a.addEventListener("error",c))}}var Vy=0;function cD(r,a){return r.stylesheets&&r.count===0&&gf(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var h=setTimeout(function(){if(r.stylesheets&&gf(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+a);0<r.imgBytes&&Vy===0&&(Vy=62500*U6());var g=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&gf(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Vy?50:800)+a);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function pf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var mf=null;function gf(r,a){r.stylesheets=null,r.unsuspend!==null&&(r.count++,mf=new Map,a.forEach(uD,r),mf=null,pf.call(r))}function uD(r,a){if(!(a.state.loading&4)){var c=mf.get(r);if(c)var h=c.get(null);else{c=new Map,mf.set(r,c);for(var g=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var E=g[v];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),h=E)}h&&c.set(null,h)}g=a.instance,E=g.getAttribute("data-precedence"),v=c.get(E)||h,v===h&&c.set(null,g),c.set(E,g),this.count++,h=pf.bind(this),g.addEventListener("load",h),g.addEventListener("error",h),v?v.parentNode.insertBefore(g,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(g,r.firstChild)),a.state.loading|=4}}var zu={$$typeof:q,Provider:null,Consumer:null,_currentValue:C,_currentValue2:C,_threadCount:0};function dD(r,a,c,h,g,v,E,H,J){this.tag=1,this.containerInfo=r,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=St(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=St(0),this.hiddenUpdates=St(null),this.identifierPrefix=h,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function bk(r,a,c,h,g,v,E,H,J,ce,_e,xe){return r=new dD(r,a,c,E,J,ce,_e,xe,H),a=1,v===!0&&(a|=24),v=gr(3,null,null,a),r.current=v,v.stateNode=r,a=Ag(),a.refCount++,r.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:c,cache:a},Lg(v),r}function wk(r){return r?(r=Ol,r):Ol}function Sk(r,a,c,h,g,v){g=wk(g),h.context===null?h.context=g:h.pendingContext=g,h=Ia(a),h.payload={element:c},v=v===void 0?null:v,v!==null&&(h.callback=v),c=Da(r,h,a),c!==null&&(sr(c,r,a),yu(c,r,a))}function xk(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<a?c:a}}function Yy(r,a){xk(r,a),(r=r.alternate)&&xk(r,a)}function Ck(r){if(r.tag===13||r.tag===31){var a=Oo(r,67108864);a!==null&&sr(a,r,67108864),Yy(r,67108864)}}function kk(r){if(r.tag===13||r.tag===31){var a=wr();a=gt(a);var c=Oo(r,a);c!==null&&sr(c,r,a),Yy(r,a)}}var yf=!0;function hD(r,a,c,h){var g=A.T;A.T=null;var v=O.p;try{O.p=2,Xy(r,a,c,h)}finally{O.p=v,A.T=g}}function fD(r,a,c,h){var g=A.T;A.T=null;var v=O.p;try{O.p=8,Xy(r,a,c,h)}finally{O.p=v,A.T=g}}function Xy(r,a,c,h){if(yf){var g=Zy(h);if(g===null)jy(r,a,h,_f,c),Ak(r,h);else if(mD(g,r,a,c,h))h.stopPropagation();else if(Ak(r,h),a&4&&-1<pD.indexOf(r)){for(;g!==null;){var v=Se(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var E=at(v.pendingLanes);if(E!==0){var H=v;for(H.pendingLanes|=2,H.entangledLanes|=2;E;){var J=1<<31-Ne(E);H.entanglements[1]|=J,E&=~J}Ss(v),(nn&6)===0&&(Qh=Ke()+500,Ou(0))}}break;case 31:case 13:H=Oo(v,2),H!==null&&sr(H,v,2),tf(),Yy(v,2)}if(v=Zy(h),v===null&&jy(r,a,h,_f,c),v===g)break;g=v}g!==null&&h.stopPropagation()}else jy(r,a,h,null,c)}}function Zy(r){return r=bt(r),Jy(r)}var _f=null;function Jy(r){if(_f=null,r=X(r),r!==null){var a=o(r);if(a===null)r=null;else{var c=a.tag;if(c===13){if(r=l(a),r!==null)return r;r=null}else if(c===31){if(r=d(a),r!==null)return r;r=null}else if(c===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null)}}return _f=r,null}function Ek(r){switch(r){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(en()){case we:return 2;case De:return 8;case de:case Pe:return 32;case st:return 268435456;default:return 32}default:return 32}}var Qy=!1,Ga=null,Ka=null,Va=null,$u=new Map,Fu=new Map,Ya=[],pD="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 Ak(r,a){switch(r){case"focusin":case"focusout":Ga=null;break;case"dragenter":case"dragleave":Ka=null;break;case"mouseover":case"mouseout":Va=null;break;case"pointerover":case"pointerout":$u.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Fu.delete(a.pointerId)}}function Hu(r,a,c,h,g,v){return r===null||r.nativeEvent!==v?(r={blockedOn:a,domEventName:c,eventSystemFlags:h,nativeEvent:v,targetContainers:[g]},a!==null&&(a=Se(a),a!==null&&Ck(a)),r):(r.eventSystemFlags|=h,a=r.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),r)}function mD(r,a,c,h,g){switch(a){case"focusin":return Ga=Hu(Ga,r,a,c,h,g),!0;case"dragenter":return Ka=Hu(Ka,r,a,c,h,g),!0;case"mouseover":return Va=Hu(Va,r,a,c,h,g),!0;case"pointerover":var v=g.pointerId;return $u.set(v,Hu($u.get(v)||null,r,a,c,h,g)),!0;case"gotpointercapture":return v=g.pointerId,Fu.set(v,Hu(Fu.get(v)||null,r,a,c,h,g)),!0}return!1}function Tk(r){var a=X(r.target);if(a!==null){var c=o(a);if(c!==null){if(a=c.tag,a===13){if(a=l(c),a!==null){r.blockedOn=a,Lr(r.priority,function(){kk(c)});return}}else if(a===31){if(a=d(c),a!==null){r.blockedOn=a,Lr(r.priority,function(){kk(c)});return}}else if(a===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function vf(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var c=Zy(r.nativeEvent);if(c===null){c=r.nativeEvent;var h=new c.constructor(c.type,c);Xe=h,c.target.dispatchEvent(h),Xe=null}else return a=Se(c),a!==null&&Ck(a),r.blockedOn=c,!1;a.shift()}return!0}function Rk(r,a,c){vf(r)&&c.delete(a)}function gD(){Qy=!1,Ga!==null&&vf(Ga)&&(Ga=null),Ka!==null&&vf(Ka)&&(Ka=null),Va!==null&&vf(Va)&&(Va=null),$u.forEach(Rk),Fu.forEach(Rk)}function bf(r,a){r.blockedOn===a&&(r.blockedOn=null,Qy||(Qy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,gD)))}var wf=null;function Mk(r){wf!==r&&(wf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){wf===r&&(wf=null);for(var a=0;a<r.length;a+=3){var c=r[a],h=r[a+1],g=r[a+2];if(typeof h!="function"){if(Jy(h||c)===null)continue;break}var v=Se(c);v!==null&&(r.splice(a,3),a-=3,Zg(v,{pending:!0,data:g,method:c.method,action:h},h,g))}}))}function ic(r){function a(J){return bf(J,r)}Ga!==null&&bf(Ga,r),Ka!==null&&bf(Ka,r),Va!==null&&bf(Va,r),$u.forEach(a),Fu.forEach(a);for(var c=0;c<Ya.length;c++){var h=Ya[c];h.blockedOn===r&&(h.blockedOn=null)}for(;0<Ya.length&&(c=Ya[0],c.blockedOn===null);)Tk(c),c.blockedOn===null&&Ya.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var g=c[h],v=c[h+1],E=g[Kt]||null;if(typeof v=="function")E||Mk(c);else if(E){var H=null;if(v&&v.hasAttribute("formAction")){if(g=v,E=v[Kt]||null)H=E.formAction;else if(Jy(g)!==null)continue}else H=E.action;typeof H=="function"?c[h+1]=H:(c.splice(h,3),h-=3),Mk(c)}}}function Lk(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(E){return g=E})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),h||setTimeout(c,20)}function c(){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",r),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function e_(r){this._internalRoot=r}Sf.prototype.render=e_.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(i(409));var c=a.current,h=wr();Sk(c,h,r,a,null,null)},Sf.prototype.unmount=e_.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;Sk(r.current,2,null,r,null,null),tf(),a[Qi]=null}};function Sf(r){this._internalRoot=r}Sf.prototype.unstable_scheduleHydration=function(r){if(r){var a=$i();r={blockedOn:null,target:r,priority:a};for(var c=0;c<Ya.length&&a!==0&&a<Ya[c].priority;c++);Ya.splice(c,0,r),c===0&&Tk(r)}};var Nk=t.version;if(Nk!=="19.2.7")throw Error(i(527,Nk,"19.2.7"));O.findDOMNode=function(r){var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=p(a),r=r!==null?m(r):null,r=r===null?null:r.stateNode,r};var yD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xf.isDisabled&&xf.supportsFiber)try{Gt=xf.inject(yD),_t=xf}catch{}}return Wu.createRoot=function(r,a){if(!s(r))throw Error(i(299));var c=!1,h="",g=zx,v=$x,E=Fx;return a!=null&&(a.unstable_strictMode===!0&&(c=!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&&(E=a.onRecoverableError)),a=bk(r,1,!1,null,null,c,h,null,g,v,E,Lk),r[Qi]=a.current,Dy(r),new e_(a)},Wu.hydrateRoot=function(r,a,c){if(!s(r))throw Error(i(299));var h=!1,g="",v=zx,E=$x,H=Fx,J=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(H=c.onRecoverableError),c.formState!==void 0&&(J=c.formState)),a=bk(r,1,!0,a,c??null,h,g,J,v,E,H,Lk),a.context=wk(null),c=a.current,h=wr(),h=gt(h),g=Ia(h),g.callback=null,Da(c,g,h),c=h,a.current.lanes=c,Pt(a,c),Ss(a),r[Qi]=a.current,Dy(r),new Sf(a)},Wu.version="19.2.7",Wu}var Uk;function h4(){if(Uk)return s_.exports;Uk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),s_.exports=d4(),s_.exports}var L5=h4();var Wk="popstate";function qk(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function f4(e={}){function t(i,s){let o=s.state?.masked,{pathname:l,search:d,hash:f}=o||i.location;return $v("",{pathname:l,search:d,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,s){return typeof s=="string"?s:zd(s)}return m4(t,n,null,e)}function An(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ds(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function p4(){return Math.random().toString(36).substring(2,10)}function Gk(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function $v(e,t,n=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Gc(t):t,state:n,key:t&&t.key||i||p4(),mask:s}}function zd({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 Gc(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 m4(e,t,n,i={}){let{window:s=document.defaultView,v5Compat:o=!1}=i,l=s.history,d="POP",f=null,p=m();p==null&&(p=0,l.replaceState({...l.state,idx:p},""));function m(){return(l.state||{idx:null}).idx}function y(){d="POP";let k=m(),L=k==null?null:k-p;p=k,f&&f({action:d,location:x.location,delta:L})}function b(k,L){d="PUSH";let F=qk(k)?k:$v(x.location,k,L);p=m()+1;let q=Gk(F,p),T=x.createHref(F.mask||F);try{l.pushState(q,"",T)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;s.location.assign(T)}o&&f&&f({action:d,location:x.location,delta:1})}function w(k,L){d="REPLACE";let F=qk(k)?k:$v(x.location,k,L);p=m();let q=Gk(F,p),T=x.createHref(F.mask||F);l.replaceState(q,"",T),o&&f&&f({action:d,location:x.location,delta:0})}function S(k){return g4(s,k)}let x={get action(){return d},get location(){return e(s,l)},listen(k){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(Wk,y),f=k,()=>{s.removeEventListener(Wk,y),f=null}},createHref(k){return t(s,k)},createURL:S,encodeLocation(k){let L=S(k);return{pathname:L.pathname,search:L.search,hash:L.hash}},push:b,replace:w,go(k){return l.go(k)}};return x}function g4(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),An(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:zd(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=i+s),new URL(s,i)}function N5(e,t,n="/"){return y4(e,t,n,!1)}function y4(e,t,n,i,s){let o=typeof t=="string"?Gc(t):t,l=Sa(o.pathname||"/",n);if(l==null)return null;let d=_4(e),f=null,p=M4(l);for(let m=0;f==null&&m<d.length;++m)f=T4(d[m],p,i);return f}function _4(e){let t=O5(e);return v4(t),t}function O5(e,t=[],n=[],i="",s=!1){let o=(l,d,f=s,p)=>{let m={relativePath:p===void 0?l.path||"":p,caseSensitive:l.caseSensitive===!0,childrenIndex:d,route:l};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(i)&&f)return;An(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 y=us([i,m.relativePath]),b=n.concat(m);l.children&&l.children.length>0&&(An(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),O5(l.children,t,b,y,f)),!(l.path==null&&!l.index)&&t.push({path:y,score:E4(y,l.index),routesMeta:b})};return e.forEach((l,d)=>{if(l.path===""||!l.path?.includes("?"))o(l,d);else for(let f of I5(l.path))o(l,d,!0,f)}),t}function I5(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(i.length===0)return s?[o,""]:[o];let l=I5(i.join("/")),d=[];return d.push(...l.map(f=>f===""?o:[o,f].join("/"))),s&&d.push(...l),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function v4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:A4(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var b4=/^:[\w-]+$/,w4=3,S4=2,x4=1,C4=10,k4=-2,Kk=e=>e==="*";function E4(e,t){let n=e.split("/"),i=n.length;return n.some(Kk)&&(i+=k4),t&&(i+=S4),n.filter(s=>!Kk(s)).reduce((s,o)=>s+(b4.test(o)?w4:o===""?x4:C4),i)}function A4(e,t){return e.length===t.length&&e.slice(0,-1).every((i,s)=>i===t[s])?e[e.length-1]-t[t.length-1]:0}function T4(e,t,n=!1){let{routesMeta:i}=e,s={},o="/",l=[];for(let d=0;d<i.length;++d){let f=i[d],p=d===i.length-1,m=o==="/"?t:t.slice(o.length)||"/",y=Op({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},m),b=f.route;if(!y&&p&&n&&!i[i.length-1].route.index&&(y=Op({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!y)return null;Object.assign(s,y.params),l.push({params:s,pathname:us([o,y.pathname]),pathnameBase:I4(us([o,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(o=us([o,y.pathnameBase]))}return l}function Op(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=R4(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],l=o.replace(/(.)\/+$/,"$1"),d=s.slice(1);return{params:i.reduce((p,{paramName:m,isOptional:y},b)=>{if(m==="*"){let S=d[b]||"";l=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=d[b];return y&&!w?p[m]=void 0:p[m]=(w||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:e}}function R4(e,t=!1,n=!0){ds(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=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,d,f,p,m)=>{if(i.push({paramName:d,isOptional:f!=null}),f){let y=m.charAt(p+l.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),i]}function M4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ds(!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 Sa(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 L4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function N4(e,t="/"){let{pathname:n,search:i="",hash:s=""}=typeof e=="string"?Gc(e):e,o;return n?(n=D5(n),n.startsWith("/")?o=Vk(n.substring(1),"/"):o=Vk(n,t)):o=t,{pathname:o,search:D4(i),hash:j4(s)}}function Vk(e,t){let n=Ip(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function l_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function O4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function dw(e){let t=O4(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function Tm(e,t,n,i=!1){let s;typeof e=="string"?s=Gc(e):(s={...e},An(!s.pathname||!s.pathname.includes("?"),l_("?","pathname","search",s)),An(!s.pathname||!s.pathname.includes("#"),l_("#","pathname","hash",s)),An(!s.search||!s.search.includes("#"),l_("#","search","hash",s)));let o=e===""||s.pathname==="",l=o?"/":s.pathname,d;if(l==null)d=n;else{let y=t.length-1;if(!i&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),y-=1;s.pathname=b.join("/")}d=y>=0?t[y]:"/"}let f=N4(s,d),p=l&&l!=="/"&&l.endsWith("/"),m=(o||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||m)&&(f.pathname+="/"),f}var D5=e=>e.replace(/\/\/+/g,"/"),us=e=>D5(e.join("/")),Ip=e=>e.replace(/\/+$/,""),I4=e=>Ip(e).replace(/^\/*/,"/"),D4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,j4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,B4=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 P4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function z4(e){let t=e.map(n=>n.route.path).filter(Boolean);return us(t)||"/"}var j5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function B5(e,t){let n=e;if(typeof n!="string"||!L4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,s=!1;if(j5)try{let o=new URL(window.location.href),l=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Sa(l.pathname,t);l.origin===o.origin&&d!=null?n=d+l.search+l.hash:s=!0}catch{ds(!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:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var P5=["POST","PUT","PATCH","DELETE"];new Set(P5);var $4=["GET",...P5];new Set($4);var Kc=_.createContext(null);Kc.displayName="DataRouter";var Rm=_.createContext(null);Rm.displayName="DataRouterState";var z5=_.createContext(!1);function F4(){return _.useContext(z5)}var $5=_.createContext({isTransitioning:!1});$5.displayName="ViewTransition";var H4=_.createContext(new Map);H4.displayName="Fetchers";var U4=_.createContext(null);U4.displayName="Await";var Rr=_.createContext(null);Rr.displayName="Navigation";var ih=_.createContext(null);ih.displayName="Location";var zs=_.createContext({outlet:null,matches:[],isDataRoute:!1});zs.displayName="Route";var hw=_.createContext(null);hw.displayName="RouteError";var F5="REACT_ROUTER_ERROR",W4="REDIRECT",q4="ROUTE_ERROR_RESPONSE";function G4(e){if(e.startsWith(`${F5}:${W4}:{`))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 K4(e){if(e.startsWith(`${F5}:${q4}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new B4(t.status,t.statusText,t.data)}catch{}}function V4(e,{relative:t}={}){An(Vc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=_.useContext(Rr),{hash:s,pathname:o,search:l}=rh(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:us([n,o])),i.createHref({pathname:d,search:l,hash:s})}function Vc(){return _.useContext(ih)!=null}function Mr(){return An(Vc(),"useLocation() may be used only in the context of a <Router> component."),_.useContext(ih).location}var H5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function U5(e){_.useContext(Rr).static||_.useLayoutEffect(e)}function Yc(){let{isDataRoute:e}=_.useContext(zs);return e?oj():Y4()}function Y4(){An(Vc(),"useNavigate() may be used only in the context of a <Router> component.");let e=_.useContext(Kc),{basename:t,navigator:n}=_.useContext(Rr),{matches:i}=_.useContext(zs),{pathname:s}=Mr(),o=JSON.stringify(dw(i)),l=_.useRef(!1);return U5(()=>{l.current=!0}),_.useCallback((f,p={})=>{if(ds(l.current,H5),!l.current)return;if(typeof f=="number"){n.go(f);return}let m=Tm(f,JSON.parse(o),s,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:us([t,m.pathname])),(p.replace?n.replace:n.push)(m,p.state,p)},[t,n,o,s,e])}_.createContext(null);function rh(e,{relative:t}={}){let{matches:n}=_.useContext(zs),{pathname:i}=Mr(),s=JSON.stringify(dw(n));return _.useMemo(()=>Tm(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function X4(e,t){return W5(e,t)}function W5(e,t,n){An(Vc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=_.useContext(Rr),{matches:s}=_.useContext(zs),o=s[s.length-1],l=o?o.params:{},d=o?o.pathname:"/",f=o?o.pathnameBase:"/",p=o&&o.route;{let k=p&&p.path||"";G5(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=Mr(),y;if(t){let k=typeof t=="string"?Gc(t):t;An(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.`),y=k}else y=m;let b=y.pathname||"/",w=b;if(f!=="/"){let k=f.replace(/^\//,"").split("/");w="/"+b.replace(/^\//,"").split("/").slice(k.length).join("/")}let S=n&&n.state.matches.length?n.state.matches.map(k=>Object.assign(k,{route:n.manifest[k.route.id]||k.route})):N5(e,{pathname:w});ds(p||S!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ds(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.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=tj(S&&S.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:us([f,i.encodeLocation?i.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:us([f,i.encodeLocation?i.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&x?_.createElement(ih.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},x):x}function Z4(){let e=aj(),t=P4(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)",s={padding:"0.5rem",backgroundColor:i},o={padding:"2px 4px",backgroundColor:i},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=_.createElement(_.Fragment,null,_.createElement("p",null,"💿 Hey developer 👋"),_.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",_.createElement("code",{style:o},"ErrorBoundary")," or"," ",_.createElement("code",{style:o},"errorElement")," prop on your route.")),_.createElement(_.Fragment,null,_.createElement("h2",null,"Unexpected Application Error!"),_.createElement("h3",{style:{fontStyle:"italic"}},t),n?_.createElement("pre",{style:s},n):null,l)}var J4=_.createElement(Z4,null),q5=class extends _.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=K4(e.digest);n&&(e=n)}let t=e!==void 0?_.createElement(zs.Provider,{value:this.props.routeContext},_.createElement(hw.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?_.createElement(Q4,{error:e},t):t}};q5.contextType=z5;var c_=new WeakMap;function Q4({children:e,error:t}){let{basename:n}=_.useContext(Rr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=G4(t.digest);if(i){let s=c_.get(t);if(s)throw s;let o=B5(i.location,n);if(j5&&!c_.get(t))if(o.isExternal||i.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:i.replace}));throw c_.set(t,l),l}return _.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function ej({routeContext:e,match:t,children:n}){let i=_.useContext(Kc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),_.createElement(zs.Provider,{value:e},n)}function tj(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 s=e,o=i?.errors;if(o!=null){let m=s.findIndex(y=>y.route.id&&o?.[y.route.id]!==void 0);An(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let l=!1,d=-1;if(n&&i){l=i.renderFallback;for(let m=0;m<s.length;m++){let y=s[m];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(d=m),y.route.id){let{loaderData:b,errors:w}=i,S=y.route.loader&&!b.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||S){n.isStatic&&(l=!0),d>=0?s=s.slice(0,d+1):s=[s[0]];break}}}}let f=n?.onError,p=i&&f?(m,y)=>{f(m,{location:i.location,params:i.matches?.[0]?.params??{},pattern:z4(i.matches),errorInfo:y})}:void 0;return s.reduceRight((m,y,b)=>{let w,S=!1,x=null,k=null;i&&(w=o&&y.route.id?o[y.route.id]:void 0,x=y.route.errorElement||J4,l&&(d<0&&b===0?(G5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,k=null):d===b&&(S=!0,k=y.route.hydrateFallbackElement||null)));let L=t.concat(s.slice(0,b+1)),F=()=>{let q;return w?q=x:S?q=k:y.route.Component?q=_.createElement(y.route.Component,null):y.route.element?q=y.route.element:q=m,_.createElement(ej,{match:y,routeContext:{outlet:m,matches:L,isDataRoute:i!=null},children:q})};return i&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?_.createElement(q5,{location:i.location,revalidation:i.revalidation,component:x,error:w,children:F(),routeContext:{outlet:null,matches:L,isDataRoute:!0},onError:p}):F()},null)}function fw(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function nj(e){let t=_.useContext(Kc);return An(t,fw(e)),t}function ij(e){let t=_.useContext(Rm);return An(t,fw(e)),t}function rj(e){let t=_.useContext(zs);return An(t,fw(e)),t}function pw(e){let t=rj(e),n=t.matches[t.matches.length-1];return An(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function sj(){return pw("useRouteId")}function aj(){let e=_.useContext(hw),t=ij("useRouteError"),n=pw("useRouteError");return e!==void 0?e:t.errors?.[n]}function oj(){let{router:e}=nj("useNavigate"),t=pw("useNavigate"),n=_.useRef(!1);return U5(()=>{n.current=!0}),_.useCallback(async(s,o={})=>{ds(n.current,H5),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var Yk={};function G5(e,t,n){!t&&!Yk[e]&&(Yk[e]=!0,ds(!1,n))}_.memo(lj);function lj({routes:e,manifest:t,future:n,state:i,isStatic:s,onError:o}){return W5(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function u_({to:e,replace:t,state:n,relative:i}){An(Vc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=_.useContext(Rr);ds(!s,"<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}=_.useContext(zs),{pathname:l}=Mr(),d=Yc(),f=Tm(e,dw(o),l,i==="path"),p=JSON.stringify(f);return _.useEffect(()=>{d(JSON.parse(p),{replace:t,state:n,relative:i})},[d,p,i,t,n]),null}function mc(e){An(!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 cj({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:l}){An(!Vc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=_.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:l,future:{}}),[d,s,o,l]);typeof n=="string"&&(n=Gc(n));let{pathname:p="/",search:m="",hash:y="",state:b=null,key:w="default",mask:S}=n,x=_.useMemo(()=>{let k=Sa(p,d);return k==null?null:{location:{pathname:k,search:m,hash:y,state:b,key:w,mask:S},navigationType:i}},[d,p,m,y,b,w,i,S]);return ds(x!=null,`<Router basename="${d}"> is not able to match the URL "${p}${m}${y}" because it does not start with the basename, so the <Router> won't render anything.`),x==null?null:_.createElement(Rr.Provider,{value:f},_.createElement(ih.Provider,{children:t,value:x}))}function uj({children:e,location:t}){return X4(Fv(e),t)}function Fv(e,t=[]){let n=[];return _.Children.forEach(e,(i,s)=>{if(!_.isValidElement(i))return;let o=[...t,s];if(i.type===_.Fragment){n.push.apply(n,Fv(i.props.children,o));return}An(i.type===mc,`[${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>`),An(!i.props.index||!i.props.children,"An index route cannot have child routes.");let l={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&&(l.children=Fv(i.props.children,o)),n.push(l)}),n}var np="get",ip="application/x-www-form-urlencoded";function Mm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function dj(e){return Mm(e)&&e.tagName.toLowerCase()==="button"}function hj(e){return Mm(e)&&e.tagName.toLowerCase()==="form"}function fj(e){return Mm(e)&&e.tagName.toLowerCase()==="input"}function pj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mj(e,t){return e.button===0&&(!t||t==="_self")&&!pj(e)}var Cf=null;function gj(){if(Cf===null)try{new FormData(document.createElement("form"),0),Cf=!1}catch{Cf=!0}return Cf}var yj=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function d_(e){return e!=null&&!yj.has(e)?(ds(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ip}"`),null):e}function _j(e,t){let n,i,s,o,l;if(hj(e)){let d=e.getAttribute("action");i=d?Sa(d,t):null,n=e.getAttribute("method")||np,s=d_(e.getAttribute("enctype"))||ip,o=new FormData(e)}else if(dj(e)||fj(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?Sa(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||np,s=d_(e.getAttribute("formenctype"))||d_(d.getAttribute("enctype"))||ip,o=new FormData(d,e),!gj()){let{name:p,type:m,value:y}=e;if(m==="image"){let b=p?`${p}.`:"";o.append(`${b}x`,"0"),o.append(`${b}y`,"0")}else p&&o.append(p,y)}}else{if(Mm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=np,i=null,s=ip,l=e}return o&&s==="text/plain"&&(l=o,o=void 0),{action:i,method:n.toLowerCase(),encType:s,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function mw(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function K5(e,t,n,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:t&&Sa(s.pathname,t)==="/"?s.pathname=`${Ip(t)}/_root.${i}`:s.pathname=`${Ip(s.pathname)}.${i}`,s}async function vj(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 bj(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 wj(e,t,n){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let l=await vj(o,n);return l.links?l.links():[]}return[]}));return kj(i.flat(1).filter(bj).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Xk(e,t,n,i,s,o){let l=(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)=>l(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(l(f,p)||d(f,p))return!0;if(f.route.shouldRevalidate){let y=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function Sj(e,t,{includeHydrateFallback:n}={}){return xj(e.map(i=>{let s=t.routes[i.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function xj(e){return[...new Set(e)]}function Cj(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function kj(e,t){let n=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(Cj(s));return n.has(o)||(n.add(o),i.push({key:o,link:s})),i},[])}function gw(){let e=_.useContext(Kc);return mw(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ej(){let e=_.useContext(Rm);return mw(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var yw=_.createContext(void 0);yw.displayName="FrameworkContext";function _w(){let e=_.useContext(yw);return mw(e,"You must render this element inside a <HydratedRouter> element"),e}function Aj(e,t){let n=_.useContext(yw),[i,s]=_.useState(!1),[o,l]=_.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:y}=t,b=_.useRef(null);_.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let x=L=>{L.forEach(F=>{l(F.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return b.current&&k.observe(b.current),()=>{k.disconnect()}}},[e]),_.useEffect(()=>{if(i){let x=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(x)}}},[i]);let w=()=>{s(!0)},S=()=>{s(!1),l(!1)};return n?e!=="intent"?[o,b,{}]:[o,b,{onFocus:qu(d,w),onBlur:qu(f,S),onMouseEnter:qu(p,w),onMouseLeave:qu(m,S),onTouchStart:qu(y,w)}]:[!1,b,{}]}function qu(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Tj({page:e,...t}){let n=F4(),{router:i}=gw(),s=_.useMemo(()=>N5(i.routes,e,i.basename),[i.routes,e,i.basename]);return s?n?_.createElement(Mj,{page:e,matches:s,...t}):_.createElement(Lj,{page:e,matches:s,...t}):null}function Rj(e){let{manifest:t,routeModules:n}=_w(),[i,s]=_.useState([]);return _.useEffect(()=>{let o=!1;return wj(e,t,n).then(l=>{o||s(l)}),()=>{o=!0}},[e,t,n]),i}function Mj({page:e,matches:t,...n}){let i=Mr(),{future:s}=_w(),{basename:o}=gw(),l=_.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=K5(e,o,s.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,s.v8_trailingSlashAwareDataRequests,e,i,t]);return _.createElement(_.Fragment,null,l.map(d=>_.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function Lj({page:e,matches:t,...n}){let i=Mr(),{future:s,manifest:o,routeModules:l}=_w(),{basename:d}=gw(),{loaderData:f,matches:p}=Ej(),m=_.useMemo(()=>Xk(e,t,p,o,i,"data"),[e,t,p,o,i]),y=_.useMemo(()=>Xk(e,t,p,o,i,"assets"),[e,t,p,o,i]),b=_.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,k=!1;if(t.forEach(F=>{let q=o.routes[F.route.id];!q||!q.hasLoader||(!m.some(T=>T.route.id===F.route.id)&&F.route.id in f&&l[F.route.id]?.shouldRevalidate||q.hasClientLoader?k=!0:x.add(F.route.id))}),x.size===0)return[];let L=K5(e,d,s.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&L.searchParams.set("_routes",t.filter(F=>x.has(F.route.id)).map(F=>F.route.id).join(",")),[L.pathname+L.search]},[d,s.v8_trailingSlashAwareDataRequests,f,i,o,m,t,e,l]),w=_.useMemo(()=>Sj(y,o),[y,o]),S=Rj(y);return _.createElement(_.Fragment,null,b.map(x=>_.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),w.map(x=>_.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),S.map(({key:x,link:k})=>_.createElement("link",{key:x,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function Nj(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Oj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Oj&&(window.__reactRouterVersion="7.17.0")}catch{}function Ij({basename:e,children:t,useTransitions:n,window:i}){let s=_.useRef();s.current==null&&(s.current=f4({window:i,v5Compat:!0}));let o=s.current,[l,d]=_.useState({action:o.action,location:o.location}),f=_.useCallback(p=>{n===!1?d(p):_.startTransition(()=>d(p))},[n]);return _.useLayoutEffect(()=>o.listen(f),[o,f]),_.createElement(cj,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,useTransitions:n})}var V5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$d=_.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:s,reloadDocument:o,replace:l,mask:d,state:f,target:p,to:m,preventScrollReset:y,viewTransition:b,defaultShouldRevalidate:w,...S},x){let{basename:k,navigator:L,useTransitions:F}=_.useContext(Rr),q=typeof m=="string"&&V5.test(m),T=B5(m,k);m=T.to;let $=V4(m,{relative:s}),I=Mr(),N=null;if(d){let j=Tm(d,[],I.mask?I.mask.pathname:"/",!0);k!=="/"&&(j.pathname=j.pathname==="/"?k:us([k,j.pathname])),N=L.createHref(j)}let[V,K,Q]=Aj(i,S),Y=Pj(m,{replace:l,mask:d,state:f,target:p,preventScrollReset:y,relative:s,viewTransition:b,defaultShouldRevalidate:w,useTransitions:F});function B(j){t&&t(j),j.defaultPrevented||Y(j)}let M=!(T.isExternal||o),D=_.createElement("a",{...S,...Q,href:(M?N:void 0)||T.absoluteURL||$,onClick:M?B:t,ref:Nj(x,K),target:p,"data-discover":!q&&n==="render"?"true":void 0});return V&&!q?_.createElement(_.Fragment,null,D,_.createElement(Tj,{page:$})):D});$d.displayName="Link";var Dj=_.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:s=!1,style:o,to:l,viewTransition:d,children:f,...p},m){let y=rh(l,{relative:p.relative}),b=Mr(),w=_.useContext(Rm),{navigator:S,basename:x}=_.useContext(Rr),k=w!=null&&Uj(y)&&d===!0,L=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,F=b.pathname,q=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(F=F.toLowerCase(),q=q?q.toLowerCase():null,L=L.toLowerCase()),q&&x&&(q=Sa(q,x)||q);const T=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let $=F===L||!s&&F.startsWith(L)&&F.charAt(T)==="/",I=q!=null&&(q===L||!s&&q.startsWith(L)&&q.charAt(L.length)==="/"),N={isActive:$,isPending:I,isTransitioning:k},V=$?t:void 0,K;typeof i=="function"?K=i(N):K=[i,$?"active":null,I?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let Q=typeof o=="function"?o(N):o;return _.createElement($d,{...p,"aria-current":V,className:K,ref:m,style:Q,to:l,viewTransition:d},typeof f=="function"?f(N):f)});Dj.displayName="NavLink";var jj=_.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:s,state:o,method:l=np,action:d,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:b,...w},S)=>{let{useTransitions:x}=_.useContext(Rr),k=Fj(),L=Hj(d,{relative:p}),F=l.toLowerCase()==="get"?"get":"post",q=typeof d=="string"&&V5.test(d),T=$=>{if(f&&f($),$.defaultPrevented)return;$.preventDefault();let I=$.nativeEvent.submitter,N=I?.getAttribute("formmethod")||l,V=()=>k(I||$.currentTarget,{fetcherKey:t,method:N,navigate:n,replace:s,state:o,relative:p,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:b});x&&n!==!1?_.startTransition(()=>V()):V()};return _.createElement("form",{ref:S,method:F,action:L,onSubmit:i?f:T,...w,"data-discover":!q&&e==="render"?"true":void 0})});jj.displayName="Form";function Bj(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Y5(e){let t=_.useContext(Kc);return An(t,Bj(e)),t}function Pj(e,{target:t,replace:n,mask:i,state:s,preventScrollReset:o,relative:l,viewTransition:d,defaultShouldRevalidate:f,useTransitions:p}={}){let m=Yc(),y=Mr(),b=rh(e,{relative:l});return _.useCallback(w=>{if(mj(w,t)){w.preventDefault();let S=n!==void 0?n:zd(y)===zd(b),x=()=>m(e,{replace:S,mask:i,state:s,preventScrollReset:o,relative:l,viewTransition:d,defaultShouldRevalidate:f});p?_.startTransition(()=>x()):x()}},[y,m,b,n,i,s,t,e,o,l,d,f,p])}var zj=0,$j=()=>`__${String(++zj)}__`;function Fj(){let{router:e}=Y5("useSubmit"),{basename:t}=_.useContext(Rr),n=sj(),i=e.fetch,s=e.navigate;return _.useCallback(async(o,l={})=>{let{action:d,method:f,encType:p,formData:m,body:y}=_j(o,t);if(l.navigate===!1){let b=l.fetcherKey||$j();await i(b,n,l.action||d,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:y,formMethod:l.method||f,formEncType:l.encType||p,flushSync:l.flushSync})}else await s(l.action||d,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:m,body:y,formMethod:l.method||f,formEncType:l.encType||p,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[i,s,t,n])}function Hj(e,{relative:t}={}){let{basename:n}=_.useContext(Rr),i=_.useContext(zs);An(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...rh(e||".",{relative:t})},l=Mr();if(e==null){o.search=l.search;let d=new URLSearchParams(o.search),f=d.getAll("index");if(f.some(m=>m==="")){d.delete("index"),f.filter(y=>y).forEach(y=>d.append("index",y));let m=d.toString();o.search=m?`?${m}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:us([n,o.pathname])),zd(o)}function Uj(e,{relative:t}={}){let n=_.useContext($5);An(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=Y5("useViewTransitionState"),s=rh(e,{relative:t});if(!n.isTransitioning)return!1;let o=Sa(n.currentLocation.pathname,i)||n.currentLocation.pathname,l=Sa(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Op(s.pathname,l)!=null||Op(s.pathname,o)!=null}const Wj=["canonicalCwd","cwd","providerSession","realpath","ticket","token","transcriptPath"];let mn=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function Hv(e){return(await X5(e)).theaters}async function X5(e){const t=await fetch("/api/v1/theaters",{signal:e});await Vn(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new mn(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>bw(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 Vn(i),sB(await i.json(),i.status)}async function Gj(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await Vn(t),aB(await t.json(),t.status)}async function Kj(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 Vn(i),lB(await i.json(),i.status)}async function Vj(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await Vn(t),oB(await t.json(),t.status)}async function Z5(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await Vn(n);const i=await n.json();return bw(i,n.status)}async function Yj(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 Vn(i),bw(await i.json(),i.status)}async function Xj(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 Vn(n),fB(await n.json(),n.status)}async function J5(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 Vn(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new mn(n.status,"Invalid folder grant response");return i.folderGrantId}async function Zj(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 Vn(n),await n.json()}async function Jj(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 Vn(i),await i.json()}async function Qj(e,t,n,i){const s=await fetch("/api/v1/plans/search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,query:t,limit:n}),signal:i});return await Vn(s),await s.json()}async function eB(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await Vn(n),tR(await n.json(),n.status)}async function tB(e,t){const n=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await Vn(n),tR(await n.json(),n.status)}async function nB(e,t){const n=await fetch(`/api/v1/deletions/${encodeURIComponent(e)}/restore`,{method:"POST",signal:t});await Vn(n);const i=await n.json();if(!i||i.ok!==!0||i.kind!=="operation"&&i.kind!=="theater"||typeof i.targetId!="string"||wo(i))throw new mn(n.status,"Invalid deletion restore response");return{ok:!0,kind:i.kind,targetId:i.targetId}}async function qi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await Vn(i);const s=await i.json();if(!Array.isArray(s.operations))throw new mn(i.status,"Invalid operations response");return s.operations.map(o=>eR(o,i.status))}async function ao(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await Vn(i);const s=await i.json();if(!Array.isArray(s.groups))throw new mn(i.status,"Invalid groups response");return s.groups.map(o=>vw(o,i.status))}async function iB(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await Vn(n);const i=await n.json();return vw(i.group,n.status)}async function h_(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 Vn(i);const s=await i.json();return vw(s.group,i.status)}async function rB(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Vn(n)}async function Q5(e,t,n){return rp(e,{title:t},n)}async function rp(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 Vn(i);const s=await i.json();return eR(s.operation,i.status)}function eR(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"||wo(n)||wo(n.payload))throw new mn(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 vw(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 mn(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function bw(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"||wo(n))throw new mn(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 sB(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 mn(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 aB(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 mn(t,"Invalid environment response");return n}function oB(e,t){const n=e;if(!n||n.status!=="accepted")throw new mn(t,"Invalid update response");return{status:"accepted"}}function lB(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 mn(t,"Invalid release notes response");return{notes:n.notes.map(i=>cB(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function cB(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 mn(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>uB(i,t)),localizationFallback:n.localizationFallback}}function uB(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 mn(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>dB(i,t))}}function dB(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&&!hB(n.product))throw new mn(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 hB(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function fB(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)||wo(n))throw new mn(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=>pB(i,t)),truncated:n.truncated===!0?!0:void 0}}function pB(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||wo(n))throw new mn(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function wo(e){if(!e||typeof e!="object")return!1;const t=e;return Wj.some(n=>n in t)}function tR(e,t){const n=e;if(!n||n.ok!==!0||wo(n))throw new mn(t,"Invalid deferred deletion response");if(n.deletion===null)return{ok:!0,deletion:null};const i=n.deletion;if(!i||typeof i.deletionId!="string"||i.kind!=="operation"&&i.kind!=="theater"||typeof i.targetId!="string"||typeof i.expiresAt!="number"||!Number.isFinite(i.expiresAt)||wo(i))throw new mn(t,"Invalid deferred deletion receipt");return{ok:!0,deletion:{deletionId:i.deletionId,kind:i.kind,targetId:i.targetId,expiresAt:i.expiresAt}}}async function Vn(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 mn(e.status,t)}function Ns(e,t){const n=e[t];return(i,s)=>{const o=n[i];return typeof o!="string"?i:s?mB(o,s):o}}function Sl(e,t){return typeof e=="function"?e(t):e}function mB(e,t){return e.replace(/{([^{}]+)}/g,(n,i)=>{const s=t[i];return s===void 0?n:String(s)})}const gB=200,yB=.5,_B="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",vB=["monospace","serif","sans-serif"],_d=new Map;function bB(e,t={}){const n=Lm(e);if(!n)return!1;const i=n.toLocaleLowerCase(),s=_d.get(i);if(s!==void 0)return s;const o=t.document??globalThis.document;if(!o)return!1;const l=o.createElement("canvas").getContext("2d");if(!l)return!1;const d=vB.some(f=>{const p=Zk(l,`${nR(n)}, ${f}`),m=Zk(l,f);return Math.abs(p-m)>yB});return wB(i,d,t.maxEntries??gB),d}function nR(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Dp(e,t){const n=Lm(e);return n?`${nR(n)}, ${t}`:t}function Lm(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Zk(e,t){return e.font=`28px ${t}`,e.measureText(_B).width}function wB(e,t,n){if(_d.size>=Math.max(1,n)){const i=_d.keys().next().value;i&&_d.delete(i)}_d.set(e,t)}const Tc={min:12,max:18,step:1,defaultValue:14},Ld={source:"builtin",id:"manrope",size:Tc.defaultValue},jp=[{id:"manrope",label:"Fleet UI",name:"Manrope",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",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",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"]}],SB={manrope:"settings.typography.font.manrope","jetbrains-mono":"settings.typography.font.jetbrains-mono","source-code-pro":"settings.typography.font.source-code-pro"};function xB(e){if(!e||typeof e!="object")return Ld;const t=e,n=CB(t.size);if(t.source==="builtin"&&EB(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=Lm(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Ld}function CB(e){return typeof e!="number"||!Number.isInteger(e)||e<Tc.min||e>Tc.max?Tc.defaultValue:e}function iR(e){return e.source==="system"?Dp(e.familyName,jp[0].family):kB(e.id).family}function kB(e){return jp.find(t=>t.id===e)??jp[0]}function EB(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}async function rR(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await sR(t),aR(await t.json(),t.status)}async function AB(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await sR(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new mn(n.status,"Invalid global settings mutation response");return{state:aR(i.state,n.status)}}async function sR(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 mn(e.status,t)}function aR(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!TB(n.consoleStaticPort)||typeof n.reducePanelMotion!="boolean"||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!RB(n.language))throw new mn(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,reducePanelMotion:n.reducePanelMotion,theme:n.theme,uiFont:xB(n.uiFont),language:n.language}}function TB(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function RB(e){return e==="auto"||e==="en"||e==="ko"}const Uv=new Set;let Fd={loading:!1,state:null,savingField:null,error:null};function xl(){return _.useSyncExternalStore(oR,Yi,Yi)}function Yi(){return Fd}function MB(e){al({loading:!1,state:e,error:null})}function oR(e){return Uv.add(e),()=>{Uv.delete(e)}}async function LB(e){al({loading:!0,error:null});try{const t=await rR(e);al({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;al({loading:!1,error:lR(t)})}}async function So(e,t){if(Fd.savingField!==null)return!1;const n=Fd.state,i=n?{...n,[e]:t}:null;al({state:i,savingField:e,error:null});try{const s=await AB({[e]:t});return al({state:s.state,savingField:null,error:null}),!0}catch(s){return al({state:n,savingField:null,error:lR(s)}),!1}}function al(e){Fd={...Fd,...e};for(const t of Uv)t()}function lR(e){return e instanceof Error?e.message:String(e)}const NB="fleet-console.canvas.",cR="fleet-console.formation-layout",OB=400,Wv=640,qv=400,Jk=40,IB=320,DB=200,jB=8,BB=0,Qk=96,PB=.25,zB=1,f_=.2,eE=.5,$B=.001,xc={x:0,y:0,zoom:1},Rc={viewport:xc,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Gv=new Set,Kv=new Set,Vv=new Set,Yv=new Set,Xv=new Set,hs=new Map,Bc=new Map;let Jt=null,yo=null,ut=Rc,yn=null,uR=0,ol={},ur=!1,ww=s8(),ho=xc,ll=null,Bp=0;function Sw(e){return Gv.add(e),()=>{Gv.delete(e)}}function Rs(){return ut}function FB(e){return Jt===e?ut:Rw(e)}function Os(){return yn?.mode==="maximized"?yn.operationId:null}function Tr(){return yn?.mode==="companion"?yn.operationId:null}function tE(){return uR}function HB(e){const t=Jt===e?yn:hs.get(e)??null;return t?.mode==="companion"?t.operationId:null}function Pp(){return ur}function nE(){return ww}function xw(){return Jt}function Cw(){return _.useSyncExternalStore(Sw,Rs,Rs)}function dR(){return _.useSyncExternalStore(CR,Os,Os)}function hR(){return _.useSyncExternalStore(CR,Tr,Tr)}function UB(e){const t=_.useSyncExternalStore(QB,rE,rE);return e===null?{}:t[e]??{}}function WB(e,t,n){const i=ol[e]??{};i[t]!==n&&(ol={...ol,[e]:{...i,[t]:n}},kR())}function Nm(){return _.useSyncExternalStore(ZB,Pp,Pp)}function fR(){return _.useSyncExternalStore(JB,nE,nE)}function pR(){return _.useSyncExternalStore(Sw,sE,sE)}function dr(e){ut={viewport:e.viewport??ut.viewport,operations:e.operations??ut.operations,operationOrder:e.operationOrder??ut.operationOrder,operationAccent:e.operationAccent??ut.operationAccent,minimized:e.minimized??ut.minimized,collapsedGroups:e.collapsedGroups??ut.collapsedGroups},n8(),Ew()}function Zv(e){const t=ut.collapsedGroups.includes(e)?ut.collapsedGroups.filter(n=>n!==e):[...ut.collapsedGroups,e];dr({collapsedGroups:t})}function qB(e,t){if(Jt===e){Zv(t);return}const n=Rw(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(s=>s!==t):[...n.collapsedGroups,t];Mw(e,{...n,collapsedGroups:i}),ut={...ut},Ew()}function GB(){return _.useSyncExternalStore(Sw,aE,aE)}function Jv(e){Aw();const t=Lw(e);ho=t,dr({viewport:t})}function mR(e){const t=Lw(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||RR()){Jv(t);return}ho=t,ll===null&&(ll=window.requestAnimationFrame(TR))}function Qv(e,t){const n=gl();dr({operations:{...ut.operations,[e]:{...Nw(t,n),zIndex:n}}})}function KB(e,t,n=IB,i=DB,s=jB,o=BB,l="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(l==="columns"){const x=Math.max(0,d-s*(t-1)),k=x/t,L=Math.min(n,k),F=Math.min(Math.max(L,k),x),q=f,T=Math.min(i,q),$=Math.min(Math.max(T,q),f);return Array.from({length:t},(I,N)=>({x:e.x+o+N*(F+s),y:e.y+o,width:F,height:$}))}if(l==="rows"){const x=d,k=Math.min(n,x),L=Math.min(Math.max(k,x),d),F=Math.max(0,f-s*(t-1)),q=F/t,T=Math.min(i,q),$=Math.min(Math.max(T,q),F);return Array.from({length:t},(I,N)=>({x:e.x+o,y:e.y+o+N*($+s),width:L,height:$}))}const p=Math.ceil(Math.sqrt(t)),m=Math.ceil(t/p),y=Math.max(0,f-s*(m-1)),b=y/m,w=Math.min(i,b),S=Math.min(Math.max(w,b),y);return Array.from({length:t},(x,k)=>{const L=Math.floor(k/p),F=k%p,q=L===m-1?t-(m-1)*p:p,T=Math.max(0,d-s*(q-1)),$=T/q,I=Math.min(n,$),N=Math.min(Math.max(I,$),T);return{x:e.x+o+F*(N+s),y:e.y+o+L*(S+s),width:N,height:S}})}function gR(e){ut.minimized.includes(e)||(Os()===e&&xo(),Tr()===e&&ts(),dr({minimized:[...ut.minimized,e]}))}function yR(e){const t=new Set,i=[...ut.minimized.filter(l=>t.has(l)||!(l in ut.operations)?!1:(t.add(l),!0)),...e.filter(l=>t.has(l)||!(l in ut.operations)?!1:(t.add(l),!0))];if(AR(ut.minimized,i))return;const s=Os(),o=Tr();s&&i.includes(s)&&xo(),o&&i.includes(o)&&ts(),dr({minimized:i})}function eb(e){if(!ut.minimized.includes(e))return;Os()===e&&xo();const t=ut.minimized.filter(s=>s!==e),n=ut.operations[e];if(!n){dr({minimized:t});return}const i=gl();dr({minimized:t,operations:{...ut.operations,[e]:{...n,zIndex:i}}})}function p_(e){dr({operationOrder:LR(e)})}function gl(){return Bp+=1,Bp}function _R(e){const t=ut.operations[e];if(t)return t;const n=Object.keys(ut.operations).length,i={x:n*Jk,y:n*Jk,width:Wv,height:qv,zIndex:gl()};return dr({operations:{...ut.operations,[e]:i}}),i}function VB(e){const t=new Set(e),n={};let i=!1;for(const[b,w]of Object.entries(ut.operations))t.has(b)?n[b]=w:i=!0;const s=ut.minimized.filter(b=>t.has(b)),o=s.length!==ut.minimized.length,l=ut.operationOrder.filter(b=>t.has(b)),d=l.length!==ut.operationOrder.length,f=Object.fromEntries(Object.entries(ut.operationAccent).filter(([b])=>t.has(b))),p=Object.keys(f).length!==Object.keys(ut.operationAccent).length,m=Os(),y=Tr();m&&(!t.has(m)||s.includes(m))&&xo(),y&&s.includes(y)&&ts(),(i||o||d||p)&&dr({operations:n,minimized:s,operationOrder:l,operationAccent:f})}function vR(e){i8(),Aw(),t8(),Jt=e,ut=e?Rw(e):Rc;const t=e?hs.get(e)??null:null,n=!ER(yn,t);yn=t;const i=e?Bc.has(e):!1,s=ur!==i;ur=i,ho=ut.viewport,Bp=Math.max(Bp,NR(ut.operations)),Ew(),n&&sh(),s&&Pc()}function YB(e,t){const n=ut.operations[e];if(!n)return;const i=Math.max(PB,Math.min(zB,Math.min((t.width-Qk)/n.width,(t.height-Qk)/n.height))),s={x:t.width/2-(n.x+n.width/2)*i,y:t.height/2-(n.y+n.height/2)*i,zoom:i};Aw(),ho=s;const o=gl(),l=ut.minimized.includes(e);dr({viewport:s,operations:{...ut.operations,[e]:{...Nw(n,o),zIndex:o}},...l?{minimized:ut.minimized.filter(d=>d!==e)}:{}})}function kw(e){const t={mode:"maximized",operationId:e};Jt&&hs.set(Jt,t),wR(t)}function xo(){Jt&&hs.get(Jt)?.mode==="maximized"&&hs.delete(Jt),yn?.mode==="maximized"&&(yn=null,sh())}function bR(e){Om(e);const t=yn?.mode==="companion"?yn.returnTo:yn?.mode==="maximized"?"maximized":"underlay";wR({mode:"companion",operationId:e,returnTo:t})}function wR(e){yn?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===yn.operationId)&&Om(yn.operationId);const t=ut.minimized.filter(s=>s!==e.operationId),n=!AR(ut.minimized,t),i=!ER(yn,e);i&&(yn=e),i&&Jt&&hs.set(Jt,e),n&&dr({minimized:t}),i&&sh()}function XB(){if(yn?.mode!=="companion")return;const e=yn;yn=e.returnTo==="maximized"&&e.operationId in ut.operations&&!ut.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,Jt&&(yn?hs.set(Jt,yn):hs.delete(Jt)),Om(e.operationId),sh()}function ts(){if(yn?.mode!=="companion")return;const e=yn.operationId;yn=null,Jt&&hs.delete(Jt),Om(e),sh()}function SR(){if(Jt){if(Tr()!==null){ts(),ur||(Bc.set(Jt,!0),ur=!0,Pc());return}if(ur){xR();return}xo(),ts(),Bc.set(Jt,!0),ur=!0,Pc()}}function m_(e){if(Jt){if(Tr()!==null){iE(e),ts(),ur||(Bc.set(Jt,!0),ur=!0,Pc());return}if(ur&&ww===e){xR();return}iE(e),ur||(xo(),ts(),Bc.set(Jt,!0),ur=!0,Pc())}}function xR(){Jt&&Bc.delete(Jt),ur&&(ur=!1,Pc())}function iE(e){ww=e,a8(e),e8()}function ZB(e){return Yv.add(e),()=>{Yv.delete(e)}}function JB(e){return Xv.add(e),()=>{Xv.delete(e)}}function Ew(){for(const e of Gv)e()}function CR(e){return Kv.add(e),()=>{Kv.delete(e)}}function QB(e){return Vv.add(e),()=>{Vv.delete(e)}}function rE(){return ol}function kR(){for(const e of Vv)e()}function Om(e){if(!(e in ol))return;const t={...ol};delete t[e],ol=t,kR()}function Pc(){for(const e of Yv)e()}function e8(){for(const e of Xv)e()}function sE(){return ut.minimized}function aE(){return ut.collapsedGroups}function sh(){uR+=1;for(const e of Kv)e()}function t8(){Jt&&(yn?hs.set(Jt,yn):hs.delete(Jt))}function ER(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function AR(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function TR(){const e=ut.viewport,t=ho.x-e.x,n=ho.y-e.y,i=ho.zoom-e.zoom;if(Math.abs(t)<eE&&Math.abs(n)<eE&&Math.abs(i)<$B){ll=null,dr({viewport:ho});return}dr({viewport:{x:e.x+t*f_,y:e.y+n*f_,zoom:e.zoom+i*f_}}),ll=typeof window<"u"?window.requestAnimationFrame(TR):null}function Aw(){ll===null||typeof window>"u"||(window.cancelAnimationFrame(ll),ll=null)}function RR(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Tw(){return Yi().state?.reducePanelMotion===!0||RR()}function n8(){!Jt||typeof window>"u"||(r8(),yo=window.setTimeout(()=>{yo=null,Mw(Jt,ut)},OB))}function i8(){!yo||!Jt||typeof window>"u"||(window.clearTimeout(yo),yo=null,Mw(Jt,ut))}function r8(){!yo||typeof window>"u"||(window.clearTimeout(yo),yo=null)}function Rw(e){if(typeof window>"u")return Rc;try{const t=window.localStorage.getItem(MR(e));if(!t)return Rc;const n=JSON.parse(t);return o8(n)}catch{return Rc}}function Mw(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(MR(e),JSON.stringify(t))}catch{}}function s8(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(cR);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function a8(e){if(!(typeof window>"u"))try{window.localStorage.setItem(cR,e)}catch{}}function MR(e){return`${NB}${e}`}function o8(e){if(!zc(e))return Rc;const t=u8(e.operations);return{viewport:Lw(e.viewport),operations:t,operationOrder:LR(e.operationOrder),operationAccent:l8(e.operationAccent),minimized:c8(e.minimized,t),collapsedGroups:h8(e.collapsedGroups)}}function LR(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 l8(e){if(!zc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function c8(e,t){if(!Array.isArray(e))return[];const n=new Set,i=[];for(const s of e)typeof s!="string"||n.has(s)||!(s in t)||(n.add(s),i.push(s));return i}function Lw(e){if(!zc(e))return xc;const t=Nd(e.x,xc.x),n=Nd(e.y,xc.y),i=tb(e.zoom,xc.zoom);return{x:t,y:n,zoom:i}}function u8(e){if(!zc(e))return{};const t={};for(const[n,i]of Object.entries(e))zc(i)&&(t[n]=Nw(i,d8(t)));return t}function Nw(e,t){return zc(e)?{x:Nd(e.x,0),y:Nd(e.y,0),width:tb(e.width,Wv),height:tb(e.height,qv),zIndex:Nd(e.zIndex,t)}:{x:0,y:0,width:Wv,height:qv,zIndex:t}}function d8(e){return NR(e)+1}function NR(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Nd(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function tb(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function zc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function h8(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 OR(e,t=IR()){return hr(e,t)}function hr(e,t=IR()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function IR(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const f8={"canvas.empty.noTheater":"Add a Theater from the sidebar to start operations.","canvas.empty.standingBy_one":"{count} operation standing by","canvas.empty.standingBy_other":"{count} operations standing by","canvas.empty.openOperation":"Open operation {title}","canvas.empty.open":"OPEN","canvas.empty.headline":"Launch your first operation","canvas.empty.newOperationAria":"New Operation in {theater}","canvas.empty.newOperation":"+ New Operation","canvas.empty.hintSearch":"Search","canvas.empty.hintFormation":"Formation","canvas.empty.hintStatusBoard":"Status board","canvas.empty.guide":"Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.","canvas.frame.operationAria":"Operation {title}","canvas.frame.renameAria":"Rename operation {title}","canvas.frame.renameTitle":"{title} — Double-click, Enter, or F2 to rename","canvas.frame.setAccentAria":"Set accent for operation {title}","canvas.frame.setAccentTitle":"Set accent","canvas.frame.minimizeAria":"Minimize operation {title}","canvas.frame.minimizeTitle":"Minimize operation","canvas.frame.restoreAria":"Restore operation {title}","canvas.frame.maximizeAria":"Maximize operation {title}","canvas.frame.restoreTitle":"Restore operation","canvas.frame.maximizeTitle":"Maximize operation","canvas.frame.confirmCloseAria":"Confirm close operation {title}","canvas.frame.closeAria":"Close operation {title}","canvas.frame.confirmCloseTitle":"Confirm close","canvas.frame.closeTitle":"Close operation","canvas.frame.closeArmed":"Close?","canvas.companion.aria":"Companion {title}","canvas.plugin.operationFailed":"Plugin operation failed to render.","canvas.plugin.companionFailed":"Plugin companion failed to render.","canvas.menu.aria":"Canvas controls","canvas.menu.title":"Canvas controls","canvas.menu.launch":"Launch","canvas.menu.empty":"No operations available.","canvas.minimap.open":"Open Map","canvas.minimap.collapse":"Collapse Map","canvas.minimap.label":"Map","canvas.minimap.navigateAria":"Canvas minimap — drag to navigate","canvas.accent.menuAria":"Accent","canvas.accent.none":"None","canvas.accent.noneAria":"No accent","canvas.accent.crimson":"Crimson","canvas.accent.amber":"Amber","canvas.accent.moss":"Moss","canvas.accent.teal":"Teal","canvas.accent.cerulean":"Cerulean","canvas.accent.indigo":"Indigo","canvas.accent.plum":"Plum","canvas.accent.rose":"Rose","canvas.groupMenu.operationOptions":"Operation options","canvas.groupMenu.groupOptions":"{name} options","canvas.groupMenu.sectionGroup":"Group","canvas.groupMenu.sectionAccent":"Accent","canvas.groupMenu.sectionColor":"Color","canvas.groupMenu.sectionRename":"Rename","canvas.groupMenu.newGroup":"+ New group","canvas.groupMenu.newGroupNameAria":"New group name","canvas.groupMenu.groupNamePlaceholder":"Group name","canvas.groupMenu.groupNameAria":"Group name","canvas.groupMenu.defaultName":"Group {n}","canvas.groupMenu.ungroupAll":"Ungroup all","canvas.groupMenu.confirmUngroupAll":"Confirm ungroup all?","canvas.groupMenu.ungroupAria":"Ungroup all members and delete group","canvas.groupMenu.confirmUngroupAria":"Confirm: remove all members and delete group","sidebar.status.awaiting":"AWAITING","sidebar.status.running":"RUNNING","sidebar.status.idle":"IDLE","sidebar.status.dormant":"DORMANT","sidebar.status.expandSection":"Expand section {label}","sidebar.status.collapseSection":"Collapse section {label}","sidebar.status.expand":"Expand","sidebar.status.collapse":"Collapse","sidebar.status.sectionOperations":"{label} operations","sidebar.status.noOperations":"No operations","sidebar.list.aria":"Theaters and operations","sidebar.theater.operationsAria":"{theater} operations","sidebar.theater.controlsAria":"{theater} controls","sidebar.theater.operationControlsAria":"{theater} operation controls","sidebar.theater.expand":"Expand {theater}","sidebar.theater.collapse":"Collapse {theater}","sidebar.theater.switchTo":"Switch to {theater}","sidebar.theater.sortByStatus":"Sort by status","sidebar.theater.sortByStatusTitle":"Sort by status (Alt+S)","sidebar.theater.newOperation":"New Operation in {theater}","sidebar.theater.actions":"Theater actions","sidebar.theater.actionsMenuAria":"{theater} actions","sidebar.theater.newTheater":"New Theater","sidebar.theater.newGroup":"New group…","sidebar.theater.forget":"Forget Theater","sidebar.theater.newGroupNameAria":"New group name","sidebar.theater.groupNamePlaceholder":"Group name","sidebar.theater.defaultGroupName":"Group {n}","sidebar.ungrouped.label":"Ungrouped","sidebar.ungrouped.aria":"Ungrouped operations","sidebar.group.expand":"Expand group {name}","sidebar.group.collapse":"Collapse group {name}","sidebar.group.operationsCount":"{count} operations","sidebar.chip.focusAria":"Focus operation {title}{groupContext}{unseenContext}","sidebar.chip.focusedAria":"{title}{groupContext} (focused){unseenContext}","sidebar.chip.inGroup":" in group {name}","sidebar.chip.unseenContext":" (unseen since idle)","sidebar.chip.previewTitle":"Click to open in its Theater","sidebar.chip.activeTitle":"Focused · double-click to rename · right-click to set accent","sidebar.chip.idleTitle":"Click to focus · double-click to rename · right-click to set accent","sidebar.chip.renameAria":"Rename operation {title}","sidebar.chip.groupAria":"Group {name}","sidebar.chip.unseenAria":"Unseen since idle","sidebar.chip.unseenTitle":"Finished — not opened yet","sidebar.chip.minimizeAria":"Minimize operation {title}","sidebar.chip.minimizeTitle":"Minimize operation","sidebar.chip.confirmCloseAria":"Confirm close operation {title}","sidebar.chip.closeAria":"Close operation {title}","sidebar.chip.confirmCloseTitle":"Confirm close","sidebar.chip.closeTitle":"Close operation","sidebar.chip.closeArmed":"Close?","rail.chrome.aria":"Activity Rail","rail.chrome.toolsAria":"Activity tools","rail.chrome.panelsAria":"Activity panels","rail.chrome.resizePanel":"Resize {title} panel","rail.chrome.floatToggle":"Float panel over the Map","rail.chrome.floatLabel":"Float over Map","rail.chrome.opacityAria":"Panel opacity","rail.chrome.opacitySolid":"Solid","rail.chrome.closePanel":"Close {title}","rail.theater.fallback":"Theater","rail.alerts.title":"Alerts","rail.alerts.panelAria":"Operation alerts","rail.alerts.settingsAria":"Notification settings","rail.alerts.empty":"No active alerts","rail.alerts.open":"Open","rail.alerts.openAria":"Open {theater} {operation}","rail.alerts.kindEnded":"Ended","rail.alerts.kindWaiting":"Waiting for input","rail.alerts.settingsDisplay":"Display","rail.alerts.muteAll":"Mute all","rail.alerts.dnd":"Do not disturb","rail.alerts.byTheater":"By Theater","rail.codex.title":"Codex","rail.codex.expandAria":"Expand reading sheet","rail.codex.expand":"⤢ Expand","rail.codex.closePaneAria":"Close document pane","rail.codex.emptyEyebrow":"Codex","rail.codex.addTheater":"Add a Theater","rail.codex.addTheaterHint":"Use the top bar Theater control to choose a project root before opening Codex.","rail.codex.unavailable":"Codex unavailable","rail.codex.thisTheater":"This Theater","rail.codex.wikiUnavailable":"Fleet Wiki data could not be loaded for this Theater.","rail.plans.title":"Plans","rail.plans.selectTheater":"Select a Theater to browse plans.","rail.plans.loadingList":"Loading plans…","rail.plans.loadListError":"Unable to load plans.","rail.plans.empty":"No plans yet.","rail.plans.emptyDetail":"Workspace-scoped Fleet Plans appear here.","rail.plans.noMatch":"No matching plans.","rail.plans.search":"Search plans","rail.plans.statusAria":"Plan status","rail.plans.filterAll":"ALL","rail.plans.filterInProgress":"IN PROGRESS","rail.plans.filterComplete":"COMPLETE","rail.plans.refresh":"REFRESH","rail.plans.listAria":"Plans","rail.plans.rowMeta":"{waves} waves · {done}/{total} tasks · {relative}","rail.plans.rowMetaParallel":" · parallel","rail.plans.progressAria":"{progress}% complete","rail.plans.copy":"COPY","rail.plans.copied":"COPIED","rail.plans.copyAria":"Copy plans/{name}","rail.plans.copiedAria":"Copied plans/{name}","rail.plans.readerTitle":"Plan","rail.plans.loadingPlan":"Loading plan…","rail.plans.loadPlanError":"Unable to load plan.","rail.plans.closePlanAria":"Close plan","rail.plans.parallelBadge":"PARALLEL","rail.plans.readerMeta":"{waves} waves · {done}/{total} tasks · updated {relative}","rail.plans.waveProgressAria":"Wave progress","rail.plans.laneReady":"READY","rail.plans.codeCopied":"Copied","rail.plans.imageBlocked":"Image blocked","rail.plans.imageBlockedNamed":"Image blocked: {label}","rail.plans.mediaBlocked":"Media blocked","rail.plans.mediaBlockedNamed":"Media blocked: {label}"},p8={"canvas.empty.noTheater":"사이드바에서 Theater를 추가해 Operation을 시작하세요.","canvas.empty.standingBy_one":"대기 중인 Operation {count}개","canvas.empty.standingBy_other":"대기 중인 Operation {count}개","canvas.empty.openOperation":"Operation {title} 열기","canvas.empty.open":"열기","canvas.empty.headline":"첫 Operation을 시작하세요","canvas.empty.newOperationAria":"{theater}에서 새 Operation","canvas.empty.newOperation":"+ 새 Operation","canvas.empty.hintSearch":"검색","canvas.empty.hintFormation":"Formation","canvas.empty.hintStatusBoard":"상태 보드","canvas.empty.guide":"Shift-드래그로 Shell을 만듭니다. 우클릭으로 동작을 열고, 드래그로 이동·스크롤로 확대합니다.","canvas.frame.operationAria":"Operation {title}","canvas.frame.renameAria":"Operation {title} 이름 바꾸기","canvas.frame.renameTitle":"{title} — 더블클릭, Enter 또는 F2로 이름 변경","canvas.frame.setAccentAria":"Operation {title} 액센트 설정","canvas.frame.setAccentTitle":"액센트 설정","canvas.frame.minimizeAria":"Operation {title} 최소화","canvas.frame.minimizeTitle":"Operation 최소화","canvas.frame.restoreAria":"Operation {title} 복원","canvas.frame.maximizeAria":"Operation {title} 최대화","canvas.frame.restoreTitle":"Operation 복원","canvas.frame.maximizeTitle":"Operation 최대화","canvas.frame.confirmCloseAria":"Operation {title} 닫기 확인","canvas.frame.closeAria":"Operation {title} 닫기","canvas.frame.confirmCloseTitle":"닫기 확인","canvas.frame.closeTitle":"Operation 닫기","canvas.frame.closeArmed":"닫을까요?","canvas.companion.aria":"Companion {title}","canvas.plugin.operationFailed":"Plugin Operation을 렌더하지 못했습니다.","canvas.plugin.companionFailed":"Plugin Companion을 렌더하지 못했습니다.","canvas.menu.aria":"캔버스 제어","canvas.menu.title":"캔버스 제어","canvas.menu.launch":"실행","canvas.menu.empty":"사용 가능한 Operation이 없습니다.","canvas.minimap.open":"Map 열기","canvas.minimap.collapse":"Map 접기","canvas.minimap.label":"Map","canvas.minimap.navigateAria":"캔버스 미니맵 — 드래그하여 이동","canvas.accent.menuAria":"액센트","canvas.accent.none":"없음","canvas.accent.noneAria":"액센트 없음","canvas.accent.crimson":"Crimson","canvas.accent.amber":"Amber","canvas.accent.moss":"Moss","canvas.accent.teal":"Teal","canvas.accent.cerulean":"Cerulean","canvas.accent.indigo":"Indigo","canvas.accent.plum":"Plum","canvas.accent.rose":"Rose","canvas.groupMenu.operationOptions":"Operation 옵션","canvas.groupMenu.groupOptions":"{name} 옵션","canvas.groupMenu.sectionGroup":"그룹","canvas.groupMenu.sectionAccent":"액센트","canvas.groupMenu.sectionColor":"색","canvas.groupMenu.sectionRename":"이름 변경","canvas.groupMenu.newGroup":"+ 새 그룹","canvas.groupMenu.newGroupNameAria":"새 그룹 이름","canvas.groupMenu.groupNamePlaceholder":"그룹 이름","canvas.groupMenu.groupNameAria":"그룹 이름","canvas.groupMenu.defaultName":"그룹 {n}","canvas.groupMenu.ungroupAll":"전체 그룹 해제","canvas.groupMenu.confirmUngroupAll":"전체 그룹 해제를 확인할까요?","canvas.groupMenu.ungroupAria":"모든 멤버를 빼고 그룹을 삭제합니다","canvas.groupMenu.confirmUngroupAria":"확인: 모든 멤버를 빼고 그룹을 삭제합니다","sidebar.status.awaiting":"대기","sidebar.status.running":"실행 중","sidebar.status.idle":"유휴","sidebar.status.dormant":"휴면","sidebar.status.expandSection":"{label} 섹션 펼치기","sidebar.status.collapseSection":"{label} 섹션 접기","sidebar.status.expand":"펼치기","sidebar.status.collapse":"접기","sidebar.status.sectionOperations":"{label} Operation","sidebar.status.noOperations":"Operation 없음","sidebar.list.aria":"Theater와 Operation","sidebar.theater.operationsAria":"{theater} Operation","sidebar.theater.controlsAria":"{theater} 제어","sidebar.theater.operationControlsAria":"{theater} Operation 제어","sidebar.theater.expand":"{theater} 펼치기","sidebar.theater.collapse":"{theater} 접기","sidebar.theater.switchTo":"{theater}(으)로 전환","sidebar.theater.sortByStatus":"상태별 정렬","sidebar.theater.sortByStatusTitle":"상태별 정렬 (Alt+S)","sidebar.theater.newOperation":"{theater}에서 새 Operation","sidebar.theater.actions":"Theater 동작","sidebar.theater.actionsMenuAria":"{theater} 동작","sidebar.theater.newTheater":"새 Theater","sidebar.theater.newGroup":"새 그룹…","sidebar.theater.forget":"Theater 잊기","sidebar.theater.newGroupNameAria":"새 그룹 이름","sidebar.theater.groupNamePlaceholder":"그룹 이름","sidebar.theater.defaultGroupName":"그룹 {n}","sidebar.ungrouped.label":"미분류","sidebar.ungrouped.aria":"미분류 Operation","sidebar.group.expand":"{name} 그룹 펼치기","sidebar.group.collapse":"{name} 그룹 접기","sidebar.group.operationsCount":"Operation {count}개","sidebar.chip.focusAria":"Operation {title}에 포커스{groupContext}{unseenContext}","sidebar.chip.focusedAria":"{title}{groupContext} (포커스됨){unseenContext}","sidebar.chip.inGroup":" · 그룹 {name}","sidebar.chip.unseenContext":" (유휴 이후 미확인)","sidebar.chip.previewTitle":"클릭하여 해당 Theater에서 열기","sidebar.chip.activeTitle":"포커스됨 · 더블클릭으로 이름 변경 · 우클릭으로 액센트 설정","sidebar.chip.idleTitle":"클릭하여 포커스 · 더블클릭으로 이름 변경 · 우클릭으로 액센트 설정","sidebar.chip.renameAria":"Operation {title} 이름 바꾸기","sidebar.chip.groupAria":"그룹 {name}","sidebar.chip.unseenAria":"유휴 이후 미확인","sidebar.chip.unseenTitle":"종료됨 — 아직 열지 않음","sidebar.chip.minimizeAria":"Operation {title} 최소화","sidebar.chip.minimizeTitle":"Operation 최소화","sidebar.chip.confirmCloseAria":"Operation {title} 닫기 확인","sidebar.chip.closeAria":"Operation {title} 닫기","sidebar.chip.confirmCloseTitle":"닫기 확인","sidebar.chip.closeTitle":"Operation 닫기","sidebar.chip.closeArmed":"닫을까요?","rail.chrome.aria":"Activity Rail","rail.chrome.toolsAria":"Activity 도구","rail.chrome.panelsAria":"Activity 패널","rail.chrome.resizePanel":"{title} 패널 크기 조절","rail.chrome.floatToggle":"패널을 Map 위에 띄우기","rail.chrome.floatLabel":"Map 위에 띄우기","rail.chrome.opacityAria":"패널 불투명도","rail.chrome.opacitySolid":"불투명","rail.chrome.closePanel":"{title} 닫기","rail.theater.fallback":"Theater","rail.alerts.title":"알림","rail.alerts.panelAria":"Operation 알림","rail.alerts.settingsAria":"알림 설정","rail.alerts.empty":"활성 알림 없음","rail.alerts.open":"열기","rail.alerts.openAria":"{theater} {operation} 열기","rail.alerts.kindEnded":"종료됨","rail.alerts.kindWaiting":"입력 대기","rail.alerts.settingsDisplay":"표시","rail.alerts.muteAll":"전체 음소거","rail.alerts.dnd":"방해 금지","rail.alerts.byTheater":"Theater별","rail.codex.title":"Codex","rail.codex.expandAria":"읽기 시트 확대","rail.codex.expand":"⤢ 확대","rail.codex.closePaneAria":"문서 창 닫기","rail.codex.emptyEyebrow":"Codex","rail.codex.addTheater":"Theater 추가","rail.codex.addTheaterHint":"Codex를 열기 전에 상단 Theater 컨트롤에서 프로젝트 루트를 선택하세요.","rail.codex.unavailable":"Codex를 사용할 수 없음","rail.codex.thisTheater":"이 Theater","rail.codex.wikiUnavailable":"이 Theater의 Fleet Wiki 데이터를 불러오지 못했습니다.","rail.plans.title":"Plans","rail.plans.selectTheater":"Plans를 보려면 Theater를 선택하세요.","rail.plans.loadingList":"Plans 불러오는 중…","rail.plans.loadListError":"Plans를 불러오지 못했습니다.","rail.plans.empty":"아직 Plans가 없습니다.","rail.plans.emptyDetail":"워크스페이스 범위의 Fleet Plans가 여기에 나타납니다.","rail.plans.noMatch":"일치하는 Plans가 없습니다.","rail.plans.search":"Plans 검색","rail.plans.statusAria":"Plan 상태","rail.plans.filterAll":"전체","rail.plans.filterInProgress":"진행 중","rail.plans.filterComplete":"완료","rail.plans.refresh":"새로고침","rail.plans.listAria":"Plans","rail.plans.rowMeta":"웨이브 {waves} · 작업 {done}/{total} · {relative}","rail.plans.rowMetaParallel":" · 병렬","rail.plans.progressAria":"{progress}% 완료","rail.plans.copy":"복사","rail.plans.copied":"복사됨","rail.plans.copyAria":"plans/{name} 복사","rail.plans.copiedAria":"plans/{name} 복사됨","rail.plans.readerTitle":"계획","rail.plans.loadingPlan":"Plan 불러오는 중…","rail.plans.loadPlanError":"Plan을 불러오지 못했습니다.","rail.plans.closePlanAria":"Plan 닫기","rail.plans.parallelBadge":"PARALLEL","rail.plans.readerMeta":"웨이브 {waves} · 작업 {done}/{total} · {relative} 업데이트","rail.plans.waveProgressAria":"웨이브 진행","rail.plans.laneReady":"READY","rail.plans.codeCopied":"복사됨","rail.plans.imageBlocked":"이미지 차단됨","rail.plans.imageBlockedNamed":"이미지 차단됨: {label}","rail.plans.mediaBlocked":"미디어 차단됨","rail.plans.mediaBlockedNamed":"미디어 차단됨: {label}"},m8={"chrome.commandBand.showCommandBand":"Show command band","chrome.commandBand.local":"Local","chrome.commandBand.localDesktop":"Local · Desktop","chrome.commandBand.expandSidebar":"Expand sidebar ({shortcut})","chrome.commandBand.collapseSidebar":"Collapse sidebar ({shortcut})","chrome.commandBand.searchSessions":"Search sessions","chrome.commandBand.searchSessionsTitle":"Search sessions (⌘K)","chrome.commandBand.formationView":"Formation view","chrome.commandBand.resetCanvasView":"Reset canvas view","chrome.commandBand.formationGrid":"Formation view — Grid layout","chrome.commandBand.formationColumns":"Formation view — Columns layout","chrome.commandBand.formationRows":"Formation view — Rows layout","chrome.commandBand.activeTheater":"Active Theater: {label}","chrome.commandBand.switchTheater":"Switch Theater","chrome.commandBand.switchOperation":"Switch operation","chrome.commandBand.switchOperationRename":"Switch operation — double-click to rename","chrome.commandBand.selectOperation":"Select operation","chrome.commandBand.selectOperationEllipsis":"Select operation…","chrome.commandBand.renameOperationAria":"{title} 이름 변경","chrome.commandBand.pinCommandBand":"Pin command band","chrome.commandBand.unpinCommandBand":"Unpin command band","chrome.commandBand.expandActivityRail":"Expand Activity Rail ({shortcut})","chrome.commandBand.collapseActivityRail":"Collapse Activity Rail ({shortcut})","chrome.commandBand.environment":"Environment","chrome.commandBand.loadingEnvironment":"Loading environment details…","chrome.commandBand.unableToLoadEnvironment":"Unable to load environment details.","chrome.commandBand.env.channel":"Channel","chrome.commandBand.env.version":"Version","chrome.commandBand.env.reachableOn":"Reachable on","chrome.commandBand.env.dataRoot":"Data root","chrome.commandBand.env.runtimeLock":"Runtime lock","chrome.commandBand.env.desktopData":"Desktop data","chrome.commandBand.env.copied":"Copied","chrome.commandBand.env.copyFailed":"Copy failed","chrome.commandBand.env.copy":"Copy","chrome.commandBand.env.footer":"Development and published channels keep separate data roots.","chrome.commandBand.opCount_one":"{count} op","chrome.commandBand.opCount_other":"{count} ops","chrome.commandBand.addTheater":"Add Theater…","chrome.commandBand.renameCurrentOperation":"Rename current operation…","chrome.commandBand.newOperationIn":"New Operation in {theater}…","chrome.commandBand.noOperationsInTheater":"No operations in this Theater","chrome.operationSearch.commandsDialog":"Console commands","chrome.operationSearch.quickSearchDialog":"Operation quick search","chrome.operationSearch.placeholder":"Search Operations — type > for commands","chrome.operationSearch.commandResults":"Command results","chrome.operationSearch.operationResults":"Operation results","chrome.operationSearch.commands":"Commands","chrome.operationSearch.current":"current","chrome.operationSearch.noMatchingCommands":"No matching commands.","chrome.operationSearch.open":"open","chrome.operationSearch.noMatching":"No matching Operations or panel content.","chrome.shortcuts.title":"Keyboard Shortcuts","chrome.shortcuts.closeAria":"Close keyboard shortcuts","chrome.shortcuts.or":" or ","chrome.shortcuts.modKey":"⌘/Ctrl","chrome.whatsnew.closeAria":"Close What's new","chrome.whatsnew.title":"What's new","chrome.whatsnew.released":"Released {date}","chrome.whatsnew.unreleased":"Unreleased","chrome.whatsnew.stale":"Stale","chrome.whatsnew.releaseVersion":"Release version","chrome.whatsnew.newerVersions":"Newer versions","chrome.whatsnew.olderVersions":"Older versions","chrome.whatsnew.displayLanguage":"Display language","chrome.whatsnew.langEn":"EN","chrome.whatsnew.langKo":"한국어","chrome.whatsnew.refreshing":"Refreshing","chrome.whatsnew.releaseCategories":"Release update categories","chrome.whatsnew.refreshError":"Release notes could not be refreshed.","chrome.whatsnew.overviewAria":"Release update overview","chrome.whatsnew.updateCount_one":"{count} update","chrome.whatsnew.updateCount_other":"{count} updates","chrome.whatsnew.versionUnreleased":"Unreleased","chrome.whatsnew.versionTagged":"v{version}","chrome.commissioning.closeAria":"Close setup guide","chrome.commissioning.eyebrow":"COMMISSIONING · FLEET CONSOLE","chrome.commissioning.title":"Set up Fleet Console","chrome.commissioning.lead":"Add a project folder, start an Operation, and monitor Carriers.","chrome.commissioning.step1Title":"Register a Theater","chrome.commissioning.step1Body":"A Theater is a project folder. Choose the folder you want to work from.","chrome.commissioning.goToOperationsArrow":"Go to Operations →","chrome.commissioning.addingTheater":"Adding Theater…","chrome.commissioning.chooseFolder":"Choose a folder…","chrome.commissioning.step2Title":"Open an Operation","chrome.commissioning.step2Body":"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session.","chrome.commissioning.goToOperations":"Go to Operations","chrome.commissioning.step3Title":"Monitor Carriers","chrome.commissioning.step3Body":"Carriers are specialist agents. Their activity streams here while they run.","chrome.commissioning.footer":"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library.","chrome.commissioning.skip":"Skip for now","chrome.directoryBrowser.dialogAria":"Add Theater","chrome.directoryBrowser.kicker":"Project folder","chrome.directoryBrowser.title":"Add Theater","chrome.directoryBrowser.drives":"Drives","chrome.directoryBrowser.locations":"Locations","chrome.directoryBrowser.path":"Path","chrome.directoryBrowser.filterPlaceholder":"Filter folders…","chrome.directoryBrowser.filterAria":"Filter folders","chrome.directoryBrowser.upTitle":"Up one folder (Backspace)","chrome.directoryBrowser.up":"Up","chrome.directoryBrowser.jumpPlaceholder":"Or jump to a path — e.g. D:\\\\projects","chrome.directoryBrowser.jumpAria":"Jump to absolute path","chrome.directoryBrowser.go":"Go","chrome.directoryBrowser.folders":"Folders","chrome.directoryBrowser.loadingFolders":"Loading folders…","chrome.directoryBrowser.noMatch":"No folders match the filter.","chrome.directoryBrowser.noFolders":"No folders available.","chrome.directoryBrowser.locked":"Locked","chrome.directoryBrowser.truncated":"Showing the first 500 folders.","chrome.directoryBrowser.theaterRoot":"Theater Root","chrome.directoryBrowser.addTheater":"Add Theater","chrome.brandFoot.operations":"Operations","chrome.brandFoot.systemMenu":"System Menu","chrome.brandFoot.settings":"Settings","chrome.brandFoot.help":"Help","chrome.brandFoot.whatsNew":"What's New","chrome.brandFoot.keyboardShortcuts":"Keyboard Shortcuts","chrome.brandFoot.github":"GitHub","chrome.brandFoot.openGithub":"Open GitHub repository","chrome.brandFoot.githubRepo":"GitHub repository","chrome.brandFoot.githubStars":"GitHub stars {count}","chrome.brandFoot.starOnGithub":"Star on GitHub","chrome.brandFoot.update.latestVersion":"Latest version {version}","chrome.brandFoot.update.available":"Update available","chrome.brandFoot.update.requesting":"Requesting","chrome.brandFoot.update.requestingTitle":"Requesting the console update.","chrome.brandFoot.update.updating":"Updating","chrome.brandFoot.update.updatingTitle":"The console will restart and open in a new window.","chrome.brandFoot.update.done":"Done","chrome.brandFoot.update.doneTitle":"Continue in the newly opened console window.","chrome.brandFoot.update.retryTitle":"The update request failed. Try again.","chrome.brandFoot.update.update":"Update","chrome.brandFoot.update.local":"Local","chrome.brandFoot.update.localTitle":"Local development builds are not updated from the console.","chrome.brandFoot.update.updateAndRestart":"Update and Restart","chrome.brandFoot.update.managedTitle":"This managed Console installation updates through Fleet Console Desktop. Use Desktop Update and Restart.","chrome.brandFoot.update.busy":"Busy","chrome.brandFoot.update.busyTitle":"Another update is already in progress.","chrome.brandFoot.update.current":"Current","chrome.brandFoot.update.currentTitle":"The server re-check found no update to apply.","chrome.brandFoot.update.blocked":"Blocked","chrome.brandFoot.update.blockedTitle":"The console is not ready to start an update. Try again shortly.","chrome.toast.dismissNotification":"Dismiss notification","chrome.toast.consoleLinkInterrupted":"Console link interrupted","chrome.toast.theaterForgotten":"Theater forgotten","chrome.toast.operationClosed":"Operation closed","chrome.toast.secondsRemaining":"{count}s remaining","chrome.toast.undo":"Undo","chrome.backendApi.sectionAria":"Backend API catalog","chrome.backendApi.title":"Backend API","chrome.backendApi.routeSummary_one_one":"{count} loopback route across {categoryCount} category reported by backend introspection.","chrome.backendApi.routeSummary_one_other":"{count} loopback route across {categoryCount} categories reported by backend introspection.","chrome.backendApi.routeSummary_other_one":"{count} loopback routes across {categoryCount} category reported by backend introspection.","chrome.backendApi.routeSummary_other_other":"{count} loopback routes across {categoryCount} categories reported by backend introspection.","chrome.backendApi.emptyHelp":"Backend introspection route list for this console.","chrome.backendApi.hide":"Hide","chrome.backendApi.show":"Show","chrome.backendApi.loading":"Loading backend API catalog.","chrome.backendApi.noRoutes":"No backend API routes reported.","chrome.backendApi.foot":"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.","chrome.backendApi.uncategorized":"Uncategorized","chrome.codexReading.dialogAria":"Codex reading","chrome.codexReading.eyebrow":"Codex · Reading","chrome.codexReading.closeAria":"Close reading","chrome.codexReading.onThisPage":"On this page"},g8={"chrome.commandBand.showCommandBand":"커맨드 밴드를 표시합니다","chrome.commandBand.local":"로컬","chrome.commandBand.localDesktop":"로컬 · Desktop","chrome.commandBand.expandSidebar":"사이드바 펼치기 ({shortcut})","chrome.commandBand.collapseSidebar":"사이드바 접기 ({shortcut})","chrome.commandBand.searchSessions":"세션 검색","chrome.commandBand.searchSessionsTitle":"세션 검색 (⌘K)","chrome.commandBand.formationView":"Formation 보기","chrome.commandBand.resetCanvasView":"캔버스 보기 초기화","chrome.commandBand.formationGrid":"Formation 보기 — 격자 레이아웃","chrome.commandBand.formationColumns":"Formation 보기 — 열 레이아웃","chrome.commandBand.formationRows":"Formation 보기 — 행 레이아웃","chrome.commandBand.activeTheater":"활성 Theater: {label}","chrome.commandBand.switchTheater":"Theater 전환","chrome.commandBand.switchOperation":"Operation 전환","chrome.commandBand.switchOperationRename":"Operation 전환 — 더블클릭으로 이름 변경","chrome.commandBand.selectOperation":"Operation 선택","chrome.commandBand.selectOperationEllipsis":"Operation 선택…","chrome.commandBand.renameOperationAria":"{title} 이름 변경","chrome.commandBand.pinCommandBand":"커맨드 밴드 고정","chrome.commandBand.unpinCommandBand":"커맨드 밴드 고정 해제","chrome.commandBand.expandActivityRail":"Activity Rail 펼치기 ({shortcut})","chrome.commandBand.collapseActivityRail":"Activity Rail 접기 ({shortcut})","chrome.commandBand.environment":"환경","chrome.commandBand.loadingEnvironment":"환경 정보를 불러오는 중…","chrome.commandBand.unableToLoadEnvironment":"환경 정보를 불러올 수 없습니다.","chrome.commandBand.env.channel":"채널","chrome.commandBand.env.version":"버전","chrome.commandBand.env.reachableOn":"접속 주소","chrome.commandBand.env.dataRoot":"데이터 루트","chrome.commandBand.env.runtimeLock":"런타임 잠금","chrome.commandBand.env.desktopData":"Desktop 데이터","chrome.commandBand.env.copied":"복사됨","chrome.commandBand.env.copyFailed":"복사 실패","chrome.commandBand.env.copy":"복사","chrome.commandBand.env.footer":"개발 채널과 배포 채널은 서로 다른 데이터 루트를 사용합니다.","chrome.commandBand.opCount_one":"{count}개 op","chrome.commandBand.opCount_other":"{count}개 ops","chrome.commandBand.addTheater":"Theater 추가…","chrome.commandBand.renameCurrentOperation":"현재 Operation 이름 변경…","chrome.commandBand.newOperationIn":"{theater}에서 새 Operation…","chrome.commandBand.noOperationsInTheater":"이 Theater에 Operation이 없습니다","chrome.operationSearch.commandsDialog":"Console 명령","chrome.operationSearch.quickSearchDialog":"Operation 빠른 검색","chrome.operationSearch.placeholder":"Operation 검색 — 명령은 > 입력","chrome.operationSearch.commandResults":"명령 결과","chrome.operationSearch.operationResults":"Operation 결과","chrome.operationSearch.commands":"명령","chrome.operationSearch.current":"현재","chrome.operationSearch.noMatchingCommands":"일치하는 명령이 없습니다.","chrome.operationSearch.open":"열기","chrome.operationSearch.noMatching":"일치하는 Operation 또는 패널 콘텐츠가 없습니다.","chrome.shortcuts.title":"키보드 단축키","chrome.shortcuts.closeAria":"키보드 단축키 닫기","chrome.shortcuts.or":" 또는 ","chrome.shortcuts.modKey":"⌘/Ctrl","chrome.whatsnew.closeAria":"새 소식 닫기","chrome.whatsnew.title":"새 소식","chrome.whatsnew.released":"{date} 출시","chrome.whatsnew.unreleased":"미출시","chrome.whatsnew.stale":"오래됨","chrome.whatsnew.releaseVersion":"릴리스 버전","chrome.whatsnew.newerVersions":"더 새 버전","chrome.whatsnew.olderVersions":"더 옛 버전","chrome.whatsnew.displayLanguage":"표시 언어","chrome.whatsnew.langEn":"EN","chrome.whatsnew.langKo":"한국어","chrome.whatsnew.refreshing":"새로고침 중","chrome.whatsnew.releaseCategories":"릴리스 업데이트 분류","chrome.whatsnew.refreshError":"릴리스 노트를 새로고침할 수 없습니다.","chrome.whatsnew.overviewAria":"릴리스 업데이트 개요","chrome.whatsnew.updateCount_one":"{count}개 업데이트","chrome.whatsnew.updateCount_other":"{count}개 업데이트","chrome.whatsnew.versionUnreleased":"미출시","chrome.whatsnew.versionTagged":"v{version}","chrome.commissioning.closeAria":"설정 가이드 닫기","chrome.commissioning.eyebrow":"취역 · FLEET CONSOLE","chrome.commissioning.title":"Fleet Console 설정","chrome.commissioning.lead":"프로젝트 폴더를 추가하고 Operation을 시작한 뒤 Carrier를 모니터링하세요.","chrome.commissioning.step1Title":"Theater 등록","chrome.commissioning.step1Body":"Theater는 프로젝트 폴더입니다. 작업할 폴더를 선택하세요.","chrome.commissioning.goToOperationsArrow":"Operations로 이동 →","chrome.commissioning.addingTheater":"Theater 추가 중…","chrome.commissioning.chooseFolder":"폴더 선택…","chrome.commissioning.step2Title":"Operation 열기","chrome.commissioning.step2Body":"Operation은 Agent CLI를 실행하는 라이브 터미널 세션입니다. Operations 탭에서 시작해 작업 세션을 여세요.","chrome.commissioning.goToOperations":"Operations로 이동","chrome.commissioning.step3Title":"Carrier 모니터링","chrome.commissioning.step3Body":"Carrier는 전문 Agent입니다. 실행 중 활동 스트림이 여기에 표시됩니다.","chrome.commissioning.footer":"Fleet Wiki 지식 루트가 있는 Theater는 Codex도 잠금 해제합니다 — 결정 기록과 참고 라이브러리입니다.","chrome.commissioning.skip":"지금은 건너뛰기","chrome.directoryBrowser.dialogAria":"Theater 추가","chrome.directoryBrowser.kicker":"프로젝트 폴더","chrome.directoryBrowser.title":"Theater 추가","chrome.directoryBrowser.drives":"드라이브","chrome.directoryBrowser.locations":"위치","chrome.directoryBrowser.path":"경로","chrome.directoryBrowser.filterPlaceholder":"폴더 필터…","chrome.directoryBrowser.filterAria":"폴더 필터","chrome.directoryBrowser.upTitle":"상위 폴더 (Backspace)","chrome.directoryBrowser.up":"위로","chrome.directoryBrowser.jumpPlaceholder":"또는 경로로 이동 — 예: D:\\\\projects","chrome.directoryBrowser.jumpAria":"절대 경로로 이동","chrome.directoryBrowser.go":"이동","chrome.directoryBrowser.folders":"폴더","chrome.directoryBrowser.loadingFolders":"폴더를 불러오는 중…","chrome.directoryBrowser.noMatch":"필터와 일치하는 폴더가 없습니다.","chrome.directoryBrowser.noFolders":"사용 가능한 폴더가 없습니다.","chrome.directoryBrowser.locked":"잠김","chrome.directoryBrowser.truncated":"처음 500개 폴더만 표시합니다.","chrome.directoryBrowser.theaterRoot":"Theater 루트","chrome.directoryBrowser.addTheater":"Theater 추가","chrome.brandFoot.operations":"Operations","chrome.brandFoot.systemMenu":"시스템 메뉴","chrome.brandFoot.settings":"설정","chrome.brandFoot.help":"도움말","chrome.brandFoot.whatsNew":"새 소식","chrome.brandFoot.keyboardShortcuts":"키보드 단축키","chrome.brandFoot.github":"GitHub","chrome.brandFoot.openGithub":"GitHub 저장소 열기","chrome.brandFoot.githubRepo":"GitHub 저장소","chrome.brandFoot.githubStars":"GitHub 스타 {count}","chrome.brandFoot.starOnGithub":"GitHub에서 스타하기","chrome.brandFoot.update.latestVersion":"최신 버전 {version}","chrome.brandFoot.update.available":"업데이트 가능","chrome.brandFoot.update.requesting":"요청 중","chrome.brandFoot.update.requestingTitle":"Console 업데이트를 요청하는 중입니다.","chrome.brandFoot.update.updating":"업데이트 중","chrome.brandFoot.update.updatingTitle":"Console이 다시 시작되며 새 창에서 열립니다.","chrome.brandFoot.update.done":"완료","chrome.brandFoot.update.doneTitle":"새로 열린 Console 창에서 계속하세요.","chrome.brandFoot.update.retryTitle":"업데이트 요청에 실패했습니다. 다시 시도하세요.","chrome.brandFoot.update.update":"업데이트","chrome.brandFoot.update.local":"로컬","chrome.brandFoot.update.localTitle":"로컬 개발 빌드는 Console에서 업데이트되지 않습니다.","chrome.brandFoot.update.updateAndRestart":"업데이트 및 다시 시작","chrome.brandFoot.update.managedTitle":"이 관리형 Console 설치는 Fleet Console Desktop을 통해 업데이트됩니다. Desktop의 Update and Restart를 사용하세요.","chrome.brandFoot.update.busy":"진행 중","chrome.brandFoot.update.busyTitle":"다른 업데이트가 이미 진행 중입니다.","chrome.brandFoot.update.current":"최신","chrome.brandFoot.update.currentTitle":"서버 재확인 결과 적용할 업데이트가 없습니다.","chrome.brandFoot.update.blocked":"차단됨","chrome.brandFoot.update.blockedTitle":"Console이 업데이트를 시작할 준비가 되지 않았습니다. 잠시 후 다시 시도하세요.","chrome.toast.dismissNotification":"알림 닫기","chrome.toast.consoleLinkInterrupted":"Console 연결이 끊겼습니다","chrome.toast.theaterForgotten":"Theater를 잊었습니다","chrome.toast.operationClosed":"Operation이 닫혔습니다","chrome.toast.secondsRemaining":"{count}초 남음","chrome.toast.undo":"실행 취소","chrome.backendApi.sectionAria":"Backend API 카탈로그","chrome.backendApi.title":"Backend API","chrome.backendApi.routeSummary_one_one":"백엔드 인트로스펙션이 보고한 {categoryCount}개 분류의 루프백 라우트 {count}개입니다.","chrome.backendApi.routeSummary_one_other":"백엔드 인트로스펙션이 보고한 {categoryCount}개 분류의 루프백 라우트 {count}개입니다.","chrome.backendApi.routeSummary_other_one":"백엔드 인트로스펙션이 보고한 {categoryCount}개 분류의 루프백 라우트 {count}개입니다.","chrome.backendApi.routeSummary_other_other":"백엔드 인트로스펙션이 보고한 {categoryCount}개 분류의 루프백 라우트 {count}개입니다.","chrome.backendApi.emptyHelp":"이 Console의 백엔드 인트로스펙션 라우트 목록입니다.","chrome.backendApi.hide":"숨기기","chrome.backendApi.show":"표시","chrome.backendApi.loading":"Backend API 카탈로그를 불러오는 중.","chrome.backendApi.noRoutes":"보고된 Backend API 라우트가 없습니다.","chrome.backendApi.foot":"Console 백엔드 라우트는 GET /api/v1/settings/api-catalog에서 가져오므로, 새로 등록된 라우트가 여기에 자동으로 나타납니다. Codex/Fleet Wiki API 표면은 포함되지 않습니다.","chrome.backendApi.uncategorized":"미분류","chrome.codexReading.dialogAria":"Codex 읽기","chrome.codexReading.eyebrow":"Codex · 읽기","chrome.codexReading.closeAria":"읽기 닫기","chrome.codexReading.onThisPage":"이 페이지"},y8={"common.loading":"Loading…","common.retry":"Retry","common.close":"Close","common.cancel":"Cancel","common.refresh":"Refresh","common.dismiss":"Dismiss","common.unknown":"Unknown","common.copy":"Copy","common.copyCodeAria":"Copy {language} code","common.diagram.renderFailed":"Diagram render failed: {message}","common.diagram.openExpandedAria":"Open diagram in expanded view","common.diagram.lightboxTitle":"MANIFEST · DIAGRAM","common.diagram.closeExpandedAria":"Close expanded diagram","common.diagram.zoomControlsAria":"Diagram zoom controls","common.diagram.zoomOutAria":"Zoom out","common.diagram.zoomInAria":"Zoom in","common.diagram.fit":"Fit","common.diagram.fitAria":"Fit diagram to viewport","common.diagram.reset":"Reset","common.diagram.resetAria":"Reset diagram zoom","common.error.methodNotAllowed":"Method not allowed","common.error.notFound":"Not found","common.error.unauthorized":"Unauthorized","common.error.internal":"Internal server error"},_8={"common.loading":"불러오는 중…","common.retry":"다시 시도","common.close":"닫기","common.cancel":"취소","common.refresh":"새로고침","common.dismiss":"닫기","common.unknown":"알 수 없음","common.copy":"복사","common.copyCodeAria":"{language} 코드 복사","common.diagram.renderFailed":"다이어그램 렌더 실패: {message}","common.diagram.openExpandedAria":"다이어그램을 확대 보기로 열기","common.diagram.lightboxTitle":"MANIFEST · DIAGRAM","common.diagram.closeExpandedAria":"확대된 다이어그램 닫기","common.diagram.zoomControlsAria":"다이어그램 확대/축소 컨트롤","common.diagram.zoomOutAria":"축소","common.diagram.zoomInAria":"확대","common.diagram.fit":"맞춤","common.diagram.fitAria":"뷰포트에 다이어그램 맞추기","common.diagram.reset":"초기화","common.diagram.resetAria":"다이어그램 확대/축소 초기화","common.error.methodNotAllowed":"허용되지 않은 요청 방식입니다","common.error.notFound":"찾을 수 없습니다","common.error.unauthorized":"권한이 없습니다","common.error.internal":"서버 내부 오류가 발생했습니다"},v8={"settings.kicker":"Console","settings.title":"Settings","settings.saving":"Saving…","settings.sectionsAria":"Settings sections","settings.nav.console":"Console","settings.nav.plugins":"Plugins","settings.core.general.label":"General","settings.core.general.eyebrow":"Theme · Type · Port","settings.core.backendApi.label":"Backend API","settings.core.backendApi.eyebrow":"Loopback routes","settings.pluginFailed":"Plugin settings failed to render.","settings.pluginUnavailable":"Plugin settings unavailable.","settings.plugin.terminal":"Terminal","settings.theme.aria":"Theme","settings.theme.title":"Theme","settings.theme.help":"Console color scheme.","settings.theme.foot":"Theme applies immediately and is stored server-side.","settings.theme.instrument":"Instrument","settings.theme.maritime":"Maritime","settings.theme.carbon":"Carbon","settings.typography.aria":"Typography","settings.typography.title":"Typography","settings.typography.help":"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged.","settings.typography.reset":"Reset to Fleet default","settings.typography.preview":"Fleet typography keeps operations readable.","settings.typography.font.manrope":"Balanced · Fleet default","settings.typography.font.jetbrains-mono":"Uniform · technical scan","settings.typography.font.source-code-pro":"Open forms · compact","settings.typography.foot":"Typography applies immediately and is stored server-side for every browser and restart.","settings.typography.fontsLoadError":"Installed fonts could not be loaded.","settings.typography.picker.browserAria":"Font browser","settings.typography.picker.searchLabel":"Search fonts","settings.typography.picker.searchPlaceholder":"Search installed fonts","settings.typography.picker.loading":"Loading installed fonts…","settings.typography.picker.choicesAria":"Font choices","settings.typography.picker.builtInGroup":"Built-in","settings.typography.picker.installedGroup":"Installed on this machine","settings.typography.picker.noMatch":"No fonts match this search.","settings.typography.picker.preview":"Preview","settings.typography.picker.available":"Available","settings.typography.picker.unavailable":"Unavailable","settings.typography.picker.fontSizeAria":"Font size","settings.typography.picker.decreaseSizeAria":"Decrease font size","settings.typography.picker.sizeValueAria":"Font size value","settings.typography.picker.increaseSizeAria":"Increase font size","settings.typography.picker.sizeSliderAria":"Font size slider","settings.typography.picker.monospace":"Monospace","settings.typography.picker.systemFont":"System font","settings.typography.picker.savedSystemFont":"Saved system font","settings.general.aria":"General","settings.general.loading":"Loading settings.","settings.general.foot":"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched.","settings.panelMotion.title":"Panel Motion","settings.panelMotion.help":"Stop panel animations when panels open, move, minimize, and restore. When off, your operating system's Reduce Motion setting is followed.","settings.panelMotion.toggle":"Reduce panel motion","settings.language.title":"Display language","settings.language.help":"Choose the language used across Console surfaces. Auto follows this browser's language.","settings.language.aria":"Display language","settings.language.auto":"Auto","settings.language.en":"English","settings.language.ko":"한국어","settings.language.note":"Stored with Console settings and shared across every browser.","settings.port.title":"Console Port","settings.port.newBadge":"New","settings.port.help":"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.","settings.port.modeAria":"Console port mode","settings.port.dynamic":"Dynamic","settings.port.static":"Static","settings.port.staticPort":"Static port","settings.port.hint":"1024–65535","settings.port.currentlyReachable":"Currently reachable on","settings.port.dynamicSuffix":" · Dynamic","settings.port.fallback":"Port {port} was unavailable — the console fell back to a {mode} port and is running on {host}.","settings.port.nextRestartStatic":"Next restart will try {port}.","settings.port.nextRestartDynamic":"Next restart will use a dynamic port.","settings.port.note":"Applies when the console restarts. Console-wide — shared across every browser.","palette.theme.instrument":"Instrument","palette.theme.maritime":"Maritime","palette.theme.carbon":"Carbon","palette.switchTheater":"Switch theater: {label}","palette.newOperation":"New Operation in {label}","palette.resumeOperation":"Resume operation: {title}","palette.closeOperation":"Close operation: {title}","palette.minimizeAll":"Minimize all Operations","palette.toggleFormation":"Toggle Formation view","palette.toggleStatusAxis":"Toggle status axis","palette.renameOperation":"Rename operation…","palette.assignGroup":"Assign group…","palette.setAccent":"Set accent…","palette.minimizeOperation":"Minimize operation","palette.openPanel":"Open panel: {title}","palette.toggleRail":"Toggle Activity Rail","palette.toggleSidebar":"Toggle sidebar","palette.switchTheme":"Switch theme: {label}","palette.openSettings":"Open Settings","palette.openKeyboardShortcuts":"Open keyboard shortcuts","palette.whatsNew":"What's new","shortcuts.group.console":"Console","shortcuts.console.searchOps":"Search Operations across Theaters","shortcuts.console.toggleSidebar":"Toggle the left sidebar","shortcuts.console.toggleRail":"Toggle the right activity rail","shortcuts.console.closeOverlay":"Close the open overlay or menu","shortcuts.group.operations":"Operations","shortcuts.operations.undoClose":"Undo last close","shortcuts.operations.closeCarrierStream":"Close the carrier job stream","shortcuts.operations.insertNewline":"Insert a newline in the terminal instead of submitting","shortcuts.operations.renameConfirm":"Confirm or cancel a session rename","shortcuts.operations.menuNav":"Move between Theater, Theme, and launch menu items","shortcuts.group.map":"Map","shortcuts.map.focusPrevNext":"Focus the previous / next Operation","shortcuts.map.toggleFormation":"Toggle Formation view","shortcuts.map.sortByStatus":"Sort the sidebar by operation status","shortcuts.map.pan":"Pan the operations map","shortcuts.map.drawTerminal":"Draw a new Operation terminal","shortcuts.map.panWithSpace":"Pan even while a terminal has focus","shortcuts.map.zoom":"Zoom the map in or out","shortcuts.map.contextMenu":"Open the canvas actions menu","shortcuts.map.doubleClick":"Focus an Operation from its title bar; rename from its name","shortcuts.map.clearFocus":"Clear terminal focus on the empty canvas","shortcuts.group.codex":"Codex","shortcuts.codex.togglePalette":"Toggle the command palette","shortcuts.codex.moveResults":"Move through command palette results","shortcuts.codex.openResult":"Open the selected result","shortcuts.codex.tabFocus":"Move focus within the command palette","shortcuts.codex.closePalette":"Close the command palette or diagram lightbox","shortcuts.codex.zoomLightbox":"Zoom the diagram lightbox in / out / reset","shortcuts.codex.fitLightbox":"Fit the diagram lightbox to the viewport","whatsnew.tab.overview":"Overview","whatsnew.tab.allUpdates":"All updates","whatsnew.tab.otherUpdates":"Other updates","whatsnew.tab.fleetCli":"Fleet CLI","whatsnew.tab.fleetConsole":"Fleet Console","whatsnew.tab.fleetDesktop":"Fleet Desktop","whatsnew.tab.fleetPlugin":"Fleet Plugin","whatsnew.tab.fleetCore":"Fleet Core","whatsnew.tab.preProductGrouping":"Pre-product-grouping updates","activity.running":"Running","activity.awaiting":"Awaiting input","activity.dormant":"Dormant","activity.idle":"Idle","codex.cowork.requestFailed":"Cowork request failed.","codex.cowork.draftChangesAria":"Draft changes","codex.cowork.addCommentAria":"Add a comment","codex.cowork.commentPlaceholder":"What should change here?","codex.cowork.commentAria":"Comment","codex.cowork.add":"Add","codex.cowork.comment":"Comment","codex.cowork.annotationsAria":"Annotations","codex.cowork.instructionOptional":"Add an instruction (optional)…","codex.cowork.askAi":"Ask AI to revise this entry…","codex.cowork.instructionAria":"Instruction","codex.cowork.agentSettingsAria":"Agent settings","codex.cowork.stopAria":"Stop","codex.cowork.sendToAi":"Send to AI","codex.cowork.revisionStreamAria":"Cowork revision stream","codex.cowork.editingEntry":"Editing entry","codex.cowork.revisionComplete":"Revision complete","codex.cowork.revisionStopped":"Revision stopped","codex.cowork.expandStream":"Expand Cowork stream","codex.cowork.collapseStream":"Collapse Cowork stream","codex.cowork.writingRevision":"Writing revision","codex.cowork.emptyAnnotations":"Select text in the document to add a comment.","codex.cowork.addCommentPlaceholder":"Add a comment","codex.cowork.statusSent":"Sent","codex.cowork.statusDone":"Done","codex.cowork.statusReady":"Ready","codex.cowork.deleteAnnotation":"Delete annotation","codex.cowork.applyConfirm":"Apply these changes to the entry?","codex.cowork.discardConfirm":"Discard this draft?","codex.cowork.apply":"Apply","codex.cowork.discard":"Discard","codex.cowork.back":"Back","codex.cowork.changedLines_one":"{count} changed line","codex.cowork.changedLines_other":"{count} changed lines","codex.cowork.removedContent":"Removed content","codex.cowork.viewDraft":"View draft","codex.cowork.viewDiff":"View diff","codex.cowork.noCommentYet":"No comment yet","codex.cowork.applyStale":"This entry changed or is busy. Your draft is safe; reopen the entry before applying.","codex.cowork.copied":"Copied","codex.cowork.defaultComment":"Please revise this passage.","codex.cowork.cli":"CLI","codex.cowork.model":"Model","codex.cowork.effort":"Effort","codex.reading.entryLocationAria":"Entry location","codex.reading.relatedEntries":"Related entries","codex.reading.reviewQueuePending":"Review queue — Pending patches","codex.reading.noPendingPatches":"No pending patches.","codex.reading.reviewQueue":"Review queue","codex.reading.opCreate":"Create","codex.reading.opUpdate":"Update","codex.reading.opPatch":"Patch","codex.reading.backQueue":"‹ Queue","codex.reading.replaceExisting":"기존 문서 대체","codex.reading.createNew":"신규 문서 생성","codex.reading.processingAria":"Processing…","codex.reading.applyConfirm":"Apply this patch to the wiki?","codex.reading.yesApprove":"✓ Yes, Approve","codex.reading.rejectReasonRequired":"Rejection reason is required.","codex.reading.rejectPlaceholder":"Rejection reason (required)…","codex.reading.submitRejection":"Submit Rejection","codex.reading.approve":"✓ Approve","codex.reading.reject":"✕ Reject","codex.reading.approved":"✓ Approved","codex.reading.rejected":"✕ Rejected","codex.reading.conflicts":"Conflicts","codex.reading.conflictEyebrow":"Conflict · {status}","codex.reading.conflictOpen":"open","codex.reading.current":"Current","codex.reading.proposed":"Proposed","codex.reading.noConflicts":"No conflicts found.","codex.reading.schema":"Schema","codex.reading.workspaceSchema":"Workspace schema","codex.meta.updated":"Updated {date}","codex.meta.stale":"stale","codex.meta.statusStaleTitle":"{status} · stale","codex.toc.noSections":"No sections","codex.opBadge.create":"CREATE","codex.opBadge.update":"UPDATE","codex.nav.catalogAria":"Codex catalog","codex.nav.entries":"Entries","codex.nav.schema":"Schema","codex.nav.searchPlaceholder":"Search entries","codex.nav.searchAria":"Search Codex entries","codex.nav.reviewQueue":"Review queue","codex.nav.conflicts":"Conflicts","codex.nav.entriesCount":"Entries · {count}","codex.nav.schemaCount":"Schema · {count} templates","codex.nav.workspaceSchema":"Workspace schema","codex.nav.unavailable":"Unavailable","codex.nav.schemaUnavailable":"Schema catalog unavailable.","codex.nav.noMatch":"No entries match.","codex.nav.noEntries":"No entries."},b8={"settings.kicker":"Console","settings.title":"설정","settings.saving":"저장 중…","settings.sectionsAria":"설정 섹션","settings.nav.console":"Console","settings.nav.plugins":"플러그인","settings.core.general.label":"일반","settings.core.general.eyebrow":"테마 · 타이포 · 포트","settings.core.backendApi.label":"Backend API","settings.core.backendApi.eyebrow":"루프백 라우트","settings.pluginFailed":"플러그인 설정을 표시하지 못했습니다.","settings.pluginUnavailable":"플러그인 설정을 사용할 수 없습니다.","settings.plugin.terminal":"Terminal","settings.theme.aria":"테마","settings.theme.title":"테마","settings.theme.help":"Console 색 구성입니다.","settings.theme.foot":"테마는 즉시 적용되며 서버에 저장됩니다.","settings.theme.instrument":"Instrument","settings.theme.maritime":"Maritime","settings.theme.carbon":"Carbon","settings.typography.aria":"타이포그래피","settings.typography.title":"타이포그래피","settings.typography.help":"인터페이스 문구와 읽기 화면에 쓰는 서체입니다. Display·코드·터미널 글꼴은 그대로입니다.","settings.typography.reset":"Fleet 기본값으로 재설정","settings.typography.preview":"Fleet 타이포그래피는 Operation을 읽기 쉽게 유지합니다.","settings.typography.font.manrope":"균형 · Fleet 기본","settings.typography.font.jetbrains-mono":"균일 · 기술 스캔","settings.typography.font.source-code-pro":"열린 형태 · 콤팩트","settings.typography.foot":"타이포그래피는 즉시 적용되며 모든 브라우저와 재시작에 서버 측으로 저장됩니다.","settings.typography.fontsLoadError":"설치된 글꼴을 불러오지 못했습니다.","settings.typography.picker.browserAria":"글꼴 탐색기","settings.typography.picker.searchLabel":"글꼴 검색","settings.typography.picker.searchPlaceholder":"설치된 글꼴 검색","settings.typography.picker.loading":"설치된 글꼴을 불러오는 중…","settings.typography.picker.choicesAria":"글꼴 선택","settings.typography.picker.builtInGroup":"내장","settings.typography.picker.installedGroup":"이 기기에 설치됨","settings.typography.picker.noMatch":"검색과 일치하는 글꼴이 없습니다.","settings.typography.picker.preview":"미리보기","settings.typography.picker.available":"사용 가능","settings.typography.picker.unavailable":"사용 불가","settings.typography.picker.fontSizeAria":"글꼴 크기","settings.typography.picker.decreaseSizeAria":"글꼴 크기 줄이기","settings.typography.picker.sizeValueAria":"글꼴 크기 값","settings.typography.picker.increaseSizeAria":"글꼴 크기 키우기","settings.typography.picker.sizeSliderAria":"글꼴 크기 슬라이더","settings.typography.picker.monospace":"고정폭","settings.typography.picker.systemFont":"시스템 글꼴","settings.typography.picker.savedSystemFont":"저장된 시스템 글꼴","settings.general.aria":"일반","settings.general.loading":"설정을 불러오는 중입니다.","settings.general.foot":"변경은 새로 시작한 세션에 적용됩니다. 실행 중인 세션은 다시 시작할 때까지 현재 구성을 유지합니다.","settings.panelMotion.title":"패널 모션","settings.panelMotion.help":"패널을 열거나 이동·최소화·복원할 때 애니메이션을 끕니다. 꺼져 있으면 운영체제의 동작 줄이기 설정을 따릅니다.","settings.panelMotion.toggle":"패널 모션 줄이기","settings.language.title":"표시 언어","settings.language.help":"Console 전반에 쓰는 언어를 고릅니다. Auto는 이 브라우저 언어를 따릅니다.","settings.language.aria":"표시 언어","settings.language.auto":"Auto","settings.language.en":"English","settings.language.ko":"한국어","settings.language.note":"Console 설정에 저장되며 모든 브라우저에서 공유됩니다.","settings.port.title":"Console 포트","settings.port.newBadge":"신규","settings.port.help":"Dynamic은 Console을 시작할 때마다 OS가 빈 루프백 포트를 고릅니다. Static은 선택한 포트를 고정해 재시작 후에도 URL이 같습니다.","settings.port.modeAria":"Console 포트 모드","settings.port.dynamic":"Dynamic","settings.port.static":"Static","settings.port.staticPort":"고정 포트","settings.port.hint":"1024–65535","settings.port.currentlyReachable":"현재 접속 주소","settings.port.dynamicSuffix":" · Dynamic","settings.port.fallback":"포트 {port}를 쓸 수 없어 Console이 {mode} 포트로 전환했고 {host}에서 실행 중입니다.","settings.port.nextRestartStatic":"다음 재시작 때 {port}를 시도합니다.","settings.port.nextRestartDynamic":"다음 재시작 때는 dynamic 포트를 사용합니다.","settings.port.note":"Console을 다시 시작할 때 적용됩니다. Console 전역이며 모든 브라우저에서 공유됩니다.","palette.theme.instrument":"Instrument","palette.theme.maritime":"Maritime","palette.theme.carbon":"Carbon","palette.switchTheater":"Theater 전환: {label}","palette.newOperation":"{label}에서 새 Operation","palette.resumeOperation":"Operation 재개: {title}","palette.closeOperation":"Operation 닫기: {title}","palette.minimizeAll":"모든 Operation 최소화","palette.toggleFormation":"Formation 보기 전환","palette.toggleStatusAxis":"상태 축 전환","palette.renameOperation":"Operation 이름 변경…","palette.assignGroup":"그룹 지정…","palette.setAccent":"액센트 설정…","palette.minimizeOperation":"Operation 최소화","palette.openPanel":"패널 열기: {title}","palette.toggleRail":"Activity Rail 전환","palette.toggleSidebar":"사이드바 전환","palette.switchTheme":"테마 전환: {label}","palette.openSettings":"설정 열기","palette.openKeyboardShortcuts":"키보드 단축키 열기","palette.whatsNew":"새로운 기능","shortcuts.group.console":"Console","shortcuts.console.searchOps":"Theater 전체에서 Operation 검색","shortcuts.console.toggleSidebar":"왼쪽 사이드바 전환","shortcuts.console.toggleRail":"오른쪽 Activity Rail 전환","shortcuts.console.closeOverlay":"열린 오버레이 또는 메뉴 닫기","shortcuts.group.operations":"Operations","shortcuts.operations.undoClose":"마지막 닫기 취소","shortcuts.operations.closeCarrierStream":"Carrier 작업 스트림 닫기","shortcuts.operations.insertNewline":"제출 대신 터미널에 줄바꿈 삽입","shortcuts.operations.renameConfirm":"세션 이름 변경 확인 또는 취소","shortcuts.operations.menuNav":"Theater·테마·실행 메뉴 항목 이동","shortcuts.group.map":"맵","shortcuts.map.focusPrevNext":"이전/다음 Operation에 포커스","shortcuts.map.toggleFormation":"Formation 보기 전환","shortcuts.map.sortByStatus":"사이드바를 Operation 상태로 정렬","shortcuts.map.pan":"Operations 맵 이동","shortcuts.map.drawTerminal":"새 Operation 터미널 그리기","shortcuts.map.panWithSpace":"터미널에 포커스가 있어도 맵 이동","shortcuts.map.zoom":"맵 확대/축소","shortcuts.map.contextMenu":"캔버스 작업 메뉴 열기","shortcuts.map.doubleClick":"제목 표시줄에서 Operation 포커스, 이름에서 이름 변경","shortcuts.map.clearFocus":"빈 캔버스에서 터미널 포커스 해제","shortcuts.group.codex":"Codex","shortcuts.codex.togglePalette":"명령 팔레트 전환","shortcuts.codex.moveResults":"명령 팔레트 결과 이동","shortcuts.codex.openResult":"선택한 결과 열기","shortcuts.codex.tabFocus":"명령 팔레트 안에서 포커스 이동","shortcuts.codex.closePalette":"명령 팔레트 또는 다이어그램 라이트박스 닫기","shortcuts.codex.zoomLightbox":"다이어그램 라이트박스 확대/축소/재설정","shortcuts.codex.fitLightbox":"다이어그램 라이트박스를 뷰포트에 맞추기","whatsnew.tab.overview":"개요","whatsnew.tab.allUpdates":"전체 업데이트","whatsnew.tab.otherUpdates":"기타 업데이트","whatsnew.tab.fleetCli":"Fleet CLI","whatsnew.tab.fleetConsole":"Fleet Console","whatsnew.tab.fleetDesktop":"Fleet Desktop","whatsnew.tab.fleetPlugin":"Fleet Plugin","whatsnew.tab.fleetCore":"Fleet Core","whatsnew.tab.preProductGrouping":"제품 분류 이전 업데이트","activity.running":"실행 중","activity.awaiting":"입력 대기","activity.dormant":"휴면","activity.idle":"대기","codex.cowork.requestFailed":"Cowork 요청에 실패했습니다.","codex.cowork.draftChangesAria":"초안 변경","codex.cowork.addCommentAria":"댓글 추가","codex.cowork.commentPlaceholder":"여기서 무엇을 바꿀까요?","codex.cowork.commentAria":"댓글","codex.cowork.add":"추가","codex.cowork.comment":"댓글","codex.cowork.annotationsAria":"주석","codex.cowork.instructionOptional":"지시 추가(선택)…","codex.cowork.askAi":"AI에게 이 항목 수정을 요청…","codex.cowork.instructionAria":"지시","codex.cowork.agentSettingsAria":"Agent 설정","codex.cowork.stopAria":"중지","codex.cowork.sendToAi":"AI로 보내기","codex.cowork.revisionStreamAria":"Cowork 수정 스트림","codex.cowork.editingEntry":"항목 편집 중","codex.cowork.revisionComplete":"수정 완료","codex.cowork.revisionStopped":"수정 중단됨","codex.cowork.expandStream":"Cowork 스트림 펼치기","codex.cowork.collapseStream":"Cowork 스트림 접기","codex.cowork.writingRevision":"수정안 작성 중","codex.cowork.emptyAnnotations":"문서에서 텍스트를 선택해 댓글을 추가하세요.","codex.cowork.addCommentPlaceholder":"댓글 추가","codex.cowork.statusSent":"보냄","codex.cowork.statusDone":"완료","codex.cowork.statusReady":"준비됨","codex.cowork.deleteAnnotation":"주석 삭제","codex.cowork.applyConfirm":"이 변경을 항목에 적용할까요?","codex.cowork.discardConfirm":"이 초안을 버릴까요?","codex.cowork.apply":"적용","codex.cowork.discard":"버리기","codex.cowork.back":"뒤로","codex.cowork.changedLines_one":"변경된 줄 {count}개","codex.cowork.changedLines_other":"변경된 줄 {count}개","codex.cowork.removedContent":"삭제된 내용","codex.cowork.viewDraft":"초안 보기","codex.cowork.viewDiff":"diff 보기","codex.cowork.noCommentYet":"아직 댓글 없음","codex.cowork.applyStale":"이 항목이 바뀌었거나 사용 중입니다. 초안은 안전하니 적용 전에 항목을 다시 여세요.","codex.cowork.copied":"복사됨","codex.cowork.defaultComment":"이 구절을 수정해 주세요.","codex.cowork.cli":"CLI","codex.cowork.model":"Model","codex.cowork.effort":"Effort","codex.reading.entryLocationAria":"항목 위치","codex.reading.relatedEntries":"관련 항목","codex.reading.reviewQueuePending":"검토 대기열 — 대기 중인 패치","codex.reading.noPendingPatches":"대기 중인 패치가 없습니다.","codex.reading.reviewQueue":"검토 대기열","codex.reading.opCreate":"Create","codex.reading.opUpdate":"Update","codex.reading.opPatch":"Patch","codex.reading.backQueue":"‹ 대기열","codex.reading.replaceExisting":"기존 문서 대체","codex.reading.createNew":"신규 문서 생성","codex.reading.processingAria":"처리 중…","codex.reading.applyConfirm":"이 패치를 wiki에 적용할까요?","codex.reading.yesApprove":"✓ 예, 승인","codex.reading.rejectReasonRequired":"반려 사유가 필요합니다.","codex.reading.rejectPlaceholder":"반려 사유(필수)…","codex.reading.submitRejection":"반려 제출","codex.reading.approve":"✓ 승인","codex.reading.reject":"✕ 반려","codex.reading.approved":"✓ 승인됨","codex.reading.rejected":"✕ 반려됨","codex.reading.conflicts":"충돌","codex.reading.conflictEyebrow":"충돌 · {status}","codex.reading.conflictOpen":"열림","codex.reading.current":"현재","codex.reading.proposed":"제안","codex.reading.noConflicts":"충돌이 없습니다.","codex.reading.schema":"스키마","codex.reading.workspaceSchema":"워크스페이스 Schema","codex.meta.updated":"업데이트 {date}","codex.meta.stale":"오래됨","codex.meta.statusStaleTitle":"{status} · 오래됨","codex.toc.noSections":"섹션 없음","codex.opBadge.create":"CREATE","codex.opBadge.update":"UPDATE","codex.nav.catalogAria":"Codex 카탈로그","codex.nav.entries":"항목","codex.nav.schema":"스키마","codex.nav.searchPlaceholder":"항목 검색","codex.nav.searchAria":"Codex 항목 검색","codex.nav.reviewQueue":"검토 대기열","codex.nav.conflicts":"충돌","codex.nav.entriesCount":"항목 · {count}","codex.nav.schemaCount":"Schema · 템플릿 {count}개","codex.nav.workspaceSchema":"워크스페이스 Schema","codex.nav.unavailable":"사용 불가","codex.nav.schemaUnavailable":"Schema 카탈로그를 사용할 수 없습니다.","codex.nav.noMatch":"일치하는 항목이 없습니다.","codex.nav.noEntries":"항목이 없습니다."},oE={en:{...y8,...m8,...f8,...v8},ko:{..._8,...g8,...p8,...b8}};function cl(e){return{copyLabel:e("common.copy"),copyAriaLabel:t=>e("common.copyCodeAria",{language:t})}}function nb(e){return{renderFailed:t=>e("common.diagram.renderFailed",{message:t}),openExpandedAria:e("common.diagram.openExpandedAria"),lightboxTitle:e("common.diagram.lightboxTitle"),close:e("common.close"),closeExpandedAria:e("common.diagram.closeExpandedAria"),zoomControlsAria:e("common.diagram.zoomControlsAria"),zoomOutAria:e("common.diagram.zoomOutAria"),zoomInAria:e("common.diagram.zoomInAria"),fit:e("common.diagram.fit"),fitAria:e("common.diagram.fitAria"),reset:e("common.diagram.reset"),resetAria:e("common.diagram.resetAria")}}const DR={en:"en-US",ko:"ko-KR"},w8=[{amount:60,unit:"second"},{amount:60,unit:"minute"},{amount:24,unit:"hour"},{amount:Number.POSITIVE_INFINITY,unit:"day"}];function jR(e,t,n=Date.now()){const i=new Intl.RelativeTimeFormat(DR[t],{numeric:"auto"});let s=(e-n)/1e3;for(const o of w8){if(Math.abs(s)<o.amount)return i.format(Math.round(s),o.unit);s/=o.amount}return i.format(Math.round(s),"day")}function S8(e,t){const n=x8(e);return C8(n)?new Intl.DateTimeFormat(DR[t],{dateStyle:"medium"}).format(n):k8(e)}function x8(e){return e instanceof Date?e:new Date(e)}function C8(e){return!Number.isNaN(e.getTime())}function k8(e){return typeof e=="string"?e:String(e)}function lE(e,t){const n=[],i=/\{([^{}]+)\}/g;let s=0,o,l=0;for(;(o=i.exec(e))!==null;){o.index>s&&n.push(e.slice(s,o.index));const d=o[1],f=t[d];f!==void 0?n.push(u.jsx(_.Fragment,{children:f},`rich:${d}:${l}`)):n.push(o[0]),l+=1,s=o.index+o[0].length}return s<e.length&&n.push(e.slice(s)),n}const E8={en:Ns(oE,"en"),ko:Ns(oE,"ko")};function Im(){const e=xl();return hr(e.state?.language??"auto")}function rt(){const e=Im();return _.useMemo(()=>fr(e),[e])}function fr(e){return E8[e]}function _o(e,t){const n=t[e.id];return n||(e.payload?.resumeAvailable===!0?"dormant":"idle")}function Dm(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function A8(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function T8(e){const t=fr(A8()),n=Dm(e);return t(n==="running"?"activity.running":n==="awaiting"?"activity.awaiting":n==="dormant"?"activity.dormant":"activity.idle")}const R8=150,M8=500,BR=8,L8="__unassigned__";async function N8(e,t,n,i){const s=hr(Yi().state?.language??"auto");return(await Promise.all(e.map(async l=>{if(!l.search)return null;const d=await O8(l,t,n,i);return!d||d.length===0?null:{panelId:l.id,panelTitle:Sl(l.title,s),results:d.slice(0,BR)}}))).filter(l=>l!==null)}async function O8(e,t,n,i){if(!e.search||i.aborted)return null;const s=new AbortController;let o=null,l=null;try{const d=new Promise(p=>{o=()=>{s.abort(),p(null)},i.addEventListener("abort",o,{once:!0}),l=setTimeout(o,M8)}),f=Promise.resolve().then(()=>e.search({query:t,theaterId:n,limit:BR,signal:s.signal})).then(p=>p,()=>null);return await Promise.race([f,d])}finally{l!==null&&clearTimeout(l),o&&i.removeEventListener("abort",o)}}function I8(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(B8(i,t.get(i.theaterId),e.operationStatus));return n}function D8(e,t){const n=Ow(t);return n.length===0?e:e.filter(i=>{const s=P8(i);return n.every(o=>s.includes(o))})}function j8(e){const t=[],n=new Map;for(const i of e){const s=i.theaterId??L8,o=n.get(s);if(o!==void 0){const l=t[o];l&&(t[o]={...l,entries:[...l.entries,i]});continue}n.set(s,t.length),t.push({theaterId:i.theaterId,theaterLabel:i.theaterLabel,entries:[i]})}return t}function Ow(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function B8(e,t,n){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation",activity:_o(e,n)}}function P8(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const ib="fleet-console.activeTheaterId",PR="fleet-console.commissioningSeen",zR="fleet-console.whatsNewSeenVersion",$R="fleet-console.notificationPreferences",FR=1,z8="instrument",kf={globalMute:!1,dnd:!1,mutedTheaterIds:{}},rb=new Set;let cE=0,sb=null,tt={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:z8,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:xP(),codexReader:null,codexReaderExpanded:!1};function Co(){return tt}function Iw(e){return rb.add(e),()=>{rb.delete(e)}}function ht(e){tt={...tt,...e},vP()}function $8(e){tt.operationsViewActive!==e&&ht({operationsViewActive:e})}function $c(e){q8(e),ht({activeTheme:e})}function ab(e){K8(e)}function F8(e){ht({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,...YR({...tt,version:e.version})})}function H8(){ht({releaseNotesLoading:!0,releaseNotesError:null})}function U8(e){const t={...tt,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:tt.selectedReleaseNoteKey&&ZR(e.notes,tt.selectedReleaseNoteKey)?tt.selectedReleaseNoteKey:XR(e.notes)};ht({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...YR(t)})}function W8(e){ht({releaseNotesLoading:!1,releaseNotesError:e})}function q8(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function G8(){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 K8(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",iR(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function zp(e){const t=VR(e,tt.activeTheaterId);ht({theaters:e,activeTheaterId:t})}function V8(e){zp(e.theaters)}function cr(e){ht({operations:e,operationsHydrated:!0})}function Y8(e){const t=new Set(e.map(i=>i.id)),n=tt.operations.filter(i=>!t.has(i.id));ht({operations:[...e,...n],operationsHydrated:!0})}function X8(e){const t=tt.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...tt.operations];n[t]=e,ht({operations:n})}function oo(e){ht({groups:e})}function Dw(e){Bm(e),ht({activeTheaterId:e})}function Ki(e){tt.activeOperationId!==e&&ht({activeOperationId:e})}function Z8(e,t){tt.operationStatus[e]!==t&&ht({operationStatus:{...tt.operationStatus,[e]:t}})}function J8(e){if(!(e in tt.operationStatus))return;const t={...tt.operationStatus};delete t[e],ht({operationStatus:t})}function Q8(e){if(!e.operationId)return;const t=tt.operations.find(l=>l.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=tt.theaters.find(l=>l.id===n)?.label??n??"Unknown",s=t.title,o=wP(e.kind);cE+=1,ht({operationNotifications:{...tt.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:s,lastRaisedSeq:cE}}})}function HR(){ht({addingTheater:!0,theaterError:null})}function UR(e){const t=[e,...tt.theaters.filter(n=>n.id!==e.id)];Bm(e.id),ht({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function eP(){ht({addingTheater:!1,theaterError:null})}function ob(e){ht({addingTheater:!1,theaterError:e})}function yl(e){const t=tt.operations.find(n=>n.id===e);t&&(Bm(t.theaterId),ht({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:KR(tt.operationNotifications,e)}))}function tP(){tt.pendingOperationFocus!==null&&ht({pendingOperationFocus:null})}function nP(){ht({pendingSideBarAddTheater:!0})}function iP(){tt.pendingSideBarAddTheater&&ht({pendingSideBarAddTheater:!1})}function rP(e){ht({pendingSideBarTheaterLaunch:e})}function uE(){tt.pendingSideBarTheaterLaunch!==null&&ht({pendingSideBarTheaterLaunch:null})}function Go(e){ht({keyboardFocusRequest:{operationId:e,requestId:(tt.keyboardFocusRequest?.requestId??0)+1}})}function WR(){ht({launchMenuRequest:{requestId:(tt.launchMenuRequest?.requestId??0)+1}})}function sP(){tt.launchMenuRequest!==null&&ht({launchMenuRequest:null})}function aP(){tt.keyboardShortcutsOpen||ht({keyboardShortcutsOpen:!0})}function oP(){tt.keyboardShortcutsOpen&&ht({keyboardShortcutsOpen:!1})}function lP(e,t,n){if(e.length===0)return null;const i=t?e.indexOf(t):-1,s=i===-1?n>0?0:e.length-1:(i+n+e.length)%e.length;return e[s]??null}function jm(e,t){if(t.length===0)return[...e].sort(lb);const n=new Map(t.map((i,s)=>[i,s]));return[...e].sort((i,s)=>{const o=n.get(i.id),l=n.get(s.id);return o!==void 0&&l!==void 0?o-l:o!==void 0?-1:l!==void 0?1:lb(i,s)})}function jw(e,t,n,i=[]){const s=jm(e,n),o=new Set(i),l=[...t].sort((f,p)=>f.order-p.order||f.createdAt-p.createdAt),d=new Map;for(const f of l)d.set(f.id,[]);d.set(null,[]);for(const f of s){const p=f.groupId??null;p!==null&&d.has(p)?d.get(p).push(f):d.get(null).push(f)}return[...l.filter(f=>!o.has(f.id)).flatMap(f=>d.get(f.id)??[]),...d.get(null)??[]]}function cP(e,t,n,i,s){const o=new Set(s);return jw(e,t,n,i).filter(l=>!o.has(l.id)).map(l=>l.id)}const uP={awaiting:0,running:1,idle:2,dormant:3};function dP(e,t,n,i,s,o){const l=new Set(i),d=p=>_o(p,n),f=p=>uP[d(p)];return[...jm(e,t)].sort((p,m)=>{const y=f(p)-f(m);if(y!==0)return y;const b=o?.(p.id),w=o?.(m.id);return b===void 0&&w===void 0?0:b===void 0?1:w===void 0?-1:w-b}).filter(p=>!l.has(p.id)&&!s(d(p))).map(p=>p.id)}function lb(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Gu(){ht({operationSearchOpen:!1})}function qR(){ht({operationSearchOpen:!tt.operationSearchOpen})}function GR(){tt.releaseNotes.length===0||tt.whatsNewOpen||ht({whatsNewOpen:!0,selectedReleaseNoteKey:tt.selectedReleaseNoteKey??XR(tt.releaseNotes)})}function Ef(){tt.whatsNewOpen&&(tt.automaticWhatsNewVersion&&AP(tt.automaticWhatsNewVersion),ht({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function dE(e){ZR(tt.releaseNotes,e)&&ht({selectedReleaseNoteKey:e})}function Ku(){kP(!0),tt.onboardingOpen&&ht({onboardingOpen:!1})}function Ts(e){ht({codexReader:e,codexReaderExpanded:!1})}function sp(){tt.codexReader!==null&&ht({codexReaderExpanded:!0})}function hP(){ht({codexReaderExpanded:!1})}function g_(){ht({codexReader:null,codexReaderExpanded:!1})}function hE(){if(tt.bootstrapped)return;const e=tt.theaters.length===0&&!CP();ht({bootstrapped:!0,onboardingOpen:e?!0:tt.onboardingOpen})}function fP(e){const t=tt.theaters.filter(l=>l.id!==e),n=VR(t,tt.activeTheaterId===e?null:tt.activeTheaterId),i=bP(tt.operationNotifications,e),s=new Set(tt.operations.filter(l=>l.theaterId===e).map(l=>l.id)),o=tt.activeOperationId&&s.has(tt.activeOperationId)?null:tt.activeOperationId;Bm(n),ht({theaters:t,activeTheaterId:n,activeOperationId:o,operationNotifications:i})}function pP(e){const t=KR(tt.operationNotifications,e);t!==tt.operationNotifications&&ht({operationNotifications:t})}function mP(e){const t={...tt.notificationPreferences,globalMute:e};Pw(t),ht({notificationPreferences:t})}function gP(e){const t={...tt.notificationPreferences,dnd:e};Pw(t),ht({notificationPreferences:t})}function yP(e){const t={...tt.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...tt.notificationPreferences,mutedTheaterIds:t};Pw(n),ht({notificationPreferences:n})}function _P(e){return I8(e)}function vP(){for(const e of rb)e()}function KR(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function bP(e,t){let n=!1;const i={};for(const[s,o]of Object.entries(e)){if(o.theaterId===t){n=!0;continue}i[s]=o}return n?i:e}function VR(e,t){const n=new Set(e.map(s=>s.id)),i=SP();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function wP(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function YR(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||EP()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:Bw(n.version,t)}}function XR(e){return e[0]?Bw(e[0].version,0):null}function ZR(e,t){return e.some((n,i)=>Bw(n.version,i)===t)}function Bw(e,t){return`${e}:${t}`}function SP(){if(typeof window>"u")return null;try{return window.localStorage.getItem(ib)}catch{return null}}function Bm(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(ib,e):window.localStorage.removeItem(ib)}catch{}}function xP(){if(typeof window>"u")return kf;try{const e=window.localStorage.getItem($R);if(!e)return kf;const t=JSON.parse(e);return TP(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:kf}catch{return kf}}function CP(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(PR)==="1"}catch{return!1}}function kP(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(PR,"1")}catch{}}function EP(){if(sb!==null)return sb;if(typeof window>"u")return null;try{return window.localStorage.getItem(zR)}catch{return null}}function AP(e){if(sb=e,!(typeof window>"u"))try{window.localStorage.setItem(zR,e)}catch{}}function Pw(e){if(!(typeof window>"u"))try{window.localStorage.setItem($R,JSON.stringify({version:FR,preferences:e}))}catch{}}function TP(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==FR||!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 fE(e,t){return e!==null&&e===t?e:null}function RP(e,t,n,i){return jw(e.filter(s=>s.theaterId===n),t.filter(s=>s.theaterId===n),i)}function MP(e,t,n){if(t===null||n===null)return null;const i=e.find(s=>s.id===t)??null;return i!==null&&i.theaterId===n?i:null}function LP(e,t){return!(t instanceof Node&&e.contains(t))}function NP(e,t,n,i,s=12){const o=i-s-n-t,l=s-t;return Math.max(l,Math.min(e,o))}const OP=288,pE=520,IP=120,Ko=12;function JR({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:s,renderKindIcon:o,onLaunchKind:l,onClose:d}){const f=rt(),p=_.useRef(null),m=_.useRef(null),[y,b]=_.useState(null);return _.useLayoutEffect(()=>{const w=m.current;if(!w)return;const S=()=>{const k=w.getBoundingClientRect();b(L=>L&&Math.abs(L.width-k.width)<.5&&Math.abs(L.height-k.height)<.5?L:{width:k.width,height:k.height})};if(S(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(S);return x.observe(w),()=>x.disconnect()},[]),_.useEffect(()=>{const w=x=>{p.current?.contains(x.target)||d()},S=x=>{x.key==="Escape"&&d()};return document.addEventListener("mousedown",w),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",S)}},[d]),_.useEffect(()=>{m.current?.focus()},[]),u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:jP(e,t,n,y),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":f("canvas.menu.aria"),tabIndex:-1,ref:m,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(DP,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:f("canvas.menu.title")})})]}),u.jsx("p",{className:"canvas-context-menu-section",children:f("canvas.menu.launch")}),i.length>0?i.map((w,S)=>u.jsxs("div",{children:[S>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:w.title}),w.kinds.map(x=>{const k=x.disabled===!0||!s;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:k,title:x.disabledReason,onClick:()=>l(w.id,x),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(w.id,x)??u.jsx(BP,{})}),u.jsx("span",{className:"theater-menu-label",children:x.title}),x.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:x.disabledReason}):null]},`${w.id}:${x.id}`)})]},w.id)):u.jsx("p",{className:"theater-menu-empty",children:f("canvas.menu.empty")})]})})}function DP(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function jP(e,t,n,i){const o={"--canvas-menu-max-height":`${t?Math.max(IP,Math.min(pE,t.height-Ko*2)):pE}px`},l=i?.width??OP,d=i?.height??0,f=t?Math.max(Ko,Math.min(e.x,t.width-l-Ko)):e.x;if(n==="above")return{...o,left:f,bottom:Math.max(Ko,e.y)};if(!t)return{...o,left:f,top:e.y};const p=e.y+d+Ko<=t.height?e.y:e.y-d,m=Math.max(Ko,Math.min(p,t.height-d-Ko));return{...o,left:f,top:m}}function BP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function QR(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const Af="directory-browser-sectors";function eM({open:e,onCancel:t,onConfirm:n}){const i=rt(),[s,o]=_.useState(null),[l,d]=_.useState(null),[f,p]=_.useState(null),[m,y]=_.useState(""),[b,w]=_.useState(""),[S,x]=_.useState(0),k=_.useRef(null),L=_.useRef(null),F=async(A,O)=>{d(A),p(null),y(""),x(0);try{const C=await Xj(A,O);o(C)}catch(C){if(C instanceof DOMException&&C.name==="AbortError")return;p(C instanceof mn?C.message:String(C))}finally{d(null)}};_.useEffect(()=>{if(!e)return;const A=new AbortController;return F(null,A.signal),()=>A.abort()},[e]),_.useEffect(()=>{e&&k.current?.focus()},[e,s?.path]);const q=s?.entries??[],T=_.useMemo(()=>{const A=m.trim().toLowerCase();return A===""?q:q.filter(O=>O.name.toLowerCase().includes(A))},[q,m]),$=_.useMemo(()=>s?PP(s):[],[s]),I=s?mE(s.path):null,N=s?.roots??[],V=N.length>1,K=T.length===0?-1:Math.min(S,T.length-1);if(_.useEffect(()=>{if(K<0)return;L.current?.querySelector(`[data-index="${K}"]`)?.scrollIntoView({block:"nearest"})},[K,s?.path]),!e)return null;const Q=A=>{A.accessible&&l===null&&F(A.path)},Y=()=>{s?.parentPath!=null&&l===null&&F(s.parentPath)},B=()=>{const A=b.trim();A!==""&&l===null&&F(A)},M=s?.path??null,D=K>=0?`${Af}-${K}`:void 0,j=A=>{switch(A.key){case"Escape":m!==""?y(""):t();return;case"ArrowDown":A.preventDefault(),x(O=>Math.min(O+1,Math.max(T.length-1,0)));return;case"ArrowUp":A.preventDefault(),x(O=>Math.max(O-1,0));return;case"Enter":{A.preventDefault();const O=T[K];O&&Q(O);return}case"Backspace":m===""&&(A.preventDefault(),Y());return;default:return}};return xa.createPortal(u.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[u.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":i("common.close"),onClick:t}),u.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":i("chrome.directoryBrowser.dialogAria"),onKeyDown:j,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(FP,{})}),u.jsxs("div",{className:"directory-browser-heading",children:[u.jsx("span",{className:"directory-browser-kicker",children:i("chrome.directoryBrowser.kicker")}),u.jsx("h2",{children:i("chrome.directoryBrowser.title")})]}),u.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":i("common.close"),children:"×"})]}),V?u.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":i("chrome.directoryBrowser.drives"),children:[u.jsx("span",{className:"directory-browser-kicker",children:i("chrome.directoryBrowser.locations")}),u.jsx("div",{className:"directory-browser-root-chips",children:N.map(A=>{const O=I!=null&&mE(A)===I;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${O?"is-active":""}`,"aria-current":O?"location":void 0,disabled:l!==null,title:A,onClick:()=>{l===null&&F(A)},onKeyDown:C=>C.stopPropagation(),children:$P(A)},A)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":i("chrome.directoryBrowser.path"),children:$.map((A,O)=>{const C=O===$.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[O>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${C?"is-current":""}`,"aria-current":C?"location":void 0,disabled:C||l!==null,title:A.path,onClick:()=>{F(A.path)},children:A.label})]},A.path)})}),u.jsxs("div",{className:"directory-browser-toolbar",children:[u.jsxs("div",{className:"directory-browser-filter",children:[u.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:u.jsx(UP,{})}),u.jsx("input",{ref:k,type:"text",className:"directory-browser-filter-input",placeholder:i("chrome.directoryBrowser.filterPlaceholder"),"aria-label":i("chrome.directoryBrowser.filterAria"),"aria-controls":Af,value:m,spellCheck:!1,autoComplete:"off",onChange:A=>{y(A.target.value),x(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||l!==null,title:i("chrome.directoryBrowser.upTitle"),onClick:Y,children:[u.jsx(WP,{}),u.jsx("span",{children:i("chrome.directoryBrowser.up")})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:i("chrome.directoryBrowser.jumpPlaceholder"),"aria-label":i("chrome.directoryBrowser.jumpAria"),value:b,spellCheck:!1,autoComplete:"off",onChange:A=>w(A.target.value),onKeyDown:A=>{A.stopPropagation(),A.key==="Enter"&&(A.preventDefault(),B())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:b.trim()===""||l!==null,onClick:B,onKeyDown:A=>A.stopPropagation(),children:i("chrome.directoryBrowser.go")})]}),f?u.jsx("p",{className:"directory-browser-error",role:"alert",children:f}):null,u.jsx("div",{className:"directory-browser-list",id:Af,role:"listbox","aria-label":i("chrome.directoryBrowser.folders"),"aria-busy":l!==null,"aria-activedescendant":D,ref:L,children:l!==null?u.jsxs("p",{className:"directory-browser-state is-live",children:[u.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),i("chrome.directoryBrowser.loadingFolders")]}):T.length===0?u.jsx("p",{className:"directory-browser-state",children:i(m!==""?"chrome.directoryBrowser.noMatch":"chrome.directoryBrowser.noFolders")}):T.map((A,O)=>u.jsxs("div",{id:`${Af}-${O}`,"data-index":O,role:"option","aria-selected":O===K,"aria-disabled":!A.accessible,className:`directory-browser-sector ${O===K?"is-active":""} ${A.accessible?"":"is-locked"}`,title:A.path,onClick:()=>{x(O),Q(A)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(HP,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:A.name}),A.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(qP,{})," ",i("chrome.directoryBrowser.locked")]})]},A.path))}),s?.truncated?u.jsx("p",{className:"directory-browser-note",children:i("chrome.directoryBrowser.truncated")}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:i("chrome.directoryBrowser.theaterRoot")}),u.jsx("span",{className:"directory-browser-target-path",title:M??"",children:M??i("common.loading")})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:i("common.cancel")}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:M===null||l!==null,onClick:()=>M&&n(M),children:i("chrome.directoryBrowser.addTheater")})]})]})]})]}),document.body)}function PP(e){if(zP(e)==="/"){const l=[{label:"/",path:"/"}];let d="";for(const f of e.path.split("/").filter(Boolean))d+=`/${f}`,l.push({label:f,path:d});return l}const n=/^([A-Za-z]:)\\?/.exec(e.path),i=n?`${n[1]}\\`:e.roots[0]??"C:\\",s=[{label:i,path:i}];let o=i.replace(/\\$/,"");for(const l of e.path.slice(i.length).split("\\").filter(Boolean))o+=`\\${l}`,s.push({label:l,path:o});return s}function zP(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function mE(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function $P(e){return e.replace(/[\\/]+$/,"")||e}function FP(){return u.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),u.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function HP(){return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function UP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function WP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function qP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function ps(){return _.useSyncExternalStore(Iw,Co,Co)}const zw=[{key:"crimson",labelKey:"canvas.accent.crimson",color:"var(--id-crimson)"},{key:"amber",labelKey:"canvas.accent.amber",color:"var(--id-amber)"},{key:"moss",labelKey:"canvas.accent.moss",color:"var(--id-moss)"},{key:"teal",labelKey:"canvas.accent.teal",color:"var(--id-teal)"},{key:"cerulean",labelKey:"canvas.accent.cerulean",color:"var(--id-cerulean)"},{key:"indigo",labelKey:"canvas.accent.indigo",color:"var(--id-indigo)"},{key:"plum",labelKey:"canvas.accent.plum",color:"var(--id-plum)"},{key:"rose",labelKey:"canvas.accent.rose",color:"var(--id-rose)"}];function GP(e){return zw.map(t=>({key:t.key,label:e(t.labelKey),color:t.color}))}const KP={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 tM(e){return typeof e!="string"||e.length===0?null:zw.some(t=>t.key===e)?e:KP[e]??null}function Zr(e){const t=tM(e);return t?zw.find(n=>n.key===t)?.color??null:null}function Od(e){return typeof e.accent=="string"?e.accent:null}const gE=8,VP=268;function $w({accentKey:e,includeNone:t,onSelect:n}){const i=rt(),s=GP(i),o=tM(e);return u.jsxs(u.Fragment,{children:[t?u.jsxs("button",{type:"button",className:"accent-tone-row accent-tone-row--clear",role:"menuitem","data-accent-option":"none","aria-label":i("canvas.accent.noneAria"),"aria-pressed":o===null,onClick:()=>n(null),children:[u.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:i("canvas.accent.none")})]}):null,s.map(l=>u.jsxs("button",{type:"button",className:"accent-tone-row",role:"menuitem","data-accent-option":l.key,"aria-label":l.label,"aria-pressed":o===l.key,onClick:()=>n(l.key),children:[u.jsx("span",{className:"accent-tone-flag",style:{background:l.color},"aria-hidden":"true"}),u.jsx("span",{className:"accent-tone-name",children:l.label})]},l.key))]})}function YP({anchor:e,accentKey:t,onSelect:n,onClose:i}){const s=rt(),[o,l]=_.useState(void 0);_.useLayoutEffect(()=>{const f=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+gE,m=p+VP>window.innerHeight;l(m?{position:"fixed",left:f,top:"auto",bottom:Math.round(window.innerHeight-e.top+gE)}:{position:"fixed",left:f,top:Math.round(p)})},[e]),_.useEffect(()=>{const f=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",f),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",f),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]);const d=f=>{n(f),i()};return xa.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:o?u.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":s("canvas.accent.menuAria"),style:o,onPointerDown:f=>f.stopPropagation(),children:u.jsx($w,{accentKey:t,includeNone:!0,onSelect:d})}):null}),document.body)}const yE=8,XP=320;function _E(e){const t=rt(),{anchor:n,onClose:i}=e,[s,o]=_.useState(void 0);return _.useLayoutEffect(()=>{const l=Math.max(8,Math.min(n.left,window.innerWidth-208)),d=n.bottom+yE,f=d+XP>window.innerHeight;o(f?{position:"fixed",left:l,top:"auto",bottom:Math.round(window.innerHeight-n.top+yE)}:{position:"fixed",left:l,top:Math.round(d)})},[n]),_.useEffect(()=>{const l=d=>{d.key==="Escape"&&(d.preventDefault(),i())};return window.addEventListener("keydown",l),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",l),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]),xa.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?t("canvas.groupMenu.operationOptions"):t("canvas.groupMenu.groupOptions",{name:e.group.name}),style:s,onPointerDown:l=>l.stopPropagation(),children:e.kind==="chip"?u.jsx(ZP,{...e}):u.jsx(JP,{...e})}):null}),document.body)}function ZP({operation:e,groups:t,accentKey:n,actions:i,onClose:s}){const o=rt(),[l,d]=_.useState(!1),[f,p]=_.useState(()=>o("canvas.groupMenu.defaultName",{n:t.length+1})),m=_.useRef(!1),y=_.useRef(null);_.useEffect(()=>{l&&y.current?.select()},[l]);const b=()=>{const w=f.trim();w&&(i.onCreateGroup(w),s())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:o("canvas.groupMenu.sectionGroup")}),t.map(w=>{const S=Zr(w.color),x=e.groupId===w.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${x?" is-selected":""}`,role:"menuitemradio","aria-checked":x,onClick:()=>{i.onSetGroupId(x?null:w.id),s()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:w.name}),x?u.jsx(QP,{}):null]},w.id)}),l?u.jsx("input",{ref:y,className:"group-context-menu-new-input",type:"text",value:f,onChange:w=>p(w.target.value),onCompositionStart:()=>{m.current=!0},onCompositionEnd:()=>{m.current=!1},onKeyDown:w=>{w.key==="Enter"&&!m.current&&(w.preventDefault(),b()),w.key==="Escape"&&(w.preventDefault(),d(!1))},onBlur:()=>d(!1),"aria-label":o("canvas.groupMenu.newGroupNameAria"),placeholder:o("canvas.groupMenu.groupNamePlaceholder")}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>d(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:o("canvas.groupMenu.newGroup")})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:o("canvas.groupMenu.sectionAccent")}),u.jsx($w,{accentKey:n,includeNone:!0,onSelect:w=>{i.onSetAccent(w),s()}})]})}function JP({group:e,actions:t,onClose:n}){const i=rt(),[s,o]=_.useState(e.name),[l,d]=_.useState(!1),f=_.useRef(!1),p=()=>{const m=s.trim();if(!m||m===e.name){n();return}t.onRename(m),n()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:i("canvas.groupMenu.sectionColor")}),u.jsx($w,{accentKey:e.color,includeNone:!1,onSelect:m=>{m&&t.onSetColor(m),n()}}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:i("canvas.groupMenu.sectionRename")}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:s,onChange:m=>o(m.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:m=>{m.key==="Enter"&&!f.current&&(m.preventDefault(),p()),m.key==="Escape"&&(m.preventDefault(),n())},onBlur:p,"aria-label":i("canvas.groupMenu.groupNameAria")}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${l?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!l){d(!0);return}t.onUngroupAll(),n()},"aria-label":i(l?"canvas.groupMenu.confirmUngroupAria":"canvas.groupMenu.ungroupAria"),children:i(l?"canvas.groupMenu.confirmUngroupAll":"canvas.groupMenu.ungroupAll")})]})}function QP(){return u.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:u.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function e7(e){return[{title:e("shortcuts.group.console"),entries:[{combos:[["Mod","K"]],description:e("shortcuts.console.searchOps")},{combos:[["Mod","B"]],description:e("shortcuts.console.toggleSidebar")},{combos:[["Mod","Alt","B"]],description:e("shortcuts.console.toggleRail")},{combos:[["Esc"]],description:e("shortcuts.console.closeOverlay")}]},{title:e("shortcuts.group.operations"),entries:[{combos:[["Mod","Z"]],description:e("shortcuts.operations.undoClose")},{combos:[["Esc"]],description:e("shortcuts.operations.closeCarrierStream")},{combos:[["Shift","Enter"]],description:e("shortcuts.operations.insertNewline")},{combos:[["Enter"],["Esc"]],description:e("shortcuts.operations.renameConfirm")},{combos:[["↑"],["↓"]],description:e("shortcuts.operations.menuNav")}]},{title:e("shortcuts.group.map"),entries:[{combos:[["Alt","←"],["Alt","→"]],description:e("shortcuts.map.focusPrevNext")},{combos:[["Alt","F"]],description:e("shortcuts.map.toggleFormation")},{combos:[["Alt","S"]],description:e("shortcuts.map.sortByStatus")},{combos:[["Drag"]],description:e("shortcuts.map.pan")},{combos:[["Shift","Drag"]],description:e("shortcuts.map.drawTerminal")},{combos:[["Space","Drag"]],description:e("shortcuts.map.panWithSpace")},{combos:[["Scroll"]],description:e("shortcuts.map.zoom")},{combos:[["Right-click"]],description:e("shortcuts.map.contextMenu")},{combos:[["Double-click"]],description:e("shortcuts.map.doubleClick")},{combos:[["Click"]],description:e("shortcuts.map.clearFocus")}]},{title:e("shortcuts.group.codex"),entries:[{combos:[["Mod","K"]],description:e("shortcuts.codex.togglePalette")},{combos:[["↑"],["↓"]],description:e("shortcuts.codex.moveResults")},{combos:[["Enter"]],description:e("shortcuts.codex.openResult")},{combos:[["Tab"]],description:e("shortcuts.codex.tabFocus")},{combos:[["Esc"]],description:e("shortcuts.codex.closePalette")},{combos:[["+"],["−"],["0"]],description:e("shortcuts.codex.zoomLightbox")},{combos:[["F"]],description:e("shortcuts.codex.fitLightbox")}]}]}const vd="data-keyboard-shortcuts-open",t7='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function nM(){return document.body.getAttribute(vd)==="true"}function n7(){return!nM()}function iM({onClose:e}){const t=rt(),n=_.useMemo(()=>e7(t),[t]),i=_.useRef(null);_.useEffect(()=>{const o=i.current,l=document.querySelector(".console-shell"),d=document.body.getAttribute(vd);return document.body.setAttribute(vd,"true"),l&&(l.inert=!0),o?.focus(),()=>{d===null?document.body.removeAttribute(vd):document.body.setAttribute(vd,d),l&&(l.inert=!1)}},[e]);const s=o=>{if(o.key==="Escape"){o.preventDefault(),e();return}if(o.key!=="Tab")return;const l=[...i.current?.querySelectorAll(t7)??[]];if(l.length===0){o.preventDefault(),i.current?.focus();return}const d=l[0],f=l[l.length-1],p=document.activeElement;(p===i.current||!i.current?.contains(p)||(o.shiftKey?p===d:p===f))&&(o.preventDefault(),(o.shiftKey?f:d)?.focus())};return xa.createPortal(u.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:u.jsxs("div",{ref:i,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":t("chrome.shortcuts.title"),tabIndex:-1,onKeyDown:s,onMouseDown:o=>o.stopPropagation(),children:[u.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[u.jsx("strong",{children:t("chrome.shortcuts.title")}),u.jsx("button",{type:"button",onClick:e,"aria-label":t("chrome.shortcuts.closeAria"),children:"✕"})]}),n.map(o=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:o.title}),u.jsx("dl",{children:o.entries.map(l=>u.jsxs("div",{children:[u.jsx("dt",{children:l.combos.map((d,f)=>u.jsxs("span",{children:[f>0?t("chrome.shortcuts.or"):null,d.map(p=>u.jsx("kbd",{children:p==="Mod"?t("chrome.shortcuts.modKey"):p},p))]},d.join("+")))}),u.jsx("dd",{children:l.description})]},`${o.title}:${l.description}`))})]},o.title))]})}),document.body)}const i7=1400,r7="https://github.com/sbluemin/fleet-harness",s7="https://github.com/sbluemin/fleet-harness/stargazers",a7="https://api.github.com/repos/sbluemin/fleet-harness",Fw="fleet-console.github-stars",o7=360*60*1e3,vE='[role="menuitem"]:not([disabled])';function l7(){const e=ps();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(u7,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(d7,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function c7({className:e="brand-foot-home"}){const t=rt();return u.jsxs($d,{className:e,to:"/operations","aria-label":t("chrome.brandFoot.operations"),children:[u.jsx(S7,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function u7({latestVersion:e,updateAvailable:t}){const n=rt(),i=_.useRef(null),s=_.useRef(null),o=_.useRef(null),[l,d]=_.useState(!1),f=Yc();rM(i,s,o,l,d);const p=m=>{d(!1),f(m),window.requestAnimationFrame(()=>{const y=document.querySelector("main h2, h2");y?.focus?.(),y&&document.activeElement!==y&&(y.setAttribute("tabindex","-1"),y.focus())})};return u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:s,type:"button",className:"brand-foot-system-trigger",onClick:()=>d(m=>!m),"aria-haspopup":"menu","aria-expanded":l,"aria-label":n("chrome.brandFoot.systemMenu"),title:n("chrome.brandFoot.systemMenu"),children:[u.jsx(bE,{}),u.jsx("span",{children:n("chrome.brandFoot.systemMenu")})]}),l?u.jsxs("div",{ref:o,className:"brand-foot-dropup-menu",role:"menu","aria-label":n("chrome.brandFoot.systemMenu"),children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/settings"),children:[u.jsx(bE,{}),u.jsx("span",{children:n("chrome.brandFoot.settings")})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(h7,{latestVersion:e})]}):null]}):null]})}function d7({releaseDisabled:e,version:t}){const n=rt(),i=_.useRef(null),s=_.useRef(null),o=_.useRef(null),[l,d]=_.useState(!1),[f,p]=_.useState(!1);return rM(i,s,o,l,d),u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:s,type:"button",className:"brand-foot-help-trigger",onClick:()=>d(m=>!m),"aria-haspopup":"menu","aria-expanded":l,"aria-label":n("chrome.brandFoot.help"),title:n("chrome.brandFoot.help"),children:u.jsx(x7,{})}),l?u.jsxs("div",{ref:o,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":n("chrome.brandFoot.help"),children:[u.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{d(!1),GR()},children:[u.jsx(C7,{}),u.jsx("span",{children:n("chrome.brandFoot.whatsNew")})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{d(!1),p(!0)},children:[u.jsx(k7,{}),u.jsx("span",{children:n("chrome.brandFoot.keyboardShortcuts")})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(f7,{menuItem:!0,version:t})]}):null,f?u.jsx(iM,{onClose:()=>{p(!1),s.current?.focus()}}):null]})}function rM(e,t,n,i,s){_.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(vE)?.focus()}),l=f=>{f.target instanceof Node&&e.current?.contains(f.target)||s(!1)},d=f=>{if(f.key==="Escape"){s(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;const p=[...n.current?.querySelectorAll(vE)??[]];if(p.length===0)return;f.preventDefault();const m=p.findIndex(b=>b===document.activeElement),y=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[y]?.focus()};return window.addEventListener("pointerdown",l,!0),window.addEventListener("keydown",d,!0),()=>{window.cancelAnimationFrame(o),window.removeEventListener("pointerdown",l,!0),window.removeEventListener("keydown",d,!0)}},[n,i,e,s,t])}function h7({latestVersion:e}){const t=rt(),[n,i]=_.useState("idle"),[s,o]=_.useState(null),l=_.useRef(null),d=p7(n,s,e,t);_.useEffect(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);const f=async()=>{if(!d.disabled){l.current!==null&&(window.clearTimeout(l.current),l.current=null),i("applying"),o(null);try{if((await Vj()).status!=="accepted"){i("error"),o("invalid_response");return}i("accepted"),l.current=window.setTimeout(()=>{l.current=null,i("completed")},i7)}catch(p){const m=p instanceof mn?p.message:"network_error";o(m),i(g7(m)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${d.tone}`,onClick:f,disabled:d.disabled,title:d.title,"aria-live":"polite",children:d.label})}function f7({menuItem:e=!1,version:t}){const n=rt(),i=y7(),s=i.count!==null;return u.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":n("chrome.brandFoot.github"),children:[u.jsx("a",{className:"brand-foot-github-link",href:r7,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":n("chrome.brandFoot.openGithub"),title:n("chrome.brandFoot.githubRepo"),children:u.jsx(E7,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:s7,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":s?n("chrome.brandFoot.githubStars",{count:i.count.toLocaleString()}):n("chrome.brandFoot.starOnGithub"),title:n("chrome.brandFoot.starOnGithub"),children:[u.jsx(A7,{}),s?u.jsx("span",{className:"brand-foot-github-stars-count",children:w7(i.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function p7(e,t,n,i){const s=n?i("chrome.brandFoot.update.latestVersion",{version:n}):i("chrome.brandFoot.update.available");return e==="applying"?{label:i("chrome.brandFoot.update.requesting"),title:i("chrome.brandFoot.update.requestingTitle"),tone:"live",disabled:!0}:e==="accepted"?{label:i("chrome.brandFoot.update.updating"),title:i("chrome.brandFoot.update.updatingTitle"),tone:"live",disabled:!0}:e==="completed"?{label:i("chrome.brandFoot.update.done"),title:i("chrome.brandFoot.update.doneTitle"),tone:"live",disabled:!0}:e==="blocked"?m7(t,i):e==="error"?{label:i("common.retry"),title:i("chrome.brandFoot.update.retryTitle"),tone:"error",disabled:!1}:{label:i("chrome.brandFoot.update.update"),title:s,tone:"warn",disabled:!1}}function m7(e,t){return e==="local_channel"?{label:t("chrome.brandFoot.update.local"),title:t("chrome.brandFoot.update.localTitle"),tone:"blocked",disabled:!0}:e==="managed_runtime_update_requires_relaunch"?{label:t("chrome.brandFoot.update.updateAndRestart"),title:t("chrome.brandFoot.update.managedTitle"),tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:t("chrome.brandFoot.update.busy"),title:t("chrome.brandFoot.update.busyTitle"),tone:"blocked",disabled:!0}:e==="update_not_available"?{label:t("chrome.brandFoot.update.current"),title:t("chrome.brandFoot.update.currentTitle"),tone:"blocked",disabled:!0}:{label:t("chrome.brandFoot.update.blocked"),title:t("chrome.brandFoot.update.blockedTitle"),tone:"error",disabled:!1}}function g7(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function y7(){const[e,t]=_.useState(()=>{const n=_7();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return _.useEffect(()=>{if(v7())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(a7,{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 s=typeof i.stargazers_count=="number"?i.stargazers_count:null;if(s===null){t(o=>({count:o.count,status:o.count===null?"error":"ready"}));return}b7(s),t({count:s,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function _7(){try{const e=window.localStorage.getItem(Fw);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function v7(){try{const e=window.localStorage.getItem(Fw);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<o7}catch{return!1}}function b7(e){try{window.localStorage.setItem(Fw,JSON.stringify({count:e,at:Date.now()}))}catch{}}function w7(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function S7(){return u.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),u.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),u.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),u.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),u.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),u.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function bE(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function x7(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function C7(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function k7(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function E7(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function A7(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function T7(e,t,n,i){if(!n)return{groupId:null,index:0};for(const o of t){const l=o.groupId??"__ungrouped__",d=n.querySelector(`[data-drop-zone-group-id="${l}"]`);if(!d)continue;const f=d.getBoundingClientRect();if(e<f.top||e>f.bottom)continue;const p=d.querySelector(`[data-group-section-id="${l}"]`);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 y of m){const b=y.dataset.sideBarChipId;if(!b||b===i)continue;const w=y.getBoundingClientRect();if(e<=w.top+w.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(b))}}return{groupId:o.groupId,index:o.entryIds.length}}const s=t[t.length-1];return{groupId:s?.groupId??null,index:s?.entryIds.length??0}}function R7(e,t,n,i){if(!n)return 0;const s=Array.from(n.querySelectorAll("[data-drop-zone-group-id]"));for(const o of s){const l=o.dataset.dropZoneGroupId;if(!l||l==="__ungrouped__"||l===i)continue;const d=t.indexOf(l);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function M7(e,t,n,i){if(!n)return 0;const s=Array.from(n.querySelectorAll("[data-theater-id]"));for(const o of s){const l=o.dataset.theaterId;if(!l||l===i)continue;const d=t.indexOf(l);if(d===-1)continue;const f=o.getBoundingClientRect();if(e<=f.top+f.height/2)return d}return t.length}function L7(e,t,n,i){const s=e.filter(m=>m!==t),o=new Set(i),l=s.filter(m=>o.has(m)),d=Math.max(0,Math.min(n,l.length));if(l.length===0)return[...s,t];if(d<l.length){const m=s.indexOf(l[d]),y=[...s];return y.splice(m,0,t),y}const f=s.indexOf(l[l.length-1]),p=[...s];return p.splice(f+1,0,t),p}function N7(e,t,n,i){const s=new Set(i),o=e.filter(y=>s.has(y)),l=o.indexOf(t),d=o.filter(y=>y!==t),f=n>l?n-1:n,p=Math.max(0,Math.min(f,d.length));d.splice(p,0,t);let m=0;return e.map(y=>s.has(y)?d[m++]??y:y)}function O7(e,t,n){if(n.length!==t.length)return[...e];const i=new Set(t);let s=0;return e.map(o=>i.has(o)?n[s++]??o:o)}function I7(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const s=e.filter(d=>d!==t),o=n>i?n-1:n,l=Math.max(0,Math.min(o,s.length));return s.splice(l,0,t),s}function D7(e,t,n){const i=e.indexOf(t);if(i===-1)return[...e];const s=e.filter(d=>d!==t),o=n>i?n-1:n,l=Math.max(0,Math.min(o,s.length));return s.splice(l,0,t),s}function j7(e,t,n){if(e.indexOf(t)===-1)return[...e];const s=e.filter(l=>l!==t),o=Math.max(0,Math.min(n,s.length));return s.splice(o,0,t),s}const B7='button[role^="menuitem"]:not(:disabled)',P7="data-accent-option";function z7({open:e,menuSelector:t,returnFocusRef:n,requestedAction:i,onEscape:s}){_.useEffect(()=>{if(!e)return;let o=!1,l=null,d=null;const f=()=>{const m=document.querySelector(t);if(!m)return!1;const y=()=>Array.from(m.querySelectorAll(B7)),b=(L,F)=>{const q=y();for(const[T,$]of q.entries())$.tabIndex=T===L?0:-1;F&&q[L]?.focus()},w=y();if(w.length>0){const L=i==="set-accent"?w.findIndex(q=>q.hasAttribute(P7)):0,F=Math.max(0,L);b(F,!1),n.current!==null&&(l=window.requestAnimationFrame(()=>{!o&&m.isConnected&&b(F,!0)}))}const S=L=>{const F=y();if(F.length===0)return;if(L.key==="Escape"){L.preventDefault(),L.stopPropagation();const $=n.current;s(),$?.focus();return}if(L.key==="Enter"&&document.activeElement instanceof HTMLButtonElement&&m.contains(document.activeElement)){L.preventDefault(),L.stopPropagation(),document.activeElement.click();return}if(L.key!=="ArrowDown"&&L.key!=="ArrowUp")return;L.preventDefault(),L.stopPropagation();const q=F.findIndex($=>$===document.activeElement),T=L.key==="ArrowDown"?(q+1)%F.length:q<=0?F.length-1:q-1;b(T,!0)},x=L=>{if(L.target instanceof HTMLInputElement)for(const F of y())F.tabIndex=-1},k=new MutationObserver(()=>{const L=y();if(document.activeElement instanceof HTMLInputElement&&m.contains(document.activeElement)){for(const q of L)q.tabIndex=-1;return}const F=L.findIndex(q=>q.tabIndex===0);L.length>0&&b(Math.max(0,F),!1)});return m.addEventListener("keydown",S),m.addEventListener("focusin",x),k.observe(m,{childList:!0,subtree:!0}),d=()=>{m.removeEventListener("keydown",S),m.removeEventListener("focusin",x),k.disconnect()},!0};let p=null;return f()||(p=new MutationObserver(()=>{f()&&p?.disconnect()})),p?.observe(document.body,{childList:!0,subtree:!0}),()=>{o=!0,l!==null&&window.cancelAnimationFrame(l),p?.disconnect(),d?.()}},[t,s,e,i,n])}let ap=null;const cb=new Set;function $7(e,t){ap={operationId:e,action:t},F7()}function sM(e){return cb.add(e),aM(e),()=>cb.delete(e)}function F7(){for(const e of cb)if(aM(e))return}function aM(e){return ap===null||!e(ap)?!1:(ap=null,!0)}function Hw(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,s=_.useRef(null),o=_.useRef(!1),l=_.useRef(!1),[d,f]=_.useState(!1),[p,m]=_.useState("");_.useEffect(()=>{d&&(s.current?.focus(),s.current?.select())},[d]);const y=()=>{i?.(),l.current=!1,m(t),f(!0)},b=()=>{l.current=!0,f(!1),m("")},w=()=>{if(!o.current){o.current=!0;try{n(p)}finally{o.current=!1,l.current=!0,f(!1)}}};return{renaming:d,draftTitle:p,inputRef:s,begin:y,cancel:b,commit:w,setDraftTitle:m,handleKeyDown:k=>{if(k.key==="Enter"){k.preventDefault(),w();return}k.key==="Escape"&&(k.preventDefault(),b())},handleBlur:()=>{if(l.current){l.current=!1;return}w()}}}function $p({entry:e,index:t,isCloseArmed:n,accentValue:i,groupMark:s=null,statusAxis:o=!1,idleUnseen:l=!1,statusLanded:d=!1,reorderEnabled:f=!0,dragging:p,dragOffsetY:m,dropTarget:y,preview:b=!1,onArmClose:w,onDisarmClose:S,onClose:x,onMinimize:k,onFocus:L,onKeyboardMove:F,onPointerDragStart:q,onOpenAccent:T,onRename:$}){const I=rt(),N=_.useRef(null),V=_.useRef(!1),{operation:K,active:Q,minimized:Y,notificationCount:B,status:M}=e,D=H7(K),j=o&&s?I("sidebar.chip.inGroup",{name:s.name}):"",A=l?I("sidebar.chip.unseenContext"):"",O=Q?I("sidebar.chip.focusedAria",{title:D,groupContext:j,unseenContext:A}):I("sidebar.chip.focusAria",{title:D,groupContext:j,unseenContext:A}),C=Hw({currentTitle:D,onCommit:ne=>$(K.id,ne),onBegin:S}),z=["side-bar-chip",Q?"side-bar-chip--active":"",Y?"side-bar-chip--minimized":"",d?"side-bar-chip--status-landed":"",p?"side-bar-chip--dragging":"",y?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),P=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),R={"--i":t,...i?{"--user-accent":i}:{},...p?{"--drag-dy":`${Math.round(m)}px`}:{}},W=()=>{if(S(),V.current){V.current=!1;return}L(K.id)},G=ne=>{ne.stopPropagation()},U=ne=>{if(ne.stopPropagation(),!n){w(K.id);return}S(),x(K.id)},ee=ne=>{ne.preventDefault(),S(),T(K.id,ne.currentTarget.getBoundingClientRect())};return _.useEffect(()=>sM(ne=>{if(ne.operationId!==K.id||b)return!1;const me=N.current;return!me||me.closest("[inert]")?!1:ne.action==="rename"?(C.begin(),!0):ne.action==="assign-group"||ne.action==="set-accent"?(S(),me.scrollIntoView({block:"nearest"}),T(K.id,me.getBoundingClientRect(),me,ne.action),!0):(S(),k(K.id),me.focus(),!0)}),[S,k,T,K.id,b,C]),u.jsxs("li",{ref:N,"data-side-bar-chip-id":K.id,"data-reorder-enabled":f?"true":"false",className:z,role:"button",tabIndex:0,"aria-haspopup":b?void 0:"menu","aria-label":O,"aria-current":Q?"true":void 0,title:I(b?"sidebar.chip.previewTitle":Q?"sidebar.chip.activeTitle":"sidebar.chip.idleTitle"),style:R,onClick:W,onContextMenu:b?void 0:ee,onFocus:()=>{n||S()},onPointerDown:f?ne=>q(ne,K.id):void 0,onPointerUp:()=>{p&&(V.current=!0)},onKeyDown:ne=>{if(ne.target===ne.currentTarget){if(!b&&f&&ne.altKey&&ne.shiftKey&&(ne.key==="ArrowUp"||ne.key==="ArrowDown")){ne.preventDefault(),F(K.id,ne.key==="ArrowUp"?-1:1);return}if(!b&&(ne.key==="ContextMenu"||ne.shiftKey&&ne.key==="F10")){ne.preventDefault(),S(),T(K.id,ne.currentTarget.getBoundingClientRect(),ne.currentTarget);return}(ne.key==="Enter"||ne.key===" ")&&(ne.preventDefault(),W())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(G7,{})})}),C.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:C.inputRef,value:C.draftTitle,"aria-label":I("sidebar.chip.renameAria",{title:D}),onChange:ne=>C.setDraftTitle(ne.target.value),onKeyDown:C.handleKeyDown,onBlur:C.handleBlur,onPointerDown:ne=>ne.stopPropagation(),onClick:ne=>ne.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:b?void 0:C.begin,children:D}),B>0?u.jsx("span",{className:"side-bar-chip-count",children:B}):null,s&&o&&!b?u.jsx("span",{className:"side-bar-chip-group-pill",title:s.name,"aria-hidden":"true",style:{"--group-mark":s.color},children:s.name}):s&&!o?u.jsx("span",{className:"side-bar-chip-group-mark",title:s.name,"aria-label":I("sidebar.chip.groupAria",{name:s.name}),style:{"--group-mark":s.color}}):null,o&&l?u.jsx("span",{className:"side-bar-chip-unseen",role:"img","aria-label":I("sidebar.chip.unseenAria"),title:I("sidebar.chip.unseenTitle")}):null,o?null:u.jsx("span",{className:`side-bar-chip-status ${U7(M)}`,role:"img","aria-label":wE(M),title:wE(M)}),!b&&!Y?u.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:G,onClick:ne=>{ne.stopPropagation(),S(),k(K.id)},"aria-label":I("sidebar.chip.minimizeAria",{title:D}),title:I("sidebar.chip.minimizeTitle"),children:u.jsx(q7,{})}):null,b?null:u.jsx("button",{type:"button",className:P,onPointerDown:G,onClick:U,"aria-label":n?I("sidebar.chip.confirmCloseAria",{title:D}):I("sidebar.chip.closeAria",{title:D}),title:I(n?"sidebar.chip.confirmCloseTitle":"sidebar.chip.closeTitle"),children:n?I("sidebar.chip.closeArmed"):u.jsx(W7,{})})]})}function H7(e){return e.title}function U7(e){const t=Dm(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 wE(e){return T8(e)}function W7(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function q7(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function G7(){return u.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function oM({group:e,count:t,collapsed:n,dragging:i,dropTarget:s,dragOffsetY:o,onToggle:l,onContextMenu:d,onPointerDragStart:f}){const p=rt(),m=_.useRef(!1),y=Zr(e.color),b=["side-bar-group-header",n?"side-bar-group-header--collapsed":"",i?"side-bar-group-header--dragging":"",s?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),w={...y?{"--grp-color":y}:{},...i?{"--drag-dy":`${Math.round(o)}px`}:{}},S=L=>{L.preventDefault(),d(e.id,L.currentTarget.getBoundingClientRect())},x=L=>{L.target instanceof Element&&L.target.closest("button")||f(L,e.id)},k=()=>{i&&(m.current=!0)};return u.jsxs("div",{className:b,style:w,onContextMenu:S,onPointerDown:x,onPointerUp:k,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>l(e.id),"aria-expanded":!n,"aria-label":n?p("sidebar.group.expand",{name:e.name}):p("sidebar.group.collapse",{name:e.name}),title:p(n?"sidebar.status.expand":"sidebar.status.collapse"),children:u.jsx(K7,{collapsed:n})}),u.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":p("sidebar.group.operationsCount",{count:t}),children:t})]})}function K7({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const lM="fleet-console.operations.side-width",cM="fleet-console.operations.side-collapsed",uM="fleet-console.operations.theater-collapsed",Pm=280,SE=Pm,ub=new Set,db=new Set,hb=new Set,fb=new Set;let ul={width:az(),collapsed:oz()},op=lz(),Fp=!1,gc=new Set,yc=new Set,V7=0,dM=new Map,Uw=new Set,xE=new Map,CE=new Set,pb=new Set;function hM(){return _.useSyncExternalStore(cz,Hd,Hd)}function Y7(){return _.useSyncExternalStore(dz,AE,AE)}function X7(){return _.useSyncExternalStore(ez,mb,mb)}function Z7(e,t,n){const i=_.useCallback(()=>zm(e,t,n),[e,t,n]);return _.useSyncExternalStore(tz,i,i)}function J7(e){const t=Math.max(Pm,Math.min(yM(),e));if(ul.width!==t){ul={...ul,width:t};try{typeof window<"u"&&localStorage.setItem(lM,String(t))}catch{}_M()}}function fo(e){if(ul.collapsed!==e){ul={...ul,collapsed:e};try{typeof window<"u"&&localStorage.setItem(cM,e?"1":"0")}catch{}_M()}}function kE(e,t){const n=new Set(op);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==op.join("\0")){op=i;try{typeof window<"u"&&localStorage.setItem(uM,JSON.stringify(i))}catch{}uz()}}function Q7(e){if(Fp!==e){Fp=e;for(const t of hb)t()}}function Hp(){Q7(!Fp)}function mb(){return Fp}function ez(e){return hb.add(e),()=>hb.delete(e)}function zm(e,t,n){const i=gM(e,t);return gc.has(i)?!0:yc.has(i)?!1:n}function fM(e,t,n){const i=gM(e,t);zm(e,t,n)?(gc=new Set(gc),gc.delete(i),yc=new Set(yc).add(i)):(yc=new Set(yc),yc.delete(i),gc=new Set(gc).add(i));for(const s of fb)s()}function tz(e){return fb.add(e),()=>fb.delete(e)}function nz(e){for(const t of e)dM.set(t,++V7)}function Ww(e){return dM.get(e)}function iz(e){Uw.add(e)}function EE(e){Uw.delete(e)}function pM(){return Uw}function mM(e){const t=new Map(e.operations.map(s=>[s.id,_o(s,e.operationStatus)])),n=e.operations.filter(s=>e.operationStatus[s.id]===void 0||CE.has(s.id)?!1:(CE.add(s.id),!0)).map(s=>s.id),i=e.operations.filter(s=>{const o=xE.get(s.id);return o!==void 0&&o!==t.get(s.id)&&!n.includes(s.id)}).map(s=>s.id);nz(i),i.forEach(s=>pb.add(s));for(const s of e.operations)i.includes(s.id)&&(t.get(s.id)==="idle"?s.id===e.activeOperationId&&s.theaterId===e.activeTheaterId||iz(s.id):EE(s.id));if(e.activeOperationId!==null){const s=e.operations.find(o=>o.id===e.activeOperationId);s!==void 0&&s.theaterId===e.activeTheaterId&&EE(e.activeOperationId)}return xE=t,i}function rz(){const e=Array.from(pb);return pb=new Set,e}function sz(){return Iw(()=>{const e=Co();mM({operations:e.operations,operationStatus:e.operationStatus,activeTheaterId:e.activeTheaterId,activeOperationId:e.activeOperationId})})}function gM(e,t){return`${e}:${t}`}function yM(){return typeof window<"u"?Math.max(Pm,window.innerWidth-480):800}function az(){try{if(typeof window>"u")return SE;const e=localStorage.getItem(lM);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(Pm,Math.min(yM(),t))}}catch{}return SE}function oz(){try{return typeof window<"u"&&localStorage.getItem(cM)==="1"}catch{return!1}}function lz(){try{if(typeof window>"u")return[];const e=localStorage.getItem(uM),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function _M(){for(const e of ub)e()}function Hd(){return ul}function cz(e){return ub.add(e),()=>ub.delete(e)}function uz(){for(const e of db)e()}function AE(){return op}function dz(e){return db.add(e),()=>db.delete(e)}function vM(e,t){const n=e.find(s=>s.id===t.pluginId)?.kinds.filter(s=>s.type===t.type)??[],i=t.payload.launchKindId;if(typeof i=="string"){const s=n.find(o=>o.id===i);if(s)return s}return n.length===1?n[0]:null}const hz=1500,fz=6,TE=34,RE=18,pz=500;function mz(e){return[{status:"awaiting",label:e("sidebar.status.awaiting")},{status:"running",label:e("sidebar.status.running")},{status:"idle",label:e("sidebar.status.idle")},{status:"dormant",label:e("sidebar.status.dormant")}]}function bM({theaterId:e,section:t,unseenCount:n=0,children:i}){const s=rt(),o=t.entries.length===0,l=Z7(e,t.status,o);return u.jsxs("li",{className:["side-bar-status-section",`side-bar-status-section--${t.status}`,o?"side-bar-status-section--empty":""].filter(Boolean).join(" "),children:[u.jsxs("div",{className:`side-bar-status-header side-bar-status-header--${t.status}`,children:[u.jsx("button",{type:"button",className:"side-bar-status-header__toggle",onClick:()=>fM(e,t.status,o),"aria-expanded":!l,"aria-label":l?s("sidebar.status.expandSection",{label:t.label}):s("sidebar.status.collapseSection",{label:t.label}),title:s(l?"sidebar.status.expand":"sidebar.status.collapse"),children:u.jsx(gz,{collapsed:l})}),u.jsx("span",{className:"side-bar-status-header__dot","aria-hidden":"true"}),u.jsx("span",{className:"side-bar-status-header__label",children:t.label}),n>0?u.jsx("span",{className:"side-bar-status-header__unseen",children:n}):null,u.jsx("span",{className:"side-bar-status-header__count",children:t.entries.length})]}),l?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":s("sidebar.status.sectionOperations",{label:t.label}),children:o?u.jsx("li",{className:"side-bar-status-empty-hint",children:s("sidebar.status.noOperations")}):i})]})}function gz({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-status-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function yz({theaters:e,activeTheaterId:t,operations:n,groups:i,minimized:s,activeOperationId:o,operationNotifications:l,catalog:d,canLaunch:f,addingTheater:p,theaterError:m,renderKindIcon:y,onLaunchKind:b,onClose:w,onMinimize:S,onFocus:x,onSetAccent:k,onRename:L,onSetGroupId:F,onCreateGroup:q,onSetGroupColor:T,onRenameGroup:$,onReorderGroups:I,onReorderTheaters:N,onUngroupAll:V,onSelectTheater:K,onAddTheater:Q,onCancelAddTheater:Y,onForgetTheater:B}){const M=rt(),D=_.useRef(null),j=_.useRef(null),A=hM(),{width:O,collapsed:C}=A,z=X7(),P=_.useRef(C),R=Cw(),W=_.useRef(null),G=_.useRef(new Set),U=_.useRef(!1),[ee,ne]=_.useState(null),[me,Me]=_.useState(new Set),[ve,Ye]=_.useState(null),qe=_.useRef(null),yt=_.useRef([]),$e=_.useRef([]),We=_.useRef([]),mt=_.useRef([]),ot=_.useRef([]),Nt=_.useRef(F),Ot=_.useRef(I),kt=_.useRef(N),ye=_.useRef(null),[ze,Je]=_.useState(null),[It,Ke]=_.useState(null),[en,we]=_.useState(!1),[De,de]=_.useState(!1),Pe=GB(),st=Y7(),{operationStatus:ft,pendingSideBarAddTheater:Dt,pendingSideBarTheaterLaunch:Gt,launchMenuRequest:_t}=ps();_.useLayoutEffect(()=>{!P.current&&C&&QR(D.current,".command-band-sidebar-toggle"),P.current=C},[C]);const Tt=n.filter(ie=>ie.theaterId===t),Ne=i.filter(ie=>ie.theaterId===t),jt=new Set(s),se=new Set(Pe),oe=jm(Tt,R.operationOrder).map(ie=>{const Ie=vM(d,ie),fe=Ie?y(ie.pluginId,Ie):null;return{operation:ie,active:o===ie.id,minimized:jt.has(ie.id),notificationCount:l[ie.id]?1:0,status:_o(ie,ft),icon:fe}}),ge=wM(oe,Ne,R.operationOrder),Ee=SM(oe,Ww,M),je=pM(),at=ie=>ie!==o&&je.has(ie),Z=new Map(oe.map((ie,Ie)=>[ie.operation.id,Ie])),he=new Map(Ne.map(ie=>{const Ie=Zr(ie.color);return[ie.id,Ie?{name:ie.name,color:Ie}:null]})),ke=ge.some(ie=>ie.group!==null),Ge=ge.flatMap(ie=>ie.groupId?[ie.groupId]:[]),St=ge.flatMap(ie=>se.has(ie.groupId??"")?[]:ie.entries),Pt=oe.map(ie=>ie.operation.id),Fe=n.map(ie=>`${ie.id}:${_o(ie,ft)}`).join("\0"),Oe=_.useCallback(()=>{W.current!==null&&(window.clearTimeout(W.current),W.current=null)},[]),Qe=_.useCallback(()=>{Oe(),ne(null)},[Oe]),_n=_.useCallback(ie=>{Oe(),ne(ie),W.current=window.setTimeout(()=>{W.current=null,ne(null)},hz)},[Oe]);_.useEffect(()=>Oe,[Oe]),_.useEffect(()=>sM(ie=>{const Ie=n.find(fe=>fe.id===ie.operationId);if(!Ie||Ie.theaterId!==t)return!1;if(C)return fo(!1),!1;if(st.includes(Ie.theaterId))return kE(Ie.theaterId,!1),!1;if(z){const fe=_o(Ie,ft);return zm(Ie.theaterId,fe,!1)&&fM(Ie.theaterId,fe,!1),!1}return Ie.groupId&&se.has(Ie.groupId)&&Zv(Ie.groupId),!1}),[t,C,se,st,ft,n,z]),_.useEffect(()=>{ee!==null&&(oe.some(ie=>ie.operation.id===ee)||Qe())},[ee,oe,Qe]),_.useEffect(()=>{mM({operations:n,operationStatus:ft,activeTheaterId:t,activeOperationId:o});const ie=rz();if(!U.current){U.current=!0;return}if(!z){for(const fe of G.current)window.clearTimeout(fe);G.current.clear(),Me(fe=>fe.size===0?fe:new Set);return}if(ie.length===0)return;Me(fe=>{const Te=new Set(fe);for(const Ae of ie)Te.add(Ae);return Te});const Ie=window.setTimeout(()=>{G.current.delete(Ie),Me(fe=>{const Te=new Set(fe);for(const Ae of ie)Te.delete(Ae);return Te.size===fe.size?fe:Te})},pz);G.current.add(Ie)},[z,Fe,t,o]),_.useEffect(()=>()=>{for(const ie of G.current)window.clearTimeout(ie);G.current.clear()},[]),_.useEffect(()=>{if(!_t)return;sP();const Ie=D.current?.querySelector(".side-bar-theater-section--active .side-bar-theater-launch-btn")?.getBoundingClientRect();Je(null),Ke({anchor:Ie?{x:Ie.right+8,y:Ie.top}:{x:16,y:64},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},[_t]);const gt=ze?.kind==="chip"?oe.find(ie=>ie.operation.id===ze.operationId)?.operation??null:null,Rn=ze?.kind==="group"?i.find(ie=>ie.id===ze.groupId)??null:null,$i=ze?.kind==="theater"?e.find(ie=>ie.id===ze.theaterId)??null:null,Lr=(ie,Ie)=>{if(z)return;const fe=St.findIndex(xt=>xt.operation.id===ie);if(fe===-1)return;const Te=Math.max(0,Math.min(St.length-1,fe+Ie));if(Te===fe)return;const Ae=St.map(xt=>xt.operation.id),dt=j7(Ae,ie,Te);p_(O7(Pt,Ae,dt))},Ii=ge.map(ie=>({groupId:ie.groupId,entryIds:ie.entries.map(Ie=>Ie.operation.id)}));_.useEffect(()=>{yt.current=oe,$e.current=Pt,We.current=Ii,mt.current=Ge,ot.current=e.map(ie=>ie.id),Nt.current=F,Ot.current=I,kt.current=N});const Ft=ie=>{qe.current=ie,Ye(ie)};_.useEffect(()=>{z&&qe.current?.kind==="chip"&&Ft(null)},[z]);const Kt=ve?.pointerId??null;_.useEffect(()=>{if(Kt===null)return;const ie=Te=>{if(Te.pointerId!==Kt)return;const Ae=qe.current;if(!Ae)return;if(Te.buttons===0){Ft(null);return}const dt=Math.hypot(Te.clientX-Ae.startX,Te.clientY-Ae.startY);if(!Ae.dragging&&dt<fz)return;if(Ae.dragging&&Te.preventDefault(),xz(Te.clientY,j.current),Ae.kind==="chip"){const rn=T7(Te.clientY,We.current,j.current,Ae.sourceId);Ft({...Ae,currentY:Te.clientY,dragging:!0,dropIndex:rn.index,dropGroupId:rn.groupId});return}if(Ae.kind==="theater"){const rn=M7(Te.clientY,ot.current,j.current,Ae.sourceTheaterId);Ft({...Ae,currentY:Te.clientY,dragging:!0,dropIndex:rn});return}const xt=R7(Te.clientY,mt.current,j.current,Ae.sourceGroupId);Ft({...Ae,currentY:Te.clientY,dragging:!0,dropIndex:xt})},Ie=Te=>{if(Te.pointerId!==Kt)return;const Ae=qe.current;if(Ft(null),!Ae?.dragging)return;if(Ae.kind==="theater"){const Zn=D7(ot.current,Ae.sourceTheaterId,Ae.dropIndex);if(Zn.join("\0")===ot.current.join("\0"))return;kt.current(Zn);return}if(Ae.kind==="group"){const Zn=I7(mt.current,Ae.sourceGroupId,Ae.dropIndex);if(Zn.join("\0")===mt.current.join("\0"))return;Ot.current(Zn);return}const{sourceId:dt,sourceGroupId:xt,dropIndex:rn,dropGroupId:Yn}=Ae,Fn=We.current,Vt=$e.current;if(Yn!==xt){const ys=Fn.find(Hn=>Hn.groupId===Yn)?.entryIds??[];p_(L7(Vt,dt,rn,ys)),Nt.current(dt,Yn);return}const sn=Fn.find(Zn=>Zn.groupId===xt)?.entryIds??[],Xn=sn.indexOf(dt);if(Xn===-1||rn===Xn)return;const Di=N7(Vt,dt,rn,sn);p_(Di)},fe=Te=>{Te.pointerId===Kt&&Ft(null)};return window.addEventListener("pointermove",ie),window.addEventListener("pointerup",Ie),window.addEventListener("pointercancel",fe),()=>{window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",Ie),window.removeEventListener("pointercancel",fe)}},[Kt]);const Qi=(ie,Ie)=>{if(z||ie.button!==0||ie.target instanceof Element&&ie.target.closest("button"))return;Je(null),Qe();const Te=oe.find(Ae=>Ae.operation.id===Ie)?.operation.groupId??null;Ft({kind:"chip",sourceId:Ie,sourceGroupId:Te,pointerId:ie.pointerId,startX:ie.clientX,startY:ie.clientY,currentY:ie.clientY,dragging:!1,dropIndex:Pt.indexOf(Ie),dropGroupId:Te})},gs=(ie,Ie)=>{ie.button===0&&(ie.target instanceof Element&&ie.target.closest("button")||Ge.includes(Ie)&&(Je(null),Qe(),Ft({kind:"group",sourceGroupId:Ie,pointerId:ie.pointerId,startX:ie.clientX,startY:ie.clientY,currentY:ie.clientY,dragging:!1,dropIndex:Ge.indexOf(Ie)})))},Hs=(ie,Ie)=>{if(ie.button!==0||ie.target instanceof Element&&ie.target.closest("button"))return;const fe=e.map(Te=>Te.id);fe.includes(Ie)&&(Je(null),Qe(),Ft({kind:"theater",sourceTheaterId:Ie,pointerId:ie.pointerId,startX:ie.clientX,startY:ie.clientY,currentY:ie.clientY,dragging:!1,dropIndex:fe.indexOf(Ie)}))},is=_.useCallback(ie=>{ie.preventDefault();const Ie=ie.clientX,fe=A.width;de(!0);const Te=dt=>{const xt=dt.clientX-Ie;J7(fe+xt)},Ae=()=>{de(!1),document.removeEventListener("pointermove",Te),document.removeEventListener("pointerup",Ae),document.removeEventListener("pointercancel",Ae)};document.addEventListener("pointermove",Te),document.addEventListener("pointerup",Ae),document.addEventListener("pointercancel",Ae)},[A.width]),Us=()=>{fo(!C)},pr=()=>{Ke(null),Je(null),we(!0)},et=()=>{we(!1),Y()},X=ie=>{we(!1),Q(ie)},Se=ie=>{ie.defaultPrevented||(ie.preventDefault(),Je(null),Ke({anchor:{x:ie.clientX,y:ie.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Be=_.useCallback(()=>{const ie=ze?.returnFocus??null;Je(null),ie?.focus()},[ze]);ye.current=ze?.returnFocus??null,z7({open:ze!==null,menuSelector:ze?.kind==="theater"?'.side-bar-theater-menu[role="menu"]':'.group-context-menu-card[role="menu"]',returnFocusRef:ye,requestedAction:ze?.kind==="chip"?ze.requestedAction:void 0,onEscape:Be});const Bt=(ie,Ie)=>{Ie!==t&&K(Ie),Je(null),Ke({anchor:{x:ie.right+8,y:ie.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Rt=(ie,Ie)=>{ie.stopPropagation(),Bt(ie.currentTarget.getBoundingClientRect(),Ie)};_.useEffect(()=>{Dt&&(iP(),C&&fo(!1),pr())},[Dt]),_.useEffect(()=>{const ie=Gt;if(ie===null)return;if(C){fo(!1);return}if(!e.some(Ae=>Ae.id===ie)){uE();return}const Ie=()=>{uE();const dt=Array.from(D.current?.querySelectorAll("[data-theater-id]")??[]).find(xt=>xt.dataset.theaterId===ie)?.querySelector(".side-bar-theater-launch-btn");dt&&Bt(dt.getBoundingClientRect(),ie)};if(D.current!==null&&Math.abs(D.current.getBoundingClientRect().width-O)<=1){Ie();return}const Te=window.setTimeout(Ie,220);return()=>window.clearTimeout(Te)},[Gt,C]);const ln=ie=>{kE(ie,!st.includes(ie))};return u.jsxs("aside",{className:`operations-side-bar ${C?"is-closed":"is-expanded"}`,ref:D,"data-sidebar-state":C?"closed":"expanded","data-resizing":De?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${O}px`},inert:C,onContextMenu:Se,children:[!C&&m?u.jsx("p",{className:"side-bar-theater-error",children:m}):null,u.jsxs("ol",{className:"operations-side-bar-chips",ref:j,"aria-label":M("sidebar.list.aria"),children:[e.map((ie,Ie)=>{const fe=ie.id===t,Te=n.filter(nt=>nt.theaterId===ie.id),Ae=!z&&_z(Te,ft),dt=ze?.kind==="theater"&&ze.theaterId===ie.id,xt=st.includes(ie.id),rn=ve?.kind==="theater"&&ve.sourceTheaterId===ie.id&&ve.dragging,Yn=rn&&ve?.kind==="theater"?ve.currentY-ve.startY:0,Fn=ve?.kind==="theater"&&ve.dragging&&ve.sourceTheaterId!==ie.id&&ve.dropIndex===Ie,Vt=ve?.kind==="theater"&&ve.dragging&&ve.sourceTheaterId!==ie.id&&Ie===e.length-1&&ve.dropIndex===e.length;if(!fe){const nt=FB(ie.id),sn=bz({theaterId:ie.id,operations:n,operationOrder:nt.operationOrder,minimizedSet:new Set(nt.minimized),activeOperationId:null,operationNotifications:l,operationStatus:ft,catalog:d,renderKindIcon:y});return u.jsx(wz,{theater:ie,entries:xt?[]:sn,groups:i.filter(Xn=>Xn.theaterId===ie.id),collapsedGroups:new Set(nt.collapsedGroups),operationAccent:nt.operationAccent,collapsed:xt,statusAxis:z,statusActionsOpen:dt,showStatusLiveTick:Ae,statusLandingIds:me,dragging:rn,dropBefore:Fn,dropAfter:Vt,dragOffsetY:Yn,onSelectTheater:K,onFocus:x,onToggleCollapsed:ln,onToggleStatusAxis:Hp,onOpenActions:(Xn,Di)=>{Ke(null),Je({kind:"theater",theaterId:ie.id,anchor:Xn,returnFocus:Di})},onOpenLaunch:Rt,onContextMenu:(Xn,Di)=>{Ke(null),Je({kind:"theater",theaterId:ie.id,anchor:Xn,returnFocus:Di})},onPointerDragStart:Hs},ie.id)}return u.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",Fn?"side-bar-theater-section--drop-before":"",Vt?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":ie.id,children:[u.jsx(xM,{theater:ie,active:!0,collapsed:xt,statusAxis:z,statusActionsOpen:dt,showStatusLiveTick:Ae,dragging:rn,dropTarget:Fn,dragOffsetY:Yn,onSelectTheater:K,onToggleCollapsed:ln,onToggleStatusAxis:Hp,onOpenActions:(nt,sn)=>{Ke(null),Je({kind:"theater",theaterId:ie.id,anchor:nt,returnFocus:sn})},onOpenLaunch:Rt,onContextMenu:(nt,sn)=>{Ke(null),Je({kind:"theater",theaterId:ie.id,anchor:nt,returnFocus:sn})},onPointerDragStart:Hs}),xt?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":M("sidebar.theater.operationsAria",{theater:ie.label}),children:z?Ee.map(nt=>u.jsx(bM,{theaterId:ie.id,section:nt,unseenCount:nt.status==="idle"?nt.entries.filter(sn=>at(sn.operation.id)).length:void 0,children:nt.entries.map(sn=>{const Xn=Z.get(sn.operation.id)??0,Di=R.operationAccent[sn.operation.id]??Od(sn.operation),Zn=Di?Zr(Di):null,ys=sn.operation.groupId?he.get(sn.operation.groupId)??null:null;return u.jsx($p,{entry:sn,index:Xn,isCloseArmed:ee===sn.operation.id,accentValue:Zn,groupMark:ys,statusAxis:!0,idleUnseen:at(sn.operation.id),statusLanded:me.has(sn.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,onArmClose:_n,onDisarmClose:Qe,onClose:w,onMinimize:S,onFocus:x,onKeyboardMove:Lr,onPointerDragStart:Qi,onOpenAccent:(Hn,Ws,rs,Un)=>{Je({kind:"chip",operationId:Hn,anchor:Ws,returnFocus:rs,requestedAction:Un})},onRename:L},sn.operation.id)})},nt.status)):ge.map(nt=>{const sn=nt.groupId!==null&&se.has(nt.groupId),Xn=nt.group?Zr(nt.group.color):null,Di=Xn?{"--grp-color":Xn}:void 0,Zn=nt.groupId?Ge.indexOf(nt.groupId):-1,ys=ve?.kind==="group"&&ve.sourceGroupId===nt.groupId&&ve.dragging,Hn=ve?.kind==="group"&&ve.dragging&&nt.groupId!==null&&ve.sourceGroupId!==nt.groupId&&ve.dropIndex===Zn,Ws=ve?.kind==="group"&&ve.dragging&&nt.groupId!==null&&ve.sourceGroupId!==nt.groupId&&Zn===Ge.length-1&&ve.dropIndex===Ge.length,rs=[nt.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Hn?"side-bar-group-section--drop-before":"",Ws?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":nt.groupId??"__ungrouped__",className:rs,style:Di,children:[nt.group?u.jsx(oM,{group:nt.group,count:nt.entries.length,collapsed:sn,dragging:ys,dragOffsetY:ys?ve.currentY-ve.startY:0,dropTarget:Hn,onToggle:Zv,onContextMenu:(Un,Wn)=>Je({kind:"group",groupId:Un,anchor:Wn}),onPointerDragStart:gs}):ke&&nt.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":M("sidebar.ungrouped.aria"),children:u.jsx("span",{children:M("sidebar.ungrouped.label")})}):null,sn?null:u.jsx("ol",{className:["side-bar-group-chips",ve?.kind==="chip"&&ve.dragging&&ve.dropGroupId===nt.groupId&&ve.dropGroupId!==ve.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":nt.groupId??"__ungrouped__","aria-label":nt.group?nt.group.name:M("sidebar.ungrouped.label"),children:nt.entries.map(Un=>{const Wn=oe.indexOf(Un),Al=nt.entries.indexOf(Un),qs=R.operationAccent[Un.operation.id]??Od(Un.operation),lt=qs?Zr(qs):null;return u.jsx($p,{entry:Un,index:Wn,isCloseArmed:ee===Un.operation.id,accentValue:lt,dragging:ve?.kind==="chip"&&ve.sourceId===Un.operation.id&&ve.dragging,dragOffsetY:ve?.kind==="chip"&&ve.sourceId===Un.operation.id&&ve.dragging?ve.currentY-ve.startY:0,dropTarget:ve?.kind==="chip"&&ve.dragging===!0&&ve.dropGroupId===nt.groupId&&ve.dropGroupId===ve.sourceGroupId&&ve.dropIndex===Al&&ve.sourceId!==Un.operation.id,onArmClose:_n,onDisarmClose:Qe,onClose:w,onMinimize:S,onFocus:x,onKeyboardMove:Lr,onPointerDragStart:Qi,onOpenAccent:(Tl,On,tn,_s)=>{Je({kind:"chip",operationId:Tl,anchor:On,returnFocus:tn,requestedAction:_s})},onRename:L},Un.operation.id)})})]},nt.groupId??"__ungrouped__")})})]},ie.id)}),u.jsx("li",{children:u.jsxs("button",{type:"button",className:"side-bar-ghost-theater-row",onClick:pr,disabled:p,children:[u.jsx("span",{className:"side-bar-ghost-theater-anchor","aria-hidden":"true",children:u.jsx(qw,{})}),u.jsx("span",{className:"side-bar-ghost-theater-label",children:M("sidebar.theater.newTheater")})]})})]}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:is,onDoubleClick:Us,"aria-hidden":"true"}),It?xa.createPortal(u.jsx(JR,{anchor:It.anchor,viewportBounds:It.viewportBounds,placement:"cursor",catalog:d,canLaunch:f,renderKindIcon:y,onLaunchKind:(ie,Ie)=>{Ke(null),b(ie,Ie)},onClose:()=>Ke(null)},`${It.anchor.x}:${It.anchor.y}`),document.body):null,ze?.kind==="chip"&&gt?u.jsx(_E,{kind:"chip",operation:gt,groups:i.filter(ie=>ie.theaterId===gt.theaterId),accentKey:R.operationAccent[gt.id]??Od(gt),anchor:ze.anchor,actions:{onSetAccent:ie=>k(gt.id,ie),onSetGroupId:ie=>F(gt.id,ie),onCreateGroup:ie=>q(gt.theaterId,ie,gt.id)},onClose:Be}):ze?.kind==="group"&&Rn?u.jsx(_E,{kind:"group-header",group:Rn,anchor:ze.anchor,actions:{onSetColor:ie=>T(Rn.id,ie),onRename:ie=>$(Rn.id,ie),onUngroupAll:()=>V(Rn.id)},onClose:Be}):ze?.kind==="theater"&&$i?u.jsx(Sz,{theater:$i,groupCount:i.filter(ie=>ie.theaterId===$i.id).length,anchor:ze.anchor,onCreateGroup:ie=>{q($i.id,ie),Be()},onForgetTheater:()=>{B($i.id),Be()},onClose:Be}):null,u.jsx(eM,{open:en,onCancel:et,onConfirm:X}),C?null:u.jsx(l7,{})]})}function wM(e,t,n){const i=[...t].sort((d,f)=>d.order-f.order||d.createdAt-f.createdAt),s=i.map(d=>({groupId:d.id,group:d,entries:[]})),o={groupId:null,group:null,entries:[]},l=new Map(i.map(d=>[d.id,d]));for(const d of e){const f=d.operation.groupId??null;f!==null&&l.has(f)?s.find(m=>m.groupId===f)?.entries.push(d):o.entries.push(d)}return[...s,o]}function SM(e,t,n=fr("en")){return mz(n).map(({status:i,label:s})=>({status:i,label:s,entries:e.filter(o=>(o.status??"idle")===i).sort((o,l)=>{const d=t?.(o.operation.id),f=t?.(l.operation.id);return d===void 0&&f===void 0?0:d===void 0?1:f===void 0?-1:f-d})}))}function _z(e,t){return e.some(n=>t[n.id]==="awaiting")}function vz(e,t){const n=e.operation.groupId;if(!n)return null;const i=t.find(o=>o.id===n);if(!i)return null;const s=Zr(i.color);return s?{name:i.name,color:s}:null}function bz({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:s,operationNotifications:o,operationStatus:l,catalog:d,renderKindIcon:f}){return jm(t.filter(p=>p.theaterId===e),n).map(p=>{const m=vM(d,p),y=m?f(p.pluginId,m):null;return{operation:p,active:s===p.id,minimized:i.has(p.id),notificationCount:o[p.id]?1:0,status:_o(p,l),icon:y}})}function xM({theater:e,active:t,collapsed:n,statusAxis:i,statusActionsOpen:s,showStatusLiveTick:o,dragging:l,dropTarget:d,dragOffsetY:f,onSelectTheater:p,onToggleCollapsed:m,onToggleStatusAxis:y,onOpenActions:b,onOpenLaunch:w,onContextMenu:S,onPointerDragStart:x}){const k=rt(),L=_.useRef(!1),F=["side-bar-theater-header",t?"is-active":"",l?"side-bar-theater-header--dragging":"",d?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),q=l?{"--drag-dy":`${Math.round(f)}px`}:void 0,T=Q=>{Q.preventDefault(),S(Q.currentTarget.getBoundingClientRect())},$=Q=>{if(Q.target===Q.currentTarget){if(Q.key==="ContextMenu"||Q.shiftKey&&Q.key==="F10"){Q.preventDefault(),S(Q.currentTarget.getBoundingClientRect(),Q.currentTarget);return}Q.key!=="Enter"&&Q.key!==" "||(Q.preventDefault(),V())}},I=Q=>{Q.target instanceof Element&&Q.target.closest("button")||x(Q,e.id)},N=()=>{l&&(L.current=!0)},V=()=>{if(!t){p(e.id);return}m(e.id)},K=()=>{if(L.current){L.current=!1;return}V()};return u.jsxs("div",{role:"button",tabIndex:0,"aria-haspopup":"menu",className:F,style:q,onClick:K,onKeyDown:$,onContextMenu:T,onPointerDown:I,onPointerUp:N,"aria-current":t?"true":void 0,"aria-expanded":!n,title:t?n?k("sidebar.theater.expand",{theater:e.label}):k("sidebar.theater.collapse",{theater:e.label}):k("sidebar.theater.switchTo",{theater:e.label}),children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:Gw(e.label)}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx(Cz,{collapsed:n}),u.jsxs("span",{className:"side-bar-theater-row-controls",role:"group","aria-label":k("sidebar.theater.controlsAria",{theater:e.label}),children:[u.jsxs("button",{type:"button",className:"side-bar-status-axis-toggle","aria-label":k("sidebar.theater.sortByStatus"),"aria-pressed":i,title:k("sidebar.theater.sortByStatusTitle"),onClick:Q=>{Q.stopPropagation(),y()},children:[u.jsx(kz,{}),o?u.jsx("span",{className:"side-bar-status-axis-live-tick","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"side-bar-theater-split-control",role:"group","aria-label":k("sidebar.theater.operationControlsAria",{theater:e.label}),children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-launch-btn side-bar-theater-split-plus","aria-label":k("sidebar.theater.newOperation",{theater:e.label}),title:k("sidebar.theater.newOperation",{theater:e.label}),onClick:Q=>w(Q,e.id),children:u.jsx(qw,{})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-split-caret","aria-label":k("sidebar.theater.actions"),"aria-haspopup":"menu","aria-expanded":s,title:k("sidebar.theater.actions"),onClick:Q=>{Q.stopPropagation(),b(Q.currentTarget.getBoundingClientRect(),Q.currentTarget)},children:u.jsx(Ez,{})})]})]})]})}function wz({theater:e,entries:t,groups:n,collapsedGroups:i,operationAccent:s,collapsed:o,statusAxis:l,statusActionsOpen:d,showStatusLiveTick:f,statusLandingIds:p,dragging:m,dropBefore:y,dropAfter:b,dragOffsetY:w,onSelectTheater:S,onFocus:x,onToggleCollapsed:k,onToggleStatusAxis:L,onOpenActions:F,onOpenLaunch:q,onContextMenu:T,onPointerDragStart:$}){const I=rt(),N=wM(t,n),V=SM(t,Ww,I),K=pM(),Q=N.some(Y=>Y.group!==null);return u.jsxs("li",{className:["side-bar-theater-section",y?"side-bar-theater-section--drop-before":"",b?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[u.jsx(xM,{theater:e,active:!1,collapsed:o,statusAxis:l,statusActionsOpen:d,showStatusLiveTick:f,dragging:m,dropTarget:y,dragOffsetY:w,onSelectTheater:S,onToggleCollapsed:k,onToggleStatusAxis:L,onOpenActions:F,onOpenLaunch:q,onContextMenu:T,onPointerDragStart:$}),!o&&(l?V.length:N.length)>0?u.jsx("ol",{className:"side-bar-theater-groups","aria-label":I("sidebar.theater.operationsAria",{theater:e.label}),children:l?V.map(Y=>u.jsx(bM,{theaterId:e.id,section:Y,unseenCount:Y.status==="idle"?Y.entries.filter(B=>K.has(B.operation.id)).length:void 0,children:Y.entries.map((B,M)=>{const D=s[B.operation.id]??Od(B.operation),j=D?Zr(D):null;return u.jsx($p,{entry:B,index:M,isCloseArmed:!1,accentValue:j,groupMark:vz(B,n),statusAxis:!0,idleUnseen:K.has(B.operation.id),statusLanded:p.has(B.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},B.operation.id)})},Y.status)):N.map(Y=>{const B=Y.groupId!==null&&i.has(Y.groupId),M=Y.group?Zr(Y.group.color):null;return u.jsxs("li",{className:Y.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:M?{"--grp-color":M}:void 0,children:[Y.group?u.jsx(oM,{group:Y.group,count:Y.entries.length,collapsed:B,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:D=>qB(e.id,D),onContextMenu:()=>{},onPointerDragStart:()=>{}}):Q&&Y.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":I("sidebar.ungrouped.aria"),children:u.jsx("span",{children:I("sidebar.ungrouped.label")})}):null,B?null:u.jsx("ol",{className:"side-bar-group-chips","aria-label":Y.group?Y.group.name:I("sidebar.ungrouped.label"),children:Y.entries.map((D,j)=>{const A=s[D.operation.id]??Od(D.operation),O=A?Zr(A):null;return u.jsx($p,{entry:D,index:j,isCloseArmed:!1,accentValue:O,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},D.operation.id)})})]},Y.groupId??"__ungrouped__")})}):null]})}function Sz({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:s,onClose:o}){const l=rt(),[d,f]=_.useState(!1),[p,m]=_.useState(()=>l("sidebar.theater.defaultGroupName",{n:t+1})),y=_.useRef(!1),b=_.useRef(null),w=_.useRef(null),[S,x]=_.useState(n.bottom+6);_.useLayoutEffect(()=>{const L=w.current?.getBoundingClientRect().height??0,F=window.innerHeight-L-8;x(Math.max(8,Math.min(n.bottom+6,F)))},[n,d]),_.useEffect(()=>{d&&b.current?.select()},[d]),_.useEffect(()=>{const L=F=>{F.key==="Escape"&&(F.preventDefault(),o())};return window.addEventListener("keydown",L),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",L),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const k=()=>{const L=p.trim();L&&i(L)};return xa.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:u.jsxs("div",{ref:w,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":l("sidebar.theater.actionsMenuAria",{theater:e.label}),style:{position:"fixed",left:n.left,top:S},onPointerDown:L=>L.stopPropagation(),children:[d?u.jsx("input",{ref:b,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:L=>m(L.target.value),onCompositionStart:()=>{y.current=!0},onCompositionEnd:()=>{y.current=!1},onKeyDown:L=>{L.key==="Enter"&&!y.current&&(L.preventDefault(),k()),L.key==="Escape"&&(L.preventDefault(),f(!1))},onBlur:()=>f(!1),"aria-label":l("sidebar.theater.newGroupNameAria"),placeholder:l("sidebar.theater.groupNamePlaceholder")}):u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>f(!0),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(qw,{})}),u.jsx("span",{className:"theater-menu-label",children:l("sidebar.theater.newGroup")})]}),u.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:s,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(Tz,{})}),u.jsx("span",{className:"theater-menu-label",children:l("sidebar.theater.forget")})]})]})}),document.body)}function xz(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+TE?t.scrollTop-=RE:e>n.bottom-TE&&(t.scrollTop+=RE)}function Cz({collapsed:e}){return u.jsx("svg",{className:`side-bar-theater-chevron${e?" is-collapsed":""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function kz(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"4",cy:"4",r:"1.5",fill:"currentColor"}),u.jsx("path",{d:"M8 4h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),u.jsx("circle",{cx:"4",cy:"8",r:"1.5",fill:"currentColor"}),u.jsx("path",{d:"M8 8h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),u.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),u.jsx("path",{d:"M8 12h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Ez(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"3.2",cy:"8",r:"1.35",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.35",fill:"currentColor"}),u.jsx("circle",{cx:"12.8",cy:"8",r:"1.35",fill:"currentColor"})]})}function qw(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function Gw(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>Az(i)):CM(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function Az(e){return CM(e).slice(0,1)}function CM(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function Tz(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Rz({theaters:e,operations:t,activeTheaterId:n,addingTheater:i,onSelectTheater:s,onAddTheater:o,style:l,containerRef:d}){const f=rt(),p=[e.map(m=>{const y=t.filter(b=>b.theaterId===m.id).length;return{key:m.id,role:"menuitemradio",label:m.label,checked:m.id===n,mark:Gw(m.label),meta:f(y===1?"chrome.commandBand.opCount_one":"chrome.commandBand.opCount_other",{count:y}),onSelect:()=>s(m.id)}}),[{key:"__add-theater__",role:"menuitem",label:f("chrome.commandBand.addTheater"),action:!0,disabled:i,onSelect:o}]];return u.jsx(kM,{menuLabel:f("chrome.commandBand.switchTheater"),sections:p,style:l,containerRef:d})}function Mz({operations:e,activeOperationId:t,theaterLabel:n,onSelectOperation:i,onRenameOperation:s,onNewOperation:o,style:l,containerRef:d}){const f=rt(),p=[e.map(m=>({key:m.id,role:"menuitemradio",label:m.title,checked:m.id===t,meta:Nz(m),onSelect:()=>i(m.id)})),[...s!==null?[{key:"__rename-operation__",role:"menuitem",label:f("chrome.commandBand.renameCurrentOperation"),onSelect:s}]:[],{key:"__new-operation__",role:"menuitem",label:f("chrome.commandBand.newOperationIn",{theater:n}),action:!0,onSelect:o}]];return u.jsx(kM,{menuLabel:f("chrome.commandBand.switchOperation"),sections:p,emptyNote:e.length===0?f("chrome.commandBand.noOperationsInTheater"):null,style:l,containerRef:d})}function kM({menuLabel:e,sections:t,emptyNote:n,style:i,containerRef:s}){const o=()=>Array.from(s.current?.querySelectorAll(".command-band-menu-item:not(:disabled)")??[]);_.useEffect(()=>{const f=o();(f.find(p=>p.getAttribute("aria-checked")==="true")??f[0])?.focus()},[]);const l=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),y=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[y]?.focus()},d=t.filter(f=>f.length>0);return u.jsxs("div",{ref:s,className:"command-band-menu",role:"menu","aria-label":e,style:i,onKeyDown:l,children:[n?u.jsx("p",{className:"command-band-menu-empty",children:n}):null,d.map((f,p)=>u.jsxs(_.Fragment,{children:[p>0||n?u.jsx("div",{className:"command-band-menu-divider","aria-hidden":"true"}):null,f.map(m=>u.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:[u.jsx("span",{className:"command-band-menu-check","aria-hidden":"true",children:m.checked?u.jsx(Lz,{}):null}),m.mark!==void 0?u.jsx("span",{className:"command-band-theater-mark","aria-hidden":"true",children:m.mark}):null,u.jsx("span",{className:"command-band-menu-label",children:m.label}),m.meta?u.jsx("span",{className:"command-band-menu-meta",children:m.meta}):null]},m.key))]},f[0]?.key??p))]})}function y_(){return u.jsx("span",{className:"command-band-trigger-caret","aria-hidden":"true",children:u.jsx("svg",{viewBox:"0 0 10 10",children:u.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})}function Lz(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Nz(e){const t=e.payload.cliLabel;if(typeof t=="string")return t;const n=e.payload.cliId;return typeof n=="string"?n:null}const Up="fleet-console.rail.activePanelId",EM="fleet-console.rail.chromeExpanded",AM="fleet-console.rail.panelBehavior",TM="fleet-console.rail.overlayAlpha",Oz="fleet-console.repository.source",gb=new Set;let di={activeRailPanelId:Wz(),railChromeExpanded:qz(),panelExtraWidth:0,panelBehavior:Gz(),overlayAlpha:Kz()};function ah(e){return gb.add(e),()=>{gb.delete(e)}}function oh(){return di}function Iz(e){di.activeRailPanelId!==e&&(Cl({...di,activeRailPanelId:e,panelExtraWidth:0}),Vw(e))}function Dz(e){const t=di.activeRailPanelId===e?null:e;Cl({...di,activeRailPanelId:t,panelExtraWidth:0}),Vw(t)}function ME(e){Iz(e)}function jz(){di.activeRailPanelId!==null&&(Cl({...di,activeRailPanelId:null,panelExtraWidth:0}),Vw(null))}function yb(e){di.railChromeExpanded!==e&&(Cl({...di,railChromeExpanded:e}),Vz(e))}function Kw(){yb(!di.railChromeExpanded)}function Bz(e){di.panelBehavior!==e&&(Cl({...di,panelBehavior:e}),Yz(e))}function Pz(){Bz(di.panelBehavior==="push"?"overlay":"push")}function zz(e){di.overlayAlpha!==e&&(Cl({...di,overlayAlpha:e}),Xz(e))}function $z(e,t){if(e!==di.activeRailPanelId)return;const n=t===null||!Number.isFinite(t)?0:t,i=Math.max(0,Math.round(n)),s=typeof window<"u"?Math.min(i,Math.max(0,window.innerWidth-548)):i;s!==di.panelExtraWidth&&Cl({...di,panelExtraWidth:s})}function RM(){return _.useSyncExternalStore(ah,oh).activeRailPanelId}function MM(){return _.useSyncExternalStore(ah,oh).railChromeExpanded}function Fz(){return _.useSyncExternalStore(ah,oh).panelExtraWidth}function Hz(){return _.useSyncExternalStore(ah,oh).panelBehavior}function Uz(){return _.useSyncExternalStore(ah,oh).overlayAlpha}function Wz(){try{const e=localStorage.getItem(Up);if(e==="diff"||e==="history"){try{localStorage.setItem(Up,"repository"),e==="history"&&localStorage.setItem(Oz,"history")}catch{}return"repository"}return e}catch{return null}}function qz(){try{return localStorage.getItem(EM)!=="0"}catch{return!0}}function Gz(){try{const e=localStorage.getItem(AM);return e==="overlay"||e==="push"?e:"push"}catch{return"push"}}function Kz(){try{const e=localStorage.getItem(TM);return e==="90"||e==="75"||e==="60"?Number(e):100}catch{return 100}}function Vw(e){try{e===null?localStorage.removeItem(Up):localStorage.setItem(Up,e)}catch{}}function Vz(e){try{localStorage.setItem(EM,e?"1":"0")}catch{}}function Yz(e){try{localStorage.setItem(AM,e)}catch{}}function Xz(e){try{localStorage.setItem(TM,String(e))}catch{}}function Cl(e){di=e;for(const t of gb)t()}const LE={browserAria:"Font browser",searchLabel:"Search fonts",searchPlaceholder:"Search installed fonts",loading:"Loading installed fonts…",choicesAria:"Font choices",builtInGroup:"Built-in",installedGroup:"Installed on this machine",noMatch:"No fonts match this search.",preview:"Preview",available:"Available",unavailable:"Unavailable",fontSizeAria:"Font size",decreaseSizeAria:"Decrease font size",sizeValueAria:"Font size value",increaseSizeAria:"Increase font size",sizeSliderAria:"Font size slider",monospace:"Monospace",systemFont:"System font",savedSystemFont:"Saved system font"};function Zz(e){return e?{...LE,...e}:LE}function LM(e){const{sizeRange:t}=e,n=Zz(e.labels),[i,s]=_.useState(""),[o,l]=_.useState(e.size),d=_.useRef(Promise.resolve()),f=_.useId(),p=_.useMemo(()=>Jz(e,n),[e,n]),m=_.useMemo(()=>Qz(p,i),[p,i]),y=_.useMemo(()=>m.map((N,V)=>({row:N,index:V})),[m]),[b,w]=_.useState(()=>e$(p,e.selected)),S=p.find(N=>Wp(N.selection,e.selected))??null,x=y[Math.min(b,Math.max(0,y.length-1))]?.row??null,k=`${f}-built-ins`,L=`${f}-installed`;_.useEffect(()=>{l(e.size)},[e.size]),_.useEffect(()=>{b>=y.length&&w(Math.max(0,y.length-1))},[b,y.length]);const F=_.useCallback(N=>{const V=OE(N,t);l(V),d.current=d.current.catch(()=>{}).then(()=>e.onSizeCommit(V))},[e.onSizeCommit,t]),q=_.useCallback(N=>{m.length&&w(V=>(V+N+m.length)%m.length)},[m.length]),T=_.useCallback(()=>{x&&!x.unavailable&&e.onSelectionChange(x.selection)},[x,e]),$=_.useCallback((N,V)=>{w(N),e.onSelectionChange(V)},[e]),I=N=>{N.key==="ArrowDown"?(N.preventDefault(),q(1)):N.key==="ArrowUp"?(N.preventDefault(),q(-1)):N.key==="Home"?(N.preventDefault(),w(0)):N.key==="End"?(N.preventDefault(),w(Math.max(0,m.length-1))):(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),T())};return u.jsx("section",{className:"fc-font-browser","aria-label":n.browserAria,"data-disabled":e.disabled?"true":void 0,children:u.jsxs("div",{className:"fc-font-browser__panes",children:[u.jsxs("div",{className:"fc-font-browser__chooser",children:[u.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${f}-search`,children:n.searchLabel}),u.jsx("input",{id:`${f}-search`,className:"fc-font-browser__search",type:"search",value:i,disabled:e.disabled,placeholder:n.searchPlaceholder,onChange:N=>{s(N.currentTarget.value),w(0)}}),e.loading?u.jsx("p",{className:"fc-font-browser__state",role:"status",children:n.loading}):null,e.error?u.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,u.jsxs("div",{id:f,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":n.choicesAria,"aria-activedescendant":x?NM(f,b):void 0,"aria-busy":e.loading||void 0,onKeyDown:I,children:[u.jsx(NE,{groupId:k,label:n.builtInGroup,unavailableLabel:n.unavailable,rows:y.filter(({row:N})=>N.source==="builtin"),activeRow:x,selected:e.selected,listboxId:f,disabled:e.disabled,onSelect:$}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(NE,{groupId:L,label:n.installedGroup,unavailableLabel:n.unavailable,rows:y.filter(({row:N})=>N.source==="system"),activeRow:x,selected:e.selected,listboxId:f,disabled:e.disabled,onSelect:$}),!e.loading&&!y.length?u.jsx("p",{className:"fc-font-browser__state",children:n.noMatch}):null]})]}),u.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[u.jsxs("div",{className:"fc-font-browser__preview-head",children:[u.jsx("span",{className:"fc-font-browser__preview-label",children:n.preview}),u.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?n.unavailable:n.available})]}),u.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${o}px`},children:e.previewText}),u.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":n.fontSizeAria,children:[u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o<=t.min,onClick:()=>F(o-t.step),"aria-label":n.decreaseSizeAria,children:"−"}),u.jsxs("output",{className:"fc-font-browser__size-value","aria-label":n.sizeValueAria,children:[o,"px"]}),u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o>=t.max,onClick:()=>F(o+t.step),"aria-label":n.increaseSizeAria,children:"+"})]}),u.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:o,disabled:e.disabled,"aria-label":n.sizeSliderAria,onChange:N=>l(OE(Number(N.currentTarget.value),t)),onPointerUp:N=>F(Number(N.currentTarget.value)),onKeyUp:N=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(N.key)&&F(Number(N.currentTarget.value))}})]})]})})}function NE({groupId:e,label:t,unavailableLabel:n,rows:i,activeRow:s,selected:o,listboxId:l,disabled:d,onSelect:f}){return u.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[u.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),i.map(({row:p,index:m})=>u.jsxs("button",{id:NM(l,m),type:"button",className:`fc-font-browser__row${Wp(p.selection,s?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Wp(p.selection,o),disabled:d||p.unavailable,onClick:()=>f(m,p.selection),children:[u.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:p.previewFamily},children:p.label}),p.description?u.jsx("span",{className:"fc-font-browser__row-meta",children:p.description}):null,p.unavailable?u.jsx("span",{className:"fc-font-browser__row-status",children:n}):null]},p.id))]})}function Jz(e,t){const n=new Set,i=e.builtIns.flatMap(l=>{const d=[l.id,l.label,...l.aliases??[]].map(Id);return d.some(f=>n.has(f))?[]:(d.forEach(f=>n.add(f)),[{id:`builtin-${l.id}`,label:l.label,family:l.family,previewFamily:l.family,source:"builtin",selection:{source:"builtin",id:l.id},description:l.description,unavailable:!1}])}),s=e.installedFonts.map(l=>({id:`system-${Id(l.family)}`,label:l.family,family:l.family,previewFamily:Dp(l.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:l.family},description:l.monospace?t.monospace:t.systemFont,unavailable:!bB(l.family)})),o=e.selected.source==="system"?e.selected.familyName:null;return o!==null&&!s.some(l=>l.family===o)&&s.unshift({id:`system-${Id(o)}`,label:e.selectedSystemFont??o,family:o,previewFamily:Dp(o,e.fallbackStack),source:"system",selection:{source:"system",familyName:o},description:t.savedSystemFont,unavailable:!0}),[...i,...s]}function Qz(e,t){const n=Id(t);return n?e.filter(i=>Id(`${i.label} ${i.description??""}`).includes(n)):e}function Id(e){return e.trim().toLocaleLowerCase()}function NM(e,t){return`${e}-option-${t}`}function e$(e,t){const n=e.findIndex(i=>Wp(i.selection,t));return n>=0?n:0}function Wp(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function OE(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 t$="/api/v1/settings/fonts/system";class tl extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function n$(e){if(!IM(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new tl("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(i$)}}async function OM(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new tl("System font fetching is unavailable in this environment.");let n;try{n=await t(t$,{method:"GET",signal:e.signal})}catch(s){throw s instanceof DOMException&&s.name==="AbortError"?s:new tl("System fonts could not be loaded.")}if(!n.ok)throw new tl("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new tl("System font response is not valid JSON.",n.status)}return n$(i)}function i$(e){if(!IM(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new tl("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function r$(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function IM(e,t){return r$(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const IE=250,s$=5e3,DE=1,a$=1013,o$=4e3,l$=4001;function c$(e){const t=new AbortController,n=new TextEncoder;let i=IE,s=null,o=null,l=null,d=!1;const f=()=>{o?.dispose(),o=null},p=(b,w)=>{l={cols:b,rows:w},s?.readyState===DE&&s.send(JSON.stringify({type:"resize",cols:b,rows:w}))},m=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:b}=await d$(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await y(u$(b,e.location,e.wsPath),e),i=IE}catch(b){if(t.signal.aborted)return;e.onStatus?.("connecting",b instanceof Error?b.message:String(b))}await f$(i,t.signal),i=Math.min(i*2,s$)}},y=async(b,w)=>{await new Promise((S,x)=>{const k=(w.webSocketFactory??h$)(b);s=k,k.binaryType="arraybuffer",k.onopen=()=>{w.onStatus?.("live"),f(),o=w.terminal.onData(L=>{k.readyState===DE&&k.send(n.encode(L))}),l&&p(l.cols,l.rows)},k.onmessage=L=>{L.data instanceof ArrayBuffer&&w.terminal.write(new Uint8Array(L.data))},k.onerror=()=>{x(new Error("Terminal WebSocket error"))},k.onclose=L=>{f(),s===k&&(s=null);const F=L?.code;F===o$?(t.abort(),w.onStatus?.("closed","terminal_replaced")):F===l$?(t.abort(),w.onStatus?.("closed","terminal_closed"),w.onExit?.()):F===a$&&(t.abort(),w.onStatus?.("closed","terminal_unavailable")),S()}})};return{start:()=>{d||(d=!0,m())},resize:p,dispose:()=>{t.abort(),f(),e.onStatus?.("closed"),s?.close(),s=null}}}function u$(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function d$(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 s=await i.json();if(typeof s.ticket!="string"||typeof s.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:s.ticket,ttlMs:s.ttlMs}}function h$(e){return new WebSocket(e)}async function f$(e,t){await new Promise(n=>{const i=()=>{clearTimeout(s),t.removeEventListener("abort",i),n()},s=setTimeout(i,e);t.addEventListener("abort",i)})}var p$=2,m$=1,g$=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")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),l={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=l.top+l.bottom,f=l.right+l.left,p=i-d,m=s-f-t;return{cols:Math.max(p$,Math.floor(m/e.css.cell.width)),rows:Math.max(m$,Math.floor(p/e.css.cell.height))}}};var __=[[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]],y$=[[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]],li;function _$(e,t){let n=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(s=n+i>>1,e>t[s][1])n=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var v$=class{constructor(){if(this.version="6",!li){li=new Uint8Array(65536),li.fill(1),li[0]=0,li.fill(0,1,32),li.fill(0,127,160),li.fill(2,4352,4448),li[9001]=2,li[9002]=2,li.fill(2,11904,42192),li[12351]=1,li.fill(2,44032,55204),li.fill(2,63744,64256),li.fill(2,65040,65050),li.fill(2,65072,65136),li.fill(2,65280,65377),li.fill(2,65504,65511);for(let t=0;t<__.length;++t)li.fill(0,__[t][0],__[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?li[t]:_$(t,y$)?0:t>=131072&&t<=196605||t>=196608&&t<=262141?2:1}charProperties(t,n){let i=this.wcwidth(t),s=i===0&&n!==0;if(s){let o=Gp.extractWidth(n);o===0?s=!1:o>i&&(i=o)}return Gp.createPropertyValue(0,i,s)}},b$=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?jE.isErrorNoTelemetry(t)?new jE(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)}},w$=new b$;function v_(e){S$(e)||w$.onUnexpectedError(e)}var _b="Canceled";function S$(e){return e instanceof x$?!0:e instanceof Error&&e.name===_b&&e.message===_b}var x$=class extends Error{constructor(){super(_b),this.name=this.message}},jE=class vb extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof vb)return t;let n=new vb;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function C$(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var k$;(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 s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(k$||={});var DM;(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*s(T){yield T}e.single=s;function o(T){return t(T)?T:s(T)}e.wrap=o;function l(T){return T||n}e.from=l;function*d(T){for(let $=T.length-1;$>=0;$--)yield T[$]}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,$){let I=0;for(let N of T)if($(N,I++))return!0;return!1}e.some=m;function y(T,$){for(let I of T)if($(I))return I}e.find=y;function*b(T,$){for(let I of T)$(I)&&(yield I)}e.filter=b;function*w(T,$){let I=0;for(let N of T)yield $(N,I++)}e.map=w;function*S(T,$){let I=0;for(let N of T)yield*$(N,I++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,I){let N=I;for(let V of T)N=$(N,V);return N}e.reduce=k;function*L(T,$,I=T.length){for($<0&&($+=T.length),I<0?I+=T.length:I>T.length&&(I=T.length);$<I;$++)yield T[$]}e.slice=L;function F(T,$=Number.POSITIVE_INFINITY){let I=[];if($===0)return[I,T];let N=T[Symbol.iterator]();for(let V=0;V<$;V++){let K=N.next();if(K.done)return[I,e.empty()];I.push(K.value)}return[I,{[Symbol.iterator](){return N}}]}e.consume=F;async function q(T){let $=[];for await(let I of T)$.push(I);return Promise.resolve($)}e.asyncToArray=q})(DM||={});function jM(e){if(DM.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 E$(...e){return BM(()=>jM(e))}function BM(e){return{dispose:C$(()=>{e()})}}var PM=class zM{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{jM(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?zM.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)}};PM.DISABLE_DISPOSED_WARNING=!1;var Yw=PM,qp=class{constructor(){this._store=new Yw,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)}};qp.None=Object.freeze({dispose(){}});var A$=globalThis.performance&&typeof globalThis.performance.now=="function",T$=class $M{static create(t){return new $M(t)}constructor(t){this._now=A$&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},R$;(e=>{e.None=()=>qp.None;function t(B,M){return y(B,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function n(B){return(M,D=null,j)=>{let A=!1,O;return O=B(C=>{if(!A)return O?O.dispose():A=!0,M.call(D,C)},null,j),A&&O.dispose(),O}}e.once=n;function i(B,M,D){return p((j,A=null,O)=>B(C=>j.call(A,M(C)),null,O),D)}e.map=i;function s(B,M,D){return p((j,A=null,O)=>B(C=>{M(C),j.call(A,C)},null,O),D)}e.forEach=s;function o(B,M,D){return p((j,A=null,O)=>B(C=>M(C)&&j.call(A,C),null,O),D)}e.filter=o;function l(B){return B}e.signal=l;function d(...B){return(M,D=null,j)=>{let A=E$(...B.map(O=>O(C=>M.call(D,C))));return m(A,j)}}e.any=d;function f(B,M,D,j){let A=D;return i(B,O=>(A=M(A,O),A),j)}e.reduce=f;function p(B,M){let D,j={onWillAddFirstListener(){D=B(A.fire,A)},onDidRemoveLastListener(){D?.dispose()}},A=new no(j);return M?.add(A),A.event}function m(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function y(B,M,D=100,j=!1,A=!1,O,C){let z,P,R,W=0,G,U={leakWarningThreshold:O,onWillAddFirstListener(){z=B(ne=>{W++,P=M(P,ne),j&&!R&&(ee.fire(P),P=void 0),G=()=>{let me=P;P=void 0,R=void 0,(!j||W>1)&&ee.fire(me),W=0},typeof D=="number"?(clearTimeout(R),R=setTimeout(G,D)):R===void 0&&(R=0,queueMicrotask(G))})},onWillRemoveListener(){A&&W>0&&G?.()},onDidRemoveLastListener(){G=void 0,z.dispose()}},ee=new no(U);return C?.add(ee),ee.event}e.debounce=y;function b(B,M=0,D){return e.debounce(B,(j,A)=>j?(j.push(A),j):[A],M,void 0,!0,void 0,D)}e.accumulate=b;function w(B,M=(j,A)=>j===A,D){let j=!0,A;return o(B,O=>{let C=j||!M(O,A);return j=!1,A=O,C},D)}e.latch=w;function S(B,M,D){return[e.filter(B,M,D),e.filter(B,j=>!M(j),D)]}e.split=S;function x(B,M=!1,D=[],j){let A=D.slice(),O=B(P=>{A?A.push(P):z.fire(P)});j&&j.add(O);let C=()=>{A?.forEach(P=>z.fire(P)),A=null},z=new no({onWillAddFirstListener(){O||(O=B(P=>z.fire(P)),j&&j.add(O))},onDidAddFirstListener(){A&&(M?setTimeout(C):C())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return j&&j.add(z),z.event}e.buffer=x;function k(B,M){return(D,j,A)=>{let O=M(new F);return B(function(C){let z=O.evaluate(C);z!==L&&D.call(j,z)},void 0,A)}}e.chain=k;let L=Symbol("HaltChainable");class F{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(D=>(M(D),D)),this}filter(M){return this.steps.push(D=>M(D)?D:L),this}reduce(M,D){let j=D;return this.steps.push(A=>(j=M(j,A),j)),this}latch(M=(D,j)=>D===j){let D=!0,j;return this.steps.push(A=>{let O=D||!M(A,j);return D=!1,j=A,O?A:L}),this}evaluate(M){for(let D of this.steps)if(M=D(M),M===L)break;return M}}function q(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.on(M,j),O=()=>B.removeListener(M,j),C=new no({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromNodeEventEmitter=q;function T(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.addEventListener(M,j),O=()=>B.removeEventListener(M,j),C=new no({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromDOMEventEmitter=T;function $(B){return new Promise(M=>n(B)(M))}e.toPromise=$;function I(B){let M=new no;return B.then(D=>{M.fire(D)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=I;function N(B,M){return B(D=>M.fire(D))}e.forward=N;function V(B,M,D){return M(D),B(j=>M(j))}e.runAndSubscribe=V;class K{constructor(M,D){this._observable=M,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new no(j),D&&D.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,D){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,M){return new K(B,M).emitter.event}e.fromObservable=Q;function Y(B){return(M,D,j)=>{let A=0,O=!1,C={beginUpdate(){A++},endUpdate(){A--,A===0&&(B.reportChanges(),O&&(O=!1,M.call(D)))},handlePossibleChange(){},handleChange(){O=!0}};B.addObserver(C),B.reportChanges();let z={dispose(){B.removeObserver(C)}};return j instanceof Yw?j.add(z):Array.isArray(j)&&j.push(z),z}}e.fromObservableLight=Y})(R$||={});var bb=class wb{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${wb._idPool++}`,wb.all.add(this)}start(t){this._stopWatch=new T$,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}}};bb.all=new Set,bb._idPool=0;var M$=bb,L$=-1,FM=class HM{constructor(t,n,i=(HM._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 s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,l]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(d),console.warn(o);let f=new I$(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,s]of this._stacks)(!t||n<s)&&(t=[i,s],n=s);return t}};FM._idPool=1;var N$=FM,O$=class UM{constructor(t){this.value=t}static create(){let t=new Error;return new UM(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},I$=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},D$=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},j$=0,b_=class{constructor(t){this.value=t,this.id=j$++}},B$=2,P$,no=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new N$(t?.onListenerError??v_,this._options?.leakWarningThreshold??L$):void 0,this._perfMon=this._options?._profName?new M$(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 D$(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||v_)(p),qp.None}if(this._disposed)return qp.None;n&&(t=t.bind(n));let s=new b_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=O$.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof b_?(this._deliveryQueue??=new z$,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=BM(()=>{o?.(),this._removeListener(s)});return i instanceof Yw?i.add(l):Array.isArray(i)&&i.push(l),l},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 s=this._deliveryQueue.current===this;if(this._size*B$<=n.length){let o=0;for(let l=0;l<n.length;l++)n[l]?n[o++]=n[l]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||v_;if(!i){t.value(n);return}try{t.value(n)}catch(s){i(s)}}_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 b_)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}},z$=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}},Gp=class lp{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new no,this.onChange=this._onChange.event;let t=new v$;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,s=t.length;for(let o=0;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return n+this.wcwidth(l);let p=t.charCodeAt(o);56320<=p&&p<=57343?l=(l-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(l,i),f=lp.extractWidth(d);lp.extractShouldJoin(d)&&(f-=lp.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},w_=[[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]],$$=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],S_=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],F$=[[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]],ca;function BE(e,t){let n=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(s=n+i>>1,e>t[s][1])n=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var H$=class{constructor(){if(this.version="11",!ca){ca=new Uint8Array(65536),ca.fill(1),ca[0]=0,ca.fill(0,1,32),ca.fill(0,127,160);for(let t=0;t<w_.length;++t)ca.fill(0,w_[t][0],w_[t][1]+1);for(let t=0;t<S_.length;++t)ca.fill(2,S_[t][0],S_[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?ca[t]:BE(t,$$)?0:BE(t,F$)?2:1}charProperties(t,n){let i=this.wcwidth(t),s=i===0&&n!==0;if(s){let o=Gp.extractWidth(n);o===0?s=!1:o>i&&(i=o)}return Gp.createPropertyValue(0,i,s)}},U$=class{activate(t){t.unicode.register(new H$)}dispose(){}};var W$=(e,t,n,i)=>{for(var s=t,o=e.length-1,l;o>=0;o--)(l=e[o])&&(s=l(s)||s);return s},q$=(e,t)=>(n,i)=>t(n,i,e),G$=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?PE.isErrorNoTelemetry(e)?new PE(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)}},K$=new G$;function x_(e){V$(e)||K$.onUnexpectedError(e)}var Sb="Canceled";function V$(e){return e instanceof Y$?!0:e instanceof Error&&e.name===Sb&&e.message===Sb}var Y$=class extends Error{constructor(){super(Sb),this.name=this.message}},PE=class xb extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof xb)return t;let n=new xb;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},X$;(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 s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(X$||={});function Z$(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var WM;(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*s(T){yield T}e.single=s;function o(T){return t(T)?T:s(T)}e.wrap=o;function l(T){return T||n}e.from=l;function*d(T){for(let $=T.length-1;$>=0;$--)yield T[$]}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,$){let I=0;for(let N of T)if($(N,I++))return!0;return!1}e.some=m;function y(T,$){for(let I of T)if($(I))return I}e.find=y;function*b(T,$){for(let I of T)$(I)&&(yield I)}e.filter=b;function*w(T,$){let I=0;for(let N of T)yield $(N,I++)}e.map=w;function*S(T,$){let I=0;for(let N of T)yield*$(N,I++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,I){let N=I;for(let V of T)N=$(N,V);return N}e.reduce=k;function*L(T,$,I=T.length){for($<0&&($+=T.length),I<0?I+=T.length:I>T.length&&(I=T.length);$<I;$++)yield T[$]}e.slice=L;function F(T,$=Number.POSITIVE_INFINITY){let I=[];if($===0)return[I,T];let N=T[Symbol.iterator]();for(let V=0;V<$;V++){let K=N.next();if(K.done)return[I,e.empty()];I.push(K.value)}return[I,{[Symbol.iterator](){return N}}]}e.consume=F;async function q(T){let $=[];for await(let I of T)$.push(I);return Promise.resolve($)}e.asyncToArray=q})(WM||={});function qM(e){if(WM.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 GM(...e){return zi(()=>qM(e))}function zi(e){return{dispose:Z$(()=>{e()})}}var KM=class VM{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{qM(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?VM.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)}};KM.DISABLE_DISPOSED_WARNING=!1;var Mc=KM,fs=class{constructor(){this._store=new Mc,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)}};fs.None=Object.freeze({dispose(){}});var Vu=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}},Xw=typeof process<"u"&&"title"in process,$m=Xw?"node":navigator.userAgent,J$=Xw?"node":navigator.platform,Q$=$m.includes("Firefox"),e9=$m.includes("Edge"),YM=/^((?!chrome|android).)*safari/i.test($m);function t9(){if(!YM)return 0;let e=$m.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}J$.indexOf("Linux")>=0;var n9="",gi=0,yi=0,_i=0,Pn=0,Wr={css:"#00000000",rgba:0},Gi;(e=>{function t(s,o,l,d){return d!==void 0?`#${Vo(s)}${Vo(o)}${Vo(l)}${Vo(d)}`:`#${Vo(s)}${Vo(o)}${Vo(l)}`}e.toCss=t;function n(s,o,l,d=255){return(s<<24|o<<16|l<<8|d)>>>0}e.toRgba=n;function i(s,o,l,d){return{css:e.toCss(s,o,l,d),rgba:e.toRgba(s,o,l,d)}}e.toColor=i})(Gi||={});var bd;(e=>{function t(f,p){if(Pn=(p.rgba&255)/255,Pn===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,y=p.rgba>>16&255,b=p.rgba>>8&255,w=f.rgba>>24&255,S=f.rgba>>16&255,x=f.rgba>>8&255;gi=w+Math.round((m-w)*Pn),yi=S+Math.round((y-S)*Pn),_i=x+Math.round((b-x)*Pn);let k=Gi.toCss(gi,yi,_i),L=Gi.toRgba(gi,yi,_i);return{css:k,rgba:L}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let y=dl.ensureContrastRatio(f.rgba,p.rgba,m);if(y)return Gi.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=i;function s(f){let p=(f.rgba|255)>>>0;return[gi,yi,_i]=dl.toChannels(p),{css:Gi.toCss(gi,yi,_i),rgba:p}}e.opaque=s;function o(f,p){return Pn=Math.round(p*255),[gi,yi,_i]=dl.toChannels(f.rgba),{css:Gi.toCss(gi,yi,_i,Pn),rgba:Gi.toRgba(gi,yi,_i,Pn)}}e.opacity=o;function l(f,p){return Pn=f.rgba&255,o(f,Pn*p/255)}e.multiplyOpacity=l;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(bd||={});var i9;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return gi=parseInt(s.slice(1,2).repeat(2),16),yi=parseInt(s.slice(2,3).repeat(2),16),_i=parseInt(s.slice(3,4).repeat(2),16),Gi.toColor(gi,yi,_i);case 5:return gi=parseInt(s.slice(1,2).repeat(2),16),yi=parseInt(s.slice(2,3).repeat(2),16),_i=parseInt(s.slice(3,4).repeat(2),16),Pn=parseInt(s.slice(4,5).repeat(2),16),Gi.toColor(gi,yi,_i,Pn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return gi=parseInt(o[1]),yi=parseInt(o[2]),_i=parseInt(o[3]),Pn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),Gi.toColor(gi,yi,_i,Pn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[gi,yi,_i,Pn]=t.getImageData(0,0,1,1).data,Pn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gi.toRgba(gi,yi,_i,Pn),css:s}}e.toColor=i})(i9||={});var Hi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,s,o){let l=i/255,d=s/255,f=o/255,p=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+m*.7152+y*.0722}e.relativeLuminance2=n})(Hi||={});var dl;(e=>{function t(l,d){if(Pn=(d&255)/255,Pn===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,y=l>>24&255,b=l>>16&255,w=l>>8&255;return gi=y+Math.round((f-y)*Pn),yi=b+Math.round((p-b)*Pn),_i=w+Math.round((m-w)*Pn),Gi.toRgba(gi,yi,_i)}e.blend=t;function n(l,d,f){let p=Hi.relativeLuminance(l>>8),m=Hi.relativeLuminance(d>>8);if(ua(p,m)<f){if(m<p){let w=i(l,d,f),S=ua(p,Hi.relativeLuminance(w>>8));if(S<f){let x=s(l,d,f),k=ua(p,Hi.relativeLuminance(x>>8));return S>k?w:x}return w}let y=s(l,d,f),b=ua(p,Hi.relativeLuminance(y>>8));if(b<f){let w=i(l,d,f),S=ua(p,Hi.relativeLuminance(w>>8));return b>S?y:w}return y}}e.ensureContrastRatio=n;function i(l,d,f){let p=l>>24&255,m=l>>16&255,y=l>>8&255,b=d>>24&255,w=d>>16&255,S=d>>8&255,x=ua(Hi.relativeLuminance2(b,w,S),Hi.relativeLuminance2(p,m,y));for(;x<f&&(b>0||w>0||S>0);)b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),x=ua(Hi.relativeLuminance2(b,w,S),Hi.relativeLuminance2(p,m,y));return(b<<24|w<<16|S<<8|255)>>>0}e.reduceLuminance=i;function s(l,d,f){let p=l>>24&255,m=l>>16&255,y=l>>8&255,b=d>>24&255,w=d>>16&255,S=d>>8&255,x=ua(Hi.relativeLuminance2(b,w,S),Hi.relativeLuminance2(p,m,y));for(;x<f&&(b<255||w<255||S<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=ua(Hi.relativeLuminance2(b,w,S),Hi.relativeLuminance2(p,m,y));return(b<<24|w<<16|S<<8|255)>>>0}e.increaseLuminance=s;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(dl||={});function Vo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function ua(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function ii(e){if(!e)throw new Error("value must not be falsy");return e}function Zw(e){return 57508<=e&&e<=57558}function r9(e){return 57520<=e&&e<=57527}function s9(e){return 57344<=e&&e<=63743}function a9(e){return 9472<=e&&e<=9631}function o9(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 l9(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!o9(e)&&!Zw(e)&&!s9(e)}function XM(e){return Zw(e)||a9(e)}function c9(){return{css:{canvas:Tf(),cell:Tf()},device:{canvas:Tf(),cell:Tf(),char:{width:0,height:0,left:0,top:0}}}}function Tf(){return{width:0,height:0}}function u9(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var Ti=0,pi=0,xs=!1,da=!1,Rf=!1,ar,C_=0,d9=class{constructor(e,t,n,i,s,o){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=i,this._coreBrowserService=s,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,pi=0,Ti=0,da=!1,xs=!1,Rf=!1,ar=this._themeService.colors,C_=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));C_=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",s=>{s.backgroundColorRGB&&(pi=s.backgroundColorRGB.rgba>>8&16777215,da=!0),s.foregroundColorRGB&&(Ti=s.foregroundColorRGB.rgba>>8&16777215,xs=!0)}),Rf=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Rf){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:pi=(this.result.fg&16777215)<<8|255;break;default:pi=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:pi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:pi=(this.result.bg&16777215)<<8|255;break}pi=dl.blend(pi,(this._coreBrowserService.isFocused?ar.selectionBackgroundOpaque:ar.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else pi=(this._coreBrowserService.isFocused?ar.selectionBackgroundOpaque:ar.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(da=!0,ar.selectionForeground&&(Ti=ar.selectionForeground.rgba>>8&16777215,xs=!0),XM(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ti=(this._coreBrowserService.isFocused?ar.selectionBackgroundOpaque:ar.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ti=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ti=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ti=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ti=(this.result.fg&16777215)<<8|255;break;default:Ti=this._themeService.colors.foreground.rgba}Ti=dl.blend(Ti,(this._coreBrowserService.isFocused?ar.selectionBackgroundOpaque:ar.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}xs=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",s=>{s.backgroundColorRGB&&(pi=s.backgroundColorRGB.rgba>>8&16777215,da=!0),s.foregroundColorRGB&&(Ti=s.foregroundColorRGB.rgba>>8&16777215,xs=!0)}),da&&(Rf?pi=e.bg&-16777216&-134217729|pi|50331648:pi=e.bg&-16777216|pi|50331648),xs&&(Ti=e.fg&-16777216&-67108865|Ti|50331648),this.result.fg&67108864&&(da&&!xs&&((this.result.bg&50331648)===0?Ti=this.result.fg&-134217728|ar.background.rgba>>8&16777215&16777215|50331648:Ti=this.result.fg&-134217728|this.result.bg&67108863,xs=!0),!da&&xs&&((this.result.fg&50331648)===0?pi=this.result.bg&-67108864|ar.foreground.rgba>>8&16777215&16777215|50331648:pi=this.result.bg&-67108864|this.result.fg&67108863,da=!0)),ar=void 0,this.result.bg=da?pi:this.result.bg,this.result.fg=xs?Ti:this.result.fg,this.result.ext&=536870911,this.result.ext|=C_<<29&3758096384}},h9=.5,ZM=Q$||e9?"bottom":"ideographic",f9={"▀":[{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}]},p9={"░":[[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]]},m9={"─":{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`}},Ud={"":{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}};Ud[""]=Ud[""];Ud[""]=Ud[""];function g9(e,t,n,i,s,o,l,d){let f=f9[t];if(f)return y9(e,f,n,i,s,o),!0;let p=p9[t];if(p)return _9(e,p,n,i,s,o),!0;let m=m9[t];if(m)return v9(e,m,n,i,s,o,d),!0;let y=Ud[t];return y?(b9(e,y,n,i,s,o,l,d),!0):!1}function y9(e,t,n,i,s,o){for(let l=0;l<t.length;l++){let d=t[l],f=s/8,p=o/8;e.fillRect(n+d.x*f,i+d.y*p,d.w*f,d.h*p)}}var zE=new Map;function _9(e,t,n,i,s,o){let l=zE.get(t);l||(l=new Map,zE.set(t,l));let d=e.fillStyle;if(typeof d!="string")throw new Error(`Unexpected fillStyle type "${d}"`);let f=l.get(d);if(!f){let p=t[0].length,m=t.length,y=e.canvas.ownerDocument.createElement("canvas");y.width=p,y.height=m;let b=ii(y.getContext("2d")),w=new ImageData(p,m),S,x,k,L;if(d.startsWith("#"))S=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),L=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[S,x,k,L]=d.substring(5,d.length-1).split(",").map(F=>parseFloat(F));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let F=0;F<m;F++)for(let q=0;q<p;q++)w.data[(F*p+q)*4]=S,w.data[(F*p+q)*4+1]=x,w.data[(F*p+q)*4+2]=k,w.data[(F*p+q)*4+3]=t[F][q]*(L*255);b.putImageData(w,0,0),f=ii(e.createPattern(y,null)),l.set(d,f)}e.fillStyle=f,e.fillRect(n,i,s,o)}function v9(e,t,n,i,s,o,l){e.strokeStyle=e.fillStyle;for(let[d,f]of Object.entries(t)){e.beginPath(),e.lineWidth=l*Number.parseInt(d);let p;if(typeof f=="function"){let m=.15/o*s;p=f(.15,m)}else p=f;for(let m of p.split(" ")){let y=m[0],b=JM[y];if(!b){console.error(`Could not find drawing instructions for "${y}"`);continue}let w=m.substring(1).split(",");!w[0]||!w[1]||b(e,QM(w,s,o,n,i,!0,l))}e.stroke(),e.closePath()}}function b9(e,t,n,i,s,o,l,d){let f=new Path2D;f.rect(n,i,s,o),e.clip(f),e.beginPath();let p=l/12;e.lineWidth=d*p;for(let m of t.d.split(" ")){let y=m[0],b=JM[y];if(!b){console.error(`Could not find drawing instructions for "${y}"`);continue}let w=m.substring(1).split(",");!w[0]||!w[1]||b(e,QM(w,s,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 $E(e,t,n=0){return Math.max(Math.min(e,t),n)}var JM={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 QM(e,t,n,i,s,o,l,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*l-f*l,o&&p[m]!==0&&(p[m]=$E(Math.round(p[m]+.5)-.5,t,0)),p[m]+=i+d*l;for(let m=1;m<p.length;m+=2)p[m]*=n,o&&p[m]!==0&&(p[m]=$E(Math.round(p[m]+.5)-.5,n,0)),p[m]+=s;return p}var FE=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={}}},HE=class{constructor(){this._data=new FE}set(e,t,n,i,s){this._data.get(e,t)||this._data.set(e,t,new FE),this._data.get(e,t).set(n,i,s)}get(e,t,n,i){return this._data.get(e,t)?.get(n,i)}clear(){this._data.clear()}},eL=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(),s=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),s=e.timeRemaining(),n*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},w9=class extends eL{_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())}}},S9=class extends eL{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},x9=!Xw&&"requestIdleCallback"in window?S9:w9,Cc=class tL{constructor(){this.fg=0,this.bg=0,this.extended=new nL}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 tL;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}},nL=class iL{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 iL(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},C9=globalThis.performance&&typeof globalThis.performance.now=="function",k9=class rL{static create(t){return new rL(t)}constructor(t){this._now=C9&&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}},_a;(e=>{e.None=()=>fs.None;function t(B,M){return y(B,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function n(B){return(M,D=null,j)=>{let A=!1,O;return O=B(C=>{if(!A)return O?O.dispose():A=!0,M.call(D,C)},null,j),A&&O.dispose(),O}}e.once=n;function i(B,M,D){return p((j,A=null,O)=>B(C=>j.call(A,M(C)),null,O),D)}e.map=i;function s(B,M,D){return p((j,A=null,O)=>B(C=>{M(C),j.call(A,C)},null,O),D)}e.forEach=s;function o(B,M,D){return p((j,A=null,O)=>B(C=>M(C)&&j.call(A,C),null,O),D)}e.filter=o;function l(B){return B}e.signal=l;function d(...B){return(M,D=null,j)=>{let A=GM(...B.map(O=>O(C=>M.call(D,C))));return m(A,j)}}e.any=d;function f(B,M,D,j){let A=D;return i(B,O=>(A=M(A,O),A),j)}e.reduce=f;function p(B,M){let D,j={onWillAddFirstListener(){D=B(A.fire,A)},onDidRemoveLastListener(){D?.dispose()}},A=new xn(j);return M?.add(A),A.event}function m(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function y(B,M,D=100,j=!1,A=!1,O,C){let z,P,R,W=0,G,U={leakWarningThreshold:O,onWillAddFirstListener(){z=B(ne=>{W++,P=M(P,ne),j&&!R&&(ee.fire(P),P=void 0),G=()=>{let me=P;P=void 0,R=void 0,(!j||W>1)&&ee.fire(me),W=0},typeof D=="number"?(clearTimeout(R),R=setTimeout(G,D)):R===void 0&&(R=0,queueMicrotask(G))})},onWillRemoveListener(){A&&W>0&&G?.()},onDidRemoveLastListener(){G=void 0,z.dispose()}},ee=new xn(U);return C?.add(ee),ee.event}e.debounce=y;function b(B,M=0,D){return e.debounce(B,(j,A)=>j?(j.push(A),j):[A],M,void 0,!0,void 0,D)}e.accumulate=b;function w(B,M=(j,A)=>j===A,D){let j=!0,A;return o(B,O=>{let C=j||!M(O,A);return j=!1,A=O,C},D)}e.latch=w;function S(B,M,D){return[e.filter(B,M,D),e.filter(B,j=>!M(j),D)]}e.split=S;function x(B,M=!1,D=[],j){let A=D.slice(),O=B(P=>{A?A.push(P):z.fire(P)});j&&j.add(O);let C=()=>{A?.forEach(P=>z.fire(P)),A=null},z=new xn({onWillAddFirstListener(){O||(O=B(P=>z.fire(P)),j&&j.add(O))},onDidAddFirstListener(){A&&(M?setTimeout(C):C())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return j&&j.add(z),z.event}e.buffer=x;function k(B,M){return(D,j,A)=>{let O=M(new F);return B(function(C){let z=O.evaluate(C);z!==L&&D.call(j,z)},void 0,A)}}e.chain=k;let L=Symbol("HaltChainable");class F{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(D=>(M(D),D)),this}filter(M){return this.steps.push(D=>M(D)?D:L),this}reduce(M,D){let j=D;return this.steps.push(A=>(j=M(j,A),j)),this}latch(M=(D,j)=>D===j){let D=!0,j;return this.steps.push(A=>{let O=D||!M(A,j);return D=!1,j=A,O?A:L}),this}evaluate(M){for(let D of this.steps)if(M=D(M),M===L)break;return M}}function q(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.on(M,j),O=()=>B.removeListener(M,j),C=new xn({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromNodeEventEmitter=q;function T(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.addEventListener(M,j),O=()=>B.removeEventListener(M,j),C=new xn({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromDOMEventEmitter=T;function $(B){return new Promise(M=>n(B)(M))}e.toPromise=$;function I(B){let M=new xn;return B.then(D=>{M.fire(D)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=I;function N(B,M){return B(D=>M.fire(D))}e.forward=N;function V(B,M,D){return M(D),B(j=>M(j))}e.runAndSubscribe=V;class K{constructor(M,D){this._observable=M,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new xn(j),D&&D.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,D){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,M){return new K(B,M).emitter.event}e.fromObservable=Q;function Y(B){return(M,D,j)=>{let A=0,O=!1,C={beginUpdate(){A++},endUpdate(){A--,A===0&&(B.reportChanges(),O&&(O=!1,M.call(D)))},handlePossibleChange(){},handleChange(){O=!0}};B.addObserver(C),B.reportChanges();let z={dispose(){B.removeObserver(C)}};return j instanceof Mc?j.add(z):Array.isArray(j)&&j.push(z),z}}e.fromObservableLight=Y})(_a||={});var Cb=class kb{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${kb._idPool++}`,kb.all.add(this)}start(t){this._stopWatch=new k9,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}}};Cb.all=new Set,Cb._idPool=0;var E9=Cb,A9=-1,sL=class aL{constructor(t,n,i=(aL._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 s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,l]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(d),console.warn(o);let f=new M9(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,s]of this._stacks)(!t||n<s)&&(t=[i,s],n=s);return t}};sL._idPool=1;var T9=sL,R9=class oL{constructor(t){this.value=t}static create(){let t=new Error;return new oL(t.stack??"")}print(){console.warn(this.value.split(`
22
+ `).slice(2).join(`
23
+ `))}},M9=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},L9=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},N9=0,k_=class{constructor(t){this.value=t,this.id=N9++}},O9=2,I9,xn=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new T9(t?.onListenerError??x_,this._options?.leakWarningThreshold??A9):void 0,this._perfMon=this._options?._profName?new E9(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 L9(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||x_)(p),fs.None}if(this._disposed)return fs.None;n&&(t=t.bind(n));let s=new k_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=R9.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof k_?(this._deliveryQueue??=new D9,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=zi(()=>{o?.(),this._removeListener(s)});return i instanceof Mc?i.add(l):Array.isArray(i)&&i.push(l),l},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 s=this._deliveryQueue.current===this;if(this._size*O9<=n.length){let o=0;for(let l=0;l<n.length;l++)n[l]?n[o++]=n[l]:s&&(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(s){i(s)}}_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 k_)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}},D9=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}},UE={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}},Yu=2,Xu,io=class _c{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new HE,this._cacheMapCombined=new HE,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Cc,this._textureSize=512,this._onAddTextureAtlasCanvas=new xn,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new xn,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=lL(t,this._config.deviceCellWidth*4+Yu*2,this._config.deviceCellHeight+Yu*2),this._tmpCtx=ii(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 x9;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(_c.maxAtlasPages&&this._pages.length>=Math.max(4,_c.maxAtlasPages)){let n=this._pages.filter(p=>p.canvas.width*2<=(_c.maxTextureSize||4096)).sort((p,m)=>m.canvas.width!==p.canvas.width?m.canvas.width-p.canvas.width:m.percentageUsed-p.percentageUsed),i=-1,s=0;for(let p=0;p<n.length;p++)if(n[p].canvas.width!==s)i=p,s=n[p].canvas.width;else if(p-i===3)break;let o=n.slice(i,i+4),l=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=l.length-1;p>=0;p--)this._deletePage(l[p]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let t=new E_(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,s=new E_(this._document,i,t);for(let[o,l]of t.entries()){let d=o*l.canvas.width%i,f=Math.floor(o/2)*l.canvas.height;s.ctx.drawImage(l.canvas,d,f);for(let m of l.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(l.canvas);let p=this._activePages.indexOf(l);p!==-1&&this._activePages.splice(p,1)}return s}_deletePage(t){this._pages.splice(t,1);for(let n=t;n<this._pages.length;n++){let i=this._pages[n];for(let s of i.glyphs)s.texturePage--;i.version++}}getRasterizedGlyphCombinedChar(t,n,i,s,o,l){return this._getFromCacheMap(this._cacheMapCombined,t,n,i,s,o,l)}getRasterizedGlyph(t,n,i,s,o,l){return this._getFromCacheMap(this._cacheMap,t,n,i,s,o,l)}_getFromCacheMap(t,n,i,s,o,l,d){return Xu=t.get(n,i,s,o),Xu||(Xu=this._drawToCache(n,i,s,o,l,d),t.set(n,i,s,o,Xu)),Xu}_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,s){if(this._config.allowTransparency)return Wr;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let l=Cc.toColorRGB(n);o=Gi.toColor(l[0],l[1],l[2]);break;default:i?o=bd.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=bd.opaque(o)),o}_getForegroundColor(t,n,i,s,o,l,d,f,p,m){let y=this._getMinimumContrastColor(t,n,i,s,o,l,d,p,f,m);if(y)return y;let b;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&l<8&&(l+=8),b=this._getColorFromAnsiIndex(l);break;case 50331648:let w=Cc.toColorRGB(l);b=Gi.toColor(w[0],w[1],w[2]);break;default:d?b=this._config.colors.background:b=this._config.colors.foreground}return this._config.allowTransparency&&(b=bd.opaque(b)),f&&(b=bd.multiplyOpacity(b,h9)),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,s){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&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,s,o,l,d,f,p,m){if(this._config.minimumContrastRatio===1||m)return;let y=this._getContrastCache(p),b=y.getColor(t,s);if(b!==void 0)return b||void 0;let w=this._resolveBackgroundRgba(n,i,d),S=this._resolveForegroundRgba(o,l,d,f),x=dl.ensureContrastRatio(w,S,this._config.minimumContrastRatio/(p?2:1));if(!x){y.setColor(t,s,null);return}let k=Gi.toColor(x>>24&255,x>>16&255,x>>8&255);return y.setColor(t,s,k),k}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,i,s,o,l){let d=typeof t=="number"?String.fromCharCode(t):t;l&&this._tmpCanvas.parentElement!==l&&(this._tmpCanvas.style.display="none",l.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(d.length,2)+Yu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let p=Math.min(this._config.deviceCellHeight+Yu*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=s,!!this._workAttributeData.isInvisible())return UE;let m=!!this._workAttributeData.isBold(),y=!!this._workAttributeData.isInverse(),b=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),S=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),L=this._workAttributeData.getFgColor(),F=this._workAttributeData.getFgColorMode(),q=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(y){let P=L;L=q,q=P;let R=F;F=T,T=R}let $=this._getBackgroundColor(T,q,y,b);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=$.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let I=m?this._config.fontWeightBold:this._config.fontWeight,N=w?"italic":"";this._tmpCtx.font=`${N} ${I} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ZM;let V=d.length===1&&Zw(d.charCodeAt(0)),K=d.length===1&&r9(d.charCodeAt(0)),Q=this._getForegroundColor(n,T,q,i,F,L,y,b,m,XM(d.charCodeAt(0)));this._tmpCtx.fillStyle=Q.css;let Y=K?0:Yu*2,B=!1;this._config.customGlyphs!==!1&&(B=g9(this._tmpCtx,d,Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let M=!V,D;if(typeof t=="number"?D=this._unicodeService.wcwidth(t):D=this._unicodeService.getStringCellWidth(t),S){this._tmpCtx.save();let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),R=P%2===1?.5:0;if(this._tmpCtx.lineWidth=P,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())M=!1,this._tmpCtx.strokeStyle=`rgb(${Cc.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{M=!1;let me=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&me<8&&(me+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(me).css}this._tmpCtx.beginPath();let W=Y,G=Math.ceil(Y+this._config.deviceCharHeight)-R-(o?P*2:0),U=G+P,ee=G+P*2,ne=this._workAttributeData.getUnderlineVariantOffset();for(let me=0;me<D;me++){this._tmpCtx.save();let Me=W+me*this._config.deviceCellWidth,ve=W+(me+1)*this._config.deviceCellWidth,Ye=Me+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Me,G),this._tmpCtx.lineTo(ve,G),this._tmpCtx.moveTo(Me,ee),this._tmpCtx.lineTo(ve,ee);break;case 3:let qe=P<=1?ee:Math.ceil(Y+this._config.deviceCharHeight-P/2)-R,yt=P<=1?G:Math.ceil(Y+this._config.deviceCharHeight+P/2)-R,$e=new Path2D;$e.rect(Me,G,this._config.deviceCellWidth,ee-G),this._tmpCtx.clip($e),this._tmpCtx.moveTo(Me-this._config.deviceCellWidth/2,U),this._tmpCtx.bezierCurveTo(Me-this._config.deviceCellWidth/2,yt,Me,yt,Me,U),this._tmpCtx.bezierCurveTo(Me,qe,Ye,qe,Ye,U),this._tmpCtx.bezierCurveTo(Ye,yt,ve,yt,ve,U),this._tmpCtx.bezierCurveTo(ve,qe,ve+this._config.deviceCellWidth/2,qe,ve+this._config.deviceCellWidth/2,U);break;case 4:let We=ne===0?0:ne>=P?P*2-ne:P-ne;ne>=P||We===0?(this._tmpCtx.setLineDash([Math.round(P),Math.round(P)]),this._tmpCtx.moveTo(Me+We,G),this._tmpCtx.lineTo(ve,G)):(this._tmpCtx.setLineDash([Math.round(P),Math.round(P)]),this._tmpCtx.moveTo(Me,G),this._tmpCtx.lineTo(Me+We,G),this._tmpCtx.moveTo(Me+We+P,G),this._tmpCtx.lineTo(ve,G)),ne=u9(ve-Me,P,ne);break;case 5:let mt=.6,ot=.3,Nt=ve-Me,Ot=Math.floor(mt*Nt),kt=Math.floor(ot*Nt),ye=Nt-Ot-kt;this._tmpCtx.setLineDash([Ot,kt,ye]),this._tmpCtx.moveTo(Me,G),this._tmpCtx.lineTo(ve,G);break;default:this._tmpCtx.moveTo(Me,G),this._tmpCtx.lineTo(ve,G);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 me=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in me&&me.actualBoundingBoxDescent>0){this._tmpCtx.save();let Me=new Path2D;Me.rect(W,G-Math.ceil(P/2),this._config.deviceCellWidth*D,ee-G+Math.ceil(P/2)),this._tmpCtx.clip(Me),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=$.css,this._tmpCtx.strokeText(d,Y,Y+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),R=P%2===1?.5:0;this._tmpCtx.lineWidth=P,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+R),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*D,Y+R),this._tmpCtx.stroke()}if(B||this._tmpCtx.fillText(d,Y,Y+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let P=A_(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),$,Q,M);if(P)for(let R=1;R<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=$.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(d,Y,Y+this._config.deviceCharHeight-R),P=A_(this._tmpCtx.getImageData(Y,Y,this._config.deviceCellWidth,this._config.deviceCellHeight),$,Q,M),!!P);R++);}if(x){let P=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),R=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=P,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Y,Y+Math.floor(this._config.deviceCharHeight/2)-R),this._tmpCtx.lineTo(Y+this._config.deviceCharWidth*D,Y+Math.floor(this._config.deviceCharHeight/2)-R),this._tmpCtx.stroke()}this._tmpCtx.restore();let j=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),A;if(this._config.allowTransparency?A=j9(j):A=A_(j,$,Q,M),A)return UE;let O=this._findGlyphBoundingBox(j,this._workBoundingBox,f,K,B,Y),C,z;for(;;){if(this._activePages.length===0){let P=this._createNewPage();C=P,z=P.currentRow,z.height=O.size.y;break}C=this._activePages[this._activePages.length-1],z=C.currentRow;for(let P of this._activePages)O.size.y<=P.currentRow.height&&(C=P,z=P.currentRow);for(let P=this._activePages.length-1;P>=0;P--)for(let R of this._activePages[P].fixedRows)R.height<=z.height&&O.size.y<=R.height&&(C=this._activePages[P],z=R);if(O.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new E_(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),C=this._overflowSizePage,z=this._overflowSizePage.currentRow,z.x+O.size.x>=C.canvas.width&&(z.x=0,z.y+=z.height,z.height=0);break}if(z.y+O.size.y>=C.canvas.height||z.height>O.size.y+2){let P=!1;if(C.currentRow.y+C.currentRow.height+O.size.y>=C.canvas.height){let R;for(let W of this._activePages)if(W.currentRow.y+W.currentRow.height+O.size.y<W.canvas.height){R=W;break}if(R)C=R;else if(_c.maxAtlasPages&&this._pages.length>=_c.maxAtlasPages&&z.y+O.size.y<=C.canvas.height&&z.height>=O.size.y&&z.x+O.size.x<=C.canvas.width)P=!0;else{let W=this._createNewPage();C=W,z=W.currentRow,z.height=O.size.y,P=!0}}P||(C.currentRow.height>0&&C.fixedRows.push(C.currentRow),z={x:0,y:C.currentRow.y+C.currentRow.height,height:O.size.y},C.fixedRows.push(z),C.currentRow={x:0,y:z.y+z.height,height:0})}if(z.x+O.size.x<=C.canvas.width)break;z===C.currentRow?(z.x=0,z.y+=z.height,z.height=0):C.fixedRows.splice(C.fixedRows.indexOf(z),1)}return O.texturePage=this._pages.indexOf(C),O.texturePosition.x=z.x,O.texturePosition.y=z.y,O.texturePositionClipSpace.x=z.x/C.canvas.width,O.texturePositionClipSpace.y=z.y/C.canvas.height,O.sizeClipSpace.x/=C.canvas.width,O.sizeClipSpace.y/=C.canvas.height,z.height=Math.max(z.height,O.size.y),z.x+=O.size.x,C.ctx.putImageData(j,O.texturePosition.x-this._workBoundingBox.left,O.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,O.size.x,O.size.y),C.addGlyph(O),C.version++,O}_findGlyphBoundingBox(t,n,i,s,o,l){n.top=0;let d=s?this._config.deviceCellHeight:this._tmpCanvas.height,f=s?this._config.deviceCellWidth:i,p=!1;for(let m=0;m<d;m++){for(let y=0;y<f;y++){let b=m*this._tmpCanvas.width*4+y*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<l+f;m++){for(let y=0;y<d;y++){let b=y*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=l+f-1;m>=l;m--){for(let y=0;y<d;y++){let b=y*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 y=0;y<f;y++){let b=m*this._tmpCanvas.width*4+y*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+l+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-n.top+l+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},E_=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 s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=lL(t,n,n),this.ctx=ii(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 A_(e,t,n,i){let s=t.rgba>>>24,o=t.rgba>>>16&255,l=t.rgba>>>8&255,d=n.rgba>>>24,f=n.rgba>>>16&255,p=n.rgba>>>8&255,m=Math.floor((Math.abs(s-d)+Math.abs(o-f)+Math.abs(l-p))/12),y=!0;for(let b=0;b<e.data.length;b+=4)e.data[b]===s&&e.data[b+1]===o&&e.data[b+2]===l||i&&Math.abs(e.data[b]-s)+Math.abs(e.data[b+1]-o)+Math.abs(e.data[b+2]-l)<m?e.data[b+3]=0:y=!1;return y}function j9(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function lL(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function B9(e,t,n,i,s,o,l,d){let f={foreground:o.foreground,background:o.background,cursor:Wr,cursorAccent:Wr,selectionForeground:Wr,selectionBackgroundTransparent:Wr,selectionBackgroundOpaque:Wr,selectionInactiveBackgroundTransparent:Wr,selectionInactiveBackgroundOpaque:Wr,overviewRulerBorder:Wr,scrollbarSliderBackground:Wr,scrollbarSliderHoverBackground:Wr,scrollbarSliderActiveBackground:Wr,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:l,deviceMaxTextureSize:d,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:i,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:f}}function WE(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 P9(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Xr=[];function cL(e,t,n,i,s,o,l,d,f){let p=B9(i,s,o,l,t,n,d,f);for(let b=0;b<Xr.length;b++){let w=Xr[b],S=w.ownedBy.indexOf(e);if(S>=0){if(WE(w.config,p))return w.atlas;w.ownedBy.length===1?(w.atlas.dispose(),Xr.splice(b,1)):w.ownedBy.splice(S,1);break}}for(let b=0;b<Xr.length;b++){let w=Xr[b];if(WE(w.config,p))return w.ownedBy.push(e),w.atlas}let m=e._core,y={atlas:new io(document,p,m.unicodeService),config:p,ownedBy:[e]};return Xr.push(y),y.atlas}function qE(e){for(let t=0;t<Xr.length;t++){let n=Xr[t].ownedBy.indexOf(e);if(n!==-1){Xr[t].ownedBy.length===1?(Xr[t].atlas.dispose(),Xr.splice(t,1)):Xr[t].ownedBy.splice(n,1);break}}}var Mf=600,z9=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=Mf){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Mf-(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=Mf-(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})},Mf)},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 GE(e,t,n){let i=new t.ResizeObserver(s=>{let o=s.find(f=>f.target===e);if(!o)return;if(!("devicePixelContentBoxSize"in o)){i?.disconnect(),i=void 0;return}let l=o.devicePixelContentBoxSize[0].inlineSize,d=o.devicePixelContentBoxSize[0].blockSize;l>0&&d>0&&n(l,d)});try{i.observe(e,{box:["device-pixel-content-box"]})}catch{i.disconnect(),i=void 0}return zi(()=>i?.disconnect())}function $9(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var KE=class uL extends Cc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new nL,this.combinedData=""}static fromCharData(t){let n=new uL;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?$9(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 s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-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()]}},dL=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function hL(e,t,n){let i=ii(e.createProgram());if(e.attachShader(i,ii(VE(e,e.VERTEX_SHADER,t))),e.attachShader(i,ii(VE(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 VE(e,t,n){let i=ii(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 F9(e,t){let n=Math.min(e.length*2,t),i=new Float32Array(n);for(let s=0;s<e.length;s++)i[s]=e[s];return i}var H9=class{constructor(t){this.texture=t,this.version=-1}},U9=`#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 W9(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 ro=11,rc=ro*Float32Array.BYTES_PER_ELEMENT,q9=2,jn=0,wn,T_=0,Zu=0,G9=class extends fs{constructor(t,n,i,s){super(),this._terminal=t,this._gl=n,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;io.maxAtlasPages===void 0&&(io.maxAtlasPages=Math.min(32,ii(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),io.maxTextureSize=ii(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=ii(hL(o,U9,W9(io.maxAtlasPages))),this._register(zi(()=>o.deleteProgram(this._program))),this._projectionLocation=ii(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ii(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ii(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),d=o.createBuffer();this._register(zi(()=>o.deleteBuffer(d))),o.bindBuffer(o.ARRAY_BUFFER,d),o.bufferData(o.ARRAY_BUFFER,l,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(zi(()=>o.deleteBuffer(p))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p),o.bufferData(o.ELEMENT_ARRAY_BUFFER,f,o.STATIC_DRAW),this._attributesBuffer=ii(o.createBuffer()),this._register(zi(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,rc,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,rc,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,rc,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,rc,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,rc,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,rc,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let m=new Int32Array(io.maxAtlasPages);for(let y=0;y<io.maxAtlasPages;y++)m[y]=y;o.uniform1iv(this._textureLocation,m),o.uniformMatrix4fv(this._projectionLocation,!1,dL),this._atlasTextures=[];for(let y=0;y<io.maxAtlasPages;y++){let b=new H9(ii(o.createTexture()));this._register(zi(()=>o.deleteTexture(b.texture))),o.activeTexture(o.TEXTURE0+y),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[y]=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,s,o,l,d,f,p){this._updateCell(this._vertices.attributes,t,n,i,s,o,l,d,f,p)}_updateCell(t,n,i,s,o,l,d,f,p,m){if(jn=(i*this._terminal.cols+n)*ro,s===0||s===void 0){t.fill(0,jn,jn+ro-1-q9);return}this._atlas&&(f&&f.length>1?wn=this._atlas.getRasterizedGlyphCombinedChar(f,o,l,d,!1,this._terminal.element):wn=this._atlas.getRasterizedGlyph(s,o,l,d,!1,this._terminal.element),T_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==m&&wn.offset.x>T_?(Zu=wn.offset.x-T_,t[jn]=-(wn.offset.x-Zu)+this._dimensions.device.char.left,t[jn+1]=-wn.offset.y+this._dimensions.device.char.top,t[jn+2]=(wn.size.x-Zu)/this._dimensions.device.canvas.width,t[jn+3]=wn.size.y/this._dimensions.device.canvas.height,t[jn+4]=wn.texturePage,t[jn+5]=wn.texturePositionClipSpace.x+Zu/this._atlas.pages[wn.texturePage].canvas.width,t[jn+6]=wn.texturePositionClipSpace.y,t[jn+7]=wn.sizeClipSpace.x-Zu/this._atlas.pages[wn.texturePage].canvas.width,t[jn+8]=wn.sizeClipSpace.y):(t[jn]=-wn.offset.x+this._dimensions.device.char.left,t[jn+1]=-wn.offset.y+this._dimensions.device.char.top,t[jn+2]=wn.size.x/this._dimensions.device.canvas.width,t[jn+3]=wn.size.y/this._dimensions.device.canvas.height,t[jn+4]=wn.texturePage,t[jn+5]=wn.texturePositionClipSpace.x,t[jn+6]=wn.texturePositionClipSpace.y,t[jn+7]=wn.sizeClipSpace.x,t[jn+8]=wn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&l9(s,p,wn.size.x,this._dimensions.device.cell.width)&&(t[jn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*ro;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 s=0;s<t.rows;s++)for(let o=0;o<t.cols;o++)this._vertices.attributes[i+9]=o/t.cols,this._vertices.attributes[i+10]=s/t.rows,i+=ro}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],s=0;for(let o=0;o<t.lineLengths.length;o++){let l=o*this._terminal.cols*ro,d=this._vertices.attributes.subarray(l,l+t.lineLengths[o]*ro);i.set(d,s),s+=d.length}n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,i.subarray(0,s),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,s/ro)}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}},K9=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,s=!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,l=n[1]-o,d=i[1]-o,f=Math.max(l,0),p=Math.min(d,t.rows-1);if(f>=t.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=l,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 V9(){return new K9}var Kp=4,cp=1,up=2,R_=3,Y9=2147483648,X9=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=V9()}resize(t,n){let i=t*n*Kp;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)}},Z9=`#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
+ }`,J9=`#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
+ }`,ga=8,M_=ga*Float32Array.BYTES_PER_ELEMENT,Q9=20*ga,YE=class{constructor(){this.attributes=new Float32Array(Q9),this.count=0}},ha=0,XE=0,ZE=0,JE=0,QE=0,e2=0,t2=0,eF=class extends fs{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new YE,this._verticesCursor=new YE;let s=this._gl;this._program=ii(hL(s,Z9,J9)),this._register(zi(()=>s.deleteProgram(this._program))),this._projectionLocation=ii(s.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=s.createVertexArray(),s.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),l=s.createBuffer();this._register(zi(()=>s.deleteBuffer(l))),s.bindBuffer(s.ARRAY_BUFFER,l),s.bufferData(s.ARRAY_BUFFER,o,s.STATIC_DRAW),s.enableVertexAttribArray(3),s.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let d=new Uint8Array([0,1,2,3]),f=s.createBuffer();this._register(zi(()=>s.deleteBuffer(f))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,f),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=ii(s.createBuffer()),this._register(zi(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,M_,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,M_,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,M_,4*Float32Array.BYTES_PER_ELEMENT),s.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,dL),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,s,o,l,d,f,p,m,y,b,w,S;for(s=0;s<t.rows;s++){for(l=-1,d=0,f=0,p=!1,o=0;o<t.cols;o++)m=(s*t.cols+o)*Kp,y=e.cells[m+cp],b=e.cells[m+up],w=!!(b&67108864),(y!==d||b!==f&&(p||w))&&((d!==0||p&&f!==0)&&(S=i++*ga,this._updateRectangle(n,S,f,d,l,o,s)),l=o,d=y,f=b,p=w);(d!==0||p&&f!==0)&&(S=i++*ga,this._updateRectangle(n,S,f,d,l,t.cols,s))}n.count=i}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style==="block"){t.count=0;return}let i,s=0;(n.style==="bar"||n.style==="outline")&&(i=s++*ga,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=s++*ga,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=s++*ga,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=s++*ga,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=s}_updateRectangle(e,t,n,i,s,o,l){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:ha=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:ha=(n&16777215)<<8;break;default:ha=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:ha=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ha=(i&16777215)<<8;break;default:ha=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=F9(e.attributes,this._terminal.rows*this._terminal.cols*ga)),XE=s*this._dimensions.device.cell.width,ZE=l*this._dimensions.device.cell.height,JE=(ha>>24&255)/255,QE=(ha>>16&255)/255,e2=(ha>>8&255)/255,t2=1,this._addRectangle(e.attributes,t,XE,ZE,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,JE,QE,e2,t2)}_addRectangle(e,t,n,i,s,o,l,d,f,p){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=l,e[t+5]=d,e[t+6]=f,e[t+7]=p}_addRectangleFloat(e,t,n,i,s,o,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=i/this._dimensions.device.canvas.height,e[t+2]=s/this._dimensions.device.canvas.width,e[t+3]=o/this._dimensions.device.canvas.height,e[t+4]=l[0],e[t+5]=l[1],e[t+6]=l[2],e[t+7]=l[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])}},tF=class extends fs{constructor(t,n,i,s,o,l,d,f){super(),this._container=n,this._alpha=o,this._coreBrowserService=l,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=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(p=>{this._refreshCharAtlas(t,p),this.reset(t)})),this._register(zi(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ii(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,s=!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=cL(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,s){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,n*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(t,n,i,s){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=ZM,this._clipCell(i,s,n.getWidth()),this._ctx.fillText(n.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*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 s=n?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${s} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},nF=class extends tF{constructor(t,n,i,s,o,l,d){super(i,t,"link",n,!0,o,l,d),this._register(s.onShowLinkUnderline(f=>this._handleShowLinkUnderline(f))),this._register(s.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&&P9(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()}},nl=typeof window=="object"?window:globalThis,Eb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new xn,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new xn,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}};Eb.INSTANCE=new Eb;var fL=Eb;function iF(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}fL.INSTANCE.onDidChangeZoomLevel;fL.INSTANCE.onDidChangeFullscreen;var Xc=typeof navigator=="object"?navigator.userAgent:"";Xc.indexOf("Firefox")>=0;Xc.indexOf("AppleWebKit")>=0;var rF=Xc.indexOf("Chrome")>=0;!rF&&Xc.indexOf("Safari")>=0;Xc.indexOf("Electron/")>=0;Xc.indexOf("Android")>=0;var L_=!1;if(typeof nl.matchMedia=="function"){let e=nl.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=nl.matchMedia("(display-mode: fullscreen)");L_=e.matches,iF(nl,e,({matches:n})=>{L_&&t.matches||(L_=n)})}var kc="en",N_=!1,pL=!1,Lf,dp=kc,n2=kc,sF,pa,hl=globalThis,kr;typeof hl.vscode<"u"&&typeof hl.vscode.process<"u"?kr=hl.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(kr=process);var aF=typeof kr?.versions?.electron=="string",oF=aF&&kr?.type==="renderer";if(typeof kr=="object"){kr.platform,kr.platform,N_=kr.platform==="linux",N_&&kr.env.SNAP&&kr.env.SNAP_REVISION,kr.env.CI||kr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Lf=kc,dp=kc;let e=kr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Lf=t.userLocale,n2=t.osLocale,dp=t.resolvedLanguage||kc,sF=t.languagePack?.translationsConfigFile}catch{}pL=!0}else typeof navigator=="object"&&!oF?(pa=navigator.userAgent,pa.indexOf("Windows")>=0,pa.indexOf("Macintosh")>=0,(pa.indexOf("Macintosh")>=0||pa.indexOf("iPad")>=0||pa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,N_=pa.indexOf("Linux")>=0,pa?.indexOf("Mobi")>=0,dp=globalThis._VSCODE_NLS_LANGUAGE||kc,Lf=navigator.language.toLowerCase(),n2=Lf):console.error("Unable to resolve platform.");var i2=pL,Is=pa,Za=dp,lF;(e=>{function t(){return Za}e.value=t;function n(){return Za.length===2?Za==="en":Za.length>=3?Za[0]==="e"&&Za[1]==="n"&&Za[2]==="-":!1}e.isDefaultVariant=n;function i(){return Za==="en"}e.isDefault=i})(lF||={});var cF=typeof hl.postMessage=="function"&&!hl.importScripts;(()=>{if(cF){let e=[];hl.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;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}),hl.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var uF=!!(Is&&Is.indexOf("Chrome")>=0);Is&&Is.indexOf("Firefox")>=0;!uF&&Is&&Is.indexOf("Safari")>=0;Is&&Is.indexOf("Edg/")>=0;Is&&Is.indexOf("Android")>=0;var sc=typeof navigator=="object"?navigator:{};i2||document.queryCommandSupported&&document.queryCommandSupported("copy")||sc&&sc.clipboard&&sc.clipboard.writeText,i2||sc&&sc.clipboard&&sc.clipboard.readText;var Jw=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}},O_=new Jw,r2=new Jw,s2=new Jw;new Array(230);var dF;(e=>{function t(d){return O_.keyCodeToStr(d)}e.toString=t;function n(d){return O_.strToKeyCode(d)}e.fromString=n;function i(d){return r2.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return s2.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return r2.strToKeyCode(d)||s2.strToKeyCode(d)}e.fromUserSettings=o;function l(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 O_.keyCodeToStr(d)}e.toElectronAccelerator=l})(dF||={});var mL=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),hF;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof fF?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:_a.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:mL})})(hF||={});var fF=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?mL:(this._emitter||(this._emitter=new xn),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},pF;(e=>{async function t(i){let s,o=await Promise.all(i.map(l=>l.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function n(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(l){o(l)}})}e.withAsyncBody=n})(pF||={});var a2=class qr{static fromArray(t){return new qr(n=>{n.emitMany(t)})}static fromPromise(t){return new qr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new qr(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new qr(async n=>{await Promise.all(t.map(async i=>{for await(let s of i)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new xn,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}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 _a.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new qr(async i=>{for await(let s of t)i.emitOne(n(s))})}map(t){return qr.map(this,t)}static filter(t,n){return new qr(async i=>{for await(let s of t)n(s)&&i.emitOne(s)})}filter(t){return qr.filter(this,t)}static coalesce(t){return qr.filter(t,n=>!!n)}coalesce(){return qr.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return qr.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())}};a2.EMPTY=a2.fromArray([]);var{getWindow:mF}=(function(){let e=new Map,t={window:nl,disposables:new Mc};e.set(nl.vscodeWindowId,t);let n=new xn,i=new xn,s=new xn;function o(l,d){return(typeof l=="number"?e.get(l):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(l){if(e.has(l.vscodeWindowId))return fs.None;let d=new Mc,f={window:l,disposables:d.add(new Mc)};return e.set(l.vscodeWindowId,f),d.add(zi(()=>{e.delete(l.vscodeWindowId),i.fire(l)})),d.add(Ab(l,yF.BEFORE_UNLOAD,()=>{s.fire(l)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:o,getWindow(l){let d=l;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=l;return f?.view?f.view.window:nl},getDocument(l){return mF(l).document}}})(),gF=class{constructor(t,n,i,s){this._node=t,this._type=n,this._handler=i,this._options=s||!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 Ab(e,t,n,i){return new gF(e,t,n,i)}var yF={BEFORE_UNLOAD:"beforeunload"},_F=class extends fs{constructor(t,n,i,s,o,l,d,f,p){super(),this._terminal=t,this._characterJoinerService=n,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=l,this._optionsService=d,this._themeService=f,this._cursorBlinkStateManager=new Vu,this._charAtlasDisposable=this._register(new Vu),this._observerDisposable=this._register(new Vu),this._model=new X9,this._workCell=new KE,this._workCell2=new KE,this._rectangleRenderer=this._register(new Vu),this._glyphRenderer=this._register(new Vu),this._onChangeTextureAtlas=this._register(new xn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new xn),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new xn),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 d9(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new nF(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=c9(),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(Ab(this._canvas,"webglcontextlost",y=>{console.log("webglcontextlost event received"),y.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(y)},3e3)})),this._register(Ab(this._canvas,"webglcontextrestored",y=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,qE(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=GE(this._canvas,this._coreBrowserService.window,(y,b)=>this._setCanvasDevicePixelDimensions(y,b)),this._register(this._coreBrowserService.onWindowChange(y=>{this._observerDisposable.value=GE(this._canvas,y,(b,w)=>this._setCanvasDevicePixelDimensions(b,w))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(zi(()=>{for(let y of this._renderLayers)y.dispose();this._canvas.parentElement?.removeChild(this._canvas),qE(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 s of this._renderLayers)s.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 eF(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new G9(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=cL(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=GM(_a.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),_a.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 z9(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,n){let i=this._core,s=this._workCell,o,l,d,f,p,m,y=0,b=!0,w,S,x,k,L,F,q,T,$;t=o2(t,i.rows-1,0),n=o2(n,i.rows-1,0);let I=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",N=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=N-i.buffer.ydisp,K=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Q=-1,Y=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let B=!1;for(l=t;l<=n;l++)for(d=l+i.buffer.ydisp,f=i.buffer.lines.get(d),this._model.lineLengths[l]=0,x=N===d,y=0,p=this._characterJoinerService.getJoinedCharacters(d),T=0;T<i.cols;T++){if(o=this._cellColorResolver.result.bg,f.loadCell(T,s),T===0&&(o=this._cellColorResolver.result.bg),m=!1,b=T>=y,w=T,p.length>0&&T===p[0][0]&&b){S=p.shift();let M=this._model.selection.isCellSelected(this._terminal,S[0],d);for(q=S[0]+1;q<S[1];q++)b&&=M===this._model.selection.isCellSelected(this._terminal,q,d);b&&=!x||K<S[0]||K>=S[1],b?(m=!0,s=new vF(s,f.translateToString(!0,S[0],S[1]),S[1]-S[0]),w=S[1]-1):y=S[1]}if(k=s.getChars(),L=s.getCode(),q=(l*i.cols+T)*Kp,this._cellColorResolver.resolve(s,T,d,this.dimensions.device.cell.width),Y&&d===N&&(T===K&&(this._model.cursor={x:K,y:V,width:s.getWidth(),style:this._coreBrowserService.isFocused?I:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Q=K+s.getWidth()-1),T>=K&&T<=Q&&(this._coreBrowserService.isFocused&&I==="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)),L!==0&&(this._model.lineLengths[l]=T+1),!(this._model.cells[q]===L&&this._model.cells[q+cp]===this._cellColorResolver.result.bg&&this._model.cells[q+up]===this._cellColorResolver.result.fg&&this._model.cells[q+R_]===this._cellColorResolver.result.ext)&&(B=!0,k.length>1&&(L|=Y9),this._model.cells[q]=L,this._model.cells[q+cp]=this._cellColorResolver.result.bg,this._model.cells[q+up]=this._cellColorResolver.result.fg,this._model.cells[q+R_]=this._cellColorResolver.result.ext,F=s.getWidth(),this._glyphRenderer.value.updateCell(T,l,L,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,F,o),m)){for(s=this._workCell,T++;T<=w;T++)$=(l*i.cols+T)*Kp,this._glyphRenderer.value.updateCell(T,l,0,0,0,0,n9,0,0),this._model.cells[$]=0,this._model.cells[$+cp]=this._cellColorResolver.result.bg,this._model.cells[$+up]=this._cellColorResolver.result.fg,this._model.cells[$+R_]=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})}},vF=class extends Cc{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 o2(e,t,n=0){return Math.max(Math.min(e,t),n)}var l2="di$target",c2="di$dependencies",I_=new Map;function $s(e){if(I_.has(e))return I_.get(e);let t=function(n,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");bF(t,n,s)};return t._id=e,I_.set(e,t),t}function bF(e,t,n){t[l2]===t?t[c2].push({id:e,index:n}):(t[c2]=[{id:e,index:n}],t[l2]=t)}$s("BufferService");$s("CoreMouseService");$s("CoreService");$s("CharsetService");$s("InstantiationService");$s("LogService");var wF=$s("OptionsService");$s("OscLinkService");$s("UnicodeService");$s("DecorationService");var SF={trace:0,debug:1,info:2,warn:3,error:4,off:5},xF="xterm.js: ",u2=class extends fs{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=SF[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?"":xF)+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)}};u2=W$([q$(0,wF)],u2);var CF=class extends fs{constructor(t){if(YM&&t9()<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 xn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new xn),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,s=n.optionsService,o=n,l=o._renderService,d=o._characterJoinerService,f=o._charSizeService,p=o._coreBrowserService,m=o._decorationService;o._logService;let y=o._themeService;this._renderer=this._register(new _F(t,d,f,p,i,m,s,y,this._preserveDrawingBuffer)),this._register(_a.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(_a.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(_a.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(_a.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(zi(()=>{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 gL=Object.defineProperty,kF=Object.getOwnPropertyDescriptor,EF=(e,t)=>{for(var n in t)gL(e,n,{get:t[n],enumerable:!0})},$n=(e,t,n,i)=>{for(var s=i>1?void 0:i?kF(t,n):t,o=e.length-1,l;o>=0;o--)(l=e[o])&&(s=(i?l(t,n,s):l(s))||s);return i&&s&&gL(t,n,s),s},Ue=(e,t)=>(n,i)=>t(n,i,e),d2="Terminal input",Tb={get:()=>d2,set:e=>d2=e},h2="Too much output to announce, navigate to rows manually to read",Rb={get:()=>h2,set:e=>h2=e};function AF(e){return e.replace(/\r?\n/g,"\r")}function TF(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function RF(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function MF(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");yL(s,t,n,i)}}function yL(e,t,n,i){e=AF(e),e=TF(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function _L(e,t,n){let i=n.getBoundingClientRect(),s=e.clientX-i.left-10,o=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}function f2(e,t,n,i,s){_L(e,t,n),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function lo(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Fm(e,t=0,n=e.length){let i="";for(let s=t;s<n;++s){let o=e[s];o>65535?(o-=65536,i+=String.fromCharCode((o>>10)+55296)+String.fromCharCode(o%1024+56320)):i+=String.fromCharCode(o)}return i}var LF=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,s=0;if(this._interim){let o=e.charCodeAt(s++);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=s;o<n;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=n)return this._interim=l,i;let d=e.charCodeAt(o);56320<=d&&d<=57343?t[i++]=(l-55296)*1024+d-56320+65536:(t[i++]=l,t[i++]=d);continue}l!==65279&&(t[i++]=l)}return i}},NF=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,s,o,l,d,f=0,p=0;if(this.interim[0]){let b=!1,w=this.interim[0];w&=(w&224)===192?31:(w&240)===224?15:7;let S=0,x;for(;(x=this.interim[++S]&63)&&S<4;)w<<=6,w|=x;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,L=k-S;for(;p<L;){if(p>=n)return 0;if(x=e[p++],(x&192)!==128){p--,b=!0;break}else this.interim[S++]=x,w<<=6,w|=x&63}b||(k===2?w<128?p--:t[i++]=w:k===3?w<2048||w>=55296&&w<=57343||w===65279||(t[i++]=w):w<65536||w>1114111||(t[i++]=w)),this.interim.fill(0)}let m=n-4,y=p;for(;y<n;){for(;y<m&&!((s=e[y])&128)&&!((o=e[y+1])&128)&&!((l=e[y+2])&128)&&!((d=e[y+3])&128);)t[i++]=s,t[i++]=o,t[i++]=l,t[i++]=d,y+=4;if(s=e[y++],s<128)t[i++]=s;else if((s&224)===192){if(y>=n)return this.interim[0]=s,i;if(o=e[y++],(o&192)!==128){y--;continue}if(f=(s&31)<<6|o&63,f<128){y--;continue}t[i++]=f}else if((s&240)===224){if(y>=n)return this.interim[0]=s,i;if(o=e[y++],(o&192)!==128){y--;continue}if(y>=n)return this.interim[0]=s,this.interim[1]=o,i;if(l=e[y++],(l&192)!==128){y--;continue}if(f=(s&15)<<12|(o&63)<<6|l&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[i++]=f}else if((s&248)===240){if(y>=n)return this.interim[0]=s,i;if(o=e[y++],(o&192)!==128){y--;continue}if(y>=n)return this.interim[0]=s,this.interim[1]=o,i;if(l=e[y++],(l&192)!==128){y--;continue}if(y>=n)return this.interim[0]=s,this.interim[1]=o,this.interim[2]=l,i;if(d=e[y++],(d&192)!==128){y--;continue}if(f=(s&7)<<18|(o&63)<<12|(l&63)<<6|d&63,f<65536||f>1114111)continue;t[i++]=f}}return i}},vL="",po=" ",lh=class bL{constructor(){this.fg=0,this.bg=0,this.extended=new Vp}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 bL;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}},Vp=class wL{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 wL(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Jr=class SL extends lh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vp,this.combinedData=""}static fromCharData(t){let n=new SL;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?lo(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 s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-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()]}},p2="di$target",Mb="di$dependencies",D_=new Map;function OF(e){return e[Mb]||[]}function xi(e){if(D_.has(e))return D_.get(e);let t=function(n,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");IF(t,n,s)};return t._id=e,D_.set(e,t),t}function IF(e,t,n){t[p2]===t?t[Mb].push({id:e,index:n}):(t[Mb]=[{id:e,index:n}],t[p2]=t)}var Zi=xi("BufferService"),xL=xi("CoreMouseService"),kl=xi("CoreService"),DF=xi("CharsetService"),Qw=xi("InstantiationService"),CL=xi("LogService"),Ji=xi("OptionsService"),kL=xi("OscLinkService"),jF=xi("UnicodeService"),ch=xi("DecorationService"),Lb=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=[],s=this._optionsService.rawOptions.linkHandler,o=new Jr,l=n.getTrimmedLength(),d=-1,f=-1,p=!1;for(let m=0;m<l;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===l-1){let y=this._oscLinkService.getLinkData(d)?.uri;if(y){let b={start:{x:f+1,y:e},end:{x:m+(!p&&m===l-1?1:0),y:e}},w=!1;if(!s?.allowNonHttpProtocols)try{let S=new URL(y);["http:","https:"].includes(S.protocol)||(w=!0)}catch{w=!0}w||i.push({text:y,range:b,activate:(S,x)=>s?s.activate(S,x,b):BF(S,x),hover:(S,x)=>s?.hover?.(S,x,b),leave:(S,x)=>s?.leave?.(S,x,b)})}p=!1,o.hasExtendedAttrs()&&o.extended.urlId?(f=m,d=o.extended.urlId):(f=-1,d=-1)}}t(i)}};Lb=$n([Ue(0,Zi),Ue(1,Ji),Ue(2,kL)],Lb);function BF(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 Hm=xi("CharSizeService"),Ca=xi("CoreBrowserService"),eS=xi("MouseService"),ka=xi("RenderService"),PF=xi("SelectionService"),EL=xi("CharacterJoinerService"),Zc=xi("ThemeService"),AL=xi("LinkProviderService"),zF=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?m2.isErrorNoTelemetry(e)?new m2(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)}},$F=new zF;function hp(e){FF(e)||$F.onUnexpectedError(e)}var Nb="Canceled";function FF(e){return e instanceof HF?!0:e instanceof Error&&e.name===Nb&&e.message===Nb}var HF=class extends Error{constructor(){super(Nb),this.name=this.message}};function UF(e){return new Error(`Illegal argument: ${e}`)}var m2=class Ob extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Ob)return t;let n=new Ob;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Ib=class TL extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,TL.prototype)}};function Sr(e,t=0){return e[e.length-(1+t)]}var WF;(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 s(o){return o===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(WF||={});function qF(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var RL;(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*s(T){yield T}e.single=s;function o(T){return t(T)?T:s(T)}e.wrap=o;function l(T){return T||n}e.from=l;function*d(T){for(let $=T.length-1;$>=0;$--)yield T[$]}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,$){let I=0;for(let N of T)if($(N,I++))return!0;return!1}e.some=m;function y(T,$){for(let I of T)if($(I))return I}e.find=y;function*b(T,$){for(let I of T)$(I)&&(yield I)}e.filter=b;function*w(T,$){let I=0;for(let N of T)yield $(N,I++)}e.map=w;function*S(T,$){let I=0;for(let N of T)yield*$(N,I++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,I){let N=I;for(let V of T)N=$(N,V);return N}e.reduce=k;function*L(T,$,I=T.length){for($<0&&($+=T.length),I<0?I+=T.length:I>T.length&&(I=T.length);$<I;$++)yield T[$]}e.slice=L;function F(T,$=Number.POSITIVE_INFINITY){let I=[];if($===0)return[I,T];let N=T[Symbol.iterator]();for(let V=0;V<$;V++){let K=N.next();if(K.done)return[I,e.empty()];I.push(K.value)}return[I,{[Symbol.iterator](){return N}}]}e.consume=F;async function q(T){let $=[];for await(let I of T)$.push(I);return Promise.resolve($)}e.asyncToArray=q})(RL||={});function _l(e){if(RL.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 GF(...e){return Tn(()=>_l(e))}function Tn(e){return{dispose:qF(()=>{e()})}}var ML=class LL{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{_l(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?LL.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)}};ML.DISABLE_DISPOSED_WARNING=!1;var vo=ML,Lt=class{constructor(){this._store=new vo,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)}};Lt.None=Object.freeze({dispose(){}});var Fc=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}},va=typeof window=="object"?window:globalThis,Db=class jb{constructor(t){this.element=t,this.next=jb.Undefined,this.prev=jb.Undefined}};Db.Undefined=new Db(void 0);var Ln=Db,g2=class{constructor(){this._first=Ln.Undefined,this._last=Ln.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ln.Undefined}clear(){let e=this._first;for(;e!==Ln.Undefined;){let t=e.next;e.prev=Ln.Undefined,e.next=Ln.Undefined,e=t}this._first=Ln.Undefined,this._last=Ln.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ln(e);if(this._first===Ln.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==Ln.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ln.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ln.Undefined&&e.next!==Ln.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ln.Undefined&&e.next===Ln.Undefined?(this._first=Ln.Undefined,this._last=Ln.Undefined):e.next===Ln.Undefined?(this._last=this._last.prev,this._last.next=Ln.Undefined):e.prev===Ln.Undefined&&(this._first=this._first.next,this._first.prev=Ln.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ln.Undefined;)yield e.element,e=e.next}},KF=globalThis.performance&&typeof globalThis.performance.now=="function",VF=class NL{static create(t){return new NL(t)}constructor(t){this._now=KF&&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}},Ni;(e=>{e.None=()=>Lt.None;function t(B,M){return y(B,()=>{},0,void 0,!0,void 0,M)}e.defer=t;function n(B){return(M,D=null,j)=>{let A=!1,O;return O=B(C=>{if(!A)return O?O.dispose():A=!0,M.call(D,C)},null,j),A&&O.dispose(),O}}e.once=n;function i(B,M,D){return p((j,A=null,O)=>B(C=>j.call(A,M(C)),null,O),D)}e.map=i;function s(B,M,D){return p((j,A=null,O)=>B(C=>{M(C),j.call(A,C)},null,O),D)}e.forEach=s;function o(B,M,D){return p((j,A=null,O)=>B(C=>M(C)&&j.call(A,C),null,O),D)}e.filter=o;function l(B){return B}e.signal=l;function d(...B){return(M,D=null,j)=>{let A=GF(...B.map(O=>O(C=>M.call(D,C))));return m(A,j)}}e.any=d;function f(B,M,D,j){let A=D;return i(B,O=>(A=M(A,O),A),j)}e.reduce=f;function p(B,M){let D,j={onWillAddFirstListener(){D=B(A.fire,A)},onDidRemoveLastListener(){D?.dispose()}},A=new Re(j);return M?.add(A),A.event}function m(B,M){return M instanceof Array?M.push(B):M&&M.add(B),B}function y(B,M,D=100,j=!1,A=!1,O,C){let z,P,R,W=0,G,U={leakWarningThreshold:O,onWillAddFirstListener(){z=B(ne=>{W++,P=M(P,ne),j&&!R&&(ee.fire(P),P=void 0),G=()=>{let me=P;P=void 0,R=void 0,(!j||W>1)&&ee.fire(me),W=0},typeof D=="number"?(clearTimeout(R),R=setTimeout(G,D)):R===void 0&&(R=0,queueMicrotask(G))})},onWillRemoveListener(){A&&W>0&&G?.()},onDidRemoveLastListener(){G=void 0,z.dispose()}},ee=new Re(U);return C?.add(ee),ee.event}e.debounce=y;function b(B,M=0,D){return e.debounce(B,(j,A)=>j?(j.push(A),j):[A],M,void 0,!0,void 0,D)}e.accumulate=b;function w(B,M=(j,A)=>j===A,D){let j=!0,A;return o(B,O=>{let C=j||!M(O,A);return j=!1,A=O,C},D)}e.latch=w;function S(B,M,D){return[e.filter(B,M,D),e.filter(B,j=>!M(j),D)]}e.split=S;function x(B,M=!1,D=[],j){let A=D.slice(),O=B(P=>{A?A.push(P):z.fire(P)});j&&j.add(O);let C=()=>{A?.forEach(P=>z.fire(P)),A=null},z=new Re({onWillAddFirstListener(){O||(O=B(P=>z.fire(P)),j&&j.add(O))},onDidAddFirstListener(){A&&(M?setTimeout(C):C())},onDidRemoveLastListener(){O&&O.dispose(),O=null}});return j&&j.add(z),z.event}e.buffer=x;function k(B,M){return(D,j,A)=>{let O=M(new F);return B(function(C){let z=O.evaluate(C);z!==L&&D.call(j,z)},void 0,A)}}e.chain=k;let L=Symbol("HaltChainable");class F{constructor(){this.steps=[]}map(M){return this.steps.push(M),this}forEach(M){return this.steps.push(D=>(M(D),D)),this}filter(M){return this.steps.push(D=>M(D)?D:L),this}reduce(M,D){let j=D;return this.steps.push(A=>(j=M(j,A),j)),this}latch(M=(D,j)=>D===j){let D=!0,j;return this.steps.push(A=>{let O=D||!M(A,j);return D=!1,j=A,O?A:L}),this}evaluate(M){for(let D of this.steps)if(M=D(M),M===L)break;return M}}function q(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.on(M,j),O=()=>B.removeListener(M,j),C=new Re({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromNodeEventEmitter=q;function T(B,M,D=j=>j){let j=(...z)=>C.fire(D(...z)),A=()=>B.addEventListener(M,j),O=()=>B.removeEventListener(M,j),C=new Re({onWillAddFirstListener:A,onDidRemoveLastListener:O});return C.event}e.fromDOMEventEmitter=T;function $(B){return new Promise(M=>n(B)(M))}e.toPromise=$;function I(B){let M=new Re;return B.then(D=>{M.fire(D)},()=>{M.fire(void 0)}).finally(()=>{M.dispose()}),M.event}e.fromPromise=I;function N(B,M){return B(D=>M.fire(D))}e.forward=N;function V(B,M,D){return M(D),B(j=>M(j))}e.runAndSubscribe=V;class K{constructor(M,D){this._observable=M,this._counter=0,this._hasChanged=!1;let j={onWillAddFirstListener:()=>{M.addObserver(this)},onDidRemoveLastListener:()=>{M.removeObserver(this)}};this.emitter=new Re(j),D&&D.add(this.emitter)}beginUpdate(M){this._counter++}handlePossibleChange(M){}handleChange(M,D){this._hasChanged=!0}endUpdate(M){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Q(B,M){return new K(B,M).emitter.event}e.fromObservable=Q;function Y(B){return(M,D,j)=>{let A=0,O=!1,C={beginUpdate(){A++},endUpdate(){A--,A===0&&(B.reportChanges(),O&&(O=!1,M.call(D)))},handlePossibleChange(){},handleChange(){O=!0}};B.addObserver(C),B.reportChanges();let z={dispose(){B.removeObserver(C)}};return j instanceof vo?j.add(z):Array.isArray(j)&&j.push(z),z}}e.fromObservableLight=Y})(Ni||={});var Bb=class Pb{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Pb._idPool++}`,Pb.all.add(this)}start(t){this._stopWatch=new VF,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}}};Bb.all=new Set,Bb._idPool=0;var YF=Bb,XF=-1,OL=class IL{constructor(t,n,i=(IL._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 s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[o,l]=this.getMostFrequentStack(),d=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(d),console.warn(o);let f=new QF(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,s]of this._stacks)(!t||n<s)&&(t=[i,s],n=s);return t}};OL._idPool=1;var ZF=OL,JF=class DL{constructor(t){this.value=t}static create(){let t=new Error;return new DL(t.stack??"")}print(){console.warn(this.value.split(`
87
+ `).slice(2).join(`
88
+ `))}},QF=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},eH=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},tH=0,j_=class{constructor(e){this.value=e,this.id=tH++}},nH=2,iH,Re=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new ZF(t?.onListenerError??hp,this._options?.leakWarningThreshold??XF):void 0,this._perfMon=this._options?._profName?new YF(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 eH(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||hp)(p),Lt.None}if(this._disposed)return Lt.None;n&&(t=t.bind(n));let s=new j_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=JF.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof j_?(this._deliveryQueue??=new rH,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=Tn(()=>{o?.(),this._removeListener(s)});return i instanceof vo?i.add(l):Array.isArray(i)&&i.push(l),l},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 s=this._deliveryQueue.current===this;if(this._size*nH<=n.length){let o=0;for(let l=0;l<n.length;l++)n[l]?n[o++]=n[l]:s&&(this._deliveryQueue.end--,o<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=o}}_deliver(t,n){if(!t)return;let i=this._options?.onListenerError||hp;if(!i){t.value(n);return}try{t.value(n)}catch(s){i(s)}}_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 j_)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}},rH=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}},zb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Re,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Re,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}};zb.INSTANCE=new zb;var tS=zb;function sH(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}tS.INSTANCE.onDidChangeZoomLevel;function aH(e){return tS.INSTANCE.getZoomFactor(e)}tS.INSTANCE.onDidChangeFullscreen;var Jc=typeof navigator=="object"?navigator.userAgent:"",$b=Jc.indexOf("Firefox")>=0,oH=Jc.indexOf("AppleWebKit")>=0,nS=Jc.indexOf("Chrome")>=0,lH=!nS&&Jc.indexOf("Safari")>=0;Jc.indexOf("Electron/")>=0;Jc.indexOf("Android")>=0;var B_=!1;if(typeof va.matchMedia=="function"){let e=va.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=va.matchMedia("(display-mode: fullscreen)");B_=e.matches,sH(va,e,({matches:n})=>{B_&&t.matches||(B_=n)})}var Ec="en",Fb=!1,Hb=!1,fp=!1,jL=!1,Nf,pp=Ec,y2=Ec,cH,ma,fl=globalThis,Er;typeof fl.vscode<"u"&&typeof fl.vscode.process<"u"?Er=fl.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Er=process);var uH=typeof Er?.versions?.electron=="string",dH=uH&&Er?.type==="renderer";if(typeof Er=="object"){Fb=Er.platform==="win32",Hb=Er.platform==="darwin",fp=Er.platform==="linux",fp&&Er.env.SNAP&&Er.env.SNAP_REVISION,Er.env.CI||Er.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Nf=Ec,pp=Ec;let e=Er.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Nf=t.userLocale,y2=t.osLocale,pp=t.resolvedLanguage||Ec,cH=t.languagePack?.translationsConfigFile}catch{}jL=!0}else typeof navigator=="object"&&!dH?(ma=navigator.userAgent,Fb=ma.indexOf("Windows")>=0,Hb=ma.indexOf("Macintosh")>=0,(ma.indexOf("Macintosh")>=0||ma.indexOf("iPad")>=0||ma.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,fp=ma.indexOf("Linux")>=0,ma?.indexOf("Mobi")>=0,pp=globalThis._VSCODE_NLS_LANGUAGE||Ec,Nf=navigator.language.toLowerCase(),y2=Nf):console.error("Unable to resolve platform.");var BL=Fb,Ls=Hb,hH=fp,_2=jL,Ds=ma,Ja=pp,fH;(e=>{function t(){return Ja}e.value=t;function n(){return Ja.length===2?Ja==="en":Ja.length>=3?Ja[0]==="e"&&Ja[1]==="n"&&Ja[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ja==="en"}e.isDefault=i})(fH||={});var pH=typeof fl.postMessage=="function"&&!fl.importScripts;(()=>{if(pH){let e=[];fl.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;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}),fl.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var mH=!!(Ds&&Ds.indexOf("Chrome")>=0);Ds&&Ds.indexOf("Firefox")>=0;!mH&&Ds&&Ds.indexOf("Safari")>=0;Ds&&Ds.indexOf("Edg/")>=0;Ds&&Ds.indexOf("Android")>=0;var ac=typeof navigator=="object"?navigator:{};_2||document.queryCommandSupported&&document.queryCommandSupported("copy")||ac&&ac.clipboard&&ac.clipboard.writeText,_2||ac&&ac.clipboard&&ac.clipboard.readText;var iS=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},P_=new iS,v2=new iS,b2=new iS,gH=new Array(230),PL;(e=>{function t(d){return P_.keyCodeToStr(d)}e.toString=t;function n(d){return P_.strToKeyCode(d)}e.fromString=n;function i(d){return v2.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return b2.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return v2.strToKeyCode(d)||b2.strToKeyCode(d)}e.fromUserSettings=o;function l(d){if(d>=98&&d<=113)return null;switch(d){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return P_.keyCodeToStr(d)}e.toElectronAccelerator=l})(PL||={});var yH=class zL{constructor(t,n,i,s,o){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=s,this.keyCode=o}equals(t){return t instanceof zL&&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",s=this.metaKey?"1":"0";return`K${t}${n}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new _H([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},_H=class{constructor(e){if(e.length===0)throw UF("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 vH(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return PL.fromString(n)}let t=e.keyCode;if(t===3)return 7;if($b)switch(t){case 59:return 85;case 60:if(hH)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ls)return 57;break}else if(oH&&(Ls&&t===93||!Ls&&t===92))return 57;return gH[t]||0}var bH=Ls?256:2048,wH=512,SH=1024,xH=Ls?2048:256,w2=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=vH(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|=bH),this.altKey&&(t|=wH),this.shiftKey&&(t|=SH),this.metaKey&&(t|=xH),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new yH(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},S2=new WeakMap;function CH(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 kH=class{static getSameOriginWindowChain(e){let t=S2.get(e);if(!t){t=[],S2.set(e,t);let n=e,i;do i=CH(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,s=this.getSameOriginWindowChain(e);for(let o of s){let l=o.window.deref();if(n+=l?.scrollY??0,i+=l?.scrollX??0,l===t||!o.iframeElement)break;let d=o.iframeElement.getBoundingClientRect();n+=d.top,i+=d.left}return{top:n,left:i}}},Of=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=kH.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},x2=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(nS){let s=navigator.userAgent.match(/Chrome\/(\d+)/);i=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,l=e.view?.devicePixelRatio||1;if(typeof s.wheelDeltaY<"u")i?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.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?$b&&!Ls?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")lH&&BL?this.deltaX=-(s.wheelDeltaX/120):i?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.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?$b&&!Ls?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*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},$L=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),EH;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof AH?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ni.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$L})})(EH||={});var AH=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?$L:(this._emitter||(this._emitter=new Re),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},rS=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 Ib("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new Ib("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},TH=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 Ib("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=Tn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},RH;(e=>{async function t(i){let s,o=await Promise.all(i.map(l=>l.then(d=>d,d=>{s||(s=d)})));if(typeof s<"u")throw s;return o}e.settled=t;function n(i){return new Promise(async(s,o)=>{try{await i(s,o)}catch(l){o(l)}})}e.withAsyncBody=n})(RH||={});var C2=class Gr{static fromArray(t){return new Gr(n=>{n.emitMany(t)})}static fromPromise(t){return new Gr(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Gr(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new Gr(async n=>{await Promise.all(t.map(async i=>{for await(let s of i)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Re,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}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 Ni.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new Gr(async i=>{for await(let s of t)i.emitOne(n(s))})}map(t){return Gr.map(this,t)}static filter(t,n){return new Gr(async i=>{for await(let s of t)n(s)&&i.emitOne(s)})}filter(t){return Gr.filter(this,t)}static coalesce(t){return Gr.filter(t,n=>!!n)}coalesce(){return Gr.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return Gr.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())}};C2.EMPTY=C2.fromArray([]);var{getWindow:Ms,getWindowId:MH,onDidRegisterWindow:LH}=(function(){let e=new Map,t={window:va,disposables:new vo};e.set(va.vscodeWindowId,t);let n=new Re,i=new Re,s=new Re;function o(l,d){return(typeof l=="number"?e.get(l):void 0)??(d?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(l){if(e.has(l.vscodeWindowId))return Lt.None;let d=new vo,f={window:l,disposables:d.add(new vo)};return e.set(l.vscodeWindowId,f),d.add(Tn(()=>{e.delete(l.vscodeWindowId),i.fire(l)})),d.add(pt(l,mi.BEFORE_UNLOAD,()=>{s.fire(l)})),n.fire(f),d},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:o,getWindow(l){let d=l;if(d?.ownerDocument?.defaultView)return d.ownerDocument.defaultView.window;let f=l;return f?.view?f.view.window:va},getDocument(l){return Ms(l).document}}})(),NH=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 pt(e,t,n,i){return new NH(e,t,n,i)}var k2=function(e,t,n,i){return pt(e,t,n,i)},sS,OH=class extends TH{constructor(e){super(),this.defaultTarget=e&&Ms(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},E2=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){hp(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,s=o=>{n.set(o,!1);let l=e.get(o)??[];for(t.set(o,l),e.set(o,[]),i.set(o,!0);l.length>0;)l.sort(E2.sort),l.shift().execute();i.set(o,!1)};sS=(o,l,d=0)=>{let f=MH(o),p=new E2(l,d),m=e.get(f);return m||(m=[],e.set(f,m)),m.push(p),n.get(f)||(n.set(f,!0),o.requestAnimationFrame(()=>s(f))),p}})();function IH(e){let t=e.getBoundingClientRect(),n=Ms(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var mi={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"},DH=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=or(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=or(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=or(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=or(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=or(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=or(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=or(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=or(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=or(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=or(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=or(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=or(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=or(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=or(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 or(e){return typeof e=="number"?`${e}px`:e}function Dd(e){return new DH(e)}var FL=class{constructor(){this._hooks=new vo,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,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let o=e;try{e.setPointerCapture(t),this._hooks.add(Tn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Ms(e)}this._hooks.add(pt(o,mi.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(pt(o,mi.POINTER_UP,l=>this.stopMonitoring(!0)))}};function jH(e,t,n){let i=null,s=null;if(typeof n.value=="function"?(i="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",s=n.get),!s)throw new Error("not supported");let o=`$memoize$${t}`;n[i]=function(...l){return this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,l)}),this[o]}}var Es;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Es||={});var wd=class Bi extends Lt{constructor(){super(),this.dispatched=!1,this.targets=new g2,this.ignoreTargets=new g2,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ni.runAndSubscribe(LH,({window:t,disposables:n})=>{n.add(pt(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(pt(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(pt(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:va,disposables:this._store}))}static addTarget(t){if(!Bi.isTouchDevice())return Lt.None;Bi.INSTANCE||(Bi.INSTANCE=new Bi);let n=Bi.INSTANCE.targets.push(t);return Tn(n)}static ignoreTarget(t){if(!Bi.isTouchDevice())return Lt.None;Bi.INSTANCE||(Bi.INSTANCE=new Bi);let n=Bi.INSTANCE.ignoreTargets.push(t);return Tn(n)}static isTouchDevice(){return"ontouchstart"in va||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,s=t.targetTouches.length;i<s;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 l=this.newGestureEvent(Es.Start,o.target);l.pageX=o.pageX,l.pageY=o.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let o=0,l=n.changedTouches.length;o<l;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<Bi.HOLD_DELAY&&Math.abs(f.initialPageX-Sr(f.rollingPageX))<30&&Math.abs(f.initialPageY-Sr(f.rollingPageY))<30){let m=this.newGestureEvent(Es.Tap,f.initialTarget);m.pageX=Sr(f.rollingPageX),m.pageY=Sr(f.rollingPageY),this.dispatchEvent(m)}else if(p>=Bi.HOLD_DELAY&&Math.abs(f.initialPageX-Sr(f.rollingPageX))<30&&Math.abs(f.initialPageY-Sr(f.rollingPageY))<30){let m=this.newGestureEvent(Es.Contextmenu,f.initialTarget);m.pageX=Sr(f.rollingPageX),m.pageY=Sr(f.rollingPageY),this.dispatchEvent(m)}else if(s===1){let m=Sr(f.rollingPageX),y=Sr(f.rollingPageY),b=Sr(f.rollingTimestamps)-f.rollingTimestamps[0],w=m-f.rollingPageX[0],S=y-f.rollingPageY[0],x=[...this.targets].filter(k=>f.initialTarget instanceof Node&&k.contains(f.initialTarget));this.inertia(t,x,i,Math.abs(w)/b,w>0?1:-1,m,Math.abs(S)/b,S>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Es.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===Es.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Bi.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===Es.Change||t.type===Es.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 s=0,o=t.initialTarget;for(;o&&o!==i;)s++,o=o.parentElement;n.push([s,i])}n.sort((i,s)=>i[0]-s[0]);for(let[i,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,s,o,l,d,f,p){this.handle=sS(t,()=>{let m=Date.now(),y=m-i,b=0,w=0,S=!0;s+=Bi.SCROLL_FRICTION*y,d+=Bi.SCROLL_FRICTION*y,s>0&&(S=!1,b=o*s*y),d>0&&(S=!1,w=f*d*y);let x=this.newGestureEvent(Es.Change);x.translationX=b,x.translationY=w,n.forEach(k=>k.dispatchEvent(x)),S||this.inertia(t,n,m,s,o,l+b,d,f,p+w)})}onTouchMove(t){let n=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let o=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn("end of an UNKNOWN touch",o);continue}let l=this.activeTouches[o.identifier],d=this.newGestureEvent(Es.Change,l.initialTarget);d.translationX=o.pageX-Sr(l.rollingPageX),d.translationY=o.pageY-Sr(l.rollingPageY),d.pageX=o.pageX,d.pageY=o.pageY,this.dispatchEvent(d),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(o.pageX),l.rollingPageY.push(o.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};wd.SCROLL_FRICTION=-.005,wd.HOLD_DELAY=700,wd.CLEAR_TAP_COUNT_TIME=400,$n([jH],wd,"isTouchDevice",1);var BH=wd,aS=class extends Lt{onclick(e,t){this._register(pt(e,mi.CLICK,n=>t(new Of(Ms(e),n))))}onmousedown(e,t){this._register(pt(e,mi.MOUSE_DOWN,n=>t(new Of(Ms(e),n))))}onmouseover(e,t){this._register(pt(e,mi.MOUSE_OVER,n=>t(new Of(Ms(e),n))))}onmouseleave(e,t){this._register(pt(e,mi.MOUSE_LEAVE,n=>t(new Of(Ms(e),n))))}onkeydown(e,t){this._register(pt(e,mi.KEY_DOWN,n=>t(new w2(n))))}onkeyup(e,t){this._register(pt(e,mi.KEY_UP,n=>t(new w2(n))))}oninput(e,t){this._register(pt(e,mi.INPUT,t))}onblur(e,t){this._register(pt(e,mi.BLUR,t))}onfocus(e,t){this._register(pt(e,mi.FOCUS,t))}onchange(e,t){this._register(pt(e,mi.CHANGE,t))}ignoreGesture(e){return BH.ignoreTarget(e)}},A2=11,PH=class extends aS{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=A2+"px",this.domNode.style.height=A2+"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 FL),this._register(k2(this.bgDomNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(k2(this.domNode,mi.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new OH),this._pointerdownScheduleRepeatTimer=this._register(new rS)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ms(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()}},zH=class Ub{constructor(t,n,i,s,o,l,d){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,s=s|0,o=o|0,l=l|0,d=d|0),this.rawScrollLeft=s,this.rawScrollTop=d,n<0&&(n=0),s+n>i&&(s=i-n),s<0&&(s=0),o<0&&(o=0),d+o>l&&(d=l-o),d<0&&(d=0),this.width=n,this.scrollWidth=i,this.scrollLeft=s,this.height=o,this.scrollHeight=l,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 Ub(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 Ub(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,s=this.scrollWidth!==t.scrollWidth,o=this.scrollLeft!==t.scrollLeft,l=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:s,scrollLeftChanged:o,heightChanged:l,scrollHeightChanged:d,scrollTopChanged:f}}},$H=class extends Lt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Re),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new zH(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 R2(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=R2.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)))}},T2=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function z_(e,t){let n=t-e;return function(i){return e+n*UH(i)}}function FH(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var R2=class Wb{constructor(t,n,i,s){this.from=t,this.to=n,this.duration=s,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 s,o;return t<n?(s=t+.75*i,o=n-.75*i):(s=t-.75*i,o=n+.75*i),FH(z_(t,s),z_(o,n),.33)}return z_(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),s=this.scrollTop(n);return new T2(i,s,!1)}return new T2(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return Wb.start(t,n,i)}static start(t,n,i){i=i+10;let s=Date.now()-10;return new Wb(t,n,s,i)}};function HH(e){return Math.pow(e,3)}function UH(e){return 1-HH(1-e)}var WH=class extends Lt{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 rS)}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":"")))}},qH=140,HL=class extends aS{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 WH(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new FL),this._shouldRender=!0,this.domNode=Dd(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(pt(this.domNode.domNode,mi.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new PH(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Dd(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(pt(this.slider.domNode,mi.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.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(),s=this._sliderPointerPosition(e);n<=s&&s<=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 s=IH(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.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,s=>{let o=this._sliderOrthogonalPointerPosition(s),l=Math.abs(o-n);if(BL&&l>qH){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let d=this._sliderPointerPosition(s)-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()}},UL=class qb{constructor(t,n,i,s,o,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=o,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new qb(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,s,o){let l=Math.max(0,i-t),d=Math.max(0,l-2*n),f=s>0&&s>i;if(!f)return{computedAvailableSize:Math.round(l),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:0,computedSliderPosition:0};let p=Math.round(Math.max(20,Math.floor(i*d/s))),m=(d-p)/(s-i),y=o*m;return{computedAvailableSize:Math.round(l),computedIsNeeded:f,computedSliderSize:Math.round(p),computedSliderRatio:m,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let t=qb._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)}},GH=class extends HL{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new UL(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.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}},KH=class extends HL{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new UL(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.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}},VH=500,M2=50,YH=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Gb=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,s=this._rear;do{let o=s===this._front?t:Math.pow(2,-i);if(t-=o,n+=this._memory[s].score*o,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(nS){let n=Ms(t.browserEvent),i=aH(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 s=null,o=new YH(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=o,this._front=0,this._rear=0):(s=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,s)}_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 s=Math.abs(t.deltaX),o=Math.abs(t.deltaY),l=Math.abs(n.deltaX),d=Math.abs(n.deltaY),f=Math.max(Math.min(s,l),1),p=Math.max(Math.min(o,d),1),m=Math.max(s,l),y=Math.max(o,d);m%f===0&&y%p===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Gb.INSTANCE=new Gb;var XH=Gb,ZH=class extends aS{constructor(e,t,n){super(),this._onScroll=this._register(new Re),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Re),this.onWillScroll=this._onWillScroll.event,this._options=QH(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new KH(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new GH(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=Dd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Dd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Dd(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new rS),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=_l(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,Ls&&(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 x2(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=_l(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new x2(n))};this._mouseWheelToDispose.push(pt(this._listenOnDomNode,mi.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=XH.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let l=!Ls&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let d=this._scrollable.getFutureScrollPosition(),f={};if(s){let p=M2*s,m=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,m)}if(o){let p=M2*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":"",s=t?" top":"",o=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${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(),VH)}},JH=class extends ZH{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 QH(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,Ls&&(t.className+=" mac"),t}var Kb=class extends Lt{constructor(e,t,n,i,s,o,l,d){super(),this._bufferService=n,this._optionsService=l,this._renderService=d,this._onRequestScrollLines=this._register(new Re),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new $H({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>sS(i.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new JH(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(s.onProtocolChange(p=>{this._scrollableElement.updateOptions({handleMouseWheel:!(p&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ni.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Tn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Tn(()=>this._styleElement.remove())),this._register(Ni.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}};Kb=$n([Ue(2,Zi),Ue(3,Ca),Ue(4,xL),Ue(5,Zc),Ue(6,Ji),Ue(7,ka)],Kb);var Vb=class extends Lt{constructor(e,t,n,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=s,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(Tn(()=>{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()}};Vb=$n([Ue(1,Zi),Ue(2,Ca),Ue(3,ch),Ue(4,ka)],Vb);var eU=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)}},Cs={full:0,left:0,center:0,right:0},Qa={full:0,left:0,center:0,right:0},Ju={full:0,left:0,center:0,right:0},Yp=class extends Lt{constructor(e,t,n,i,s,o,l,d){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=s,this._optionsService=o,this._themeService=l,this._coreBrowserService=d,this._colorZoneStore=new eU,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(Tn(()=>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);Qa.full=this._canvas.width,Qa.left=e,Qa.center=t,Qa.right=e,this._refreshDrawHeightConstants(),Ju.full=1,Ju.left=1,Ju.center=1+Qa.left,Ju.right=1+Qa.left+Qa.center}_refreshDrawHeightConstants(){Cs.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);Cs.left=t,Cs.center=t,Cs.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Cs.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Cs.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Cs.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Cs.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(Ju[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Cs[e.position||"full"]/2),Qa[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Cs[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}))}};Yp=$n([Ue(2,Zi),Ue(3,ch),Ue(4,ka),Ue(5,Ji),Ue(6,Zc),Ue(7,Ca)],Yp);var Ce;(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=""))(Ce||={});var mp;(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="Ÿ"))(mp||={});var WL;(e=>e.ST=`${Ce.ESC}\\`)(WL||={});var Yb=class{constructor(e,t,n,i,s,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=s,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(`${Ce.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,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"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=s+"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)}}};Yb=$n([Ue(2,Zi),Ue(3,Ji),Ue(4,kl),Ue(5,ka)],Yb);var vi=0,bi=0,wi=0,zn=0,L2={css:"#00000000",rgba:0},ri;(e=>{function t(s,o,l,d){return d!==void 0?`#${Yo(s)}${Yo(o)}${Yo(l)}${Yo(d)}`:`#${Yo(s)}${Yo(o)}${Yo(l)}`}e.toCss=t;function n(s,o,l,d=255){return(s<<24|o<<16|l<<8|d)>>>0}e.toRgba=n;function i(s,o,l,d){return{css:e.toCss(s,o,l,d),rgba:e.toRgba(s,o,l,d)}}e.toColor=i})(ri||={});var Sn;(e=>{function t(f,p){if(zn=(p.rgba&255)/255,zn===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,y=p.rgba>>16&255,b=p.rgba>>8&255,w=f.rgba>>24&255,S=f.rgba>>16&255,x=f.rgba>>8&255;vi=w+Math.round((m-w)*zn),bi=S+Math.round((y-S)*zn),wi=x+Math.round((b-x)*zn);let k=ri.toCss(vi,bi,wi),L=ri.toRgba(vi,bi,wi);return{css:k,rgba:L}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let y=gp.ensureContrastRatio(f.rgba,p.rgba,m);if(y)return ri.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=i;function s(f){let p=(f.rgba|255)>>>0;return[vi,bi,wi]=gp.toChannels(p),{css:ri.toCss(vi,bi,wi),rgba:p}}e.opaque=s;function o(f,p){return zn=Math.round(p*255),[vi,bi,wi]=gp.toChannels(f.rgba),{css:ri.toCss(vi,bi,wi,zn),rgba:ri.toRgba(vi,bi,wi,zn)}}e.opacity=o;function l(f,p){return zn=f.rgba&255,o(f,zn*p/255)}e.multiplyOpacity=l;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(Sn||={});var Nn;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(t=o,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return vi=parseInt(s.slice(1,2).repeat(2),16),bi=parseInt(s.slice(2,3).repeat(2),16),wi=parseInt(s.slice(3,4).repeat(2),16),ri.toColor(vi,bi,wi);case 5:return vi=parseInt(s.slice(1,2).repeat(2),16),bi=parseInt(s.slice(2,3).repeat(2),16),wi=parseInt(s.slice(3,4).repeat(2),16),zn=parseInt(s.slice(4,5).repeat(2),16),ri.toColor(vi,bi,wi,zn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.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 vi=parseInt(o[1]),bi=parseInt(o[2]),wi=parseInt(o[3]),zn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),ri.toColor(vi,bi,wi,zn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[vi,bi,wi,zn]=t.getImageData(0,0,1,1).data,zn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ri.toRgba(vi,bi,wi,zn),css:s}}e.toColor=i})(Nn||={});var Ui;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,s,o){let l=i/255,d=s/255,f=o/255,p=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),y=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return p*.2126+m*.7152+y*.0722}e.relativeLuminance2=n})(Ui||={});var gp;(e=>{function t(l,d){if(zn=(d&255)/255,zn===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,y=l>>24&255,b=l>>16&255,w=l>>8&255;return vi=y+Math.round((f-y)*zn),bi=b+Math.round((p-b)*zn),wi=w+Math.round((m-w)*zn),ri.toRgba(vi,bi,wi)}e.blend=t;function n(l,d,f){let p=Ui.relativeLuminance(l>>8),m=Ui.relativeLuminance(d>>8);if(fa(p,m)<f){if(m<p){let w=i(l,d,f),S=fa(p,Ui.relativeLuminance(w>>8));if(S<f){let x=s(l,d,f),k=fa(p,Ui.relativeLuminance(x>>8));return S>k?w:x}return w}let y=s(l,d,f),b=fa(p,Ui.relativeLuminance(y>>8));if(b<f){let w=i(l,d,f),S=fa(p,Ui.relativeLuminance(w>>8));return b>S?y:w}return y}}e.ensureContrastRatio=n;function i(l,d,f){let p=l>>24&255,m=l>>16&255,y=l>>8&255,b=d>>24&255,w=d>>16&255,S=d>>8&255,x=fa(Ui.relativeLuminance2(b,w,S),Ui.relativeLuminance2(p,m,y));for(;x<f&&(b>0||w>0||S>0);)b-=Math.max(0,Math.ceil(b*.1)),w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),x=fa(Ui.relativeLuminance2(b,w,S),Ui.relativeLuminance2(p,m,y));return(b<<24|w<<16|S<<8|255)>>>0}e.reduceLuminance=i;function s(l,d,f){let p=l>>24&255,m=l>>16&255,y=l>>8&255,b=d>>24&255,w=d>>16&255,S=d>>8&255,x=fa(Ui.relativeLuminance2(b,w,S),Ui.relativeLuminance2(p,m,y));for(;x<f&&(b<255||w<255||S<255);)b=Math.min(255,b+Math.ceil((255-b)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=fa(Ui.relativeLuminance2(b,w,S),Ui.relativeLuminance2(p,m,y));return(b<<24|w<<16|S<<8|255)>>>0}e.increaseLuminance=s;function o(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=o})(gp||={});function Yo(e){let t=e.toString(16);return t.length<2?"0"+t:t}function fa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var tU=class extends lh{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()]}},Xp=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Jr}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),s=0,o=0,l=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-s>1){let m=this._getJoinedRanges(i,l,o,t,s);for(let y=0;y<m.length;y++)n.push(m[y])}s=p,l=o,d=this._workCell.fg,f=this._workCell.bg}o+=this._workCell.getChars().length||po.length}if(this._bufferService.cols-s>1){let p=this._getJoinedRanges(i,l,o,t,s);for(let m=0;m<p.length;m++)n.push(p[m])}return n}_getJoinedRanges(e,t,n,i,s){let o=e.substring(t,n),l=[];try{l=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++)Xp._mergeRanges(l,f[p])}catch(f){console.error(f)}return this._stringRangesToCellRanges(l,i,s),l}_stringRangesToCellRanges(e,t,n){let i=0,s=!1,o=0,l=e[i];if(l){for(let d=n;d<this._bufferService.cols;d++){let f=t.getWidth(d),p=t.getString(d).length||po.length;if(f!==0){if(!s&&l[0]<=o&&(l[0]=d,s=!0),l[1]<=o){if(l[1]=d,l=e[++i],!l)break;l[0]<=o?(l[0]=d,s=!0):s=!1}o+=p}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(n){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Xp=$n([Ue(0,Zi)],Xp);function nU(e){return 57508<=e&&e<=57558}function iU(e){return 9472<=e&&e<=9631}function rU(e){return nU(e)||iU(e)}function sU(){return{css:{canvas:If(),cell:If()},device:{canvas:If(),cell:If(),char:{width:0,height:0,left:0,top:0}}}}function If(){return{width:0,height:0}}var Xb=class{constructor(e,t,n,i,s,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=s,this._decorationService=o,this._themeService=l,this._workCell=new Jr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,s,o,l,d,f,p,m){let y=[],b=this._characterJoinerService.getJoinedCharacters(t),w=this._themeService.colors,S=e.getNoBgTrimmedLength();n&&S<o+1&&(S=o+1);let x,k=0,L="",F=0,q=0,T=0,$=0,I=!1,N=0,V=!1,K=0,Q=0,Y=[],B=p!==-1&&m!==-1;for(let M=0;M<S;M++){e.loadCell(M,this._workCell);let D=this._workCell.getWidth();if(D===0)continue;let j=!1,A=M>=Q,O=M,C=this._workCell;if(b.length>0&&M===b[0][0]&&A){let $e=b.shift(),We=this._isCellInSelection($e[0],t);for(F=$e[0]+1;F<$e[1];F++)A&&=We===this._isCellInSelection(F,t);A&&=!n||o<$e[0]||o>=$e[1],A?(j=!0,C=new tU(this._workCell,e.translateToString(!0,$e[0],$e[1]),$e[1]-$e[0]),O=$e[1]-1,D=C.getWidth()):Q=$e[1]}let z=this._isCellInSelection(M,t),P=n&&M===o,R=B&&M>=p&&M<=m,W=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,$e=>{W=!0});let G=C.getChars()||po;if(G===" "&&(C.isUnderline()||C.isOverline())&&(G=" "),K=D*d-f.get(G,C.isBold(),C.isItalic()),!x)x=this._document.createElement("span");else if(k&&(z&&V||!z&&!V&&C.bg===q)&&(z&&V&&w.selectionForeground||C.fg===T)&&C.extended.ext===$&&R===I&&K===N&&!P&&!j&&!W&&A){C.isInvisible()?L+=po:L+=G,k++;continue}else k&&(x.textContent=L),x=this._document.createElement("span"),k=0,L="";if(q=C.bg,T=C.fg,$=C.extended.ext,I=R,N=K,V=z,j&&o>=M&&o<=O&&(o=M),!this._coreService.isCursorHidden&&P&&this._coreService.isCursorInitialized){if(Y.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&Y.push("xterm-cursor-blink"),Y.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":Y.push("xterm-cursor-outline");break;case"block":Y.push("xterm-cursor-block");break;case"bar":Y.push("xterm-cursor-bar");break;case"underline":Y.push("xterm-cursor-underline");break}}if(C.isBold()&&Y.push("xterm-bold"),C.isItalic()&&Y.push("xterm-italic"),C.isDim()&&Y.push("xterm-dim"),C.isInvisible()?L=po:L=C.getChars()||po,C.isUnderline()&&(Y.push(`xterm-underline-${C.extended.underlineStyle}`),L===" "&&(L=" "),!C.isUnderlineColorDefault()))if(C.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${lh.toColorRGB(C.getUnderlineColor()).join(",")})`;else{let $e=C.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&C.isBold()&&$e<8&&($e+=8),x.style.textDecorationColor=w.ansi[$e].css}C.isOverline()&&(Y.push("xterm-overline"),L===" "&&(L=" ")),C.isStrikethrough()&&Y.push("xterm-strikethrough"),R&&(x.style.textDecoration="underline");let U=C.getFgColor(),ee=C.getFgColorMode(),ne=C.getBgColor(),me=C.getBgColorMode(),Me=!!C.isInverse();if(Me){let $e=U;U=ne,ne=$e;let We=ee;ee=me,me=We}let ve,Ye,qe=!1;this._decorationService.forEachDecorationAtCell(M,t,void 0,$e=>{$e.options.layer!=="top"&&qe||($e.backgroundColorRGB&&(me=50331648,ne=$e.backgroundColorRGB.rgba>>8&16777215,ve=$e.backgroundColorRGB),$e.foregroundColorRGB&&(ee=50331648,U=$e.foregroundColorRGB.rgba>>8&16777215,Ye=$e.foregroundColorRGB),qe=$e.options.layer==="top")}),!qe&&z&&(ve=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,ne=ve.rgba>>8&16777215,me=50331648,qe=!0,w.selectionForeground&&(ee=50331648,U=w.selectionForeground.rgba>>8&16777215,Ye=w.selectionForeground)),qe&&Y.push("xterm-decoration-top");let yt;switch(me){case 16777216:case 33554432:yt=w.ansi[ne],Y.push(`xterm-bg-${ne}`);break;case 50331648:yt=ri.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(x,`background-color:#${N2((ne>>>0).toString(16),"0",6)}`);break;default:Me?(yt=w.foreground,Y.push("xterm-bg-257")):yt=w.background}switch(ve||C.isDim()&&(ve=Sn.multiplyOpacity(yt,.5)),ee){case 16777216:case 33554432:C.isBold()&&U<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(U+=8),this._applyMinimumContrast(x,yt,w.ansi[U],C,ve,void 0)||Y.push(`xterm-fg-${U}`);break;case 50331648:let $e=ri.toColor(U>>16&255,U>>8&255,U&255);this._applyMinimumContrast(x,yt,$e,C,ve,Ye)||this._addStyle(x,`color:#${N2(U.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,yt,w.foreground,C,ve,Ye)||Me&&Y.push("xterm-fg-257")}Y.length&&(x.className=Y.join(" "),Y.length=0),!P&&!j&&!W&&A?k++:x.textContent=L,K!==this.defaultSpacing&&(x.style.letterSpacing=`${K}px`),y.push(x),M=O}return x&&k&&(x.textContent=L),y}_applyMinimumContrast(e,t,n,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||rU(i.getCode()))return!1;let l=this._getContrastCache(i),d;if(!s&&!o&&(d=l.getColor(t.rgba,n.rgba)),d===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);d=Sn.ensureContrastRatio(s||t,o||n,f),l.setColor((s||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]}};Xb=$n([Ue(1,EL),Ue(2,Ji),Ue(3,Ca),Ue(4,kl),Ue(5,ch),Ue(6,Zc)],Xb);function N2(e,t,n){for(;e.length<n;)e=t+e;return e}var aU=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.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,s,o],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),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 l=this._measure(e,0);return l>0&&(this._flat[i]=l),l}let s=e;t&&(s+="B"),n&&(s+="I");let o=this._holey.get(s);if(o===void 0){let l=0;t&&(l|=1),n&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(s,o)}return o}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},oU=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 s=e.buffers.active.ydisp,o=t[1]-s,l=n[1]-s,d=Math.max(o,0),f=Math.min(l,e.rows-1);if(d>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=o,this.viewportEndRow=l,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 lU(){return new oU}var $_="xterm-dom-renderer-owner-",Fr="xterm-rows",Df="xterm-fg-",O2="xterm-bg-",Qu="xterm-focus",jf="xterm-selection",cU=1,Zb=class extends Lt{constructor(e,t,n,i,s,o,l,d,f,p,m,y,b,w){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=s,this._helperContainer=o,this._linkifier2=l,this._charSizeService=f,this._optionsService=p,this._bufferService=m,this._coreService=y,this._coreBrowserService=b,this._themeService=w,this._terminalClass=cU++,this._rowElements=[],this._selectionRenderModel=lU(),this.onRequestRedraw=this._register(new Re).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Fr),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(jf),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=sU(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(S=>this._injectCss(S))),this._injectCss(this._themeService.colors),this._rowFactory=d.createInstance(Xb,document),this._element.classList.add($_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(S=>this._handleLinkHover(S))),this._register(this._linkifier2.onHideLinkUnderline(S=>this._handleLinkLeave(S))),this._register(Tn(()=>{this._element.classList.remove($_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new aU(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} .${Fr} 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} .${Fr} { 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} .${Fr} .xterm-dim { color: ${Sn.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}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Fr}.${Qu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Fr}.${Qu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Fr}.${Qu} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Fr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Fr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Fr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Fr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Fr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${jf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${jf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${jf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Df}${o} { color: ${l.css}; }${this._terminalSelector} .${Df}${o}.xterm-dim { color: ${Sn.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${O2}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Df}257 { color: ${Sn.opaque(e.background).css}; }${this._terminalSelector} .${Df}257.xterm-dim { color: ${Sn.multiplyOpacity(Sn.opaque(e.background),.5).css}; }${this._terminalSelector} .${O2}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(Qu),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Qu),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,s=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=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],l-o+1))}else{let f=i===o?e[0]:0,p=o===s?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(o,f,p));let m=l-o-1;if(d.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==l){let y=s===l?t[0]:this._bufferService.cols;d.appendChild(this._createSelectionElement(l,0,y))}}this._selectionContainer.appendChild(d)}_createSelectionElement(e,t,n,i=1){let s=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${o}px`,s.style.width=`${l}px`,s}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,s=Math.min(n.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=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],y=n.lines.get(p);if(!m||!y)break;m.replaceChildren(...this._rowFactory.createRow(y,p,p===i,l,d,s,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${$_}${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,s,o){n<0&&(e=0),i<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),i=Math.max(Math.min(i,l),0),s=Math.min(s,this._bufferService.cols);let d=this._bufferService.buffer,f=d.ybase+d.y,p=Math.min(d.x,s-1),m=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,b=this._optionsService.rawOptions.cursorInactiveStyle;for(let w=n;w<=i;++w){let S=w+d.ydisp,x=this._rowElements[w],k=d.lines.get(S);if(!x||!k)break;x.replaceChildren(...this._rowFactory.createRow(k,S,S===f,y,b,p,m,this.dimensions.css.cell.width,this._widthCache,o?w===n?e:0:-1,o?(w===i?t:s)-1:-1))}}};Zb=$n([Ue(7,Qw),Ue(8,Hm),Ue(9,Ji),Ue(10,Zi),Ue(11,kl),Ue(12,Ca),Ue(13,Zc)],Zb);var Jb=class extends Lt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Re),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new dU(this._optionsService))}catch{this._measureStrategy=this._register(new uU(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())}};Jb=$n([Ue(2,Ji)],Jb);var qL=class extends Lt{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)}},uU=class extends qL{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}},dU=class extends qL{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}},hU=class extends Lt{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 fU(this._window)),this._onDprChange=this._register(new Re),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Re),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Ni.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(pt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(pt(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}},fU=class extends Lt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Fc),this._onDprChange=this._register(new Re),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Tn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=pt(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)}},pU=class extends Lt{constructor(){super(),this.linkProviders=[],this._register(Tn(()=>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 oS(e,t,n){let i=n.getBoundingClientRect(),s=e.getComputedStyle(n),o=parseInt(s.getPropertyValue("padding-left")),l=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-o,t.clientY-i.top-l]}function mU(e,t,n,i,s,o,l,d,f){if(!o)return;let p=oS(e,t,n);if(p)return p[0]=Math.ceil((p[0]+(f?l/2:0))/l),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),s),p}var Qb=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,s){return mU(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=oS(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])}}};Qb=$n([Ue(0,ka),Ue(1,Hm)],Qb);var gU=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=[]}},GL={};EF(GL,{getSafariVersion:()=>_U,isChromeOS:()=>XL,isFirefox:()=>KL,isIpad:()=>vU,isIphone:()=>bU,isLegacyEdge:()=>yU,isLinux:()=>lS,isMac:()=>Zp,isNode:()=>Um,isSafari:()=>VL,isWindows:()=>YL});var Um=typeof process<"u"&&"title"in process,uh=Um?"node":navigator.userAgent,dh=Um?"node":navigator.platform,KL=uh.includes("Firefox"),yU=uh.includes("Edge"),VL=/^((?!chrome|android).)*safari/i.test(uh);function _U(){if(!VL)return 0;let e=uh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Zp=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(dh),vU=dh==="iPad",bU=dh==="iPhone",YL=["Windows","Win16","Win32","WinCE"].includes(dh),lS=dh.indexOf("Linux")>=0,XL=/\bCrOS\b/.test(uh),ZL=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(),s=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),s=e.timeRemaining(),n*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},wU=class extends ZL{_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())}}},SU=class extends ZL{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Jp=!Um&&"requestIdleCallback"in window?SU:wU,xU=class{constructor(){this._queue=new Jp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},e0=class extends Lt{constructor(e,t,n,i,s,o,l,d,f){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=s,this._coreBrowserService=d,this._renderer=this._register(new Fc),this._pausedResizeTask=new xU,this._observerDisposable=this._register(new Fc),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 Re),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Re),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Re),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Re),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new gU((p,m)=>this._renderRows(p,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new CU(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Tn(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.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(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.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=Tn(()=>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()}};e0=$n([Ue(2,Ji),Ue(3,Hm),Ue(4,kl),Ue(5,ch),Ue(6,Zi),Ue(7,Ca),Ue(8,Zc)],e0);var CU=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 kU(e,t,n,i){let s=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return TU(s,o,e,t,n,i)+Wm(o,t,n,i)+RU(s,o,e,t,n,i);let l;if(o===t)return l=s>e?"D":"C",qd(Math.abs(s-e),Wd(l,i));l=o>t?"D":"C";let d=Math.abs(o-t),f=AU(o>t?e:s,n)+(d-1)*n.cols+1+EU(o>t?s:e);return qd(f,Wd(l,i))}function EU(e,t){return e-1}function AU(e,t){return t.cols-e}function TU(e,t,n,i,s,o){return Wm(t,i,s,o).length===0?"":qd(QL(e,t,e,t-vl(t,s),!1,s).length,Wd("D",o))}function Wm(e,t,n,i){let s=e-vl(e,n),o=t-vl(t,n),l=Math.abs(s-o)-MU(e,t,n);return qd(l,Wd(JL(e,t),i))}function RU(e,t,n,i,s,o){let l;Wm(t,i,s,o).length>0?l=i-vl(i,s):l=t;let d=i,f=LU(e,t,n,i,s,o);return qd(QL(e,l,n,d,f==="C",s).length,Wd(f,o))}function MU(e,t,n){let i=0,s=e-vl(e,n),o=t-vl(t,n);for(let l=0;l<Math.abs(s-o);l++){let d=JL(e,t)==="A"?-1:1;n.buffer.lines.get(s+d*l)?.isWrapped&&i++}return i}function vl(e,t){let n=0,i=t.buffer.lines.get(e),s=i?.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),s=i?.isWrapped;return n}function LU(e,t,n,i,s,o){let l;return Wm(n,i,s,o).length>0?l=i-vl(i,s):l=t,e<n&&l<=i||e>=n&&l<i?"C":"D"}function JL(e,t){return e>t?"A":"B"}function QL(e,t,n,i,s,o){let l=e,d=t,f="";for(;(l!==n||d!==i)&&d>=0&&d<o.buffer.lines.length;)l+=s?1:-1,s&&l>o.cols-1?(f+=o.buffer.translateBufferLineToString(d,!1,e,l),l=0,e=0,d++):!s&&l<0&&(f+=o.buffer.translateBufferLineToString(d,!1,0,e+1),l=o.cols-1,e=l,d--);return f+o.buffer.translateBufferLineToString(d,!1,e,l)}function Wd(e,t){let n=t?"O":"[";return Ce.ESC+n+e}function qd(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var NU=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 I2(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 F_=50,OU=15,IU=50,DU=500,jU=" ",BU=new RegExp(jU,"g"),t0=class extends Lt{constructor(e,t,n,i,s,o,l,d,f){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=s,this._mouseService=o,this._optionsService=l,this._renderService=d,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Jr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Re),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Re),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Re),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Re),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 NU(this._bufferService),this._activeSelectionMode=0,this._register(Tn(()=>{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 s=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let d=n.translateBufferLineToString(l,!0,s,o);i.push(d)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let o=e[1]+1;o<=t[1]-1;o++){let l=n.lines.get(o),d=n.translateBufferLineToString(o,!0);l?.isWrapped?i[i.length-1]+=d:i.push(d)}if(e[1]!==t[1]){let o=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?i[i.length-1]+=l:i.push(l)}}return i.map(s=>s.replace(BU," ")).join(YL?`\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())),lS&&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=I2(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=oS(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,-F_),F_),t/=F_,t/Math.abs(t)+Math.round(t*(OU-1)))}shouldForceSelection(e){return Zp?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(),IU)}_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&&!(Zp&&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<DU&&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=kU(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 s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==i&&(n+=s-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 s=this._bufferService.buffer,o=s.lines.get(e[1]);if(!o)return;let l=s.translateBufferLineToString(e[1],!1),d=this._convertViewportColToCharacterIndex(o,e[0]),f=d,p=e[0]-d,m=0,y=0,b=0,w=0;if(l.charAt(d)===" "){for(;d>0&&l.charAt(d-1)===" ";)d--;for(;f<l.length&&l.charAt(f+1)===" ";)f++}else{let k=e[0],L=e[0];o.getWidth(k)===0&&(m++,k--),o.getWidth(L)===2&&(y++,L++);let F=o.getString(L).length;for(F>1&&(w+=F-1,f+=F-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let q=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,k--):q>1&&(b+=q-1,d-=q-1),d--,k--}for(;L<o.length&&f+1<l.length&&!this._isCharWordSeparator(o.loadCell(L+1,this._workCell));){o.loadCell(L+1,this._workCell);let q=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,L++):q>1&&(w+=q-1,f+=q-1),f++,L++}}f++;let S=d+p-m+b,x=Math.min(this._bufferService.cols,f-d+m+y-b-w);if(!(!t&&l.slice(d,f).trim()==="")){if(n&&S===0&&o.getCodePoint(0)!==32){let k=s.lines.get(e[1]-1);if(k&&o.isWrapped&&k.getCodePoint(this._bufferService.cols-1)!==32){let L=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(L){let F=this._bufferService.cols-L.start;S-=F,x+=F}}}if(i&&S+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let k=s.lines.get(e[1]+1);if(k?.isWrapped&&k.getCodePoint(0)!==32){let L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(x+=L.length)}}return{start:S,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=I2(n,this._bufferService.cols)}};t0=$n([Ue(3,Zi),Ue(4,kl),Ue(5,eS),Ue(6,Ji),Ue(7,ka),Ue(8,Ca)],t0);var D2=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={}}},j2=class{constructor(){this._color=new D2,this._css=new D2}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()}},ci=Object.freeze((()=>{let e=[Nn.toColor("#2e3436"),Nn.toColor("#cc0000"),Nn.toColor("#4e9a06"),Nn.toColor("#c4a000"),Nn.toColor("#3465a4"),Nn.toColor("#75507b"),Nn.toColor("#06989a"),Nn.toColor("#d3d7cf"),Nn.toColor("#555753"),Nn.toColor("#ef2929"),Nn.toColor("#8ae234"),Nn.toColor("#fce94f"),Nn.toColor("#729fcf"),Nn.toColor("#ad7fa8"),Nn.toColor("#34e2e2"),Nn.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],s=t[n/6%6|0],o=t[n%6];e.push({css:ri.toCss(i,s,o),rgba:ri.toRgba(i,s,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:ri.toCss(i,i,i),rgba:ri.toRgba(i,i,i)})}return e})()),Jo=Nn.toColor("#ffffff"),Sd=Nn.toColor("#000000"),B2=Nn.toColor("#ffffff"),P2=Sd,ed={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},PU=Jo,n0=class extends Lt{constructor(e){super(),this._optionsService=e,this._contrastCache=new j2,this._halfContrastCache=new j2,this._onChangeColors=this._register(new Re),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Jo,background:Sd,cursor:B2,cursorAccent:P2,selectionForeground:void 0,selectionBackgroundTransparent:ed,selectionBackgroundOpaque:Sn.blend(Sd,ed),selectionInactiveBackgroundTransparent:ed,selectionInactiveBackgroundOpaque:Sn.blend(Sd,ed),scrollbarSliderBackground:Sn.opacity(Jo,.2),scrollbarSliderHoverBackground:Sn.opacity(Jo,.4),scrollbarSliderActiveBackground:Sn.opacity(Jo,.5),overviewRulerBorder:Jo,ansi:ci.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=hn(e.foreground,Jo),t.background=hn(e.background,Sd),t.cursor=Sn.blend(t.background,hn(e.cursor,B2)),t.cursorAccent=Sn.blend(t.background,hn(e.cursorAccent,P2)),t.selectionBackgroundTransparent=hn(e.selectionBackground,ed),t.selectionBackgroundOpaque=Sn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=hn(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Sn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?hn(e.selectionForeground,L2):void 0,t.selectionForeground===L2&&(t.selectionForeground=void 0),Sn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Sn.opacity(t.selectionBackgroundTransparent,.3)),Sn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Sn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=hn(e.scrollbarSliderBackground,Sn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=hn(e.scrollbarSliderHoverBackground,Sn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=hn(e.scrollbarSliderActiveBackground,Sn.opacity(t.foreground,.5)),t.overviewRulerBorder=hn(e.overviewRulerBorder,PU),t.ansi=ci.slice(),t.ansi[0]=hn(e.black,ci[0]),t.ansi[1]=hn(e.red,ci[1]),t.ansi[2]=hn(e.green,ci[2]),t.ansi[3]=hn(e.yellow,ci[3]),t.ansi[4]=hn(e.blue,ci[4]),t.ansi[5]=hn(e.magenta,ci[5]),t.ansi[6]=hn(e.cyan,ci[6]),t.ansi[7]=hn(e.white,ci[7]),t.ansi[8]=hn(e.brightBlack,ci[8]),t.ansi[9]=hn(e.brightRed,ci[9]),t.ansi[10]=hn(e.brightGreen,ci[10]),t.ansi[11]=hn(e.brightYellow,ci[11]),t.ansi[12]=hn(e.brightBlue,ci[12]),t.ansi[13]=hn(e.brightMagenta,ci[13]),t.ansi[14]=hn(e.brightCyan,ci[14]),t.ansi[15]=hn(e.brightWhite,ci[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]=hn(e.extendedAnsi[i],ci[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()}}};n0=$n([Ue(0,Ji)],n0);function hn(e,t){if(e!==void 0)try{return Nn.toColor(e)}catch{}return t}var zU=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)}},$U=class{constructor(){this._services=new zU,this._services.set(Qw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=OF(e).sort((o,l)=>o.index-l.index),i=[];for(let o of n){let l=this._services.get(o.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${o.id._id}.`);i.push(l)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},FU={trace:0,debug:1,info:2,warn:3,error:4,off:5},HU="xterm.js: ",i0=class extends Lt{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=FU[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?"":HU)+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)}};i0=$n([Ue(0,Ji)],i0);var z2=class extends Lt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Re),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Re),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Re),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 s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Mt=3,ni=Object.freeze(new lh),Bf=0,H_=2,xd=class eN{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Mt);let s=n||Jr.fromCharData([0,vL,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let n=this._data[t*Mt+0],i=n&2097151;return[this._data[t*Mt+1],n&2097152?this._combined[t]:i?lo(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*Mt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*Mt+0]=t|2097152|n[2]<<22):this._data[t*Mt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*Mt+0]>>22}hasWidth(t){return this._data[t*Mt+0]&12582912}getFg(t){return this._data[t*Mt+1]}getBg(t){return this._data[t*Mt+2]}hasContent(t){return this._data[t*Mt+0]&4194303}getCodePoint(t){let n=this._data[t*Mt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*Mt+0]&2097152}getString(t){let n=this._data[t*Mt+0];return n&2097152?this._combined[t]:n&2097151?lo(n&2097151):""}isProtected(t){return this._data[t*Mt+2]&536870912}loadCell(t,n){return Bf=t*Mt,n.content=this._data[Bf+0],n.fg=this._data[Bf+1],n.bg=this._data[Bf+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*Mt+0]=n.content,this._data[t*Mt+1]=n.fg,this._data[t*Mt+2]=n.bg}setCellFromCodepoint(t,n,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*Mt+0]=n|i<<22,this._data[t*Mt+1]=s.fg,this._data[t*Mt+2]=s.bg}addCodepointToCell(t,n,i){let s=this._data[t*Mt+0];s&2097152?this._combined[t]+=lo(n):s&2097151?(this._combined[t]=lo(s&2097151)+lo(n),s&=-2097152,s|=2097152):s=n|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*Mt+0]=s}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 s=new Jr;for(let o=this.length-t-n-1;o>=0;--o)this.setCell(t+n+o,this.loadCell(t+o,s));for(let o=0;o<n;++o)this.setCell(t+o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,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 s=new Jr;for(let o=0;o<this.length-t-n;++o)this.setCell(t+o,this.loadCell(t+n+o,s));for(let o=this.length-n;o<this.length;++o)this.setCell(o,i)}else for(let s=t;s<this.length;++s)this.setCell(s,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,s=!1){if(s){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*H_<this._data.buffer.byteLength;let i=t*Mt;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let l=0;l<s.length;l++){let d=parseInt(s[l],10);d>=t&&delete this._combined[d]}let o=Object.keys(this._extendedAttrs);for(let l=0;l<o.length;l++){let d=parseInt(o[l],10);d>=t&&delete this._extendedAttrs[d]}}return this.length=t,i*4*H_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*H_<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 eN(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Mt+0]&4194303)return t+(this._data[t*Mt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Mt+0]&4194303||this._data[t*Mt+2]&50331648)return t+(this._data[t*Mt+0]>>22);return 0}copyCellsFrom(t,n,i,s,o){let l=t._data;if(o)for(let f=s-1;f>=0;f--){for(let p=0;p<Mt;p++)this._data[(i+f)*Mt+p]=l[(n+f)*Mt+p];l[(n+f)*Mt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}else for(let f=0;f<s;f++){for(let p=0;p<Mt;p++)this._data[(i+f)*Mt+p]=l[(n+f)*Mt+p];l[(n+f)*Mt+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,s){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let o="";for(;n<i;){let l=this._data[n*Mt+0],d=l&2097151,f=l&2097152?this._combined[n]:d?lo(d):po;if(o+=f,s)for(let p=0;p<f.length;++p)s.push(n);n+=l>>22||1}return s&&s.push(n),o}};function UU(e,t,n,i,s,o){let l=[];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 y=0,b=Gd(m,y,t),w=1,S=0;for(;w<m.length;){let k=Gd(m,w,t),L=k-S,F=n-b,q=Math.min(L,F);m[y].copyCellsFrom(m[w],S,b,q,!1),b+=q,b===n&&(y++,b=0),S+=q,S===k&&(w++,S=0),b===0&&y!==0&&m[y-1].getWidth(n-1)===2&&(m[y].copyCellsFrom(m[y-1],n-1,b++,1,!1),m[y-1].setCell(n-1,s))}m[y].replaceCells(b,n,s);let x=0;for(let k=m.length-1;k>0&&(k>y||m[k].getTrimmedLength()===0);k--)x++;x>0&&(l.push(d+m.length-x),l.push(x)),d+=m.length-1}return l}function WU(e,t){let n=[],i=0,s=t[i],o=0;for(let l=0;l<e.length;l++)if(s===l){let d=t[++i];e.onDeleteEmitter.fire({index:l-o,amount:d}),l+=d-1,o+=d,s=t[++i]}else n.push(l);return{layout:n,countRemoved:o}}function qU(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 GU(e,t,n){let i=[],s=e.map((f,p)=>Gd(e,p,t)).reduce((f,p)=>f+p),o=0,l=0,d=0;for(;d<s;){if(s-d<n){i.push(s-d);break}o+=n;let f=Gd(e,l,t);o>f&&(o-=f,l++);let p=e[l].getWidth(o-1)===2;p&&o--;let m=p?n-1:n;i.push(m),d+=m}return i}function Gd(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,s=e[t+1].getWidth(0)===2;return i&&s?n-1:n}var tN=class nN{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=nN._nextId++,this._onDispose=this.register(new Re),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),_l(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};tN._nextId=1;var KU=tN,hi={},Qo=hi.B;hi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};hi.A={"#":"£"};hi.B=void 0;hi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};hi.C=hi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};hi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};hi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};hi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};hi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};hi.E=hi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};hi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};hi.H=hi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};hi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var $2=4294967295,F2=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=ni.clone(),this.savedCharset=Qo,this.markers=[],this._nullCell=Jr.fromCharData([0,vL,1,0]),this._whitespaceCell=Jr.fromCharData([0,po,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Jp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new z2(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 Vp),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 Vp),this._whitespaceCell}getBlankLine(e,t){return new xd(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>$2?$2:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ni);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 z2(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ni),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)i+=+this.lines.get(l).resize(e,n);let o=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 xd(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 xd(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let l=this.lines.length-s;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=s}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=UU(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ni),n);if(i.length>0){let s=WU(this.lines,i);qU(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(ni),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new xd(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(ni),s=[],o=0;for(let l=this.lines.length-1;l>=0;l--){let d=this.lines.get(l);if(!d||!d.isWrapped&&d.getTrimmedLength()<=e)continue;let f=[d];for(;d.isWrapped&&l>0;)d=this.lines.get(--l),f.unshift(d);if(!n){let q=this.ybase+this.y;if(q>=l&&q<l+f.length)continue}let p=f[f.length-1].getTrimmedLength(),m=GU(f,this._cols,e),y=m.length-f.length,b;this.ybase===0&&this.y!==this.lines.length-1?b=Math.max(0,this.y-this.lines.maxLength+y):b=Math.max(0,this.lines.length-this.lines.maxLength+y);let w=[];for(let q=0;q<y;q++){let T=this.getBlankLine(ni,!0);w.push(T)}w.length>0&&(s.push({start:l+f.length+o,newLines:w}),o+=w.length),f.push(...w);let S=m.length-1,x=m[S];x===0&&(S--,x=m[S]);let k=f.length-y-1,L=p;for(;k>=0;){let q=Math.min(L,x);if(f[S]===void 0)break;if(f[S].copyCellsFrom(f[k],L-q,x-q,q,!0),x-=q,x===0&&(S--,x=m[S]),L-=q,L===0){k--;let T=Math.max(k,0);L=Gd(f,T,this._cols)}}for(let q=0;q<f.length;q++)m[q]<e&&f[q].setCell(m[q],i);let F=y-b;for(;F-- >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+y,this.ybase+t-1)}if(s.length>0){let l=[],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,y=s[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(y&&y.start>p+b){for(let k=y.newLines.length-1;k>=0;k--)this.lines.set(x--,y.newLines[k]);x++,l.push({index:p+1,amount:y.newLines.length}),b+=y.newLines.length,y=s[++m]}else this.lines.set(x,d[p--]);let w=0;for(let x=l.length-1;x>=0;x--)l[x].index+=w,this.lines.onInsertEmitter.fire(l[x]),w+=l[x].amount;let S=Math.max(0,f+o-this.lines.maxLength);S>0&&this.lines.onTrimEmitter.fire(S)}}translateBufferLineToString(e,t,n=0,i){let s=this.lines.get(e);return s?s.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 KU(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)}},VU=class extends Lt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Re),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 F2(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new F2(!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)}},iN=2,rN=1,r0=class extends Lt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Re),this.onResize=this._onResize.event,this._onScroll=this._register(new Re),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,iN),this.rows=Math.max(e.rawOptions.rows||0,rN),this.buffers=this._register(new VU(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 s=n.ybase+n.scrollTop,o=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;o===n.lines.length-1?l?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(o+1,0,i.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=o-s+1;n.lines.shiftElements(s+1,l-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))}};r0=$n([Ue(0,Ji)],r0);var oc={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:Zp,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},YU=["normal","bold","100","200","300","400","500","600","700","800","900"],XU=class extends Lt{constructor(e){super(),this._onOptionChange=this._register(new Re),this.onOptionChange=this._onOptionChange.event;let t={...oc};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(Tn(()=>{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 oc))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in oc))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=oc[e]),!ZU(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=oc[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=YU.includes(t)?t:oc[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 ZU(e){return e==="block"||e==="underline"||e==="bar"}function Cd(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]&&Cd(e[i],t-1);return n}var H2=Object.freeze({insertMode:!1}),U2=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),s0=class extends Lt{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 Re),this.onData=this._onData.event,this._onUserInput=this._register(new Re),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Re),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Re),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Cd(H2),this.decPrivateModes=Cd(U2)}reset(){this.modes=Cd(H2),this.decPrivateModes=Cd(U2)}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))}};s0=$n([Ue(0,Zi),Ue(1,CL),Ue(2,Ji)],s0);var W2={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 U_(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 W_=String.fromCharCode,q2={DEFAULT:e=>{let t=[U_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${W_(t[0])}${W_(t[1])}${W_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${U_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${U_(e,!0)};${e.x};${e.y}${t}`}},a0=class extends Lt{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 Re),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(W2))this.addProtocol(i,W2[i]);for(let i of Object.keys(q2))this.addEncoding(i,q2[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,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_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)}};a0=$n([Ue(0,Zi),Ue(1,kl),Ue(2,Ji)],a0);var q_=[[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]],JU=[[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]],ui;function QU(e,t){let n=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(s=n+i>>1,e>t[s][1])n=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var eW=class{constructor(){if(this.version="6",!ui){ui=new Uint8Array(65536),ui.fill(1),ui[0]=0,ui.fill(0,1,32),ui.fill(0,127,160),ui.fill(2,4352,4448),ui[9001]=2,ui[9002]=2,ui.fill(2,11904,42192),ui[12351]=1,ui.fill(2,44032,55204),ui.fill(2,63744,64256),ui.fill(2,65040,65050),ui.fill(2,65072,65136),ui.fill(2,65280,65377),ui.fill(2,65504,65511);for(let e=0;e<q_.length;++e)ui.fill(0,q_[e][0],q_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ui[e]:QU(e,JU)?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 s=il.extractWidth(t);s===0?i=!1:s>n&&(n=s)}return il.createPropertyValue(0,n,i)}},il=class yp{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Re,this.onChange=this._onChange.event;let t=new eW;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,s=t.length;for(let o=0;o<s;++o){let l=t.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return n+this.wcwidth(l);let p=t.charCodeAt(o);56320<=p&&p<=57343?l=(l-55296)*1024+p-56320+65536:n+=this.wcwidth(p)}let d=this.charProperties(l,i),f=yp.extractWidth(d);yp.extractShouldJoin(d)&&(f-=yp.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},tW=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 G2(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 td=2147483647,nW=256,sN=class o0{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>nW)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 o0;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let o=0;o<s.length;++o)n.addSubParam(s[o]);else n.addParam(s)}return n}clone(){let t=new o0(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,s=this._subParamsIdx[n]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}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>td?td: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>td?td: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,s=this._subParamsIdx[n]&255;s-i>0&&(t[n]=this._subParams.slice(i,s))}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,s=i[n-1];i[n-1]=~s?Math.min(s*10+t,td):t}},nd=[],iW=class{constructor(){this._state=0,this._active=nd,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=nd}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=nd,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||nd,!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",Fm(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,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&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=nd,this._id=-1,this._state=0}}},xr=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+=Fm(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}},id=[],rW=class{constructor(){this._handlers=Object.create(null),this._active=id,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=id}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=id,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||id,!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",Fm(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,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&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=id,this._ident=0}},kd=new sN;kd.addParam(0);var K2=class{constructor(e){this._handler=e,this._data="",this._params=kd,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():kd,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Fm(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=kd,this._data="",this._hitLimit=!1,n));return this._params=kd,this._data="",this._hitLimit=!1,t}},sW=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 s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|i}},Yr=160,aW=(function(){let e=new sW(4095),t=Array.apply(null,Array(256)).map((d,f)=>f),n=(d,f)=>t.slice(d,f),i=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let o=n(0,14),l;e.setDefault(1,0),e.addMany(i,0,2,0);for(l in o)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,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(s,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(s,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(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,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(s,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(s,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(Yr,0,2,0),e.add(Yr,8,5,8),e.add(Yr,6,0,6),e.add(Yr,11,0,11),e.add(Yr,13,13,13),e})(),oW=class extends Lt{constructor(e=aW){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 sN,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(Tn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new iW),this._dcsParser=this._register(new rW),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 s=0;s<e.intermediates.length;++s){let o=e.intermediates.charCodeAt(s);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 s=i.indexOf(t);s!==-1&&i.splice(s,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 s=i.indexOf(t);s!==-1&&i.splice(s,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,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,n){let i=0,s=0,o=0,l;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&&(l=d[f](this._params),l!==!0);f--)if(l instanceof Promise)return this._parseStack.handlerPos=f,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&f>-1){for(;f>=0&&(l=d[f](),l!==!0);f--)if(l instanceof Promise)return this._parseStack.handlerPos=f,l}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(i!==24&&i!==26,n),l)return l;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],l=this._oscParser.end(i!==24&&i!==26,n),l)return l;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],s=this._transitions.table[this.currentState<<8|(i<160?i:Yr)],s>>4){case 2:for(let b=d+1;;++b){if(b>=t||(i=e[b])<32||i>126&&i<Yr){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Yr){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Yr){this._printHandler(e,d,b),d=b-1;break}if(++b>=t||(i=e[b])<32||i>126&&i<Yr){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&&(l=f[p](this._params),l!==!0);p--)if(l instanceof Promise)return this._preserveStack(3,f,p,s,d),l;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],y=m?m.length-1:-1;for(;y>=0&&(l=m[y](),l!==!0);y--)if(l instanceof Promise)return this._preserveStack(4,m,y,s,d),l;y<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<Yr){this._dcsParser.put(e,d,b),d=b-1;break}break;case 14:if(l=this._dcsParser.unhook(i!==24&&i!==26),l)return this._preserveStack(6,[],0,s,d),l;i===27&&(s|=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<Yr){this._oscParser.put(e,d,b),d=b-1;break}break;case 6:if(l=this._oscParser.end(i!==24&&i!==26),l)return this._preserveStack(5,[],0,s,d),l;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},lW=/^([\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})$/,cW=/^[\da-f]+$/;function V2(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=lW.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),cW.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let o=parseInt(t.slice(n*s,n*s+n),16);i[s]=n===1?o<<4:n===2?o:n===3?o>>4:o>>8}return i}}function G_(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 uW(e,t=16){let[n,i,s]=e;return`rgb:${G_(n,t)}/${G_(i,t)}/${G_(s,t)}`}var dW={"(":0,")":1,"*":2,"+":3,"-":1,".":2},eo=131072,Y2=10;function X2(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 Z2=5e3,J2=0,hW=class extends Lt{constructor(e,t,n,i,s,o,l,d,f=new oW){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=s,this._oscLinkService=o,this._coreMouseService=l,this._unicodeService=d,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new LF,this._utf8Decoder=new NF,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ni.clone(),this._eraseAttrDataInternal=ni.clone(),this._onRequestBell=this._register(new Re),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Re),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Re),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Re),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Re),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Re),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Re),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Re),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Re),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Re),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Re),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Re),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Re),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 l0(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,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:p,action:m,data:y})}),this._parser.setDcsHandlerFallback((p,m,y)=>{m==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(p),action:m,payload:y})}),this._parser.setPrintHandler((p,m,y)=>this.print(p,m,y)),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(Ce.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ce.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ce.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ce.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ce.HT,()=>this.tab()),this._parser.setExecuteHandler(Ce.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ce.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(mp.IND,()=>this.index()),this._parser.setExecuteHandler(mp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(mp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new xr(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new xr(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new xr(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new xr(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new xr(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new xr(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new xr(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new xr(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new xr(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new xr(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new xr(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new xr(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 hi)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 K2((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"),Z2))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Z2} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,s=this._activeBuffer.y,o=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>eo&&(o=this._parseStack.position+eo)}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<eo&&(this._parseBuffer=new Uint32Array(Math.min(e.length,eo))),l||this._dirtyRowTracker.clearRange(),e.length>eo)for(let p=o;p<e.length;p+=eo){let m=p+eo<e.length?p+eo:e.length,y=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,y))return this._preserveStack(i,s,y,p),this._logSlowResolvingAsync(n),n}else if(!l){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,s,p,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&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,s,o=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,d=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,p=this._coreService.modes.insertMode,m=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,m);let b=this._parser.precedingJoinState;for(let w=t;w<n;++w){if(i=e[w],i<127&&o){let L=o[String.fromCharCode(i)];L&&(i=L.charCodeAt(0))}let S=this._unicodeService.charProperties(i,b);s=il.extractWidth(S);let x=il.extractShouldJoin(S),k=x?il.extractWidth(b):0;if(b=S,l&&this._onA11yChar.fire(lo(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-k>d){if(f){let L=y,F=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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&y instanceof xd&&y.copyCellsFrom(L,F,0,k,!1);F<d;)L.setCellFromCodepoint(F++,0,1,m)}else if(this._activeBuffer.x=d-1,s===2)continue}if(x&&this._activeBuffer.x){let L=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-L,i,s);for(let F=s-k;--F>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,m);continue}if(p&&(y.insertCells(this._activeBuffer.x,s-k,this._activeBuffer.getNullCell(m)),y.getWidth(d-1)===2&&y.setCellFromCodepoint(d-1,0,1,m)),y.setCellFromCodepoint(this._activeBuffer.x++,i,s,m),s>0)for(;--s;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,m)}this._parser.precedingJoinState=b,this._activeBuffer.x<d&&n-t>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.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=>X2(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new K2(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new xr(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,s=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),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,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-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(ni));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=il.extractWidth(t),s=this._activeBuffer.x-i,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),l=new Uint32Array(o.length*n),d=0;for(let p=0;p<o.length;){let m=o.codePointAt(p)||0;l[d++]=m,p+=m>65535?2:1}let f=d;for(let p=1;p<n;++p)l.copyWithin(f,0,d),f+=d;return this.print(l,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(Ce.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ce.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ce.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ce.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ce.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,Qo),this._charsetService.setgCharset(1,Qo),this._charsetService.setgCharset(2,Qo),this._charsetService.setgCharset(3,Qo);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:s,activeEncoding:o}=this._coreMouseService,l=this._coreService,{buffers:d,cols:f}=this._bufferService,{active:p,alt:m}=d,y=this._optionsService.rawOptions,b=(x,k)=>(l.triggerDataEvent(`${Ce.ESC}[${t?"":"?"}${x};${k}$y`),!0),w=x=>x?1:2,S=e.params[0];return t?S===2?b(S,4):S===4?b(S,w(l.modes.insertMode)):S===12?b(S,3):S===20?b(S,w(y.convertEol)):b(S,0):S===1?b(S,w(i.applicationCursorKeys)):S===3?b(S,y.windowOptions.setWinLines?f===80?2:f===132?1:0:0):S===6?b(S,w(i.origin)):S===7?b(S,w(i.wraparound)):S===8?b(S,3):S===9?b(S,w(s==="X10")):S===12?b(S,w(y.cursorBlink)):S===25?b(S,w(!l.isCursorHidden)):S===45?b(S,w(i.reverseWraparound)):S===66?b(S,w(i.applicationKeypad)):S===67?b(S,4):S===1e3?b(S,w(s==="VT200")):S===1002?b(S,w(s==="DRAG")):S===1003?b(S,w(s==="ANY")):S===1004?b(S,w(i.sendFocus)):S===1005?b(S,4):S===1006?b(S,w(o==="SGR")):S===1015?b(S,4):S===1016?b(S,w(o==="SGR_PIXELS")):S===1048?b(S,1):S===47||S===1047||S===1049?b(S,w(p===m)):S===2004?b(S,w(i.bracketedPasteMode)):S===2026?b(S,w(i.synchronizedOutput)):b(S,0)}_updateAttrColor(e,t,n,i,s){return t===2?(e|=50331648,e&=-16777216,e|=lh.fromColorRGB([n,i,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],s=0,o=0;do{if(i[o+s]=e.params[t+o],e.hasSubParams(t+o)){let l=e.getSubParams(t+o),d=0;do i[1]===5&&(s=1),i[o+d+1+s]=l[d];while(++d<l.length&&d+o+1+s<i.length);break}if(i[1]===5&&o+s>=2||i[1]===2&&o+s>=5)break;i[1]&&(s=1)}while(++o+t<e.length&&o+s<i.length);for(let l=2;l<i.length;++l)i[l]===-1&&(i[l]=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=ni.fg,e.bg=ni.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 s=0;s<t;s++)n=e.params[s],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(s)?e.getSubParams(s)[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|=ni.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=ni.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,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|=ni.fg&16777215,i.bg&=-67108864,i.bg|=ni.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ce.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ce.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(`${Ce.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=ni.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(!X2(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(`${Ce.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Y2&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Y2&&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(),s=n.shift();if(/^\d+$/.exec(i)){let o=parseInt(i);if(Q2(o))if(s==="?")t.push({type:0,index:o});else{let l=V2(s);l&&t.push({type:1,index:o,color:l})}}}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,s=n.findIndex(o=>o.startsWith("id="));return s!==-1&&(i=n[s].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 s=V2(n[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}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 s=parseInt(n[i]);Q2(s)&&t.push({type:2,index:s})}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,Qo),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(dW[e[0]],hi[e[1]]||Qo),!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=ni.clone(),this._eraseAttrDataInternal=ni.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 Jr;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=l=>(this._coreService.triggerDataEvent(`${Ce.ESC}${l}${Ce.ESC}\\`),!0),i=this._bufferService.buffer,s=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}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},l0=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&&(J2=e,e=t,t=J2),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};l0=$n([Ue(0,Zi)],l0);function Q2(e){return 0<=e&&e<256}var fW=5e7,eA=12,pW=50,mW=class extends Lt{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 Re),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>fW)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],s=this._action(i,t);if(s){let l=d=>performance.now()-n>=eA?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(n,d);s.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=eA)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>pW&&(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()}},c0=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),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.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)))}};c0=$n([Ue(0,Zi)],c0);var tA=!1,gW=class extends Lt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Fc),this._onBinary=this._register(new Re),this.onBinary=this._onBinary.event,this._onData=this._register(new Re),this.onData=this._onData.event,this._onLineFeed=this._register(new Re),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Re),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Re),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Re),this._instantiationService=new $U,this.optionsService=this._register(new XU(e)),this._instantiationService.setService(Ji,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(r0)),this._instantiationService.setService(Zi,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(i0)),this._instantiationService.setService(CL,this._logService),this.coreService=this._register(this._instantiationService.createInstance(s0)),this._instantiationService.setService(kl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(a0)),this._instantiationService.setService(xL,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(il)),this._instantiationService.setService(jF,this.unicodeService),this._charsetService=this._instantiationService.createInstance(tW),this._instantiationService.setService(DF,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(c0),this._instantiationService.setService(kL,this._oscLinkService),this._inputHandler=this._register(new hW(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ni.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ni.forward(this._bufferService.onResize,this._onResize)),this._register(Ni.forward(this.coreService.onData,this._onData)),this._register(Ni.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 mW((t,n)=>this._inputHandler.parse(t,n))),this._register(Ni.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Re),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&&!tA&&(this._logService.warn("writeSync is unreliable and will be removed soon."),tA=!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,iN),t=Math.max(t,rN),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(G2.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(G2(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Tn(()=>{for(let t of e)t.dispose()})}}},yW={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 _W(e,t,n,i){let s={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?s.key=Ce.ESC+"OA":s.key=Ce.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=Ce.ESC+"OD":s.key=Ce.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=Ce.ESC+"OC":s.key=Ce.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=Ce.ESC+"OB":s.key=Ce.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":Ce.DEL,e.altKey&&(s.key=Ce.ESC+s.key);break;case 9:if(e.shiftKey){s.key=Ce.ESC+"[Z";break}s.key=Ce.HT,s.cancel=!0;break;case 13:s.key=e.altKey?Ce.ESC+Ce.CR:Ce.CR,s.cancel=!0;break;case 27:s.key=Ce.ESC,e.altKey&&(s.key=Ce.ESC+Ce.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=Ce.ESC+"[1;"+(o+1)+"D":t?s.key=Ce.ESC+"OD":s.key=Ce.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=Ce.ESC+"[1;"+(o+1)+"C":t?s.key=Ce.ESC+"OC":s.key=Ce.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=Ce.ESC+"[1;"+(o+1)+"A":t?s.key=Ce.ESC+"OA":s.key=Ce.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=Ce.ESC+"[1;"+(o+1)+"B":t?s.key=Ce.ESC+"OB":s.key=Ce.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=Ce.ESC+"[2~");break;case 46:o?s.key=Ce.ESC+"[3;"+(o+1)+"~":s.key=Ce.ESC+"[3~";break;case 36:o?s.key=Ce.ESC+"[1;"+(o+1)+"H":t?s.key=Ce.ESC+"OH":s.key=Ce.ESC+"[H";break;case 35:o?s.key=Ce.ESC+"[1;"+(o+1)+"F":t?s.key=Ce.ESC+"OF":s.key=Ce.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=Ce.ESC+"[5;"+(o+1)+"~":s.key=Ce.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=Ce.ESC+"[6;"+(o+1)+"~":s.key=Ce.ESC+"[6~";break;case 112:o?s.key=Ce.ESC+"[1;"+(o+1)+"P":s.key=Ce.ESC+"OP";break;case 113:o?s.key=Ce.ESC+"[1;"+(o+1)+"Q":s.key=Ce.ESC+"OQ";break;case 114:o?s.key=Ce.ESC+"[1;"+(o+1)+"R":s.key=Ce.ESC+"OR";break;case 115:o?s.key=Ce.ESC+"[1;"+(o+1)+"S":s.key=Ce.ESC+"OS";break;case 116:o?s.key=Ce.ESC+"[15;"+(o+1)+"~":s.key=Ce.ESC+"[15~";break;case 117:o?s.key=Ce.ESC+"[17;"+(o+1)+"~":s.key=Ce.ESC+"[17~";break;case 118:o?s.key=Ce.ESC+"[18;"+(o+1)+"~":s.key=Ce.ESC+"[18~";break;case 119:o?s.key=Ce.ESC+"[19;"+(o+1)+"~":s.key=Ce.ESC+"[19~";break;case 120:o?s.key=Ce.ESC+"[20;"+(o+1)+"~":s.key=Ce.ESC+"[20~";break;case 121:o?s.key=Ce.ESC+"[21;"+(o+1)+"~":s.key=Ce.ESC+"[21~";break;case 122:o?s.key=Ce.ESC+"[23;"+(o+1)+"~":s.key=Ce.ESC+"[23~";break;case 123:o?s.key=Ce.ESC+"[24;"+(o+1)+"~":s.key=Ce.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=Ce.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=Ce.DEL:e.keyCode===219?s.key=Ce.ESC:e.keyCode===220?s.key=Ce.FS:e.keyCode===221&&(s.key=Ce.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let l=yW[e.keyCode]?.[e.shiftKey?1:0];if(l)s.key=Ce.ESC+l;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()),s.key=Ce.ESC+f}else if(e.keyCode===32)s.key=Ce.ESC+(e.ctrlKey?Ce.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),s.key=Ce.ESC+d,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=Ce.US),e.key==="@"&&(s.key=Ce.NUL));break}return s}var Kn=0,vW=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Jp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Jp,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((s,o)=>this._getKey(s)-this._getKey(o)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[s]=e[t],t++):i[s]=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||(Kn=this._search(t),Kn===-1)||this._getKey(this._array[Kn])!==t)return!1;do if(this._array[Kn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Kn),!0;while(++Kn<this._array.length&&this._getKey(this._array[Kn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,o)=>s-o),t=0,n=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[i++]=this._array[s];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&&(Kn=this._search(e),!(Kn<0||Kn>=this._array.length)&&this._getKey(this._array[Kn])===e))do yield this._array[Kn];while(++Kn<this._array.length&&this._getKey(this._array[Kn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Kn=this._search(e),!(Kn<0||Kn>=this._array.length)&&this._getKey(this._array[Kn])===e))do t(this._array[Kn]);while(++Kn<this._array.length&&this._getKey(this._array[Kn])===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,s=this._getKey(this._array[i]);if(s>e)n=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},K_=0,nA=0,bW=class extends Lt{constructor(){super(),this._decorations=new vW(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Re),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Re),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Tn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new wW(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,s=0;for(let o of this._decorations.getKeyIterator(t))i=o.options.x??0,s=i+(o.options.width??1),e>=i&&e<s&&(!n||(o.options.layer??"bottom")===n)&&(yield o)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,s=>{K_=s.options.x??0,nA=K_+(s.options.width??1),e>=K_&&e<nA&&(!n||(s.options.layer??"bottom")===n)&&i(s)})}},wW=class extends vo{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Re),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Re),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=Nn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Nn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},SW=1e3,xW=class{constructor(e,t=SW){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 s=i-this._lastRefreshMs,o=this._debounceThresholdMS-s;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)}},iA=20,Qp=class extends Lt{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 s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new xW(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(pt(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Tn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<iA+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
94
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===iA+1&&(this._liveRegion.textContent+=Rb.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 s=e;s<=t;s++){let o=n.lines.get(n.ydisp+s),l=[],d=o?.translateToString(!0,void 0,void 0,l)||"",f=(n.ydisp+s+1).toString(),p=this._rowElements[s];p&&(d.length===0?(p.textContent=" ",this._rowColumns.set(p,[0,1])):(p.textContent=d,this._rowColumns.set(p,l)),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],s=n.getAttribute("aria-posinset"),o=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===o||e.relatedTarget!==i)return;let l,d;if(t===0?(l=n,d=this._rowElements.pop(),this._rowContainer.removeChild(d)):(l=this._rowElements.shift(),d=n,this._rowContainer.removeChild(l)),l.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 s=({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 y=this._rowColumns.get(p);if(!y)return console.warn("columns is null. Race condition?"),null;let b=f<y.length?y[f]:y.slice(-1)[0]+1;return b>=this._terminal.cols&&(++m,b=0),{row:m,column:b}},o=s(t),l=s(n);if(!(!o||!l)){if(o.row>l.row||o.row===l.row&&o.column>=l.column)throw new Error("invalid range");this._terminal.select(o.column,o.row,(l.row-o.row)*this._terminal.cols-o.column+l.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})`}};Qp=$n([Ue(1,Qw),Ue(2,Ca),Ue(3,ka)],Qp);var u0=class extends Lt{constructor(e,t,n,i,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Re),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Re),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Tn(()=>{_l(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(pt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(pt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(pt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(pt(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 s=n[i];if(s.classList.contains("xterm"))break;if(s.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(s=>{s.link.dispose&&s.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,s]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):s.provideLinks(e.y,o=>{if(this._isMouseOut)return;let l=o?.map(d=>({link:d}));this._activeProviderReplies?.set(i,l),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 s=t.get(i);if(s)for(let o=0;o<s.length;o++){let l=s[o],d=l.link.range.start.y<e?0:l.link.range.start.x,f=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let p=d;p<=f;p++){if(n.has(p)){s.splice(o--,1);break}n.add(p)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),s=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(s=!0);if(!s&&i){let o=i.find(l=>this._linkAtPosition(l.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 l=this._activeProviderReplies.get(o)?.find(d=>this._linkAtPosition(d.link,t));if(l){n=!0,this._handleNewLink(l);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&&CW(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,_l(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,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),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,s=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(s)}_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,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=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,s){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:s}}};u0=$n([Ue(1,eS),Ue(2,ka),Ue(3,Zi),Ue(4,AL)],u0);function CW(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 kW=class extends gW{constructor(e={}){super(e),this._linkifier=this._register(new Fc),this.browser=GL,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Fc),this._onCursorMove=this._register(new Re),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Re),this.onKey=this._onKey.event,this._onRender=this._register(new Re),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Re),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Re),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Re),this.onBell=this._onBell.event,this._onFocus=this._register(new Re),this._onBlur=this._register(new Re),this._onA11yCharEmitter=this._register(new Re),this._onA11yTabEmitter=this._register(new Re),this._onWillOpen=this._register(new Re),this._setup(),this._decorationService=this._instantiationService.createInstance(bW),this._instantiationService.setService(ch,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pU),this._instantiationService.setService(AL,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Lb)),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(Ni.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ni.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ni.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ni.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Tn(()=>{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 s=Sn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Ce.ESC}]${i};${uW(s)}${WL.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=ri.toColor(...t.color));else{let o=n;this._themeService.modifyColors(l=>l[o]=ri.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Qp,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ce.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(Ce.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,s=t.getWidth(n),o=this._renderService.dimensions.css.cell.width*s,l=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=l+"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(pt(this.element,"copy",t=>{this.hasSelection()&&RF(t,this._selectionService)}));let e=t=>MF(t,this.textarea,this.coreService,this.optionsService);this._register(pt(this.textarea,"paste",e)),this._register(pt(this.element,"paste",e)),KL?this._register(pt(this.element,"mousedown",t=>{t.button===2&&f2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(pt(this.element,"contextmenu",t=>{f2(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),lS&&this._register(pt(this.element,"auxclick",t=>{t.button===1&&_L(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(pt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(pt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(pt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(pt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(pt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(pt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(pt(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(pt(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),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",Tb.get()),XL||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(hU,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ca,this._coreBrowserService),this._register(pt(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(pt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Jb,this._document,this._helperContainer),this._instantiationService.setService(Hm,this._charSizeService),this._themeService=this._instantiationService.createInstance(n0),this._instantiationService.setService(Zc,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Xp),this._instantiationService.setService(EL,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(e0,this.rows,this.screenElement)),this._instantiationService.setService(ka,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Yb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Qb),this._instantiationService.setService(eS,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(u0,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(Kb,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(t0,this.element,this.screenElement,i)),this._instantiationService.setService(PF,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(Ni.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Vb,this.screenElement)),this._register(pt(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(Qp,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yp,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yp,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Zb,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(o){let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)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:l.col,row:l.row,x:l.x,y:l.y,button:d,action:f,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={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",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),o&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),o&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),o&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(pt(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(pt(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 l=Ce.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(l,!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){yL(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=_W(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===Ce.ETX||n.key===Ce.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)&&(EW(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(ni));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(Ce.ESC+"[I"):this.coreService.triggerDataEvent(Ce.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(`${Ce.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Ce.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function EW(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var AW=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)}},TW=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 Jr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},rA=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 TW(t)}getNullCell(){return new Jr}},RW=class extends Lt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Re),this.onBufferChange=this._onBufferChange.event,this._normal=new rA(this._core.buffers.normal,"normal"),this._alternate=new rA(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)}},MW=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)}},LW=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}},NW=["cols","rows"],ks=0,OW=class extends Lt{constructor(e){super(),this._core=this._register(new kW(e)),this._addonManager=this._register(new AW),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(NW.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 MW(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new LW(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 RW(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 Tb.get()},set promptLabel(e){Tb.set(e)},get tooMuchOutput(){return Rb.get()},set tooMuchOutput(e){Rb.set(e)}}}_verifyIntegers(...e){for(ks of e)if(ks===1/0||isNaN(ks)||ks%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(ks of e)if(ks&&(ks===1/0||isNaN(ks)||ks%1!==0||ks<0))throw new Error("This API only accepts positive integers")}};function IW(e){let t=!1,n=!1,i=!1,s=!1,o=null,l=null;const d=()=>{o!==null&&(clearTimeout(o),o=null),i=!1},f=()=>{l!==null&&(clearTimeout(l),l=null),n=!1},p=()=>{f(),n=!0,l=setTimeout(()=>{l=null,n=!1},0)},m=()=>{i=!1,o!==null&&clearTimeout(o),l!==null&&(clearTimeout(l),l=null),o=setTimeout(()=>{o=null,n=!1,e()},0)},y=()=>{t=!1,o===null&&(f(),i=!1)},b=()=>{t=!1,s=!1,f(),d()},w=S=>{if(o===null){if(t||n||jW(S)){i=!0,n&&!t?m():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,p(),i&&m()},onCompositionCancel:y,handleKeyEvent(S){return DW(S)&&S.shiftKey?(S.preventDefault?.(),S.type==="keydown"?(s=!0,w(S)):S.type==="keypress"?(s||w(S),s=!1):S.type==="keyup"&&(s=!1),!1):!0},dispose:b}}function DW(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function jW(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function BW({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let s=!1,o=!1,l=!1;const d=()=>{o=!1,l=!1},f=b=>{sA(b)&&(o=!0,l=!1)},p=()=>{o&&(l=!0)},m=b=>{const w=o&&l&&sA(b);if(d(),!w)return;const S=e.getSelection();if(!(!S||!i))try{i.writeText(S).catch(()=>{})}catch{}},y=e.onSelectionChange(p);return t.addEventListener("mousedown",f,!0),n.addEventListener("mouseup",m),n.addEventListener("blur",d),{dispose:()=>{s||(s=!0,d(),y.dispose(),t.removeEventListener("mousedown",f,!0),n.removeEventListener("mouseup",m),n.removeEventListener("blur",d))}}}function sA(e){return e.button===0}function PW(e,t){return{activate(n,i){try{const s=new URL(i);if(s.protocol!=="http:"&&s.protocol!=="https:"||!t(s.href))return;e(s.href,"_blank","noopener,noreferrer")}catch{}}}}const zW={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:PW((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},$W="Symbols Nerd Font Mono",Pf=`ui-monospace, "SF Mono", Menlo, "${$W}", monospace`,cS=14,aN=10,oN=22,FW={min:aN,max:oN},HW="cascadia",Kd=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Pf}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Pf}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Pf}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Pf}`,meta:"Variable · Adobe mono"}],Lc=Kd[0];function UW(e){return Kd.find(t=>t.id===e)??Lc}function Vd(){return{source:"curated",id:HW,customName:"",family:Lc.family,size:cS}}function uS(e,t){const n=UW(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:fS(t)}}function dS(e,t){const n=GW(e);return{source:"custom",id:null,customName:n,family:Dp(n,Lc.family),size:fS(t)}}function lN(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=fS(typeof t.size=="number"?t.size:cS);return t.source==="custom"&&typeof t.customName=="string"?dS(t.customName,n):typeof t.id=="string"&&qW(t.id)?uS(t.id,n):null}function hS(e){if(!e)return Vd();try{const t=lN(JSON.parse(e));if(t!==null)return t}catch{}return Vd()}function WW(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function fS(e){return Number.isFinite(e)?Math.min(oN,Math.max(aN,Math.round(e))):cS}function qW(e){return Kd.some(t=>t.id===e)}function GW(e){return Lm(e)}const em="fleet-plugin.terminal.renderer",Nc="fleet-plugin.terminal.font",aA="fleet-console.terminalRenderer",oA="fleet-console.terminalFont",d0=new Set;let bo=sq(),tm=null,pl=0,zf=null;function KW(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(em)!==null||window.localStorage.getItem(Nc)!==null)return;const e=window.localStorage.getItem(aA),t=window.localStorage.getItem(oA),n=e==="webgl"||e==="dom"?e:"webgl",i=hS(t);window.localStorage.setItem(em,n),window.localStorage.setItem(Nc,WW(i)),window.localStorage.removeItem(aA),window.localStorage.removeItem(oA)}catch{}}function VW(e){pl+=1,tm=e,QW()}function cN(){return _.useSyncExternalStore(rq,lA,lA)}function YW(e){nq(e),Hc({renderer:e})}function XW(e){const t=uS(e,bo.font.size);pl+=1,Hc({font:t}),qm(t)}function ZW(e){const t=dS(e,bo.font.size);pl+=1,Hc({font:t}),qm(t)}function JW(e){const t=bo.font.source==="custom"?dS(bo.font.customName,e):uS(bo.font.id,e);pl+=1,Hc({font:t}),qm(t)}async function QW(){if(!tm)return;const e=pl;try{const t=await tm.read("terminal");if(t!==null){const n=lN(t.font);if(n!==null){if(e!==pl)return;Hc({font:n});try{window.localStorage.removeItem(Nc)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Nc)}catch{}if(n!==null){const i=hS(n);if(e!==pl)return;Hc({font:i}),qm(i);try{window.localStorage.removeItem(Nc)}catch{}}}}catch{}}async function qm(e){const t=tm;if(t)try{await uN(t,{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function uN(e,t){const n=async()=>{const o=await e.read("terminal");await e.write("terminal",{...o??{},...t})},i=zf,s=i?i.catch(()=>{}).then(n):n();return zf=s,s.finally(()=>{zf===s&&(zf=null)}).catch(()=>{}),s}function eq(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(em);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function tq(){if(typeof window>"u")return Vd();try{return hS(window.localStorage.getItem(Nc))}catch{return Vd()}}function nq(e){if(!(typeof window>"u"))try{window.localStorage.setItem(em,e)}catch{}}function iq(){for(const e of d0)e()}function Hc(e){bo={...bo,...e},iq()}function rq(e){return d0.add(e),()=>{d0.delete(e)}}function lA(){return bo}function sq(){return typeof window>"u"?{renderer:"webgl",font:Vd()}:(KW(),{renderer:eq(),font:tq()})}function cA({baseY:e,viewportY:t}){return t>=e}function aq(e){let t=!0,n=null,i=null;const s=()=>{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)))},l=()=>{if(t){e.scrollToBottom();return}o()},d=()=>{i===null&&(i=e.requestFrame(()=>{i=null,l()}))},f=()=>{t&&(l(),d())};return{isFollowing:()=>t,recordUserViewportChange:()=>{if(t=cA(e.getViewport()),t){n=null;return}s()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,f()},preserveAfterGeometryChange:p=>{p(),l(),d()},restoreAfterOutputParsing:()=>{if(t){f();return}cA(e.getViewport())||s()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function oq({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!lq(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const s=t();return s&&!i.repeat&&n(s).catch(()=>{}),!1}}}function lq(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 cq="Symbols Nerd Font Mono",uq=`1em "${cq}"`,dq=650;let $f=null;function dN(){return $f||($f=fq(),$f)}async function hq(){await pq(dN(),dq)}async function fq(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(uq)}catch{}}async function pq(e,t){await new Promise(n=>{let i=!1;const s=setTimeout(o,t);e.then(o,o);function o(){i||(i=!0,clearTimeout(s),n())}})}const mq=80,gq=16,yq=250,_q=1024*1024,vq=120,bq={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)"},wq={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)"},Sq={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 pS({operationId:e,ticketPath:t,wsPath:n,theme:i="instrument",onExit:s,active:o,keyboardFocusRequestId:l,zoom:d=1}){const f=i,{renderer:p,font:m}=cN(),y=_.useRef(null),b=_.useRef(null),w=_.useRef(null),S=_.useRef(null),x=_.useRef(null),k=_.useRef(null),L=_.useRef(null),[F,q]=_.useState(d),T=_.useRef(s);T.current=s;const $=_.useRef(o);$.current=o;const[I,N]=_.useState("connecting"),[V,K]=_.useState(0),[Q,Y]=_.useState(0);_.useEffect(()=>{const D=y.current;if(!D)return;let j=!1,A=null,O=null,C=null;return(async()=>{if(await hq(),j)return;const P=uA(f),R=new OW({...zW,fontFamily:m.family,fontSize:m.size*F,theme:P});b.current=R;const W=new g$;L.current=W,R.loadAddon(W),R.open(D),dA(D,P);const G=BW({terminal:R,selectionTarget:D,windowTarget:window,clipboard:navigator.clipboard});R.loadAddon(new U$),R.unicode.activeVersion="11";const U=IW(()=>R.input(`
98
+ `)),ee=D.querySelector("textarea.xterm-helper-textarea, textarea")??D;ee.addEventListener("compositionstart",U.onCompositionStart),ee.addEventListener("compositionend",U.onCompositionEnd),ee.addEventListener("focusout",U.onCompositionCancel);const ne=oq({getPlatform:()=>navigator.platform,getSelection:()=>R.getSelection(),writeText:We=>navigator.clipboard.writeText(We)});R.attachCustomKeyEventHandler(We=>ne.handleKeyEvent(We)&&U.handleKeyEvent(We));const me=aq({getViewport:()=>R.buffer.active,scrollToBottom:()=>xq(R),scrollToLine:We=>Cq(R,We),requestFrame:We=>window.requestAnimationFrame(We),cancelFrame:We=>window.cancelAnimationFrame(We)});k.current=me;const Me=kq(D,ee,me.recordUserViewportChange),ve=Tq(R,$.current!==!1,me.restoreAfterOutputParsing);x.current=ve;const Ye=c$({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:We=>R.onData(mt=>{me.resumeFollowing(),We(mt)}),write:ve.write},onExit:()=>T.current?.(),onStatus:(We,mt)=>{N(mt?`${We}: ${mt}`:We)}});w.current=Ye;const qe=()=>{me.preserveAfterGeometryChange(()=>{W.fit(),Ye.resize(R.cols,R.rows),R.refresh(0,R.rows-1)})},yt=()=>{O&&clearTimeout(O),O=setTimeout(()=>{O=null,j||qe()},mq)},$e=async()=>{await document.fonts?.ready,!j&&(qe(),Ye.start(),Y(We=>We+1),$.current!==!1&&R.focus())};A=new ResizeObserver(yt),A.observe(D),$e(),C=()=>{O&&clearTimeout(O),ee.removeEventListener("compositionstart",U.onCompositionStart),ee.removeEventListener("compositionend",U.onCompositionEnd),ee.removeEventListener("focusout",U.onCompositionCancel),U.dispose(),Ye.dispose(),G.dispose(),Me.dispose(),ve.dispose(),me.dispose(),b.current=null,w.current=null,x.current=null,k.current=null,L.current=null;try{R.dispose()}catch{}},K(We=>We+1)})(),()=>{j=!0,A?.disconnect(),C?.()}},[e,t,n]),_.useEffect(()=>{x.current?.setActive(o!==!1),o&&(b.current?.focus(),k.current?.resumeFollowing())},[o,l,Q]),_.useEffect(()=>{const D=b.current;if(!D)return;let j=!1;if(p==="webgl")try{const A=new CF;S.current=A,A.onContextLoss(()=>{if(!j){try{A.dispose()}catch{}S.current===A&&(S.current=null)}}),D.loadAddon(A)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{j=!0;const A=S.current;if(A){S.current=null;try{A.dispose()}catch{}}}},[p,e,V]),_.useEffect(()=>{const D=b.current,j=y.current;if(!D||!j)return;const A=uA(f);D.options.theme=A,dA(j,A)},[f,V]),_.useEffect(()=>{const D=b.current;D&&(D.options.fontFamily=m.family,hA(D,L.current,w.current,k.current))},[m.family,V]),_.useEffect(()=>{if(d===F)return;const D=setTimeout(()=>q(d),vq);return()=>clearTimeout(D)},[d,F]),_.useEffect(()=>{const D=b.current;D&&(D.options.fontSize=m.size*F,hA(D,L.current,w.current,k.current))},[F,m.size,V]);const B=I.startsWith("live"),M=F===1?void 0:{width:`${F*100}%`,height:`${F*100}%`,transform:`scale(${1/F})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[B?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),I]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:y,style:M})})]})})}function uA(e){return e==="carbon"?Sq:e==="maritime"?wq:bq}function dA(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function xq(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function Cq(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function kq(e,t,n){const i=e.querySelector(".xterm-scrollable-element")??e.querySelector(".xterm-viewport");if(!i)return{dispose:()=>{}};let s=!1,o=null;const l=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{o=window.requestAnimationFrame(()=>{o=null,n()})})},d=()=>l(),f=()=>{s=!0},p=w=>{s=Eq(w,i)},m=()=>{s&&l()},y=()=>{const w=s;s=!1,w&&l()},b=w=>{Aq(w)&&l()};return i.addEventListener("wheel",d,{capture:!0,passive:!0}),i.addEventListener("touchstart",f,{capture:!0,passive:!0}),i.addEventListener("touchend",y),i.addEventListener("touchcancel",y),i.addEventListener("pointerdown",p,!0),i.addEventListener("scroll",m),window.addEventListener("pointerup",y),window.addEventListener("pointercancel",y),t.addEventListener("keydown",b,!0),{dispose:()=>{i.removeEventListener("wheel",d,!0),i.removeEventListener("touchstart",f,!0),i.removeEventListener("touchend",y),i.removeEventListener("touchcancel",y),i.removeEventListener("pointerdown",p,!0),i.removeEventListener("scroll",m),window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),t.removeEventListener("keydown",b,!0),o!==null&&window.cancelAnimationFrame(o)}}}function Eq(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function Aq(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function Tq(e,t,n){let i=t,s=!1,o=null,l=0,d=[];const f=()=>{o&&(clearTimeout(o),o=null)},p=()=>{if(f(),s||l===0)return;const y=Rq(d,l);d=[],l=0,e.write(y,()=>{s||n()})},m=()=>{s||o||l===0||(o=setTimeout(p,i?gq:yq))};return{write:y=>{if(!(s||y.byteLength===0)){if(d.push(y),l+=y.byteLength,l>=_q){p();return}m()}},setActive:y=>{if(i!==y){if(i=y,f(),i){p();return}m()}},dispose:()=>{p(),s=!0,d=[],l=0,f()}}}function Rq(e,t){if(e.length===1)return e[0]??new Uint8Array;const n=new Uint8Array(t);let i=0;for(const s of e)n.set(s,i),i+=s.byteLength;return n}function hA(e,t,n,i){const s=()=>{t?.fit(),n?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)};if(i){i.preserveAfterGeometryChange(s);return}s()}const Mq=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),Lq=50*1024;function Yd(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(Yd):Object.entries(e).some(([t,n])=>Mq.has(t.toLowerCase())||Yd(n))}function Nq(e){if(Yd(e)||!bl(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(Dq);return t.every(n=>n!==null)?{clis:t}:null}function Oq(e){return Yd(e)||!bl(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"&&hN(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&bl(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&jq(e.artifact.html)<=Lq?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function Iq(e){return!Yd(e)&&bl(e)&&hN(e.error)?e.error:null}function Dq(e){if(!bl(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=>bl(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 hN(e){return bl(e)&&typeof e.code=="string"&&typeof e.message=="string"}function bl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function jq(e){return new TextEncoder().encode(e).byteLength}class h0 extends Error{constructor(t,n){super(n),this.code=t}code}const hh=e=>`analysis/${encodeURIComponent(e)}`,Bq="/plugins/terminal/analysis/stream",Pq={type:"error",error:{code:"analysis_session_not_found",message:"Analysis session was not found."}},fN=250,zq=4e3;let Qr=null,Uc=0,f0=0,pN=new Set,mS=!1,Oc=null,_p=fN;const ml=new Map;function $q(e,t,n,i){const s=new URLSearchParams({theme:t,canvas:n,foreground:i});return`/plugins/terminal/analysis/artifacts/${encodeURIComponent(e)}?${s.toString()}`}async function Fq(e){const t=await Km(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=Nq(n);if(i)return i;throw Vm(t.status,n)}async function Hq(e,t){try{const n=await Km(e,`${hh(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 Uq(e,t,n,i){await yS(e,`${hh(t)}/start`,n,i)}async function Wq(e,t,n){await yS(e,`${hh(t)}/message`,{text:n})}async function V_(e,t){await yS(e,`${hh(t)}/stop`,{})}async function mN(e,t){const n=await Km(e,`${hh(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw Vm(n.status,await n.json().catch(()=>null))}function qq(e,t,n){return Gq(t,n)}function Gq(e,t){let n=ml.get(e);return n||(n={listeners:new Set,confirmedEpoch:null},ml.set(e,n)),n.listeners.add(t),Vq(),queueMicrotask(()=>{n.listeners.has(t)&&Qr?.readyState===EventSource.OPEN&&(!mS||!pN.has(e)||n.confirmedEpoch===null&&(n.confirmedEpoch=f0,t({type:"connected"})))}),()=>{n.listeners.delete(t),n.listeners.size===0&&ml.delete(e),Kq()}}function Gm(){for(const e of ml.values())if(e.listeners.size>0)return!0;return!1}function gS(){mS=!1}function gN(){_p=fN}function yN(){Oc!==null&&(clearTimeout(Oc),Oc=null)}function Kq(){Gm()||(yN(),gS(),Qr?.close(),Qr=null,gN())}function _N(){yN(),gS(),Qr?.close(),Uc+=1;const e=Uc,t=new EventSource(Bq);Qr=t,Yq(t,e)}function Vq(){if(!(Qr&&Qr.readyState!==EventSource.CLOSED)){if(Qr?.readyState===EventSource.CLOSED){Gm()&&vN();return}_N()}}function Yq(e,t){e.onmessage=n=>{Qr!==e||Uc!==t||typeof n.data=="string"&&Qq(n.data,t)},e.onerror=()=>{Qr!==e||Uc!==t||(gS(),e.readyState!==EventSource.CONNECTING&&e.readyState===EventSource.CLOSED&&Gm()&&vN())}}function vN(){if(Oc!==null)return;const e=_p;_p=Math.min(_p*2,zq),Oc=setTimeout(()=>{Oc=null,Gm()&&(Qr!==null&&Qr.readyState!==EventSource.CLOSED||_N())},e)}function p0(e,t){const n=ml.get(e);if(n)for(const i of n.listeners)i(t)}function Xq(e,t){if(Uc!==t)return;const n=new Set(e);for(const[i,s]of ml)s.confirmedEpoch!==null&&!n.has(i)&&(p0(i,Pq),s.confirmedEpoch=null);f0+=1,pN=n,mS=!0,gN();for(const i of e){const s=ml.get(i);s&&(s.confirmedEpoch=f0,p0(i,{type:"connected"}))}}function bN(e,t){const n=Object.keys(e);return n.length===t.size&&n.every(i=>t.has(i))}function Zq(e){if(!bN(e,new Set(["type","operationIds"]))||e.type!=="connected"||!Array.isArray(e.operationIds))return null;for(const t of e.operationIds)if(typeof t!="string")return null;return e.operationIds}function Jq(e){if(!bN(e,new Set(["type","operationId","event"]))||e.type!=="event"||typeof e.operationId!="string"||!e.event||typeof e.event!="object"||Array.isArray(e.event))return null;const t=Oq(e.event);return t?{operationId:e.operationId,event:t}:null}function Qq(e,t){if(Uc!==t)return;let n;try{n=JSON.parse(e)}catch{return}if(!n||typeof n!="object"||Array.isArray(n))return;const i=n,s=Zq(i);if(s){Xq(s,t);return}const o=Jq(i);o&&p0(o.operationId,o.event)}async function yS(e,t,n,i){const s=await Km(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!s.ok)throw Vm(s.status,await s.json().catch(()=>null))}async function Km(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Pi?Vm(i.status,i.body):i}}function Vm(e,t){const n=Iq(t);return new h0(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const eG={"terminal.analyst.suggestion.walkthrough":"Walk me through how this session unfolded","terminal.analyst.suggestion.whatDoing":"What is the agent doing right now?","terminal.analyst.suggestion.flagReview":"Flag anything I should review","terminal.analyst.suggestion.handoffBrief":"Draft a handoff brief","terminal.analyst.prompt.handoffBriefArtifact":"Draft a handoff brief and publish it as an artifact.","terminal.analyst.prompt.flagReviewBeforeContinue":"Flag anything I should review before this work continues.","terminal.analyst.prompt.walkthrough":"Walk me through how this session unfolded.","terminal.analyst.followup.goDeeper":"Go deeper on the last answer","terminal.analyst.prompt.goDeeper":"Go deeper on your previous answer with more evidence citations.","terminal.analyst.followup.intentDrift":"Check for intent drift","terminal.analyst.prompt.intentDrift":"Review this session for intent drift against my stated goals.","terminal.analyst.followup.toArtifact":"Turn this into an artifact","terminal.analyst.prompt.toArtifact":"Turn your previous answer into a published artifact.","terminal.analyst.followup.whatDoingNow":"What is the agent doing now?","terminal.analyst.slash.now":"Current state — what the agent is doing right now","terminal.analyst.slash.drift":"Intent drift review against settled goals","terminal.analyst.slash.brief":"Handoff brief as an artifact","terminal.analyst.slash.risks":"Flag anything that needs review","terminal.analyst.slash.timeline":"How the session unfolded, end to end","terminal.analyst.chatAria":"Session Analyst chat","terminal.analyst.hideArtifacts":"Hide Artifacts","terminal.analyst.openArtifacts":"Open Artifacts","terminal.analyst.authoringTooltip":"The analyst is authoring an artifact…","terminal.analyst.artifactsEmptyTooltip":"Artifacts the analyst publishes appear here","terminal.analyst.artifactsHandle":"ARTIFACTS","terminal.companion.sessionAnalyst":"Session Analyst","terminal.analyst.subtitle":"Read-only intelligence for this operation","terminal.analyst.reset":"Reset","terminal.analyst.resetAria":"Reset Session Analyst","terminal.analyst.askAboutSession":"Ask about this session","terminal.analyst.heroBody":"Review, explain, and summarize this session — without affecting the host agent.","terminal.analyst.publishingArtifact":"Publishing an artifact","terminal.analyst.authoringBody":"The analyst is authoring artifact content. It opens in Artifacts when it lands.","terminal.analyst.artifactPublished":"Artifact published — {title}","terminal.analyst.openInArtifacts":"Open in Artifacts","terminal.analyst.stoppedReceipt":"Stopped · last confirmed: {activity} · {elapsed}","terminal.analyst.lastConfirmedOnly":"Last confirmed activity only","terminal.analyst.activity.starting":"Starting analyst","terminal.analyst.activity.connected":"Analyst connection confirmed","terminal.analyst.activity.startingSession":"Starting a new analysis session","terminal.analyst.activity.reasoning":"Reasoning over session","terminal.analyst.activity.thoughtHidden":"Thought event received · content hidden","terminal.analyst.activity.usingTool":"Using {title}","terminal.analyst.activity.toolStatus":"Tool status: {status}","terminal.analyst.activity.writing":"Writing answer","terminal.analyst.activity.answerChunk":"Answer chunk received","terminal.analyst.state.needsAttention":"Needs attention","terminal.analyst.state.analyzing":"Analyzing","terminal.analyst.state.complete":"Complete","terminal.analyst.state.stopped":"Stopped","terminal.analyst.state.ready":"Ready","terminal.analyst.queued":"QUEUED","terminal.analyst.cancelQueued":"Cancel queued question {index + 1}","terminal.analyst.followUp":"FOLLOW UP","terminal.analyst.commands":"Analysis commands","terminal.analyst.initialSettings":"Initial analysis settings","terminal.analyst.cli":"Analysis CLI","terminal.analyst.model":"Analysis model","terminal.analyst.effort":"Analysis effort","terminal.analyst.na":"n/a","terminal.analyst.composerPlaceholder":"Ask about the session… (/ for commands)","terminal.analyst.stop":"Stop","terminal.analyst.queueQuestion":"Queue question","terminal.analyst.send":"Send","terminal.analyst.queueHint":"Enter queues the question — it fires when the analyst is ready","terminal.analyst.copied":"Copied","terminal.companion.artifacts":"Artifacts","terminal.artifacts.subtitle":"Visual outputs from this analysis","terminal.artifacts.hideCount_one":"Hide artifacts ({count} item)","terminal.artifacts.hideCount_other":"Hide artifacts ({count} items)","terminal.artifacts.showCount_one":"Show artifacts ({count} item)","terminal.artifacts.showCount_other":"Show artifacts ({count} items)","terminal.artifacts.published":"Published artifacts","terminal.artifacts.clear":"Clear","terminal.artifacts.emptyTitle":"No artifacts yet","terminal.artifacts.emptyBody":"Artifacts the analyst publishes will appear here.","terminal.artifacts.selectedPreview":"Selected artifact preview","terminal.artifacts.unknownTime":"Unknown time","terminal.analyst.exit":"Exit Session Analyst","terminal.analyst.open":"Open Session Analyst","terminal.streams.exit":"Exit Carrier Streams","terminal.streams.open":"Open Carrier Streams","terminal.analyst.sendMessageFirst":"Send a message in this session first","terminal.handle.exit":"EXIT","terminal.handle.analyze":"ANALYZE","terminal.streams.dispatchOrder":"Dispatch order","terminal.handle.streams":"STREAMS","terminal.streams.subtitle":"This operation · live carrier output","terminal.streams.status.live":"LIVE","terminal.streams.status.done":"DONE","terminal.streams.status.error":"ERROR","terminal.streams.status.idle":"IDLE","terminal.streams.emptyTitle":"No carriers streaming.","terminal.streams.emptyBody":"The next dispatch from this operation appears here the moment it begins.","terminal.streams.reasoning":"Reasoning…","terminal.streams.expand":"Expand completed stream","terminal.streams.collapse":"Collapse completed stream","terminal.streams.activity":"Activity","terminal.analysis.error.timedOut":"Analysis response timed out.","terminal.analysis.error.sessionEnded":"Analysis session ended — send again to restart.","terminal.analysis.error.stopFailed":"Stop failed: {message}","terminal.analysis.error.resetFailed":"Reset failed: {message}","terminal.analysis.error.unavailable":"Analysis is unavailable.","terminal.analyst.saved":"Saved","terminal.kind.agent":"Agent","terminal.kind.shell":"Shell","terminal.companion.carrierStreams":"Carrier Streams","terminal.settings.general":"General","terminal.settings.agentCli":"Agent CLI","terminal.notifications.agentInputWaiting":"Agent input waiting","terminal.notifications.agentTurnEnded":"Agent turn ended","terminal.notifications.resumeFailed":"Resume failed","terminal.markdown.copy":"Copy","terminal.markdown.copyCodeAria":"Copy {language} code","terminal.markdown.diagram.renderFailed":"Diagram render failed: {message}","terminal.markdown.diagram.openExpandedAria":"Open diagram in expanded view","terminal.markdown.diagram.lightboxTitle":"MANIFEST · DIAGRAM","terminal.markdown.diagram.close":"Close","terminal.markdown.diagram.closeExpandedAria":"Close expanded diagram","terminal.markdown.diagram.zoomControlsAria":"Diagram zoom controls","terminal.markdown.diagram.zoomOutAria":"Zoom out","terminal.markdown.diagram.zoomInAria":"Zoom in","terminal.markdown.diagram.fit":"Fit","terminal.markdown.diagram.fitAria":"Fit diagram to viewport","terminal.markdown.diagram.reset":"Reset","terminal.markdown.diagram.resetAria":"Reset diagram zoom","terminal.carriers.title":"Carriers","terminal.carriers.listAria":"Carrier list","terminal.carriers.loading":"Loading carrier settings.","terminal.carriers.empty":"No carriers registered.","terminal.carriers.captain":"Captain","terminal.carriers.displayName":"Display name","terminal.carriers.saveDisplayNameAria":"Save display name","terminal.carriers.cancelDisplayNameAria":"Cancel display name edit","terminal.carriers.editDisplayNameAria":"Edit display name","terminal.carriers.saving":"Saving…","terminal.carriers.saved":"Saved ✓","terminal.carriers.refresh":"Refresh","terminal.carriers.identity":"Identity","terminal.carriers.runtime":"Runtime","terminal.carriers.cli":"CLI","terminal.carriers.model":"Model","terminal.carriers.effort":"Effort","terminal.carriers.effortUnsupported":"Not supported for this model.","terminal.carriers.select":"Select a carrier.","terminal.carriers.taskForce":"Task Force","terminal.carriers.tf.helpEmpty":"Run this carrier across multiple CLI backends. Needs at least {minBackends} to activate.","terminal.carriers.tf.helpActive_one":"{count} backend configured · active","terminal.carriers.tf.helpActive_other":"{count} backends configured · active","terminal.carriers.tf.helpNeeds_one":"{count} backend configured · needs {minBackends}+ to activate","terminal.carriers.tf.helpNeeds_other":"{count} backends configured · needs {minBackends}+ to activate","terminal.carriers.tf.hide":"Hide","terminal.carriers.tf.configure":"Configure","terminal.carriers.tf.empty":"No Task Force backend configured.","terminal.carriers.tf.confirmDeactivate":"Confirm — TF deactivates","terminal.carriers.tf.confirmRemove":"Confirm remove","terminal.carriers.tf.confirmRemovalAria":"Confirm removal of {name} backend","terminal.carriers.tf.remove":"Remove","terminal.carriers.tf.addCliLabel":"Task Force CLI to add","terminal.carriers.tf.add":"Add","terminal.dormant.status":"Dormant","terminal.dormant.resume":"Resume","terminal.dormant.resuming":"Resuming…","terminal.dormant.tryAgain":"Try again","terminal.dormant.startFresh":"Start fresh","terminal.dormant.resumeFailedBody":"Couldn’t resume this session. The saved session for “{name}” has expired.","terminal.shell.relaunch":"Relaunch","terminal.auth.signedIn":"Signed in","terminal.auth.notSignedIn":"Not signed in","terminal.auth.signOut":"Sign out","terminal.auth.signIn":"Sign in","terminal.auth.working":"Working…","terminal.auth.verifying":"Verifying…","terminal.auth.apiKey":"API key","terminal.auth.apiKeyAria":"{name} API key","terminal.auth.settingsForKimi":"Settings for Kimi","terminal.auth.kimiHelp":"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.","terminal.auth.loadingSignIn":"Loading sign-in state.","terminal.auth.defaultModel":"Default model","terminal.auth.defaultEffort":"Default effort","terminal.auth.kimiModelHelp":"Used for Kimi sessions without an explicit carrier model. Applies to newly launched sessions.","terminal.auth.signInFoot":"Sign-in changes apply to newly launched sessions. Running sessions keep their current credentials until relaunched.","terminal.auth.modelSignInAria":"Model sign-in","terminal.settings.metaphor":"Metaphor","terminal.settings.metaphorHelp":"Adds concise Fleet wording to every session. Off uses the standard prompt.","terminal.settings.enabled":"Enabled","terminal.settings.off":"Off","terminal.settings.loading":"Loading settings.","terminal.settings.unavailable":"Settings unavailable.","terminal.settings.systemPromptAria":"System Prompt","terminal.settings.systemPromptFoot":"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched.","terminal.settings.terminalFont":"Terminal Font","terminal.settings.terminalFontNew":"New","terminal.settings.terminalFontHelp":"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.","terminal.settings.terminalFontFoot":"Font preferences apply immediately and are stored on the Console server, separate from session settings and shared across browsers after restart.","terminal.settings.terminalFontPreview":"The quick brown fox jumps over 0123456789 — terminal output stays crisp.","terminal.settings.fontMetaCascadia":"Variable · terminal tuned","terminal.settings.fontMetaJetbrains":"Variable · console mono","terminal.settings.fontMetaFiraCode":"Variable · ligatures","terminal.settings.fontMetaSourceCodePro":"Variable · Adobe mono","terminal.settings.fontLoadError":"Installed system fonts are unavailable. Built-in fonts remain available.","terminal.settings.fontPicker.browserAria":"Font browser","terminal.settings.fontPicker.searchLabel":"Search fonts","terminal.settings.fontPicker.searchPlaceholder":"Search installed fonts","terminal.settings.fontPicker.loading":"Loading installed fonts…","terminal.settings.fontPicker.choicesAria":"Font choices","terminal.settings.fontPicker.builtInGroup":"Built-in","terminal.settings.fontPicker.installedGroup":"Installed on this machine","terminal.settings.fontPicker.noMatch":"No fonts match this search.","terminal.settings.fontPicker.preview":"Preview","terminal.settings.fontPicker.available":"Available","terminal.settings.fontPicker.unavailable":"Unavailable","terminal.settings.fontPicker.fontSizeAria":"Font size","terminal.settings.fontPicker.decreaseSizeAria":"Decrease font size","terminal.settings.fontPicker.sizeValueAria":"Font size value","terminal.settings.fontPicker.increaseSizeAria":"Increase font size","terminal.settings.fontPicker.sizeSliderAria":"Font size slider","terminal.settings.fontPicker.monospace":"Monospace","terminal.settings.fontPicker.systemFont":"System font","terminal.settings.fontPicker.savedSystemFont":"Saved system font","terminal.settings.terminalRenderer":"Terminal Renderer","terminal.settings.terminalRendererHelp":"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.","terminal.settings.terminalRendererAria":"Terminal renderer","terminal.settings.webgl":"WebGL","terminal.settings.dom":"DOM","terminal.settings.agentCliAvailable":"Agent CLI Available","terminal.settings.agentCliHelp":"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.","terminal.settings.agentCliFoot":"Install or update a CLI, then reopen this page to re-check availability.","terminal.settings.available":"Available","terminal.settings.missing":"Missing","terminal.analysis.error.sessionNotFound":"Analysis session was not found.","terminal.analysis.error.requestFailed":"Analysis request failed."},tG={"terminal.analyst.suggestion.walkthrough":"이 세션이 어떻게 진행됐는지 정리해 줘","terminal.analyst.suggestion.whatDoing":"에이전트가 지금 무엇을 하고 있어?","terminal.analyst.suggestion.flagReview":"내가 검토해야 할 항목을 짚어 줘","terminal.analyst.suggestion.handoffBrief":"인수인계 브리프 초안을 작성해 줘","terminal.analyst.prompt.handoffBriefArtifact":"인수인계 브리프 초안을 작성하고 아티팩트로 발행해 줘.","terminal.analyst.prompt.flagReviewBeforeContinue":"이 작업을 계속하기 전에 내가 검토해야 할 항목을 짚어 줘.","terminal.analyst.prompt.walkthrough":"이 세션이 어떻게 진행됐는지 정리해 줘","terminal.analyst.followup.goDeeper":"이전 답변 더 깊게 파기","terminal.analyst.prompt.goDeeper":"이전 답변을 근거 인용을 늘려 더 깊게 분석해 줘.","terminal.analyst.followup.intentDrift":"의도 드리프트 점검","terminal.analyst.prompt.intentDrift":"내가 정한 목표와 비교해 이 세션의 의도 드리프트를 검토해 줘.","terminal.analyst.followup.toArtifact":"아티팩트로 만들기","terminal.analyst.prompt.toArtifact":"이전 답변을 아티팩트로 발행해 줘.","terminal.analyst.followup.whatDoingNow":"에이전트 현재 상태","terminal.analyst.slash.now":"현재 상태 — 에이전트가 지금 하고 있는 일","terminal.analyst.slash.drift":"확정된 목표 대비 의도 드리프트 검토","terminal.analyst.slash.brief":"아티팩트로 남기는 인수인계 브리프","terminal.analyst.slash.risks":"검토가 필요한 항목 표시","terminal.analyst.slash.timeline":"세션 진행 경과 전체 타임라인","terminal.analyst.chatAria":"Session Analyst 채팅","terminal.analyst.hideArtifacts":"아티팩트 닫기","terminal.analyst.openArtifacts":"아티팩트 열기","terminal.analyst.authoringTooltip":"분석가가 아티팩트를 작성하는 중…","terminal.analyst.artifactsEmptyTooltip":"분석가가 발행한 아티팩트가 여기에 표시됩니다","terminal.analyst.artifactsHandle":"아티팩트","terminal.companion.sessionAnalyst":"Session Analyst","terminal.analyst.subtitle":"이 오퍼레이션의 읽기 전용 인텔리전스","terminal.analyst.reset":"초기화","terminal.analyst.resetAria":"Session Analyst 초기화","terminal.analyst.askAboutSession":"이 세션에 대해 물어보세요","terminal.analyst.heroBody":"호스트 에이전트에 영향을 주지 않고 세션을 검토·설명·요약합니다.","terminal.analyst.publishingArtifact":"아티팩트 발행 중","terminal.analyst.authoringBody":"분석가가 아티팩트 내용을 작성하고 있습니다. 완료되면 아티팩트에서 열립니다.","terminal.analyst.artifactPublished":"아티팩트 발행됨 — {title}","terminal.analyst.openInArtifacts":"아티팩트에서 열기","terminal.analyst.stoppedReceipt":"중지됨 · 마지막 확인: {activity} · {elapsed}","terminal.analyst.lastConfirmedOnly":"마지막으로 확인된 활동만 표시","terminal.analyst.activity.starting":"분석가 시작 중","terminal.analyst.activity.connected":"분석가 연결 확인됨","terminal.analyst.activity.startingSession":"새 분석 세션 시작 중","terminal.analyst.activity.reasoning":"세션 분석 추론 중","terminal.analyst.activity.thoughtHidden":"사고 이벤트 수신 · 내용 숨김","terminal.analyst.activity.usingTool":"{title} 사용 중","terminal.analyst.activity.toolStatus":"도구 상태: {status}","terminal.analyst.activity.writing":"답변 작성 중","terminal.analyst.activity.answerChunk":"답변 청크 수신","terminal.analyst.state.needsAttention":"확인 필요","terminal.analyst.state.analyzing":"분석 중","terminal.analyst.state.complete":"완료","terminal.analyst.state.stopped":"중지됨","terminal.analyst.state.ready":"준비됨","terminal.analyst.queued":"대기 중","terminal.analyst.cancelQueued":"대기 중인 질문 {index + 1} 취소","terminal.analyst.followUp":"후속 질문","terminal.analyst.commands":"분석 명령","terminal.analyst.initialSettings":"초기 분석 설정","terminal.analyst.cli":"분석 CLI","terminal.analyst.model":"분석 모델","terminal.analyst.effort":"분석 Effort","terminal.analyst.na":"n/a","terminal.analyst.composerPlaceholder":"세션에 대해 질문하기… (/ 명령)","terminal.analyst.stop":"중지","terminal.analyst.queueQuestion":"질문 대기열 추가","terminal.analyst.send":"보내기","terminal.analyst.queueHint":"Enter로 질문을 대기시킵니다 — 분석가가 준비되면 실행됩니다","terminal.analyst.copied":"복사됨","terminal.companion.artifacts":"아티팩트","terminal.artifacts.subtitle":"이 분석의 시각적 결과물","terminal.artifacts.hideCount_one":"아티팩트 닫기({count}개)","terminal.artifacts.hideCount_other":"아티팩트 닫기({count}개)","terminal.artifacts.showCount_one":"아티팩트 보기({count}개)","terminal.artifacts.showCount_other":"아티팩트 보기({count}개)","terminal.artifacts.published":"발행된 아티팩트","terminal.artifacts.clear":"지우기","terminal.artifacts.emptyTitle":"아직 아티팩트 없음","terminal.artifacts.emptyBody":"분석가가 발행한 아티팩트가 여기에 표시됩니다.","terminal.artifacts.selectedPreview":"선택한 아티팩트 미리보기","terminal.artifacts.unknownTime":"시간 알 수 없음","terminal.analyst.exit":"Session Analyst 닫기","terminal.analyst.open":"Session Analyst 열기","terminal.streams.exit":"Carrier Streams 닫기","terminal.streams.open":"Carrier Streams 열기","terminal.analyst.sendMessageFirst":"먼저 이 세션에서 메시지를 보내세요","terminal.handle.exit":"닫기","terminal.handle.analyze":"분석","terminal.streams.dispatchOrder":"출격 명령","terminal.handle.streams":"스트림","terminal.streams.subtitle":"이 오퍼레이션의 라이브 캐리어 출력","terminal.streams.status.live":"진행 중","terminal.streams.status.done":"완료","terminal.streams.status.error":"오류","terminal.streams.status.idle":"대기","terminal.streams.emptyTitle":"스트리밍 중인 캐리어가 없습니다.","terminal.streams.emptyBody":"이 오퍼레이션의 다음 디스패치가 시작되는 즉시 여기에 표시됩니다.","terminal.streams.reasoning":"추론 중…","terminal.streams.expand":"완료된 스트림 펼치기","terminal.streams.collapse":"완료된 스트림 접기","terminal.streams.activity":"활동","terminal.analysis.error.timedOut":"분석 응답 시간이 초과됐습니다.","terminal.analysis.error.sessionEnded":"분석 세션이 종료됐습니다 — 다시 보내면 재시작합니다.","terminal.analysis.error.stopFailed":"중지 실패: {message}","terminal.analysis.error.resetFailed":"초기화 실패: {message}","terminal.analysis.error.unavailable":"분석을 사용할 수 없습니다.","terminal.analyst.saved":"저장됨","terminal.kind.agent":"Agent","terminal.kind.shell":"Shell","terminal.companion.carrierStreams":"Carrier Streams","terminal.settings.general":"일반","terminal.settings.agentCli":"Agent CLI","terminal.notifications.agentInputWaiting":"Agent 입력 대기","terminal.notifications.agentTurnEnded":"Agent 턴 종료","terminal.notifications.resumeFailed":"재개 실패","terminal.markdown.copy":"복사","terminal.markdown.copyCodeAria":"{language} 코드 복사","terminal.markdown.diagram.renderFailed":"다이어그램 렌더 실패: {message}","terminal.markdown.diagram.openExpandedAria":"다이어그램을 확대 보기로 열기","terminal.markdown.diagram.lightboxTitle":"MANIFEST · DIAGRAM","terminal.markdown.diagram.close":"닫기","terminal.markdown.diagram.closeExpandedAria":"확대된 다이어그램 닫기","terminal.markdown.diagram.zoomControlsAria":"다이어그램 확대/축소 컨트롤","terminal.markdown.diagram.zoomOutAria":"축소","terminal.markdown.diagram.zoomInAria":"확대","terminal.markdown.diagram.fit":"맞춤","terminal.markdown.diagram.fitAria":"뷰포트에 다이어그램 맞추기","terminal.markdown.diagram.reset":"초기화","terminal.markdown.diagram.resetAria":"다이어그램 확대/축소 초기화","terminal.carriers.title":"Carriers","terminal.carriers.listAria":"Carrier 목록","terminal.carriers.loading":"Carrier 설정을 불러오는 중.","terminal.carriers.empty":"등록된 Carrier가 없습니다.","terminal.carriers.captain":"Captain","terminal.carriers.displayName":"표시 이름","terminal.carriers.saveDisplayNameAria":"표시 이름 저장","terminal.carriers.cancelDisplayNameAria":"표시 이름 편집 취소","terminal.carriers.editDisplayNameAria":"표시 이름 편집","terminal.carriers.saving":"저장 중…","terminal.carriers.saved":"저장됨 ✓","terminal.carriers.refresh":"새로고침","terminal.carriers.identity":"정체성","terminal.carriers.runtime":"런타임","terminal.carriers.cli":"CLI","terminal.carriers.model":"모델","terminal.carriers.effort":"Effort","terminal.carriers.effortUnsupported":"이 모델에서는 지원되지 않습니다.","terminal.carriers.select":"Carrier를 선택하세요.","terminal.carriers.taskForce":"Task Force","terminal.carriers.tf.helpEmpty":"이 Carrier를 여러 CLI 백엔드에서 실행합니다. 활성화하려면 최소 {minBackends}개가 필요합니다.","terminal.carriers.tf.helpActive_one":"백엔드 {count}개 구성됨 · 활성","terminal.carriers.tf.helpActive_other":"백엔드 {count}개 구성됨 · 활성","terminal.carriers.tf.helpNeeds_one":"백엔드 {count}개 구성됨 · 활성화하려면 {minBackends}+ 필요","terminal.carriers.tf.helpNeeds_other":"백엔드 {count}개 구성됨 · 활성화하려면 {minBackends}+ 필요","terminal.carriers.tf.hide":"숨기기","terminal.carriers.tf.configure":"구성","terminal.carriers.tf.empty":"구성된 Task Force 백엔드가 없습니다.","terminal.carriers.tf.confirmDeactivate":"확인 — TF 비활성화","terminal.carriers.tf.confirmRemove":"제거 확인","terminal.carriers.tf.confirmRemovalAria":"{name} 백엔드 제거 확인","terminal.carriers.tf.remove":"제거","terminal.carriers.tf.addCliLabel":"추가할 Task Force CLI","terminal.carriers.tf.add":"추가","terminal.dormant.status":"휴면","terminal.dormant.resume":"재개","terminal.dormant.resuming":"재개 중…","terminal.dormant.tryAgain":"다시 시도","terminal.dormant.startFresh":"새로 시작","terminal.dormant.resumeFailedBody":"이 세션을 재개할 수 없습니다. “{name}”의 저장 세션이 만료되었습니다.","terminal.shell.relaunch":"다시 실행","terminal.auth.signedIn":"로그인됨","terminal.auth.notSignedIn":"로그인되지 않음","terminal.auth.signOut":"로그아웃","terminal.auth.signIn":"로그인","terminal.auth.working":"처리 중…","terminal.auth.verifying":"확인 중…","terminal.auth.apiKey":"API key","terminal.auth.apiKeyAria":"{name} API key","terminal.auth.settingsForKimi":"Kimi 설정","terminal.auth.kimiHelp":"Kimi API key를 등록하면 Claude Code로 Kimi 엔드포인트에서 캐리어와 터미널 세션을 실행할 수 있습니다. 키는 검증 후 로컬에만 저장되며 브라우저로 반환되지 않습니다.","terminal.auth.loadingSignIn":"로그인 상태를 불러오는 중.","terminal.auth.defaultModel":"기본 모델","terminal.auth.defaultEffort":"기본 Effort","terminal.auth.kimiModelHelp":"명시적 캐리어 모델이 없는 Kimi 세션에 사용됩니다. 새로 시작한 세션에 적용됩니다.","terminal.auth.signInFoot":"로그인 변경은 새로 시작한 세션에 적용됩니다. 실행 중인 세션은 다시 실행하기 전까지 현재 자격 증명을 유지합니다.","terminal.auth.modelSignInAria":"모델 로그인","terminal.settings.metaphor":"Metaphor","terminal.settings.metaphorHelp":"모든 세션에 간결한 Fleet 문구를 추가합니다. Off면 기본 프롬프트를 사용합니다.","terminal.settings.enabled":"사용","terminal.settings.off":"Off","terminal.settings.loading":"설정을 불러오는 중.","terminal.settings.unavailable":"설정을 사용할 수 없습니다.","terminal.settings.systemPromptAria":"시스템 프롬프트","terminal.settings.systemPromptFoot":"변경 사항은 새로 시작한 세션에 적용됩니다. 실행 중인 세션은 다시 실행하기 전까지 현재 구성을 유지합니다.","terminal.settings.terminalFont":"터미널 글꼴","terminal.settings.terminalFontNew":"신규","terminal.settings.terminalFontHelp":"모든 터미널 패널(agent-cli·shell)의 글꼴과 크기입니다. 열린 터미널에 즉시 적용되며 Console 서버에 저장되어 브라우저와 재시작을 넘깁니다.","terminal.settings.terminalFontFoot":"글꼴 설정은 즉시 적용되며 Console 서버에 저장됩니다. 세션 설정과 별개이며 재시작 후 브라우저 간에 공유됩니다.","terminal.settings.terminalFontPreview":"다람쥐 헌 쳇바퀴에 타고파 0123456789 — 터미널 출력이 선명합니다.","terminal.settings.fontMetaCascadia":"가변 · 터미널 최적화","terminal.settings.fontMetaJetbrains":"가변 · 콘솔 모노","terminal.settings.fontMetaFiraCode":"가변 · 합자","terminal.settings.fontMetaSourceCodePro":"가변 · Adobe 모노","terminal.settings.fontLoadError":"설치된 시스템 글꼴을 사용할 수 없습니다. 내장 글꼴은 계속 사용할 수 있습니다.","terminal.settings.fontPicker.browserAria":"글꼴 탐색기","terminal.settings.fontPicker.searchLabel":"글꼴 검색","terminal.settings.fontPicker.searchPlaceholder":"설치된 글꼴 검색","terminal.settings.fontPicker.loading":"설치된 글꼴을 불러오는 중…","terminal.settings.fontPicker.choicesAria":"글꼴 선택","terminal.settings.fontPicker.builtInGroup":"내장","terminal.settings.fontPicker.installedGroup":"이 기기에 설치됨","terminal.settings.fontPicker.noMatch":"검색과 일치하는 글꼴이 없습니다.","terminal.settings.fontPicker.preview":"미리보기","terminal.settings.fontPicker.available":"사용 가능","terminal.settings.fontPicker.unavailable":"사용 불가","terminal.settings.fontPicker.fontSizeAria":"글꼴 크기","terminal.settings.fontPicker.decreaseSizeAria":"글꼴 크기 줄이기","terminal.settings.fontPicker.sizeValueAria":"글꼴 크기 값","terminal.settings.fontPicker.increaseSizeAria":"글꼴 크기 키우기","terminal.settings.fontPicker.sizeSliderAria":"글꼴 크기 슬라이더","terminal.settings.fontPicker.monospace":"고정폭","terminal.settings.fontPicker.systemFont":"시스템 글꼴","terminal.settings.fontPicker.savedSystemFont":"저장된 시스템 글꼴","terminal.settings.terminalRenderer":"터미널 렌더러","terminal.settings.terminalRendererHelp":"WebGL은 GPU로 터미널을 그려 더 선명하고 빠르게 출력합니다. DOM은 호환용 대체입니다. 전환은 세션을 끊지 않고 즉시 적용됩니다.","terminal.settings.terminalRendererAria":"터미널 렌더러","terminal.settings.webgl":"WebGL","terminal.settings.dom":"DOM","terminal.settings.agentCliAvailable":"Agent CLI 사용 가능","terminal.settings.agentCliHelp":"각 Agent CLI가 이 기기의 PATH에서 설치·검색되는지와 감지된 버전입니다. 캐리어는 여기서 사용 가능으로 표시된 Agent CLI에서만 실행할 수 있습니다.","terminal.settings.agentCliFoot":"CLI를 설치하거나 업데이트한 뒤 이 페이지를 다시 열어 사용 가능 여부를 확인하세요.","terminal.settings.available":"사용 가능","terminal.settings.missing":"없음","terminal.analysis.error.sessionNotFound":"분석 세션을 찾을 수 없습니다.","terminal.analysis.error.requestFailed":"분석 요청이 실패했습니다."},fA={en:eG,ko:tG},nG={en:Ns(fA,"en"),ko:Ns(fA,"ko")};function wt(e){return nG[e??"en"]}function wN(e,t=lG()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}let m0=wN(vp()??"auto");const g0=new Set;let pA=!1,Y_=null,X_=null;function mA(){return m0}function iG(e){return g0.add(e),()=>{g0.delete(e)}}function Ff(e){if(m0!==e){m0=e;for(const t of g0)t()}}function vp(){if(typeof document>"u")return null;const e=document.documentElement.lang;return e==="en"||e==="ko"?e:null}function rG(){if(typeof document<"u"&&!Y_&&(Y_=new MutationObserver(()=>{const t=vp();t&&Ff(t)}),Y_.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]})),pA)return;pA=!0;const e=vp();if(e){Ff(e);return}typeof fetch=="function"&&(X_=new AbortController,fetch("/api/v1/settings/global",{signal:X_.signal}).then(async t=>{if(!t.ok)return;const n=await t.json();if(X_?.signal.aborted)return;const i=vp();if(i){Ff(i);return}Ff(wN(typeof n.language=="string"?n.language:"auto"))}).catch(()=>{}))}function Fs(){return rG(),_.useSyncExternalStore(iG,mA,mA)}function sG(e){const t=wt(e);return{renderFailed:n=>t("terminal.markdown.diagram.renderFailed",{message:n}),openExpandedAria:t("terminal.markdown.diagram.openExpandedAria"),lightboxTitle:t("terminal.markdown.diagram.lightboxTitle"),close:t("terminal.markdown.diagram.close"),closeExpandedAria:t("terminal.markdown.diagram.closeExpandedAria"),zoomControlsAria:t("terminal.markdown.diagram.zoomControlsAria"),zoomOutAria:t("terminal.markdown.diagram.zoomOutAria"),zoomInAria:t("terminal.markdown.diagram.zoomInAria"),fit:t("terminal.markdown.diagram.fit"),fitAria:t("terminal.markdown.diagram.fitAria"),reset:t("terminal.markdown.diagram.reset"),resetAria:t("terminal.markdown.diagram.resetAria")}}function aG(e,t){const n=wt(e);if(t.startsWith("Stop failed: "))return n("terminal.analysis.error.stopFailed",{message:t.slice(13)});if(t.startsWith("Reset failed: "))return n("terminal.analysis.error.resetFailed",{message:t.slice(14)});const i=oG[t];return i?n(i):t}const oG={"Analysis response timed out.":"terminal.analysis.error.timedOut","Analysis session ended — send again to restart.":"terminal.analysis.error.sessionEnded","Analysis is unavailable.":"terminal.analysis.error.unavailable","Analysis session was not found.":"terminal.analysis.error.sessionNotFound","Analysis request failed.":"terminal.analysis.error.requestFailed"};function lG(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const cG=32,y0={catalog:null,cliId:"",model:"",effort:"",draft:"",queue:[],started:!1,busy:!1,phase:"idle",latestActivity:null,runStartedAt:null,runEndedAt:null,entries:[],tools:[],artifacts:[],artifactAuthoring:null,artifactPublished:null,artifactsAutoOpenArmed:!0,selectionLocked:!1,selectionSaved:!1,error:null};function uG(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...gA(t.catalog,t.selection)};if(t.type==="select-cli"&&!e.started){const i=e.catalog?.clis.find(o=>o.cliId===t.cliId),s=i?.models.find(o=>o.id===i.defaultModel)??i?.models[0];return{...e,cliId:t.cliId,model:s?.id??"",effort:s?.defaultEffort??s?.effortLevels[0]??""}}if(t.type==="select-model"&&!e.started){const i=e.catalog?.clis.find(s=>s.cliId===e.cliId)?.models.find(s=>s.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==="set-draft")return{...e,draft:t.draft};if(t.type==="queue-push")return{...e,queue:[...e.queue,t.text]};if(t.type==="queue-cancel")return t.index<0||t.index>=e.queue.length?e:{...e,queue:e.queue.filter((i,s)=>s!==t.index)};if(t.type==="queue-clear")return e.queue.length>0?{...e,queue:[]}:e;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:[],artifactAuthoring:null,artifactPublished:null,entries:[...e.entries,{role:"user",text:t.text}]};if(t.type==="error")return rd(e,t.message,t.now);if(t.type==="session-lost")return{...rd(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...rd(e,t.message,t.now),started:!1};if(t.type==="stopped")return{...e,queue:[],started:!1,busy:!1,phase:"stopped",runEndedAt:t.now,artifactAuthoring:null,error:null};if(t.type==="stop-failed")return{...rd(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...y0,catalog:i,selectionLocked:e.selectionLocked,...gA(i,t.selection)}:{...y0,selectionLocked:e.selectionLocked}}if(t.type==="selection-lock")return e.selectionLocked===t.locked?e:{...e,selectionLocked:t.locked};if(t.type==="selection-saved")return{...e,selectionSaved:!0};if(t.type==="selection-saved-clear")return e.selectionSaved?{...e,selectionSaved:!1}:e;if(t.type==="clear-artifacts")return{...e,artifacts:[],artifactPublished:null,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;if(n.type==="connected")return e.phase==="starting"?{...e,latestActivity:{kind:"starting",connected:!0}}:e;if(n.type==="chunk")return{...e,phase:"writing",latestActivity:{kind:"writing"},entries:hG(e.entries,n.text)};if(n.type==="thought")return{...e,phase:"reasoning",latestActivity:{kind:"reasoning"}};if(n.type==="tool"){const i=n.status.toLowerCase(),s=n.title.toLowerCase().includes("publish_artifact")&&(i==="pending"||i==="in_progress");return{...e,phase:"tool",latestActivity:{kind:"tool",title:n.title,status:n.status},tools:[...e.tools.filter(o=>o.title!==n.title),{title:n.title,status:n.status}],...s?{artifactAuthoring:e.artifactAuthoring??{startedAt:t.now},artifactPublished:null}:{}}}return n.type==="artifact"?{...e,artifacts:[n.artifact,...e.artifacts.filter(i=>i.id!==n.artifact.id)].slice(0,cG),artifactPublished:{artifact:n.artifact,durationMs:e.artifactAuthoring?t.now-e.artifactAuthoring.startedAt:null},artifactAuthoring:null}:n.type==="complete"?{...e,busy:!1,phase:"complete",runEndedAt:t.now,artifactAuthoring:null,error:null}:rd(e,n.error.message,t.now)}function dG(e){const t=e.clis.find(s=>s.cliId==="claude"&&s.available)??e.clis.find(s=>s.available)??e.clis[0],n=t?.models.find(s=>t.cliId==="claude"&&s.id==="sonnet")??t?.models.find(s=>s.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 gA(e,t){const n=dG(e);if(!t)return n;const i=e.clis.find(m=>m.cliId===t.cliId&&m.available),s=i??e.clis.find(m=>m.cliId===n.cliId);if(!s)return n;const o=i?s.models.find(m=>m.id===s.defaultModel)??s.models[0]:s.models.find(m=>m.id===n.model)??s.models.find(m=>m.id===s.defaultModel)??s.models[0],d=s.models.find(m=>m.id===t.model)??o;if(!d)return{cliId:s.cliId,model:"",effort:""};const f=d.effortLevels.includes("medium")?"medium":d.defaultEffort??d.effortLevels[0]??"",p=d.effortLevels.length===0?t.effort===""?"":f:d.effortLevels.includes(t.effort)?t.effort:f;return{cliId:s.cliId,model:d.id,effort:p}}function rd(e,t,n){return{...e,queue:[],busy:!1,phase:"error",runEndedAt:n,artifactAuthoring:null,error:t}}function hG(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 Xd=new Map,lc=new Map;function _S(e){const t=fG(e.operationId,e.api,e.settings,e.language);return{state:_.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function fG(e,t,n,i){const s=Xd.get(e);if(s)return s.updateContext(n,i),s;const o=_G(e,t,n,i);return Xd.set(e,o),o}function pG(e){Xd.get(e)?.dispose()}function mG(e){Xd.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const gG=2e3,yG=12e4;function _G(e,t,n,i){let s=y0,o=n,l=i,d=null,f=!1,p=null,m=null,y=null,b=null,w=null,S=null,x=Promise.resolve(),k=0,L=null,F=0,q=0;const T=new Set,$=j=>{if(f)return;const A=j.type==="select-cli"||j.type==="select-model"||j.type==="select-effort";if(A&&s.selectionLocked)return;const O=uG(s,j);if(O!==s){A&&L!==null&&(clearTimeout(L),L=null),s=A&&O.selectionSaved?{...O,selectionSaved:!1}:O;for(const C of T)C();A&&I({cliId:s.cliId,model:s.model,effort:s.effort})}},I=j=>{const A=o;if(!A)return;const O=++k;x=x.then(async()=>{try{if(await uN(A,{analyst:{selection:j}}),d=j,f||O!==k)return;$({type:"selection-saved"}),L=setTimeout(()=>{L=null,$({type:"selection-saved-clear"})},1500)}catch{}})},N=()=>{m!==null&&(clearTimeout(m),m=null)},V=()=>{N(),m=setTimeout(()=>{m=null,$({type:"error",message:"Analysis response timed out.",now:Date.now()})},yG)},K=()=>{N(),F+=1,q+=1;const j=p;p=null,j?.()},Q=()=>{K(),$({type:"session-lost",now:Date.now()})},Y=async()=>{if(p)return;const j=++F;let A=null;const O=new Promise(C=>{A=C});p=qq(t,e,C=>{if(j!==F||f)return;if(C.type==="connected"){$({type:"event",event:C,now:Date.now()}),A?.(),A=null;return}if(C.type==="error"&&_A(C.error.code)){A?.(),A=null,Q();return}(C.type==="complete"||C.type==="error")&&N();const z=C.type==="complete"?s.queue[0]:void 0;$({type:"event",event:C,now:Date.now()}),z!==void 0&&!s.busy&&!f&&j===F&&($({type:"queue-cancel",index:0}),M.send(z))}),await Promise.race([O,new Promise(C=>setTimeout(C,gG))])},M={getSnapshot:()=>s,subscribe:j=>(T.add(j),()=>T.delete(j)),dispatch:$,send:async j=>{const A=lc.get(e);if(A&&await A,S)try{await S}catch{return}w&&await w;const O=j.trim();if(!O||s.busy||f)return;const C=!s.started,z=++q,P={cliId:s.cliId,model:s.model,effort:s.effort,...l?{language:l}:{}};if($({type:"sending",started:C,text:O,now:Date.now()}),C){const R=new AbortController,W=Uq(t,e,P,R.signal);b=R,y=W;try{await W}catch(G){if(f||z!==q)return;if(!(G instanceof h0&&G.code==="analysis_session_exists")){$({type:"start-failed",message:sd(G),now:Date.now()});return}}finally{b===R&&(b=null),y===W&&(y=null)}if(f||z!==q||!s.started||(await Y(),z!==q||!s.started))return}try{if(await Wq(t,e,O),z!==q||!s.busy||!s.started)return;V()}catch(R){if(f||z!==q)return;R instanceof h0&&_A(R.code)?Q():$({type:"error",message:sd(R),now:Date.now()})}},stop:async()=>{if(S){await S.catch(()=>{});return}if(w)return w;if(f||!s.started)return;K(),$({type:"stopped",now:Date.now()});const j=V_(t,e).catch(A=>{$({type:"stop-failed",message:sd(A),now:Date.now()})});w=j,await j,w===j&&(w=null)},reset:async()=>{if(S)return S;if(f)return;$({type:"selection-lock",locked:!0});const j=s.started||s.phase!=="idle"||s.entries.length>0||s.artifacts.length>0;K();const A=(async()=>{w&&await w,y&&await y.catch(()=>{}),await x,j&&await V_(t,e),await mN(t,e).catch(()=>{}),$({type:"reset",selection:d})})().catch(O=>{throw $({type:"error",message:`Reset failed: ${sd(O)}`,now:Date.now()}),O});S=A;try{await A}finally{S===A&&(S=null),$({type:"selection-lock",locked:!1})}},dispose:()=>{if(f)return;const j=lc.get(e),A=S,O=w,C=y,z=x,P=b;f=!0,Xd.delete(e),K(),L!==null&&clearTimeout(L),T.clear(),P?.abort();const R=(async()=>{j&&await j,C&&await C.catch(()=>{}),A&&await A.catch(()=>{}),O&&await O.catch(()=>{}),await z,await V_(t,e)})().catch(()=>{});lc.set(e,R),R.finally(()=>{lc.get(e)===R&&lc.delete(e)})},updateContext:(j,A)=>{j&&(o=j),l=A}};return(lc.get(e)??Promise.resolve()).then(()=>Promise.all([Fq(t),vG(o)])).then(([j,A])=>{d=A,$({type:"catalog",catalog:j,selection:A})}).catch(j=>$({type:"error",message:sd(j),now:Date.now()})),M}async function vG(e){if(!e)return null;try{const t=await e.read("terminal");if(!t)return null;const n=yA(t.analyst),i=yA(n.selection);return typeof i.cliId=="string"&&typeof i.model=="string"&&typeof i.effort=="string"?{cliId:i.cliId,model:i.model,effort:i.effort}:null}catch{return null}}function yA(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function sd(e){return e instanceof Error?e.message:"Analysis is unavailable."}function _A(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function bG({context:e}){const{state:t,dispatch:n}=_S(e),i=e.language??"en",s=wt(i),o=_.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),l=t.artifacts[0]?.id??null,[d,f]=_.useState(null),[p,m]=_.useState(!1),y=_.useId(),b=_.useRef(null);_.useEffect(()=>{l&&f(l)},[l]);const w=o.find(x=>x.id===d)??o.at(-1)??null,S=o.length;return _.useEffect(()=>{if(!p)return;const x=L=>{L.target instanceof Node&&!b.current?.contains(L.target)&&m(!1)},k=L=>{L.key==="Escape"&&m(!1)};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",k)}},[p]),_.useEffect(()=>{S||m(!1)},[S]),u.jsxs("section",{className:"session-analyst__artifacts","aria-label":s("terminal.companion.artifacts"),children:[u.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[u.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:s("terminal.companion.artifacts")}),u.jsx("small",{children:s("terminal.artifacts.subtitle")})]}),u.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:b,children:[u.jsxs("button",{type:"button",className:"session-analyst__artifact-count","aria-expanded":p,"aria-controls":y,"aria-haspopup":"listbox","aria-label":s(p?S===1?"terminal.artifacts.hideCount_one":"terminal.artifacts.hideCount_other":S===1?"terminal.artifacts.showCount_one":"terminal.artifacts.showCount_other",{count:S}),onClick:()=>m(x=>!x),disabled:!S,children:[u.jsx("strong",{children:S})," ",u.jsx("span",{children:i==="ko"?"개":S===1?"item":"items"}),u.jsx("i",{"aria-hidden":"true"})]}),p?u.jsx("div",{className:"session-analyst__artifact-menu",id:y,role:"listbox","aria-label":s("terminal.artifacts.published"),children:o.map(x=>{const k=x.id===w?.id;return u.jsxs("button",{type:"button",role:"option","aria-selected":k,className:k?"is-active":void 0,title:x.title,onClick:()=>{f(x.id),m(!1)},children:[u.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),u.jsx("strong",{children:x.title}),u.jsx(SN,{createdAt:x.createdAt,language:i})]},x.id)})}):null]}),u.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{m(!1),n({type:"clear-artifacts"}),mN(e.api,e.operationId).catch(()=>{})},disabled:!S,children:s("terminal.artifacts.clear")})]}),S===0?u.jsxs("div",{className:"session-analyst__artifacts-empty",children:[u.jsx("strong",{children:s("terminal.artifacts.emptyTitle")}),s("terminal.artifacts.emptyBody")]}):u.jsx("div",{className:"session-analyst__artifact-content",children:w?u.jsx(wG,{artifact:w,theme:e.theme,language:i},w.id):null})]})}function wG({artifact:e,theme:t,language:n}){if(!e.id)return null;const i=wt(n),s=getComputedStyle(document.documentElement),o=s.getPropertyValue("--ink-veil").trim()||"Canvas",l=s.getPropertyValue("--ink-pearl").trim()||"CanvasText";return u.jsxs("article",{"aria-label":i("terminal.artifacts.selectedPreview"),children:[u.jsxs("header",{children:[u.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),u.jsx(SN,{createdAt:e.createdAt,language:n})]}),u.jsx("iframe",{title:e.title,src:$q(e.id,t,o,l),sandbox:"allow-scripts"})]})}function SN({createdAt:e,language:t}){const n=wt(t),i=new Date(e),s=Number.isFinite(i.getTime());return u.jsx("time",{dateTime:s?i.toISOString():void 0,children:s?i.toLocaleTimeString(t==="ko"?"ko-KR":"en",{hour:"2-digit",minute:"2-digit"}):n("terminal.artifacts.unknownTime")})}const SG="modulepreload",xG=function(e){return"/console/"+e},vA={},CG=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let f=function(p){return Promise.all(p.map(m=>Promise.resolve(m).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=l?.nonce||l?.getAttribute("nonce");s=f(n.map(p=>{if(p=xG(p),p in vA)return;vA[p]=!0;const m=p.endsWith(".css"),y=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":SG,m||(b.as="script"),b.crossOrigin="",b.href=p,d&&b.setAttribute("nonce",d),document.head.appendChild(b),m)return new Promise((w,S)=>{b.addEventListener("load",w),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function o(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return s.then(l=>{for(const d of l||[])d.status==="rejected"&&o(d.reason);return t().catch(o)})};const{entries:xN,setPrototypeOf:bA,isFrozen:kG,getPrototypeOf:EG,getOwnPropertyDescriptor:AG}=Object;let{freeze:Xi,seal:ns,create:vc}=Object,{apply:_0,construct:v0}=typeof Reflect<"u"&&Reflect;Xi||(Xi=function(t){return t});ns||(ns=function(t){return t});_0||(_0=function(t,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return t.apply(n,s)});v0||(v0=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new t(...i)});const ad=si(Array.prototype.forEach),TG=si(Array.prototype.lastIndexOf),wA=si(Array.prototype.pop),od=si(Array.prototype.push),RG=si(Array.prototype.splice),Wi=Array.isArray,Ed=si(String.prototype.toLowerCase),Z_=si(String.prototype.toString),SA=si(String.prototype.match),cc=si(String.prototype.replace),xA=si(String.prototype.indexOf),MG=si(String.prototype.trim),LG=si(Number.prototype.toString),NG=si(Boolean.prototype.toString),CA=typeof BigInt>"u"?null:si(BigInt.prototype.toString),kA=typeof Symbol>"u"?null:si(Symbol.prototype.toString),Bn=si(Object.prototype.hasOwnProperty),ld=si(Object.prototype.toString),Ri=si(RegExp.prototype.test),Hf=OG(TypeError);function si(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return _0(e,t,i)}}function OG(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return v0(e,n)}}function At(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ed;if(bA&&bA(e,null),!Wi(t))return e;let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(kG(t)||(t[i]=o),s=o)}e[s]=!0}return e}function IG(e){for(let t=0;t<e.length;t++)Bn(e,t)||(e[t]=null);return e}function lr(e){const t=vc(null);for(const[n,i]of xN(e))Bn(e,n)&&(Wi(i)?t[n]=IG(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=lr(i):t[n]=i);return t}function DG(e){switch(typeof e){case"string":return e;case"number":return LG(e);case"boolean":return NG(e);case"bigint":return CA?CA(e):"0";case"symbol":return kA?kA(e):"Symbol()";case"undefined":return ld(e);case"function":case"object":{if(e===null)return ld(e);const t=e,n=bc(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:ld(i)}return ld(e)}default:return ld(e)}}function bc(e,t){for(;e!==null;){const i=AG(e,t);if(i){if(i.get)return si(i.get);if(typeof i.value=="function")return si(i.value)}e=EG(e)}function n(){return null}return n}function jG(e){try{return Ri(e,""),!0}catch{return!1}}const EA=Xi(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),J_=Xi(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Q_=Xi(["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"]),BG=Xi(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ev=Xi(["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"]),PG=Xi(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),AA=Xi(["#text"]),TA=Xi(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),tv=Xi(["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"]),RA=Xi(["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"]),Uf=Xi(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zG=ns(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$G=ns(/<%[\w\W]*|[\w\W]*%>/gm),FG=ns(/\$\{[\w\W]*/gm),HG=ns(/^data-[\-\w.\u00B7-\uFFFF]+$/),UG=ns(/^aria-[\-\w]+$/),CN=ns(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),WG=ns(/^(?:\w+script|data):/i),qG=ns(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kN=ns(/^html$/i),GG=ns(/^[a-z][.\w]*(-[.\w]+)+$/i);var MA=Object.freeze({__proto__:null,ARIA_ATTR:UG,ATTR_WHITESPACE:qG,CUSTOM_ELEMENT:GG,DATA_ATTR:HG,DOCTYPE_NAME:kN,ERB_EXPR:$G,IS_ALLOWED_URI:CN,IS_SCRIPT_OR_DATA:WG,MUSTACHE_EXPR:zG,TMPLIT_EXPR:FG});const cd={element:1,text:3,progressingInstruction:7,comment:8,document:9},KG=function(){return typeof window>"u"?null:window},VG=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const o="dompurify"+(i?"#"+i:"");try{return t.createPolicy(o,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},LA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function EN(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:KG();const t=et=>EN(et);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==cd.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:o,HTMLTemplateElement:l,Node:d,Element:f,NodeFilter:p,NamedNodeMap:m=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:y,DOMParser:b,trustedTypes:w}=e,S=f.prototype,x=bc(S,"cloneNode"),k=bc(S,"remove"),L=bc(S,"nextSibling"),F=bc(S,"childNodes"),q=bc(S,"parentNode");if(typeof l=="function"){const et=n.createElement("template");et.content&&et.content.ownerDocument&&(n=et.content.ownerDocument)}let T,$="";const{implementation:I,createNodeIterator:N,createDocumentFragment:V,getElementsByTagName:K}=n,{importNode:Q}=i;let Y=LA();t.isSupported=typeof xN=="function"&&typeof q=="function"&&I&&I.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:M,TMPLIT_EXPR:D,DATA_ATTR:j,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:C,CUSTOM_ELEMENT:z}=MA;let{IS_ALLOWED_URI:P}=MA,R=null;const W=At({},[...EA,...J_,...Q_,...ev,...AA]);let G=null;const U=At({},[...TA,...tv,...RA,...Uf]);let ee=Object.seal(vc(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}})),ne=null,me=null;const Me=Object.seal(vc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ve=!0,Ye=!0,qe=!1,yt=!0,$e=!1,We=!0,mt=!1,ot=!1,Nt=!1,Ot=!1,kt=!1,ye=!1,ze=!0,Je=!1;const It="user-content-";let Ke=!0,en=!1,we={},De=null;const de=At({},["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 Pe=null;const st=At({},["audio","video","img","source","image","track"]);let ft=null;const Dt=At({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Gt="http://www.w3.org/1998/Math/MathML",_t="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let Ne=Tt,jt=!1,se=null;const oe=At({},[Gt,_t,Tt],Z_);let ge=At({},["mi","mo","mn","ms","mtext"]),Ee=At({},["annotation-xml"]);const je=At({},["title","style","font","a","script"]);let at=null;const Z=["application/xhtml+xml","text/html"],he="text/html";let ke=null,Ge=null;const St=n.createElement("form"),Pt=function(X){return X instanceof RegExp||X instanceof Function},Fe=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ge&&Ge===X)return;(!X||typeof X!="object")&&(X={}),X=lr(X),at=Z.indexOf(X.PARSER_MEDIA_TYPE)===-1?he:X.PARSER_MEDIA_TYPE,ke=at==="application/xhtml+xml"?Z_:Ed,R=Bn(X,"ALLOWED_TAGS")&&Wi(X.ALLOWED_TAGS)?At({},X.ALLOWED_TAGS,ke):W,G=Bn(X,"ALLOWED_ATTR")&&Wi(X.ALLOWED_ATTR)?At({},X.ALLOWED_ATTR,ke):U,se=Bn(X,"ALLOWED_NAMESPACES")&&Wi(X.ALLOWED_NAMESPACES)?At({},X.ALLOWED_NAMESPACES,Z_):oe,ft=Bn(X,"ADD_URI_SAFE_ATTR")&&Wi(X.ADD_URI_SAFE_ATTR)?At(lr(Dt),X.ADD_URI_SAFE_ATTR,ke):Dt,Pe=Bn(X,"ADD_DATA_URI_TAGS")&&Wi(X.ADD_DATA_URI_TAGS)?At(lr(st),X.ADD_DATA_URI_TAGS,ke):st,De=Bn(X,"FORBID_CONTENTS")&&Wi(X.FORBID_CONTENTS)?At({},X.FORBID_CONTENTS,ke):de,ne=Bn(X,"FORBID_TAGS")&&Wi(X.FORBID_TAGS)?At({},X.FORBID_TAGS,ke):lr({}),me=Bn(X,"FORBID_ATTR")&&Wi(X.FORBID_ATTR)?At({},X.FORBID_ATTR,ke):lr({}),we=Bn(X,"USE_PROFILES")?X.USE_PROFILES&&typeof X.USE_PROFILES=="object"?lr(X.USE_PROFILES):X.USE_PROFILES:!1,ve=X.ALLOW_ARIA_ATTR!==!1,Ye=X.ALLOW_DATA_ATTR!==!1,qe=X.ALLOW_UNKNOWN_PROTOCOLS||!1,yt=X.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=X.SAFE_FOR_TEMPLATES||!1,We=X.SAFE_FOR_XML!==!1,mt=X.WHOLE_DOCUMENT||!1,Ot=X.RETURN_DOM||!1,kt=X.RETURN_DOM_FRAGMENT||!1,ye=X.RETURN_TRUSTED_TYPE||!1,Nt=X.FORCE_BODY||!1,ze=X.SANITIZE_DOM!==!1,Je=X.SANITIZE_NAMED_PROPS||!1,Ke=X.KEEP_CONTENT!==!1,en=X.IN_PLACE||!1,P=jG(X.ALLOWED_URI_REGEXP)?X.ALLOWED_URI_REGEXP:CN,Ne=typeof X.NAMESPACE=="string"?X.NAMESPACE:Tt,ge=Bn(X,"MATHML_TEXT_INTEGRATION_POINTS")&&X.MATHML_TEXT_INTEGRATION_POINTS&&typeof X.MATHML_TEXT_INTEGRATION_POINTS=="object"?lr(X.MATHML_TEXT_INTEGRATION_POINTS):At({},["mi","mo","mn","ms","mtext"]),Ee=Bn(X,"HTML_INTEGRATION_POINTS")&&X.HTML_INTEGRATION_POINTS&&typeof X.HTML_INTEGRATION_POINTS=="object"?lr(X.HTML_INTEGRATION_POINTS):At({},["annotation-xml"]);const Se=Bn(X,"CUSTOM_ELEMENT_HANDLING")&&X.CUSTOM_ELEMENT_HANDLING&&typeof X.CUSTOM_ELEMENT_HANDLING=="object"?lr(X.CUSTOM_ELEMENT_HANDLING):vc(null);if(ee=vc(null),Bn(Se,"tagNameCheck")&&Pt(Se.tagNameCheck)&&(ee.tagNameCheck=Se.tagNameCheck),Bn(Se,"attributeNameCheck")&&Pt(Se.attributeNameCheck)&&(ee.attributeNameCheck=Se.attributeNameCheck),Bn(Se,"allowCustomizedBuiltInElements")&&typeof Se.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=Se.allowCustomizedBuiltInElements),$e&&(Ye=!1),kt&&(Ot=!0),we&&(R=At({},AA),G=vc(null),we.html===!0&&(At(R,EA),At(G,TA)),we.svg===!0&&(At(R,J_),At(G,tv),At(G,Uf)),we.svgFilters===!0&&(At(R,Q_),At(G,tv),At(G,Uf)),we.mathMl===!0&&(At(R,ev),At(G,RA),At(G,Uf))),Me.tagCheck=null,Me.attributeCheck=null,Bn(X,"ADD_TAGS")&&(typeof X.ADD_TAGS=="function"?Me.tagCheck=X.ADD_TAGS:Wi(X.ADD_TAGS)&&(R===W&&(R=lr(R)),At(R,X.ADD_TAGS,ke))),Bn(X,"ADD_ATTR")&&(typeof X.ADD_ATTR=="function"?Me.attributeCheck=X.ADD_ATTR:Wi(X.ADD_ATTR)&&(G===U&&(G=lr(G)),At(G,X.ADD_ATTR,ke))),Bn(X,"ADD_URI_SAFE_ATTR")&&Wi(X.ADD_URI_SAFE_ATTR)&&At(ft,X.ADD_URI_SAFE_ATTR,ke),Bn(X,"FORBID_CONTENTS")&&Wi(X.FORBID_CONTENTS)&&(De===de&&(De=lr(De)),At(De,X.FORBID_CONTENTS,ke)),Bn(X,"ADD_FORBID_CONTENTS")&&Wi(X.ADD_FORBID_CONTENTS)&&(De===de&&(De=lr(De)),At(De,X.ADD_FORBID_CONTENTS,ke)),Ke&&(R["#text"]=!0),mt&&At(R,["html","head","body"]),R.table&&(At(R,["tbody"]),delete ne.tbody),X.TRUSTED_TYPES_POLICY){if(typeof X.TRUSTED_TYPES_POLICY.createHTML!="function")throw Hf('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof X.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Hf('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=X.TRUSTED_TYPES_POLICY,$=T.createHTML("")}else T===void 0&&(T=VG(w,s)),T!==null&&typeof $=="string"&&($=T.createHTML(""));Xi&&Xi(X),Ge=X},Oe=At({},[...J_,...Q_,...BG]),Qe=At({},[...ev,...PG]),_n=function(X){let Se=q(X);(!Se||!Se.tagName)&&(Se={namespaceURI:Ne,tagName:"template"});const Be=Ed(X.tagName),Bt=Ed(Se.tagName);return se[X.namespaceURI]?X.namespaceURI===_t?Se.namespaceURI===Tt?Be==="svg":Se.namespaceURI===Gt?Be==="svg"&&(Bt==="annotation-xml"||ge[Bt]):!!Oe[Be]:X.namespaceURI===Gt?Se.namespaceURI===Tt?Be==="math":Se.namespaceURI===_t?Be==="math"&&Ee[Bt]:!!Qe[Be]:X.namespaceURI===Tt?Se.namespaceURI===_t&&!Ee[Bt]||Se.namespaceURI===Gt&&!ge[Bt]?!1:!Qe[Be]&&(je[Be]||!Oe[Be]):!!(at==="application/xhtml+xml"&&se[X.namespaceURI]):!1},gt=function(X){od(t.removed,{element:X});try{q(X).removeChild(X)}catch{k(X)}},Rn=function(X,Se){try{od(t.removed,{attribute:Se.getAttributeNode(X),from:Se})}catch{od(t.removed,{attribute:null,from:Se})}if(Se.removeAttribute(X),X==="is")if(Ot||kt)try{gt(Se)}catch{}else try{Se.setAttribute(X,"")}catch{}},$i=function(X){let Se=null,Be=null;if(Nt)X="<remove></remove>"+X;else{const ln=SA(X,/^[\r\n\t ]+/);Be=ln&&ln[0]}at==="application/xhtml+xml"&&Ne===Tt&&(X='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+X+"</body></html>");const Bt=T?T.createHTML(X):X;if(Ne===Tt)try{Se=new b().parseFromString(Bt,at)}catch{}if(!Se||!Se.documentElement){Se=I.createDocument(Ne,"template",null);try{Se.documentElement.innerHTML=jt?$:Bt}catch{}}const Rt=Se.body||Se.documentElement;return X&&Be&&Rt.insertBefore(n.createTextNode(Be),Rt.childNodes[0]||null),Ne===Tt?K.call(Se,mt?"html":"body")[0]:mt?Se.documentElement:Rt},Lr=function(X){return N.call(X.ownerDocument||X,X,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Ii=function(X){return X instanceof y&&(typeof X.nodeName!="string"||typeof X.textContent!="string"||typeof X.removeChild!="function"||!(X.attributes instanceof m)||typeof X.removeAttribute!="function"||typeof X.setAttribute!="function"||typeof X.namespaceURI!="string"||typeof X.insertBefore!="function"||typeof X.hasChildNodes!="function")},Ft=function(X){return typeof d=="function"&&X instanceof d};function Kt(et,X,Se){ad(et,Be=>{Be.call(t,X,Se,Ge)})}const Qi=function(X){let Se=null;if(Kt(Y.beforeSanitizeElements,X,null),Ii(X))return gt(X),!0;const Be=ke(X.nodeName);if(Kt(Y.uponSanitizeElement,X,{tagName:Be,allowedTags:R}),We&&X.hasChildNodes()&&!Ft(X.firstElementChild)&&Ri(/<[/\w!]/g,X.innerHTML)&&Ri(/<[/\w!]/g,X.textContent)||We&&X.namespaceURI===Tt&&Be==="style"&&Ft(X.firstElementChild)||X.nodeType===cd.progressingInstruction||We&&X.nodeType===cd.comment&&Ri(/<[/\w]/g,X.data))return gt(X),!0;if(ne[Be]||!(Me.tagCheck instanceof Function&&Me.tagCheck(Be))&&!R[Be]){if(!ne[Be]&&is(Be)&&(ee.tagNameCheck instanceof RegExp&&Ri(ee.tagNameCheck,Be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Be)))return!1;if(Ke&&!De[Be]){const Bt=q(X)||X.parentNode,Rt=F(X)||X.childNodes;if(Rt&&Bt){const ln=Rt.length;for(let ie=ln-1;ie>=0;--ie){const Ie=x(Rt[ie],!0);Bt.insertBefore(Ie,L(X))}}}return gt(X),!0}return X instanceof f&&!_n(X)||(Be==="noscript"||Be==="noembed"||Be==="noframes")&&Ri(/<\/no(script|embed|frames)/i,X.innerHTML)?(gt(X),!0):($e&&X.nodeType===cd.text&&(Se=X.textContent,ad([B,M,D],Bt=>{Se=cc(Se,Bt," ")}),X.textContent!==Se&&(od(t.removed,{element:X.cloneNode()}),X.textContent=Se)),Kt(Y.afterSanitizeElements,X,null),!1)},gs=function(X,Se,Be){if(me[Se]||ze&&(Se==="id"||Se==="name")&&(Be in n||Be in St))return!1;const Bt=G[Se]||Me.attributeCheck instanceof Function&&Me.attributeCheck(Se,X);if(!(Ye&&!me[Se]&&Ri(j,Se))){if(!(ve&&Ri(A,Se))){if(!Bt||me[Se]){if(!(is(X)&&(ee.tagNameCheck instanceof RegExp&&Ri(ee.tagNameCheck,X)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(X))&&(ee.attributeNameCheck instanceof RegExp&&Ri(ee.attributeNameCheck,Se)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(Se,X))||Se==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&Ri(ee.tagNameCheck,Be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Be))))return!1}else if(!ft[Se]){if(!Ri(P,cc(Be,C,""))){if(!((Se==="src"||Se==="xlink:href"||Se==="href")&&X!=="script"&&xA(Be,"data:")===0&&Pe[X])){if(!(qe&&!Ri(O,cc(Be,C,"")))){if(Be)return!1}}}}}}return!0},Hs=At({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),is=function(X){return!Hs[Ed(X)]&&Ri(z,X)},Us=function(X){Kt(Y.beforeSanitizeAttributes,X,null);const{attributes:Se}=X;if(!Se||Ii(X))return;const Be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let Bt=Se.length;for(;Bt--;){const Rt=Se[Bt],{name:ln,namespaceURI:ie,value:Ie}=Rt,fe=ke(ln),Te=Ie;let Ae=ln==="value"?Te:MG(Te);if(Be.attrName=fe,Be.attrValue=Ae,Be.keepAttr=!0,Be.forceKeepAttr=void 0,Kt(Y.uponSanitizeAttribute,X,Be),Ae=Be.attrValue,Je&&(fe==="id"||fe==="name")&&xA(Ae,It)!==0&&(Rn(ln,X),Ae=It+Ae),We&&Ri(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Ae)){Rn(ln,X);continue}if(fe==="attributename"&&SA(Ae,"href")){Rn(ln,X);continue}if(Be.forceKeepAttr)continue;if(!Be.keepAttr){Rn(ln,X);continue}if(!yt&&Ri(/\/>/i,Ae)){Rn(ln,X);continue}$e&&ad([B,M,D],xt=>{Ae=cc(Ae,xt," ")});const dt=ke(X.nodeName);if(!gs(dt,fe,Ae)){Rn(ln,X);continue}if(T&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!ie)switch(w.getAttributeType(dt,fe)){case"TrustedHTML":{Ae=T.createHTML(Ae);break}case"TrustedScriptURL":{Ae=T.createScriptURL(Ae);break}}if(Ae!==Te)try{ie?X.setAttributeNS(ie,ln,Ae):X.setAttribute(ln,Ae),Ii(X)?gt(X):wA(t.removed)}catch{Rn(ln,X)}}Kt(Y.afterSanitizeAttributes,X,null)},pr=function(X){let Se=null;const Be=Lr(X);for(Kt(Y.beforeSanitizeShadowDOM,X,null);Se=Be.nextNode();)Kt(Y.uponSanitizeShadowNode,Se,null),Qi(Se),Us(Se),Se.content instanceof o&&pr(Se.content);Kt(Y.afterSanitizeShadowDOM,X,null)};return t.sanitize=function(et){let X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Se=null,Be=null,Bt=null,Rt=null;if(jt=!et,jt&&(et="<!-->"),typeof et!="string"&&!Ft(et)&&(et=DG(et),typeof et!="string"))throw Hf("dirty is not a string, aborting");if(!t.isSupported)return et;if(ot||Fe(X),t.removed=[],typeof et=="string"&&(en=!1),en){const Ie=et.nodeName;if(typeof Ie=="string"){const fe=ke(Ie);if(!R[fe]||ne[fe])throw Hf("root node is forbidden and cannot be sanitized in-place")}}else if(et instanceof d)Se=$i("<!---->"),Be=Se.ownerDocument.importNode(et,!0),Be.nodeType===cd.element&&Be.nodeName==="BODY"||Be.nodeName==="HTML"?Se=Be:Se.appendChild(Be);else{if(!Ot&&!$e&&!mt&&et.indexOf("<")===-1)return T&&ye?T.createHTML(et):et;if(Se=$i(et),!Se)return Ot?null:ye?$:""}Se&&Nt&&gt(Se.firstChild);const ln=Lr(en?et:Se);for(;Bt=ln.nextNode();)Qi(Bt),Us(Bt),Bt.content instanceof o&&pr(Bt.content);if(en)return et;if(Ot){if($e){Se.normalize();let Ie=Se.innerHTML;ad([B,M,D],fe=>{Ie=cc(Ie,fe," ")}),Se.innerHTML=Ie}if(kt)for(Rt=V.call(Se.ownerDocument);Se.firstChild;)Rt.appendChild(Se.firstChild);else Rt=Se;return(G.shadowroot||G.shadowrootmode)&&(Rt=Q.call(i,Rt,!0)),Rt}let ie=mt?Se.outerHTML:Se.innerHTML;return mt&&R["!doctype"]&&Se.ownerDocument&&Se.ownerDocument.doctype&&Se.ownerDocument.doctype.name&&Ri(kN,Se.ownerDocument.doctype.name)&&(ie="<!DOCTYPE "+Se.ownerDocument.doctype.name+`>
99
+ `+ie),$e&&ad([B,M,D],Ie=>{ie=cc(ie,Ie," ")}),T&&ye?T.createHTML(ie):ie},t.setConfig=function(){let et=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fe(et),ot=!0},t.clearConfig=function(){Ge=null,ot=!1},t.isValidAttribute=function(et,X,Se){Ge||Fe({});const Be=ke(et),Bt=ke(X);return gs(Be,Bt,Se)},t.addHook=function(et,X){typeof X=="function"&&od(Y[et],X)},t.removeHook=function(et,X){if(X!==void 0){const Se=TG(Y[et],X);return Se===-1?void 0:RG(Y[et],Se,1)[0]}return wA(Y[et])},t.removeHooks=function(et){Y[et]=[]},t.removeAllHooks=function(){Y=LA()},t}var jd=EN();function vS(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var El=vS();function AN(e){El=e}var Bd={exec:()=>null};function Qt(e,t=""){let n=typeof e=="string"?e:e.source,i={replace:(s,o)=>{let l=typeof o=="string"?o:o.source;return l=l.replace(Vi.caret,"$1"),n=n.replace(s,l),i},getRegex:()=>new RegExp(n,t)};return i}var YG=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Vi={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")},XG=/^(?:[ \t]*(?:\n|$))+/,ZG=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JG=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fh=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,QG=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bS=/(?:[*+-]|\d{1,9}[.)])/,TN=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,RN=Qt(TN).replace(/bull/g,bS).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(),eK=Qt(TN).replace(/bull/g,bS).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(),wS=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tK=/^[^\n]+/,SS=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nK=Qt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",SS).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),iK=Qt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bS).getRegex(),Ym="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",xS=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rK=Qt("^ {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",xS).replace("tag",Ym).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),MN=Qt(wS).replace("hr",fh).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",Ym).getRegex(),sK=Qt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",MN).getRegex(),CS={blockquote:sK,code:ZG,def:nK,fences:JG,heading:QG,hr:fh,html:rK,lheading:RN,list:iK,newline:XG,paragraph:MN,table:Bd,text:tK},NA=Qt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fh).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",Ym).getRegex(),aK={...CS,lheading:eK,table:NA,paragraph:Qt(wS).replace("hr",fh).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",NA).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",Ym).getRegex()},oK={...CS,html:Qt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xS).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:Bd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Qt(wS).replace("hr",fh).replace("heading",` *#{1,6} *[^
100
+ ]`).replace("lheading",RN).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lK=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cK=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,LN=/^( {2,}|\\)\n(?!\s*$)/,uK=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xm=/[\p{P}\p{S}]/u,kS=/[\s\p{P}\p{S}]/u,NN=/[^\s\p{P}\p{S}]/u,dK=Qt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,kS).getRegex(),ON=/(?!~)[\p{P}\p{S}]/u,hK=/(?!~)[\s\p{P}\p{S}]/u,fK=/(?:[^\s\p{P}\p{S}]|~)/u,pK=Qt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",YG?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),IN=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,mK=Qt(IN,"u").replace(/punct/g,Xm).getRegex(),gK=Qt(IN,"u").replace(/punct/g,ON).getRegex(),DN="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yK=Qt(DN,"gu").replace(/notPunctSpace/g,NN).replace(/punctSpace/g,kS).replace(/punct/g,Xm).getRegex(),_K=Qt(DN,"gu").replace(/notPunctSpace/g,fK).replace(/punctSpace/g,hK).replace(/punct/g,ON).getRegex(),vK=Qt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,NN).replace(/punctSpace/g,kS).replace(/punct/g,Xm).getRegex(),bK=Qt(/\\(punct)/,"gu").replace(/punct/g,Xm).getRegex(),wK=Qt(/^<(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(),SK=Qt(xS).replace("(?:-->|$)","-->").getRegex(),xK=Qt("^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",SK).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),nm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,CK=Qt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",nm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jN=Qt(/^!?\[(label)\]\[(ref)\]/).replace("label",nm).replace("ref",SS).getRegex(),BN=Qt(/^!?\[(ref)\](?:\[\])?/).replace("ref",SS).getRegex(),kK=Qt("reflink|nolink(?!\\()","g").replace("reflink",jN).replace("nolink",BN).getRegex(),OA=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ES={_backpedal:Bd,anyPunctuation:bK,autolink:wK,blockSkip:pK,br:LN,code:cK,del:Bd,emStrongLDelim:mK,emStrongRDelimAst:yK,emStrongRDelimUnd:vK,escape:lK,link:CK,nolink:BN,punctuation:dK,reflink:jN,reflinkSearch:kK,tag:xK,text:uK,url:Bd},EK={...ES,link:Qt(/^!?\[(label)\]\((.*?)\)/).replace("label",nm).getRegex(),reflink:Qt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",nm).getRegex()},b0={...ES,emStrongRDelimAst:_K,emStrongLDelim:gK,url:Qt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",OA).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:Qt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",OA).getRegex()},AK={...b0,br:Qt(LN).replace("{2,}","*").getRegex(),text:Qt(b0.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wf={normal:CS,gfm:aK,pedantic:oK},ud={normal:ES,gfm:b0,breaks:AK,pedantic:EK},TK={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},IA=e=>TK[e];function As(e,t){if(t){if(Vi.escapeTest.test(e))return e.replace(Vi.escapeReplace,IA)}else if(Vi.escapeTestNoEncode.test(e))return e.replace(Vi.escapeReplaceNoEncode,IA);return e}function DA(e){try{e=encodeURI(e).replace(Vi.percentDecode,"%")}catch{return null}return e}function jA(e,t){let n=e.replace(Vi.findPipe,(o,l,d)=>{let f=!1,p=l;for(;--p>=0&&d[p]==="\\";)f=!f;return f?"|":" |"}),i=n.split(Vi.splitPipe),s=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(;s<i.length;s++)i[s]=i[s].trim().replace(Vi.slashPipe,"|");return i}function dd(e,t,n){let i=e.length;if(i===0)return"";let s=0;for(;s<i&&e.charAt(i-s-1)===t;)s++;return e.slice(0,i-s)}function RK(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 BA(e,t,n,i,s){let o=t.href,l=t.title||null,d=e[1].replace(s.other.outputLinkReplace,"$1");i.state.inLink=!0;let f={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:l,text:d,tokens:i.inlineTokens(d)};return i.state.inLink=!1,f}function MK(e,t,n){let i=e.match(n.other.indentCodeCompensation);if(i===null)return t;let s=i[1];return t.split(`
101
+ `).map(o=>{let l=o.match(n.other.beginningSpace);if(l===null)return o;let[d]=l;return d.length>=s.length?o.slice(s.length):o}).join(`
102
+ `)}var im=class{options;rules;lexer;constructor(e){this.options=e||El}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:dd(n,`
103
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=MK(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=dd(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:dd(t[0],`
104
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=dd(t[0],`
105
+ `).split(`
106
+ `),i="",s="",o=[];for(;n.length>0;){let l=!1,d=[],f;for(f=0;f<n.length;f++)if(this.rules.other.blockquoteStart.test(n[f]))d.push(n[f]),l=!0;else if(!l)d.push(n[f]);else break;n=n.slice(f);let p=d.join(`
107
+ `),m=p.replace(this.rules.other.blockquoteSetextReplace,`
108
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
109
+ ${p}`:p,s=s?`${s}
110
+ ${m}`:m;let y=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(m,o,!0),this.lexer.state.top=y,n.length===0)break;let b=o.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){let w=b,S=w.raw+`
111
+ `+n.join(`
112
+ `),x=this.blockquote(S);o[o.length-1]=x,i=i.substring(0,i.length-w.raw.length)+x.raw,s=s.substring(0,s.length-w.text.length)+x.text;break}else if(b?.type==="list"){let w=b,S=w.raw+`
113
+ `+n.join(`
114
+ `),x=this.list(S);o[o.length-1]=x,i=i.substring(0,i.length-b.raw.length)+x.raw,s=s.substring(0,s.length-w.raw.length)+x.raw,n=S.substring(o.at(-1).raw.length).split(`
115
+ `);continue}}return{type:"blockquote",raw:i,tokens:o,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),i=n.length>1,s={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),l=!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 y=t[2].split(`
116
+ `,1)[0].replace(this.rules.other.listReplaceTabs,L=>" ".repeat(3*L.length)),b=e.split(`
117
+ `,1)[0],w=!y.trim(),S=0;if(this.options.pedantic?(S=2,m=y.trimStart()):w?S=t[1].length+1:(S=t[2].search(this.rules.other.nonSpaceChar),S=S>4?1:S,m=y.slice(S),S+=t[1].length),w&&this.rules.other.blankLine.test(b)&&(p+=b+`
118
+ `,e=e.substring(b.length+1),f=!0),!f){let L=this.rules.other.nextBulletRegex(S),F=this.rules.other.hrRegex(S),q=this.rules.other.fencesBeginRegex(S),T=this.rules.other.headingBeginRegex(S),$=this.rules.other.htmlBeginRegex(S);for(;e;){let I=e.split(`
119
+ `,1)[0],N;if(b=I,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),N=b):N=b.replace(this.rules.other.tabCharGlobal," "),q.test(b)||T.test(b)||$.test(b)||L.test(b)||F.test(b))break;if(N.search(this.rules.other.nonSpaceChar)>=S||!b.trim())m+=`
120
+ `+N.slice(S);else{if(w||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||q.test(y)||T.test(y)||F.test(y))break;m+=`
121
+ `+b}!w&&!b.trim()&&(w=!0),p+=I+`
122
+ `,e=e.substring(I.length+1),y=N.slice(S)}}s.loose||(l?s.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(l=!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,""))),s.items.push({type:"list_item",raw:p,task:!!x,checked:k,loose:!1,text:m,tokens:[]}),s.raw+=p}let d=s.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let f=0;f<s.items.length;f++)if(this.lexer.state.top=!1,s.items[f].tokens=this.lexer.blockTokens(s.items[f].text,[]),!s.loose){let p=s.items[f].tokens.filter(y=>y.type==="space"),m=p.length>0&&p.some(y=>this.rules.other.anyLine.test(y.raw));s.loose=m}if(s.loose)for(let f=0;f<s.items.length;f++)s.items[f].loose=!0;return s}}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"):"",s=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:s}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=jA(t[1]),i=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
123
+ `):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===i.length){for(let l of i)this.rules.other.tableAlignRight.test(l)?o.align.push("right"):this.rules.other.tableAlignCenter.test(l)?o.align.push("center"):this.rules.other.tableAlignLeft.test(l)?o.align.push("left"):o.align.push(null);for(let l=0;l<n.length;l++)o.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:o.align[l]});for(let l of s)o.rows.push(jA(l,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)===`
124
+ `?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=dd(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=RK(t[2],"()");if(o===-2)return;if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let i=t[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=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)),BA(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.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," "),s=t[i.toLowerCase()];if(!s){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return BA(n,s,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 s=[...i[0]].length-1,o,l,d=s,f=0,p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(i=p.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(l=[...o].length,i[3]||i[4]){d+=l;continue}else if((i[5]||i[6])&&s%3&&!((s+l)%3)){f+=l;continue}if(d-=l,d>0)continue;l=Math.min(l,l+d+f);let m=[...i[0]][0].length,y=e.slice(0,s+i.index+m+l);if(Math.min(s,l)%2){let w=y.slice(1,-1);return{type:"em",raw:y,text:w,tokens:this.lexer.inlineTokens(w)}}let b=y.slice(2,-2);return{type:"strong",raw:y,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),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return i&&s&&(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 s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==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}}}},ls=class w0{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||El,this.options.tokenizer=this.options.tokenizer||new im,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:Vi,block:Wf.normal,inline:ud.normal};this.options.pedantic?(n.block=Wf.pedantic,n.inline=ud.pedantic):this.options.gfm&&(n.block=Wf.gfm,this.options.breaks?n.inline=ud.breaks:n.inline=ud.gfm),this.tokenizer.rules=n}static get rules(){return{block:Wf,inline:ud}}static lex(t,n){return new w0(n).lex(t)}static lexInline(t,n){return new w0(n).inlineTokens(t)}lex(t){t=t.replace(Vi.carriageReturn,`
125
+ `),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(Vi.tabCharGlobal," ").replace(Vi.spaceLine,""));t;){let s;if(this.options.extensions?.block?.some(l=>(s=l.call({lexer:this},t,n))?(t=t.substring(s.raw.length),n.push(s),!0):!1))continue;if(s=this.tokenizer.space(t)){t=t.substring(s.raw.length);let l=n.at(-1);s.raw.length===1&&l!==void 0?l.raw+=`
126
+ `:n.push(s);continue}if(s=this.tokenizer.code(t)){t=t.substring(s.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
127
+ `)?"":`
128
+ `)+s.raw,l.text+=`
129
+ `+s.text,this.inlineQueue.at(-1).src=l.text):n.push(s);continue}if(s=this.tokenizer.fences(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.heading(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.hr(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.blockquote(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.list(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.html(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.def(t)){t=t.substring(s.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
130
+ `)?"":`
131
+ `)+s.raw,l.text+=`
132
+ `+s.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title},n.push(s));continue}if(s=this.tokenizer.table(t)){t=t.substring(s.raw.length),n.push(s);continue}if(s=this.tokenizer.lheading(t)){t=t.substring(s.raw.length),n.push(s);continue}let o=t;if(this.options.extensions?.startBlock){let l=1/0,d=t.slice(1),f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},d),typeof f=="number"&&f>=0&&(l=Math.min(l,f))}),l<1/0&&l>=0&&(o=t.substring(0,l+1))}if(this.state.top&&(s=this.tokenizer.paragraph(o))){let l=n.at(-1);i&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
133
+ `)?"":`
134
+ `)+s.raw,l.text+=`
135
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(s),i=o.length!==t.length,t=t.substring(s.raw.length);continue}if(s=this.tokenizer.text(t)){t=t.substring(s.raw.length);let l=n.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
136
+ `)?"":`
137
+ `)+s.raw,l.text+=`
138
+ `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(s);continue}if(t){let l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){let i=t,s=null;if(this.tokens.links){let f=Object.keys(this.tokens.links);if(f.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)f.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,s.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(s=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)o=s[2]?s[2].length:0,i=i.slice(0,s.index+o)+"["+"a".repeat(s[0].length-o-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=this.options.hooks?.emStrongMask?.call({lexer:this},i)??i;let l=!1,d="";for(;t;){l||(d=""),l=!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,y=t.slice(1),b;this.options.extensions.startInline.forEach(w=>{b=w.call({lexer:this},y),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)),l=!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}},rm=class{options;parser;constructor(e){this.options=e||El}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(Vi.notSpaceStart)?.[0],s=e.replace(Vi.endingNewline,"")+`
139
+ `;return i?'<pre><code class="language-'+As(i)+'">'+(n?s:As(s,!0))+`</code></pre>
140
+ `:"<pre><code>"+(n?s:As(s,!0))+`</code></pre>
141
+ `}blockquote({tokens:e}){return`<blockquote>
142
+ ${this.parser.parse(e)}</blockquote>
143
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
144
+ `}hr(e){return`<hr>
145
+ `}list(e){let t=e.ordered,n=e.start,i="";for(let l=0;l<e.items.length;l++){let d=e.items[l];i+=this.listitem(d)}let s=t?"ol":"ul",o=t&&n!==1?' start="'+n+'"':"";return"<"+s+o+`>
146
+ `+i+"</"+s+`>
147
+ `}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+" "+As(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>
148
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
149
+ `}table(e){let t="",n="";for(let s=0;s<e.header.length;s++)n+=this.tablecell(e.header[s]);t+=this.tablerow({text:n});let i="";for(let s=0;s<e.rows.length;s++){let o=e.rows[s];n="";for(let l=0;l<o.length;l++)n+=this.tablecell(o[l]);i+=this.tablerow({text:n})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
150
+ <thead>
151
+ `+t+`</thead>
152
+ `+i+`</table>
153
+ `}tablerow({text:e}){return`<tr>
154
+ ${e}</tr>
155
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
156
+ `}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>${As(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),s=DA(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+As(t)+'"'),o+=">"+i+"</a>",o}image({href:e,title:t,text:n,tokens:i}){i&&(n=this.parser.parseInline(i,this.parser.textRenderer));let s=DA(e);if(s===null)return As(n);e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${As(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:As(e.text)}},AS=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""}},cs=class S0{options;renderer;textRenderer;constructor(t){this.options=t||El,this.options.renderer=this.options.renderer||new rm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new AS}static parse(t,n){return new S0(n).parse(t)}static parseInline(t,n){return new S0(n).parseInline(t)}parse(t,n=!0){let i="";for(let s=0;s<t.length;s++){let o=t[s];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 l=o;switch(l.type){case"space":{i+=this.renderer.space(l);continue}case"hr":{i+=this.renderer.hr(l);continue}case"heading":{i+=this.renderer.heading(l);continue}case"code":{i+=this.renderer.code(l);continue}case"table":{i+=this.renderer.table(l);continue}case"blockquote":{i+=this.renderer.blockquote(l);continue}case"list":{i+=this.renderer.list(l);continue}case"html":{i+=this.renderer.html(l);continue}case"def":{i+=this.renderer.def(l);continue}case"paragraph":{i+=this.renderer.paragraph(l);continue}case"text":{let d=l,f=this.renderer.text(d);for(;s+1<t.length&&t[s+1].type==="text";)d=t[++s],f+=`
157
+ `+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 "'+l.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 s=0;s<t.length;s++){let o=t[s];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 l=o;switch(l.type){case"escape":{i+=n.text(l);break}case"html":{i+=n.html(l);break}case"link":{i+=n.link(l);break}case"image":{i+=n.image(l);break}case"strong":{i+=n.strong(l);break}case"em":{i+=n.em(l);break}case"codespan":{i+=n.codespan(l);break}case"br":{i+=n.br(l);break}case"del":{i+=n.del(l);break}case"text":{i+=n.text(l);break}default:{let d='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return i}},Ad=class{options;block;constructor(e){this.options=e||El}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?ls.lex:ls.lexInline}provideParser(){return this.block?cs.parse:cs.parseInline}},PN=class{defaults=vS();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=cs;Renderer=rm;TextRenderer=AS;Lexer=ls;Tokenizer=im;Hooks=Ad;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 s=i;for(let o of s.header)n=n.concat(this.walkTokens(o.tokens,t));for(let o of s.rows)for(let l of o)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let s=i;n=n.concat(this.walkTokens(s.items,t));break}default:{let s=i;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(o=>{let l=s[o].flat(1/0);n=n.concat(this.walkTokens(l,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.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(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=t.renderers[s.name];o?t.renderers[s.name]=function(...l){let d=s.renderer.apply(this,l);return d===!1&&(d=o.apply(this,l)),d}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[s.level];o?o.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),i.extensions=t),n.renderer){let s=this.defaults.renderer||new rm(this.defaults);for(let o in n.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let l=o,d=n.renderer[l],f=s[l];s[l]=(...p)=>{let m=d.apply(s,p);return m===!1&&(m=f.apply(s,p)),m||""}}i.renderer=s}if(n.tokenizer){let s=this.defaults.tokenizer||new im(this.defaults);for(let o in n.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let l=o,d=n.tokenizer[l],f=s[l];s[l]=(...p)=>{let m=d.apply(s,p);return m===!1&&(m=f.apply(s,p)),m}}i.tokenizer=s}if(n.hooks){let s=this.defaults.hooks||new Ad;for(let o in n.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let l=o,d=n.hooks[l],f=s[l];Ad.passThroughHooks.has(o)?s[l]=p=>{if(this.defaults.async&&Ad.passThroughHooksRespectAsync.has(o))return(async()=>{let y=await d.call(s,p);return f.call(s,y)})();let m=d.call(s,p);return f.call(s,m)}:s[l]=(...p)=>{if(this.defaults.async)return(async()=>{let y=await d.apply(s,p);return y===!1&&(y=await f.apply(s,p)),y})();let m=d.apply(s,p);return m===!1&&(m=f.apply(s,p)),m}}i.hooks=s}if(n.walkTokens){let s=this.defaults.walkTokens,o=n.walkTokens;i.walkTokens=function(l){let d=[];return d.push(o.call(this,l)),s&&(d=d.concat(s.call(this,l))),d}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ls.lex(e,t??this.defaults)}parser(e,t){return cs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let i={...n},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.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(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let l=s.hooks?await s.hooks.preprocess(t):t,d=await(s.hooks?await s.hooks.provideLexer():e?ls.lex:ls.lexInline)(l,s),f=s.hooks?await s.hooks.processAllTokens(d):d;s.walkTokens&&await Promise.all(this.walkTokens(f,s.walkTokens));let p=await(s.hooks?await s.hooks.provideParser():e?cs.parse:cs.parseInline)(f,s);return s.hooks?await s.hooks.postprocess(p):p})().catch(o);try{s.hooks&&(t=s.hooks.preprocess(t));let l=(s.hooks?s.hooks.provideLexer():e?ls.lex:ls.lexInline)(t,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let d=(s.hooks?s.hooks.provideParser():e?cs.parse:cs.parseInline)(l,s);return s.hooks&&(d=s.hooks.postprocess(d)),d}catch(l){return o(l)}}}onError(e,t){return n=>{if(n.message+=`
158
+ Please report this to https://github.com/markedjs/marked.`,e){let i="<p>An error occurred:</p><pre>"+As(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},wl=new PN;function pn(e,t){return wl.parse(e,t)}pn.options=pn.setOptions=function(e){return wl.setOptions(e),pn.defaults=wl.defaults,AN(pn.defaults),pn};pn.getDefaults=vS;pn.defaults=El;pn.use=function(...e){return wl.use(...e),pn.defaults=wl.defaults,AN(pn.defaults),pn};pn.walkTokens=function(e,t){return wl.walkTokens(e,t)};pn.parseInline=wl.parseInline;pn.Parser=cs;pn.parser=cs.parse;pn.Renderer=rm;pn.TextRenderer=AS;pn.Lexer=ls;pn.lexer=ls.lex;pn.Tokenizer=im;pn.Hooks=Ad;pn.parse=pn;pn.options;pn.setOptions;pn.use;pn.walkTokens;pn.parseInline;cs.parse;ls.lex;var nv,PA;function LK(){if(PA)return nv;PA=1;function e(Z){return Z instanceof Map?Z.clear=Z.delete=Z.set=function(){throw new Error("map is read-only")}:Z instanceof Set&&(Z.add=Z.clear=Z.delete=function(){throw new Error("set is read-only")}),Object.freeze(Z),Object.getOwnPropertyNames(Z).forEach(he=>{const ke=Z[he],Ge=typeof ke;(Ge==="object"||Ge==="function")&&!Object.isFrozen(ke)&&e(ke)}),Z}class t{constructor(he){he.data===void 0&&(he.data={}),this.data=he.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(Z,...he){const ke=Object.create(null);for(const Ge in Z)ke[Ge]=Z[Ge];return he.forEach(function(Ge){for(const St in Ge)ke[St]=Ge[St]}),ke}const s="</span>",o=Z=>!!Z.scope,l=(Z,{prefix:he})=>{if(Z.startsWith("language:"))return Z.replace("language:","language-");if(Z.includes(".")){const ke=Z.split(".");return[`${he}${ke.shift()}`,...ke.map((Ge,St)=>`${Ge}${"_".repeat(St+1)}`)].join(" ")}return`${he}${Z}`};class d{constructor(he,ke){this.buffer="",this.classPrefix=ke.classPrefix,he.walk(this)}addText(he){this.buffer+=n(he)}openNode(he){if(!o(he))return;const ke=l(he.scope,{prefix:this.classPrefix});this.span(ke)}closeNode(he){o(he)&&(this.buffer+=s)}value(){return this.buffer}span(he){this.buffer+=`<span class="${he}">`}}const f=(Z={})=>{const he={children:[]};return Object.assign(he,Z),he};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(he){this.top.children.push(he)}openNode(he){const ke=f({scope:he});this.add(ke),this.stack.push(ke)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(he){return this.constructor._walk(he,this.rootNode)}static _walk(he,ke){return typeof ke=="string"?he.addText(ke):ke.children&&(he.openNode(ke),ke.children.forEach(Ge=>this._walk(he,Ge)),he.closeNode(ke)),he}static _collapse(he){typeof he!="string"&&he.children&&(he.children.every(ke=>typeof ke=="string")?he.children=[he.children.join("")]:he.children.forEach(ke=>{p._collapse(ke)}))}}class m extends p{constructor(he){super(),this.options=he}addText(he){he!==""&&this.add(he)}startScope(he){this.openNode(he)}endScope(){this.closeNode()}__addSublanguage(he,ke){const Ge=he.root;ke&&(Ge.scope=`language:${ke}`),this.add(Ge)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function y(Z){return Z?typeof Z=="string"?Z:Z.source:null}function b(Z){return x("(?=",Z,")")}function w(Z){return x("(?:",Z,")*")}function S(Z){return x("(?:",Z,")?")}function x(...Z){return Z.map(ke=>y(ke)).join("")}function k(Z){const he=Z[Z.length-1];return typeof he=="object"&&he.constructor===Object?(Z.splice(Z.length-1,1),he):{}}function L(...Z){return"("+(k(Z).capture?"":"?:")+Z.map(Ge=>y(Ge)).join("|")+")"}function F(Z){return new RegExp(Z.toString()+"|").exec("").length-1}function q(Z,he){const ke=Z&&Z.exec(he);return ke&&ke.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function $(Z,{joinWith:he}){let ke=0;return Z.map(Ge=>{ke+=1;const St=ke;let Pt=y(Ge),Fe="";for(;Pt.length>0;){const Oe=T.exec(Pt);if(!Oe){Fe+=Pt;break}Fe+=Pt.substring(0,Oe.index),Pt=Pt.substring(Oe.index+Oe[0].length),Oe[0][0]==="\\"&&Oe[1]?Fe+="\\"+String(Number(Oe[1])+St):(Fe+=Oe[0],Oe[0]==="("&&ke++)}return Fe}).map(Ge=>`(${Ge})`).join(he)}const I=/\b\B/,N="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",K="\\b\\d+(\\.\\d+)?",Q="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Y="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",M=(Z={})=>{const he=/^#![ ]*\//;return Z.binary&&(Z.begin=x(he,/.*\b/,Z.binary,/\b.*/)),i({scope:"meta",begin:he,end:/$/,relevance:0,"on:begin":(ke,Ge)=>{ke.index!==0&&Ge.ignoreMatch()}},Z)},D={begin:"\\\\[\\s\\S]",relevance:0},j={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},A={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},O={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/},C=function(Z,he,ke={}){const Ge=i({scope:"comment",begin:Z,end:he,contains:[]},ke);Ge.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 St=L("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 Ge.contains.push({begin:x(/[ ]+/,"(",St,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ge},z=C("//","$"),P=C("/\\*","\\*/"),R=C("#","$"),W={scope:"number",begin:K,relevance:0},G={scope:"number",begin:Q,relevance:0},U={scope:"number",begin:Y,relevance:0},ee={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},ne={scope:"title",begin:N,relevance:0},me={scope:"title",begin:V,relevance:0},Me={begin:"\\.\\s*"+V,relevance:0};var Ye=Object.freeze({__proto__:null,APOS_STRING_MODE:j,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:U,BINARY_NUMBER_RE:Y,COMMENT:C,C_BLOCK_COMMENT_MODE:P,C_LINE_COMMENT_MODE:z,C_NUMBER_MODE:G,C_NUMBER_RE:Q,END_SAME_AS_BEGIN:function(Z){return Object.assign(Z,{"on:begin":(he,ke)=>{ke.data._beginMatch=he[1]},"on:end":(he,ke)=>{ke.data._beginMatch!==he[1]&&ke.ignoreMatch()}})},HASH_COMMENT_MODE:R,IDENT_RE:N,MATCH_NOTHING_RE:I,METHOD_GUARD:Me,NUMBER_MODE:W,NUMBER_RE:K,PHRASAL_WORDS_MODE:O,QUOTE_STRING_MODE:A,REGEXP_MODE:ee,RE_STARTERS_RE:B,SHEBANG:M,TITLE_MODE:ne,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:me});function qe(Z,he){Z.input[Z.index-1]==="."&&he.ignoreMatch()}function yt(Z,he){Z.className!==void 0&&(Z.scope=Z.className,delete Z.className)}function $e(Z,he){he&&Z.beginKeywords&&(Z.begin="\\b("+Z.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",Z.__beforeBegin=qe,Z.keywords=Z.keywords||Z.beginKeywords,delete Z.beginKeywords,Z.relevance===void 0&&(Z.relevance=0))}function We(Z,he){Array.isArray(Z.illegal)&&(Z.illegal=L(...Z.illegal))}function mt(Z,he){if(Z.match){if(Z.begin||Z.end)throw new Error("begin & end are not supported with match");Z.begin=Z.match,delete Z.match}}function ot(Z,he){Z.relevance===void 0&&(Z.relevance=1)}const Nt=(Z,he)=>{if(!Z.beforeMatch)return;if(Z.starts)throw new Error("beforeMatch cannot be used with starts");const ke=Object.assign({},Z);Object.keys(Z).forEach(Ge=>{delete Z[Ge]}),Z.keywords=ke.keywords,Z.begin=x(ke.beforeMatch,b(ke.begin)),Z.starts={relevance:0,contains:[Object.assign(ke,{endsParent:!0})]},Z.relevance=0,delete ke.beforeMatch},Ot=["of","and","for","in","not","or","if","then","parent","list","value"],kt="keyword";function ye(Z,he,ke=kt){const Ge=Object.create(null);return typeof Z=="string"?St(ke,Z.split(" ")):Array.isArray(Z)?St(ke,Z):Object.keys(Z).forEach(function(Pt){Object.assign(Ge,ye(Z[Pt],he,Pt))}),Ge;function St(Pt,Fe){he&&(Fe=Fe.map(Oe=>Oe.toLowerCase())),Fe.forEach(function(Oe){const Qe=Oe.split("|");Ge[Qe[0]]=[Pt,ze(Qe[0],Qe[1])]})}}function ze(Z,he){return he?Number(he):Je(Z)?0:1}function Je(Z){return Ot.includes(Z.toLowerCase())}const It={},Ke=Z=>{console.error(Z)},en=(Z,...he)=>{console.log(`WARN: ${Z}`,...he)},we=(Z,he)=>{It[`${Z}/${he}`]||(console.log(`Deprecated as of ${Z}. ${he}`),It[`${Z}/${he}`]=!0)},De=new Error;function de(Z,he,{key:ke}){let Ge=0;const St=Z[ke],Pt={},Fe={};for(let Oe=1;Oe<=he.length;Oe++)Fe[Oe+Ge]=St[Oe],Pt[Oe+Ge]=!0,Ge+=F(he[Oe-1]);Z[ke]=Fe,Z[ke]._emit=Pt,Z[ke]._multi=!0}function Pe(Z){if(Array.isArray(Z.begin)){if(Z.skip||Z.excludeBegin||Z.returnBegin)throw Ke("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),De;if(typeof Z.beginScope!="object"||Z.beginScope===null)throw Ke("beginScope must be object"),De;de(Z,Z.begin,{key:"beginScope"}),Z.begin=$(Z.begin,{joinWith:""})}}function st(Z){if(Array.isArray(Z.end)){if(Z.skip||Z.excludeEnd||Z.returnEnd)throw Ke("skip, excludeEnd, returnEnd not compatible with endScope: {}"),De;if(typeof Z.endScope!="object"||Z.endScope===null)throw Ke("endScope must be object"),De;de(Z,Z.end,{key:"endScope"}),Z.end=$(Z.end,{joinWith:""})}}function ft(Z){Z.scope&&typeof Z.scope=="object"&&Z.scope!==null&&(Z.beginScope=Z.scope,delete Z.scope)}function Dt(Z){ft(Z),typeof Z.beginScope=="string"&&(Z.beginScope={_wrap:Z.beginScope}),typeof Z.endScope=="string"&&(Z.endScope={_wrap:Z.endScope}),Pe(Z),st(Z)}function Gt(Z){function he(Fe,Oe){return new RegExp(y(Fe),"m"+(Z.case_insensitive?"i":"")+(Z.unicodeRegex?"u":"")+(Oe?"g":""))}class ke{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Oe,Qe){Qe.position=this.position++,this.matchIndexes[this.matchAt]=Qe,this.regexes.push([Qe,Oe]),this.matchAt+=F(Oe)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Oe=this.regexes.map(Qe=>Qe[1]);this.matcherRe=he($(Oe,{joinWith:"|"}),!0),this.lastIndex=0}exec(Oe){this.matcherRe.lastIndex=this.lastIndex;const Qe=this.matcherRe.exec(Oe);if(!Qe)return null;const _n=Qe.findIndex((Rn,$i)=>$i>0&&Rn!==void 0),gt=this.matchIndexes[_n];return Qe.splice(0,_n),Object.assign(Qe,gt)}}class Ge{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Oe){if(this.multiRegexes[Oe])return this.multiRegexes[Oe];const Qe=new ke;return this.rules.slice(Oe).forEach(([_n,gt])=>Qe.addRule(_n,gt)),Qe.compile(),this.multiRegexes[Oe]=Qe,Qe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Oe,Qe){this.rules.push([Oe,Qe]),Qe.type==="begin"&&this.count++}exec(Oe){const Qe=this.getMatcher(this.regexIndex);Qe.lastIndex=this.lastIndex;let _n=Qe.exec(Oe);if(this.resumingScanAtSamePosition()&&!(_n&&_n.index===this.lastIndex)){const gt=this.getMatcher(0);gt.lastIndex=this.lastIndex+1,_n=gt.exec(Oe)}return _n&&(this.regexIndex+=_n.position+1,this.regexIndex===this.count&&this.considerAll()),_n}}function St(Fe){const Oe=new Ge;return Fe.contains.forEach(Qe=>Oe.addRule(Qe.begin,{rule:Qe,type:"begin"})),Fe.terminatorEnd&&Oe.addRule(Fe.terminatorEnd,{type:"end"}),Fe.illegal&&Oe.addRule(Fe.illegal,{type:"illegal"}),Oe}function Pt(Fe,Oe){const Qe=Fe;if(Fe.isCompiled)return Qe;[yt,mt,Dt,Nt].forEach(gt=>gt(Fe,Oe)),Z.compilerExtensions.forEach(gt=>gt(Fe,Oe)),Fe.__beforeBegin=null,[$e,We,ot].forEach(gt=>gt(Fe,Oe)),Fe.isCompiled=!0;let _n=null;return typeof Fe.keywords=="object"&&Fe.keywords.$pattern&&(Fe.keywords=Object.assign({},Fe.keywords),_n=Fe.keywords.$pattern,delete Fe.keywords.$pattern),_n=_n||/\w+/,Fe.keywords&&(Fe.keywords=ye(Fe.keywords,Z.case_insensitive)),Qe.keywordPatternRe=he(_n,!0),Oe&&(Fe.begin||(Fe.begin=/\B|\b/),Qe.beginRe=he(Qe.begin),!Fe.end&&!Fe.endsWithParent&&(Fe.end=/\B|\b/),Fe.end&&(Qe.endRe=he(Qe.end)),Qe.terminatorEnd=y(Qe.end)||"",Fe.endsWithParent&&Oe.terminatorEnd&&(Qe.terminatorEnd+=(Fe.end?"|":"")+Oe.terminatorEnd)),Fe.illegal&&(Qe.illegalRe=he(Fe.illegal)),Fe.contains||(Fe.contains=[]),Fe.contains=[].concat(...Fe.contains.map(function(gt){return Tt(gt==="self"?Fe:gt)})),Fe.contains.forEach(function(gt){Pt(gt,Qe)}),Fe.starts&&Pt(Fe.starts,Oe),Qe.matcher=St(Qe),Qe}if(Z.compilerExtensions||(Z.compilerExtensions=[]),Z.contains&&Z.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return Z.classNameAliases=i(Z.classNameAliases||{}),Pt(Z)}function _t(Z){return Z?Z.endsWithParent||_t(Z.starts):!1}function Tt(Z){return Z.variants&&!Z.cachedVariants&&(Z.cachedVariants=Z.variants.map(function(he){return i(Z,{variants:null},he)})),Z.cachedVariants?Z.cachedVariants:_t(Z)?i(Z,{starts:Z.starts?i(Z.starts):null}):Object.isFrozen(Z)?i(Z):Z}var Ne="11.11.1";class jt extends Error{constructor(he,ke){super(he),this.name="HTMLInjectionError",this.html=ke}}const se=n,oe=i,ge=Symbol("nomatch"),Ee=7,je=function(Z){const he=Object.create(null),ke=Object.create(null),Ge=[];let St=!0;const Pt="Could not find the language '{}', did you forget to load/include a language module?",Fe={disableAutodetect:!0,name:"Plain text",contains:[]};let Oe={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:m};function Qe(fe){return Oe.noHighlightRe.test(fe)}function _n(fe){let Te=fe.className+" ";Te+=fe.parentNode?fe.parentNode.className:"";const Ae=Oe.languageDetectRe.exec(Te);if(Ae){const dt=X(Ae[1]);return dt||(en(Pt.replace("{}",Ae[1])),en("Falling back to no-highlight mode for this block.",fe)),dt?Ae[1]:"no-highlight"}return Te.split(/\s+/).find(dt=>Qe(dt)||X(dt))}function gt(fe,Te,Ae){let dt="",xt="";typeof Te=="object"?(dt=fe,Ae=Te.ignoreIllegals,xt=Te.language):(we("10.7.0","highlight(lang, code, ...args) has been deprecated."),we("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),xt=fe,dt=Te),Ae===void 0&&(Ae=!0);const rn={code:dt,language:xt};ie("before:highlight",rn);const Yn=rn.result?rn.result:Rn(rn.language,rn.code,Ae);return Yn.code=rn.code,ie("after:highlight",Yn),Yn}function Rn(fe,Te,Ae,dt){const xt=Object.create(null);function rn(Le,Xe){return Le.keywords[Xe]}function Yn(){if(!lt.keywords){On.addText(tn);return}let Le=0;lt.keywordPatternRe.lastIndex=0;let Xe=lt.keywordPatternRe.exec(tn),bt="";for(;Xe;){bt+=tn.substring(Le,Xe.index);const Ht=Wn.case_insensitive?Xe[0].toLowerCase():Xe[0],Mn=rn(lt,Ht);if(Mn){const[Nr,tu]=Mn;if(On.addText(bt),bt="",xt[Ht]=(xt[Ht]||0)+1,xt[Ht]<=Ee&&(_s+=tu),Nr.startsWith("_"))bt+=Xe[0];else{const ph=Wn.classNameAliases[Nr]||Nr;nt(Xe[0],ph)}}else bt+=Xe[0];Le=lt.keywordPatternRe.lastIndex,Xe=lt.keywordPatternRe.exec(tn)}bt+=tn.substring(Le),On.addText(bt)}function Fn(){if(tn==="")return;let Le=null;if(typeof lt.subLanguage=="string"){if(!he[lt.subLanguage]){On.addText(tn);return}Le=Rn(lt.subLanguage,tn,!0,Tl[lt.subLanguage]),Tl[lt.subLanguage]=Le._top}else Le=Lr(tn,lt.subLanguage.length?lt.subLanguage:null);lt.relevance>0&&(_s+=Le.relevance),On.__addSublanguage(Le._emitter,Le.language)}function Vt(){lt.subLanguage!=null?Fn():Yn(),tn=""}function nt(Le,Xe){Le!==""&&(On.startScope(Xe),On.addText(Le),On.endScope())}function sn(Le,Xe){let bt=1;const Ht=Xe.length-1;for(;bt<=Ht;){if(!Le._emit[bt]){bt++;continue}const Mn=Wn.classNameAliases[Le[bt]]||Le[bt],Nr=Xe[bt];Mn?nt(Nr,Mn):(tn=Nr,Yn(),tn=""),bt++}}function Xn(Le,Xe){return Le.scope&&typeof Le.scope=="string"&&On.openNode(Wn.classNameAliases[Le.scope]||Le.scope),Le.beginScope&&(Le.beginScope._wrap?(nt(tn,Wn.classNameAliases[Le.beginScope._wrap]||Le.beginScope._wrap),tn=""):Le.beginScope._multi&&(sn(Le.beginScope,Xe),tn="")),lt=Object.create(Le,{parent:{value:lt}}),lt}function Di(Le,Xe,bt){let Ht=q(Le.endRe,bt);if(Ht){if(Le["on:end"]){const Mn=new t(Le);Le["on:end"](Xe,Mn),Mn.isMatchIgnored&&(Ht=!1)}if(Ht){for(;Le.endsParent&&Le.parent;)Le=Le.parent;return Le}}if(Le.endsWithParent)return Di(Le.parent,Xe,bt)}function Zn(Le){return lt.matcher.regexIndex===0?(tn+=Le[0],1):(Aa=!0,0)}function ys(Le){const Xe=Le[0],bt=Le.rule,Ht=new t(bt),Mn=[bt.__beforeBegin,bt["on:begin"]];for(const Nr of Mn)if(Nr&&(Nr(Le,Ht),Ht.isMatchIgnored))return Zn(Xe);return bt.skip?tn+=Xe:(bt.excludeBegin&&(tn+=Xe),Vt(),!bt.returnBegin&&!bt.excludeBegin&&(tn=Xe)),Xn(bt,Le),bt.returnBegin?0:Xe.length}function Hn(Le){const Xe=Le[0],bt=Te.substring(Le.index),Ht=Di(lt,Le,bt);if(!Ht)return ge;const Mn=lt;lt.endScope&&lt.endScope._wrap?(Vt(),nt(Xe,lt.endScope._wrap)):lt.endScope&&lt.endScope._multi?(Vt(),sn(lt.endScope,Le)):Mn.skip?tn+=Xe:(Mn.returnEnd||Mn.excludeEnd||(tn+=Xe),Vt(),Mn.excludeEnd&&(tn=Xe));do lt.scope&&On.closeNode(),!lt.skip&&!lt.subLanguage&&(_s+=lt.relevance),lt=lt.parent;while(lt!==Ht.parent);return Ht.starts&&Xn(Ht.starts,Le),Mn.returnEnd?0:Xe.length}function Ws(){const Le=[];for(let Xe=lt;Xe!==Wn;Xe=Xe.parent)Xe.scope&&Le.unshift(Xe.scope);Le.forEach(Xe=>On.openNode(Xe))}let rs={};function Un(Le,Xe){const bt=Xe&&Xe[0];if(tn+=Le,bt==null)return Vt(),0;if(rs.type==="begin"&&Xe.type==="end"&&rs.index===Xe.index&&bt===""){if(tn+=Te.slice(Xe.index,Xe.index+1),!St){const Ht=new Error(`0 width match regex (${fe})`);throw Ht.languageName=fe,Ht.badRule=rs.rule,Ht}return 1}if(rs=Xe,Xe.type==="begin")return ys(Xe);if(Xe.type==="illegal"&&!Ae){const Ht=new Error('Illegal lexeme "'+bt+'" for mode "'+(lt.scope||"<unnamed>")+'"');throw Ht.mode=lt,Ht}else if(Xe.type==="end"){const Ht=Hn(Xe);if(Ht!==ge)return Ht}if(Xe.type==="illegal"&&bt==="")return tn+=`
160
+ `,1;if(eu>1e5&&eu>Xe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return tn+=bt,bt.length}const Wn=X(fe);if(!Wn)throw Ke(Pt.replace("{}",fe)),new Error('Unknown language: "'+fe+'"');const Al=Gt(Wn);let qs="",lt=dt||Al;const Tl={},On=new Oe.__emitter(Oe);Ws();let tn="",_s=0,Gs=0,eu=0,Aa=!1;try{if(Wn.__emitTokens)Wn.__emitTokens(Te,On);else{for(lt.matcher.considerAll();;){eu++,Aa?Aa=!1:lt.matcher.considerAll(),lt.matcher.lastIndex=Gs;const Le=lt.matcher.exec(Te);if(!Le)break;const Xe=Te.substring(Gs,Le.index),bt=Un(Xe,Le);Gs=Le.index+bt}Un(Te.substring(Gs))}return On.finalize(),qs=On.toHTML(),{language:fe,value:qs,relevance:_s,illegal:!1,_emitter:On,_top:lt}}catch(Le){if(Le.message&&Le.message.includes("Illegal"))return{language:fe,value:se(Te),illegal:!0,relevance:0,_illegalBy:{message:Le.message,index:Gs,context:Te.slice(Gs-100,Gs+100),mode:Le.mode,resultSoFar:qs},_emitter:On};if(St)return{language:fe,value:se(Te),illegal:!1,relevance:0,errorRaised:Le,_emitter:On,_top:lt};throw Le}}function $i(fe){const Te={value:se(fe),illegal:!1,relevance:0,_top:Fe,_emitter:new Oe.__emitter(Oe)};return Te._emitter.addText(fe),Te}function Lr(fe,Te){Te=Te||Oe.languages||Object.keys(he);const Ae=$i(fe),dt=Te.filter(X).filter(Be).map(Vt=>Rn(Vt,fe,!1));dt.unshift(Ae);const xt=dt.sort((Vt,nt)=>{if(Vt.relevance!==nt.relevance)return nt.relevance-Vt.relevance;if(Vt.language&&nt.language){if(X(Vt.language).supersetOf===nt.language)return 1;if(X(nt.language).supersetOf===Vt.language)return-1}return 0}),[rn,Yn]=xt,Fn=rn;return Fn.secondBest=Yn,Fn}function Ii(fe,Te,Ae){const dt=Te&&ke[Te]||Ae;fe.classList.add("hljs"),fe.classList.add(`language-${dt}`)}function Ft(fe){let Te=null;const Ae=_n(fe);if(Qe(Ae))return;if(ie("before:highlightElement",{el:fe,language:Ae}),fe.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",fe);return}if(fe.children.length>0&&(Oe.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(fe)),Oe.throwUnescapedHTML))throw new jt("One of your code blocks includes unescaped HTML.",fe.innerHTML);Te=fe;const dt=Te.textContent,xt=Ae?gt(dt,{language:Ae,ignoreIllegals:!0}):Lr(dt);fe.innerHTML=xt.value,fe.dataset.highlighted="yes",Ii(fe,Ae,xt.language),fe.result={language:xt.language,re:xt.relevance,relevance:xt.relevance},xt.secondBest&&(fe.secondBest={language:xt.secondBest.language,relevance:xt.secondBest.relevance}),ie("after:highlightElement",{el:fe,result:xt,text:dt})}function Kt(fe){Oe=oe(Oe,fe)}const Qi=()=>{is(),we("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function gs(){is(),we("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Hs=!1;function is(){function fe(){is()}if(document.readyState==="loading"){Hs||window.addEventListener("DOMContentLoaded",fe,!1),Hs=!0;return}document.querySelectorAll(Oe.cssSelector).forEach(Ft)}function Us(fe,Te){let Ae=null;try{Ae=Te(Z)}catch(dt){if(Ke("Language definition for '{}' could not be registered.".replace("{}",fe)),St)Ke(dt);else throw dt;Ae=Fe}Ae.name||(Ae.name=fe),he[fe]=Ae,Ae.rawDefinition=Te.bind(null,Z),Ae.aliases&&Se(Ae.aliases,{languageName:fe})}function pr(fe){delete he[fe];for(const Te of Object.keys(ke))ke[Te]===fe&&delete ke[Te]}function et(){return Object.keys(he)}function X(fe){return fe=(fe||"").toLowerCase(),he[fe]||he[ke[fe]]}function Se(fe,{languageName:Te}){typeof fe=="string"&&(fe=[fe]),fe.forEach(Ae=>{ke[Ae.toLowerCase()]=Te})}function Be(fe){const Te=X(fe);return Te&&!Te.disableAutodetect}function Bt(fe){fe["before:highlightBlock"]&&!fe["before:highlightElement"]&&(fe["before:highlightElement"]=Te=>{fe["before:highlightBlock"](Object.assign({block:Te.el},Te))}),fe["after:highlightBlock"]&&!fe["after:highlightElement"]&&(fe["after:highlightElement"]=Te=>{fe["after:highlightBlock"](Object.assign({block:Te.el},Te))})}function Rt(fe){Bt(fe),Ge.push(fe)}function ln(fe){const Te=Ge.indexOf(fe);Te!==-1&&Ge.splice(Te,1)}function ie(fe,Te){const Ae=fe;Ge.forEach(function(dt){dt[Ae]&&dt[Ae](Te)})}function Ie(fe){return we("10.7.0","highlightBlock will be removed entirely in v12.0"),we("10.7.0","Please use highlightElement now."),Ft(fe)}Object.assign(Z,{highlight:gt,highlightAuto:Lr,highlightAll:is,highlightElement:Ft,highlightBlock:Ie,configure:Kt,initHighlighting:Qi,initHighlightingOnLoad:gs,registerLanguage:Us,unregisterLanguage:pr,listLanguages:et,getLanguage:X,registerAliases:Se,autoDetection:Be,inherit:oe,addPlugin:Rt,removePlugin:ln}),Z.debugMode=function(){St=!1},Z.safeMode=function(){St=!0},Z.versionString=Ne,Z.regex={concat:x,lookahead:b,either:L,optional:S,anyNumberOfTimes:w};for(const fe in Ye)typeof Ye[fe]=="object"&&e(Ye[fe]);return Object.assign(Z,Ye),Z},at=je({});return at.newInstance=()=>je({}),nv=at,at.HighlightJS=at,at.default=at,nv}var NK=LK();const Hr=cw(NK);function zA(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 s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},o=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),l={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,s]};s.contains.push(d);const f={match:/\\"/},p={className:"string",begin:/'/,end:/'/},m={match:/\\'/},y={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},b=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=e.SHEBANG({binary:`(${b.join("|")})`,relevance:10}),S={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"],L={match:/(\/[a-z._-]+)+/},F=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],q=["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"],$=["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:[...F,...q,"set","shopt",...T,...$]},contains:[w,e.SHEBANG(),S,y,o,l,L,d,f,p,m,n]}}const $A="[A-Za-z$_][0-9A-Za-z$_]*",OK=["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"],IK=["true","false","null","undefined","NaN","Infinity"],zN=["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"],$N=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],FN=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],DK=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],jK=[].concat(FN,zN,$N);function FA(e){const t=e.regex,n=(C,{after:z})=>{const P="</"+C[0].slice(1);return C.input.indexOf(P,z)!==-1},i=$A,s={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,z)=>{const P=C[0].length+C.index,R=C.input[P];if(R==="<"||R===","){z.ignoreMatch();return}R===">"&&(n(C,{after:P})||z.ignoreMatch());let W;const G=C.input.substring(P);if(W=G.match(/^\s*=/)){z.ignoreMatch();return}if((W=G.match(/^\s+extends\s+/))&&W.index===0){z.ignoreMatch();return}}},d={$pattern:$A,keyword:OK,literal:IK,built_in:jK,"variable.language":DK},f="[0-9](_?[0-9])*",p=`\\.(${f})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={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:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},S={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]},F={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]},q=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,{match:/\$\d+/},y];b.contains=q.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(q)});const T=[].concat(F,b.contains),$=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},N={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"}}]},V={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:{_:[...zN,...$N]}},K={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:[I],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(C){return t.concat("(?!",C.join("|"),")")}const M={match:t.concat(/\b/,B([...FN,"super","import"].map(C=>`${C}\\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},j={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:V},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,F,{match:/\$\d+/},y,V,{scope:"attr",match:i+t.lookahead(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.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:[I,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:[I]},M,Y,N,j,{match:/\$[(.]/}]}}function BK(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},i=["true","false","null"],s={scope:"literal",beginKeywords:i.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:i},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function HA(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},s={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},l={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}]},y=e.inherit(p,{contains:[]}),b=e.inherit(m,{contains:[]});p.contains.push(b),m.contains.push(y);let w=[n,f];return[p,m,y,b].forEach(L=>{L.contains=L.contains.concat(w)}),w=w.concat(p,m),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:w},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:w}]}]},n,o,p,m,{className:"quote",begin:"^>\\s+",contains:w,end:"$"},s,i,f,l,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function UA(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},y={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])*",w=`(\\b(${b}))?\\.(${b})|\\b(${b})\\.`,S=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${b})|(${w}))[eE][+-]?(${b})[jJ]?(?=${S})`},{begin:`(${w})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${S})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${S})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${S})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${S})`},{begin:`\\b(${b})[jJ](?=${S})`}]},k={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},L={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:["self",f,x,y,e.HASH_COMMENT_MODE]}]};return p.contains=[y,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"},y,k,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[L]},{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,L,y]}]}}const sm="[A-Za-z$_][0-9A-Za-z$_]*",HN=["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"],UN=["true","false","null","undefined","NaN","Infinity"],WN=["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"],qN=["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"],KN=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],VN=[].concat(GN,WN,qN);function PK(e){const t=e.regex,n=(C,{after:z})=>{const P="</"+C[0].slice(1);return C.input.indexOf(P,z)!==-1},i=sm,s={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(C,z)=>{const P=C[0].length+C.index,R=C.input[P];if(R==="<"||R===","){z.ignoreMatch();return}R===">"&&(n(C,{after:P})||z.ignoreMatch());let W;const G=C.input.substring(P);if(W=G.match(/^\s*=/)){z.ignoreMatch();return}if((W=G.match(/^\s+extends\s+/))&&W.index===0){z.ignoreMatch();return}}},d={$pattern:sm,keyword:HN,literal:UN,built_in:VN,"variable.language":KN},f="[0-9](_?[0-9])*",p=`\\.(${f})`,m="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",y={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:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,b],subLanguage:"xml"}},S={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]},F={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]},q=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,{match:/\$\d+/},y];b.contains=q.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(q)});const T=[].concat(F,b.contains),$=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),I={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},N={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"}}]},V={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:{_:[...WN,...qN]}},K={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:[I],illegal:/%/},Y={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function B(C){return t.concat("(?!",C.join("|"),")")}const M={match:t.concat(/\b/,B([...GN,"super","import"].map(C=>`${C}\\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},j={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},I]},A="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",O={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(A)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[I]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:d,exports:{PARAMS_CONTAINS:$,CLASS_REFERENCE:V},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),K,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,F,{match:/\$\d+/},y,V,{scope:"attr",match:i+t.lookahead(":"),relevance:0},O,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[F,e.REGEXP_MODE,{className:"function",begin:A,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:o},{begin:l.begin,"on:begin":l.isTrulyOpeningTag,end:l.end}],subLanguage:"xml",contains:[{begin:l.begin,end:l.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:[I,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:[I]},M,Y,N,j,{match:/\$[(.]/}]}}function WA(e){const t=e.regex,n=PK(e),i=sm,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],o={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},l={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},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:sm,keyword:HN.concat(f),literal:UN,built_in:VN.concat(s),"variable.language":KN},m={className:"meta",begin:"@"+i},y=(x,k,L)=>{const F=x.contains.findIndex(q=>q.label===k);if(F===-1)throw new Error("can not find mode to replace");x.contains.splice(F,1,L)};Object.assign(n.keywords,p),n.exports.PARAMS_CONTAINS.push(m);const b=n.contains.find(x=>x.scope==="attr"),w=Object.assign({},b,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,b,w]),n.contains=n.contains.concat([m,o,l,w]),y(n,"shebang",e.SHEBANG()),y(n,"use_strict",d);const S=n.contains.find(x=>x.label==="func.def");return S.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}const zK=/\[\[wiki:([^\]]+)\]\]/g,$K=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,FK=/^(\S[^:]*?):[ \t]*(.*)$/,HK=new PN({gfm:!0,breaks:!1}),qA={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},iv=nV();function es(e,t={}){const{entries:n,content:i}=qK(e),s=VK(i,t.resolveWikiLink),o=HK.parse(s,{async:!1}),l=KK(n),d=jd.sanitize(l+o,qA),f=new DOMParser().parseFromString(d,"text/html");return XK(f,t.omitDuplicateTitle),YK(f),ZK(f,{copyLabel:t.copyLabel??"Copy",copyAriaLabel:t.copyAriaLabel??(m=>`Copy ${m} code`)}),QK(f),{html:jd.sanitize(f.body.innerHTML,qA),toc:eV(f)}}function UK(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function WK(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 qK(e){const t=$K.exec(e);return t?{entries:GK(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function GK(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const s=FK.exec(i);if(s){const[,d="",f=""]=s;t.push({key:d.trim(),value:f.trim()});continue}const o=t[t.length-1];if(!o)continue;const l=i.trim();o.value=o.value?`${o.value} ${l}`:l}return t}function KK(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${Pd(n.key)}</dt><dd>${Pd(n.value)}</dd>`).join("")}</dl>`}function VK(e,t){return e.replace(zK,(n,i)=>{const s=i.trim();if(!s)return"";if(!t)return Pd(`[[wiki:${s}]]`);const o=t(s);if(o===null)return Pd(`[[wiki:${s}]]`);const l=Pd(s),d=encodeURIComponent(s);return`<a href="${o}" data-entry-id="${d}">${l}</a>`})}function YK(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",s=sV(i||"section"),o=t.get(s)??0;t.set(s,o+1),n.id=o===0?s:`${s}-${o+1}`}}function XK(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||GA(n.textContent??"")===GA(t)&&n.remove()}function ZK(e,t){for(const n of e.querySelectorAll("pre > code")){const i=iV(n.className),s=n.textContent??"",o=n.parentElement;if(!o)continue;if(i==="mermaid"){const d=e.createElement("div");d.className="diagram-block",d.setAttribute("data-mermaid-source",UK(s)),d.setAttribute("data-diagram-state","pending"),o.replaceWith(d);continue}const l=tV(s,i);n.innerHTML=l,n.classList.add("hljs"),o.classList.add("code-block"),o.dataset.code=s,o.insertBefore(JK(e,i||"text",t),o.firstChild)}}function JK(e,t,n){const i=e.createElement("div");i.className="code-block-toolbar";const s=e.createElement("span");s.className="code-block-dots",s.setAttribute("aria-hidden","true");for(let d=0;d<3;d++)s.append(e.createElement("span"));const o=e.createElement("span");o.className="code-block-language",o.textContent=t;const l=e.createElement("button");return l.className="copy-code",l.type="button",l.dataset.action="copy-code",l.setAttribute("aria-label",n.copyAriaLabel(t)),l.textContent=n.copyLabel,i.append(s,o,l),i}function QK(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";rV(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function eV(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 tV(e,t){return t&&iv.getLanguage(t)?iv.highlight(e,{language:t}).value:iv.highlightAuto(e).value}function nV(){return Hr.registerLanguage("bash",zA),Hr.registerLanguage("sh",zA),Hr.registerLanguage("javascript",FA),Hr.registerLanguage("js",FA),Hr.registerLanguage("json",BK),Hr.registerLanguage("markdown",HA),Hr.registerLanguage("md",HA),Hr.registerLanguage("python",UA),Hr.registerLanguage("py",UA),Hr.registerLanguage("typescript",WA),Hr.registerLanguage("ts",WA),Hr}function iV(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function rV(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function sV(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function GA(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function Pd(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const YN={renderFailed:e=>`Diagram render failed: ${e}`,openExpandedAria:"Open diagram in expanded view",lightboxTitle:"MANIFEST · DIAGRAM",close:"Close",closeExpandedAria:"Close expanded diagram",zoomControlsAria:"Diagram zoom controls",zoomOutAria:"Zoom out",zoomInAria:"Zoom in",fit:"Fit",fitAria:"Fit diagram to viewport",reset:"Reset",resetAria:"Reset diagram zoom"};let Cr=YN;const aV=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",oV=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),lV=/^on/i,cV={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},KA="diagramInteractionBound",uV=/^oklch\s*\(\s*([^)]+)\s*\)$/i,dV=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Kr=[25,50,75,100,125,150,200],hV=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let rv=null;const VA=new WeakSet;let fV=0,pV=0,Zd=null;function co(e){const t=e.trim();if(!t)return t;const n=jV(t);return n?BV(n):t}function Jd(e,t){if(t&&(Cr={...YN,...t}),VA.has(e))return;VA.add(e),YA(e);const n=e instanceof Node?e:document.body;new MutationObserver(s=>{let o=!1;for(const l of s)if(l.type==="childList"){Zd&&!Zd.trigger.isConnected&&Td(!1);for(const d of l.addedNodes)if(d instanceof Element&&(d.matches?.(".diagram-block[data-mermaid-source]")||d.querySelector?.(".diagram-block[data-mermaid-source]"))){o=!0;break}if(o)break}o&&YA(e)}).observe(n,{childList:!0,subtree:!0})}function YA(e){const t=e.querySelectorAll(aV);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",mV(n))}async function mV(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=WK(t)}catch{sv(e,"Invalid diagram source");return}if(!n.trim()){sv(e,"Empty diagram source");return}try{const i=await yV(),s=`mermaid-diagram-${++fV}`,{svg:o}=await i.render(s,n);e.innerHTML=gV(o),bV(e,o),wV(e),SV(e),e.dataset.diagramState="rendered"}catch(i){const s=i instanceof Error?i.message:String(i);sv(e,s)}}function sv(e,t){e.dataset.diagramState="error",e.textContent=Cr.renderFailed(t)}function gV(e){const t=(n,i)=>{lV.test(i.attrName)&&(i.keepAttr=!1)};jd.addHook("uponSanitizeAttribute",t);try{return jd.sanitize(e,cV)}finally{jd.removeHook("uponSanitizeAttribute",t)}}async function yV(){return rv||(rv=(async()=>{const e=await CG(()=>import("./mermaid.core-DDcMYg9W.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:_V(),themeCSS:vV(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),rv}function _V(){const e=getComputedStyle(document.documentElement),t=(x,k)=>{const L=e.getPropertyValue(x).trim();return co(L||k)},n=(x,k)=>e.getPropertyValue(x).trim()||k,i=t("--brass","#c69a4a"),s=t("--brass-bright","#e6b86a"),o=t("--brass-deep","#a0782a"),l=t("--aurora","#8bd7e6"),d=t("--aurora-deep","#1f8aa8"),f=t("--coral","#ef7c63"),p=t("--ink-deep","#1d2734"),m=t("--ink-fog","#a6afbb"),y=t("--ink-pearl","#e6e9ef"),b=t("--ink-spectral","#bcc4d0"),w=[s,i,l,f,co("oklch(70% 0.11 68)"),d,co("oklch(76% 0.09 205)"),o,co("oklch(68% 0.14 30)"),m,co("oklch(62% 0.08 228)"),co("oklch(52% 0.05 248)")],S=Object.fromEntries(hV.map((x,k)=>[x,w[k]??p]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:y,primaryBorderColor:i,secondaryColor:"transparent",secondaryTextColor:y,secondaryBorderColor:s,tertiaryColor:"transparent",tertiaryTextColor:b,tertiaryBorderColor:i,lineColor:d,edgeLabelBackground:"transparent",titleColor:s,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:i,clusterBkg:"transparent",clusterBorder:i,pieTitleTextColor:s,pieTitleTextSize:n("--font-size-title-lg","19px"),pieSectionTextColor:y,pieSectionTextSize:n("--font-size-md","13px"),pieLegendTextColor:y,pieLegendTextSize:n("--font-size-lg","14px"),pieStrokeColor:o,pieStrokeWidth:"1.35px",pieOuterStrokeColor:s,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...S}}function vV(){const e=getComputedStyle(document.documentElement),t=(p,m)=>{const y=e.getPropertyValue(p).trim();return co(y||m)},n=t("--brass-deep","#a0782a"),i=t("--brass-bright","#e6b86a"),s=t("--aurora-deep","#1f8aa8"),o=t("--ink-abyss","#131920"),l=co("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: ${s};
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 ${l});
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 bV(e,t){const n=new DOMParser().parseFromString(t,"image/svg+xml"),i=Array.from(n.querySelectorAll("a")),s=Array.from(e.querySelectorAll("a")),o=Math.min(i.length,s.length);for(let l=0;l<o;l++){const d=i[l],f=s[l];if(!d||!f)continue;const p=d.getAttribute("href")??d.getAttribute("xlink:href")??"",m=ZN(p);m&&f.setAttribute("href",m)}}function wV(e){const t=e.querySelector("svg");if(!t)return;let n;try{n=t.getBBox()}catch{return}const{x:i,y:s,width:o,height:l}=n;!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(l)||i<0||s<0||o<=0||l<=0||t.setAttribute("viewBox",`${Ac(i)} ${Ac(s)} ${Ac(o)} ${Ac(l)}`)}function SV(e){e.tabIndex=0,e.setAttribute("aria-label",Cr.openExpandedAria),OV(e),e.dataset[KA]!=="true"&&(e.dataset[KA]="true",e.addEventListener("click",xV),e.addEventListener("keydown",CV))}function xV(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||am(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),XN(t))}function CV(e){if(e.key!=="Enter"&&e.key!==" "||am(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),XN(t))}function XN(e){const t=e.querySelector("svg");if(!t)return;Td(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),s=++pV,o=`diagram-lightbox-title-${s}`;i.className="diagram-lightbox",i.setAttribute("aria-labelledby",o),n||(i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.tabIndex=-1);const l=document.createElement("div");l.className="diagram-lightbox__frame";const d=document.createElement("div");d.className="diagram-lightbox__header";const f=document.createElement("h2");f.id=o,f.textContent=Cr.lightboxTitle;const p=document.createElement("button");p.className="diagram-lightbox__close",p.type="button",p.setAttribute("aria-label",Cr.closeExpandedAria),p.textContent=Cr.close;const m=document.createElement("div");m.className="diagram-lightbox__controls",m.setAttribute("aria-label",Cr.zoomControlsAria);const y=qf("−",Cr.zoomOutAria,"out"),b=document.createElement("span");b.className="diagram-lightbox__zoom-readout",b.setAttribute("aria-live","polite");const w=qf("+",Cr.zoomInAria,"in"),S=qf(Cr.fit,Cr.fitAria,"fit"),x=qf(Cr.reset,Cr.resetAria,"reset");m.append(y,b,w,S,x);const k=document.createElement("div");k.className="diagram-lightbox__viewport";const L=AV(t),F=t.cloneNode(!0);F.removeAttribute("style"),RV(F,`diagram-lightbox-svg-${s}`),k.append(F),d.append(f,m,p),l.append(d,k),i.append(l),document.body.append(i);const q=new kV(k,F,b,L);y.addEventListener("click",()=>q.zoomOut()),w.addEventListener("click",()=>q.zoomIn()),S.addEventListener("click",()=>q.fit()),x.addEventListener("click",()=>q.reset());const T=MV(i),$=V=>{(V.target===i||V.target===p)&&Td(!0)},I=V=>{if(V.key==="Escape"){V.preventDefault(),Td(!0);return}q.handleKeyboard(V)||V.key==="Tab"&&NV(V,i)},N={dialog:i,trigger:e,inertStates:T,onClick:$,onKeyDown:I,cleanupPanZoom:()=>q.destroy()};n&&(N.onCancel=V=>{V.preventDefault(),Td(!0)},i.addEventListener("cancel",N.onCancel),i.showModal()),i.addEventListener("click",$),document.addEventListener("keydown",I,!0),Zd=N,q.fit(),p.focus()}function qf(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 kV{constructor(t,n,i,s){this.viewport=t,this.svg=n,this.readout=i,this.baseSize=s,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=Kr.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,Kr.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Kr.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),s=Math.floor(i*100),o=Kr.findIndex(d=>d>s),l=o===-1?Kr.length-1:Math.max(0,o-1);this.applyZoom(l),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*(Gf(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(Gf(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=Gf(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Ac(this.baseSize.width*i)),this.svg.setAttribute("height",Ac(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 s=this.svgWidth,o=this.svgHeight,l=this.viewport.getBoundingClientRect(),d=this.viewport.scrollLeft+n-l.left,f=this.viewport.scrollTop+i-l.top;this.applyZoom(t),this.viewport.scrollLeft=d/s*this.svgWidth-(n-l.left),this.viewport.scrollTop=f/o*this.svgHeight-(i-l.top)}onPointerDown=t=>{if(t.button!==0||am(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,s=Gf(this.pinchStart.zoomIndex)*i;this.applyZoom(TV(s));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,Kr.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{am(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Kr.indexOf(200)?Kr.indexOf(100):Kr.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 EV(e){const t=XA(e.getAttribute("width")),n=XA(e.getAttribute("height"));if(t&&n)return{width:t,height:n};const i=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],s=i[2],o=i[3],l=s!==void 0&&Number.isFinite(s)&&s>0?s:null,d=o!==void 0&&Number.isFinite(o)&&o>0?o:null;return{width:t??l??800,height:n??d??600}}function AV(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:EV(e)}function XA(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 Ac(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function TV(e){let t=0,n=Number.POSITIVE_INFINITY;return Kr.forEach((i,s)=>{const o=Math.abs(i-e);o<n&&(n=o,t=s)}),t}function Gf(e){return Kr[e]??Kr[0]}function RV(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 Td(e){const t=Zd;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),LV(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),Zd=null,e&&t.trigger.isConnected&&t.trigger.focus())}function MV(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 LV(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 NV(e,t){const n=Array.from(t.querySelectorAll(oV)).filter(DV);if(n.length===0){e.preventDefault(),t.focus();return}const i=n[0],s=n[n.length-1];!i||!s||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),s.focus()):!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),i.focus()))}function OV(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function am(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!IV(t)}function IV(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function DV(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function ZN(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:ZN(i.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const i=t.slice(7);let s;try{s=decodeURIComponent(i)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(s)?`/entry/${encodeURIComponent(s)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function jV(e){const t=uV.exec(e);if(!t)return null;const n=t[1]?.trim();if(!n)return null;const i=n.indexOf("/"),s=i>=0?n.slice(0,i):n,o=i>=0?n.slice(i+1).trim():"",l=s.trim().split(/[\s,]+/).filter(Boolean);if(l.length!==3)return null;const[d,f,p]=l;if(!d||!f||!p)return null;const m=av(d,1),y=av(f,.4),b=PV(p);if(m===null||y===null||b===null)return null;let w=1;if(i>=0){const S=av(o,1);if(S===null)return null;w=S}return{L:m,C:y,h:b,alpha:w}}function BV(e){const t=e.h*Math.PI/180,n=e.C*Math.cos(t),i=e.C*Math.sin(t),s=e.L,o=s+.3963377774*n+.2158037573*i,l=s-.1055613458*n-.0638541728*i,d=s-.0894841775*n-1.291485548*i,f=o**3,p=l**3,m=d**3,y=4.0767416621*f-3.3077115913*p+.2309699292*m,b=-1.2684380046*f+2.6097574011*p-.3413193965*m,w=-.0041960863*f-.7034186147*p+1.707614701*m,S=Kf(ov(y)),x=Kf(ov(b)),k=Kf(ov(w));if(e.alpha<1){const L=Kf(e.alpha);return`#${Xo(S)}${Xo(x)}${Xo(k)}${Xo(L)}`}return`#${Xo(S)}${Xo(x)}${Xo(k)}`}function av(e,t){if(!e)return null;if(e.endsWith("%")){const i=Number(e.slice(0,-1));return Number.isFinite(i)?i/100*t:null}const n=Number(e);return Number.isFinite(n)?n:null}function PV(e){const t=dV.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function ov(e){const t=Math.max(0,Math.min(1,e));return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function Kf(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function Xo(e){return e.toString(16).padStart(2,"0")}const zV=32;function lv(e){const t=wt(e);return{copyLabel:t("terminal.markdown.copy"),copyAriaLabel:n=>t("terminal.markdown.copyCodeAria",{language:n})}}const JN=_.memo(function({text:t,streaming:n,className:i,language:s="en"}){const o=_.useRef(t),l=_.useRef(n?t:""),d=_.useRef(null),[f,p]=_.useState(()=>n?es(t,lv(s)).html:"");o.current=t;const m=_.useMemo(()=>n?null:es(t,lv(s)).html,[n,t,s]);return _.useEffect(()=>{if(!n){d.current!==null&&window.clearTimeout(d.current),d.current=null;return}l.current===t||d.current!==null||(d.current=window.setTimeout(()=>{d.current=null;const y=o.current;y!==l.current&&(l.current=y,p(es(y,lv(s)).html))},zV))},[n,t,s]),_.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]),u.jsx("div",{className:i,dangerouslySetInnerHTML:{__html:m??f}})}),$V=[{icon:"◈",tone:"aurora",textKey:"terminal.analyst.suggestion.walkthrough"},{icon:"●",tone:"aurora",textKey:"terminal.analyst.suggestion.whatDoing"},{icon:"▲",tone:"coral",textKey:"terminal.analyst.suggestion.flagReview"},{icon:"≡",tone:"brass",textKey:"terminal.analyst.suggestion.handoffBrief"}],FV=[{icon:"◈",tone:"aurora",labelKey:"terminal.analyst.followup.goDeeper",textKey:"terminal.analyst.prompt.goDeeper"},{icon:"▲",tone:"coral",labelKey:"terminal.analyst.followup.intentDrift",textKey:"terminal.analyst.prompt.intentDrift"},{icon:"≡",tone:"brass",labelKey:"terminal.analyst.followup.toArtifact",textKey:"terminal.analyst.prompt.toArtifact"},{icon:"●",tone:"aurora",labelKey:"terminal.analyst.followup.whatDoingNow",textKey:"terminal.analyst.suggestion.whatDoing"}],HV=[{command:"/now",descriptionKey:"terminal.analyst.slash.now",templateKey:"terminal.analyst.suggestion.whatDoing"},{command:"/drift",descriptionKey:"terminal.analyst.slash.drift",templateKey:"terminal.analyst.prompt.intentDrift"},{command:"/brief",descriptionKey:"terminal.analyst.slash.brief",templateKey:"terminal.analyst.prompt.handoffBriefArtifact"},{command:"/risks",descriptionKey:"terminal.analyst.slash.risks",templateKey:"terminal.analyst.prompt.flagReviewBeforeContinue"},{command:"/timeline",descriptionKey:"terminal.analyst.slash.timeline",templateKey:"terminal.analyst.prompt.walkthrough"}],uo="session-analyst-artifacts";function UV({context:e}){const{state:t,dispatch:n,send:i,stop:s,reset:o}=_S(e),l=e.language??"en",d=wt(l),f=QV(),[p,m]=_.useState(0),[y,b]=_.useState(!1),w=t.catalog?.clis.find(U=>U.cliId===t.cliId),S=w?.models.find(U=>U.id===t.model),x=t.entries.length>0,k=t.artifacts.length,L=e.hiddenCompanionPanelIds,F=e.onSetCompanionPanelVisible,q=L!==void 0&&F!==void 0,T=L?.includes(uo)??!1,$=k>0&&!T,I=t.artifactAuthoring!==null&&k===0,N=_.useRef(0),[V,K]=_.useState(0),Q=_.useRef(null),Y=_.useRef(null),B=_.useRef(null),M=t.entries.at(-1),D=t.draft.startsWith("/")?HV.filter(U=>U.command.toLowerCase().startsWith(t.draft.toLowerCase())):[],j=!y&&D.length>0,A=`analysis-${e.operationId}-slash-listbox`,O=U=>`analysis-${e.operationId}-slash-${U.slice(1)}`,C=j?D[Math.min(p,D.length-1)]:void 0,z=_.useRef(x).current,P=x&&!z;_.useLayoutEffect(()=>{const U=Y.current;!U||!x||(U.scrollTop=U.scrollHeight)},[x,M?.text,t.entries.length,t.latestActivity,t.phase,t.artifactAuthoring,t.artifactPublished]),_.useLayoutEffect(()=>{const U=B.current;U&&ZA(U)},[t.draft]),_.useLayoutEffect(()=>{const U=B.current;if(!U||typeof ResizeObserver>"u")return;const ee=new ResizeObserver(()=>ZA(U));return ee.observe(U),()=>ee.disconnect()},[]),_.useEffect(()=>{const U=Y.current;U&&Jd(U,sG(l))},[l]),_.useEffect(()=>{const U=N.current;if(N.current=k,!(!q||!F)){if(k===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!T){const ee=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;F(uo,!1),ee&&window.requestAnimationFrame(()=>Q.current?.focus())}return}if(U===0&&T&&t.artifactsAutoOpenArmed){F(uo,!0);return}k>U&&T&&K(ee=>ee+1)}},[k,T,n,F,t.artifactsAutoOpenArmed,q]);const R=async(U,ee)=>{const ne=U.trim();if(ne){if(t.busy){n({type:"queue-push",text:ne}),ee&&n({type:"set-draft",draft:""});return}ee&&n({type:"set-draft",draft:""}),await i(ne)}},W=U=>{const ee=D[U];ee&&(n({type:"set-draft",draft:d(ee.templateKey)}),b(!0),m(0),window.requestAnimationFrame(()=>B.current?.focus()))},G=_.useCallback(U=>{const ee=U.target.closest('[data-action="copy-code"]');if(!ee)return;const ne=ee.closest("pre")?.getAttribute("data-code");ne&&WV(ee,ne,l)},[l]);return u.jsxs("section",{className:`session-analyst__chat-pane ${x?"has-interacted":"is-initial"}`,"aria-label":d("terminal.analyst.chatAria"),"data-phase":t.phase,children:[q?u.jsxs("button",{ref:Q,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${k===0?" is-waiting":""}${I?" is-authoring":""}`,"aria-label":d($?"terminal.analyst.hideArtifacts":"terminal.analyst.openArtifacts"),"aria-pressed":$,"aria-disabled":k===0,tabIndex:k===0?-1:void 0,title:I?d("terminal.analyst.authoringTooltip"):k===0?d("terminal.analyst.artifactsEmptyTooltip"):void 0,onClick:()=>{!F||k===0||($&&n({type:"artifacts-chip-disarm"}),F(uo,!$))},children:[u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:$?"«":"»"}),k>0?u.jsx("span",{className:`session-analyst-handle__count${V>0?" is-pulsing":""}`,children:k},V):null,I?u.jsx("span",{className:"session-analyst-handle__count",children:"…"}):null,u.jsx("span",{className:"session-analyst-handle__label",children:d("terminal.analyst.artifactsHandle")})]}):null,u.jsx(qV,{state:t,language:l,onReset:()=>{o().catch(()=>{})}}),u.jsxs("div",{className:"session-analyst__workspace",children:[u.jsxs("section",{ref:Y,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[x?u.jsx("ol",{className:"session-analyst__transcript",onClick:G,children:t.entries.map((U,ee)=>u.jsx("li",{className:`session-analyst__message session-analyst__message--${U.role}`,children:U.role==="analyst"?u.jsx(JN,{className:"session-analyst__response markdown-body",text:U.text,streaming:t.busy&&ee===t.entries.length-1,language:l}):U.text},`${U.role}-${ee}`))}):u.jsxs("div",{className:"session-analyst__hero-wrap",children:[u.jsxs("header",{className:"session-analyst__hero",children:[u.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),u.jsx("h2",{children:d("terminal.analyst.askAboutSession")}),u.jsx("p",{children:d("terminal.analyst.heroBody")})]}),u.jsx("div",{className:"session-analyst__suggestions",children:$V.map(U=>u.jsxs("button",{type:"button",onClick:()=>{R(d(U.textKey),!1)},children:[u.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":U.tone,"aria-hidden":"true",children:U.icon}),d(U.textKey)]},U.textKey))})]}),t.artifactAuthoring||t.artifactPublished?u.jsx(GV,{state:t,language:l,onOpen:q&&F?()=>F(uo,!0):void 0}):null,t.phase!=="idle"?u.jsx(KV,{state:t,language:l}):null]}),t.queue.length>0?u.jsx("div",{className:"session-analyst__queue","aria-live":"polite",children:t.queue.map((U,ee)=>u.jsxs("div",{className:"session-analyst__queue-item",children:[u.jsx("span",{className:"session-analyst__queue-tag",children:d("terminal.analyst.queued")}),u.jsx("span",{className:"session-analyst__queue-text",children:U}),u.jsx("button",{type:"button","aria-label":d("terminal.analyst.cancelQueued",{"index + 1":ee+1}),onClick:()=>n({type:"queue-cancel",index:ee}),children:"✕"})]},`${U}-${ee}`))}):null,t.phase==="complete"&&!t.busy&&x?u.jsxs("div",{className:"session-analyst__followups",children:[u.jsx("span",{className:"session-analyst__followups-label",children:d("terminal.analyst.followUp")}),u.jsx("div",{className:"session-analyst__followups-row",children:FV.map(U=>u.jsxs("button",{type:"button",onClick:()=>{R(d(U.textKey),!1)},children:[u.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":U.tone,"aria-hidden":"true",children:U.icon}),d(U.labelKey)]},U.labelKey))})]}):null,u.jsxs("form",{className:`session-analyst__composer ${x?"is-docked":"is-initial"}${P?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:U=>{U.preventDefault(),R(t.draft,!0)},children:[j?u.jsxs("div",{id:A,className:"session-analyst__slash",role:"listbox","aria-label":d("terminal.analyst.commands"),children:[u.jsx("span",{className:"session-analyst__slash-heading",children:d("terminal.analyst.commands")}),D.map((U,ee)=>u.jsxs("button",{type:"button",id:O(U.command),role:"option","aria-selected":ee===p,className:ee===p?"is-selected":void 0,onMouseDown:ne=>ne.preventDefault(),onClick:()=>W(ee),children:[u.jsx("span",{children:U.command}),u.jsx("small",{children:d(U.descriptionKey)})]},U.command))]}):null,x?null:u.jsxs("div",{className:"session-analyst__selector-strip","aria-label":d("terminal.analyst.initialSettings"),children:[u.jsx("span",{className:"session-analyst__select",children:u.jsx(Oi,{compact:!0,label:d("terminal.analyst.cli"),value:t.cliId,disabled:t.started||t.selectionLocked||!t.catalog,options:t.catalog?.clis.map(U=>({value:U.cliId,label:U.label,disabled:!U.available}))??[],onChange:U=>n({type:"select-cli",cliId:U})})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx(Oi,{compact:!0,label:d("terminal.analyst.model"),value:t.model,disabled:t.started||t.selectionLocked||!S,options:w?.models.map(U=>({value:U.id,label:U.label}))??[],onChange:U=>n({type:"select-model",model:U})})}),u.jsx("span",{className:"session-analyst__select",children:u.jsx(Oi,{compact:!0,label:d("terminal.analyst.effort"),value:t.effort,disabled:t.started||t.selectionLocked||!S||!S.effortLevels.length,options:S?.effortLevels.length?S.effortLevels.map(U=>({value:U,label:U})):[{value:"",label:d("terminal.analyst.na")}],onChange:U=>n({type:"select-effort",effort:U})})}),u.jsx("span",{"aria-live":"polite","aria-atomic":"true",style:{display:"inline-block",inlineSize:"5em",flex:"none",opacity:t.selectionSaved?1:0,textAlign:"center",transition:f?"none":"opacity var(--duration-base) var(--ease-glide)"},children:t.selectionSaved?d("terminal.analyst.saved"):""})]}),u.jsxs("div",{className:"session-analyst__composer-surface",children:[u.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:d("terminal.analyst.askAboutSession")}),u.jsx("textarea",{ref:B,id:`analysis-${e.operationId}`,role:"combobox","aria-expanded":j,"aria-controls":A,"aria-activedescendant":C?O(C.command):void 0,rows:1,placeholder:d("terminal.analyst.composerPlaceholder"),value:t.draft,onChange:U=>{n({type:"set-draft",draft:U.target.value}),m(0),b(!1)},onKeyDown:U=>{if(j&&!U.nativeEvent.isComposing){if(U.key==="ArrowDown"){U.preventDefault(),m(ee=>(ee+1)%D.length);return}if(U.key==="ArrowUp"){U.preventDefault(),m(ee=>(ee-1+D.length)%D.length);return}if(U.key==="Enter"){U.preventDefault(),W(Math.min(p,D.length-1));return}if(U.key==="Escape"){U.preventDefault(),b(!0);return}}U.key!=="Enter"||U.shiftKey||U.nativeEvent.isComposing||(U.preventDefault(),R(t.draft,!0))}}),t.busy?u.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":d("terminal.analyst.stop"),onClick:()=>{s()},children:u.jsx("span",{"aria-hidden":"true"})}):null,u.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":d(t.busy?"terminal.analyst.queueQuestion":"terminal.analyst.send"),disabled:!t.draft.trim(),children:u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:u.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]}),t.busy?u.jsx("div",{className:"session-analyst__composer-hint",children:d("terminal.analyst.queueHint")}):null]})]})]})}function ZA(e){e.style.height="auto";const t=window.getComputedStyle(e),n=Number.parseFloat(t.lineHeight)||18.75,i=(Number.parseFloat(t.paddingTop)||0)+(Number.parseFloat(t.paddingBottom)||0),s=n*6+i,o=Math.max(36,Math.min(e.scrollHeight,s));e.style.height=`${o}px`,e.style.overflowY=e.scrollHeight>s?"auto":"hidden"}function WV(e,t,n){const i=navigator.clipboard;if(!i)return;let s;try{s=i.writeText(t)}catch{return}const o=e.textContent,l=wt(n);s.then(()=>{e.isConnected&&(e.textContent=l("terminal.analyst.copied"),window.setTimeout(()=>{e.isConnected&&(e.textContent=o)},1200))}).catch(()=>{})}function qV({state:e,language:t,onReset:n}){const i=wt(t),s=e.started||e.phase!=="idle"||e.draft.length>0||e.queue.length>0||e.entries.length>0||e.artifacts.length>0;return u.jsxs("header",{className:"session-analyst__panel-head",children:[u.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:i("terminal.companion.sessionAnalyst")}),u.jsx("small",{children:i("terminal.analyst.subtitle")})]}),u.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":i("terminal.analyst.resetAria"),onClick:n,disabled:!s,children:i("terminal.analyst.reset")}),u.jsxs("span",{className:"session-analyst__panel-state",children:[u.jsx("i",{"aria-hidden":"true"}),XV(e,t)]})]})}function GV({state:e,language:t,onOpen:n}){const i=wt(t),s=JV(e.artifactAuthoring?.startedAt??null);if(e.artifactAuthoring)return u.jsxs("div",{className:"session-analyst__author-card is-authoring",children:[u.jsxs("div",{className:"session-analyst__author-head",children:[u.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"✳"}),u.jsx("strong",{className:"session-analyst__author-title",children:i("terminal.analyst.publishingArtifact")}),u.jsx("time",{className:"session-analyst__author-time",children:x0(s)})]}),u.jsx("p",{className:"session-analyst__author-sub",children:i("terminal.analyst.authoringBody")}),u.jsx("div",{className:"session-analyst__author-track","aria-hidden":"true",children:u.jsx("span",{})})]});const o=e.artifactPublished;return o?u.jsx("div",{className:"session-analyst__author-card is-done",children:u.jsxs("div",{className:"session-analyst__author-head",children:[u.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"◆"}),u.jsx("strong",{className:"session-analyst__author-title",children:i("terminal.analyst.artifactPublished",{title:o.artifact.title})}),o.durationMs===null?null:u.jsx("time",{className:"session-analyst__author-time",children:x0(o.durationMs)}),n?u.jsx("button",{type:"button",className:"session-analyst__author-open",onClick:n,children:i("terminal.analyst.openInArtifacts")}):null]})}):null}function KV({state:e,language:t}){const n=wt(t),i=ZV(e),s=x0(i),o=YV(e.latestActivity,t);if(e.phase==="complete")return null;if(e.phase==="stopped")return u.jsx("div",{className:"session-analyst__receipt is-stopped",role:"status",children:n("terminal.analyst.stoppedReceipt",{activity:o,elapsed:s})});const l=e.phase==="error",d=VV(e.latestActivity,t);return u.jsxs("div",{className:`session-analyst__pulse${l?" is-error":""}`,role:l?"alert":"status","aria-live":l?void 0:"polite",children:[l?null:u.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),u.jsxs("div",{className:"session-analyst__pulse-main",children:[u.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),u.jsxs("span",{className:"session-analyst__pulse-copy",children:[u.jsx("strong",{children:l?aG(t,e.error??""):d.label},`${e.phase}-${d.label}`),u.jsx("small",{children:l?t==="ko"?o:`Last confirmed activity: ${o}`:d.note})]}),u.jsx("time",{children:s})]}),u.jsx("span",{className:"session-analyst__truth-mark",children:n("terminal.analyst.lastConfirmedOnly")})]})}function VV(e,t){const n=wt(t);return!e||e.kind==="starting"?{label:n("terminal.analyst.activity.starting"),note:n(e?.connected?"terminal.analyst.activity.connected":"terminal.analyst.activity.startingSession")}:e.kind==="reasoning"?{label:n("terminal.analyst.activity.reasoning"),note:n("terminal.analyst.activity.thoughtHidden")}:e.kind==="tool"?{label:n("terminal.analyst.activity.usingTool",{title:e.title}),note:n("terminal.analyst.activity.toolStatus",{status:e.status})}:{label:n("terminal.analyst.activity.writing"),note:n("terminal.analyst.activity.answerChunk")}}function YV(e,t){const n=wt(t);return!e||e.kind==="starting"?n("terminal.analyst.activity.starting"):e.kind==="reasoning"?n("terminal.analyst.activity.reasoning"):e.kind==="tool"?`${n("terminal.analyst.activity.usingTool",{title:e.title})} (${e.status})`:n("terminal.analyst.activity.writing")}function XV(e,t){const n=wt(t);return e.phase==="error"?n("terminal.analyst.state.needsAttention"):e.busy?n("terminal.analyst.state.analyzing"):e.phase==="complete"?n("terminal.analyst.state.complete"):e.phase==="stopped"?n("terminal.analyst.state.stopped"):n("terminal.analyst.state.ready")}function ZV(e){const[t,n]=_.useState(()=>Date.now());return _.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 JV(e){const[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(e===null)return;n(Date.now());const i=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(i)},[e]),e===null?0:Math.max(0,t-e)}function x0(e){return`${Math.floor(e/1e3)}s`}function QV(){const[e,t]=_.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return _.useEffect(()=>{if(typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-reduced-motion: reduce)"),i=()=>t(n.matches);return n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),e}class js extends Error{constructor(t,n){super(n),this.status=t}status}const eY=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function tY(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await RS(t),e3(await t.json(),t.status)}async function QN(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await RS(t),sY(await t.json(),t.status)}async function nY(e,t,n){return TS(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function iY(e,t,n,i){return TS(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function rY(e,t,n){return TS(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function TS(e,t,n,i){const s=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await RS(s);const o=await s.json();if(!o||typeof o!="object"||!("state"in o))throw new js(s.status,"Invalid carrier settings mutation response");return{state:e3(o.state,s.status)}}async function RS(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 js(e.status,t)}function e3(e,t){t3(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new js(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>aY(i,t))}}function sY(e,t){t3(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new js(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>oY(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function aY(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 js(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=>cY(i,t))}}}function oY(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 js(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>lY(i,t)),defaultModel:n.defaultModel}}function lY(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new js(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new js(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 cY(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 js(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function t3(e,t){const n=[e];for(;n.length>0;){const i=n.pop();if(!(!i||typeof i!="object"))for(const[s,o]of Object.entries(i)){if(eY.has(s))throw new js(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const uY=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class ms extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function n3(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new ms(t.status,"Invalid agent state response");return n.agentClis.map(i=>vY(i,t.status))}async function dY(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.clis))throw new ms(t.status,"Invalid Agent CLI state response");return n}async function hY(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new ms(t.status,"Invalid tenants response");return n.tenants.map(i=>bY(i,t.status))}async function fY(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new ms(t.status,"Invalid jobs response");return n.tenants}async function pY(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new ms(t.status,"Invalid agent sessions response");return n.sessions.map(i=>Zm(i,t.status))}async function mY(e){const t=await fetch("/api/v1/operations",{signal:e});await Ea(t);const n=await t.json();if(!Array.isArray(n.operations))throw new ms(t.status,"Invalid operations response");return{operations:n.operations.map(i=>wY(i,t.status))}}async function gY(e,t,n){const i=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:n});return await Ea(i),Zm(await i.json(),i.status)}async function yY(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",...t?.fresh?{headers:{"Content-Type":"application/json"},body:JSON.stringify({fresh:!0})}:{},signal:t?.signal});return await Ea(n),Zm(await n.json(),n.status)}async function _Y(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Ea(n)}function Zm(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||C0(n))throw new ms(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",modelActivity:n.modelActivity==="working"||n.modelActivity==="not-working"?n.modelActivity:void 0,attentionPending:typeof n.attentionPending=="boolean"?n.attentionPending:void 0,createdAt:n.createdAt,theaterId:typeof n.theaterId=="string"?n.theaterId:void 0,tenantId:typeof n.tenantId=="string"?n.tenantId:void 0,registrationId:typeof n.registrationId=="string"?n.registrationId:void 0,resumeAvailable:n.resumeAvailable===!0}}async function Ea(e){if(!e.ok)throw new ms(e.status,`Agent plugin request failed: ${e.status}`)}function vY(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new ms(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function bY(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 ms(t,"Invalid tenant response");return n}function wY(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"||C0(n)||C0(n.payload))throw new ms(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 C0(e){return k0(e,new Set(uY))}function k0(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>k0(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||k0(i,t))}const SY=new Set(["nimitz","genesis","sentinel","vanguard"]);function xY(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 CY(e){if(e)return SY.has(e)?e:void 0}function kY(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function EY(e){return e==="err"||e==="error"}function i3(e,t){if(EY(e.status))return{label:"Error",tone:"error"};if(e.status==="aborted")return{label:"Aborted",tone:"error"};if(e.status==="done")return{label:"Done",tone:"done"};if(t==="error")return{label:"Error",tone:"error"};if(t==="aborted")return{label:"Aborted",tone:"error"};if(t==="done")return{label:"Done",tone:"done"};const n=e.tools.at(-1);return n&&MS(n.status)==="live"?{label:`Using ${n.name??"tool"}`,tone:"live"}:e.text.length>0?{label:"Writing",tone:"live"}:e.thought.length>0?{label:"Reasoning",tone:"live"}:{label:"Working",tone:"live"}}function MS(e){return e==="done"||e==="completed"?"done":e==="error"||e==="failed"?"error":"live"}function AY(e,t){const n=new Set(e),i=t.filter(s=>n.has(s)?!1:(n.add(s),!0));return i.length===0?e:[...e,...i]}const TY="active",E0=new Set(["done","error","aborted"]);function RY(e,t){let n=s3(A0(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=r3(n,i);return E0.has(t.status)&&!E0.has(n.status)&&(n={...n,status:t.status}),n}function r3(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:OY(e.recentEvents,t)};switch(t.type){case"job:registered":return LY(i,n);case"job:finalized":return{...i,status:En(n.status)??"done",finishedAt:so(n.finishedAt)??t.at,summary:En(n.summary),error:En(n.error)};case"track:begin":return uc(s3(i,n.request),n,t.id,s=>({...s,startedAt:so(n.startedAt)??t.at,requestPreview:En(n.requestPreview)}));case"track:status":return uc(i,n,t.id,s=>({...s,status:En(n.status)??s.status}));case"track:text":return uc(i,n,t.id,s=>{const o=s.text+(En(n.text)??"");return{...s,status:"stream",text:o,sentTextLength:s.sentTextLength+(so(n.textLength)??En(n.text)?.length??0),latestLine:IY(o)||s.latestLine}});case"track:thought":return uc(i,n,t.id,s=>{const o=s.thought+(En(n.text)??"");return{...s,thought:o,sentThoughtLength:s.sentThoughtLength+(so(n.textLength)??En(n.text)?.length??0)}});case"track:tool":return uc(i,n,t.id,s=>({...s,status:"stream",tools:NY(s.tools,n)}));case"track:finalized":return uc(i,n,t.id,s=>{const o=JA(s.text,s.sentTextLength,En(n.fallbackText),so(n.fallbackTextLength)),l=JA(s.thought,s.sentThoughtLength,En(n.fallbackThought),so(n.fallbackThoughtLength));return{...s,status:En(n.status)??"done",finishedAt:so(n.finishedAt)??t.at,error:En(n.error),text:o.text,sentTextLength:o.sentLength,thought:l.text,sentThoughtLength:l.sentLength}});default:return i}}function s3(e,t){if(e.request)return e;const n=MY(t);return n?{...e,request:n}:e}function MY(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 s=i;if(typeof s.tag!="string"||typeof s.hint!="string"||typeof s.required!="boolean"||typeof s.present!="boolean"||typeof s.body!="string")return;n.push({tag:s.tag,hint:s.hint,required:s.required,present:s.present,body:s.body})}return{blocks:n,additional:t.additional}}function A0(e,t,n){return{jobId:t,tenantId:e,status:TY,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function a3(e){return E0.has(e)}function LY(e,t){const n=Array.isArray(t.tracks)?t.tracks:[];let i=e.trackOrder,s=e.tracks;for(const o of n){if(!o.trackId)continue;const l=s[o.trackId],d={...l??o3(o.trackId),displayName:o.displayName??l?.displayName??o.trackId,displayCli:o.displayCli??l?.displayCli,model:o.model??l?.model,effort:o.effort??l?.effort,subtitle:o.subtitle??l?.subtitle,kind:o.kind??l?.kind,startedAt:o.startedAt??l?.startedAt};l||(i=[...i,o.trackId]),s={...s,[o.trackId]:d}}return{...e,label:En(t.label)??e.label,ownerCarrierId:En(t.ownerCarrierId)??e.ownerCarrierId,kind:En(t.kind)??e.kind,signatureCli:En(t.signatureCli)??e.signatureCli,startedAt:so(t.startedAt)??e.startedAt,trackOrder:i,tracks:s}}function uc(e,t,n,i){const s=En(t.trackId);if(!s)return e;const o=e.tracks[s],l={...i(o??o3(s)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,s],tracks:{...e.tracks,[s]:l}}}function o3(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function NY(e,t){const n=En(t.title),i=En(t.toolCallId)??En(t.toolId)??En(t.id);let s=i,o=i?e.findIndex(f=>f.id===i):-1;if(!s&&n){for(let f=e.length-1;f>=0;f-=1)if(e[f]?.name===n){MS(e[f]?.status)==="live"&&(o=f,s=e[f]?.id);break}if(!s){const f=e.filter(p=>p.name===n).length;s=`${n}#${f}`}}if(!s)return e;const l=o>=0?e[o]:void 0,d={...l,id:s,name:n??En(t.name)??l?.name,input:t.input??l?.input,output:t.output??l?.output,status:En(t.status)??l?.status};return o>=0?[...e.slice(0,o),d,...e.slice(o+1)]:[...e,d]}function JA(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 OY(e,t){return[...e,t].slice(-120)}function IY(e){const t=e.trim();if(!t)return"";const n=t.split(`
214
+ `);return n[n.length-1]?.trim()??""}function En(e){return typeof e=="string"?e:void 0}function so(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const DY=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function jY(){let e="";return t=>{e+=t;const n=[];let i=e.indexOf(`
215
+
216
+ `);for(;i>=0;){const s=e.slice(0,i);e=e.slice(i+2);const o=PY(s);o&&n.push(o),i=e.indexOf(`
217
+
218
+ `)}return n}}function BY(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=eT(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=eT(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:zY(t.reason)}:null}const n=QA(t.event)??QA(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function PY(e){const t=e.split(`
219
+ `),n=t.find(s=>s.startsWith("event:"))?.slice(6).trim()??"message",i=t.filter(s=>s.startsWith("data:")).map(s=>s.slice(5).trim()).join(`
220
+ `);return!i&&n==="message"?null:{event:n,data:i}}function QA(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 eT(e){try{return Zm(e,200)}catch{return null}}function zY(e){return typeof e=="string"&&DY.has(e)?e:void 0}const LS={droppedCount:0},T0=new Set;let Cn={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function l3(){return T5($Y,c3)}function c3(){return Cn}function $Y(e){return T0.add(e),()=>{T0.delete(e)}}function Ar(e){Cn={...Cn,...e},GY()}function u3(e){Ar({agentClis:e})}function FY(e){const t={};for(const n of e)t[n.sessionId]=n;Ar({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function om(e){const t=!!Cn.sessions[e.sessionId];Ar({sessions:{...Cn.sessions,[e.sessionId]:e},sessionOrder:t?Cn.sessionOrder:[e.sessionId,...Cn.sessionOrder],turnState:{...Cn.turnState,[e.sessionId]:e.turnState}})}function d3(e){const{[e]:t,...n}=Cn.sessions,{[e]:i,...s}=Cn.turnState;Ar({sessions:n,sessionOrder:Cn.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:Cn.activeTerminalSessionId===e?null:Cn.activeTerminalSessionId,turnState:s})}function h3(e){Ar({activeTerminalSessionId:e})}function HY(e){Ar({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Cn.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&Cn.tenantJobs[t])]})}function UY(e){const t={};for(const n of e){const i={};for(const s of n.jobs)i[s.jobId]=RY(n.tenantId,s);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(s=>s.jobId),jobs:i,truncation:n.truncation??LS}}Ar({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...Cn.tenantOrder.filter(n=>t[n])]})}function WY(e,t){const n=e.tenantId,i=e.jobId??KY(e),s=Cn.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:LS},o=i?s.jobs[i]??A0(n,i,e.at):A0(n,"__unknown__",e.at),l=r3(o,e),d=i&&s.jobOrder.includes(i)?s.jobOrder:i?[i,...s.jobOrder]:s.jobOrder,f={...s,tenantLabel:t??s.tenantLabel,jobOrder:d,jobs:i?{...s.jobs,[i]:l}:s.jobs};return Ar({tenantJobs:{...Cn.tenantJobs,[n]:f},tenantOrder:Cn.tenantOrder.includes(n)?Cn.tenantOrder:[n,...Cn.tenantOrder]}),{job:l,unknownTenant:!Cn.tenantJobs[n]}}function qY(e,t,n){const i=Cn.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:LS};Ar({tenantJobs:{...Cn.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function NS(e){const t=e.tenantId;if(!t)return[];const n=Cn.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function GY(){for(const e of T0)e()}function KY(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const tT=250,VY=5e3,R0=new Map;function YY(e){const t=new AbortController;return XY(t.signal,e),()=>t.abort()}async function XY(e,t){let n=tT;for(;!e.aborted;){Ar({connection:"connecting"});try{await QY(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}`);Ar({connection:"live",connectionError:null}),n=tT,await ZY(i.body.getReader(),e,t),e.aborted||Ar({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;Ar({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await tX(n,e),n=Math.min(n*2,VY)}}async function ZY(e,t,n){const i=new TextDecoder,s=jY();for(;!t.aborted;){const o=await e.read();if(o.done)return;for(const l of s(i.decode(o.value,{stream:!0}))){const d=BY(l);if(d){if(d.kind==="truncation"&&d.truncation){qY(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){om(d.session),lm(n,d.session.sessionId,OS(d.session));continue}if(d.kind==="attention"&&d.session){om(d.session),d.reason!=="idle_prompt"&&lm(n,d.session.sessionId,"awaiting");continue}d.event&&(WY(d.event,d.tenantLabel),JY(n,d.event.tenantId))}}}}function OS(e){return e.status==="dormant"?"dormant":e.attentionPending===!0?"awaiting":e.modelActivity==="working"?"running":e.modelActivity==="not-working"?nT(e)?"running":"idle":e.turnState==="running"||e.turnState==="ended"&&nT(e)?"running":"idle"}function nT(e){return NS(e).some(t=>!a3(t.status))}function lm(e,t,n){const i=R0.get(t);e.status.set(t,n),R0.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 JY(e,t){const{sessions:n}=c3();for(const i of Object.values(n))i.tenantId===t&&R0.get(i.sessionId)!=="awaiting"&&lm(e,i.sessionId,OS(i))}async function QY(e,t){const[n,i,s,o,l]=await Promise.all([n3(e),pY(e),hY(e),fY(e),mY(e)]);u3(n),FY(i),HY(s),UY(o);for(const d of i)lm(t,d.sessionId,OS(d));eX(l.operations,t)}function eX(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function tX(e,t){await new Promise(n=>{const i=()=>{clearTimeout(s),t.removeEventListener("abort",i),n()},s=setTimeout(i,e);t.addEventListener("abort",i)})}class Jm extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function nX(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await IS(t),p3(await t.json(),t.status)}async function iX(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 IS(i),f3(await i.json(),i.status)}async function rX(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await IS(n),f3(await n.json(),n.status)}async function IS(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 Jm(e.status,t)}function f3(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Jm(t,"Invalid model auth mutation response");return{state:p3(n.state,t)}}function p3(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Jm(t,"Invalid model auth state response");return{providers:n.providers.map(i=>sX(i,t))}}function sX(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Jm(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const M0=new Set;let L0={loading:!1,state:null,busyCli:null,error:null},ba=0;function aX(){return _.useSyncExternalStore(oX,iT,iT)}function iT(){return L0}function oX(e){return M0.add(e),()=>M0.delete(e)}async function lX(e){const t=++ba;wa({loading:!0,error:null});try{const n=await nX(e);if(t!==ba)return;wa({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==ba)return;wa({loading:!1,error:DS(n)})}}async function cX(e,t){const n=++ba;wa({busyCli:e,error:null});try{const i=await iX(e,t);return n!==ba||(wa({state:i.state,busyCli:null,error:null}),await m3()),!0}catch(i){return n!==ba||wa({busyCli:null,error:DS(i)}),!1}}async function uX(e){const t=++ba;wa({busyCli:e,error:null});try{const n=await rX(e);return t!==ba||(wa({state:n.state,busyCli:null,error:null}),await m3()),!0}catch(n){return t!==ba||wa({busyCli:null,error:DS(n)}),!1}}async function m3(){try{u3(await n3())}catch{}}function wa(e){L0={...L0,...e};for(const t of M0)t()}function DS(e){return e instanceof Error?e.message:String(e)}class g3 extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function dX(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await y3(t),_3(await t.json(),t.status)}async function hX(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await y3(n),_3(await n.json(),n.status)}async function y3(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 g3(e.status,t)}function _3(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||!fX(n.agentIdleDormantMinutes))throw new g3(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,kimiModel:pX(n.kimiModel),agentIdleDormantMinutes:n.agentIdleDormantMinutes}}function fX(e){return e===null?!0:typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)&&e>0}function pX(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 N0=new Set;let cm={loading:!1,state:null,savingField:null,error:null},bp=0;function jS(){return _.useSyncExternalStore(mX,rT,rT)}function rT(){return cm}function mX(e){return N0.add(e),()=>{N0.delete(e)}}async function BS(e){const t=++bp;Ic({loading:!0,error:null});try{const n=await dX(e);if(t!==bp)return;Ic({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==bp)return;Ic({loading:!1,error:v3(n)})}}async function PS(e,t){const n=cm.state;if(!n||e==="kimiModel"&&t===null)return!1;bp+=1;const i={...n,[e]:t},s=gX(e,i);Ic({state:i,savingField:e,error:null});try{const o=await hX(s);return Ic({state:o,savingField:null,error:null}),!0}catch(o){return Ic({state:n,savingField:null,error:v3(o)}),!1}}function gX(e,t){return e==="enableMetaphor"?{enableMetaphor:t.enableMetaphor}:e==="agentIdleDormantMinutes"?{agentIdleDormantMinutes:t.agentIdleDormantMinutes}:{kimiModel:t.kimiModel}}function Ic(e){cm={...cm,...e};for(const t of N0)t()}function v3(e){return e instanceof Error?e.message:String(e)}const yX=["webgl","dom"],_X="/plugins/terminal/agent/ticket",vX="/plugins/terminal/ws",bX=56,wX={...FW,step:1,defaultValue:14},SX={cascadia:"terminal.settings.fontMetaCascadia",jetbrains:"terminal.settings.fontMetaJetbrains","fira-code":"terminal.settings.fontMetaFiraCode","source-code-pro":"terminal.settings.fontMetaSourceCodePro"},xX=5e3,um="carrier-streams",Qd="session-analyst-chat",CX=[um,Qd,uo],kX={live:"terminal.streams.status.live",done:"terminal.streams.status.done",error:"terminal.streams.status.error"},b3={pluginId:"terminal",type:"agent",title:e=>wt(e)("terminal.kind.agent"),subtitle:e=>Rd(e.payload,"cliLabel")??void 0,render:e=>u.jsx(OX,{context:e}),canOpenCompanions:()=>!0,companions:[{id:um,title:e=>wt(e)("terminal.companion.carrierStreams"),hideCaption:!0,defaultHidden:!0,render:e=>u.jsx(IX,{context:e})},{id:Qd,title:e=>wt(e)("terminal.companion.sessionAnalyst"),hideCaption:!0,defaultHidden:!0,render:e=>u.jsx(UV,{context:e})},{id:uo,title:e=>wt(e)("terminal.companion.artifacts"),hideCaption:!0,defaultHidden:!0,render:e=>u.jsx(bG,{context:e})}]},w3={id:"general",title:e=>wt(e)("terminal.settings.general"),render:()=>u.jsx(PX,{})},S3={id:"agent-cli",title:e=>wt(e)("terminal.settings.agentCli"),render:()=>u.jsx(FX,{})},x3={id:"agent.attention",title:e=>wt(e)("terminal.notifications.agentInputWaiting")},EX={id:"agent.ended",title:e=>wt(e)("terminal.notifications.agentTurnEnded")},O0={id:"agent.resume-failed",title:e=>wt(e)("terminal.notifications.resumeFailed")},hd={id:"terminal",operationKinds:[b3],settingsSections:[w3,S3],notificationKinds:[x3,EX,O0],install:e=>AX(e),closeOperation:async e=>{try{await _Y(e)}finally{pG(e),d3(e)}},resumeOperation:async e=>{try{await E3(e),dm?.dismiss(e)}catch(t){throw dm?.emit({kind:O0.id,operationId:e,message:"Resume failed — the saved session has expired."}),t}},launch:async({theaterId:e,kind:t})=>{const n=await gY(e,t.id);return om(n),h3(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?u.jsx(eZ,{}):e.id==="claude"?u.jsx(JX,{}):e.id==="codex"?u.jsx(QX,{}):u.jsx(ZX,{})};let dm=null;function AX(e){dm=e.notifications;const t=YY({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync});return()=>{dm=null,t()}}function TX(e,t){const n=_.useRef(null),i=_.useRef(null),s=_.useRef(!0),o=_.useCallback(l=>{s.current!==l&&(s.current=l)},[]);return _.useEffect(()=>{const l=n.current;if(!l)return;const d=()=>{const f=l.scrollHeight-l.scrollTop-l.clientHeight;o(f<=bX)};return l.addEventListener("scroll",d,{passive:!0}),()=>l.removeEventListener("scroll",d)},[e,o]),_.useLayoutEffect(()=>{o(!0);const l=n.current;l&&(l.scrollTop=l.scrollHeight)},[e,o]),_.useLayoutEffect(()=>{const l=n.current;!l||!s.current||(l.scrollTop=l.scrollHeight)},[t]),_.useEffect(()=>{if(typeof ResizeObserver>"u")return;const l=n.current,d=i.current;if(!l||!d)return;const f=new ResizeObserver(()=>{s.current&&(l.scrollTop=l.scrollHeight)});return f.observe(d),()=>f.disconnect()},[e]),{containerRef:n,contentRef:i}}function RX(e,t){const[n,i]=_.useState(Date.now);return _.useEffect(()=>{if(e===void 0||t!==void 0)return;const s=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(s)},[e,t]),e===void 0?"":xY((t??n)-e)}function MX(e){const[t,n]=_.useState({operationId:e.operationId,readiness:"unknown"}),i=t.operationId===e.operationId?t.readiness:"unknown";return _.useEffect(()=>{let s=!1,o=!1,l;n({operationId:e.operationId,readiness:"unknown"});const d=async()=>{if(o)return;o=!0;const f=await Hq(e.api,e.operationId);o=!1,!s&&(n({operationId:e.operationId,readiness:f?"ready":"not-ready"}),f&&l!==void 0&&window.clearInterval(l))};return d(),l=window.setInterval(()=>{d()},xX),()=>{s=!0,l!==void 0&&window.clearInterval(l)}},[e.api,e.operationId]),i}function hm(e,t){return!!e.companionsOpen&&!(e.hiddenCompanionPanelIds??[]).includes(t)}function C3(e,t){if(!e.onSetCompanionPanelVisible){e.onRequestCompanions?.(!e.companionsOpen);return}if(!hm(e,t)){e.companionsOpen||e.onRequestCompanions?.(!0),e.onSetCompanionPanelVisible(t,!0);return}e.onSetCompanionPanelVisible(t,!1),CX.filter(o=>hm(e,o)).length<=1&&e.onRequestCompanions?.(!1)}function LX({context:e,ready:t,working:n}){const i=hm(e,Qd),s=e.language??"en",o=wt(s);return u.jsxs("button",{type:"button",className:`session-analyst-handle${t?"":" is-waiting"}${n?" is-live":""}`,"aria-label":o(i?"terminal.analyst.exit":"terminal.analyst.open"),"aria-pressed":i,"aria-disabled":!t,disabled:!t,title:t?void 0:o("terminal.analyst.sendMessageFirst"),onClick:()=>{t&&C3(e,Qd)},children:[n?u.jsx("span",{className:"session-analyst-handle__live","aria-hidden":"true"}):null,u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:i?"«":"»"}),u.jsx("span",{className:"session-analyst-handle__label",children:o(i?"terminal.handle.exit":"terminal.handle.analyze")})]})}function NX({context:e,live:t}){const n=hm(e,um),i=e.language??"en",s=wt(i);return u.jsxs("button",{type:"button",className:`session-analyst-handle session-analyst-handle--streams${t?" is-live":""}`,"aria-label":s(n?"terminal.streams.exit":"terminal.streams.open"),"aria-pressed":n,onClick:()=>C3(e,um),children:[t?u.jsx("span",{className:"session-analyst-handle__live","aria-hidden":"true"}):null,u.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),u.jsx("span",{className:"session-analyst-handle__label",children:s(n?"terminal.handle.exit":"terminal.handle.streams")})]})}function OX({context:e}){const n=l3().sessions[e.operationId]??A3(e),i=MX(e),{state:s}=_S(e),o=NS(n),l=k3(o),d=_.useRef(!0);_.useEffect(()=>{const p=e.companionsOpen??!1,m=d.current;d.current=p,m&&!p&&mG(e.operationId)},[e.companionsOpen,e.operationId]),_.useEffect(()=>{i!=="not-ready"||!e.onSetCompanionPanelVisible||(e.onSetCompanionPanelVisible(Qd,!1),e.onSetCompanionPanelVisible(uo,!1))},[i,e.onSetCompanionPanelVisible]);const f=u.jsxs("div",{className:"session-analyst-handle-stack",children:[u.jsx(NX,{context:e,live:l>0}),u.jsx(LX,{context:e,ready:i==="ready",working:s.busy})]});return n.status==="dormant"?u.jsxs("div",{className:"agent-stream-host",children:[f,u.jsx(KX,{context:e,session:n})]}):u.jsxs("div",{className:"agent-stream-host",children:[f,u.jsx(pS,{operationId:n.sessionId,ticketPath:_X,wsPath:vX,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>d3(n.sessionId)})]})}function IX({context:e}){const n=l3().sessions[e.operationId]??A3(e),i=NS(n),s=e.language??"en",o=wt(s),[l,d]=_.useState([]),f=i.flatMap(m=>m.trackOrder.flatMap(y=>{const b=m.tracks[y];return b?[{job:m,track:b}]:[]})),p=k3(i);return u.jsxs("section",{className:"carrier-streams","aria-label":o("terminal.companion.carrierStreams"),children:[u.jsxs("header",{className:"session-analyst__panel-head carrier-streams__panel-head",children:[u.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),u.jsxs("span",{className:"session-analyst__panel-copy",children:[u.jsx("strong",{children:o("terminal.companion.carrierStreams")}),u.jsx("small",{children:o("terminal.streams.subtitle")})]}),u.jsxs("span",{className:`carrier-streams__state${p>0?" is-live":""}`,children:[u.jsx("i",{"aria-hidden":"true"}),p>0?`${p} ${o("terminal.streams.status.live")}`:o("terminal.streams.status.idle")]})]}),f.length===0?u.jsxs("div",{className:"carrier-streams__empty",children:[u.jsx("strong",{children:o("terminal.streams.emptyTitle")}),u.jsx("span",{children:o("terminal.streams.emptyBody")})]}):u.jsx("div",{className:"carrier-streams__board",children:f.map(({job:m,track:y})=>{const b=`${m.jobId}:${y.trackId}`,S=i3(y,m.status).tone!=="done"||l.includes(b);return u.jsx(DX,{job:m,track:y,language:s,expanded:S,onToggleCompleted:()=>{d(x=>S?x.filter(k=>k!==b):AY(x,[b]))}},b)})})]})}function DX({job:e,track:t,language:n,expanded:i,onToggleCompleted:s}){const o=wt(n),l=i3(t,e.status),d=CY(e.ownerCarrierId),f=RX(t.startedAt??e.startedAt,t.finishedAt??e.finishedAt),p=jX(e,t),m=`${t.lastEventId}:${t.text.length}:${t.tools.length}`,y=TX(`${e.jobId}:${t.trackId}:${i}`,m),b=l.tone==="done",w=l.tone==="live"&&t.thought.length>0&&(t.text.length===0||BX(e,t.trackId)==="track:thought"),S=t.error??(l.tone==="error"?e.error??e.summary:void 0),x=o(kX[l.tone]),k=t.tools.length>0?t.tools[t.tools.length-1]:void 0;return b&&!i?u.jsxs("button",{type:"button",className:"carrier-stream-column carrier-stream-column--collapsed","data-captain":d,"aria-label":`${o("terminal.streams.expand")} · ${t.displayName}`,onClick:s,children:[d?u.jsx("span",{className:"carrier-stream-column__captain-dot","data-captain":d,"aria-hidden":"true"}):null,u.jsx("strong",{children:t.displayName}),u.jsx("span",{className:"carrier-stream-column__phase","data-tone":"done",children:o("terminal.streams.status.done")}),u.jsx("time",{children:f})]}):u.jsxs("article",{className:"carrier-stream-column","data-captain":d,"data-tone":l.tone,children:[l.tone==="live"?u.jsx("span",{className:"carrier-stream-column__scan","aria-hidden":"true"}):null,u.jsxs("header",{className:"carrier-stream-column__head",children:[d?u.jsx("span",{className:"carrier-stream-column__captain-dot","data-captain":d,"aria-hidden":"true"}):null,u.jsx("strong",{title:t.displayName,children:t.displayName}),u.jsx("span",{className:"carrier-stream-column__phase","data-tone":l.tone,children:x}),b?u.jsx("button",{type:"button","aria-label":`${o("terminal.streams.collapse")} · ${t.displayName}`,onClick:s,children:"‹"}):null]}),u.jsx("div",{ref:y.containerRef,className:"carrier-stream-column__body",tabIndex:0,children:u.jsxs("div",{ref:y.contentRef,className:"carrier-stream-column__content",children:[p?u.jsxs("div",{className:"carrier-stream-column__request","data-captain":d,children:[u.jsx("span",{className:"carrier-stream-column__request-kicker",children:o("terminal.streams.dispatchOrder")}),u.jsx("p",{children:p})]}):null,t.text?u.jsxs("div",{className:"carrier-stream-column__answer",children:[u.jsx("span",{"aria-hidden":"true",children:"✳"}),u.jsx(JN,{className:"carrier-stream-column__markdown markdown-body",text:t.text,streaming:l.tone==="live",language:n})]}):null,w?u.jsxs("div",{className:"carrier-stream-column__reasoning","aria-live":"polite",children:[u.jsx("i",{"aria-hidden":"true"}),u.jsx("span",{children:o("terminal.streams.reasoning")})]}):null,S?u.jsx("div",{className:"carrier-stream-column__error",role:"alert",children:S}):null,k?u.jsxs("div",{className:"carrier-stream-column__activity","data-tone":l.tone,"aria-label":`${o("terminal.streams.activity")} · ${t.displayName}`,children:[l.tone==="live"?u.jsx("span",{className:"carrier-stream-column__activity-scan","aria-hidden":"true"}):null,u.jsxs("div",{className:"carrier-stream-column__activity-main",children:[u.jsx("span",{className:"carrier-stream-column__activity-orbit","data-tone":MS(k.status),"aria-hidden":"true"}),u.jsxs("span",{className:"carrier-stream-column__activity-copy",children:[u.jsx("strong",{children:o("terminal.analyst.activity.usingTool",{title:k.name??k.id})}),u.jsx("small",{children:o("terminal.analyst.activity.toolStatus",{status:k.status})}),u.jsx("small",{children:o("terminal.analyst.lastConfirmedOnly")})]}),u.jsx("time",{children:f})]})]}):null]})})]})}function k3(e){return e.reduce((t,n)=>a3(n.status)?t:t+n.trackOrder.reduce((i,s)=>{const o=n.tracks[s];return o&&kY(o.status)?i+1:i},0),0)}function jX(e,t){if(e.request){const n=e.request.blocks.filter(i=>i.present&&i.body.trim()).map(i=>i.body.trim());return e.request.additional.trim()&&n.push(e.request.additional.trim()),n.join(`
221
+
222
+ `)}return t.requestPreview?.trim()??""}function BX(e,t){for(let n=e.recentEvents.length-1;n>=0;n-=1){const i=e.recentEvents[n];if(i?.event.trackId===t)return i.type}}function PX(){const{renderer:e,font:t}=cN();return u.jsxs(u.Fragment,{children:[u.jsx(WX,{}),u.jsx($X,{}),u.jsx(VX,{terminalFont:t}),u.jsx(YX,{terminalRenderer:e})]})}const zX=[{value:"off",label:"Off"},{value:"30",label:"30 minutes"},{value:"60",label:"1 hour"},{value:"120",label:"2 hours"},{value:"240",label:"4 hours"}];function $X(){const e=jS(),t=e.state,n=e.savingField!==null;_.useEffect(()=>{const o=new AbortController;return BS(o.signal),()=>o.abort()},[]);const i=t?.agentIdleDormantMinutes===null?"off":t?.agentIdleDormantMinutes!==void 0?String(t.agentIdleDormantMinutes):"60",s=(()=>{const o=zX.map(f=>({value:f.value,label:f.label})),l=t?.agentIdleDormantMinutes;if(l==null)return o;const d=String(l);return o.some(f=>f.value===d)||o.push({value:d,label:`${l} minutes`}),o})();return u.jsxs("section",{className:"global-settings-card","aria-label":"Idle agent sessions",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",id:"idle-agent-sessions-label",children:"Idle agent sessions"}),u.jsx("p",{className:"global-settings-help",id:"idle-agent-sessions-help",children:"Automatically move idle agent terminals to Dormant after the selected period. Dormant sessions keep their conversation and resume with one click. Shell terminals are never affected. Persists on the Console server."})]}),u.jsx(Oi,{"aria-labelledby":"idle-agent-sessions-label",value:i,disabled:n,options:s,onChange:o=>{const l=o==="off"?null:Number(o);PS("agentIdleDormantMinutes",l)}})]}):u.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."})]})}function FX(){const e=wt(Fs()),[t,n]=_.useState([]),[i,s]=_.useState(null);return _.useEffect(()=>{const o=new AbortController;return dY(o.signal).then(l=>n(l.clis)).catch(l=>{o.signal.aborted||s(l instanceof Error?l.message:String(l))}),()=>o.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.settings.agentCliAvailable"),children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:e("terminal.settings.agentCliAvailable")})}),u.jsx("p",{className:"global-settings-help",children:e("terminal.settings.agentCliHelp")}),i?u.jsx("p",{className:"settings-error",children:i}):null,u.jsx("div",{className:"agent-cli-list",children:t.map(o=>u.jsx(GX,{cli:o},o.id))}),u.jsx("p",{className:"global-settings-foot",children:e("terminal.settings.agentCliFoot")})]}),u.jsx(HX,{})]})}function HX(){const e=wt(Fs()),t=aX(),n=jS(),[i,s]=_.useState(null);_.useEffect(()=>{const y=new AbortController;return lX(y.signal),()=>y.abort()},[]),_.useEffect(()=>{const y=new AbortController;return QN(y.signal).then(b=>s(b.cliTypes.find(w=>w.id==="claude-kimi")??null)).catch(()=>{}),()=>y.abort()},[]),_.useEffect(()=>{const y=new AbortController;return BS(y.signal),()=>y.abort()},[]);const o=n.state?.kimiModel??null,l=o?.model??i?.defaultModel,d=i?.models.find(y=>y.modelId===l),f=o?.effort??d?.effort?.default,p=n.savingField!==null,m=(y,b)=>{PS("kimiModel",b?{model:y,effort:b}:{model:y})};return u.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.auth.modelSignInAria"),children:[u.jsxs("div",{className:"model-auth-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:e("terminal.auth.settingsForKimi")}),u.jsx("p",{className:"global-settings-help",children:e("terminal.auth.kimiHelp")})]}),t.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,t.loading&&!t.state?u.jsx("p",{className:"global-settings-help",children:e("terminal.auth.loadingSignIn")}):null,t.state?.providers.map(y=>u.jsx(UX,{provider:y,busy:t.busyCli===y.cli},y.cli)),i&&l?u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"terminal-carriers-runtime-row",children:[u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-model-label",children:e("terminal.auth.defaultModel")}),u.jsx(Oi,{"aria-labelledby":"kimi-default-model-label",value:l,disabled:p||!n.state,options:i.models.map(y=>({value:y.modelId,label:y.name})),onChange:y=>{const b=i.models.find(w=>w.modelId===y);b&&m(b.modelId,b.effort?o?.effort??b.effort.default:void 0)}})]}),d?.effort?u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-effort-label",children:e("terminal.auth.defaultEffort")}),u.jsx(Oi,{"aria-labelledby":"kimi-default-effort-label",value:f??d.effort.default,disabled:p||!n.state,options:d.effort.levels.map(y=>({value:y,label:y})),onChange:y=>m(d.modelId,y)})]}):null]}),u.jsx("p",{className:"global-settings-help",children:e("terminal.auth.kimiModelHelp")})]}):null,u.jsx("p",{className:"global-settings-foot",children:e("terminal.auth.signInFoot")})]})}function UX({provider:e,busy:t}){const n=wt(Fs()),[i,s]=_.useState(""),o=async()=>{await cX(e.cli,i)&&s("")};return u.jsxs("div",{className:"model-auth-row",children:[u.jsxs("div",{className:"model-auth-row-head",children:[u.jsx("span",{className:"model-auth-name",children:e.displayName}),u.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?n("terminal.auth.signedIn"):n("terminal.auth.notSignedIn")})]}),e.signedIn?u.jsx("div",{className:"model-auth-actions",children:u.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{uX(e.cli)},children:n(t?"terminal.auth.working":"terminal.auth.signOut")})}):u.jsxs("form",{className:"model-auth-form",onSubmit:l=>{l.preventDefault(),o()},children:[u.jsx("input",{type:"password",className:"model-auth-input",placeholder:n("terminal.auth.apiKey"),value:i,autoComplete:"off",spellCheck:!1,disabled:t,"aria-label":n("terminal.auth.apiKeyAria",{name:e.displayName}),onChange:l=>s(l.target.value)}),u.jsx("button",{type:"submit",className:"model-auth-button is-primary",disabled:t||i.trim().length===0,children:n(t?"terminal.auth.verifying":"terminal.auth.signIn")})]})]})}function WX(){const e=wt(Fs()),t=jS(),n=t.state,i=t.savingField!==null;return _.useEffect(()=>{const s=new AbortController;return BS(s.signal),()=>s.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.settings.systemPromptAria"),children:[t.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,n?u.jsx(u.Fragment,{children:u.jsx(qX,{title:e("terminal.settings.metaphor"),help:e("terminal.settings.metaphorHelp"),onLabel:e("terminal.settings.enabled"),offLabel:e("terminal.settings.off"),value:n.enableMetaphor,disabled:i,onToggle:()=>{PS("enableMetaphor",!n.enableMetaphor)}})}):u.jsx("p",{className:"global-settings-help",children:t.loading?e("terminal.settings.loading"):e("terminal.settings.unavailable")}),u.jsx("p",{className:"global-settings-foot",children:e("terminal.settings.systemPromptFoot")})]})}function qX({title:e,help:t,onLabel:n,offLabel:i,value:s,disabled:o,onToggle:l}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${s?"is-on":""}`,disabled:o,"aria-pressed":s,onClick:l,children:u.jsx("span",{children:s?n:i})})]})}function GX({cli:e}){const t=wt(Fs());return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?t("terminal.settings.available"):t("terminal.settings.missing")})]})]})}async function E3(e,t){om(await yY(e,t)),h3(e)}function KX({context:e,session:t}){const n=wt(e.language??"en"),[i,s]=_.useState("idle"),o=_.useCallback(async l=>{s("resuming");try{await E3(t.sessionId,{fresh:l}),e.notifications.dismiss(t.sessionId)}catch{s("error"),e.notifications.emit({kind:O0.id,operationId:t.sessionId,message:"Resume failed — the saved session has expired."})}},[e,t.sessionId]);return i==="error"?u.jsxs("div",{className:"canvas-operation-dormant canvas-operation-dormant--error",role:"alert",children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:n("terminal.dormant.status")}),u.jsx("p",{className:"canvas-operation-dormant-error",children:n("terminal.dormant.resumeFailedBody",{name:t.label||t.cwdLabel})}),u.jsxs("div",{className:"canvas-operation-dormant-error-actions",children:[u.jsx("button",{type:"button",className:"canvas-operation-dormant-action",onClick:()=>{o(!1)},children:n("terminal.dormant.tryAgain")}),u.jsx("button",{type:"button",className:"canvas-operation-dormant-action canvas-operation-dormant-action--ghost",onClick:()=>{o(!0)},children:n("terminal.dormant.startFresh")})]})]}):u.jsxs("button",{type:"button",className:"canvas-operation-dormant",disabled:i==="resuming",onClick:()=>{o(!1)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:n("terminal.dormant.status")}),u.jsx("span",{className:`canvas-operation-dormant-action${i==="resuming"?" canvas-operation-dormant-action--pending":""}`,children:n(i==="resuming"?"terminal.dormant.resuming":"terminal.dormant.resume")})]})}function A3(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Rd(e.operation.payload,"cliId")??void 0,cliLabel:Rd(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Rd(e.operation.payload,"tenantId")??void 0,registrationId:Rd(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Rd(e,t){const n=e[t];return typeof n=="string"?n:null}function VX({terminalFont:e}){const t=wt(Fs()),[n,i]=_.useState([]),[s,o]=_.useState(!0),[l,d]=_.useState(!1),f=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Lc.id:Lc.id}:{source:"system",familyName:e.customName};_.useEffect(()=>{const m=new AbortController;return o(!0),d(!1),OM({signal:m.signal}).then(y=>{m.signal.aborted||i(y.fonts.filter(b=>b.monospace).map(b=>({family:b.family,monospace:b.monospace})))}).catch(y=>{m.signal.aborted||XX(y)||(i([]),d(!0))}).finally(()=>{m.signal.aborted||o(!1)}),()=>m.abort()},[]);const p=m=>{if(m.source==="system"){ZW(m.familyName);return}const y=Kd.find(b=>b.id===m.id);y&&XW(y.id)};return u.jsxs("section",{className:"global-settings-card","aria-label":t("terminal.settings.terminalFont"),children:[u.jsx("div",{className:"global-settings-row",children:u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:[t("terminal.settings.terminalFont")," ",u.jsx("span",{className:"new-badge",children:t("terminal.settings.terminalFontNew")})]}),u.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:t("terminal.settings.terminalFontHelp")})]})}),u.jsx("div",{"aria-describedby":"terminal-font-help",children:u.jsx(LM,{builtIns:Kd.map(m=>({id:m.id,label:m.name,family:m.family,aliases:[m.familyName],description:t(SX[m.id])})),installedFonts:n,selected:f,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Lc.family,previewText:t("terminal.settings.terminalFontPreview"),size:e.size,sizeRange:wX,loading:s,error:l?t("terminal.settings.fontLoadError"):null,labels:{browserAria:t("terminal.settings.fontPicker.browserAria"),searchLabel:t("terminal.settings.fontPicker.searchLabel"),searchPlaceholder:t("terminal.settings.fontPicker.searchPlaceholder"),loading:t("terminal.settings.fontPicker.loading"),choicesAria:t("terminal.settings.fontPicker.choicesAria"),builtInGroup:t("terminal.settings.fontPicker.builtInGroup"),installedGroup:t("terminal.settings.fontPicker.installedGroup"),noMatch:t("terminal.settings.fontPicker.noMatch"),preview:t("terminal.settings.fontPicker.preview"),available:t("terminal.settings.fontPicker.available"),unavailable:t("terminal.settings.fontPicker.unavailable"),fontSizeAria:t("terminal.settings.fontPicker.fontSizeAria"),decreaseSizeAria:t("terminal.settings.fontPicker.decreaseSizeAria"),sizeValueAria:t("terminal.settings.fontPicker.sizeValueAria"),increaseSizeAria:t("terminal.settings.fontPicker.increaseSizeAria"),sizeSliderAria:t("terminal.settings.fontPicker.sizeSliderAria"),monospace:t("terminal.settings.fontPicker.monospace"),systemFont:t("terminal.settings.fontPicker.systemFont"),savedSystemFont:t("terminal.settings.fontPicker.savedSystemFont")},onSelectionChange:p,onSizeCommit:JW})}),u.jsx("p",{className:"global-settings-foot",children:t("terminal.settings.terminalFontFoot")})]})}function YX({terminalRenderer:e}){const t=wt(Fs()),n={webgl:t("terminal.settings.webgl"),dom:t("terminal.settings.dom")};return u.jsx("section",{className:"global-settings-card","aria-label":t("terminal.settings.terminalRenderer"),children:u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:t("terminal.settings.terminalRenderer")}),u.jsx("p",{className:"global-settings-help",children:t("terminal.settings.terminalRendererHelp")})]}),u.jsx("div",{className:"segmented",role:"group","aria-label":t("terminal.settings.terminalRendererAria"),children:yX.map(i=>{const s=i===e;return u.jsx("button",{type:"button","aria-pressed":s,className:`segmented-option ${s?"is-active":""}`,onClick:()=>YW(i),children:n[i]},i)})})]})})}function XX(e){return e instanceof DOMException&&e.name==="AbortError"}function ZX(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function JX(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function QX(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function eZ(){return u.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:u.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const I0=new Set;let Bs={loading:!1,state:null,options:null,activeCarrierId:null,savingActionId:null,error:null};function tZ(){return _.useSyncExternalStore(nZ,Wc,Wc)}function Wc(){return Bs}function nZ(e){return I0.add(e),()=>{I0.delete(e)}}async function wp(e){mo({loading:!0,error:null});try{const[t,n]=await Promise.all([tY(e),QN(e)]);T3(t,n)}catch(t){if(e?.aborted)return;mo({loading:!1,error:R3(t)})}}function iZ(e){mo({activeCarrierId:e,error:null})}async function Vf(e){const t=$S();return!t||Bs.savingActionId!==null?!1:zS("carrier-patch",()=>nY(t.carrierId,e))}async function rZ(e,t){const n=$S();return!n||Bs.savingActionId!==null?!1:zS(`taskforce-save:${e}`,()=>iY(n.carrierId,e,t))}async function sZ(e){const t=$S();return!t||Bs.savingActionId!==null?!1:zS(`taskforce-remove:${e}`,()=>rY(t.carrierId,e))}function T3(e,t){const n=aZ(e,Bs.activeCarrierId);mo({loading:!1,state:e,options:t,activeCarrierId:n,error:null})}async function zS(e,t){mo({savingActionId:e,error:null});try{const n=await t();return T3(n.state,Bs.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),mo({savingActionId:null}),!0}catch(n){const i=R3(n);return mo({error:i}),await wp(),mo({savingActionId:null,error:i}),!1}}function $S(){return Bs.state?.carriers.find(e=>e.carrierId===Bs.activeCarrierId)??null}function aZ(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function mo(e){Bs={...Bs,...e};for(const t of I0)t()}function R3(e){return e instanceof Error?e.message:String(e)}const oZ=50,M3=2400,lZ={nimitz:"var(--captain-nimitz)",genesis:"var(--captain-genesis)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)"},cZ={id:"carriers",title:e=>wt(e)("terminal.carriers.title"),render:()=>u.jsx(uZ,{})};function uZ(){const e=wt(Fs()),t=tZ(),n=t.state?.carriers.find(N=>N.carrierId===t.activeCarrierId)??null,[i,s]=_.useState(!1),[o,l]=_.useState(""),[d,f]=_.useState("idle"),[p,m]=_.useState({}),y=p.carrierId===n?.carrierId?p:{},b=y.cli??n?.cliType,w=t.options?.cliTypes.find(N=>N.id===b)??null,S=y.model??n?.model,x=w?.models.find(N=>N.modelId===S)??null,k=t.savingActionId!==null;_.useEffect(()=>{const N=new AbortController;return wp(N.signal),()=>N.abort()},[]),_.useEffect(()=>{s(!1),l(n?.displayName??""),f("idle"),m({})},[n?.carrierId]),_.useEffect(()=>{if(d!=="saved")return;const N=window.setTimeout(()=>f("idle"),M3);return()=>window.clearTimeout(N)},[d]);async function L(N){const V=Wc().activeCarrierId;f("saving");const K=await N();return Wc().activeCarrierId===V&&(m({}),f(K?"saved":"idle")),K}async function F(){!n||k||(s(!1),o!==n.displayName&&await L(()=>Vf({displayName:o})))}function q(){l(n?.displayName??""),s(!1)}async function T(N){const V=t.options?.cliTypes.find(Q=>Q.id===N),K=V?.models.find(Q=>Q.modelId===V.defaultModel)??V?.models[0]??null;!n||!V||!K||(m({carrierId:n.carrierId,cli:N,model:K.modelId,effort:K.effort?.default??""}),await L(()=>Vf({cli:N,model:{model:K.modelId,...K.effort?.default?{effort:K.effort.default}:{}}})))}async function $(N){if(!n)return;const V=w?.models.find(K=>K.modelId===N)??null;m({carrierId:n.carrierId,model:N,effort:V?.effort?.default??""}),await L(()=>Vf({model:{model:N,...V?.effort?.default?{effort:V.effort.default}:{}}}))}async function I(N){n&&(m({carrierId:n.carrierId,effort:N}),await L(()=>Vf({model:{model:n.model,effort:N}})))}return u.jsxs(u.Fragment,{children:[t.error?u.jsx("p",{className:"terminal-carriers-error",role:"alert",children:t.error}):null,u.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":e("terminal.carriers.listAria"),children:[t.loading&&!t.state?u.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.loading")}):null,t.state&&t.state.carriers.length===0?u.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.empty")}):null,t.state?.carriers.map(N=>u.jsx(dZ,{carrier:N,active:N.carrierId===t.activeCarrierId,minBackends:t.options?.taskForceConstraints.minBackends??null,onSelect:()=>iZ(N.carrierId)},N.carrierId))]}),n&&t.options&&w?u.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:O3(n.carrierId),children:[u.jsxs("div",{className:"terminal-carriers-detail-head",children:[u.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[u.jsxs("div",{className:"terminal-carriers-captain-id",children:[u.jsx("span",{children:e("terminal.carriers.captain")})," · ",n.carrierId.toUpperCase()]}),u.jsx("div",{className:`terminal-carriers-name-line ${i?"is-editing":""}`,children:i?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":e("terminal.carriers.displayName"),value:o,maxLength:oZ,disabled:k,onChange:N=>l(N.target.value),onBlur:N=>{const V=N.relatedTarget;V instanceof HTMLElement&&V.closest("[data-display-name-action]")||F()},onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),F()):N.key==="Escape"&&(N.preventDefault(),q())}}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":e("terminal.carriers.saveDisplayNameAria"),disabled:k,onClick:()=>{F()},children:u.jsx(pZ,{})}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":e("terminal.carriers.cancelDisplayNameAria"),onClick:q,children:u.jsx(mZ,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"terminal-carriers-captain-name",children:n.displayName}),u.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":e("terminal.carriers.editDisplayNameAria"),disabled:k,onClick:()=>{l(n.displayName),s(!0)},children:u.jsx(fZ,{})})]})}),u.jsx("div",{className:"terminal-carriers-captain-role",children:n.role})]}),u.jsxs("div",{className:"terminal-carriers-detail-actions",children:[u.jsx("div",{className:`terminal-carriers-save-status ${d==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:d==="saving"?e("terminal.carriers.saving"):d==="saved"?e("terminal.carriers.saved"):""}),u.jsx("div",{className:"terminal-carriers-save-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:t.loading||k,onClick:()=>{wp()},children:e("terminal.carriers.refresh")})})]})]}),u.jsxs("div",{className:"terminal-carriers-body",children:[u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:e("terminal.carriers.identity")}),u.jsx("div",{className:"terminal-carriers-mission",children:n.roleDescription})]}),u.jsxs("div",{className:"terminal-carriers-control-group",children:[u.jsx("div",{className:"terminal-carriers-resp-title",children:e("terminal.carriers.runtime")}),u.jsxs("div",{className:"terminal-carriers-runtime",children:[u.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:u.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[u.jsx("span",{className:"terminal-carriers-label",id:"carrier-cli-label",children:e("terminal.carriers.cli")}),u.jsx(Oi,{"aria-labelledby":"carrier-cli-label",value:y.cli??n.cliType,disabled:k,options:t.options.cliTypes.map(N=>({value:N.id,label:N.displayName})),onChange:N=>{T(N)}})]})}),u.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[u.jsx(L3,{id:"carrier-model",label:e("terminal.carriers.model"),models:w.models,value:y.model??n.model,disabled:k,onChange:N=>{$(N)}}),u.jsx(N3,{id:"carrier-effort",model:x,value:y.effort??n.effort??"",disabled:k,onChange:N=>{I(N)}})]})]})]}),n.taskForceCapable?u.jsx(hZ,{carrier:n,cliOptions:t.options.cliTypes,minBackends:t.options.taskForceConstraints.minBackends,savingActionId:t.savingActionId,stateGeneration:t.state?.generation??0}):null]})]},n.carrierId):u.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[u.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.select")}),u.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:t.loading,onClick:()=>{wp()},children:e("terminal.carriers.refresh")})]})]})}function dZ({carrier:e,active:t,minBackends:n,onSelect:i}){const s=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return u.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:O3(e.carrierId),onClick:i,children:[u.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),u.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),s?u.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function L3({id:e,label:t,models:n,value:i,disabled:s=!1,onChange:o}){const l=`${e}-label`;return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",id:l,children:t}),u.jsx(Oi,{"aria-labelledby":l,value:i,disabled:s,options:n.map(d=>({value:d.modelId,label:d.name})),onChange:o})]})}function N3({id:e,model:t,value:n,disabled:i=!1,onChange:s}){const o=wt(Fs());if(!t?.effort)return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",children:o("terminal.carriers.effort")}),u.jsx("p",{className:"terminal-carriers-help",children:o("terminal.carriers.effortUnsupported")})]});const l=`${e}-label`;return u.jsxs("div",{className:"terminal-carriers-field",children:[u.jsx("span",{className:"terminal-carriers-label",id:l,children:o("terminal.carriers.effort")}),u.jsx(Oi,{"aria-labelledby":l,value:n||t.effort.default,disabled:i,options:t.effort.levels.map(d=>({value:d,label:d})),onChange:s})]})}function hZ({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,stateGeneration:s}){const o=wt(Fs()),l=e.taskforce.backends.length,[d,f]=_.useState(l>0),[p,m]=_.useState(!1),[y,b]=_.useState(""),[w,S]=_.useState(null),[x,k]=_.useState({}),[L,F]=_.useState({}),q=e.taskforce.backends.length>=n,T=t.filter(B=>!e.taskforce.backends.some(M=>M.cliType===B.id)),$=y||T[0]?.id||"",I=i!==null,N=l>0?q?o(l===1?"terminal.carriers.tf.helpActive_one":"terminal.carriers.tf.helpActive_other",{count:l}):o(l===1?"terminal.carriers.tf.helpNeeds_one":"terminal.carriers.tf.helpNeeds_other",{count:l,minBackends:n}):o("terminal.carriers.tf.helpEmpty",{minBackends:n});_.useEffect(()=>{S(null)},[s]),_.useEffect(()=>{if(!w)return;const B=M=>{const D=M.target;(!(D instanceof Element)||!D.closest(`[data-remove-cli="${w}"]`))&&S(null)};return document.addEventListener("click",B,!0),()=>document.removeEventListener("click",B,!0)},[w]),_.useEffect(()=>{const B=Object.entries(x).filter(([,D])=>D==="saved").map(([D])=>D);if(B.length===0)return;const M=window.setTimeout(()=>{k(D=>{const j={...D};for(const A of B)j[A]="idle";return j})},M3);return()=>window.clearTimeout(M)},[x]);async function V(B,M,D,j={}){const A=e.carrierId;F(C=>({...C,...j})),k(C=>({...C,[B]:"saving"}));const O=await rZ(B,{model:M,...D?{effort:D}:{}});return Wc().activeCarrierId===A&&(F({}),k(C=>({...C,[B]:O?"saved":"idle"})),O&&S(null)),O}async function K(B,M){if(!e.taskforce.backends.find(O=>O.cliType===B.id))return;const A=(B.models.find(O=>O.modelId===M)??null)?.effort?.default??"";await V(B.id,M,A,{[`tf:${B.id}:model`]:M,[`tf:${B.id}:effort`]:A})}async function Q(B,M,D){await V(B,M,D,{[`tf:${B}:effort`]:D})}async function Y(B){if(w!==B){S(B);return}const M=e.carrierId;k(j=>({...j,[B]:"saving"}));const D=await sZ(B);Wc().activeCarrierId===M&&(F({}),k(j=>({...j,[B]:D?"saved":"idle"})),D&&S(null))}return u.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${d?"is-expanded":""}`,children:[u.jsxs("div",{className:"terminal-carriers-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"terminal-carriers-resp-title",children:o("terminal.carriers.taskForce")}),u.jsx("p",{className:"terminal-carriers-help",children:N})]}),u.jsx("div",{className:"terminal-carriers-tf-head-actions",children:u.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":d,onClick:()=>f(B=>!B),children:o(d?"terminal.carriers.tf.hide":"terminal.carriers.tf.configure")})})]}),d?u.jsxs("div",{className:"terminal-carriers-tf-list",children:[e.taskforce.backends.length===0?u.jsx("p",{className:"terminal-carriers-tf-empty",children:o("terminal.carriers.tf.empty")}):null,e.taskforce.backends.map(B=>{const M=t.find(P=>P.id===B.cliType);if(!M)return null;const D=L[`tf:${M.id}:model`]??B.model,j=L[`tf:${M.id}:effort`]??B.effort??"",A=M.models.find(P=>P.modelId===D)??M.models[0]??null,O=x[M.id]??"idle",C=w===M.id,z=e.taskforce.backends.length-1<n?o("terminal.carriers.tf.confirmDeactivate"):o("terminal.carriers.tf.confirmRemove");return u.jsxs("div",{className:"terminal-carriers-tf-item is-active",children:[u.jsxs("div",{className:"terminal-carriers-tf-title",children:[u.jsx("span",{className:`terminal-carriers-live-dot ${q?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:M.displayName}),u.jsx("span",{className:`terminal-carriers-tf-status ${O==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:O==="saving"?o("terminal.carriers.saving"):O==="saved"?o("terminal.carriers.saved"):""})]}),u.jsx(L3,{id:`tf-${M.id}-model`,label:o("terminal.carriers.model"),models:M.models,value:D,disabled:I,onChange:P=>{K(M,P)}}),u.jsx(N3,{id:`tf-${M.id}-effort`,model:A,value:j,disabled:I,onChange:P=>{Q(M.id,D,P)}}),u.jsx("div",{className:"terminal-carriers-tf-actions",children:u.jsx("button",{type:"button",className:`terminal-carriers-ghost-button terminal-carriers-tf-remove ${C?"is-armed":""}`,"data-remove-cli":M.id,"aria-label":C?o("terminal.carriers.tf.confirmRemovalAria",{name:M.displayName}):void 0,disabled:I,onClick:()=>{Y(M.id)},children:C?z:o("terminal.carriers.tf.remove")})})]},M.id)}),u.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[p&&T.length>0?u.jsx(Oi,{className:"terminal-carriers-tf-add-select",label:o("terminal.carriers.tf.addCliLabel"),value:$,disabled:I,options:T.map(B=>({value:B.id,label:B.displayName})),onChange:B=>b(B)}):null,u.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:T.length===0||I,onClick:()=>{if(!p){m(!0);return}const B=$,M=t.find(j=>j.id===B),D=M?.models.find(j=>j.modelId===M.defaultModel)??M?.models[0]??null;!M||!D||V(M.id,D.modelId,D.effort?.default??"").then(j=>{j&&(b(""),m(!1))})},children:o("terminal.carriers.tf.add")})]})]}):null]})}function O3(e){return{"--cap-color":lZ[e]??"var(--brass)"}}function fZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function pZ(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function mZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const gZ="global-shell:theater:",yZ="/plugins/terminal/global/ticket",_Z="/plugins/terminal/ws",vZ=168,bZ={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},wZ={id:"global-shell",title:e=>wt(e)("terminal.kind.shell"),icon:SZ,preferredExtraWidth:vZ,render:e=>u.jsx("div",{style:bZ,children:u.jsx(pS,{operationId:`${gZ}${encodeURIComponent(e.theaterId??"")}`,ticketPath:yZ,wsPath:_Z,theme:"instrument",active:!0})})};function SZ(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const xZ="/plugins/terminal/shell/ticket",CZ="/plugins/terminal/ws",I3={pluginId:"terminal",type:"shell",title:e=>wt(e)("terminal.kind.shell"),subtitle:()=>"shell",render:e=>_.createElement(kZ,{context:e})},cv={id:"terminal",operationKinds:[I3],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:wt("en")("terminal.kind.shell"),payload:{theaterId:e}})).id}),renderLaunchIcon:()=>u.jsx(EZ,{})};function kZ({context:e}){const t=wt(e.language??"en"),[n,i]=_.useState(!1);return e.operation.payload.restoredDormant===!0&&!n?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{e.api.fetch("terminal",`shell/sessions/${encodeURIComponent(e.operationId)}/relaunch`,{method:"POST"}).then(o=>{if(!o.ok)throw new Error("shell_relaunch_failed");i(!0),e.api.resync()}).catch(()=>{})},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:t("terminal.dormant.status")}),u.jsx("span",{className:"canvas-operation-dormant-action",children:t("terminal.shell.relaunch")})]}):u.jsx(pS,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:xZ,wsPath:CZ,theme:e.theme,onExit:e.onClose})}function EZ(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),u.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const AZ=new Set(["agent"]),TZ={id:"terminal",operationKinds:[I3,b3],settingsSections:[w3,S3,cZ],notificationKinds:[x3],railPanels:[wZ],install:e=>(dN(),VW(e.settings),hd.install?.(e)),closeOperation:async e=>{const t=await sT(e);if(t?.type==="shell"){await cv.closeOperation?.(e);return}t&&AZ.has(t.type)&&await hd.closeOperation?.(e)},resumeOperation:async e=>{let t=null;try{t=await sT(e)}catch{t=null}t?.type!=="shell"&&await hd.resumeOperation?.(e)},launch:async e=>e.kind.type==="shell"?cv.launch?.(e)??{id:""}:hd.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?cv.renderLaunchIcon?.(e):hd.renderLaunchIcon?.(e)},RZ=[TZ];async function sT(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 MZ={"fileExplorer.panel.title":"Files","fileExplorer.status.loading":"Loading…","fileExplorer.status.unableToLoadFile":"Unable to load file","fileExplorer.status.selectTheater":"Select a Theater","fileExplorer.status.emptyFolder":"This folder is empty","fileExplorer.status.noMatchingItems":"No matching items","fileExplorer.status.onlyHiddenItems":"Only hidden items — use the eye icon to show them","fileExplorer.filter.placeholder":"Filter…","fileExplorer.filter.clear":"Clear filter","fileExplorer.filter.aria":"Filter files","fileExplorer.tree.refresh":"Refresh file tree","fileExplorer.tree.aria":"File tree","fileExplorer.tree.parentFolder":"Parent folder","fileExplorer.tree.hideHidden":"Hide hidden files","fileExplorer.tree.showHidden":"Show hidden files","fileExplorer.viewer.close":"Close viewer","fileExplorer.viewer.binaryHint":"Binary files can't be previewed","fileExplorer.viewer.truncated":"File is too large — showing a partial preview","fileExplorer.viewer.fileContentsAria":"File contents","fileExplorer.viewer.imageBlocked":"Image blocked","fileExplorer.viewer.imageBlockedNamed":"Image blocked: {alt}","fileExplorer.markdown.copy":"Copy","fileExplorer.markdown.copyCodeAria":"Copy {language} code","fileExplorer.markdown.copied":"Copied","fileExplorer.diagram.renderFailed":"Diagram render failed: {message}","fileExplorer.diagram.openExpandedAria":"Open diagram in expanded view","fileExplorer.diagram.lightboxTitle":"MANIFEST · DIAGRAM","fileExplorer.diagram.close":"Close","fileExplorer.diagram.closeExpandedAria":"Close expanded diagram","fileExplorer.diagram.zoomControlsAria":"Diagram zoom controls","fileExplorer.diagram.zoomOutAria":"Zoom out","fileExplorer.diagram.zoomInAria":"Zoom in","fileExplorer.diagram.fit":"Fit","fileExplorer.diagram.fitAria":"Fit diagram to viewport","fileExplorer.diagram.reset":"Reset","fileExplorer.diagram.resetAria":"Reset diagram zoom","fileExplorer.error.unableToLoadFolder":"Unable to load folder","fileExplorer.error.methodNotAllowed":"Method not allowed","fileExplorer.error.unauthorized":"unauthorized","fileExplorer.error.invalidRequest":"invalid_request","fileExplorer.error.invalidPath":"invalid_path","fileExplorer.error.theaterNotFound":"theater_not_found","fileExplorer.error.forbidden":"forbidden","fileExplorer.error.notFound":"not_found","fileExplorer.error.pathOutsideTheater":"path_outside_theater","fileExplorer.error.notAFile":"not_a_file","fileExplorer.error.mimeNotAllowed":"mime_not_allowed","fileExplorer.error.sizeExceeded":"size_exceeded","fileExplorer.error.searchFailed":"search_failed","fileExplorer.error.listFailed":"list_failed","fileExplorer.error.readFailed":"read_failed","fileExplorer.error.noTheater":"no_theater"},LZ={"fileExplorer.panel.title":"파일","fileExplorer.status.loading":"불러오는 중…","fileExplorer.status.unableToLoadFile":"파일을 불러올 수 없습니다","fileExplorer.status.selectTheater":"Theater를 선택하세요","fileExplorer.status.emptyFolder":"이 폴더는 비어 있습니다","fileExplorer.status.noMatchingItems":"일치하는 항목이 없습니다","fileExplorer.status.onlyHiddenItems":"숨김 항목만 있습니다 — 눈 아이콘으로 표시하세요","fileExplorer.filter.placeholder":"필터…","fileExplorer.filter.clear":"필터 지우기","fileExplorer.filter.aria":"파일 필터","fileExplorer.tree.refresh":"파일 트리 새로고침","fileExplorer.tree.aria":"파일 트리","fileExplorer.tree.parentFolder":"상위 폴더","fileExplorer.tree.hideHidden":"숨김 파일 숨기기","fileExplorer.tree.showHidden":"숨김 파일 표시","fileExplorer.viewer.close":"뷰어 닫기","fileExplorer.viewer.binaryHint":"바이너리 파일은 미리볼 수 없습니다","fileExplorer.viewer.truncated":"파일이 너무 커서 일부만 미리봅니다","fileExplorer.viewer.fileContentsAria":"파일 내용","fileExplorer.viewer.imageBlocked":"이미지가 차단됨","fileExplorer.viewer.imageBlockedNamed":"이미지 차단됨: {alt}","fileExplorer.markdown.copy":"복사","fileExplorer.markdown.copyCodeAria":"{language} 코드 복사","fileExplorer.markdown.copied":"복사됨","fileExplorer.diagram.renderFailed":"다이어그램 렌더 실패: {message}","fileExplorer.diagram.openExpandedAria":"다이어그램을 확대 보기로 열기","fileExplorer.diagram.lightboxTitle":"MANIFEST · DIAGRAM","fileExplorer.diagram.close":"닫기","fileExplorer.diagram.closeExpandedAria":"확대된 다이어그램 닫기","fileExplorer.diagram.zoomControlsAria":"다이어그램 확대/축소 컨트롤","fileExplorer.diagram.zoomOutAria":"축소","fileExplorer.diagram.zoomInAria":"확대","fileExplorer.diagram.fit":"맞춤","fileExplorer.diagram.fitAria":"뷰포트에 다이어그램 맞추기","fileExplorer.diagram.reset":"초기화","fileExplorer.diagram.resetAria":"다이어그램 확대/축소 초기화","fileExplorer.error.unableToLoadFolder":"폴더를 불러올 수 없습니다","fileExplorer.error.methodNotAllowed":"허용되지 않은 요청 방식입니다","fileExplorer.error.unauthorized":"권한이 없습니다","fileExplorer.error.invalidRequest":"잘못된 요청입니다","fileExplorer.error.invalidPath":"잘못된 경로입니다","fileExplorer.error.theaterNotFound":"Theater를 찾을 수 없습니다","fileExplorer.error.forbidden":"접근이 거부되었습니다","fileExplorer.error.notFound":"찾을 수 없습니다","fileExplorer.error.pathOutsideTheater":"Theater 밖 경로입니다","fileExplorer.error.notAFile":"파일이 아닙니다","fileExplorer.error.mimeNotAllowed":"허용되지 않은 이미지 형식입니다","fileExplorer.error.sizeExceeded":"파일 크기 제한을 초과했습니다","fileExplorer.error.searchFailed":"검색에 실패했습니다","fileExplorer.error.listFailed":"목록을 불러오지 못했습니다","fileExplorer.error.readFailed":"파일을 읽지 못했습니다","fileExplorer.error.noTheater":"Theater가 선택되지 않았습니다"},aT={en:MZ,ko:LZ},NZ={en:Ns(aT,"en"),ko:Ns(aT,"ko")};function FS(e){return NZ[e??"en"]}function OZ(e){return{copyLabel:e("fileExplorer.markdown.copy"),copyAriaLabel:t=>e("fileExplorer.markdown.copyCodeAria",{language:t})}}function IZ(e){return{renderFailed:t=>e("fileExplorer.diagram.renderFailed",{message:t}),openExpandedAria:e("fileExplorer.diagram.openExpandedAria"),lightboxTitle:e("fileExplorer.diagram.lightboxTitle"),close:e("fileExplorer.diagram.close"),closeExpandedAria:e("fileExplorer.diagram.closeExpandedAria"),zoomControlsAria:e("fileExplorer.diagram.zoomControlsAria"),zoomOutAria:e("fileExplorer.diagram.zoomOutAria"),zoomInAria:e("fileExplorer.diagram.zoomInAria"),fit:e("fileExplorer.diagram.fit"),fitAria:e("fileExplorer.diagram.fitAria"),reset:e("fileExplorer.diagram.reset"),resetAria:e("fileExplorer.diagram.resetAria")}}const DZ={"Method not allowed":"fileExplorer.error.methodNotAllowed",unauthorized:"fileExplorer.error.unauthorized",invalid_request:"fileExplorer.error.invalidRequest",invalid_path:"fileExplorer.error.invalidPath",theater_not_found:"fileExplorer.error.theaterNotFound",forbidden:"fileExplorer.error.forbidden",not_found:"fileExplorer.error.notFound",path_outside_theater:"fileExplorer.error.pathOutsideTheater",not_a_file:"fileExplorer.error.notAFile",mime_not_allowed:"fileExplorer.error.mimeNotAllowed",size_exceeded:"fileExplorer.error.sizeExceeded",search_failed:"fileExplorer.error.searchFailed",list_failed:"fileExplorer.error.listFailed",read_failed:"fileExplorer.error.readFailed",no_theater:"fileExplorer.error.noTheater","Unable to load file":"fileExplorer.status.unableToLoadFile","Unable to load folder":"fileExplorer.error.unableToLoadFolder"};function fm(e,t){const n=DZ[e];return n===void 0?e:t(n)}const ae={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"},jZ={src:ae.ts,lib:ae.ts,app:ae.ts,test:ae.shell,tests:ae.shell,__tests__:ae.shell,spec:ae.shell,specs:ae.shell,node_modules:ae.binary,vendor:ae.binary,dist:ae.config,build:ae.config,out:ae.config,target:ae.config,docs:ae.md,doc:ae.md,public:ae.data,assets:ae.data,static:ae.data,components:ae.image,scripts:ae.js,styles:ae.css,".git":ae.html,".github":ae.config,".vscode":ae.css},oT={ts:{shape:"angle",tone:ae.ts},tsx:{shape:"angle",tone:ae.ts},mts:{shape:"angle",tone:ae.ts},cts:{shape:"angle",tone:ae.ts},"d.ts":{shape:"angle",tone:ae.ts},js:{shape:"angle",tone:ae.js},jsx:{shape:"angle",tone:ae.js},mjs:{shape:"angle",tone:ae.js},cjs:{shape:"angle",tone:ae.js},json:{shape:"braces",tone:ae.json},jsonc:{shape:"braces",tone:ae.json},json5:{shape:"braces",tone:ae.json},jsonl:{shape:"braces",tone:ae.json},graphql:{shape:"braces",tone:ae.image},gql:{shape:"braces",tone:ae.image},proto:{shape:"braces",tone:ae.go},css:{shape:"hash",tone:ae.css},scss:{shape:"hash",tone:ae.css},sass:{shape:"hash",tone:ae.css},less:{shape:"hash",tone:ae.css},styl:{shape:"hash",tone:ae.css},html:{shape:"markup",tone:ae.html},htm:{shape:"markup",tone:ae.html},xml:{shape:"markup",tone:ae.html},xhtml:{shape:"markup",tone:ae.html},vue:{shape:"markup",tone:ae.shell},svelte:{shape:"markup",tone:ae.rust},astro:{shape:"markup",tone:ae.image},md:{shape:"doc",tone:ae.md},mdx:{shape:"doc",tone:ae.md},markdown:{shape:"doc",tone:ae.md},rst:{shape:"doc",tone:ae.md},txt:{shape:"doc",tone:ae.default},text:{shape:"doc",tone:ae.default},log:{shape:"doc",tone:ae.default},adoc:{shape:"doc",tone:ae.md},pdf:{shape:"doc",tone:ae.ruby},py:{shape:"angle",tone:ae.py},pyi:{shape:"angle",tone:ae.py},pyw:{shape:"angle",tone:ae.py},go:{shape:"angle",tone:ae.go},rs:{shape:"angle",tone:ae.rust},rb:{shape:"angle",tone:ae.ruby},rake:{shape:"angle",tone:ae.ruby},gemspec:{shape:"angle",tone:ae.ruby},java:{shape:"angle",tone:ae.html},kt:{shape:"angle",tone:ae.config},kts:{shape:"angle",tone:ae.config},scala:{shape:"angle",tone:ae.ruby},c:{shape:"angle",tone:ae.ts},h:{shape:"angle",tone:ae.ts},cpp:{shape:"angle",tone:ae.css},cc:{shape:"angle",tone:ae.css},cxx:{shape:"angle",tone:ae.css},hpp:{shape:"angle",tone:ae.css},cs:{shape:"angle",tone:ae.config},php:{shape:"angle",tone:ae.config},swift:{shape:"angle",tone:ae.html},lua:{shape:"angle",tone:ae.ts},dart:{shape:"angle",tone:ae.go},sh:{shape:"terminal",tone:ae.shell},bash:{shape:"terminal",tone:ae.shell},zsh:{shape:"terminal",tone:ae.shell},fish:{shape:"terminal",tone:ae.shell},ps1:{shape:"terminal",tone:ae.css},bat:{shape:"terminal",tone:ae.shell},cmd:{shape:"terminal",tone:ae.shell},yaml:{shape:"gear",tone:ae.config},yml:{shape:"gear",tone:ae.config},toml:{shape:"gear",tone:ae.config},ini:{shape:"gear",tone:ae.config},conf:{shape:"gear",tone:ae.config},cfg:{shape:"gear",tone:ae.config},properties:{shape:"gear",tone:ae.config},env:{shape:"gear",tone:ae.config},editorconfig:{shape:"gear",tone:ae.config},png:{shape:"image",tone:ae.image},jpg:{shape:"image",tone:ae.image},jpeg:{shape:"image",tone:ae.image},gif:{shape:"image",tone:ae.image},webp:{shape:"image",tone:ae.image},svg:{shape:"image",tone:ae.image},ico:{shape:"image",tone:ae.image},bmp:{shape:"image",tone:ae.image},avif:{shape:"image",tone:ae.image},tiff:{shape:"image",tone:ae.image},heic:{shape:"image",tone:ae.image},mp4:{shape:"image",tone:ae.data},mov:{shape:"image",tone:ae.data},webm:{shape:"image",tone:ae.data},mkv:{shape:"image",tone:ae.data},mp3:{shape:"chip",tone:ae.shell},wav:{shape:"chip",tone:ae.shell},flac:{shape:"chip",tone:ae.shell},ogg:{shape:"chip",tone:ae.shell},sql:{shape:"database",tone:ae.data},csv:{shape:"database",tone:ae.data},tsv:{shape:"database",tone:ae.data},db:{shape:"database",tone:ae.data},sqlite:{shape:"database",tone:ae.data},sqlite3:{shape:"database",tone:ae.data},parquet:{shape:"database",tone:ae.data},zip:{shape:"archive",tone:ae.archive},tar:{shape:"archive",tone:ae.archive},gz:{shape:"archive",tone:ae.archive},tgz:{shape:"archive",tone:ae.archive},bz2:{shape:"archive",tone:ae.archive},xz:{shape:"archive",tone:ae.archive},rar:{shape:"archive",tone:ae.archive},"7z":{shape:"archive",tone:ae.archive},zst:{shape:"archive",tone:ae.archive},bin:{shape:"chip",tone:ae.binary},exe:{shape:"chip",tone:ae.binary},dll:{shape:"chip",tone:ae.binary},so:{shape:"chip",tone:ae.binary},dylib:{shape:"chip",tone:ae.binary},wasm:{shape:"chip",tone:ae.config},class:{shape:"chip",tone:ae.binary},lock:{shape:"chip",tone:ae.binary},woff:{shape:"chip",tone:ae.config},woff2:{shape:"chip",tone:ae.config},ttf:{shape:"chip",tone:ae.config},otf:{shape:"chip",tone:ae.config}},BZ={dockerfile:{shape:"chip",tone:ae.css},"docker-compose.yml":{shape:"gear",tone:ae.css},"docker-compose.yaml":{shape:"gear",tone:ae.css},makefile:{shape:"gear",tone:ae.html},"cmakelists.txt":{shape:"gear",tone:ae.html},".gitignore":{shape:"gear",tone:ae.html},".gitattributes":{shape:"gear",tone:ae.html},".dockerignore":{shape:"gear",tone:ae.html},".npmignore":{shape:"gear",tone:ae.html},".npmrc":{shape:"gear",tone:ae.ruby},"package.json":{shape:"braces",tone:ae.shell},"tsconfig.json":{shape:"braces",tone:ae.ts},license:{shape:"doc",tone:ae.json},"license.md":{shape:"doc",tone:ae.json},licence:{shape:"doc",tone:ae.json}},PZ={shape:"default",tone:ae.default},D0={angle:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),u.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),u.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:u.jsxs(u.Fragment,{children:[u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function zZ({name:e}){const t=FZ(e);return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:D0[t.shape]})}function $Z({name:e,open:t}){const n=jZ[e.toLowerCase()]??ae.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?D0.folderOpen:D0.folderClosed})}function FZ(e){const t=e.toLowerCase(),n=BZ[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:ae.config};if(t.startsWith("readme"))return{shape:"doc",tone:ae.md};if(t.endsWith(".d.ts"))return oT["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const s=t.slice(i+1),o=oT[s];if(o)return o}return PZ}const HZ=200,dc=30,lT=5,HS="fleet-console.fileExplorer.showHidden",cT=500;function Ur(e,t){return e===t}async function UZ({entries:e,cachedResults:t,files:n,showHidden:i,isCurrent:s,onFolderResult:o}){const l=[],d=new Map(t),f=new Set,p=new Set;let m=0;const y=b=>{for(const w of b)if(!(!GZ(w,i)||f.has(w.relativePath))){if(f.size>=cT)return;f.add(w.relativePath),l.push(w)}};for(y(e);l.length>0&&s();){const b=l.shift();if(!b)return;const w=d.get(b.relativePath);if(w){if(p.has(w.relativePath))continue;p.add(w.relativePath),y(w.entries);continue}if(m>=cT)return;m+=1;try{const S=await n.listFolder(b.relativePath);if(!s())return;if(d.set(b.relativePath,S),o(b.relativePath,S),p.has(S.relativePath))continue;p.add(S.relativePath),y(S.entries)}catch{}}}function D3(e,t,n,i,s,o,l,d,f=new Set,p=new Set){const m=[];for(const y of e){if(!d&&y.name.startsWith("."))continue;const b=o.get(y.relativePath),w=b?.entries,S=b?.relativePath??y.relativePath,x=y.kind==="dir"&&f.has(S),k=y.kind==="dir"&&!x&&j3(w??[],o,l,d);if(l&&!y.name.toLowerCase().includes(l)&&!k)continue;const L=!p.has(y.relativePath)&&(i.has(y.relativePath)||!!(l&&k));if(m.push({entry:y,depth:t,isSelected:n===y.relativePath,isExpanded:L,isLoading:s.has(y.relativePath)}),y.kind==="dir"&&L&&!x&&w){const F=new Set(f);F.add(S),m.push(...D3(w,t+1,n,i,s,o,l,d,F,p))}}return m}function WZ(e,t,n){const i=e[t];if(!i)return{kind:"none"};if(n==="ArrowDown")return{kind:"focus",index:Math.min(e.length-1,t+1)};if(n==="ArrowUp")return{kind:"focus",index:Math.max(0,t-1)};if(n==="Home")return{kind:"focus",index:0};if(n==="End")return{kind:"focus",index:e.length-1};if(n==="ArrowRight")return i.entry.kind!=="dir"?{kind:"none"}:i.isExpanded?e[t+1]?.depth===i.depth+1?{kind:"focus",index:t+1}:{kind:"none"}:{kind:"expand"};if(n==="ArrowLeft"){if(i.entry.kind==="dir"&&i.isExpanded)return{kind:"collapse"};for(let s=t-1;s>=0;s-=1)if(e[s]?.depth===i.depth-1)return{kind:"focus",index:s};return{kind:"none"}}return n==="Enter"||n===" "?{kind:"activate"}:{kind:"none"}}function qZ({contextKey:e,files:t,theaterId:n,selectedPath:i,revealTarget:s,onSelect:o,t:l}){const[d,f]=_.useState(null),[p,m]=_.useState(null),[y,b]=_.useState(""),[w,S]=_.useState(new Set),[x,k]=_.useState(new Set),[L,F]=_.useState(new Map),[q,T]=_.useState(""),[$,I]=_.useState(new Set),[N,V]=_.useState(0),[K,Q]=_.useState(600),[Y,B]=_.useState(()=>KZ()),[M,D]=_.useState(null),j=_.useRef(null),A=_.useRef(new Map),O=_.useRef(null),C=_.useRef(0),z=_.useRef(w);z.current=w;const P=_.useRef(y);P.current=y;const R=_.useRef(t);R.current=t;const W=_.useRef(e);W.current=e;const G=_.useRef(L);G.current=L;const U=_.useRef(0),ee=!!q;_.useEffect(()=>{n&&(f(null),m(null),b(""),S(new Set),F(new Map),T(""),I(new Set),V(0),D(null))},[e,n]),_.useEffect(()=>{if(!n)return;const we=e;t.listFolder(y||void 0).then(De=>{Ur(we,W.current)&&(f(De),m(null))}).catch(De=>{if(!Ur(we,W.current))return;const de=De instanceof Error?De.message:"Unable to load folder";m(fm(de,l))})},[e,n,y,t,l]),_.useEffect(()=>{if(!s||s.theaterId!==n||s.requestId<=C.current)return;let we=!0;const De=e;return(async()=>{const Pe=await t.listFolder(),st=new Map,ft=new Set,Dt=s.relativePath.split("/").filter(Boolean);let Gt="";for(const _t of Dt.slice(0,-1)){Gt=Gt?`${Gt}/${_t}`:_t;const Tt=await t.listFolder(Gt);st.set(Gt,Tt),ft.add(Gt)}!we||!Ur(De,W.current)||(T(""),I(new Set),Dt.some(_t=>_t.startsWith("."))&&(B(!0),VZ(!0)),b(""),f(Pe),F(_t=>{const Tt=new Map(_t);for(const[Ne,jt]of st)Tt.set(Ne,jt);return Tt}),S(_t=>new Set([..._t,...ft])),D(s.relativePath))})().catch(()=>{}),()=>{we=!1}},[e,t,s,n]),_.useEffect(()=>{const we=++U.current;if(!ee||!d)return;let De=!0;const de=e,Pe=()=>De&&we===U.current&&Ur(de,W.current);return UZ({entries:d.entries,cachedResults:G.current,files:t,showHidden:Y,isCurrent:Pe,onFolderResult:(st,ft)=>{Pe()&&F(Dt=>new Map(Dt).set(st,ft))}}),()=>{De=!1}},[e,t,ee,d,Y]),_.useEffect(()=>{const we=j.current;if(!we)return;const De=new ResizeObserver(()=>Q(we.clientHeight));return De.observe(we),Q(we.clientHeight),()=>De.disconnect()},[]),_.useEffect(()=>{if(!n)return;let we=!0;const De=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,de=new EventSource(De),Pe=()=>{const ft=e;R.current.listFolder(P.current||void 0).then(Dt=>{Ur(ft,W.current)&&(f(Dt),m(null))}).catch(()=>{})},st=()=>{Pe();for(const ft of z.current){const Dt=e;R.current.listFolder(ft).then(Gt=>{Ur(Dt,W.current)&&F(_t=>new Map(_t).set(ft,Gt))}).catch(()=>{})}};return de.addEventListener("change",ft=>{let Dt;try{Dt=JSON.parse(ft.data)}catch{return}if(typeof Dt=="string"&&((Dt===""||Dt===P.current)&&Pe(),Dt!==""&&z.current.has(Dt))){const Gt=e;R.current.listFolder(Dt).then(_t=>{Ur(Gt,W.current)&&F(Tt=>new Map(Tt).set(Dt,_t))}).catch(()=>{})}}),de.onopen=()=>{if(we){we=!1;return}st()},()=>{de.close()}},[e,n,t]);const ne=_.useCallback(we=>{const De=we.relativePath,de=!w.has(De);if(S(Pe=>{const st=new Set(Pe);return st.has(De)?(st.delete(De),st):(st.add(De),st)}),de){const Pe=e;k(st=>new Set(st).add(De)),t.listFolder(De).then(st=>{Ur(Pe,W.current)&&(F(ft=>new Map(ft).set(De,st)),k(ft=>{const Dt=new Set(ft);return Dt.delete(De),Dt}))}).catch(()=>{Ur(Pe,W.current)&&k(st=>{const ft=new Set(st);return ft.delete(De),ft})})}},[e,t,w]),me=_.useCallback(we=>{V(we.currentTarget.scrollTop)},[]),Me=_.useCallback(()=>{B(we=>{const De=!we;try{localStorage.setItem(HS,De?"1":"0")}catch{}return De})},[]),ve=_.useCallback(()=>{if(!n)return;const we=e;t.listFolder(y||void 0).then(De=>{Ur(we,W.current)&&(f(De),m(null))}).catch(De=>{if(!Ur(we,W.current))return;const de=De instanceof Error?De.message:"Unable to load folder";m(fm(de,l))});for(const De of w)t.listFolder(De).then(de=>{Ur(we,W.current)&&F(Pe=>new Map(Pe).set(De,de))}).catch(()=>{})},[e,t,y,w,n,l]),Ye=q.toLowerCase(),qe=_.useMemo(()=>d?D3(d.entries,0,i,w,x,L,Ye,Y,new Set,$):[],[d,i,w,x,L,Ye,Y,$]),yt=!Y&&d!==null&&d.entries.length>0&&qe.length===0&&!q,$e=qe.length>HZ,We=$e?Math.max(0,Math.floor(N/dc)-lT):0,mt=$e?Math.min(qe.length,Math.ceil((N+K)/dc)+lT):qe.length,ot=qe.slice(We,mt),Nt=qe.length*dc,Ot=We*dc,kt=i&&qe.some(we=>we.entry.relativePath===i)?i:null,ye=M&&qe.some(we=>we.entry.relativePath===M)?M:kt??qe[0]?.entry.relativePath??null,ze=ot.some(we=>we.entry.relativePath===ye)?ye:ot[0]?.entry.relativePath??null;_.useEffect(()=>{ze!==M&&D(ze)},[M,ze]),_.useLayoutEffect(()=>{const we=O.current;we===null||we!==ze||(O.current=null,A.current.get(we)?.focus())},[ze,ot]),_.useLayoutEffect(()=>{if(!s||s.requestId<=C.current)return;const we=qe.findIndex(de=>de.entry.relativePath===s.relativePath);if(we<0)return;if(D(s.relativePath),$e&&(we<We||we>=mt)){const de=Math.max(0,we*dc);j.current&&(j.current.scrollTop=de),V(de);return}const De=A.current.get(s.relativePath);De&&(De.scrollIntoView({block:"nearest"}),C.current=s.requestId)},[mt,qe,s,$e,We,ot]);const Je=we=>{const De=qe[we];if(!De)return;const de=De.entry.relativePath;if(de===ze){O.current=null,A.current.get(de)?.focus();return}if(O.current=de,D(de),$e&&(we<We||we>=mt)){const Pe=Math.max(0,we*dc);j.current&&(j.current.scrollTop=Pe),V(Pe)}},It=(we,De)=>{const de=qe.findIndex(st=>st.entry.relativePath===we.entry.relativePath);if(de<0)return;const Pe=WZ(qe,de,De.key);if(Pe.kind==="none"){(De.key==="ArrowRight"||De.key==="ArrowLeft")&&De.preventDefault();return}if(De.preventDefault(),Pe.kind==="focus"){Je(Pe.index);return}if(Pe.kind==="expand"){Ye?I(st=>{const ft=new Set(st);return ft.delete(we.entry.relativePath),ft}):ne(we.entry);return}if(Pe.kind==="collapse"){we.entry.kind==="dir"&&(Ye?I(st=>new Set(st).add(we.entry.relativePath)):S(st=>{const ft=new Set(st);return ft.delete(we.entry.relativePath),ft}));return}Ke(we)},Ke=we=>{if(we.entry.kind!=="dir"){o(we.entry);return}if(!Ye){ne(we.entry);return}I(De=>{const de=new Set(De);return we.isExpanded?de.add(we.entry.relativePath):de.delete(we.entry.relativePath),de})},en=we=>{D(we.entry.relativePath),Ke(we)};return n?p&&!d?u.jsx("div",{className:"fexp-tree-error",children:p}):d?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:l("fileExplorer.filter.placeholder"),value:q,onChange:we=>{T(we.target.value),I(new Set)},"aria-label":l("fileExplorer.filter.aria")}),q&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>{T(""),I(new Set)},"aria-label":l("fileExplorer.filter.clear"),children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:ve,"aria-label":l("fileExplorer.tree.refresh"),title:l("fileExplorer.tree.refresh"),children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${Y?" is-active":""}`,onClick:Me,"aria-pressed":Y,"aria-label":l(Y?"fileExplorer.tree.hideHidden":"fileExplorer.tree.showHidden"),title:l(Y?"fileExplorer.tree.hideHidden":"fileExplorer.tree.showHidden"),children:Y?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:j,className:"fexp-tree",role:"tree","aria-label":l("fileExplorer.tree.aria"),onScroll:$e?me:void 0,children:[!1,$e?u.jsx("div",{style:{height:Nt,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${Ot}px)`},children:ot.map(we=>u.jsx(uT,{row:we,cursor:we.entry.relativePath===ze,rowRefs:A,onEntryClick:en,onKeyDown:It},we.entry.relativePath))})}):ot.map(we=>u.jsx(uT,{row:we,cursor:we.entry.relativePath===ze,rowRefs:A,onEntryClick:en,onKeyDown:It},we.entry.relativePath)),qe.length===0&&q&&u.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.noMatchingItems")}),qe.length===0&&!q&&d.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.emptyFolder")}),yt&&u.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.onlyHiddenItems")})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:l("fileExplorer.status.loading")}):u.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.selectTheater")})}function j3(e,t,n,i,s=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 l=t.get(o.relativePath);if(l&&!s.has(l.relativePath)){const d=new Set(s);if(d.add(l.relativePath),j3(l.entries,t,n,i,d))return!0}}}return!1}function GZ(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function uT({row:e,cursor:t,rowRefs:n,onEntryClick:i,onKeyDown:s}){const{entry:o,depth:l,isSelected:d,isExpanded:f,isLoading:p}=e,m=o.kind==="dir",y=l*16,b=_.useCallback(()=>i(e),[i,e]);return u.jsxs("button",{ref:w=>{w?n.current.set(o.relativePath,w):n.current.delete(o.relativePath)},className:`fexp-tree-row${d?" is-cur":""}${m?" is-dir":" is-file"}`,style:{paddingLeft:`${y+12}px`},type:"button",role:"treeitem",tabIndex:t?0:-1,"aria-selected":d,"aria-expanded":m?f:void 0,onClick:b,onKeyDown:w=>s(e,w),children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:m?u.jsx($Z,{name:o.name,open:f}):u.jsx(zZ,{name:o.name})}),u.jsx("span",{className:"fexp-tree-name",children:o.name}),p&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function KZ(){try{return localStorage.getItem(HS)==="1"}catch{return!1}}function VZ(e){try{localStorage.setItem(HS,e?"1":"0")}catch{}}function YZ({name:e,sizeHint:t,t:n}){return u.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[u.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),u.jsx("p",{className:"fexp-bin-name",children:e}),t&&u.jsx("p",{className:"fexp-bin-meta",children:t}),u.jsx("p",{className:"fexp-bin-hint",children:n("fileExplorer.viewer.binaryHint")})]})}function XZ(e,t){switch(t){case"typescript":case"javascript":return JZ(e);case"json":return QZ(e);case"python":return tJ(e);case"css":case"scss":case"sass":case"less":return nJ(e);case"html":case"xml":return iJ(e);case"bash":case"shell":return rJ(e);case"yaml":return sJ(e);default:return[{kind:"text",value:e}]}}const ZZ=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 JZ(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),s=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:s}),n+=s.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
223
+ `,n),s=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:s}),n+=s.length;continue}if(e[n]==="`"){const{slice:i,length:s}=ko(e,n,"`","`");t.push({kind:"str",value:i}),n+=s;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:s}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=s;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 s=i[0],o=e.slice(n+s.length).match(/^\s*\(/);ZZ.has(s)?t.push({kind:"key",value:s}):o?t.push({kind:"fn",value:s}):t.push({kind:"text",value:s}),n+=s.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 QZ(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:s}=ko(e,n,'"','"'),l=e.slice(n+s).trimStart().startsWith(":");t.push({kind:l?"attr":"str",value:i}),n+=s;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 eJ=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 tJ(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
224
+ `,n),s=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:s}),n+=s.length;continue}if(e.startsWith('"""',n)||e.startsWith("'''",n)){const i=e.slice(n,n+3),s=e.indexOf(i,n+3),o=s===-1?e.slice(n):e.slice(n,s+3);t.push({kind:"str",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:s}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=s;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 s=i[0],o=e.slice(n+s.length).match(/^\s*\(/);eJ.has(s)?t.push({kind:"key",value:s}):o?t.push({kind:"fn",value:s}):t.push({kind:"text",value:s}),n+=s.length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function nJ(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("/*",n)){const i=e.indexOf("*/",n+2),s=i===-1?e.slice(n):e.slice(n,i+2);t.push({kind:"com",value:s}),n+=s.length;continue}if(e.startsWith("//",n)){const i=e.indexOf(`
225
+ `,n),s=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:s}),n+=s.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:s}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=s;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 s=i[0];e.slice(n+s.length).trimStart().startsWith(":")?t.push({kind:"attr",value:s}):t.push({kind:"text",value:s}),n+=s.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 iJ(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("<!--",n)){const i=e.indexOf("-->",n+4),s=i===-1?e.slice(n):e.slice(n,i+3);t.push({kind:"com",value:s}),n+=s.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:s}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=s;continue}if(/[a-zA-Z]/.test(e[n])){const i=e.slice(n).match(/^[a-zA-Z][\w:-]*/);if(i){const s=e.slice(n+i[0].length).trimStart();t.push({kind:s.startsWith("=")?"attr":"text",value:i[0]}),n+=i[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function rJ(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 s=e.indexOf(`
226
+ `,n),o=s===-1?e.slice(n):e.slice(n,s);t.push({kind:"com",value:o}),n+=o.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:s,length:o}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:s}),n+=o;continue}if(/[a-zA-Z_]/.test(e[n])){const s=e.slice(n).match(/^[a-zA-Z_][\w]*/);if(s){t.push({kind:i.has(s[0])?"key":"text",value:s[0]}),n+=s[0].length;continue}}t.push({kind:"text",value:e[n]}),n++}return t}function sJ(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==="#"){const i=e.indexOf(`
227
+ `,n),s=i===-1?e.slice(n):e.slice(n,i);t.push({kind:"com",value:s}),n+=s.length;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:s}=ko(e,n,e[n],e[n]);t.push({kind:"str",value:i}),n+=s;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 ko(e,t,n,i){let s=t+n.length;for(;s<e.length;){if(e[s]==="\\"){s+=2;continue}if(e.startsWith(i,s)){s+=i.length;break}if(i!=="`"&&e[s]===`
228
+ `)break;s++}return{slice:e.slice(t,s),length:s-t}}function aJ({content:e,lang:t,truncated:n,t:i}){const s=_.useMemo(()=>oJ(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[n&&u.jsx("div",{className:"fexp-truncated-badge",children:i("fileExplorer.viewer.truncated")}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":i("fileExplorer.viewer.fileContentsAria"),children:u.jsx("tbody",{children:s.map((o,l)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:l+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:o}})]},l))})})})]})}function oJ(e,t){return e.split(`
229
+ `).map(i=>lJ(i,t))}function lJ(e,t){return t==="plaintext"||t==="markdown"?dT(e)||" ":XZ(e,t).map(i=>{const s=dT(i.value);return i.kind==="text"?s:`<span class="syn-${i.kind}">${s}</span>`}).join("")||" "}function dT(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function cJ({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const uJ=new Set([".png",".jpg",".jpeg",".webp",".gif"]),dJ=new Set(["img.shields.io"]),hJ=/^[a-z][a-z0-9+.-]*:/i;function hT(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||hJ.test(n))return null;const i=B3(n);if(!i)return null;const s=mJ(i);return s===null?null:gJ(s,t)}function fJ(e){const t=B3(e).toLowerCase();return[...uJ].some(n=>t.endsWith(n))}function fT(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function pJ(e){try{const t=new URL(e);return t.protocol==="https:"&&dJ.has(t.hostname)}catch{return!1}}function B3(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function mJ(e){try{return decodeURI(e)}catch{return null}}function gJ(e,t){const n=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/"),s=i.includes("/")?i.slice(0,i.lastIndexOf("/")):"",o=n.startsWith("/")?n:`${s}/${n}`,l=[];for(const d of o.split("/"))if(!(!d||d===".")){if(d===".."){if(l.length===0)return null;l.pop();continue}l.push(d)}return l.length>0?l.join("/"):null}function yJ({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:s,language:o}){const l=FS(o),d=_.useMemo(()=>{const w=es(e,OZ(l)).html,S=new DOMParser().parseFromString(w,"text/html");return uv(S.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i,t:l}),S.body.innerHTML},[e,n,i,l]),f=_.useRef(null);_.useEffect(()=>{const w=f.current;if(!w)return;Jd(w,IZ(l)),uv(w,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,t:l});const S=new MutationObserver(()=>uv(w,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,t:l}));return S.observe(w,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>S.disconnect()},[d,n,i,l]);const p=_.useCallback(w=>{const S=w.target.closest('[data-action="copy-code"]');if(!S)return;const x=S.closest("pre")?.getAttribute("data-code");if(!x)return;navigator.clipboard?.writeText(x);const k=S.textContent;S.textContent=l("fileExplorer.markdown.copied"),window.setTimeout(()=>{S.textContent=k},1200)},[l]),m=_.useCallback(w=>{const x=w.target.closest("[data-fexp-open-path]");if(!x)return;const k=x.dataset.fexpOpenPath;k&&(w.preventDefault(),t(k))},[t]),y=_.useCallback(w=>{if(w.key!=="Enter"&&w.key!==" ")return;const x=w.target.closest("[data-fexp-open-path]");if(!x)return;const k=x.dataset.fexpOpenPath;k&&(w.preventDefault(),t(k))},[t]),b=_.useCallback(w=>{p(w),m(w)},[p,m]);return u.jsxs("div",{className:"fexp-md-wrap",children:[s&&u.jsx("div",{className:"fexp-truncated-badge",children:l("fileExplorer.viewer.truncated")}),u.jsx("div",{ref:f,className:"markdown-body",onClick:b,onKeyDown:y,dangerouslySetInnerHTML:{__html:d}})]})}function uv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",s=hT(i,t.currentRelativePath);s?(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("tabindex","0"),n.setAttribute("data-fexp-open-path",s),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")??"",s=n.getAttribute("data-fexp-local-image-path");if(n.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&s&&i===fT(t.theaterId,s)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&pJ(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=hT(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&fJ(o)){n.setAttribute("src",fT(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&_J(n,t.t)}}function _J(e,t){const n=e.getAttribute("alt")?.trim(),i=e.ownerDocument.createElement("span");i.className="fexp-md-blocked-image",i.textContent=n?t("fileExplorer.viewer.imageBlockedNamed",{alt:n}):t("fileExplorer.viewer.imageBlocked"),e.replaceWith(i)}const vJ=360,US=248,WS=200,pm=160,mm=4;function bJ(e){return e-WS-mm>=pm}function wJ(e,t,n){const i=n-WS-mm;return i<pm?e:Math.max(pm,Math.min(i,e-t))}function SJ(e){const t=WS+mm;return`minmax(0, 1fr) ${mm}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function xJ(e){return e?vJ:null}const P3="fleet-console.file-explorer.treePaneWidth",qS={selectedPath:null,viewState:{kind:"none"}},CJ={...qS,treePaneWidth:US},z3=new Map,pT=new Map,j0=new Set;let gm=RJ();function kJ(e){return _.useSyncExternalStore(TJ,()=>AJ(e),()=>CJ)}function mT(e,t){e&&H3(e,{selectedPath:t})}function to(e,t){e&&H3(e,{viewState:t})}function EJ(e){gm=U3(e);try{localStorage.setItem(P3,String(gm))}catch{}$3()}function $3(){for(const e of j0)e()}function F3(e){return z3.get(e)??qS}function AJ(e){const t=e??"__none__",n=e!=null?F3(e):qS,i=pT.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===gm)return i;const s={...n,treePaneWidth:gm};return pT.set(t,s),s}function H3(e,t){z3.set(e,{...F3(e),...t}),$3()}function TJ(e){return j0.add(e),()=>{j0.delete(e)}}function RJ(){try{return U3(Number(localStorage.getItem(P3)))}catch{return US}}function U3(e){return!Number.isFinite(e)||e<=0?US:Math.max(pm,Math.round(e))}const B0=new Set;let MJ=0,ym=null;function LJ(e,t){ym={theaterId:e,relativePath:t,requestId:++MJ},W3()}function NJ(e){ym?.requestId===e.requestId&&(ym=null,W3())}function OJ(){return _.useSyncExternalStore(IJ,gT,gT)}function IJ(e){return B0.add(e),()=>{B0.delete(e)}}function gT(){return ym}function W3(){for(const e of B0)e()}const DJ=new Set([".png",".jpg",".jpeg",".webp",".gif"]),jJ={id:"file-explorer",title:e=>FS(e)("fileExplorer.panel.title"),defaultWidth:360,icon:zJ,render:e=>u.jsx(PJ,{...e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>{const s=await fetch("/plugins/file-explorer/files/palette-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,query:e,limit:n}),signal:i});if(!s.ok)throw new Error("file_search_failed");return(await s.json()).files.map(l=>({id:l.relativePath,title:l.relativePath.split("/").at(-1)??l.relativePath,subtitle:l.relativePath,activate:()=>LJ(t,l.relativePath)}))}};function BJ(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 PJ(e){const{theaterId:t}=e,n=FS(e.language),i=t??"",{selectedPath:s,viewState:o,treePaneWidth:l}=kJ(i),d=_.useRef(l);d.current=l;const f=_.useRef(null),[p,m]=_.useState(!1),[y,b]=_.useState(null),w=OJ(),S=_.useMemo(()=>BJ(t),[t]),x=_.useCallback(async(T,$)=>{if(!t){to(t,{kind:"error",message:fm("no_theater",n)});return}mT(i,T);const I=$??T.split("/").filter(Boolean).at(-1)??T,N=I.slice(I.lastIndexOf(".")).toLowerCase();if(DJ.has(N)){const V=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(T)}`:"";to(i,{kind:"image",relativePath:T,name:I,src:V});return}to(i,{kind:"loading"});try{const V=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:T})});if(!V.ok){const Q=await V.json();throw new Error(Q.error??"read_failed")}const K=await V.json();if(K.binary){to(i,{kind:"binary",name:I});return}to(i,{kind:"code",relativePath:K.relativePath,content:K.content,lang:K.lang,truncated:K.truncated})}catch(V){const K=V instanceof Error?V.message:"Unable to load file";K==="binary_file"?to(i,{kind:"binary",name:I}):to(i,{kind:"error",message:fm(K,n)})}},[i,n,t]);_.useLayoutEffect(()=>{!w||w.theaterId!==t||(b(w),x(w.relativePath),NJ(w))},[x,w,t]);const k=_.useCallback(async T=>{T.kind==="file"&&await x(T.relativePath,T.name)},[x]),L=_.useCallback(()=>{to(i,{kind:"none"}),mT(i,null)},[i]),F=_.useCallback(T=>{T.preventDefault();const $=f.current;if(!$)return;const I=$.getBoundingClientRect().width;if(!bJ(I))return;const N=T.clientX,V=d.current;m(!0);const K=Y=>{const B=Y.clientX-N,M=wJ(V,B,I);d.current=M,EJ(M)},Q=()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",Q),m(!1)};document.addEventListener("pointermove",K),document.addEventListener("pointerup",Q)},[]),q=o.kind!=="none";return _.useLayoutEffect(()=>{e.requestExtraWidth?.(xJ(q))},[e,q]),u.jsxs("div",{ref:f,className:`fexp-root${q?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:q?{gridTemplateColumns:SJ(l)}:void 0,children:[q&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:o.kind!=="loading"&&o.kind!=="error"?"relativePath"in o?o.relativePath:o.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:L,"aria-label":n("fileExplorer.viewer.close"),children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[o.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:n("fileExplorer.status.loading")}),o.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:o.message}),o.kind==="code"&&o.lang==="markdown"&&u.jsx(yJ,{content:o.content,onOpenPath:x,relativePath:o.relativePath,theaterId:t,truncated:o.truncated,language:e.language}),o.kind==="code"&&o.lang!=="markdown"&&u.jsx(aJ,{content:o.content,lang:o.lang,truncated:o.truncated,t:n}),o.kind==="image"&&u.jsx(cJ,{src:o.src,name:o.name}),o.kind==="binary"&&u.jsx(YZ,{name:o.name,t:n})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:F,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(qZ,{files:S,theaterId:t,contextKey:i,selectedPath:s,revealTarget:y,onSelect:k,t:n},i)})]})}function zJ(){return u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const $J={id:"file-explorer",railPanels:[jJ]},FJ=[$J],HJ={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function UJ(e){const t={dirs:{},files:[]};for(const n of e){const i=n.path.split("/");i.pop();let s=t;for(const o of i)s.dirs[o]||(s.dirs[o]={dirs:{},files:[]}),s=s.dirs[o];s.files.push(n)}return t}function q3({files:e,selectedPath:t,onSelect:n}){const i=UJ(e);return u.jsx(G3,{node:i,depth:0,selectedPath:t,onSelect:n})}function G3({node:e,depth:t,selectedPath:n,onSelect:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([s,o])=>u.jsx(WJ,{dirKey:s,node:o,depth:t,selectedPath:n,onSelect:i},s)),e.files.map(s=>u.jsx(qJ,{entry:s,depth:t,selectedPath:n,onSelect:i},s.path))]})}function WJ({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:s}){const[o,l]=_.useState(!1),d=_.useCallback(()=>l(y=>!y),[]);let f=e,p=t;for(;Object.keys(p.dirs).length===1&&p.files.length===0;){const y=Object.keys(p.dirs)[0];f+="/"+y,p=p.dirs[y]}const m=n*16+12;return u.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`},onClick:d,"aria-expanded":!o,children:[u.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-folder-name",children:f})]}),!o&&u.jsx(G3,{node:p,depth:n+1,selectedPath:i,onSelect:s})]})}function qJ({entry:e,depth:t,selectedPath:n,onSelect:i}){const s=e.path===n,o=_.useCallback(()=>i(e),[e,i]),l=t*16+12,d=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`repository-file-row${s?" is-cur":""}`,style:{paddingLeft:`${l}px`},title:e.path,onClick:o,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:HJ[e.status]??e.status}),u.jsx("span",{className:"repository-file-name",children:u.jsx("span",{className:"repository-file-fn",children:d})}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const yT="fleet-console.diff.changesCollapsed",GJ={M:"repository.status.modified",A:"repository.status.added",D:"repository.status.deleted",R:"repository.status.renamed",T:"repository.status.typeChanged",U:"repository.status.untracked"};function KJ(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function VJ(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function K3({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:s,filterText:o,t:l}){const[d,f]=_.useState(()=>VJ(yT)),p=_.useCallback(()=>{f(b=>{const w=!b;try{localStorage.setItem(yT,w?"1":"0")}catch{}return w})},[]),m=_.useMemo(()=>e.kind==="ok"?KJ(e.files,o):[],[o,e]);if(e.kind==="loading")return u.jsx("div",{className:"repository-sections-loading",children:l("repository.common.loading")});if(e.kind==="notice"){const b=e.reason==="no_git_repo"?l("repository.changes.notice.noGitRepoTitle"):l("repository.changes.notice.gitUnavailableTitle"),w=e.reason==="no_git_repo"?l("repository.changes.notice.noGitRepoBody"):l("repository.changes.notice.gitUnavailableBody");return u.jsxs("div",{className:"repository-sections-notice",children:[u.jsx("strong",{className:"repository-notice-title",children:b}),u.jsx("span",{className:"repository-notice-body",children:w}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:l("repository.common.retry")})]})}if(e.kind==="error")return u.jsxs("div",{className:"repository-sections-error",children:[u.jsx("span",{children:e.message}),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:l("repository.common.retry")})]});const y=o?`${m.length}/${e.files.length}`:String(e.files.length);return u.jsx("div",{className:"repository-sections",children:u.jsxs("div",{className:`repository-section${d?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-section-head",onClick:p,children:[u.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-section-name",children:l("repository.changes.section")}),u.jsx("span",{className:"repository-count-badge",children:y})]}),!d&&u.jsx("div",{className:"repository-section-rows",children:m.length===0?u.jsx("div",{className:"repository-empty-row",children:l(o?"repository.common.noMatchingItems":"repository.changes.empty")}):n==="tree"?u.jsx(q3,{files:m,selectedPath:i,onSelect:s}):m.map(b=>u.jsx(V3,{entry:b,isSelected:b.path===i,onSelect:s,t:l},b.path))})]})})}function V3({entry:e,isSelected:t,onSelect:n,t:i}){const s=_.useCallback(()=>n(e),[e,n]),o=e.path.endsWith("/")?e.path.slice(0,-1):e.path,l=o.lastIndexOf("/"),d=l>=0?o.slice(0,l+1):"",f=(l>=0?o.slice(l+1):o)+(e.path.endsWith("/")?"/":""),p=GJ[e.status];return u.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[u.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":p?i(p):e.status,children:e.status}),u.jsxs("span",{className:"repository-file-name",children:[u.jsx("span",{className:"repository-file-fn",children:f}),d&&u.jsx("span",{className:"repository-file-dir",children:d})]}),u.jsxs("span",{className:"repository-nums",children:[e.additions>0&&u.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const YJ={"repository.panel.title":"Repository","repository.section.context":"CONTEXT","repository.section.working":"WORKING","repository.section.worktrees":"WORKTREES","repository.section.branches":"BRANCHES","repository.section.tags":"TAGS","repository.section.stashes":"STASHES","repository.source.history":"History","repository.source.changes":"Changes","repository.source.compare":"Compare","repository.refs.local":"LOCAL","repository.refs.remotes":"REMOTES","repository.refs.tags":"TAGS","repository.discovery.placeholder":"Find repositories…","repository.discovery.aria":"Find repositories","repository.discovery.clearSearch":"Clear search","repository.discovery.depth":"Depth","repository.discovery.scanShallower":"Scan shallower","repository.discovery.scanDeeper":"Scan deeper","repository.discovery.countMatched":"{matched} of {total}","repository.discovery.countFound":"{count} found","repository.discovery.countFoundLimited":"{count} found · limit reached","repository.discovery.noMatching":"No matching repositories","repository.discovery.loadReposFailed":"Unable to load repositories","repository.discovery.loadWorktreesFailed":"Unable to load worktrees","repository.discovery.loadRefsFailed":"Unable to load refs","repository.common.retry":"Retry","repository.common.loading":"Loading…","repository.common.filterPlaceholder":"Filter…","repository.common.filterChangedFiles":"Filter changed files","repository.common.clearFilter":"Clear filter","repository.common.listView":"List view","repository.common.treeView":"Tree view","repository.common.resizeSourceTree":"Resize source tree","repository.common.noMatchingItems":"No matching items","repository.changes.section":"Changes","repository.changes.empty":"No changes","repository.changes.notice.noGitRepoTitle":"Not a Git repository","repository.changes.notice.noGitRepoBody":"This folder isn't a Git repository, so there are no changes to show.","repository.changes.notice.gitUnavailableTitle":"Git isn't available","repository.changes.notice.gitUnavailableBody":"Git was not found on this system. Install Git and make sure it's on your PATH.","repository.status.modified":"modified","repository.status.added":"added","repository.status.deleted":"deleted","repository.status.renamed":"renamed","repository.status.typeChanged":"type changed","repository.status.untracked":"untracked","repository.history.uncommitted":"Uncommitted changes","repository.history.wipStats_one":"{count} files · +{additions} −{deletions}","repository.history.wipStats_other":"{count} files · +{additions} −{deletions}","repository.history.empty":"No history","repository.history.capped":"History capped at 200 commits.","repository.history.loadingCommit":"Loading commit…","repository.history.noChangedFiles":"No changed files","repository.history.closeInspector":"Close inspector","repository.history.previousFile":"Previous file","repository.history.nextFile":"Next file","repository.history.details":"Details","repository.history.changedFiles":"Changed files","repository.history.copy":"copy","repository.history.copied":"copied","repository.history.parent":"parent {short}","repository.history.detached":"detached","repository.history.resizeDock":"Resize commit detail dock","repository.history.resizeLog":"Resize commit log","repository.time.today":"Today {time}","repository.time.yesterday":"Yesterday {time}","repository.compare.run":"Compare","repository.compare.baseRef":"Base ref","repository.compare.headRef":"Head ref","repository.compare.selectBase":"Select base…","repository.compare.optionLocal":"LOCAL · {label}","repository.compare.optionRemotes":"REMOTES · {label}","repository.compare.optionTags":"TAGS · {label}","repository.compare.idle":"Select base and head refs, then run Compare.","repository.compare.comparing":"Comparing…","repository.compare.noDifferences":"No differences between the selected refs.","repository.compare.noMergeBase":"The selected refs share no common history.","repository.compare.mergeBase":"merge-base","repository.compare.capped":"Comparison capped — file list truncated.","repository.hunk.diffTruncated":"Diff truncated"},XJ={"repository.panel.title":"저장소","repository.section.context":"컨텍스트","repository.section.working":"작업","repository.section.worktrees":"워크트리","repository.section.branches":"브랜치","repository.section.tags":"태그","repository.section.stashes":"스태시","repository.source.history":"기록","repository.source.changes":"변경","repository.source.compare":"비교","repository.refs.local":"로컬","repository.refs.remotes":"원격","repository.refs.tags":"태그","repository.discovery.placeholder":"저장소 찾기…","repository.discovery.aria":"저장소 찾기","repository.discovery.clearSearch":"검색 지우기","repository.discovery.depth":"깊이","repository.discovery.scanShallower":"더 얕게 스캔","repository.discovery.scanDeeper":"더 깊게 스캔","repository.discovery.countMatched":"{matched} / {total}","repository.discovery.countFound":"{count}개 발견","repository.discovery.countFoundLimited":"{count}개 발견 · 한도 도달","repository.discovery.noMatching":"일치하는 저장소 없음","repository.discovery.loadReposFailed":"저장소를 불러올 수 없습니다","repository.discovery.loadWorktreesFailed":"워크트리를 불러올 수 없습니다","repository.discovery.loadRefsFailed":"refs를 불러올 수 없습니다","repository.common.retry":"다시 시도","repository.common.loading":"불러오는 중…","repository.common.filterPlaceholder":"필터…","repository.common.filterChangedFiles":"변경된 파일 필터","repository.common.clearFilter":"필터 지우기","repository.common.listView":"목록 보기","repository.common.treeView":"트리 보기","repository.common.resizeSourceTree":"소스 트리 크기 조절","repository.common.noMatchingItems":"일치하는 항목 없음","repository.changes.section":"변경","repository.changes.empty":"변경 없음","repository.changes.notice.noGitRepoTitle":"Git 저장소가 아닙니다","repository.changes.notice.noGitRepoBody":"이 폴더는 Git 저장소가 아니라 표시할 변경이 없습니다.","repository.changes.notice.gitUnavailableTitle":"Git을 사용할 수 없습니다","repository.changes.notice.gitUnavailableBody":"이 시스템에서 Git을 찾지 못했습니다. Git을 설치하고 PATH에 추가하세요.","repository.status.modified":"수정됨","repository.status.added":"추가됨","repository.status.deleted":"삭제됨","repository.status.renamed":"이름 변경됨","repository.status.typeChanged":"형식 변경됨","repository.status.untracked":"추적되지 않음","repository.history.uncommitted":"커밋되지 않은 변경","repository.history.wipStats_one":"{count}개 파일 · +{additions} −{deletions}","repository.history.wipStats_other":"{count}개 파일 · +{additions} −{deletions}","repository.history.empty":"기록 없음","repository.history.capped":"기록은 최대 200개 커밋까지 표시됩니다.","repository.history.loadingCommit":"커밋 불러오는 중…","repository.history.noChangedFiles":"변경된 파일 없음","repository.history.closeInspector":"검사기 닫기","repository.history.previousFile":"이전 파일","repository.history.nextFile":"다음 파일","repository.history.details":"세부 정보","repository.history.changedFiles":"변경된 파일","repository.history.copy":"복사","repository.history.copied":"복사됨","repository.history.parent":"부모 {short}","repository.history.detached":"detached","repository.history.resizeDock":"커밋 상세 독 크기 조절","repository.history.resizeLog":"커밋 로그 크기 조절","repository.time.today":"오늘 {time}","repository.time.yesterday":"어제 {time}","repository.compare.run":"비교","repository.compare.baseRef":"Base ref","repository.compare.headRef":"Head ref","repository.compare.selectBase":"base 선택…","repository.compare.optionLocal":"로컬 · {label}","repository.compare.optionRemotes":"원격 · {label}","repository.compare.optionTags":"태그 · {label}","repository.compare.idle":"base와 head ref를 선택한 뒤 비교를 실행하세요.","repository.compare.comparing":"비교 중…","repository.compare.noDifferences":"선택한 refs 사이에 차이가 없습니다.","repository.compare.noMergeBase":"선택한 refs에 공통 이력이 없습니다.","repository.compare.mergeBase":"merge-base","repository.compare.capped":"비교 한도 — 파일 목록이 잘렸습니다.","repository.hunk.diffTruncated":"Diff가 잘림"},_T={en:YJ,ko:XJ},ZJ={en:Ns(_T,"en"),ko:Ns(_T,"ko")};function Eo(e){return ZJ[e??"en"]}function JJ(e){return(e??"en")==="ko"?"ko-KR":"en-US"}const QJ=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 eQ(e){let t="",n=0;const i=(s,o)=>`<span class="repository-token-${s}">${o}</span>`;for(;n<e.length;){const s=e[n];if(s==="&"){const o=e.indexOf(";",n+1);if(o>=0){t+=e.slice(n,o+1),n=o+1;continue}}if(s==="/"&&e[n+1]==="/"||s==="#"){t+=i("comment",e.slice(n));break}if(s==='"'||s==="'"||s==="`"){const o=s,l=n++;for(;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n++]===o)break}t+=i("string",e.slice(l,n));continue}if(/[0-9]/.test(s)&&!/[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(s)){const o=n;for(;n<e.length&&/[A-Za-z0-9_$]/.test(e[n]);)n++;const l=e.slice(o,n);t+=QJ.has(l)?i("keyword",l):/^[A-Z]/.test(l)?i("type",l):l;continue}if("{}()[].,;:=<>+-*/&|?!".includes(s)){t+=i("punctuation",s),n++;continue}t+=s,n++}return t}const tQ=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,nQ=/^diff --git a\/(.+) b\/(.+)$/;function iQ(e){if(!e)return[];const t=e.split(`
230
+ `);t[t.length-1]===""&&t.pop();const n=[];let i=0,s=0,o=!0;for(const l of t)if(!l.startsWith("\\")){if(l.startsWith("diff --git ")){const d=nQ.exec(l),f=d?.[1],p=d?.[2]??l,m=f!==void 0&&f!==p?f:void 0;n.push({kind:"file-label",text:p,oldPath:m}),o=!0;continue}if(o){if(l.startsWith("new file mode")||l.startsWith("deleted file mode")||l.startsWith("old mode")||l.startsWith("new mode")||l.startsWith("rename from ")||l.startsWith("rename to ")||l.startsWith("similarity index")||l.startsWith("dissimilarity index")){n.push({kind:"meta",text:l});continue}if(l.startsWith("index ")||l.startsWith("--- ")||l.startsWith("+++ "))continue;if(!l.startsWith("@@")){l!==""&&n.push({kind:"ctx",text:` ${l}`});continue}}if(l.startsWith("@@")){o=!1;const d=tQ.exec(l);if(d){i=parseInt(d[1]??"0",10),s=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:l});continue}l.startsWith("+")?n.push({kind:"add",text:l,newLine:s++}):l.startsWith("-")?n.push({kind:"del",text:l,oldLine:i++}):n.push({kind:"ctx",text:l,oldLine:i++,newLine:s++})}return n}function Yf(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _m({ctx:e,repoRel:t,file:n,mode:i,commit:s,compare:o}){const l=Eo(e.language),[d,f]=_.useState({kind:"loading"});if(_.useEffect(()=>{if(!e.theaterId){f({kind:"error",message:"no_theater"});return}let b=!1;return f({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 w=>{if(!w.ok)throw new Error((await w.json()).error??"git_failed");const S=await w.json();b||f({kind:"ok",result:S})}).catch(w=>{b||f({kind:"error",message:w instanceof Error?w.message:"unknown"})}):s?e.api.fetch("repository","commit-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:s.theaterId,repoRel:s.repoRel,ref:s.fullHash,filePath:n.path,...n.oldPath??s.oldPath?{oldPath:n.oldPath??s.oldPath}:{}})}).then(async w=>{if(!w.ok)throw new Error((await w.json()).error??"git_failed");const S=await w.json();b||f({kind:"ok",result:S})}).catch(w=>{b||f({kind:"error",message:w instanceof Error?w.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 w=>{if(!w.ok)throw new Error((await w.json()).error??"git_failed");const S=await w.json();b||f({kind:"ok",result:S})}).catch(w=>{b||f({kind:"error",message:w instanceof Error?w.message:"unknown"})}),()=>{b=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,s,o,t]),d.kind==="loading")return u.jsx("div",{className:"repository-hunk-loading",children:l("repository.common.loading")});if(d.kind==="error")return u.jsx("div",{className:"repository-hunk-error",children:d.message});const{result:p}=d,y=iQ(p.content).filter(b=>b.kind!=="file-label");return u.jsxs("div",{className:"repository-hunk-wrap",children:[p.truncated&&u.jsx("div",{className:"repository-truncated-badge",children:l("repository.hunk.diffTruncated")}),u.jsx("div",{className:"repository-hunk-scroll",children:u.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:y.map((b,w)=>u.jsx("tr",{className:`repository-line repository-line-${b.kind}`,children:b.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:Yf(b.text)}}):b.kind==="meta"?u.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:Yf(b.text)}}):b.kind==="file-label"?u.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:Yf(b.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"repository-gutter repository-gutter-old",children:b.oldLine??""}),u.jsx("td",{className:"repository-gutter repository-gutter-new",children:b.newLine??""}),u.jsx("td",{className:"repository-marker",children:b.kind==="add"?"+":b.kind==="del"?"−":""}),u.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:eQ(Yf(b.text.length>0?b.text.slice(1):b.text))}})]})},w))})})})]})}const GS=140,Y3=120,X3=160,Ps=4,Z3=null;function J3({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:s,dividerWidth:o}){const l=n-s-o;return l<i?Z3:Math.max(i,Math.min(l,e-t))}function Q3(e){const t=GS+Ps;return`minmax(0, 1fr) ${Ps}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function rQ(e){const t=X3+Ps;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Ps}px minmax(0, 1fr)`}function eO(e,t,n,i,s,o=Ps){const l=n-s-o;return l<i?Z3:Math.max(i,Math.min(l,e+t))}function sQ(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Ps}px minmax(120px, 1fr)`}function aQ(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Ps}px minmax(140px, 1fr)`}function KS({documentTarget:e,windowTarget:t,onMove:n,onFinish:i}){let s=!0;const o=()=>{e.removeEventListener("pointermove",n),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",l),t.removeEventListener("blur",l)},l=()=>{s&&(s=!1,o(),i())},d=()=>{s&&(s=!1,o())};return e.addEventListener("pointermove",n),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l),t.addEventListener("blur",l),d}const oQ="fleet-console.repository.compare.",lQ=248,cQ=220;function tO(e,t){return`${oQ}${e}.${t}`}function uQ(e,t){try{const n=localStorage.getItem(tO(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 dQ(e,t,n,i){try{localStorage.setItem(tO(e,t),JSON.stringify({base:n,head:i}))}catch{}}function hQ({ctx:e,repoRel:t,refs:n,refsError:i=!1,onRetryRefs:s,onFileOpenChange:o}){const l=Eo(e.language),[d,f]=_.useState(""),[p,m]=_.useState(""),[y,b]=_.useState({kind:"idle"}),[w,S]=_.useState(null),[x,k]=_.useState(lQ),[L,F]=_.useState(!1),q=_.useRef(x),T=_.useRef(null),$=_.useRef(null),I=_.useRef(!1),N=_.useRef(0),V=_.useMemo(()=>n.remotes.filter(W=>!XS(W.ref)),[n.remotes]),K=n.branches.find(W=>W.current)??null,Q=K===null,Y=_.useCallback(W=>W==="HEAD"?Q:n.branches.some(G=>G.ref===W)||V.some(G=>G.ref===W)||n.tags.some(G=>G.ref===W),[n.branches,n.tags,V,Q]);_.useEffect(()=>{const W=n.branches.length>0||V.length>0||n.tags.length>0,G=K?.ref??"HEAD";if(!I.current){if(!W||!e.theaterId)return;I.current=!0;const U=uQ(e.theaterId,t);f(U&&Y(U.base)?U.base:""),m(U&&Y(U.head)?U.head:G);return}f(U=>U&&!Y(U)?"":U),m(U=>U&&!Y(U)?G:U)},[e.theaterId,K,Y,n.branches.length,n.tags.length,V.length,t]),_.useEffect(()=>{o?.(w!==null)},[o,w]),_.useEffect(()=>()=>$.current?.(),[]);const B=_.useCallback((W,G)=>{const U=W==="base"?G:d,ee=W==="head"?G:p;W==="base"?f(G):m(G),e.theaterId&&dQ(e.theaterId,t,U,ee)},[d,e.theaterId,p,t]),M=_.useCallback(()=>{if(!e.theaterId||!d||!p||d===p)return;const W=++N.current;S(null),b({kind:"loading"}),fetch("/plugins/repository/compare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,base:d,head:p})}).then(async G=>{if(W!==N.current)return;if(!G.ok){const ee=await G.json();if(W!==N.current)return;const ne=ee.error??"git_failed";b(ne==="no_git_repo"||ne==="git_unavailable"?{kind:"notice",reason:ne}:{kind:"error",message:ne});return}const U=await G.json();W===N.current&&b({kind:"ok",base:d,head:p,files:U.files,...U.mergeBase?{mergeBase:U.mergeBase}:{},...U.truncated?{truncated:!0}:{}})}).catch(G=>{W===N.current&&b({kind:"error",message:G instanceof Error?G.message:"unknown"})})},[d,e.theaterId,p,t]),D=_.useCallback(W=>{W.preventDefault();const G=T.current;if(!G)return;const U=G.getBoundingClientRect().width,ee=W.clientX,ne=q.current;$.current?.(),F(!0),$.current=KS({documentTarget:document,windowTarget:window,onMove:me=>{const ve=J3({startWidth:ne,dx:me.clientX-ee,containerWidth:U,listPaneMinWidth:cQ,hunkPaneMinWidth:GS,dividerWidth:Ps});ve!==null&&(q.current=ve,k(ve))},onFinish:()=>{F(!1),$.current=null}})},[]),j=_.useMemo(()=>{const W=[];Q&&W.push({value:"HEAD",label:"HEAD"});for(const G of n.branches)W.push({value:G.ref,label:l("repository.compare.optionLocal",{label:G.label})});for(const G of V)W.push({value:G.ref,label:l("repository.compare.optionRemotes",{label:G.label})});for(const G of n.tags)W.push({value:G.ref,label:l("repository.compare.optionTags",{label:G.label})});return W},[n.branches,n.tags,V,Q,l]),A=_.useMemo(()=>[{value:"",label:l("repository.compare.selectBase"),disabled:!0},...j],[j,l]),O=(W,G)=>u.jsx(Oi,{label:l(W==="base"?"repository.compare.baseRef":"repository.compare.headRef"),value:G,options:W==="base"?A:j,onChange:U=>B(W,U)}),C=d!==""&&p!==""&&d!==p,z=y.kind==="ok"?y.base:null,P=y.kind==="ok"?y.head:null,R=_.useMemo(()=>z&&P&&e.theaterId?{base:z,head:P,theaterId:e.theaterId,repoRel:t}:null,[z,P,e.theaterId,t]);return u.jsxs("div",{className:"repository-compare",children:[i?u.jsxs("div",{className:"history-error",children:[l("repository.discovery.loadRefsFailed"),u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:s,children:l("repository.common.retry")})]}):u.jsxs("div",{className:"repository-compare-controls",children:[O("base",d),u.jsx("span",{className:"repository-compare-arrow","aria-hidden":"true",children:"…"}),O("head",p),u.jsx("button",{type:"button",className:"repository-refresh-btn repository-compare-run",disabled:!C,onClick:M,children:l("repository.compare.run")})]}),u.jsxs("div",{ref:T,className:`repository-root${w?" has-hunk":""}${L?" is-dragging":""}`,style:w?{gridTemplateColumns:Q3(x)}:void 0,children:[w&&R?u.jsxs("div",{className:"repository-hunk-pane",children:[u.jsxs("div",{className:"repository-hunk-head",children:[u.jsx("span",{children:w.path}),u.jsx("button",{type:"button",onClick:()=>S(null),children:"✕"})]}),u.jsx(_m,{ctx:e,repoRel:t,file:w,mode:"unified",compare:R})]}):null,w?u.jsx("div",{className:"repository-divider",onPointerDown:D,"aria-hidden":"true"}):null,u.jsxs("div",{className:"repository-list-pane repository-compare-results",children:[y.kind==="idle"&&u.jsx("div",{className:"history-empty",children:l("repository.compare.idle")}),y.kind==="loading"&&u.jsx("div",{className:"history-empty",children:l("repository.compare.comparing")}),y.kind==="ok"&&y.files.length===0&&u.jsx("div",{className:"history-empty",children:l("repository.compare.noDifferences")}),y.kind==="error"&&y.message==="no_merge_base"&&u.jsx("div",{className:"history-empty",children:l("repository.compare.noMergeBase")}),(y.kind==="notice"||y.kind==="error"&&y.message!=="no_merge_base"||y.kind==="ok"&&y.files.length>0)&&u.jsxs(u.Fragment,{children:[y.kind==="ok"&&y.mergeBase&&u.jsxs("div",{className:"repository-compare-meta",children:[l("repository.compare.mergeBase")," ",u.jsx("span",{children:y.mergeBase})]}),u.jsx(K3,{state:y.kind==="ok"?{kind:"ok",files:y.files}:y,onRetry:M,viewMode:"list",selectedPath:w?.path??null,onSelect:S,filterText:"",t:l}),y.kind==="ok"&&y.truncated&&u.jsx("div",{className:"history-truncated",children:l("repository.compare.capped")})]})]})]})]})}function vT(e,t){const n=Array.from(e.toLowerCase()),i=Array.from(t),s=[];let o=0;for(const l of n){let d=-1;for(let f=o;f<i.length;f+=1)if(i[f].toLowerCase()===l){d=f;break}if(d<0)return null;s.push(d),o=d+1}return s}function nO(){return Object.create(null)}function bT(){return{dirs:nO(),repos:[]}}function fQ(e){const t=bT();for(const n of e){const i=n.relPath.replaceAll("\\","/").split("/").filter(o=>o.length>0);if(i.length===0)continue;i.pop();let s=t;for(const o of i)s.dirs[o]||(s.dirs[o]=bT()),s=s.dirs[o];s.repos.push(n)}return iO(t),t}function iO(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=nO();for(const[n,i]of t)iO(i),e.dirs[n]=i}function pQ(e,t){let n=e,i=t;for(;Object.keys(i.dirs).length===1&&i.repos.length===0;){const s=Object.keys(i.dirs)[0];n+="/"+s,i=i.dirs[s]}return{label:n,node:i}}function rO(e){let t=e.repos.length;for(const n of Object.values(e.dirs))t+=rO(n);return t}const P0=new Set;let VS={file:null};function sO(){for(const e of P0)e()}function mQ(e){return P0.add(e),()=>{P0.delete(e)}}function wT(){return VS}function gQ(e,t){const n=_.useSyncExternalStore(mQ,wT,wT);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function yQ(e,t,n){VS={file:{entry:e,theaterId:t,repoRel:n}},sO()}function dv(){VS={file:null},sO()}const z0=12,hc=28,hv=3,_Q=5,ST=["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 fd(e){return e*z0+6}function Zo(e){return ST[e%ST.length]??"var(--ink-fog)"}function vQ({node:e}){const t=Math.max(e.activeLaneCount,1),n=e.collapsed?10:0,i=t*z0+n,s=fd(e.lane),o=hc/2;return u.jsxs("svg",{width:i,height:hc,viewBox:`0 0 ${i} ${hc}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(l=>u.jsx("line",{x1:fd(l),y1:0,x2:fd(l),y2:hc,stroke:Zo(l),strokeWidth:1.5},`pt-${l}`)),e.connectAbove&&u.jsx("line",{x1:s,y1:0,x2:s,y2:o-hv,stroke:Zo(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:s,y1:o+hv,x2:s,y2:hc,stroke:Zo(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(l=>u.jsx("line",{x1:fd(l),y1:0,x2:s,y2:o,stroke:Zo(l),strokeWidth:1.5,strokeLinecap:"round"},`mf-${l}`)),e.branchToLanes.map(l=>u.jsx("line",{x1:s,y1:o,x2:fd(l),y2:hc,stroke:Zo(l),strokeWidth:1.5,strokeLinecap:"round"},`bt-${l}`)),e.isHead&&u.jsx("circle",{cx:s,cy:o,r:_Q,fill:"none",stroke:Zo(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:s,cy:o,r:hv,fill:Zo(e.lane)}),e.collapsed&&u.jsx("text",{x:t*z0+2,y:o+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const fv=8;function bQ(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],n=[];let i=!1,s=0;for(let o=0;o<e.length;o++){const l=e[o],d=l.fullHash,f=[...l.parents],p=[];for(let k=0;k<t.length;k++)t[k]===d&&p.push(k);let m,y=!1;const b=[];if(p.length===0){const k=t.indexOf(null);k>=0?m=k:t.length<fv?(m=t.length,t.push(null)):(i=!0,m=fv-1,t[m]=null,y=!0)}else{m=Math.min(...p);for(const k of p)k!==m&&(b.push(k),t[k]=null)}const w=[];if(f.length===0)t[m]=null;else{t[m]=y?null:f[0]??null;for(const k of f.slice(1))if(!(t.indexOf(k)>=0)){const F=t.indexOf(null);if(F>=0)t[F]=k,w.push(F);else if(t.length<fv){const q=t.length;t.push(k),w.push(q)}else i=!0}}const S=t.map((k,L)=>({h:k,i:L})).filter(({h:k,i:L})=>k!==null&&L!==m).map(({i:k})=>k),x=Math.max(m,...S,...b,...w);s=Math.max(s,x),n.push({lane:m,activeLaneCount:x+1,collapsed:i,isHead:l.refs.some(k=>k==="HEAD"||k.startsWith("HEAD ->")),connectAbove:p.length>0,connectBelow:f.length>0&&t[m]===f[0],passThroughLanes:S,mergeFromLanes:b,branchToLanes:w})}return{nodes:n,activeLaneCount:s+1,collapsed:i}}function aO(e,t=new Date,n="en"){const i=new Date(e*1e3);if(!Number.isFinite(i.getTime()))return"—";const s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,o=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),l=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),d=Math.round((o-l)/864e5),f=Eo(n);return d===0?f("repository.time.today",{time:s}):d===1?f("repository.time.yesterday",{time:s}):`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function YS(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 wQ=230,eh=160,SQ=222,$0=148,xQ=4,CQ=180,oO="fleet-console.repository.workspace.dockHeight",lO="fleet-console.repository.workspace.treeWidth",fc={context:"repository.section.context",working:"repository.section.working",worktrees:"repository.section.worktrees",branches:"repository.section.branches",tags:"repository.section.tags",stashes:"repository.section.stashes"};function kQ(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(lO)??"");if(Number.isFinite(t)&&t>=$0)return t}catch{}return SQ}function EQ(e,t){try{(t??globalThis.localStorage).setItem(lO,String(e))}catch{}}function AQ(e,t,n){const i=n-CQ-xQ;return i<$0?null:Math.max($0,Math.min(i,e+t))}function TQ(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(oO)??"");if(Number.isFinite(t)&&t>=eh)return t}catch{}return wQ}function RQ(e,t){try{(t??globalThis.localStorage).setItem(oO,String(e))}catch{}}function MQ(e,t){const n=t-180-4;return n<=eh?Math.max(0,n):Math.max(eh,Math.min(n,e))}function LQ(e,t,n){const i=n-180-4;return i<eh?null:Math.max(eh,Math.min(i,e-t))}function NQ(e){return`minmax(180px, 1fr) 4px ${e}px`}function OQ(e,t){return[{id:"context",label:t(fc.context),count:e.context},{id:"working",label:t(fc.working),count:e.changes},{id:"worktrees",label:t(fc.worktrees),count:e.worktrees},{id:"branches",label:t(fc.branches),count:e.branches},{id:"tags",label:t(fc.tags),count:e.tags},{id:"stashes",label:t(fc.stashes),count:e.stashes}]}const F0=new Set;let IQ=0,vm=null;function DQ(e,t,n){vm={theaterId:e,repoRel:t,fullHash:n,requestId:++IQ},uO()}function jQ(e){vm?.requestId===e.requestId&&(vm=null,uO())}function cO(){return _.useSyncExternalStore(BQ,xT,xT)}function BQ(e){return F0.add(e),()=>{F0.delete(e)}}function xT(){return vm}function uO(){for(const e of F0)e()}const dO="fleet-console.history.logHeight",CT="fleet-console.history.headerHeight",kT="fleet-console.history.fileListWidth",hO="fleet-console.history.filesView",PQ=240,zQ=214,$Q=180;function FQ(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function HQ(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(s=>s.toLowerCase().includes(n))||YS(i).some(s=>s.label.toLowerCase().includes(n))):e}function UQ(e){return e==="Escape"}function WQ(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 qQ(e,t,n){return e.files>0&&!t&&!n}function ET({current:e}){return e?u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:u.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2"})})}function GQ({entry:e,checkouts:t,selected:n,graphNode:i,onSelect:s,rowRef:o,locale:l}){const d=Eo(l),f=YS(e),p=FQ(e,t);return u.jsxs("button",{ref:o,type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>s(e),children:[u.jsxs("span",{className:"history-commit-badges",children:[f.map(m=>{const y=m.kind==="branch"?t.find(b=>b.branch===m.label):null;return u.jsxs("span",{className:`history-badge history-badge--${m.kind}`,children:[y&&u.jsx(ET,{current:y.isCurrent}),m.label]},`${m.kind}:${m.label}`)}),p&&u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(ET,{current:p.isCurrent}),d("repository.history.detached")]})]}),u.jsx("span",{className:"history-commit-subject",title:e.subject,children:e.subject}),u.jsx("span",{className:"history-commit-sha",children:e.shortHash}),u.jsx("span",{className:"history-commit-time",children:aO(e.authorAt,new Date,l)}),u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(vQ,{node:i})})]})}function KQ({ctx:e,repoRel:t,target:n,workspace:i,onSelectCommit:s,onClose:o}){const l=Eo(e.language),[d,f]=_.useState({kind:"loading"}),[p,m]=_.useState("details"),[y,b]=_.useState(null),[w,S]=_.useState(!1),[x,k]=_.useState(()=>H0(CT,zQ)),[L,F]=_.useState(()=>H0(kT,$Q)),[q,T]=_.useState(ZQ),$=_.useRef(null),I=_.useRef(null),N=_.useRef(null),V=_.useRef(x),K=_.useRef(L),Q=_.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);_.useEffect(()=>{let M=!1;return f({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 D=>{if(!D.ok)throw new Error((await D.json()).error??"git_failed");return D.json()}).then(D=>{M||(f({kind:"ok",result:D}),b(D.files[0]?.path??null))}).catch(D=>{M||f({kind:"error",message:D instanceof Error?D.message:"unknown"})}),()=>{M=!0}},[e.api,e.theaterId,t,n.fullHash]),_.useEffect(()=>()=>N.current?.(),[]);const Y=_.useCallback((M,D)=>{M.preventDefault();const j=D==="y"?$.current:I.current;if(!j)return;const A=D==="y"?V.current:K.current,O=D==="y"?M.clientY:M.clientX,C=D==="y"?j.getBoundingClientRect().height:j.getBoundingClientRect().width;N.current?.(),N.current=KS({documentTarget:document,windowTarget:window,onMove:z=>{const P=z,R=eO(A,(D==="y"?P.clientY:P.clientX)-O,C,120,120);R!==null&&(D==="y"?(V.current=R,k(R)):(K.current=R,F(R)))},onFinish:()=>{const z=D==="y"?V.current:K.current;try{localStorage.setItem(D==="y"?CT:kT,String(z))}catch{}N.current=null}})},[]),B=d.kind==="loading"?u.jsx("div",{className:"history-inspector-empty",children:l("repository.history.loadingCommit")}):d.kind==="error"?u.jsx("div",{className:"history-inspector-empty history-inspector-error",children:d.message}):(()=>{const{meta:M,files:D}=d.result,j=D.find(W=>W.path===y)??D[0]??null,A=D.reduce((W,G)=>W+G.additions,0),O=D.reduce((W,G)=>W+G.deletions,0),C=n.entry,z=(W,G)=>{b(W.path),G&&m("changes")},P=W=>{T(W);try{localStorage.setItem(hO,W)}catch{}},R=()=>{const W=navigator.clipboard?.writeText(n.fullHash);W&&W.then(()=>{S(!0),window.setTimeout(()=>S(!1),1200)}).catch(()=>{})};return i?u.jsxs("div",{className:"repository-ws-dock",children:[u.jsx(pv,{files:D,selectedPath:y,additions:A,deletions:O,viewMode:q,onViewMode:P,onSelect:W=>z(W,!1),t:l}),u.jsxs("div",{className:"repository-ws-dock-main",children:[u.jsxs("div",{className:"repository-ws-dock-meta",children:[u.jsx(AT,{meta:M,entry:C,fullHash:n.fullHash,copied:w,onCopy:R,onParent:W=>s({fullHash:W}),locale:e.language,t:l}),u.jsx("button",{type:"button",className:"history-detail-close repository-ws-dock-close","aria-label":l("repository.history.closeInspector"),title:l("repository.history.closeInspector"),onClick:o,children:"✕"})]}),j?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-repository-head",children:[u.jsx("span",{title:j.path,children:j.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":l("repository.history.previousFile"),disabled:D.indexOf(j)===0,onClick:()=>z(D[D.indexOf(j)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":l("repository.history.nextFile"),disabled:D.indexOf(j)===D.length-1,onClick:()=>z(D[D.indexOf(j)+1],!1),children:"›"})]})]}),u.jsx(_m,{ctx:e,repoRel:t,file:j,mode:"unified",commit:Q})]}):u.jsx("div",{className:"history-inspector-empty",children:l("repository.history.noChangedFiles")})]})]}):p==="details"?u.jsxs("div",{ref:$,className:"history-details-tab",style:{gridTemplateRows:sQ(x)},children:[u.jsx(AT,{meta:M,entry:C,fullHash:n.fullHash,copied:w,onCopy:R,onParent:W=>s({fullHash:W}),locale:e.language,t:l}),u.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:W=>Y(W,"y")}),u.jsx(pv,{files:D,selectedPath:y,additions:A,deletions:O,viewMode:q,onViewMode:P,onSelect:W=>z(W,!0),t:l})]}):u.jsx("div",{className:"history-changes-tab",children:u.jsxs("div",{ref:I,className:"history-changes-columns",style:{gridTemplateColumns:aQ(L)},children:[u.jsx(pv,{files:D,selectedPath:y,additions:A,deletions:O,viewMode:q,onViewMode:P,onSelect:W=>z(W,!1),t:l}),u.jsx("div",{className:"history-divider",onPointerDown:W=>Y(W,"x")}),j?u.jsxs("div",{className:"history-file-diff",children:[u.jsxs("div",{className:"history-file-repository-head",children:[u.jsx("span",{title:j.path,children:j.path}),u.jsxs("div",{children:[u.jsx("button",{type:"button","aria-label":l("repository.history.previousFile"),disabled:D.indexOf(j)===0,onClick:()=>z(D[D.indexOf(j)-1],!1),children:"‹"}),u.jsx("button",{type:"button","aria-label":l("repository.history.nextFile"),disabled:D.indexOf(j)===D.length-1,onClick:()=>z(D[D.indexOf(j)+1],!1),children:"›"})]})]}),u.jsx(_m,{ctx:e,repoRel:t,file:j,mode:"unified",commit:Q})]}):u.jsx("div",{className:"history-inspector-empty",children:l("repository.history.noChangedFiles")})]})})})();return u.jsx("div",{className:`history-inspector${i?" repository-ws-inspector":""}`,onKeyDown:M=>{UQ(M.key)&&(M.preventDefault(),o())},children:i?B:u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"history-segmented",children:[u.jsx("button",{type:"button","aria-pressed":p==="details",onClick:()=>m("details"),children:l("repository.history.details")}),u.jsxs("button",{type:"button","aria-pressed":p==="changes",onClick:()=>m("changes"),children:[l("repository.source.changes")," ",d.kind==="ok"&&u.jsx("span",{children:d.result.files.length})]}),u.jsx("button",{type:"button",className:"history-detail-close history-inspector-close","aria-label":l("repository.history.closeInspector"),title:l("repository.history.closeInspector"),onClick:o,children:"✕"})]}),B]})})}function AT({meta:e,entry:t,fullHash:n,copied:i,onCopy:s,onParent:o,locale:l,t:d}){return u.jsxs("div",{className:"history-inspector-head",children:[u.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&u.jsx("pre",{className:"history-inspector-message",children:e.body}),u.jsxs("div",{className:"history-author",children:[u.jsx("span",{className:"history-avatar",children:JQ(e.authorName)}),u.jsxs("span",{children:[u.jsx("b",{children:e.authorName}),u.jsx("small",{children:e.authorEmail})]}),u.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(JJ(l)),children:aO(e.authorAt,new Date,l)})]}),u.jsxs("div",{className:"history-inspector-ids",children:[u.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:s,children:[n,u.jsx("span",{children:d(i?"repository.history.copied":"repository.history.copy")})]}),e.parents.map(f=>u.jsx("button",{type:"button",className:"history-parent",onClick:()=>o(f.full),children:d("repository.history.parent",{short:f.short})},f.full))]}),t&&u.jsx("div",{className:"history-ref-chips",children:YS(t).map(f=>u.jsx("span",{className:`history-badge history-badge--${f.kind}`,children:f.label},`${f.kind}:${f.label}`))})]})}function pv({files:e,selectedPath:t,additions:n,deletions:i,viewMode:s,onViewMode:o,onSelect:l,t:d}){return u.jsxs("section",{className:"history-commit-files",children:[u.jsxs("div",{className:"history-files-title",children:[u.jsx("span",{className:"history-files-label",children:d("repository.history.changedFiles")}),u.jsxs("span",{className:"history-files-stats",children:[e.length," ",u.jsxs("i",{children:["+",n]})," ",u.jsxs("em",{children:["−",i]})]}),u.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${s==="list"?" is-active":""}`,title:d("repository.common.listView"),"aria-label":d("repository.common.listView"),"aria-pressed":s==="list",onClick:()=>o("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${s==="tree"?" is-active":""}`,title:d("repository.common.treeView"),"aria-label":d("repository.common.treeView"),"aria-pressed":s==="tree",onClick:()=>o("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx("div",{className:"history-files-scroll",children:s==="tree"?u.jsx(q3,{files:e,selectedPath:t,onSelect:l}):e.map(f=>u.jsx(V3,{entry:f,isSelected:f.path===t,onSelect:l,t:d},f.path))})]})}function VQ({ctx:e,repoRel:t,active:n=!0,refFilter:i=null,wipFiles:s,workspace:o=!1,workspaceMain:l,workspaceMainVisible:d=!1,onInspectorOpenChange:f,onClearRef:p,onWip:m}){return u.jsx(YQ,{ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:s,workspace:o,workspaceMain:l,workspaceMainVisible:d,onInspectorOpenChange:f,onClearRef:p,onWip:m},`${e.theaterId??""}:${t}`)}function YQ({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:s,workspace:o,workspaceMain:l,workspaceMainVisible:d,onInspectorOpenChange:f,onClearRef:p,onWip:m}){const y=Eo(e.language),[b,w]=_.useState({kind:"loading"}),[S,x]=_.useState(null),[k,L]=_.useState(""),[F,q]=_.useState(0),[T,$]=_.useState(XQ),[I,N]=_.useState(TQ),[V,K]=_.useState(!1),Q=_.useRef(null),Y=_.useRef(new Map),B=cO(),M=_.useRef(null),D=_.useRef(T),j=_.useRef(I);_.useEffect(()=>{x(null)},[i]),_.useEffect(()=>{if(!B||B.theaterId!==e.theaterId||B.repoRel!==t||b.kind!=="ok")return;const U=b.commits.find(ee=>ee.fullHash===B.fullHash);U&&(L(""),x({fullHash:U.fullHash,entry:U}),jQ(B))},[e.theaterId,t,B,b]),_.useLayoutEffect(()=>{S&&Y.current.get(S.fullHash)?.scrollIntoView({block:"nearest"})},[S]);const[A,O]=_.useState(n);_.useEffect(()=>{n&&O(!0)},[n]),_.useEffect(()=>{if(!A)return;if(!e.theaterId){w({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let U=!1;return w({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 ee=>{if(!ee.ok)throw new Error((await ee.json()).error??"git_failed");return ee.json()}).then(ee=>{U||w({kind:"ok",commits:ee.commits,checkouts:ee.checkouts,truncated:ee.truncated??!1})}).catch(ee=>{U||w({kind:"error",message:ee instanceof Error?ee.message:"unknown"})}),()=>{U=!0}},[e.api,e.theaterId,A,F,i,t]),_.useEffect(()=>{f?.(n&&S!==null)},[n,f,S]),_.useEffect(()=>()=>M.current?.(),[]),_.useLayoutEffect(()=>{if(!o||S===null)return;const U=Q.current;if(!U)return;const ee=()=>{const me=MQ(j.current,U.getBoundingClientRect().height);me!==j.current&&(j.current=me,N(me))};ee();const ne=new ResizeObserver(ee);return ne.observe(U),()=>ne.disconnect()},[o,S]);const C=_.useCallback(U=>{U.preventDefault();const ee=Q.current;if(!ee)return;const ne=o?j.current:D.current,me=U.clientY,Me=ee.getBoundingClientRect().height;M.current?.(),K(!0),M.current=KS({documentTarget:document,windowTarget:window,onMove:ve=>{const Ye=ve.clientY-me,qe=o?LQ(ne,Ye,Me):eO(ne,Ye,Me,Y3,X3,Ps);qe!==null&&(o?(j.current=qe,N(qe)):(D.current=qe,$(qe)))},onFinish:()=>{if(o)RQ(j.current);else try{localStorage.setItem(dO,String(D.current))}catch{}K(!1),M.current=null}})},[o]),z=_.useMemo(()=>b.kind==="ok"?HQ(b.commits,k):[],[k,b]),P=b.kind==="ok"?bQ(z):null,R=_.useMemo(()=>WQ(s),[s]),W=qQ(R,k,i),G=S?o?NQ(I):rQ(T):void 0;return u.jsxs("div",{ref:Q,className:`history-root${o?" repository-ws-history":""}${V?" is-dragging":""}`,style:G?{gridTemplateRows:G}:void 0,children:[u.jsxs("div",{className:"history-list-pane",hidden:o&&d,children:[u.jsxs("div",{className:"history-toolbar",children:[u.jsxs("div",{className:"history-filter",children:[u.jsx("input",{className:"history-filter-input",placeholder:y("repository.common.filterPlaceholder"),value:k,onChange:U=>L(U.target.value)}),k&&u.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>L(""),children:"✕"})]}),i&&u.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:p,children:[i," ✕"]}),b.kind==="ok"&&u.jsx("span",{className:"history-count",children:k?`${z.length}/${b.commits.length}`:b.commits.length})]}),u.jsxs("div",{className:"history-list",children:[W&&u.jsxs("button",{type:"button",className:"repository-wip-row",onClick:m,children:[y("repository.history.uncommitted")," ",u.jsx("span",{children:y(R.files===1?"repository.history.wipStats_one":"repository.history.wipStats_other",{count:R.files,additions:R.additions,deletions:R.deletions})})]}),b.kind==="loading"&&u.jsx("div",{className:"history-empty",children:y("repository.common.loading")}),b.kind==="error"&&u.jsxs("div",{className:"history-error",children:[b.message,u.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>q(U=>U+1),children:y("repository.common.retry")})]}),b.kind==="ok"&&b.commits.length===0&&u.jsx("div",{className:"history-empty",children:y("repository.history.empty")}),b.kind==="ok"&&b.commits.length>0&&z.length===0&&u.jsx("div",{className:"history-empty",children:y("repository.common.noMatchingItems")}),b.kind==="ok"&&P&&z.map((U,ee)=>u.jsx(GQ,{rowRef:ne=>{ne?Y.current.set(U.fullHash,ne):Y.current.delete(U.fullHash)},entry:U,checkouts:b.checkouts,selected:S?.fullHash===U.fullHash,graphNode:P.nodes[ee],onSelect:ne=>x({fullHash:ne.fullHash,entry:ne}),locale:e.language},U.fullHash)),b.kind==="ok"&&(b.truncated||b.commits.length>=200)&&u.jsx("div",{className:"history-truncated",children:y("repository.history.capped")})]})]}),l!==void 0&&u.jsx("div",{className:"repository-ws-main",hidden:!d,children:l}),S&&u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":y(o?"repository.history.resizeDock":"repository.history.resizeLog"),onPointerDown:C}),u.jsx("div",{className:"history-detail-pane",children:u.jsx(KQ,{ctx:e,repoRel:t,target:S,workspace:o,onSelectCommit:x,onClose:()=>x(null)})})]})]})}function XQ(){return H0(dO,PQ,Y3)}function ZQ(){try{const e=localStorage.getItem(hO);if(e==="list"||e==="tree")return e}catch{}return"list"}function H0(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function JQ(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const fO="fleet-console.diff.viewMode",pO="fleet-console.diff.listPaneWidth",mO="fleet-console.repository.source",Qm="fleet-console.repository.repo.",gO="fleet-console.repository.scanDepth",yO=1,_O=8,QQ=3,eee=248,vO=220;function tee(){try{const e=localStorage.getItem(fO);if(e==="list"||e==="tree")return e}catch{}return"list"}function nee(){try{const e=localStorage.getItem(mO);if(e==="changes"||e==="history"||e==="compare")return e}catch{}return"history"}function bO(e){try{return localStorage.getItem(`${Qm}${e}`)??""}catch{return""}}function iee(e,t,n){try{const i=`${Qm}${e}`,s=localStorage.getItem(i);if(s===null)return"";if(t.some(o=>o.relPath===s)||n.some(o=>o.relPath===s))return s;localStorage.removeItem(i)}catch{}return""}function ree(){try{const e=Number.parseInt(localStorage.getItem(gO)??"",10);if(Number.isInteger(e)&&e>=yO&&e<=_O)return e}catch{}return QQ}function see(e){try{localStorage.setItem(gO,String(e))}catch{}}function aee(e,t){try{localStorage.setItem(`${Qm}${e}`,t)}catch{}}function oee(e){try{localStorage.removeItem(`${Qm}${e}`)}catch{}}function lee(e){try{localStorage.setItem(mO,e)}catch{}}function cee(){try{const e=localStorage.getItem(pO),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(vO,t)}catch{}return eee}function uee(e){return e.entry.status==="U"?"untracked":"unified"}function dee({ctx:e}){return u.jsx(pee,{ctx:e},e.theaterId)}function hee(e,t,n){return!e||n===t?{transition:!1,landing:"history"}:{transition:!0,landing:"history"}}function XS(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function fee(e,t){const n=(i,s)=>i.map(o=>({key:o.ref,source:s,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=>!XS(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 pee({ctx:e}){const t=Eo(e.language),[n,i]=_.useState([]),[s,o]=_.useState(!1),[l,d]=_.useState(0),[f,p]=_.useState(!1),[m,y]=_.useState(ree),b=_.useCallback(ge=>{y(ge),see(ge)},[]),[w,S]=_.useState(!1),[x,k]=_.useState([]),[L,F]=_.useState(!1),[q,T]=_.useState(0),[$,I]=_.useState(null),[N,V]=_.useState(()=>e.theaterId?bO(e.theaterId):""),K=_.useRef(N),[Q,Y]=_.useState(nee),[B,M]=_.useState(kQ),D=_.useRef(B),[j,A]=_.useState(!1),O=_.useRef(null),[C,z]=_.useState(null),[P,R]=_.useState({branches:[],remotes:[],tags:[],stashes:[]}),[W,G]=_.useState(!1),[U,ee]=_.useState(0),[ne,me]=_.useState({kind:"loading"}),[Me,ve]=_.useState(0),[Ye,qe]=_.useState(tee),[yt,$e]=_.useState(""),[We,mt]=_.useState(0),ot=cO(),Nt=gQ(e.theaterId??null,N),[Ot,kt]=_.useState(cee),ye=_.useRef(Ot),ze=_.useRef(null),[Je,It]=_.useState(!1),Ke=_.useCallback(ge=>{Y(ge),lee(ge)},[]),en=_.useCallback(ge=>{ge.preventDefault();const Ee=O.current;if(!Ee)return;const je=Ee.getBoundingClientRect().width,at=ge.clientX,Z=D.current;A(!0);const he=Ge=>{const St=AQ(Z,Ge.clientX-at,je);St!==null&&(D.current=St,M(St))},ke=()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",ke),A(!1),EQ(D.current)};document.addEventListener("pointermove",he),document.addEventListener("pointerup",ke)},[]),we=_.useCallback((ge,Ee,je="changes")=>{e.theaterId&&(Ee&&aee(e.theaterId,ge),dv(),z(null),$e(""),me({kind:"loading"}),R({branches:[],remotes:[],tags:[],stashes:[]}),K.current=ge,V(ge),Ke(je))},[e.theaterId,Ke]);_.useEffect(()=>{if(!(!ot||ot.theaterId!==e.theaterId)){if(z(null),K.current!==ot.repoRel){we(ot.repoRel,!0,"history");return}Ke("history")}},[e.theaterId,ot,Ke,we]),_.useEffect(()=>{if(!e.theaterId)return;let ge=!1;return o(!1),S(!1),e.api.fetch("repository","repos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,maxDepth:m})}).then(Ee=>Ee.json()).then(Ee=>{ge||(i(Ee.repos),p(Ee.truncated===!0),S(!0))}).catch(()=>{ge||o(!0)}),()=>{ge=!0}},[e.api,e.theaterId,l,m]),_.useEffect(()=>{if(!e.theaterId)return;let ge=!1;const Ee=N;return k([]),F(!1),I(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:Ee})}).then(je=>je.json()).then(je=>{ge||(k(je.worktrees),I(Ee))}).catch(je=>{if(ge)return;if((typeof je=="object"&&je!==null&&"status"in je?je.status:null)===400&&Ee!==""){oee(e.theaterId),we("",!1);return}F(!0)}),()=>{ge=!0}},[e.api,e.theaterId,N,we,q]),_.useEffect(()=>{if(!e.theaterId||!w||$!==N)return;const ge=iee(e.theaterId,n,x);ge!==K.current&&we(ge,!1)},[e.theaterId,N,n,w,we,x,$]),_.useEffect(()=>{if(!e.theaterId)return;let ge=!1;return R({branches:[],remotes:[],tags:[],stashes:[]}),G(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:N})}).then(Ee=>Ee.ok?Ee.json():Promise.reject()).then(Ee=>{ge||R(Ee)}).catch(()=>{ge||G(!0)}),()=>{ge=!0}},[e.api,e.theaterId,N,U]),_.useEffect(()=>{if(!e.theaterId){me({kind:"error",message:"no_theater"});return}let ge=!1;return me({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:N})}).then(async Ee=>{if(!Ee.ok){const Z=(await Ee.json()).error??"git_failed";ge||me(Z==="no_git_repo"||Z==="git_unavailable"?{kind:"notice",reason:Z}:{kind:"error",message:Z});return}const je=await Ee.json();ge||me({kind:"ok",files:je.files})}).catch(Ee=>{ge||me({kind:"error",message:Ee instanceof Error?Ee.message:"unknown"})}),()=>{ge=!0}},[Me,e.theaterId,N]),_.useLayoutEffect(()=>()=>dv(),[]);const De=_.useCallback(ge=>{e.theaterId&&yQ(ge,e.theaterId,N)},[e.theaterId,N]),de=_.useCallback(ge=>{const Ee=hee(e.theaterId,N,ge.relPath);if(!Ee.transition){z(null),mt(je=>je+1),Ke(Ee.landing);return}we(ge.relPath,!0,Ee.landing)},[e.theaterId,N,Ke,we]),Pe=_.useCallback(()=>dv(),[]),st=_.useCallback(ge=>{qe(ge);try{localStorage.setItem(fO,ge)}catch{}},[]),ft=_.useCallback(ge=>{ge.preventDefault();const Ee=ze.current;if(!Ee)return;const je=Ee.getBoundingClientRect().width,at=ge.clientX,Z=ye.current;It(!0);const he=Ge=>{const St=J3({startWidth:Z,dx:Ge.clientX-at,containerWidth:je,listPaneMinWidth:vO,hunkPaneMinWidth:GS,dividerWidth:Ps});St!==null&&(ye.current=St,kt(St))},ke=()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",ke),It(!1);try{localStorage.setItem(pO,String(ye.current))}catch{}};document.addEventListener("pointermove",he),document.addEventListener("pointerup",ke)},[]),Dt=Nt?uee(Nt):null,Gt=_.useCallback(()=>ve(ge=>ge+1),[]),_t=ne.kind==="ok"?ne.files:[],Tt=n.find(ge=>ge.relPath===N)??x.find(ge=>ge.relPath===N),Ne=u.jsxs("div",{ref:ze,className:`repository-root${Nt?" has-hunk":""}${Je?" is-dragging":""}`,style:Nt?{gridTemplateColumns:Q3(Ot)}:void 0,children:[Nt&&Dt?u.jsxs("div",{className:"repository-hunk-pane",children:[u.jsxs("div",{className:"repository-hunk-head",children:[u.jsx("span",{children:Nt.entry.path}),u.jsx("button",{type:"button",onClick:Pe,children:"✕"})]}),u.jsx(_m,{ctx:e,repoRel:N,file:Nt.entry,mode:Dt})]}):null,Nt?u.jsx("div",{className:"repository-divider",onPointerDown:ft,"aria-hidden":"true"}):null,u.jsxs("div",{className:"repository-list-pane",children:[u.jsxs("div",{className:"repository-toolbar",children:[u.jsxs("div",{className:"repository-filter",children:[u.jsx("input",{type:"text",className:"repository-filter-input",placeholder:t("repository.common.filterPlaceholder"),"aria-label":t("repository.common.filterChangedFiles"),value:yt,onChange:ge=>$e(ge.target.value)}),yt?u.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":t("repository.common.clearFilter"),onClick:()=>$e(""),children:"✕"}):null]}),u.jsxs("div",{className:"repository-view-toggle",children:[u.jsx("button",{type:"button",className:`repository-toggle-btn${Ye==="list"?" is-active":""}`,title:t("repository.common.listView"),"aria-pressed":Ye==="list",onClick:()=>st("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`repository-toggle-btn${Ye==="tree"?" is-active":""}`,title:t("repository.common.treeView"),"aria-pressed":Ye==="tree",onClick:()=>st("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx(K3,{state:ne,onRetry:Gt,viewMode:Ye,selectedPath:Nt?.entry.path??null,onSelect:De,filterText:yt,t})]})]}),jt=u.jsx(hQ,{ctx:e,repoRel:N,refs:P,refsError:W,onRetryRefs:()=>ee(ge=>ge+1)},`${e.theaterId??""}:${N}`),se=Q==="changes"||Q==="compare",oe=u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"repository-source-fill",hidden:Q!=="changes",children:Ne}),u.jsx("div",{className:"repository-source-fill",hidden:Q!=="compare",children:jt})]});return u.jsxs("div",{className:"repository-unified is-workspace",children:[u.jsxs("div",{className:`repository-identity${N?" is-subcontext":""}`,children:[u.jsx(SO,{}),u.jsx("strong",{children:Tt?.name??t("repository.panel.title")}),Tt?.branch&&u.jsx("span",{children:Tt.branch})]}),u.jsxs("div",{ref:O,className:`repository-ws-layout${j?" is-dragging":""}`,style:{"--ws-tree-width":`${B}px`},children:[u.jsx(mee,{t,repos:n,reposError:s,reposTruncated:f,scanDepth:m,worktrees:x,worktreesError:L,refs:P,refsError:W,changedFiles:ne,selectedRel:N,source:Q,refFilter:C,onRepository:de,onScanDepth:b,onRetryRepos:()=>d(ge=>ge+1),onRetryWorktrees:()=>T(ge=>ge+1),onRetryRefs:()=>ee(ge=>ge+1),onSource:Ke,onRef:ge=>{z(ge),Ke("history")}}),u.jsx("div",{className:"repository-divider repository-ws-tree-divider",onPointerDown:en,role:"separator","aria-orientation":"vertical","aria-label":t("repository.common.resizeSourceTree")}),u.jsx(VQ,{ctx:e,repoRel:N,active:!0,refFilter:C,wipFiles:_t,workspace:!0,workspaceMain:oe,workspaceMainVisible:se,onClearRef:()=>z(null),onWip:()=>Ke("changes")},`${e.theaterId??""}:${N}:${We}`)]})]})}function mee({t:e,repos:t,reposError:n,reposTruncated:i,scanDepth:s,worktrees:o,worktreesError:l,refs:d,refsError:f,changedFiles:p,selectedRel:m,source:y,refFilter:b,onRepository:w,onScanDepth:S,onRetryRepos:x,onRetryWorktrees:k,onRetryRefs:L,onSource:F,onRef:q}){const[T,$]=_.useState(""),[I,N]=_.useState(()=>new Set(["tags","stashes"])),V=t.filter(P=>P.kind==="root").sort((P,R)=>P.name.localeCompare(R.name)),K=t.filter(P=>P.kind==="nested"),Q=fQ(K),Y=P=>vT(T,P.name)??vT(T,P.relPath),B=T?V.filter(P=>Y(P)!==null):V,M=T?K.filter(P=>Y(P)!==null):K,D=B.length+M.length,j=d.branches.length+d.remotes.filter(P=>!XS(P.ref)).length,A=p.kind==="ok"?p.files.length:0,O=OQ({context:t.length,changes:A,worktrees:o.length,branches:j,tags:d.tags.length,stashes:d.stashes.length},e),C=P=>{const R=O.find(G=>G.id===P),W=I.has(P);return u.jsxs("button",{type:"button",className:"repository-ws-section-head","aria-expanded":!W,onClick:()=>{N(G=>{const U=new Set(G);return U.has(P)?U.delete(P):U.add(P),U})},children:[u.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{children:R.label}),u.jsx("i",{children:R.count})]})},z=P=>fee(P,d).map(R=>u.jsxs("div",{className:"repository-ws-ref-group",children:[R.label&&u.jsx("span",{className:"repository-ws-ref-subhead",children:e(R.label==="LOCAL"?"repository.refs.local":"repository.refs.remotes")}),R.rows.map(W=>u.jsxs("button",{type:"button",className:`repository-ws-tree-row${W.current?" is-current":""}${y==="history"&&W.ref===b?" is-active":""}`,disabled:W.ref===null,onClick:()=>W.ref&&q(W.ref),children:[u.jsx(wc,{source:W.source}),u.jsx("span",{children:W.primary}),W.current&&u.jsx("i",{children:"HEAD"}),W.sub&&u.jsx("i",{children:W.sub})]},W.key))]},R.label??P));return u.jsxs("aside",{className:"repository-ws-tree",children:[u.jsx(gee,{t:e,query:T,onQuery:$,totalCount:t.length,matchedCount:D,scanDepth:s,onScanDepth:S,truncated:i,onEnter:()=>{const P=B[0]??M[0];P&&w(P)}}),u.jsxs("div",{className:"repository-ws-tree-scroll",children:[u.jsxs("section",{className:`repository-ws-section${I.has("context")?" is-collapsed":""}`,children:[C("context"),!I.has("context")&&(n?u.jsx(mv,{t:e,label:e("repository.discovery.loadReposFailed"),onRetry:x}):u.jsxs(u.Fragment,{children:[B.map(P=>u.jsx(U0,{repo:P,depth:0,selectedRel:m,onRepository:w},P.relPath)),T?M.map(P=>u.jsx(U0,{repo:P,depth:0,selectedRel:m,onRepository:w},P.relPath)):u.jsx(wO,{node:Q,depth:0,selectedRel:m,onRepository:w}),T&&D===0&&u.jsx("div",{className:"repository-empty-row",children:e("repository.discovery.noMatching")})]}))]}),u.jsxs("section",{className:`repository-ws-section${I.has("working")?" is-collapsed":""}`,children:[C("working"),!I.has("working")&&u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="history"?" is-active":""}`,onClick:()=>F("history"),children:[u.jsx(wc,{source:"history"}),u.jsx("span",{children:e("repository.source.history")})]}),u.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="changes"?" is-active":""}`,onClick:()=>F("changes"),children:[u.jsx(wc,{source:"changes"}),u.jsx("span",{children:e("repository.source.changes")}),u.jsx("i",{children:A})]}),u.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="compare"?" is-active":""}`,onClick:()=>F("compare"),children:[u.jsx(wc,{source:"compare"}),u.jsx("span",{children:e("repository.source.compare")})]})]})]}),u.jsxs("section",{className:`repository-ws-section${I.has("worktrees")?" is-collapsed":""}`,children:[C("worktrees"),!I.has("worktrees")&&(l?u.jsx(mv,{t:e,label:e("repository.discovery.loadWorktreesFailed"),onRetry:k}):o.map(P=>u.jsxs("button",{type:"button",className:`repository-ws-tree-row${P.relPath===m?" is-current":""}`,title:P.relPath,onClick:()=>w(P),children:[u.jsx(wc,{source:"worktrees"}),u.jsx("span",{children:P.name}),P.current&&u.jsx("i",{children:"HEAD"})]},P.relPath)))]}),u.jsxs("section",{className:`repository-ws-section${I.has("branches")?" is-collapsed":""}`,children:[C("branches"),!I.has("branches")&&(f?u.jsx(mv,{t:e,label:e("repository.discovery.loadRefsFailed"),onRetry:L}):z("branches"))]}),u.jsxs("section",{className:`repository-ws-section${I.has("tags")?" is-collapsed":""}`,children:[C("tags"),!I.has("tags")&&!f&&z("tags")]}),u.jsxs("section",{className:`repository-ws-section${I.has("stashes")?" is-collapsed":""}`,children:[C("stashes"),!I.has("stashes")&&!f&&z("stashes")]})]})]})}function mv({t:e,label:t,onRetry:n}){return u.jsxs("div",{className:"repository-ws-tree-error",children:[u.jsx("span",{children:t}),u.jsx("button",{type:"button",onClick:n,children:e("repository.common.retry")})]})}function wc({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 u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function gee({t:e,query:t,onQuery:n,totalCount:i,matchedCount:s,scanDepth:o,onScanDepth:l,truncated:d,onEnter:f}){return u.jsxs("div",{className:"repository-discovery",children:[u.jsx("input",{type:"text",className:"repository-filter-input",placeholder:e("repository.discovery.placeholder"),"aria-label":e("repository.discovery.aria"),value:t,onChange:p=>n(p.target.value),onKeyDown:p=>{p.key!=="Enter"||p.nativeEvent.isComposing||f()}}),t?u.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":e("repository.discovery.clearSearch"),onClick:()=>n(""),children:"✕"}):null,u.jsxs("span",{className:"repository-discovery-depth",children:[e("repository.discovery.depth"),u.jsx("button",{type:"button",className:"repository-depth-step","aria-label":e("repository.discovery.scanShallower"),disabled:o<=yO,onClick:()=>l(o-1),children:"−"}),u.jsx("output",{className:"repository-depth-value",children:o}),u.jsx("button",{type:"button",className:"repository-depth-step","aria-label":e("repository.discovery.scanDeeper"),disabled:o>=_O,onClick:()=>l(o+1),children:"+"})]}),u.jsx("span",{className:"repository-scan-count",children:t?e("repository.discovery.countMatched",{matched:s,total:i}):d?e("repository.discovery.countFoundLimited",{count:i}):e("repository.discovery.countFound",{count:i})})]})}function wO({node:e,depth:t,selectedRel:n,onRepository:i}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([s,o])=>u.jsx(yee,{dirKey:s,node:o,depth:t,selectedRel:n,onRepository:i},s)),e.repos.map(s=>u.jsx(U0,{repo:s,depth:t,selectedRel:n,onRepository:i},s.relPath))]})}function yee({dirKey:e,node:t,depth:n,selectedRel:i,onRepository:s}){const[o,l]=_.useState(!1),d=_.useCallback(()=>l(b=>!b),[]),{label:f,node:p}=pQ(e,t),m=n*16+12,y=rO(p);return u.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`,gridTemplateColumns:"12px 15px 1fr auto"},onClick:d,"aria-expanded":!o,children:[u.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"repository-folder-name",children:f}),u.jsx("span",{className:"repository-folder-count",children:y})]}),!o&&u.jsx(wO,{node:p,depth:n+1,selectedRel:i,onRepository:s})]})}function U0({repo:e,depth:t,selectedRel:n,onRepository:i,nameMatch:s}){const o=t*16+30;return u.jsxs("button",{type:"button",title:e.relPath,className:`repository-ref-row${e.relPath===n?" is-current":""}`,style:{paddingLeft:`${o}px`},onClick:()=>i(e),children:[u.jsx(wc,{source:"repositories"}),u.jsx("span",{className:"repository-ref-name",children:s?Array.from(e.name).map((l,d)=>s.includes(d)?u.jsx("b",{className:"repository-ref-hl",children:l},d):l):e.name}),e.relPath===n&&u.jsx("span",{className:"repository-ref-mark",children:"✓"}),e.branch&&u.jsx("span",{className:"repository-ref-sub",children:e.branch})]})}function SO(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const _ee={id:"repository",title:e=>Eo(e)("repository.panel.title"),defaultWidth:420,icon:()=>u.jsx(SO,{}),render:e=>u.jsx(dee,{ctx:e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>{const s=bO(t),o=await fetch("/plugins/repository/palette-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,repoRel:s,query:e,limit:n}),signal:i});if(!o.ok)throw new Error("repository_search_failed");const l=await o.json();return l.commits.map(d=>({id:`${l.repoRel}:${d.fullHash}`,title:d.subject,subtitle:d.shortHash,activate:()=>DQ(t,l.repoRel,d.fullHash)}))}},vee={id:"repository",railPanels:[_ee]},bee=[vee],Xf=["claude-code","codex","cursor","opencode"],wee={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"};function See({source:e,skill:t,theaterId:n,onCancel:i,onStarted:s,jobLog:o,t:l}){const[d,f]=_.useState(n?"project":"global"),[p,m]=_.useState(!0),[y,b]=_.useState(new Set(Xf)),{status:w,start:S}=o,x=w==="running",k=w==="done",L=w==="error",F=_.useCallback(()=>{m(!0),b(new Set(Xf))},[]),q=_.useCallback($=>{m(!1),b(I=>{const N=new Set(I);return N.has($)?N.delete($):N.add($),N})},[]),T=_.useCallback(()=>{const $=p?Xf:Array.from(y);if($.length===0)return;const I={source:e,skill:t,scope:d,agents:$};d==="project"&&n&&(I.theaterId=n),S("/plugins/skills/install",I),s(d)},[p,y,e,t,d,n,S,s]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${d==="project"?" is-active":""}`,onClick:()=>f("project"),disabled:!n||x||k,title:n?void 0:l("skills.install.selectTheater"),children:l("skills.scope.project")}),u.jsx("button",{type:"button",className:`skills-scope-btn${d==="global"?" is-active":""}`,onClick:()=>f("global"),disabled:x||k,children:l("skills.scope.global")})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:F,disabled:x||k,children:l("skills.install.allAgents")}),Xf.map($=>u.jsx("button",{type:"button",className:`skills-agent-chip${!p&&y.has($)?" is-active":""}`,onClick:()=>q($),disabled:x||k,children:wee[$]},$))]}),u.jsx("p",{className:"skills-permission-warning",children:l("skills.install.permissionWarning")}),!x&&!k&&!L&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:l("skills.action.cancel")}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:T,disabled:!p&&y.size===0,children:l("skills.install.installNow")})]})]})}const xee=4e3;function xO({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:s,onDismiss:o,onRetry:l,t:d}){const[f,p]=_.useState(!1),m=_.useRef(null),y=_.useRef(null);_.useEffect(()=>{e==="running"&&p(!1)},[e]),_.useEffect(()=>{const L=m.current;L&&(L.scrollTop=L.scrollHeight)},[t]),_.useEffect(()=>{if(e==="done")return y.current=setTimeout(()=>{p(!1),o()},xee),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[e,o]);const b=_.useCallback(()=>{y.current&&(clearTimeout(y.current),y.current=null),p(!1),o()},[o]),w=_.useCallback(()=>p(L=>!L),[]);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",x=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",k=e==="running"?n:e==="done"?i:s;return u.jsxs("div",{className:"skills-dock",children:[f&&u.jsxs("div",{ref:m,className:"skills-dock-log",children:[t.map((L,F)=>u.jsx("div",{className:"skills-dock-log-line",children:L},F)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",s]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${f?" is-open":""}`,"aria-expanded":f,onClick:w,onKeyDown:L=>{L.target===L.currentTarget&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),w())},children:[u.jsx("span",{className:S,"aria-hidden":"true"}),u.jsx("span",{className:x,"aria-live":"polite",children:k}),e==="running"&&t.length>0&&u.jsx("span",{className:"skills-dock-count",children:d(t.length===1?"skills.status.lines_one":"skills.status.lines_other",{count:t.length})}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":d("skills.action.dismiss"),onClick:L=>{L.stopPropagation(),b()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[l!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:L=>{L.stopPropagation(),l()},children:d("skills.action.retry")}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":d("skills.action.dismiss"),onClick:L=>{L.stopPropagation(),b()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${f?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const Cee={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},W0=new Set;let Si=Cee;function Ao(){for(const e of W0)e()}function kee(e){return W0.add(e),()=>{W0.delete(e)}}function TT(){return Si}function ZS(){return _.useSyncExternalStore(kee,TT,TT)}function pd(e){Si={...Si,activeTab:e},Ao()}function q0(e){Si={...Si,scope:e},Ao()}function CO(e){Si={...Si,filterText:e},Ao()}function Eee(e){Si={...Si,searchQuery:e},Ao()}function Sc(e,t){Si={...Si,searchResults:e,searchLoading:t},Ao()}function bm(e){return e??""}function wm(e,t){return e.installedContextKey===t}function gv(e,t,n){Si.installedContextKey===e&&(Si={...Si,installedList:t,installedLoading:n},Ao())}function G0(e){Si={...Si,installFormOpenId:e},Ao()}function Aee(e){Si={...Si,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ao()}const RT=750;function kO(){const[e,t]=_.useState({status:"idle",lines:[]}),n=_.useRef(null),i=_.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);_.useEffect(()=>()=>i(),[i]);const s=_.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=_.useCallback((l,d)=>{i(),t({status:"running",lines:[]}),(async()=>{const f=await fetch(l,{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 y=async()=>{const b=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(p)}&cursor=${m}`).catch(()=>null);if(!b?.ok){t(S=>({...S,status:"error"}));return}const w=await b.json();m=w.nextCursor,t(S=>({...S,lines:[...S.lines,...w.lines]})),w.status==="running"?n.current=setTimeout(()=>{y()},RT):t(S=>({...S,status:w.status}))};n.current=setTimeout(()=>{y()},RT)})()},[i]);return{...e,start:o,reset:s}}const Tee=300,Sp=2;function Ree(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function Mee(e){if(e.length<Sp){Sc([],!1);return}Sc([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Sc([],!1);return}const n=await t.json();Sc(n.skills??[],!1)}catch{Sc([],!1)}}function Lee({result:e,theaterId:t,isFormOpen:n,onInstallClick:i,onReadMore:s,onInstallStarted:o,jobLog:l,t:d}){const f={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>s(f,e.id),title:d("skills.action.readSkillMdPreview"),children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:Ree(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:d(n?"skills.action.cancel":"skills.action.install")})}),n&&u.jsx(See,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:p=>o(e.name,p),jobLog:l,t:d})]})}function Nee({theaterId:e,onReadMore:t,onInstallSuccess:n,t:i}){const{searchQuery:s,searchResults:o,searchLoading:l,installFormOpenId:d}=ZS(),f=_.useRef(null),p=kO(),[m,y]=_.useState(null),b=_.useCallback(S=>{if(Eee(S),f.current&&clearTimeout(f.current),S.length<Sp){Sc([],!1);return}f.current=setTimeout(()=>{Mee(S)},Tee)},[]);_.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),_.useEffect(()=>{p.status!=="done"||!m||(n(m.name,m.scope),G0(null),y(null))},[p.status,m,n]);const w=m?i("skills.status.installingNamed",{name:m.name}):i("skills.status.installing");return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:i("skills.filter.searchPlaceholder"),value:s,onChange:S=>b(S.target.value),"aria-label":i("skills.filter.searchAria")}),l&&u.jsx("div",{className:"skills-empty-state",children:i("skills.empty.searching")}),!l&&s.length>=Sp&&o.length===0&&u.jsx("div",{className:"skills-empty-state",children:i("skills.empty.noResults",{query:s})}),!l&&s.length>0&&s.length<Sp&&u.jsx("div",{className:"skills-empty-state",children:i("skills.empty.minQuery")}),u.jsx("div",{className:"skills-card-list",children:o.map(S=>u.jsx(Lee,{result:S,theaterId:e,isFormOpen:d===S.id,onInstallClick:()=>G0(d===S.id?null:S.id),onReadMore:t,onInstallStarted:(x,k)=>y({name:x,scope:k}),jobLog:p,t:i},S.id))})]}),u.jsx(xO,{status:p.status,lines:p.lines,runningLabel:w,doneLabel:i("skills.status.installed"),errorLabel:i("skills.status.installFailed"),onDismiss:p.reset,t:i})]})}const Oee={"skills.panel.title":"Skills","skills.tab.installed":"Installed","skills.tab.find":"Find","skills.filter.installedPlaceholder":"Filter installed skills…","skills.filter.installedAria":"Filter installed skills","skills.filter.searchPlaceholder":"Search skills.sh registry…","skills.filter.searchAria":"Search skills registry","skills.tab.panelsAria":"Skills panels","skills.empty.loading":"Loading…","skills.empty.noMatch":"No skills match the filter.","skills.empty.noneInstalled":"No {scope} skills installed.","skills.empty.searching":"Searching…","skills.empty.noResults":'No results for "{query}".',"skills.empty.minQuery":"Type at least 2 characters to search.","skills.action.install":"Install","skills.action.cancel":"Cancel","skills.action.readSkillMd":"Read SKILL.md","skills.action.readSkillMdPreview":"Read SKILL.md preview","skills.action.updateAll":"Update all","skills.action.updateAllTitle":"Updates all {scope} skills","skills.action.updating":"Updating…","skills.action.removeConfirm":"Remove?","skills.action.removeAria":"Remove {name}","skills.action.removeConfirmAria":"Confirm remove {name}","skills.action.retry":"Retry","skills.action.dismiss":"Dismiss","skills.status.installing":"Installing…","skills.status.installingNamed":"Installing {name}…","skills.status.installed":"Installed","skills.status.installFailed":"Install failed","skills.status.updatingSkills":"Updating skills…","skills.status.updated":"Updated","skills.status.updateFailed":"Update failed","skills.status.lines_one":"{count} line","skills.status.lines_other":"{count} lines","skills.scope.project":"Project","skills.scope.global":"Global","skills.toast.installed":"Installed {name} to {scope}","skills.install.permissionWarning":"Skills run with full agent permissions. Review before use — open the name to read SKILL.md.","skills.install.selectTheater":"Select a Theater to install project skills","skills.install.allAgents":"All agents","skills.install.installNow":"Install now","skills.scope.viewProjectTitle":"Select a Theater to view project skills","skills.overlay.close":"Close","skills.overlay.skillMdAria":"{name} SKILL.md","skills.overlay.loading":"Loading SKILL.md…","skills.overlay.loadFailed":"Could not load SKILL.md.","skills.overlay.permissionWarning":"Skills run with full agent permissions. Review before use.","skills.markdown.copy":"Copy","skills.markdown.copyCodeAria":"Copy {language} code","skills.markdown.copied":"Copied"},Iee={"skills.panel.title":"스킬","skills.tab.installed":"설치됨","skills.tab.find":"찾기","skills.filter.installedPlaceholder":"설치된 스킬 필터…","skills.filter.installedAria":"설치된 스킬 필터","skills.filter.searchPlaceholder":"skills.sh 레지스트리 검색…","skills.filter.searchAria":"skills.sh 레지스트리 검색","skills.tab.panelsAria":"스킬 패널","skills.empty.loading":"불러오는 중…","skills.empty.noMatch":"필터와 일치하는 스킬이 없습니다.","skills.empty.noneInstalled":"설치된 {scope} 스킬이 없습니다.","skills.empty.searching":"검색 중…","skills.empty.noResults":"'{query}'에 대한 결과가 없습니다.","skills.empty.minQuery":"검색하려면 최소 2자를 입력하세요.","skills.action.install":"설치","skills.action.cancel":"취소","skills.action.readSkillMd":"SKILL.md 읽기","skills.action.readSkillMdPreview":"SKILL.md 미리보기","skills.action.updateAll":"모두 업데이트","skills.action.updateAllTitle":"모든 {scope} 스킬 업데이트","skills.action.updating":"업데이트 중…","skills.action.removeConfirm":"제거할까요?","skills.action.removeAria":"{name} 제거","skills.action.removeConfirmAria":"{name} 제거 확인","skills.action.retry":"다시 시도","skills.action.dismiss":"닫기","skills.status.installing":"설치 중…","skills.status.installingNamed":"{name} 설치 중…","skills.status.installed":"설치됨","skills.status.installFailed":"설치 실패","skills.status.updatingSkills":"스킬 업데이트 중…","skills.status.updated":"업데이트됨","skills.status.updateFailed":"업데이트 실패","skills.status.lines_one":"{count}줄","skills.status.lines_other":"{count}줄","skills.scope.project":"프로젝트","skills.scope.global":"전역","skills.toast.installed":"{name}을(를) {scope}에 설치했습니다","skills.install.permissionWarning":"스킬은 에이전트 전체 권한으로 실행됩니다. 사용 전 확인하세요 — 이름을 열어 SKILL.md를 읽으세요.","skills.install.selectTheater":"프로젝트 스킬을 설치하려면 Theater를 선택하세요","skills.install.allAgents":"모든 에이전트","skills.install.installNow":"지금 설치","skills.scope.viewProjectTitle":"프로젝트 스킬을 보려면 Theater를 선택하세요","skills.overlay.close":"닫기","skills.overlay.skillMdAria":"{name} SKILL.md","skills.overlay.loading":"SKILL.md 불러오는 중…","skills.overlay.loadFailed":"SKILL.md를 불러올 수 없습니다.","skills.overlay.permissionWarning":"스킬은 에이전트 전체 권한으로 실행됩니다. 사용 전 확인하세요.","skills.markdown.copy":"복사","skills.markdown.copyCodeAria":"{language} 코드 복사","skills.markdown.copied":"복사됨"},MT={en:Oee,ko:Iee},Dee={en:Ns(MT,"en"),ko:Ns(MT,"ko")};function JS(e){return Dee[e??"en"]}function jee(e){return{copyLabel:e("skills.markdown.copy"),copyAriaLabel:t=>e("skills.markdown.copyCodeAria",{language:t})}}const Bee=2600;function Pee({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:s,t:o}){const[l,d]=_.useState(!1),f=_.useRef(null),p=_.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),m=_.useCallback(()=>{l?(p(),d(!1),i?.(e.name,e.scope)):(d(!0),f.current=setTimeout(()=>d(!1),Bee))},[l,p,i,e.name,e.scope]);return _.useEffect(()=>()=>p(),[p]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:o("skills.action.readSkillMd"),children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[n&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:o("skills.action.updateAllTitle",{scope:o(e.scope==="project"?"skills.scope.project":"skills.scope.global")}),onClick:()=>n(e.scope),disabled:s,children:o(s?"skills.action.updating":"skills.action.updateAll")}),i&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${l?" is-armed":""}`,onClick:m,"aria-label":l?o("skills.action.removeConfirmAria",{name:e.name}):o("skills.action.removeAria",{name:e.name}),children:l?o("skills.action.removeConfirm"):"✕"})]})]})}async function zee(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function $ee({theaterId:e,onReadMore:t,refreshKey:n,t:i,language:s}){const o=ZS(),{scope:l,filterText:d}=o,f=bm(e),p=wm(o,f)?o.installedList:[],m=wm(o,f)&&o.installedLoading,y=kO(),b=_.useRef(null),w=_.useCallback($=>{const I=bm($);gv(I,[],!0),zee($).then(N=>gv(I,N,!1)).catch(()=>gv(I,[],!1))},[]);_.useEffect(()=>{w(e)},[e,w,n]),_.useEffect(()=>{(y.status==="done"||y.status==="error")&&w(e)},[y.status,e,w]);const S=_.useCallback($=>{const I=$;b.current=I;const N={scope:I};I==="project"&&e&&(N.theaterId=e),y.start("/plugins/skills/update",N)},[e,y]),x=_.useCallback(($,I)=>{const N={scope:I,skill:$};I==="project"&&e&&(N.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}).then(()=>w(e)).catch(()=>null)},[e,w]),k=_.useCallback(()=>{b.current&&S(b.current)},[S]),L=l==="project"&&!e?"global":l,F=p.filter($=>$.scope!==L?!1:d?$.name.toLowerCase().includes(d.toLowerCase()):!0),q=y.status==="running"&&b.current===L,T=(s??"en")==="en"?L:i(L==="project"?"skills.scope.project":"skills.scope.global");return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${L==="project"?" is-active":""}`,onClick:()=>q0("project"),disabled:!e,title:e?void 0:i("skills.scope.viewProjectTitle"),children:i("skills.scope.project")}),u.jsx("button",{type:"button",className:`skills-scope-btn${L==="global"?" is-active":""}`,onClick:()=>q0("global"),children:i("skills.scope.global")})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:i("skills.filter.installedPlaceholder"),value:d,onChange:$=>CO($.target.value),"aria-label":i("skills.filter.installedAria")}),m&&u.jsx("div",{className:"skills-empty-state",children:i("skills.empty.loading")}),!m&&F.length===0&&u.jsx("div",{className:"skills-empty-state",children:d?i("skills.empty.noMatch"):i("skills.empty.noneInstalled",{scope:T})}),u.jsx("div",{className:"skills-card-list",children:F.map($=>u.jsx(Pee,{skill:$,onReadMore:t,onUpdate:S,onRemove:x,isUpdating:q,t:i},`${$.scope}:${$.name}`))})]}),u.jsx(xO,{status:y.status,lines:y.lines,runningLabel:i("skills.status.updatingSkills"),doneLabel:i("skills.status.updated"),errorLabel:i("skills.status.updateFailed"),onDismiss:y.reset,onRetry:k,t:i})]})}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 Fee({content:e,language:t}){const n=JS(t),i=_.useMemo(()=>{const l=es(e,jee(n)).html,d=new DOMParser().parseFromString(l,"text/html");return yv(d.body),d.body.innerHTML},[e,n]),s=_.useRef(null);_.useEffect(()=>{const l=s.current;if(!l)return;yv(l);const d=new MutationObserver(()=>yv(l));return d.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>d.disconnect()},[i]);const o=_.useCallback(l=>{const d=l.target.closest('[data-action="copy-code"]');if(!d)return;const f=d.closest("pre")?.getAttribute("data-code");if(!f)return;navigator.clipboard?.writeText(f);const p=d.textContent;d.textContent=n("skills.markdown.copied"),window.setTimeout(()=>{d.textContent=p},1200)},[n]);return u.jsx("div",{ref:s,className:"markdown-body",onClick:o,dangerouslySetInnerHTML:{__html:i}})}const Hee=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Uee(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(Hee)),i=n[0],s=n[n.length-1];!i||!s||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),s.focus()):!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),i.focus()))}function Wee({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:s,t:o,language:l}){const[d,f]=_.useState(null),[p,m]=_.useState(!1),y=_.useRef(null),b=_.useRef(null),w=_.useRef(null);if(_.useEffect(()=>{e&&y.current===null&&(y.current=document.activeElement)},[e]),_.useEffect(()=>{if(!e){f(null);return}m(!0),f(null);let x=!1;return(async()=>{try{let L;if(t){const q={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(q.theaterId=n),L=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(q)})}else L=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:n})});if(x)return;if(!L.ok){m(!1);return}const F=await L.json();x||(f(F.markdown??""),m(!1))}catch{x||m(!1)}})(),()=>{x=!0}},[e,t,n]),_.useEffect(()=>{if(!e)return;const x=k=>{k.key==="Escape"?(k.preventDefault(),i()):k.key==="Tab"&&Uee(k,w.current),k.stopImmediatePropagation()};return b.current?.focus(),window.addEventListener("keydown",x,!0),()=>{window.removeEventListener("keydown",x,!0);const k=y.current;y.current=null,k?.focus?.()}},[e,i]),_.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const S=e.displayPath||e.source||null;return xa.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:u.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":o("skills.overlay.skillMdAria",{name:e.name}),className:"skills-overlay-dialog",onClick:x=>x.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&u.jsx("span",{className:"skills-overlay-meta",children:S}),u.jsx("button",{ref:b,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":o("skills.overlay.close"),children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[p&&u.jsx("div",{className:"skills-empty-state",children:o("skills.overlay.loading")}),!p&&d===null&&u.jsx("div",{className:"skills-empty-state",children:o("skills.overlay.loadFailed")}),d!==null&&u.jsx(Fee,{content:d,language:l})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:o("skills.overlay.permissionWarning")}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),s()},children:o("skills.action.install")})]})]})}),document.body)}const K0=new Set;let qee=0,Sm=null;function Gee(e,t,n){Sm={theaterId:e,name:t,scope:n,requestId:++qee},EO()}function Kee(e){Sm?.requestId===e.requestId&&(Sm=null,EO())}function Vee(){return _.useSyncExternalStore(Yee,LT,LT)}function Yee(e){return K0.add(e),()=>{K0.delete(e)}}function LT(){return Sm}function EO(){for(const e of K0)e()}const Xee=3200;function Zee({message:e,onDismiss:t}){return _.useEffect(()=>{if(!e)return;const n=setTimeout(t,Xee);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function Jee({ctx:e}){const t=bm(e.theaterId);return u.jsx(Qee,{ctx:e},t)}function Qee({ctx:e}){const{theaterId:t}=e,n=JS(e.language),i=ZS(),{activeTab:s}=i,o=bm(e.theaterId),[l,d]=_.useState(null),[f,p]=_.useState(null),[m,y]=_.useState(0),b=Vee(),w=wm(i,o)?i.installedList.length:0;_.useLayoutEffect(()=>{Aee(o)},[o]),_.useLayoutEffect(()=>{!b||b.theaterId!==t||(pd("installed"),q0(b.scope),CO(""))},[b,t]),_.useLayoutEffect(()=>{if(!b||b.theaterId!==t||!wm(i,o)||i.installedLoading)return;const F=i.installedList.find(q=>q.name===b.name&&q.scope===b.scope);F&&(d({skill:F,isInstalled:!0}),Kee(b))},[o,b,i,t]);const S=_.useCallback(F=>{d({skill:F,isInstalled:!0})},[]),x=_.useCallback((F,q)=>{d({skill:F,isInstalled:!1,registryId:q})},[]),k=_.useCallback((F,q)=>{const T=(e.language??"en")==="en"?q:n(q==="project"?"skills.scope.project":"skills.scope.global");p(n("skills.toast.installed",{name:F,scope:T})),y($=>$+1),pd("installed")},[e.language,n]),L=_.useCallback(()=>{l?.registryId&&(G0(l.registryId),pd("find")),d(null)},[l]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":n("skills.tab.panelsAria"),children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":s==="installed",className:`skills-tab-btn${s==="installed"?" is-active":""}`,onClick:()=>pd("installed"),children:[n("skills.tab.installed"),w>0?` ${w}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":s==="find",className:`skills-tab-btn${s==="find"?" is-active":""}`,onClick:()=>pd("find"),children:n("skills.tab.find")})]}),s==="installed"?u.jsx($ee,{theaterId:t,onReadMore:S,refreshKey:m,t:n,language:e.language}):u.jsx(Nee,{theaterId:t,onReadMore:x,onInstallSuccess:k,t:n}),u.jsx(Zee,{message:f,onDismiss:()=>p(null)}),u.jsx(Wee,{skill:l?.skill??null,isInstalled:l?.isInstalled??!1,theaterId:t,onClose:()=>d(null),onInstall:L,t:n,language:e.language})]})}function ete(){return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const tte={id:"skills",title:e=>JS(e)("skills.panel.title"),defaultWidth:360,icon:ete,render:e=>u.jsx(Jee,{ctx:e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>{const s=await fetch("/plugins/skills/palette-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,query:e,limit:n}),signal:i});if(!s.ok)throw new Error("skills_search_failed");return(await s.json()).skills.map(l=>({id:`${l.scope}:${l.name}`,title:l.name,subtitle:l.scope,activate:()=>Gee(t,l.name,l.scope)}))}},nte={id:"skills",railPanels:[tte]},ite=[nte],AO=[...RZ,...FJ,...bee,...ite],rte=RO(AO),TO=_.createContext(rte),ste=TO.Provider;async function ate(){const e=[...AO],t=new Set(e.map(i=>i.id)),n=await ote();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const s=await lte(i);if(s){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}t.add(s.id),e.push(s)}}return RO(e)}function Qc(){return _.useContext(TO)}async function ote(){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(ute):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function lte(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return cte(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 RO(e){const t=new Set,n=[];for(const i of e)for(const s of i.railPanels??[]){if(t.has(s.id)){console.warn(`Skipping rail panel with duplicate id: ${s.id}`);continue}t.add(s.id),n.push(s)}return{plugins:e,operationKinds:e.flatMap(i=>i.operationKinds??[]),settingsSections:e.flatMap(i=>i.settingsSections??[]),notificationKinds:e.flatMap(i=>i.notificationKinds??[]),railPanels:n}}function cte(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function ute(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 MO=!1;const V0=new Set;function dte(){return _.useSyncExternalStore(hte,NT,NT)}function NT(){return MO}function LO(e){MO=fte(e)?e.fullscreen:!1;for(const t of V0)t()}function OT(){LO({fullscreen:!1})}function hte(e){return V0.add(e),()=>V0.delete(e)}function fte(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 NO="(display-mode: fullscreen)",pte=480,mte=480,gte=()=>!0;function yte(){return typeof window<"u"&&window.matchMedia(NO).matches}function _te(e=gte){const t=dte(),[n,i]=_.useState(yte),s=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||s&&t,l=_.useRef(o);l.current=o;const d=_.useRef(!1),f=_.useRef(null),[p,m]=_.useState(o),[y,b]=_.useState(!0),[w,S]=_.useState(!1),x=_.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),k=_.useCallback(T=>{x(),!(!l.current||d.current)&&(f.current=setTimeout(()=>{f.current=null,l.current&&!d.current&&e()&&b(!1)},T))},[e,x]),L=_.useCallback(()=>{x(),l.current&&b(!0)},[x]),F=_.useCallback(()=>k(mte),[k]),q=_.useCallback(()=>{const T=!d.current;d.current=T,S(T),T&&(x(),b(!0))},[x]);return _.useEffect(()=>{const T=window.matchMedia(NO),$=()=>i(T.matches);return $(),T.addEventListener("change",$),()=>T.removeEventListener("change",$)},[]),_.useLayoutEffect(()=>(x(),m(o),b(!0),o&&!d.current&&k(pte),x),[x,o,k]),{isFullscreen:p,isVisible:y,isPinned:w,reveal:L,hideAfterLeave:F,togglePin:q}}function vte({operationsViewVisible:e}){const t=rt(),n=ps(),i=Qc(),s=hM(),o=MM(),l=Ste(),d=`${l}${l==="⌘"?"":"+"}B`,f=`${l}${l==="⌘"?"⌥":"+Alt+"}B`,p=Cw(),m=fR(),y=Nm(),b=n.theaters.find(Ne=>Ne.id===n.activeTheaterId)??null,w=MP(n.operations,n.activeOperationId,n.activeTheaterId),S=w?i.plugins.find(Ne=>Ne.id===w.pluginId):null,x=typeof w?.payload.cliId=="string"?w.payload.cliId:null,k=typeof w?.payload.cliLabel=="string"?w.payload.cliLabel:x,L=w?S?.operationKinds?.find(Ne=>Ne.type===w.type)??null:null,F=xl(),q=hr(F.state?.language??"auto"),T=L?Sl(L.title,q):null,$=w&&S?.renderLaunchIcon?S.renderLaunchIcon({id:x??w.type,type:w.type,title:T??w.type}):null,I=_.useRef(null),N=_.useRef(null),V=_.useRef(null),K=_.useRef(null),Q=_.useRef({edge:!1,band:!1}),Y=_.useRef(null),B=_.useRef(null),M=_.useRef(null),D=_.useRef(null),j=_.useRef(null),[A,O]=_.useState(null),[C,z]=_.useState(0),[P,R]=_.useState(!1),[W,G]=_.useState(null),[U,ee]=_.useState(null),[ne,me]=_.useState(!1),[Me,ve]=_.useState(null),[Ye,qe]=_.useState(null),yt=()=>{G(null),ee(null),me(!1),ve(null),qe(null)},$e=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",We=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?t("chrome.commandBand.local"):t("chrome.commandBand.localDesktop"),mt=_.useCallback(()=>{const Ne=document.activeElement;return!(Ne instanceof Node&&(V.current?.contains(Ne)||K.current?.contains(Ne)))&&!Q.current.edge&&!Q.current.band},[]),ot=_te(mt),Nt=w?.id??null,Ot=_.useRef(null);Ot.current=Nt;const kt=Hw({currentTitle:w?.title??"",onCommit:Ne=>{const jt=fE(Y.current,Ot.current);Y.current=null,jt&&Q5(jt,Ne).then(()=>qi(null)).then(cr).catch(()=>{})}});_.useEffect(()=>{!kt.renaming||fE(Y.current,Nt)||(Y.current=null,kt.cancel())},[kt,Nt]),_.useEffect(()=>{if(!P)return;const Ne=new AbortController;return G(null),ee(null),me(!0),Gj(Ne.signal).then(G).catch(jt=>{Ne.signal.aborted||ee(jt instanceof Error?jt.message:t("chrome.commandBand.unableToLoadEnvironment"))}).finally(()=>{Ne.signal.aborted||me(!1)}),()=>Ne.abort()},[P,t]),_.useEffect(()=>{if(!P)return;const Ne=se=>{const oe=se.target;!(oe instanceof Node)||I.current?.contains(oe)||N.current?.contains(oe)||(R(!1),yt())},jt=se=>{se.key==="Escape"&&(R(!1),yt(),I.current?.focus())};return document.addEventListener("pointerdown",Ne),document.addEventListener("keydown",jt),()=>{document.removeEventListener("pointerdown",Ne),document.removeEventListener("keydown",jt)}},[P]),_.useEffect(()=>{if(A===null)return;const Ne=A==="theater"?B:M,jt=oe=>{const ge=oe.target;!(ge instanceof Node)||Ne.current?.contains(ge)||j.current?.contains(ge)||O(null)},se=oe=>{oe.key==="Escape"&&(O(null),Ne.current?.focus())};return document.addEventListener("pointerdown",jt),document.addEventListener("keydown",se),()=>{document.removeEventListener("pointerdown",jt),document.removeEventListener("keydown",se)}},[A]),_.useEffect(()=>{O(null)},[n.activeTheaterId,n.activeOperationId]),_.useLayoutEffect(()=>{if(A===null)return;const Ne=()=>{const jt=D.current,se=j.current;if(!jt||!se)return;const oe=A==="operation"?M.current?.offsetLeft??0:0;z(NP(oe,jt.getBoundingClientRect().left,se.getBoundingClientRect().width,window.innerWidth))};return Ne(),window.addEventListener("resize",Ne),()=>window.removeEventListener("resize",Ne)},[A]),_.useEffect(()=>{n.channel!=="local"&&(R(!1),G(null),ee(null),me(!1),ve(null),qe(null))},[n.channel]);const ye=Ne=>{navigator.clipboard.writeText(Ne).then(()=>{ve(Ne),qe(null)}).catch(()=>{qe(Ne),ve(null)})},ze=()=>{w&&(O(null),Y.current=w.id,kt.begin())},Je=Ne=>{R(!1),yt(),O(jt=>jt===Ne?null:Ne)},It=Ne=>{A===null||!LP(Ne.currentTarget,Ne.relatedTarget)||O(null)},Ke=Ne=>{O(null),B.current?.focus(),Ne!==n.activeTheaterId&&Dw(Ne)},en=Ne=>{O(null),M.current?.focus(),yl(Ne)},we=()=>{O(null),B.current?.focus(),nP()},De=()=>{b&&(O(null),M.current?.focus(),rP(b.id))},de=RP(n.operations,n.groups,n.activeTheaterId,p.operationOrder),Pe=()=>{mt()&&ot.hideAfterLeave()},st=Ne=>{const jt=Ne.relatedTarget;(!(jt instanceof Node)||!V.current?.contains(jt)&&!K.current?.contains(jt))&&!Q.current.edge&&!Q.current.band&&ot.hideAfterLeave()},ft=()=>{Q.current.edge=!0,ot.reveal()},Dt=()=>{Q.current.edge=!1,Pe()},Gt=()=>{Q.current.band=!0,ot.reveal()},_t=()=>{Q.current.band=!1,Pe()},Tt=ot.isFullscreen&&!ot.isVisible;return u.jsxs(u.Fragment,{children:[u.jsx("button",{ref:K,type:"button",className:`command-band-edge-reveal${ot.isFullscreen?" is-fullscreen":""}`,"aria-label":t("chrome.commandBand.showCommandBand"),onPointerEnter:ft,onPointerLeave:Dt,onFocus:ot.reveal,onBlur:st,onKeyDown:Ne=>{Ne.key==="Tab"&&ot.reveal()}}),u.jsxs("header",{ref:V,className:`command-band${e?" is-operations":" is-utility"}${ot.isFullscreen?" is-fullscreen":""}${ot.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":`${s.width}px`},"aria-hidden":Tt||void 0,inert:Tt||void 0,onPointerEnter:Gt,onPointerLeave:_t,onFocus:ot.reveal,onBlur:st,children:[u.jsxs("div",{className:`command-band-left${e&&s.collapsed?" is-collapsed":""}`,children:[u.jsx(c7,{className:"command-band-brand"}),n.channel==="local"?u.jsxs("div",{className:"command-band-environment",children:[u.jsxs("button",{ref:I,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":P,onClick:()=>{O(null),yt(),R(Ne=>!Ne)},children:[u.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),u.jsx("span",{className:"command-band-local-chip-label",children:$e?We:t("chrome.commandBand.local")})]}),P?u.jsx("div",{ref:N,children:u.jsx(bte,{environment:W,error:U,loading:ne,copiedValue:Me,copyFailedValue:Ye,desktopShell:$e,onCopy:ye})}):null]}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>fo(!s.collapsed),"aria-label":t(s.collapsed?"chrome.commandBand.expandSidebar":"chrome.commandBand.collapseSidebar",{shortcut:d}),title:t(s.collapsed?"chrome.commandBand.expandSidebar":"chrome.commandBand.collapseSidebar",{shortcut:d}),children:u.jsx(IT,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:qR,"aria-label":t("chrome.commandBand.searchSessions"),title:t("chrome.commandBand.searchSessionsTitle"),children:u.jsx(xte,{})})]}),e?u.jsxs("div",{className:"command-band-formation-group",role:"group","aria-label":t("chrome.commandBand.formationView"),children:[u.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>mR({x:0,y:0,zoom:1}),disabled:n.activeTheaterId===null,"aria-label":t("chrome.commandBand.resetCanvasView"),title:t("chrome.commandBand.resetCanvasView"),children:u.jsx(kte,{})}),u.jsx("span",{className:"command-band-formation-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>m_("grid"),disabled:n.activeTheaterId===null,"aria-pressed":y&&m==="grid","aria-label":t("chrome.commandBand.formationGrid"),title:t("chrome.commandBand.formationGrid"),children:u.jsx(Cte,{})}),u.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>m_("columns"),disabled:n.activeTheaterId===null,"aria-pressed":y&&m==="columns","aria-label":t("chrome.commandBand.formationColumns"),title:t("chrome.commandBand.formationColumns"),children:u.jsx(Ete,{})}),u.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>m_("rows"),disabled:n.activeTheaterId===null,"aria-pressed":y&&m==="rows","aria-label":t("chrome.commandBand.formationRows"),title:t("chrome.commandBand.formationRows"),children:u.jsx(Ate,{})})]}):null,u.jsx("div",{className:"command-band-center",children:e&&b?u.jsxs("div",{ref:D,className:"command-band-switcher",onBlur:It,children:[u.jsxs("div",{className:"command-band-theater-cluster","aria-label":t("chrome.commandBand.activeTheater",{label:b.label}),children:[u.jsxs("button",{ref:B,type:"button",className:`command-band-theater-segment command-band-segment-trigger${A==="theater"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":A==="theater",title:t("chrome.commandBand.switchTheater"),onClick:()=>Je("theater"),children:[u.jsx("span",{className:"command-band-theater-mark",children:Gw(b.label)}),u.jsx("span",{className:"command-band-segment-label",children:b.label}),u.jsx(y_,{})]}),u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),w?u.jsxs(u.Fragment,{children:[kt.renaming?u.jsx("input",{ref:kt.inputRef,className:"command-band-rename-input",value:kt.draftTitle,"aria-label":t("chrome.commandBand.renameOperationAria",{title:w.title}),onChange:Ne=>kt.setDraftTitle(Ne.target.value),onKeyDown:kt.handleKeyDown,onBlur:kt.handleBlur}):u.jsxs("button",{ref:M,type:"button",className:`command-band-operation-name command-band-segment-trigger${A==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":A==="operation",title:t("chrome.commandBand.switchOperationRename"),onClick:()=>Je("operation"),onDoubleClick:ze,children:[u.jsx("span",{className:"command-band-segment-label",children:w.title}),u.jsx(y_,{})]}),k?u.jsxs("span",{className:"command-band-operation-attribute",title:T??k,children:[$?u.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:$}):null,k]}):null]}):u.jsxs("button",{ref:M,type:"button",className:`command-band-operation-placeholder command-band-segment-trigger${A==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":A==="operation",title:t("chrome.commandBand.selectOperation"),onClick:()=>Je("operation"),children:[u.jsx("span",{className:"command-band-segment-label",children:t("chrome.commandBand.selectOperationEllipsis")}),u.jsx(y_,{})]})]}),A==="theater"?u.jsx(Rz,{theaters:n.theaters,operations:n.operations,activeTheaterId:n.activeTheaterId,addingTheater:n.addingTheater,onSelectTheater:Ke,onAddTheater:we,style:{left:C},containerRef:j}):null,A==="operation"?u.jsx(Mz,{operations:de,activeOperationId:w?.id??null,theaterLabel:b.label,onSelectOperation:en,onRenameOperation:w?ze:null,onNewOperation:De,style:{left:C},containerRef:j}):null]}):null}),u.jsxs("div",{className:"command-band-right",children:[ot.isFullscreen?u.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:ot.togglePin,"aria-label":t("chrome.commandBand.pinCommandBand"),"aria-pressed":ot.isPinned,title:ot.isPinned?t("chrome.commandBand.unpinCommandBand"):t("chrome.commandBand.pinCommandBand"),children:u.jsx(Tte,{})}):null,e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:Kw,"aria-label":t(o?"chrome.commandBand.collapseActivityRail":"chrome.commandBand.expandActivityRail",{shortcut:f}),title:t(o?"chrome.commandBand.collapseActivityRail":"chrome.commandBand.expandActivityRail",{shortcut:f}),children:u.jsx(IT,{side:"right"})}):null]})]})]})}function bte({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:s,desktopShell:o,onCopy:l}){const d=rt();if(n)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:d("chrome.commandBand.loadingEnvironment")});if(t)return u.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:t});if(!e)return null;const f=wte(d,e,o);return u.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:[u.jsx("div",{className:"command-band-environment-title",children:d("chrome.commandBand.environment")}),f.map(([p,m])=>u.jsxs("div",{className:"command-band-environment-row",children:[u.jsx("span",{children:p}),u.jsx("code",{children:m}),u.jsx("button",{type:"button",onClick:()=>l(m),children:d(i===m?"chrome.commandBand.env.copied":s===m?"chrome.commandBand.env.copyFailed":"chrome.commandBand.env.copy")})]},p)),u.jsx("div",{className:"command-band-environment-footer",children:d("chrome.commandBand.env.footer")})]})}function wte(e,t,n){return[[e("chrome.commandBand.env.channel"),t.channel],[e("chrome.commandBand.env.version"),t.version],[e("chrome.commandBand.env.reachableOn"),`127.0.0.1:${t.effectivePort}`],[e("chrome.commandBand.env.dataRoot"),t.dataDir],[e("chrome.commandBand.env.runtimeLock"),t.lockFile],...n?[[e("chrome.commandBand.env.desktopData"),`${t.dataDir}/desktop`]]:[]]}function Ste(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function xte(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Cte(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function kte(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ete(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function Ate(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function IT({side:e}){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function Tte(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const Rte=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Mte({state:e}){const t=rt(),[n,i]=_.useState(!1),s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),d=e.theaters.length>0;if(_.useEffect(()=>{if(e.onboardingOpen)return s.current=document.activeElement,o.current?.focus(),()=>{const y=s.current;s.current=null,y?.focus?.()}},[e.onboardingOpen]),_.useEffect(()=>{if(!e.onboardingOpen)return;const y=b=>{n||(b.key==="Escape"?(b.preventDefault(),Ku()):b.key==="Tab"&&Lte(b,l.current),b.stopImmediatePropagation())};return window.addEventListener("keydown",y,!0),()=>window.removeEventListener("keydown",y,!0)},[n,e.onboardingOpen]),!e.onboardingOpen)return null;const f=()=>{i(!0)},p=()=>{i(!1)},m=async y=>{i(!1),HR();try{const b=await J5(y),w=await Z5(b);UR(w)}catch(b){ob(b instanceof Error?b.message:String(b))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:Ku,"aria-label":t("chrome.commissioning.closeAria")}),u.jsxs("section",{className:"commissioning-card",ref:l,children:[u.jsxs("header",{className:"commissioning-header",children:[u.jsx("span",{className:"commissioning-eyebrow",children:t("chrome.commissioning.eyebrow")}),u.jsx("h2",{id:"commissioning-title",children:t("chrome.commissioning.title")}),u.jsx("p",{children:t("chrome.commissioning.lead")})]}),u.jsxs("ol",{className:"commissioning-steps",children:[u.jsxs("li",{className:`commissioning-step commissioning-step--primary ${d?"is-complete":"is-current"}`,children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:d?"✓":"01"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:t("chrome.commissioning.step1Title")}),u.jsx("p",{children:t("chrome.commissioning.step1Body")}),d?u.jsx($d,{ref:y=>{o.current=y},className:"commissioning-primary-action",to:"/operations",onClick:Ku,children:t("chrome.commissioning.goToOperationsArrow")}):u.jsx("button",{ref:y=>{o.current=y},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:f,children:e.addingTheater?t("chrome.commissioning.addingTheater"):t("chrome.commissioning.chooseFolder")}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:t("chrome.commissioning.step2Title")}),u.jsx("p",{children:t("chrome.commissioning.step2Body")}),u.jsx($d,{className:"commissioning-secondary-link",to:"/operations",onClick:Ku,children:t("chrome.commissioning.goToOperations")})]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:t("chrome.commissioning.step3Title")}),u.jsx("p",{children:t("chrome.commissioning.step3Body")})]})]})]}),u.jsxs("footer",{className:"commissioning-footer",children:[u.jsx("p",{children:t("chrome.commissioning.footer")}),u.jsx("button",{type:"button",className:"commissioning-skip",onClick:Ku,children:t("chrome.commissioning.skip")})]})]}),u.jsx(eM,{open:n,onCancel:p,onConfirm:m})]})}function Lte(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(Rte)),i=n[0],s=n[n.length-1];!i||!s||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),s.focus()):!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),i.focus()))}let Y0=null;function Nte(e){Y0=e}function Ote(){const e=Y0;return Y0=null,e}function Ite(e){return[{id:"instrument",label:e("palette.theme.instrument")},{id:"maritime",label:e("palette.theme.maritime")},{id:"carbon",label:e("palette.theme.carbon")}]}function Dte(e){return e.startsWith(">")}function DT(e){return e.slice(1)}function jte(e,t,n){const i=[],s=Pte(),o=e.theaters.find(d=>d.id===e.activeTheaterId)??null,l=e.operations.find(d=>d.id===e.activeOperationId&&d.theaterId===e.activeTheaterId)??null;for(const d of e.theaters)i.push({commandId:`switch-theater:${d.id}`,label:n("palette.switchTheater",{label:d.label}),current:d.id===e.activeTheaterId,action:{kind:"switch-theater",theaterId:d.id}});if(o){i.push({commandId:"new-operation",label:n("palette.newOperation",{label:o.label}),current:!1,action:{kind:"new-operation"}});const d=e.operations.filter(f=>f.theaterId===o.id);for(const f of d)_o(f,e.operationStatus)==="dormant"&&i.push({commandId:`resume-operation:${f.id}`,label:n("palette.resumeOperation",{title:f.title}),current:!1,action:{kind:"resume-operation",operationId:f.id}}),i.push({commandId:`close-operation:${f.id}`,label:n("palette.closeOperation",{title:f.title}),current:!1,action:{kind:"close-operation",operationId:f.id}});d.length>0&&i.push({commandId:"minimize-all-operations",label:n("palette.minimizeAll"),current:!1,action:{kind:"minimize-all-operations"}}),i.push({commandId:"toggle-formation",label:n("palette.toggleFormation"),current:!1,action:{kind:"toggle-formation"}}),i.push({commandId:"toggle-status-axis",label:n("palette.toggleStatusAxis"),current:!1,action:{kind:"toggle-status-axis"}})}l&&i.push({commandId:"rename-operation",label:n("palette.renameOperation"),current:!1,action:{kind:"rename-operation",operationId:l.id}},{commandId:"assign-operation-group",label:n("palette.assignGroup"),current:!1,action:{kind:"assign-operation-group",operationId:l.id}},{commandId:"set-operation-accent",label:n("palette.setAccent"),current:!1,action:{kind:"set-operation-accent",operationId:l.id}},{commandId:"minimize-operation",label:n("palette.minimizeOperation"),current:!1,action:{kind:"minimize-operation",operationId:l.id}});for(const d of t)i.push({commandId:`open-rail-panel:${d.id}`,label:n("palette.openPanel",{title:Sl(d.title,s)}),current:!1,action:{kind:"open-rail-panel",panelId:d.id}});i.push({commandId:"toggle-rail",label:n("palette.toggleRail"),current:!1,action:{kind:"toggle-rail"}}),i.push({commandId:"toggle-sidebar",label:n("palette.toggleSidebar"),current:!1,action:{kind:"toggle-sidebar"}});for(const d of Ite(n))i.push({commandId:`switch-theme:${d.id}`,label:n("palette.switchTheme",{label:d.label}),current:d.id===e.activeTheme,action:{kind:"switch-theme",theme:d.id}});return i.push({commandId:"open-settings",label:n("palette.openSettings"),current:!1,action:{kind:"open-settings"}}),i.push({commandId:"open-keyboard-shortcuts",label:n("palette.openKeyboardShortcuts"),current:!1,action:{kind:"open-keyboard-shortcuts"}}),e.releaseNotes.length>0&&i.push({commandId:"whats-new",label:n("palette.whatsNew"),current:!1,action:{kind:"whats-new"}}),i}function Bte(e,t){const n=Ow(t);return n.length===0?e:e.filter(i=>{const s=i.label.toLocaleLowerCase();return n.every(o=>s.includes(o))})}function Pte(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}async function OO(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}let n=null;try{n=(await tB(e)).deletion}catch{}return await qi(null).then(cr).catch(()=>{}),n}const zte="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",jT="operation-search-listbox",IO="__unassigned__",BT="operation-search-heading-commands";function $te({state:e,railPanels:t,plugins:n,onDeferredDeletion:i}){const s=rt(),o=Yc(),l=Mr(),[d,f]=_.useState(""),[p,m]=_.useState(0),[y,b]=_.useState([]),w=_.useRef(null),S=_.useRef(null),x=_.useRef(null),k=_.useRef(new Map),L=_.useRef(0),F=Dte(d),q=_.useMemo(()=>_P(e),[e]),T=_.useMemo(()=>D8(q,d),[q,d]),$=_.useMemo(()=>j8(T),[T]),I=_.useMemo(()=>jte(e,t,s),[e,t,s]),N=_.useMemo(()=>F?Bte(I,DT(d)):I,[F,I,d]),V=_.useMemo(()=>Ow(F?DT(d):d),[F,d]),K=_.useMemo(()=>y.flatMap(C=>C.results.map(z=>({group:C,result:z}))),[y]),Q=F?N.length:T.length+K.length,Y=PT(p,Q),B=F?N[Y]?X0(N[Y].commandId):void 0:T[Y]?$T(T[Y].operationId):K[Y-T.length]?FT(K[Y-T.length].group.panelId,K[Y-T.length].result.id):void 0,M=B===void 0?void 0:xp(B);if(_.useEffect(()=>{const C=++L.current;b([]);const z=e.activeTheaterId;if(!e.operationSearchOpen||F||d.trim()===""||!z)return;const P=new AbortController,R=window.setTimeout(()=>{N8(t,d,z,P.signal).then(W=>{P.signal.aborted||C!==L.current||b(W)})},R8);return()=>{window.clearTimeout(R),P.abort()}},[F,d,t,e.activeTheaterId,e.operationSearchOpen,s]),_.useEffect(()=>{if(!e.operationSearchOpen)return;x.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const C=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>w.current?.focus(),0),()=>{document.body.style.overflow=C,x.current?.focus()}},[e.operationSearchOpen]),_.useEffect(()=>{if(!e.operationSearchOpen){f(""),m(0);return}m(0)},[e.operationSearchOpen,d]),_.useEffect(()=>{!e.operationSearchOpen||B===void 0||k.current.get(B)?.scrollIntoView({block:"nearest"})},[B,e.operationSearchOpen]),!e.operationSearchOpen)return null;const D=C=>{x.current=null,yl(C),o("/operations"),Gu()},j=async(C,z)=>{x.current=null;try{await z.activate()}catch{return}o("/operations"),ME(C),yb(!0),Gu()},A=C=>{const z=C.action;switch(z.kind){case"switch-theater":{if(C.current)break;x.current=null,Dw(z.theaterId),o("/operations");break}case"new-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),WR();break}case"resume-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations");const P=e.operations.find(W=>W.id===z.operationId),R=P?n.find(W=>W.id===P.pluginId):void 0;R?.resumeOperation?Promise.resolve(R.resumeOperation(z.operationId)).catch(()=>{}):yl(z.operationId);break}case"close-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),Tr()===z.operationId&&ts();const P=e.operations.find(W=>W.id===z.operationId),R=(P?n.find(W=>W.id===P.pluginId):null)??null;OO(z.operationId,R).then(W=>i?.(W));break}case"minimize-all-operations":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),zT(e);const P=e.operations.filter(R=>R.theaterId===e.activeTheaterId);for(const R of P)_R(R.id);yR(P.map(R=>R.id));break}case"toggle-formation":{l.pathname.startsWith("/operations")||o("/operations"),zT(e),SR();break}case"toggle-status-axis":{l.pathname.startsWith("/operations")||o("/operations"),Hp();break}case"open-rail-panel":{l.pathname.startsWith("/operations")||o("/operations"),ME(z.panelId),yb(!0);break}case"toggle-rail":{l.pathname.startsWith("/operations")||o("/operations"),x.current=document.querySelector(".command-band-rail-toggle"),Kw();break}case"toggle-sidebar":{l.pathname.startsWith("/operations")||o("/operations"),x.current=document.querySelector(".command-band-sidebar-toggle"),fo(!Hd().collapsed);break}case"switch-theme":{if(C.current)break;const P=e.activeTheme;$c(z.theme),So("theme",z.theme).then(R=>{R||$c(P)});break}case"open-settings":{x.current=null,o("/settings");break}case"open-keyboard-shortcuts":{Nte(x.current),x.current=null,aP();break}case"rename-operation":case"assign-operation-group":case"set-operation-accent":case"minimize-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),Hd().collapsed&&fo(!1),$7(z.operationId,Fte(z.kind));break}case"whats-new":{GR();break}}Gu()},O=C=>{if(C.key==="Escape"){C.preventDefault(),Gu();return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){C.preventDefault(),m(z=>PT(z+(C.key==="ArrowDown"?1:-1),Q));return}if(C.key==="Enter"){if(F){const R=N[Y];if(!R)return;C.preventDefault(),A(R);return}const z=T[Y];if(z){C.preventDefault(),D(z.operationId);return}const P=K[Y-T.length];if(!P)return;C.preventDefault(),j(P.group.panelId,P.result);return}C.key==="Tab"&&Kte(C,S.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:C=>{C.target===C.currentTarget&&Gu()},children:u.jsxs("section",{ref:S,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":s(F?"chrome.operationSearch.commandsDialog":"chrome.operationSearch.quickSearchDialog"),tabIndex:-1,onKeyDown:O,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(Vte,{}),u.jsx("input",{ref:w,id:"operation-search-input",type:"search",value:d,onChange:C=>f(C.target.value),placeholder:s("chrome.operationSearch.placeholder"),autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":jT,"aria-activedescendant":M,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:jT,className:"operation-search-results",role:"listbox","aria-label":s(F?"chrome.operationSearch.commandResults":"chrome.operationSearch.operationResults"),children:F?N.length>0?u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":BT,children:[u.jsx("h2",{id:BT,className:"operation-search-section-heading",children:s("chrome.operationSearch.commands")}),N.map((C,z)=>{const P=z===Y,R=X0(C.commandId);return u.jsxs("button",{id:Wte(C.commandId),ref:W=>{W?k.current.set(R,W):k.current.delete(R)},type:"button",className:`operation-search-result ${P?"is-active":""}`,role:"option","aria-selected":P,onMouseEnter:()=>m(z),onClick:()=>A(C),children:[u.jsx("span",{className:"operation-search-command-glyph","aria-hidden":"true",children:"›"}),u.jsx("span",{className:"operation-search-result-text",children:u.jsx("strong",{children:pc(C.label,V)})}),C.current?u.jsx("span",{className:"operation-search-theater",children:s("chrome.operationSearch.current")}):null]},C.commandId)})]}):u.jsx("p",{className:"operation-search-empty",children:s("chrome.operationSearch.noMatchingCommands")}):$.length>0||y.length>0?u.jsxs(u.Fragment,{children:[$.map(C=>{const z=Ute(C.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":z,children:[u.jsx("h2",{id:z,className:"operation-search-section-heading",children:pc(C.theaterLabel,V)}),C.entries.map(P=>{const R=T.indexOf(P),W=R===Y,G=$T(P.operationId);return u.jsxs("button",{id:xp(G),ref:U=>{U?k.current.set(G,U):k.current.delete(G)},type:"button",className:`operation-search-result ${W?"is-active":""}`,role:"option","aria-selected":W,onMouseEnter:()=>m(R),onClick:()=>D(P.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:pc(P.operationName,V)}),u.jsx("small",{children:Hte(P)})]}),P.activity!=="idle"?u.jsx("span",{className:`operation-search-status operation-search-status--${P.activity}`,children:P.activity}):null,u.jsx("span",{className:"operation-search-theater",children:pc(P.theaterLabel,V)})]},P.operationId)})]},C.theaterId??IO)}),y.map(C=>{const z=qte(C.panelId);return u.jsxs("section",{className:"operation-search-section operation-search-panel-section",role:"group","aria-labelledby":z,children:[u.jsx("h2",{id:z,className:"operation-search-section-heading",children:C.panelTitle}),C.results.map(P=>{const R=T.length+K.findIndex(U=>U.group.panelId===C.panelId&&U.result===P),W=R===Y,G=FT(C.panelId,P.id);return u.jsxs("button",{id:xp(G),ref:U=>{U?k.current.set(G,U):k.current.delete(G)},type:"button",className:`operation-search-result operation-search-panel-result ${W?"is-active":""}`,role:"option","aria-selected":W,onMouseEnter:()=>m(R),onClick:()=>{j(C.panelId,P)},children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:pc(P.title,V)}),P.subtitle?u.jsx("small",{children:pc(P.subtitle,V)}):null]}),u.jsx("span",{className:"operation-search-panel-open",children:s("chrome.operationSearch.open")})]},P.id)})]},C.panelId)})]}):u.jsx("p",{className:"operation-search-empty",children:s("chrome.operationSearch.noMatching")})})]})})}function Fte(e){switch(e){case"rename-operation":return"rename";case"assign-operation-group":return"assign-group";case"set-operation-accent":return"set-accent";case"minimize-operation":return"minimize"}}function PT(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function zT(e){e.activeTheaterId&&xw()!==e.activeTheaterId&&vR(e.activeTheaterId)}function Hte(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function Ute(e){return`operation-search-heading-${QS(e??IO)}`}function Wte(e){return xp(X0(e))}function xp(e){return`operation-search-option-${QS(e)}`}function $T(e){return`operation:${e}`}function X0(e){return`command:${e}`}function FT(e,t){return`panel:${e}:${t}`}function qte(e){return`operation-search-heading-panel-${QS(e)}`}function QS(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function pc(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const s=Gte(e,t,i);if(!s){n.push(e.slice(i));break}s.start>i&&n.push(e.slice(i,s.start)),n.push(u.jsx("mark",{children:e.slice(s.start,s.end)},`${s.start}-${s.end}`)),i=s.end}return n}function Gte(e,t,n){const i=e.toLocaleLowerCase();let s=null;for(const o of t){const l=i.indexOf(o,n);l!==-1&&(!s||l<s.start)&&(s={start:l,end:l+o.length})}return s}function Kte(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(zte)).filter(o=>o.offsetParent!==null);if(n.length===0)return;const i=n[0],s=n[n.length-1];if(e.shiftKey&&document.activeElement===i){e.preventDefault(),s?.focus();return}!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),i?.focus())}function Vte(){return u.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function HT({open:e,title:t,message:n,tone:i="info",onDismiss:s,actionLabel:o,onAction:l,progress:d}){const f=rt();return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),n?u.jsx("p",{className:"app-toast-message",children:n}):null,typeof d=="number"?u.jsx("span",{className:"app-toast-progress","aria-hidden":"true",children:u.jsx("span",{style:{transform:`scaleX(${Math.max(0,Math.min(1,d))})`}})}):null]}),o&&l?u.jsx("button",{type:"button",className:"app-toast-action",onClick:l,children:o}):null,s?u.jsx("button",{type:"button",className:"app-toast-close",onClick:s,"aria-label":f("chrome.toast.dismissNotification"),children:"×"}):null]})}):null}function Yte(e,t){return[...e.filter(n=>n.deletionId!==t.deletionId),t]}function UT(e,t){return[...e].reverse().find(n=>n.expiresAt>t)??null}function Xte(e,t){return Math.max(1,Math.ceil((e.expiresAt-t)/1e3))}let Dc=null,Md=0;function DO(e){Dc?.abort();const t=new AbortController,n=++Md;return Dc=t,H8(),Kj({...e,signal:t.signal}).then(i=>{n===Md&&U8(i)}).catch(i=>{t.signal.aborted||n!==Md||W8(i instanceof Error?i.message:String(i))}).finally(()=>{n===Md&&(Dc=null)})}function Zte(){Dc!==null&&(Dc.abort(),Dc=null,Md+=1)}function jO(e){return[{id:"fleet-cli",label:e("whatsnew.tab.fleetCli")},{id:"fleet-console",label:e("whatsnew.tab.fleetConsole")},{id:"fleet-desktop",label:e("whatsnew.tab.fleetDesktop")},{id:"fleet-plugin",label:e("whatsnew.tab.fleetPlugin")},{id:"fleet-core",label:e("whatsnew.tab.fleetCore")}]}function _v(e){return{id:"overview",label:e("whatsnew.tab.overview")}}function Jte(e){return{id:"all-updates",label:e("whatsnew.tab.allUpdates")}}function Qte(e){return{id:"other-updates",label:e("whatsnew.tab.otherUpdates")}}function BO(e){const t=PO(),n=e.sections.some(s=>s.items.some(o=>o.product===void 0)),i=jO(t).filter(s=>e.sections.some(o=>o.items.some(l=>l.product===s.id)));return i.length===0?[_v(t),Jte(t)]:n?[_v(t),...i,Qte(t)]:[_v(t),...i]}function ene(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 tne(e){const t=PO(),n=jO(t).flatMap(s=>{const o=e.sections.flatMap(l=>l.items.filter(d=>d.product===s.id));return o.length===0?[]:[{id:s.id,label:s.label,count:o.length,summary:o[0].text}]}),i=e.sections.flatMap(s=>s.items.filter(o=>o.product===void 0));return i.length===0?n:[...n,{id:n.length===0?"all-updates":"other-updates",label:n.length===0?t("whatsnew.tab.preProductGrouping"):t("whatsnew.tab.otherUpdates"),count:i.length,summary:i[0].text}]}function nne(e,t){return BO(e).some(n=>n.id===t)}function ine(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function PO(){return fr(ine())}const rne=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),md=10;function sne({state:e}){const t=rt(),n=_.useRef(null),i=_.useRef([]),s=_.useRef(null),o=_.useRef(null),l=_.useRef(new Map),[d,f]=_.useState("overview"),p=xl(),m=OR(p.state?.language??"auto"),y=e.selectedReleaseNoteKey??gd(e.releaseNotes[0]?.version??"",0),b=e.releaseNotes.findIndex((K,Q)=>gd(K.version,Q)===y),w=e.releaseNotes[b]??e.releaseNotes[0],S=w?gd(w.version,b>=0?b:0):"",x=w?BO(w):[];_.useEffect(()=>{f("overview")},[S]),_.useEffect(()=>{w&&!nne(w,d)&&f("overview")},[d,w]),_.useEffect(()=>{const K=Q=>{const Y=Q.target instanceof HTMLElement?Q.target:null;if(!Y||Y.closest(".whatsnew-card"))return;const B=i.current.filter(M=>M!==Y&&M.isConnected);i.current=[...B.slice(-4),Y]};return document.addEventListener("focusin",K,!0),()=>document.removeEventListener("focusin",K,!0)},[]);const k=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen||e.keyboardShortcutsOpen;if(e.whatsNewOpen&&!k&&n.current===null&&(n.current=document.activeElement),_.useEffect(()=>{if(!e.whatsNewOpen||k)return;const K=Q=>{une(Q)||(Q.key==="Escape"?(Q.preventDefault(),Ef()):hne(Q,o.current,f)?Q.preventDefault():Q.key==="Tab"&&dne(Q,o.current),Q.stopImmediatePropagation())};return s.current?.focus(),window.addEventListener("keydown",K,!0),()=>{window.removeEventListener("keydown",K,!0);const Q=n.current?.isConnected?n.current:[...i.current].reverse().find(Y=>Y.isConnected);n.current=null,Q?.focus?.()}},[e.whatsNewOpen,k]),!e.whatsNewOpen||k||w===void 0)return null;const L=()=>{DO({force:!0,locale:m})},F=async K=>{await So("language",K)},q=Math.max(1,Math.ceil(e.releaseNotes.length/md)),T=Math.min(q-1,Math.floor((b>=0?b:0)/md)),$=T*md,I=e.releaseNotes.slice($,$+md),N=K=>{const Q=T+K;if(Q<0||Q>=q)return;const Y=Q*md,B=e.releaseNotes[Y];B&&dE(gd(B.version,Y))},V=K=>{f(K),requestAnimationFrame(()=>l.current.get(K)?.focus())};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Ef,"aria-label":t("chrome.whatsnew.closeAria")}),u.jsxs("section",{className:"whatsnew-card",ref:o,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:t("chrome.whatsnew.title")}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",w.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[w.date?u.jsx("time",{className:"whatsnew-date",dateTime:w.date,children:t("chrome.whatsnew.released",{date:w.date})}):u.jsx("span",{className:"whatsnew-date",children:t("chrome.whatsnew.unreleased")}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:t("chrome.whatsnew.stale")}):null]})]}),u.jsx("button",{ref:s,type:"button",className:"whatsnew-close",onClick:Ef,"aria-label":t("chrome.whatsnew.closeAria"),children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx(Oi,{label:t("chrome.whatsnew.releaseVersion"),className:"whatsnew-version-select",value:S,onChange:dE,options:I.map((K,Q)=>{const Y=$+Q,B=K.version==="Unreleased"?t("chrome.whatsnew.versionUnreleased"):t("chrome.whatsnew.versionTagged",{version:K.version});return{value:gd(K.version,Y),label:`${B}${K.date?` · ${K.date}`:""}`}})}),q>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>N(-1),disabled:T===0,"aria-label":t("chrome.whatsnew.newerVersions"),children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[T+1," / ",q]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>N(1),disabled:T>=q-1,"aria-label":t("chrome.whatsnew.olderVersions"),children:"›"})]}):null,u.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":t("chrome.whatsnew.displayLanguage"),children:["en","ko"].map(K=>u.jsx("button",{type:"button",className:m===K?"is-active":"","aria-pressed":m===K,disabled:p.savingField==="language",onClick:()=>{F(K)},children:t(K==="en"?"chrome.whatsnew.langEn":"chrome.whatsnew.langKo")},K))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:L,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?t("chrome.whatsnew.refreshing"):t("common.refresh")})]}),u.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":t("chrome.whatsnew.releaseCategories"),children:x.map(K=>u.jsx("button",{ref:Q=>{Q?l.current.set(K.id,Q):l.current.delete(K.id)},id:`whatsnew-tab-${K.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":K.id,"aria-selected":d===K.id,"aria-controls":"whatsnew-tab-panel",tabIndex:d===K.id?0:-1,onClick:()=>f(K.id),children:K.label},K.id))}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:t("chrome.whatsnew.refreshError")}):null,u.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${d}`,children:d==="overview"?u.jsx("div",{className:"whatsnew-overview","aria-label":t("chrome.whatsnew.overviewAria"),children:tne(w).map(K=>u.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>V(K.id),children:[u.jsx("span",{className:"whatsnew-overview-label",children:K.label}),u.jsx("span",{className:"whatsnew-overview-count",children:t(K.count===1?"chrome.whatsnew.updateCount_one":"chrome.whatsnew.updateCount_other",{count:K.count})}),u.jsx("span",{className:"whatsnew-overview-summary",children:K.summary})]},K.id))}):ene(w,d).map((K,Q)=>u.jsx(ane,{section:K,index:Q},K.heading))})]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Ef,children:t("common.close")})})]})]})}function ane({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((s,o)=>u.jsx("li",{children:u.jsx(one,{item:s})},`${s.text}:${o}`))})]})}function one({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,n)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),u.jsx("span",{children:e.text})]})}function gd(e,t){return`${e}:${t}`}const lne=new Set(["ArrowDown","ArrowUp","Enter"," "]);function cne(e){return e instanceof HTMLElement&&e.dataset.open==="true"}function une(e){const t=e.target instanceof Element?e.target:null;if(!t)return!1;if(t.closest('.fc-select__popup[data-open="true"]'))return!0;const n=t.closest(".fc-select__trigger");if(n instanceof HTMLButtonElement){const i=n.getAttribute("aria-controls");return i&&cne(document.getElementById(i))?!0:lne.has(e.key)}return!1}function dne(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(rne)),i=n[0],s=n[n.length-1];!i||!s||(e.shiftKey&&document.activeElement===i?(e.preventDefault(),s.focus()):!e.shiftKey&&document.activeElement===s&&(e.preventDefault(),i.focus()))}function hne(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 s=Array.from(t.querySelectorAll(".whatsnew-tab[role='tab']")),o=s.indexOf(i);if(o<0||s.length===0)return!1;const l=e.key==="Home"?0:e.key==="End"?s.length-1:(o+(e.key==="ArrowRight"?1:-1)+s.length)%s.length,d=s[l],f=d.dataset.tabId;return f?(n(f),d.focus(),!0):!1}function zO(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function fne(e,t=window){const n=i=>{if(!(nM()||zO(t.document))){if((i.metaKey||i.ctrlKey)&&!i.altKey&&!i.shiftKey&&i.key.toLowerCase()==="z"&&e.canUndoLastClose?.()){const s=t.document.activeElement;if(s instanceof HTMLElement&&(s.matches("input, textarea, [contenteditable='true']")||s.closest(".xterm")))return;i.preventDefault(),i.stopImmediatePropagation(),e.undoLastClose?.();return}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 eg(e=()=>{}){return{...A5(e),notifications:{emit:n=>Q8(n),dismiss:n=>pP(n)},status:{set:(n,i)=>Z8(n,i),clear:n=>J8(n)}}}async function pne(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await mne(t),gne(await t.json(),t.status).routes}async function mne(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 mn(e.status,t)}function gne(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new mn(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>yne(i,t))}}function yne(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 mn(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const Z0=new Set;let J0={loading:!1,state:null,error:null};function _ne(){return _.useSyncExternalStore(vne,WT,WT)}function WT(){return J0}function vne(e){return Z0.add(e),()=>{Z0.delete(e)}}async function bne(e){vv({loading:!0,error:null});try{const t=await pne(e);vv({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;vv({loading:!1,error:wne(t)})}}function vv(e){J0={...J0,...e};for(const t of Z0)t()}function wne(e){return e instanceof Error?e.message:String(e)}function Sne(){const e=rt(),t=_ne(),[n,i]=_.useState(!0),s=_.useMemo(()=>Ene(t.state??[],e("chrome.backendApi.uncategorized")),[t.state,e]),o=t.state?.length??0,l=s.length;return _.useEffect(()=>{const d=new AbortController;return bne(d.signal),()=>d.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":e("chrome.backendApi.sectionAria"),children:[u.jsx("div",{className:`backend-api-control settings-disclosure-control ${n?"is-expanded":""}`,children:u.jsxs("div",{className:"settings-disclosure-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:e("chrome.backendApi.title")}),u.jsx("p",{className:"global-settings-help",children:o>0?e(xne(o,l),{count:o,categoryCount:l}):e("chrome.backendApi.emptyHelp")})]}),u.jsx("div",{className:"settings-disclosure-actions",children:u.jsx("button",{type:"button",className:"settings-disclosure-toggle","aria-expanded":n,onClick:()=>i(d=>!d),children:e(n?"chrome.backendApi.hide":"chrome.backendApi.show")})})]})}),t.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,t.loading&&!t.state?u.jsx("p",{className:"global-settings-help",children:e("chrome.backendApi.loading")}):null,n?u.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(d=>u.jsx(Cne,{group:d},d.category)):null,t.state&&s.length===0?u.jsx("p",{className:"global-settings-help",children:e("chrome.backendApi.noRoutes")}):null]}):null,u.jsx("p",{className:"global-settings-foot",children:e("chrome.backendApi.foot")})]})}function xne(e,t){return`chrome.backendApi.routeSummary_${e===1?"one":"other"}_${t===1?"one":"other"}`}function Cne({group:e}){return u.jsxs("div",{className:"backend-api-group",children:[u.jsxs("div",{className:"backend-api-group-head",children:[u.jsx("span",{children:e.category}),u.jsx("span",{children:e.entries.length})]}),u.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>u.jsx(kne,{entry:t},`${t.method}:${t.path}`))})]})}function kne({entry:e}){return u.jsxs("div",{className:"backend-api-row",children:[u.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),u.jsx("code",{className:"backend-api-path",children:e.path}),u.jsx("span",{className:"backend-api-summary",children:e.summary}),u.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function Ene(e,t){const n=new Map;for(const i of e){const s=i.category.trim()||t,o=n.get(s);o?o.push(i):n.set(s,[i])}return Array.from(n.entries()).map(([i,s])=>({category:i,entries:s}))}function Ane(e){return[{id:"instrument",label:e("settings.theme.instrument"),swatch:["oklch(16.5% 0.016 245)","oklch(80% 0.085 78)","oklch(77% 0.085 200)"]},{id:"maritime",label:e("settings.theme.maritime"),swatch:["oklch(20% 0.045 248)","oklch(78% 0.13 75)","oklch(82% 0.13 195)"]},{id:"carbon",label:e("settings.theme.carbon"),swatch:["oklch(18% 0.007 255)","oklch(76% 0.115 62)","oklch(80% 0.105 205)"]}]}function Tne(e){return[{id:"dynamic",label:e("settings.port.dynamic")},{id:"static",label:e("settings.port.static")}]}function Rne(e){return[{id:"auto",label:e("settings.language.auto")},{id:"en",label:e("settings.language.en")},{id:"ko",label:e("settings.language.ko")}]}function Mne(e){return[{id:"general",label:e("settings.core.general.label"),eyebrow:e("settings.core.general.eyebrow")},{id:"backend-api",label:e("settings.core.backendApi.label"),eyebrow:e("settings.core.backendApi.eyebrow")}]}const Lne=1024,Nne=65535;function One(){const e=xl(),t=e.state,n=e.savingField!==null,[i,s]=_.useState("general"),o=Mr(),l=Yc(),d=Qc(),f=Im(),p=rt(),m=Mne(p),y=jne(d.plugins,f,p),b=Bne(y),w=S=>{s(S),l({pathname:"/settings",search:S==="general"?"":`?section=${encodeURIComponent(S)}`})};return _.useEffect(()=>{const S=new AbortController;return LB(S.signal),()=>S.abort()},[]),_.useEffect(()=>{const S=new URLSearchParams(o.search).get("section"),x=new Set([...m.map(L=>L.id),...y.map(L=>L.id)]),k=S&&x.has(S)?S:"general";s(k),S&&S!==k&&l({pathname:"/settings",search:""},{replace:!0})},[o.search,l,m,y]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:p("settings.kicker")}),u.jsx("h2",{id:"global-settings-title",children:p("settings.title")})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?p("settings.saving"):""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":p("settings.sectionsAria"),children:[u.jsx("p",{className:"global-settings-nav-group",children:p("settings.nav.console")}),m.map(S=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${S.id===i?"is-active":""}`,"aria-pressed":S.id===i,onClick:()=>w(S.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:S.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:S.eyebrow})]},S.id)),y.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:p("settings.nav.plugins")}),b.map(S=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:S.pluginLabel}),S.sections.map(x=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${x.id===i?"is-active":""}`,"aria-pressed":x.id===i,onClick:()=>w(x.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:x.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:x.pluginLabel})]},x.id))]},S.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:Dne(i,t,n,y,p)},i)]})]})}function Ine({render:e}){return u.jsx(u.Fragment,{children:e()})}function Dne(e,t,n,i,s){if(e.includes(":")){const o=i.find(l=>l.id===e);return o?.render?u.jsx(Np,{fallback:u.jsx("div",{className:"fc-plugin-error",children:s("settings.pluginFailed")}),children:u.jsx(Ine,{render:o.render})}):u.jsx("p",{className:"global-settings-help",children:s("settings.pluginUnavailable")})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(zne,{state:t,saving:n}),u.jsx($ne,{state:t,saving:n}),u.jsx(Fne,{state:t,saving:n})]});case"backend-api":return u.jsx(Sne,{})}}function jne(e,t,n){return e.flatMap(i=>(i.settingsSections??[]).map(s=>({id:`${i.id}:${s.id}`,pluginId:i.id,pluginLabel:Pne(i.id,n),sectionTitle:Sl(s.title,t),render:s.render})))}function Bne(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 Pne(e,t){return e==="terminal"?t("settings.plugin.terminal"):e.split(/[-_]/g).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")||e}function zne({state:e,saving:t}){const n=rt(),i=Ane(n),s=e?.theme??"instrument",o=l=>{if(Yi().savingField!==null)return;const d=s;$c(l),So("theme",l).then(f=>{f||$c(d)})};return u.jsxs("section",{className:"global-settings-card","aria-label":n("settings.theme.aria"),children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:n("settings.theme.title")}),u.jsx("p",{className:"global-settings-help",children:n("settings.theme.help")})]}),u.jsx("div",{className:"theme-picker",role:"group","aria-label":n("settings.theme.aria"),children:i.map(l=>{const d=l.id===s;return u.jsxs("button",{type:"button","aria-pressed":d,className:`theme-card ${d?"is-active":""}`,disabled:t,onClick:()=>o(l.id),children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:l.swatch.map(f=>u.jsx("i",{style:{background:f}},f))}),u.jsx("span",{className:"theme-card-label",children:l.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:d?u.jsx(qne,{}):null})]},l.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:n("settings.theme.foot")})]})}function $ne({state:e,saving:t}){const n=rt(),i=e?.uiFont??Ld,[s,o]=_.useState([]),[l,d]=_.useState(!0),[f,p]=_.useState(null);_.useEffect(()=>{const b=new AbortController;return OM({signal:b.signal}).then(w=>{o(w.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:x})=>({family:S,monospace:x}))),p(null)}).catch(w=>{if(!b.signal.aborted){o([]);const S=w instanceof tl;p(!S&&w instanceof Error?w.message:n("settings.typography.fontsLoadError"))}}).finally(()=>{b.signal.aborted||d(!1)}),()=>b.abort()},[n]);const m=b=>{if(Yi().savingField!==null)return;const w=i;ab(b),So("uiFont",b).then(S=>{S||ab(w)})},y=b=>{const w=b.source==="builtin"?{source:"builtin",id:b.id,size:i.size}:{source:"system",familyName:b.familyName,size:i.size};m(w)};return u.jsxs("section",{className:"global-settings-card","aria-label":n("settings.typography.aria"),children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:n("settings.typography.title")}),u.jsx("p",{className:"global-settings-help",children:n("settings.typography.help")})]}),u.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||i.source==="builtin"&&i.id==="manrope"&&i.size===Tc.defaultValue,onClick:()=>m(Ld),children:n("settings.typography.reset")})]}),u.jsx(LM,{builtIns:jp.map(({id:b,label:w,family:S,aliases:x})=>({id:b,label:w,family:S,aliases:x,description:n(SB[b])})),installedFonts:s,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:iR(Ld),previewText:n("settings.typography.preview"),size:i.size,sizeRange:Tc,loading:l,error:f,disabled:!e||t,labels:{browserAria:n("settings.typography.picker.browserAria"),searchLabel:n("settings.typography.picker.searchLabel"),searchPlaceholder:n("settings.typography.picker.searchPlaceholder"),loading:n("settings.typography.picker.loading"),choicesAria:n("settings.typography.picker.choicesAria"),builtInGroup:n("settings.typography.picker.builtInGroup"),installedGroup:n("settings.typography.picker.installedGroup"),noMatch:n("settings.typography.picker.noMatch"),preview:n("settings.typography.picker.preview"),available:n("settings.typography.picker.available"),unavailable:n("settings.typography.picker.unavailable"),fontSizeAria:n("settings.typography.picker.fontSizeAria"),decreaseSizeAria:n("settings.typography.picker.decreaseSizeAria"),sizeValueAria:n("settings.typography.picker.sizeValueAria"),increaseSizeAria:n("settings.typography.picker.increaseSizeAria"),sizeSliderAria:n("settings.typography.picker.sizeSliderAria"),monospace:n("settings.typography.picker.monospace"),systemFont:n("settings.typography.picker.systemFont"),savedSystemFont:n("settings.typography.picker.savedSystemFont")},onSelectionChange:y,onSizeCommit:b=>m({...i,size:b})}),u.jsx("p",{className:"global-settings-foot",children:n("settings.typography.foot")})]})}function Fne({state:e,saving:t}){const n=rt(),i=ps();return u.jsxs("section",{className:"global-settings-card","aria-label":n("settings.general.aria"),children:[e?u.jsxs(u.Fragment,{children:[u.jsx(Wne,{state:e,saving:t,consoleState:i}),u.jsx(Hne,{state:e,saving:t}),u.jsx(Une,{state:e,saving:t})]}):u.jsx("p",{className:"global-settings-help",children:n("settings.general.loading")}),u.jsx("p",{className:"global-settings-foot",children:n("settings.general.foot")})]})}function Hne({state:e,saving:t}){const n=rt();return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:n("settings.panelMotion.title")}),u.jsx("p",{className:"global-settings-help",children:n("settings.panelMotion.help")})]}),u.jsx("button",{type:"button","aria-pressed":e.reducePanelMotion,className:`global-settings-toggle ${e.reducePanelMotion?"is-on":""}`,disabled:t,onClick:()=>{So("reducePanelMotion",!e.reducePanelMotion)},children:n("settings.panelMotion.toggle")})]})}function Une({state:e,saving:t}){const n=rt(),i=Rne(n);return u.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:n("settings.language.title")}),u.jsx("p",{className:"global-settings-help",children:n("settings.language.help")})]}),u.jsx("div",{className:"segmented language-picker",role:"group","aria-label":n("settings.language.aria"),children:i.map(s=>{const o=e.language===s.id;return u.jsx("button",{type:"button","aria-pressed":o,className:`segmented-option ${o?"is-active":""}`,disabled:t,onClick:()=>{So("language",s.id)},children:s.label},s.id)})}),u.jsx("p",{className:"console-port-note",children:n("settings.language.note")})]})}function Wne({state:e,saving:t,consoleState:n}){const i=rt(),s=Tne(i),[o,l]=_.useState(e.consoleStaticPort?.toString()??""),d=n.effectivePort,f=n.portMode==="static"&&!n.portHonored,p=n.requestedPort,m=e.consolePortMode==="static"&&e.consoleStaticPort!==null,y=o.trim(),b=Number(y),w=y.length>0,S=w&&qT(b),x=e.consolePortMode==="static"&&w&&!S;return _.useEffect(()=>{l(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:[i("settings.port.title")," ",u.jsx("span",{className:"new-badge",children:i("settings.port.newBadge")})]}),u.jsx("p",{className:"global-settings-help",children:i("settings.port.help")})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":i("settings.port.modeAria"),children:s.map(k=>{const L=e.consolePortMode===k.id;return u.jsx("button",{type:"button","aria-pressed":L,className:`segmented-option ${L?"is-active":""}`,disabled:t,onClick:()=>{So("consolePortMode",k.id)},children:k.label},k.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:i("settings.port.staticPort")}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${x?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:o,disabled:t,"aria-invalid":x,"aria-describedby":"console-static-port-hint",onChange:k=>{const L=k.target.value;l(L);const F=Number(L.trim());qT(F)&&So("consoleStaticPort",F)}}),u.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${x?"is-invalid":""}`,children:i("settings.port.hint")})]})}),u.jsxs("div",{className:`console-port-effective ${f?"is-fallback":""}`,"aria-live":"polite",children:[u.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("p",{className:"console-port-effective-label",children:i("settings.port.currentlyReachable")}),u.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",u.jsx("span",{children:d||"..."}),f?i("settings.port.dynamicSuffix"):""]})]})]}),f&&p?u.jsxs("div",{className:"console-port-warning",role:"status",children:[lE(i("settings.port.fallback"),{port:u.jsx("strong",{children:p}),mode:u.jsx("strong",{children:i("settings.port.dynamic")}),host:u.jsx("strong",{children:`127.0.0.1:${d||"..."}`})})," ",m?lE(i("settings.port.nextRestartStatic"),{port:u.jsx("strong",{children:e.consoleStaticPort})}):i("settings.port.nextRestartDynamic")]}):null,u.jsx("p",{className:"console-port-note",children:i("settings.port.note")})]})]})}function qT(e){return Number.isInteger(e)&&e>=Lne&&e<=Nne}function qne(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Gne(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function th(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function Kne(e,t){return{...Gne(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const Vne=600,GT=360,KT="cubic-bezier(0.4, 0.14, 0.2, 1)";function $O(e){if(typeof document>"u"||Tw())return;const t=FO(e);if(!xm(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=HO(e);xm(i)&&UO(n,i.getBoundingClientRect(),()=>Yne(i))})}function Q0(e){if(typeof document>"u"||Tw())return;const t=HO(e);if(!xm(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=FO(e);xm(i)&&UO(n,i.getBoundingClientRect())})}function FO(e){return document.querySelector(`.canvas-operation[data-operation-id="${e1(e)}"]`)}function HO(e){return document.querySelector(`[data-side-bar-chip-id="${e1(e)}"]`)}function xm(e){if(!e)return!1;const t=e.getBoundingClientRect();return t.width<=0||t.height<=0?!1:getComputedStyle(e).visibility!=="hidden"}function e1(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function UO(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:s,easing:o}=Xne();let l=!1,d=null;const f=m=>{l||(l=!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:s,easing:o})}catch{f(!1);return}d=window.setTimeout(()=>f(!0),s+120),p.onfinish=()=>f(!0),p.oncancel=()=>f(!1)}function Yne(e){e.classList.add("is-arrival-pulse"),window.setTimeout(()=>e.classList.remove("is-arrival-pulse"),Vne)}function Xne(){try{const e=getComputedStyle(document.documentElement);return{duration:Zne(e.getPropertyValue("--duration-slow"))??GT,easing:e.getPropertyValue("--ease-glide").trim()||KT}}catch{return{duration:GT,easing:KT}}}function Zne(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 VT=256,YT=176,bv=12,Zf=220,WO="fleet-console.map.radarCollapsed";function Jne({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:s,onJump:o}){const l=rt(),d=_.useRef(null),f=_.useRef(!1),p=_.useRef(null),[m,y]=_.useState(Qne),b=Nm();if(_.useEffect(()=>{if(b){p.current===null&&(p.current=m,y(!0));return}p.current!==null&&(y(p.current),p.current=null)},[m,b]),s.width<=0||s.height<=0||i.zoom<=0)return null;const w=[...Object.entries(e).map(([O,C])=>({id:O,x:C.x,y:C.y,width:C.width,height:C.height})),...Object.entries(t).map(([O,C])=>({id:O,x:C.geometry.x,y:C.geometry.y,width:C.geometry.width,height:C.geometry.height}))];if(w.length===0)return null;const S=()=>{y(O=>{const C=!O;return b||eie(C),C})};if(m)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":l("canvas.minimap.open"),title:l("canvas.minimap.open"),children:u.jsx(nie,{})});const x=VT-bv*2,k=YT-bv*2,L={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let F=Math.min(L.x,...w.map(O=>O.x)),q=Math.min(L.y,...w.map(O=>O.y)),T=Math.max(L.x+L.width,...w.map(O=>O.x+O.width)),$=Math.max(L.y+L.height,...w.map(O=>O.y+O.height));F-=Zf,q-=Zf,T+=Zf,$+=Zf;const I=T-F,N=$-q,V=Math.min(x/I,k/N),K=(x-I*V)/2,Q=(k-N*V)/2,Y=O=>K+(O-F)*V,B=O=>Q+(O-q)*V,M=O=>{const C=d.current?.getBoundingClientRect();if(!C)return;const z=O.clientX-C.left,P=O.clientY-C.top;o({x:F+(z-K)/V,y:q+(P-Q)/V})},D=O=>{O.stopPropagation(),f.current=!0,O.currentTarget.setPointerCapture(O.pointerId),M(O)},j=O=>{f.current&&(O.stopPropagation(),M(O))},A=O=>{f.current=!1;try{O.currentTarget.releasePointerCapture(O.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:VT,height:YT},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:l("canvas.minimap.label")}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":l("canvas.minimap.collapse"),title:l("canvas.minimap.collapse"),children:u.jsx(tie,{})}),u.jsxs("div",{ref:d,className:"canvas-minimap-inner",style:{inset:bv},onPointerDown:D,onPointerMove:j,onPointerUp:A,onPointerCancel:A,role:"presentation","aria-label":l("canvas.minimap.navigateAria"),children:[w.map(O=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:Y(O.x),top:B(O.y),width:Math.max(2,O.width*V),height:Math.max(2,O.height*V),...n?.[O.id]?{"--user-accent":n[O.id]}:{}}},O.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:Y(L.x),top:B(L.y),width:L.width*V,height:L.height*V}})]})]})}function Qne(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(WO)==="true"}catch{return!1}}function eie(e){if(!(typeof window>"u"))try{window.localStorage.setItem(WO,String(e))}catch{}}function tie(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function nie(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),u.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function iie({viewport:e}){return u.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[u.jsx("div",{className:"operations-canvas-sea"}),u.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const rie=["n","ne","e","se","s","sw","w","nw"],wv=320,Sv=200,sie=1500;function aie({operation:e,active:t,geometry:n,zoom:i,status:s,minimized:o=!1,maximized:l=!1,renderHidden:d=!1,focusLayerTarget:f=!1,topEdge:p=!1,interactionDisabled:m=!1,accentKey:y=null,children:b,onActivate:w,onClose:S,onMinimize:x,onMaximize:k,onRename:L,onSetAccent:F,onGeometryChange:q,onGeometryCommit:T,onRenderHiddenFocus:$}){const I=rt(),N=_.useRef(null),V=_.useRef(null),K=_.useRef(null),Q=_.useRef(null),Y=_.useRef(null),B=_.useRef(n),M=_.useRef(!1),[D,j]=_.useState(null),[A,O]=_.useState(!1),[C,z]=_.useState(!1),P=e.title,R=Hw({currentTitle:e.title,onBegin:()=>{ee()},onCommit:de=>{L(de),M.current=!0}}),W=y?Zr(y):null,G=["canvas-operation",t?"is-active":"",o?"is-minimized":"",l?"is-maximized":"",p?"is-top-edge":"",C?"is-dragging":"",lie(s)].filter(Boolean).join(" ");_.useEffect(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current)},[]),_.useEffect(()=>{if(R.renaming||!M.current)return;M.current=!1;const de=window.requestAnimationFrame(()=>V.current?.focus());return()=>window.cancelAnimationFrame(de)},[R.renaming]),_.useLayoutEffect(()=>{if(!d||typeof document>"u")return;const de=D!==null;de&&j(null),(de||N.current?.contains(document.activeElement))&&$?.()},[D,d,$]);const U=()=>{Y.current!==null&&(window.clearTimeout(Y.current),Y.current=null)},ee=()=>{U(),O(!1)},ne=()=>{U(),O(!0),Y.current=window.setTimeout(()=>{Y.current=null,O(!1)},sie)};_.useEffect(()=>{!l&&!m&&!o||(K.current=null,Q.current=null,z(!1))},[l,m,o]);const me=()=>{!K.current&&!Q.current||(K.current=null,Q.current=null,z(!1))},Me=de=>{ee(),!(l||m)&&de.button===0&&(de.preventDefault(),de.stopPropagation(),w(),K.current={pointerId:de.pointerId,startX:de.clientX,startY:de.clientY,geometry:n,latest:n},z(!0),de.currentTarget.setPointerCapture(de.pointerId))},ve=de=>{if(l||m)return;const Pe=K.current;if(!Pe||Pe.pointerId!==de.pointerId)return;de.preventDefault(),de.stopPropagation();const st={...Pe.geometry,x:Pe.geometry.x+(de.clientX-Pe.startX)/i,y:Pe.geometry.y+(de.clientY-Pe.startY)/i};Pe.latest=st,q(st)},Ye=de=>{if(l||m){K.current=null,z(!1);return}const Pe=K.current;!Pe||Pe.pointerId!==de.pointerId||(de.preventDefault(),de.stopPropagation(),K.current=null,z(!1),de.currentTarget.releasePointerCapture(de.pointerId),T(Pe.latest))},qe=(de,Pe)=>{l||m||(Pe.preventDefault(),Pe.stopPropagation(),w(),Q.current={direction:de,pointerId:Pe.pointerId,startX:Pe.clientX,startY:Pe.clientY,geometry:n,latest:n},z(!0),Pe.currentTarget.setPointerCapture(Pe.pointerId))},yt=de=>{if(l||m)return;const Pe=Q.current;if(!Pe||Pe.pointerId!==de.pointerId)return;de.preventDefault(),de.stopPropagation();const st=oie(Pe.geometry,Pe.direction,(de.clientX-Pe.startX)/i,(de.clientY-Pe.startY)/i);Pe.latest=st,q(st)},$e=de=>{if(l||m){Q.current=null,z(!1);return}const Pe=Q.current;!Pe||Pe.pointerId!==de.pointerId||(de.preventDefault(),de.stopPropagation(),Q.current=null,z(!1),de.currentTarget.releasePointerCapture(de.pointerId),T(Pe.latest))},We=de=>{de.stopPropagation()},mt=de=>{de.stopPropagation(),ee()},ot=de=>{de.stopPropagation(),w()},Nt=de=>{de.stopPropagation()},Ot=()=>{ee();const de=typeof document<"u"?document.activeElement:null;de instanceof HTMLElement&&N.current?.contains(de)&&de.blur(),x()},kt=()=>{ee(),k?.()},ye=de=>{ee(),w(),j(de)},ze=de=>{de.stopPropagation(),ee(),w()},Je=()=>{if(!A){ne();return}ee(),S()},It=de=>{de.stopPropagation(),R.begin()},Ke=de=>{de.key!=="Enter"&&de.key!=="F2"||(de.preventDefault(),de.stopPropagation(),R.begin())},en=de=>{de.key==="Escape"&&(M.current=!0),R.handleKeyDown(de)};o||(B.current=n);const we=o?B.current:n,De={left:Math.round(we.x),top:Math.round(we.y),width:Math.round(we.width),height:Math.round(we.height),zIndex:we.zIndex,...d?{visibility:"hidden",pointerEvents:"none"}:{},...W?{"--user-accent":W}:{}};return u.jsxs("article",{ref:N,className:G,style:De,onPointerDown:w,"data-canvas-operation":!0,"data-operation-id":e.id,"data-focus-layer-target":f?"true":void 0,"aria-label":I("canvas.frame.operationAria",{title:P}),"aria-hidden":d||void 0,tabIndex:f?-1:void 0,inert:o||d?!0:void 0,children:[W?u.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!l&&!m?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:Me,onPointerMove:ve,onPointerUp:Ye,onPointerCancel:Ye,onLostPointerCapture:me,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:Me,onPointerMove:ve,onPointerUp:Ye,onPointerCancel:Ye,onLostPointerCapture:me,"data-canvas-blocker":!0,children:[W?u.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,R.renaming?u.jsx("input",{ref:R.inputRef,className:"canvas-operation-identity-input",value:R.draftTitle,"aria-label":I("canvas.frame.renameAria",{title:P}),onChange:de=>R.setDraftTitle(de.target.value),onKeyDown:en,onBlur:R.handleBlur,onPointerDown:mt}):u.jsx("button",{ref:V,type:"button",className:"canvas-operation-identity-name",onPointerDown:mt,onDoubleClick:It,onKeyDown:Ke,"aria-label":I("canvas.frame.renameAria",{title:P}),title:I("canvas.frame.renameTitle",{title:P}),children:P}),F?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:We,onClick:de=>ye(de.currentTarget.getBoundingClientRect()),"aria-label":I("canvas.frame.setAccentAria",{title:P}),"aria-haspopup":"menu",title:I("canvas.frame.setAccentTitle"),children:u.jsx("span",{className:XT(s),"aria-hidden":"true"})}):u.jsx("span",{className:XT(s),onPointerDown:ze,"aria-hidden":"true"}),u.jsxs("div",{className:"canvas-operation-window-controls",children:[u.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:We,onClick:Ot,"aria-label":I("canvas.frame.minimizeAria",{title:P}),title:I("canvas.frame.minimizeTitle"),children:u.jsx(cie,{})}),k?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${l?"is-active":""}`,onPointerDown:We,onClick:kt,"aria-label":l?I("canvas.frame.restoreAria",{title:P}):I("canvas.frame.maximizeAria",{title:P}),"aria-pressed":l,title:I(l?"canvas.frame.restoreTitle":"canvas.frame.maximizeTitle"),children:l?u.jsx(die,{}):u.jsx(uie,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${A?"is-armed-close":""}`,onPointerDown:We,onClick:Je,"aria-label":A?I("canvas.frame.confirmCloseAria",{title:P}):I("canvas.frame.closeAria",{title:P}),title:I(A?"canvas.frame.confirmCloseTitle":"canvas.frame.closeTitle"),children:A?I("canvas.frame.closeArmed"):u.jsx(hie,{})})]})]}),u.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:P}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:ot,onWheel:Nt,"data-canvas-blocker":!0,children:b}),!l&&!m&&rie.map(de=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${de}`,onPointerDown:Pe=>qe(de,Pe),onPointerMove:yt,onPointerUp:$e,onPointerCancel:$e,onLostPointerCapture:me,"data-canvas-blocker":!0,"aria-hidden":"true"},de)),D&&F?u.jsx(YP,{anchor:D,accentKey:y,onSelect:F,onClose:()=>j(null)}):null]})}function oie(e,t,n,i){let{x:s,y:o,width:l,height:d}=e;return t.includes("e")&&(l+=n),t.includes("s")&&(d+=i),t.includes("w")&&(s+=n,l-=n),t.includes("n")&&(o+=i,d-=i),l<wv&&(t.includes("w")&&(s-=wv-l),l=wv),d<Sv&&(t.includes("n")&&(o-=Sv-d),d=Sv),{...e,x:s,y:o,width:l,height:d}}function lie(e){const t=Dm(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function XT(e){const t=Dm(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 cie(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function uie(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function die(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function hie(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function fie(e,t){return e.some(n=>!t.has(n.id))}function pie({activeTheaterId:e,theaterLabel:t,operations:n,canLaunch:i,onOpenOperation:s,onNewOperation:o}){const l=rt();if(!e)return u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[u.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),u.jsx("p",{children:l("canvas.empty.noTheater")})]});const d=[...n].sort((p,m)=>m.ts.updatedAt-p.ts.updatedAt).slice(0,2),f=n.length;return u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[f>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"operations-canvas-empty-ghost",children:l(f===1?"canvas.empty.standingBy_one":"canvas.empty.standingBy_other",{count:f})}),u.jsx("div",{className:"operations-canvas-empty-standby",children:d.map(p=>u.jsxs("button",{type:"button",className:"operations-canvas-empty-standby-chip","aria-label":l("canvas.empty.openOperation",{title:p.title}),onClick:()=>s(p.id),children:[u.jsx("span",{className:"operations-canvas-empty-standby-title",children:p.title}),u.jsx("span",{className:"operations-canvas-empty-standby-open","aria-hidden":"true",children:l("canvas.empty.open")})]},p.id))})]}):u.jsx("p",{className:"operations-canvas-empty-headline",children:l("canvas.empty.headline")}),u.jsx("button",{type:"button",className:"operations-canvas-empty-new","aria-label":l("canvas.empty.newOperationAria",{theater:t}),disabled:!i,onClick:o,children:l("canvas.empty.newOperation")}),u.jsxs("p",{className:"operations-canvas-empty-hints",children:[u.jsx("kbd",{children:"⌘K"})," ",l("canvas.empty.hintSearch")," ",u.jsx("span",{"aria-hidden":"true",children:"·"})," ",u.jsx("kbd",{children:"Alt+F"})," ",l("canvas.empty.hintFormation")," ",u.jsx("span",{"aria-hidden":"true",children:"·"})," ",u.jsx("kbd",{children:"Alt+S"})," ",l("canvas.empty.hintStatusBoard")]}),u.jsx("p",{className:"operations-canvas-empty-guide",children:l("canvas.empty.guide")})]})}function mie({rect:e,viewport:t}){const n=Kne(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const gie=.25,yie=2,_ie=200,vie=150,ZT=5,bie=.0018;function wie({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:s,onCreate:o,onConsumePointerDown:l,onClick:d}){const f=_.useRef(null),p=_.useRef(e),[m,y]=_.useState(null),[b,w]=_.useState(!1),[S,x]=_.useState(!1);_.useEffect(()=>{p.current=e},[e]),_.useEffect(()=>{const I=V=>{V.key==="Shift"&&x(!0),!Sie(V.target)&&V.code==="Space"&&(V.preventDefault(),w(!0))},N=V=>{V.key==="Shift"&&x(!1),V.code==="Space"&&w(!1)};return window.addEventListener("keydown",I),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",I),window.removeEventListener("keyup",N)}},[]);const k=I=>{if(t||JT(I.target)||I.button!==0&&I.button!==1)return;if(I.preventDefault(),n){l?.();return}const N=Cv(I),V=I.shiftKey&&I.button===0&&!b?"create":"pan";f.current={pointerId:I.pointerId,mode:V,startScreen:N,currentScreen:N,startViewport:p.current},I.currentTarget.setPointerCapture(I.pointerId),V==="create"&&y(xv(N,N,p.current))},L=I=>{const N=f.current;if(!N||N.pointerId!==I.pointerId)return;I.preventDefault();const V=Cv(I);if(f.current={...N,currentScreen:V},N.mode==="pan"){i({...N.startViewport,x:N.startViewport.x+V.x-N.startScreen.x,y:N.startViewport.y+V.y-N.startScreen.y});return}y(xv(N.startScreen,V,p.current))},F=I=>{$(I,!0)},q=I=>{$(I,!1)},T=I=>{if(t||JT(I.target))return;I.preventDefault();const N=Cv(I),V=p.current,K=xie(V.zoom*Math.exp(-I.deltaY*bie),gie,yie),Q=th(N,V);s({x:N.x-Q.x*K,y:N.y-Q.y*K,zoom:K})},$=(I,N)=>{const V=f.current;if(!V||V.pointerId!==I.pointerId||(f.current=null,I.currentTarget.releasePointerCapture(I.pointerId),y(null),!N))return;const K=Math.abs(V.currentScreen.x-V.startScreen.x),Q=Math.abs(V.currentScreen.y-V.startScreen.y);if(K<ZT&&Q<ZT){d?.();return}if(V.mode!=="create")return;const Y=xv(V.startScreen,V.currentScreen,p.current),B={x:Y.x,y:Y.y,width:Math.max(Y.width,_ie),height:Math.max(Y.height,vie)};o(B,V.currentScreen)};return{rubberBand:m,spaceActive:b,shiftActive:S,onPointerDown:k,onPointerMove:L,onPointerUp:F,onPointerCancel:q,onWheel:T}}function xv(e,t,n){const i=th(e,n),s=th(t,n),o=Math.min(i.x,s.x),l=Math.min(i.y,s.y);return{x:o,y:l,width:Math.abs(i.x-s.x),height:Math.abs(i.y-s.y)}}function Cv(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function JT(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function Sie(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function xie(e,t,n){return Math.min(n,Math.max(t,e))}const Cie=560,kie=360,Eie=12;function Aie({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:s,onLaunchAtGeometry:o,onClose:l,onFocus:d,onRename:f,onSetAccent:p}){const m=_.useRef(null),y=Cw(),b=fR(),w=Nm(),S=dR(),x=hR(),k=UB(x),L=_.useRef(null),F=pR(),q=e.activeOperationId,[T,$]=_.useState(null),I=Qc(),N=xl(),V=hr(N.state?.language??"auto"),[K,Q]=_.useState({width:0,height:0}),Y=Oie(),B=!e.activeTheaterId||e.addingTheater;_.useEffect(()=>{const ye=m.current;if(!ye||typeof ResizeObserver>"u")return;const ze=()=>Q({width:ye.clientWidth,height:ye.clientHeight});ze();const Je=new ResizeObserver(ze);return Je.observe(ye),()=>Je.disconnect()},[]);const M=wie({viewport:y.viewport,disabled:B||w||x!==null,onViewportChange:Jv,onZoom:mR,onCreate:ye=>{if($(null),e.activeTheaterId&&n){const ze=Iie(t);if(!ze)return;const Je={...Mie(ye),zIndex:gl()};o(ze.pluginId,ze.kind,Je)}},consumePointerDown:T!==null,onConsumePointerDown:()=>{$(null)},onClick:Rie}),D=(ye,ze)=>{const Je=T?.canvasPoint;$(null),Je&&s(ye,ze,Je)},j=ye=>{if(ye.target instanceof Element&&ye.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;ye.preventDefault();const ze=m.current?.getBoundingClientRect();if(!ze)return;const Je={x:ye.clientX-ze.left,y:ye.clientY-ze.top};$({anchor:Je,canvasPoint:th(Je,y.viewport)})},A=new Set(F);_.useEffect(()=>{e.activeOperationId&&A.has(e.activeOperationId)&&Ki(null)},[F,e.activeOperationId]);const O=Object.fromEntries(Object.entries(y.operations).filter(([ye])=>!A.has(ye))),C=(e.operations??[]).filter(ye=>ye.theaterId===e.activeTheaterId),z=I.operationKinds,R=S!==null&&C.some(ye=>ye.id===S&&!A.has(ye.id))?S:null,W=x===null?void 0:C.find(ye=>ye.id===x&&!A.has(ye.id)),G=W?z.find(ye=>ye.pluginId===W.pluginId&&ye.type===W.type):void 0;x===null&&(L.current=null),W&&G?.companions?.length&&(L.current={operation:W,descriptor:G});const U=!W&&L.current?.operation.id===x?L.current:null,ee=W??U?.operation,me=(G??U?.descriptor)?.companions??[],Me=me.filter(ye=>k[ye.id]??!ye.defaultHidden),ve=me.filter(ye=>!Me.includes(ye)).map(ye=>ye.id),Ye=ee&&me.length>0?ee.id:null,qe=W&&G?.companions?.length?W.id:null,yt=ee&&!C.some(ye=>ye.id===ee.id)?[...C,ee]:C,$e=fie(yt,A);_.useEffect(()=>{if(x===null||qe!==null)return;const ye=setTimeout(()=>{L.current=null,ts()},1500);return()=>clearTimeout(ye)},[x,qe]);const We=jw(C,e.groups.filter(ye=>ye.theaterId===e.activeTheaterId),y.operationOrder,[]).filter(ye=>!A.has(ye.id)).map(ye=>ye.id),mt=w?KB({x:0,y:0,width:K.width,height:K.height},We.length,void 0,void 0,void 0,void 0,b):[],ot=new Map(We.map((ye,ze)=>[ye,mt[ze]]));_.useEffect(()=>{if(!w||Tw())return;const ye=m.current;if(!ye)return;const ze=We.map(Ke=>ye.querySelector(`.canvas-operation[data-operation-id="${e1(Ke)}"]`)).filter(Ke=>Ke!==null);ze.forEach((Ke,en)=>{Ke.style.setProperty("--panel-stagger-delay",`${en*40}ms`)});const Je=()=>{for(const Ke of ze)Ke.style.removeProperty("--panel-stagger-delay")},It=window.setTimeout(Je,600+ze.length*40);return()=>{window.clearTimeout(It),Je()}},[w,b]);const Nt=R||Ye||w?1:y.viewport.zoom,Ot=Nie(y.operations)+1,kt=Me.length+1;return u.jsxs("main",{className:`operations-canvas ${M.spaceActive?"is-panning":""} ${M.shiftActive?"is-creating":""} ${Y?"is-glance":""} ${R?"is-panel-maximized":""} ${Ye?"is-companion-layout":""} ${w?"is-formation-view":""}`,onPointerDown:M.onPointerDown,onPointerMove:M.onPointerMove,onPointerUp:M.onPointerUp,onPointerCancel:M.onPointerCancel,onWheel:M.onWheel,onContextMenu:j,ref:m,tabIndex:-1,children:[u.jsx(iie,{viewport:y.viewport}),u.jsx("div",{style:{transform:R||Ye||w?"none":`translate(${Math.round(y.viewport.x)}px, ${Math.round(y.viewport.y)}px) scale(${y.viewport.zoom})`},className:"operations-canvas-world",children:yt.map(ye=>{const ze=y.operations[ye.id]??ye.geometry??kv(ye),Je=R===ye.id,It=Ye===ye.id,Ke=(R!==null||Ye!==null)&&!Je&&!It,en=ot.get(ye.id),we=Je?Lie(K,Ot):It?QT(K,0,kt,Ot):en?{...ze,...en}:ze,De=!Je&&!It&&!en&&y.viewport.y+we.y*Nt<Eie*Nt;return Die(ye,{active:q===ye.id,keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===ye.id?e.keyboardFocusRequest.requestId:0,geometry:we,topEdge:De,operationKindRegistry:z,status:e.operationStatus[ye.id],theme:e.activeTheme,language:V,viewportZoom:Nt,minimized:A.has(ye.id),maximized:Je,companion:It,companions:It?Me:[],companionGeometries:It?Me.map((de,Pe)=>QT(K,Pe+1,kt,Ot)):[],hiddenCompanionPanelIds:It?ve:[],formation:w,focusLayerHidden:Ke,onRenderHiddenFocus:()=>{const de=m.current?.querySelector("[data-focus-layer-target='true']");if(de){de.focus();return}m.current?.focus()},accentKey:y.operationAccent[ye.id]??t5(ye),onActivate:()=>{Ki(ye.id),!Je&&!It&&!w&&Qv(ye.id,y.operations[ye.id]??ye.geometry??kv(ye))},onClose:()=>{e.activeOperationId===ye.id&&Ki(null),R===ye.id&&xo(),Ye===ye.id&&ts(),l(ye.id)},onMinimize:()=>{e.activeOperationId===ye.id&&Ki(null),$O(ye.id),gR(ye.id)},onMaximize:()=>{Je?xo():(Ki(ye.id),kw(ye.id))},onRename:de=>{f(ye.id,de)},onSetAccent:de=>{p(ye.id,de)},onGeometryChange:de=>{!Je&&!It&&!w&&Qv(ye.id,de)},onGeometryCommit:de=>{!Je&&!It&&!w&&Bie(ye.id,Rs().operations[ye.id]??de)}})})}),$e?null:u.jsx(pie,{activeTheaterId:e.activeTheaterId,theaterLabel:e.theaters.find(ye=>ye.id===e.activeTheaterId)?.label??e.activeTheaterId??"",operations:C,canLaunch:n,onOpenOperation:d,onNewOperation:WR}),M.rubberBand?u.jsx(mie,{rect:M.rubberBand,viewport:y.viewport}):null,T?u.jsx(JR,{anchor:T.anchor,viewportBounds:Tie(m.current),placement:"cursor",catalog:t,canLaunch:n&&!w,renderKindIcon:i,onLaunchKind:D,onClose:()=>$(null)},`${T.anchor.x}:${T.anchor.y}`):null,u.jsx(Jne,{operations:O,pluginOperations:Object.fromEntries(C.filter(ye=>!A.has(ye.id)).map(ye=>[ye.id,{theaterId:ye.theaterId,geometry:y.operations[ye.id]??ye.geometry??kv(ye)}])),accents:Object.fromEntries(C.flatMap(ye=>{const ze=y.operationAccent[ye.id]??t5(ye),Je=ze?Zr(ze):null;return Je?[[ye.id,Je]]:[]})),viewport:y.viewport,canvasSize:K,onJump:ye=>Jv({x:K.width/2-ye.x*y.viewport.zoom,y:K.height/2-ye.y*y.viewport.zoom,zoom:y.viewport.zoom})})]})}function Tie(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Rie(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Ki(null)}function Mie(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function kv(e){return e.geometry??{x:0,y:0,width:Cie,height:kie,zIndex:0}}function Lie(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function QT(e,t,n,i){const s=Math.max(1,n),o=8,l=Math.max(0,(e.width-o*(s-1))/s);return{x:t*(l+o),y:0,width:l,height:Math.max(0,e.height),zIndex:i}}function Nie(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function Oie(){const[e,t]=_.useState(!1),n=_.useRef(new Set);return _.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},s=d=>{!e5(d)||d.repeat||d.ctrlKey||d.metaKey||zO()||(n.current.add(d.code),t(!0))},o=d=>{e5(d)&&(n.current.delete(d.code),t(n.current.size>0))},l=()=>{document.visibilityState==="hidden"&&i()};return window.addEventListener("keydown",s),window.addEventListener("keyup",o),window.addEventListener("blur",i),document.addEventListener("visibilitychange",l),()=>{window.removeEventListener("keydown",s),window.removeEventListener("keyup",o),window.removeEventListener("blur",i),document.removeEventListener("visibilitychange",l)}},[]),e}function e5(e){return e.code==="AltLeft"||e.code==="AltRight"}function Iie(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 t5(e){return typeof e.accent=="string"?e.accent:null}function Die(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 s=eg(()=>{qi(null).then(cr).catch(()=>{})}),o=d=>{d?(Ki(e.id),bR(e.id)):XB()},l=(d,f)=>{WB(e.id,d,f)};return u.jsxs(_.Fragment,{children:[u.jsx(aie,{operation:e,active:t.active,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onRename:t.onRename,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,onRenderHiddenFocus:t.onRenderHiddenFocus,children:u.jsx(Np,{fallback:u.jsx(i5,{messageKey:"canvas.plugin.operationFailed"}),children:u.jsx(n5,{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,capabilities:s,geometry:i,operation:e,theme:t.theme,language:t.language,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:l,render:n.render})})}),t.companions.map((d,f)=>u.jsx(jie,{descriptor:d,geometry:t.companionGeometries[f],language:t.language,children:u.jsx(Np,{fallback:u.jsx(i5,{messageKey:"canvas.plugin.companionFailed"}),children:u.jsx(n5,{active:t.active,capabilities:s,geometry:i,operation:e,theme:t.theme,language:t.language,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:l,render:d.render})})},d.id))]},e.id)}function n5({active:e,keyboardFocusRequestId:t,capabilities:n,geometry:i,operation:s,theme:o,language:l,viewportZoom:d,onActivate:f,onClose:p,onGeometryChange:m,onRequestCompanions:y,companionsOpen:b,hiddenCompanionPanelIds:w,onSetCompanionPanelVisible:S,render:x}){return x({operationId:s.id,theaterId:s.theaterId,pluginId:s.pluginId,type:s.type,operation:s,geometry:i,active:e,...t===void 0?{}:{keyboardFocusRequestId:t},zoom:d,theme:o,language:l,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:f,onClose:p,onGeometryChange:m,onRequestCompanions:y,companionsOpen:b,hiddenCompanionPanelIds:w,onSetCompanionPanelVisible:S})}function i5({messageKey:e}){const t=rt();return u.jsx("div",{className:"fc-plugin-error",children:t(e)})}function jie({descriptor:e,geometry:t,language:n,children:i}){const s=rt(),o=Sl(e.title,n),l={left:Math.round(t.x),top:Math.round(t.y),width:Math.round(t.width),height:Math.round(t.height),zIndex:t.zIndex};return u.jsxs("article",{className:"canvas-operation canvas-companion-frame",style:l,"data-canvas-operation":!0,"aria-label":s("canvas.companion.aria",{title:o}),children:[e.hideCaption?null:u.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[u.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),u.jsx("span",{className:"canvas-companion-caption-title",children:o})]}),u.jsx("div",{className:"canvas-operation-terminal canvas-companion-body",onPointerDown:d=>d.stopPropagation(),onWheel:d=>d.stopPropagation(),"data-canvas-blocker":!0,children:i})]})}async function Bie(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function qO(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 GO(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function KO(e,t){const n=[],i=[];for(const s of e)t.has(s.operationId)?i.push(s):n.push(s);return{hidden:n,visible:i}}function ew(e){const t=new Map;for(const n of[...e].sort((i,s)=>s.lastRaisedSeq-i.lastRaisedSeq)){const i=n.theaterId??"__unknown__",s=t.get(i)??{theaterId:n.theaterId,theaterLabel:n.theaterLabel,notifications:[]};s.notifications.push(n),t.set(i,s)}return[...t.values()].sort((n,i)=>{const s=n.notifications[0]?.lastRaisedSeq??0;return(i.notifications[0]?.lastRaisedSeq??0)-s})}function VO(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}function Pie(e){return{ended:e("rail.alerts.kindEnded"),"input-waiting":e("rail.alerts.kindWaiting")}}const zie={id:"alerts",title:e=>fr(e)("rail.alerts.title"),icon:()=>u.jsx(Fie,{}),render:()=>u.jsx($ie,{})};function $ie(){const e=rt(),t=Pie(e),n=ps(),i=Yc(),[s,o]=_.useState(!1),l=_.useMemo(()=>GO(Object.values(n.operationNotifications),n.operations),[n.operationNotifications,n.operations]),d=qO(n),f=KO(l,d).hidden,p=VO(f,n.notificationPreferences),m=ew(p),y=ew(f),b=tw(m,"input-waiting"),w=tw(m,"ended"),S=m.length===0,x=_.useCallback(k=>{yl(k.operationId),i("/operations")},[i]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":e("rail.alerts.panelAria"),children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[b>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:b}):null,w>0?u.jsx("span",{className:"notification-tally is-ended",children:w}):null,S?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${s?" is-active":""}`,onClick:()=>o(k=>!k),"aria-expanded":s,"aria-label":e("rail.alerts.settingsAria"),title:e("rail.alerts.settingsAria"),children:u.jsx(qie,{})})]}),s?u.jsx(Hie,{groups:y}):null,S?u.jsx("p",{className:"notification-dock-empty",children:e("rail.alerts.empty")}):u.jsx("div",{className:"notification-dock-deck",children:m.map(k=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:k.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:k.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:k.notifications.map(L=>u.jsxs("li",{className:`notification-row is-${L.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:L.operationLabel}),u.jsx("span",{className:"notification-row-state",children:t[L.kind]})]}),u.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>x(L),"aria-label":e("rail.alerts.openAria",{theater:k.theaterLabel,operation:L.operationLabel}),children:e("rail.alerts.open")})]},L.operationId))})]},k.theaterId??"__unknown__"))})]})}function Fie(){const e=ps();RM();const t=_.useMemo(()=>GO(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=qO(e),i=KO(t,n).hidden,s=VO(i,e.notificationPreferences),o=ew(s),l=o.reduce((p,m)=>p+m.notifications.length,0),d=tw(o,"input-waiting"),f=l===0?"muted":d>0?"awaiting":"ended";return u.jsxs("span",{className:`alerts-icon is-${f}`,"aria-hidden":"true",children:[u.jsx(Wie,{}),l>0?u.jsx("span",{className:"alerts-icon-badge",children:l}):null]})}function Hie({groups:e}){const t=rt(),n=ps(),i=Uie(e,n.notificationPreferences.mutedTheaterIds,n.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":t("rail.alerts.settingsAria"),children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:t("rail.alerts.settingsDisplay")}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:n.notificationPreferences.globalMute,onChange:s=>mP(s.currentTarget.checked)}),u.jsx("span",{children:t("rail.alerts.muteAll")})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:n.notificationPreferences.dnd,onChange:s=>gP(s.currentTarget.checked)}),u.jsx("span",{children:t("rail.alerts.dnd")})]}),i.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:t("rail.alerts.byTheater")}):null,i.map(s=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:s.theaterId?n.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&yP(s.theaterId)}}),u.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function Uie(e,t,n){const i=new Map;for(const s of e)s.theaterId&&i.set(s.theaterId,s);for(const s of Object.keys(t))i.has(s)||i.set(s,{theaterId:s,theaterLabel:n.find(o=>o.id===s)?.label??s,notifications:[]});return[...i.values()]}function tw(e,t){let n=0;for(const i of e)for(const s of i.notifications)s.kind===t&&(n+=1);return n}function Wie(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[u.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function qie(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class t1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function Gie(e,t){const i=new URLSearchParams().toString();return To(ai(e,`/search${i?`?${i}`:""}`))}async function Kie(e,t,n){return To(ai(e,`/entry/${encodeURIComponent(t)}`))}async function YO(e,t="pending"){return To(ai(e,`/drydock?status=${encodeURIComponent(t)}`))}async function Vie(e,t){return To(ai(e,`/drydock/${encodeURIComponent(t)}`))}async function Yie(e){return To(ai(e,"/schema"))}async function Xie(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return To(ai(e,n))}async function Zie(e,t,n,i){const s={action:n};return i!==void 0&&(s.reason=i),lre(ai(e,`/drydock/${encodeURIComponent(t)}/decision`),s)}async function Jie(e){return To(ai(e,"/conflicts"))}async function Qie(e,t){return To(ai(e,`/conflicts/${encodeURIComponent(t)}`))}async function ere(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),XO(ai(e,`/cowork/options?${i}`))}async function r5(e,t,n){return Ro(ai(e,"/cowork/sessions"),{entryId:t,...n})}async function tre(e,t){try{return await XO(ai(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof t1&&n.status===404)return null;throw n}}async function Ev(e,t,n){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function nre(e,t,n){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function s5(e,t,n){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function ire(e,t,n){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function rre(e,t){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function sre(e,t,n){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function are(e,t){return Ro(ai(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function ore(e,t,n,i){const s=new EventSource(`${ai(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=l=>{try{const d=JSON.parse(l.data);if(!cre(d))return;i(d,Number(l.lastEventId)||0)}catch{}};for(const l of["session","transcript","tool","done","error"])s.addEventListener(l,o);return()=>s.close()}function ai(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function To(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await JO(e,t));return t.json()}async function lre(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 JO(e,n));return n.json()}async function XO(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await ZO(t);return t.json()}async function Ro(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 ZO(n);return n.json()}async function ZO(e){const t=await e.json().catch(()=>null);return new t1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function cre(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 JO(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const nw=new Set;let Cp=0;const jc={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function el(){return jc}function QO(e){return nw.add(e),()=>nw.delete(e)}function a5(e){Cp+=1,kp({currentWorkspaceId:e,schemaCatalog:null})}async function Cm(){const e=jc.currentWorkspaceId,t=Cp;kp({loading:!0,error:null});try{const[n,i,s]=await Promise.all([Gie(e),YO(e,"pending").catch(()=>null),Yie(e).catch(()=>null)]);if(jc.currentWorkspaceId!==e||Cp!==t)return;kp({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:s,loading:!1})}catch(n){if(jc.currentWorkspaceId!==e||Cp!==t)return;kp({loading:!1,error:ure(n)})}}function kp(e){Object.assign(jc,e);for(const t of nw)t(jc)}function ure(e){return e instanceof Error?e.message:String(e)}const dre=120;function hre(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function Av(){return fr(hre())}function fn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function fre(e,t){if(!t)return fn(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?fn(e):fn(e.slice(0,n))+`<mark>${fn(e.slice(n,n+t.length))}</mark>`+fn(e.slice(n+t.length))}function pre(e){return`<span class="codex-nav-tag">${fn(e)}</span>`}function mre(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,s=e.tags.slice(0,3).map(pre).join(""),o=fn(e.status??"current"),l=fn(e.updated??"");return`<button
231
+ class="codex-nav-entry${n?" is-current":""}"
232
+ data-entry-id="${fn(e.id)}"
233
+ type="button"
234
+ ${n?'aria-current="page"':""}
235
+ title="${fn(e.title)}"
236
+ >
237
+ <span class="t">${fre(e.title,i?"":t)}</span>
238
+ ${s?`<span class="tg">${s}</span>`:""}
239
+ <span class="meta">${o} · ${l}</span>
240
+ </button>`}function gre(e,t){if(!t)return e;const n=t.toLowerCase();return e.filter(i=>i.title.toLowerCase().includes(n)||i.tags.some(s=>s.toLowerCase().includes(n)))}function yre(e,t){let n="",i=null,s="entries",o=null;function l(){const x=Av();e.innerHTML=`
241
+ <div class="codex-navigator">
242
+ <div class="codex-nav-modes" role="tablist" aria-label="${fn(x("codex.nav.catalogAria"))}">
243
+ <button type="button" role="tab" data-mode="entries" aria-selected="true">${fn(x("codex.nav.entries"))}</button>
244
+ <button type="button" role="tab" data-mode="schema" aria-selected="false">${fn(x("codex.nav.schema"))}</button>
245
+ </div>
246
+ <div class="codex-nav-search">
247
+ <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>
248
+ <input
249
+ class="codex-nav-search-input"
250
+ type="search"
251
+ placeholder="${fn(x("codex.nav.searchPlaceholder"))}"
252
+ autocomplete="off"
253
+ spellcheck="false"
254
+ aria-label="${fn(x("codex.nav.searchAria"))}"
255
+ />
256
+ </div>
257
+ <div class="codex-nav-quick-row">
258
+ <button class="codex-nav-quick" data-action="drydock" type="button">
259
+ ${fn(x("codex.nav.reviewQueue"))} <span class="badge" id="codex-nav-drydock-badge">0</span>
260
+ </button>
261
+ <button class="codex-nav-quick" data-action="conflicts" type="button">${fn(x("codex.nav.conflicts"))}</button>
262
+ </div>
263
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">${fn(x("codex.nav.entriesCount",{count:0}))}</div>
264
+ <div class="codex-navigator-scroll">
265
+ <div class="codex-nav-list" id="codex-nav-list"></div>
266
+ </div>
267
+ </div>
268
+ `}l();const d=e.querySelector(".codex-nav-search-input"),f=e.querySelector("#codex-nav-list"),p=e.querySelector("#codex-nav-eyebrow"),m=e.querySelector("#codex-nav-drydock-badge");function y(x){const k=Av();if(e.querySelectorAll("[data-mode]").forEach(F=>F.setAttribute("aria-selected",String(F.dataset.mode===s))),d.hidden=s==="schema",s==="schema"){const F=x.schemaCatalog;p.textContent=k("codex.nav.schemaCount",{count:F?.templates.length??0}),f.innerHTML=F?`
269
+ <button class="codex-nav-entry" type="button" ${F.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">${fn(k("codex.nav.workspaceSchema"))}</span><span class="meta">${F.schema.exists?fn(F.schema.ref):fn(k("codex.nav.unavailable"))}</span></button>
270
+ ${F.templates.map(q=>`<button class="codex-nav-entry" type="button" data-template-id="${fn(q.id)}"><span class="t">${fn(q.id)}</span><span class="meta">${fn(q.ref)}</span></button>`).join("")}`:`<div class="codex-nav-empty">${fn(k("codex.nav.schemaUnavailable"))}</div>`,m.textContent=String(x.pendingPatchCount);return}const L=gre(x.index,n);if(p.textContent=k("codex.nav.entriesCount",{count:L.length}),m.textContent=String(x.pendingPatchCount),m.hidden=x.pendingPatchCount===0,x.loading&&x.index.length===0){f.innerHTML=`<div class="codex-nav-loading" aria-live="polite">${fn(k("common.loading"))}</div>`;return}if(x.error){f.innerHTML=`<div class="codex-nav-error" role="alert">${fn(x.error)}</div>`;return}if(L.length===0){f.innerHTML=`<div class="codex-nav-empty">${fn(k(n?"codex.nav.noMatch":"codex.nav.noEntries"))}</div>`;return}f.innerHTML=L.map(F=>mre(F,n,F.id===i)).join("")}function b(x){const k=x.target;if(!(k instanceof Element))return;const L=k.closest("[data-mode]");if(L?.dataset.mode==="entries"||L?.dataset.mode==="schema"){s=L.dataset.mode,y(el());return}if(k.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const q=k.closest("[data-template-id]");if(q?.dataset.templateId){t.onRequest({kind:"schema",templateId:q.dataset.templateId});return}const T=k.closest("[data-entry-id]");if(T?.dataset.entryId){i=T.dataset.entryId,y(el()),t.onRequest({kind:"entry",id:i});return}const $=k.closest("[data-action]");if($?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if($?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function w(){o!==null&&clearTimeout(o),o=setTimeout(()=>{n=d.value,y(el())},dre)}e.addEventListener("click",b),d.addEventListener("input",w);const S=QO(x=>y(x));return y(el()),{destroy(){S(),e.removeEventListener("click",b),d.removeEventListener("input",w),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(x){n="",i=null,d&&(d.value=""),y(el())},refreshLocale(){const x=Av();e.querySelector(".codex-nav-modes")?.setAttribute("aria-label",x("codex.nav.catalogAria"));const k=e.querySelector('[data-mode="entries"]');k&&(k.textContent=x("codex.nav.entries"));const L=e.querySelector('[data-mode="schema"]');L&&(L.textContent=x("codex.nav.schema")),d.placeholder=x("codex.nav.searchPlaceholder"),d.setAttribute("aria-label",x("codex.nav.searchAria"));const F=e.querySelector('[data-action="drydock"]');F&&F.replaceChildren(document.createTextNode(`${x("codex.nav.reviewQueue")} `),m);const q=e.querySelector('[data-action="conflicts"]');q&&(q.textContent=x("codex.nav.conflicts")),y(el())}}}function _re(e,t){t.initialTheaterId&&a5(t.initialTheaterId);const n=yre(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=QO(()=>{});Cm();const s=n.destroy.bind(n);return{destroy(){i(),s()},setTheater(o){a5(o),Cm(),n.setTheater(o)},refreshLocale(){n.refreshLocale()}}}function He(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zt(e){return He(e).replace(/"/g,"&quot;")}function eI(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function vre(e){const t=eI(),n=fr(t),i=e.tags.map(o=>`<span class="chip chip-tag">${He(o)}</span>`).join(""),s=bre(e);return`
271
+ <div class="meta-chips">
272
+ ${i}
273
+ ${s}
274
+ <span class="chip">${He(n("codex.meta.updated",{date:S8(e.updated,t)}))}</span>
275
+ </div>
276
+ `}function tI(e){return e.map(t=>`<span class="chip chip-muted">${He(t)}</span>`).join("")}function bre(e){const t=wre(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Zt(t.title)}">${He(t.label)}</span>`:""}function wre(e,t=new Date){const n=fr(eI()),i=e.status,s=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return i==="deprecated"||i==="superseded"?{label:i,tone:"deprecated",title:s?n("codex.meta.statusStaleTitle",{status:i}):i}:s?{label:n("codex.meta.stale"),tone:"stale",title:e.revalidateAfter??n("codex.meta.stale")}:i==="current"||i==="draft"?{label:i,tone:"neutral",title:i}:null}function Sre(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}const xre="active";function Tv(e){if(e.length===0){const t=fr(Sre());return`<p class="toc-empty">${He(t("codex.toc.noSections"))}</p>`}return e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Zt(t.id)}" data-toc-id="${Zt(t.id)}">${He(t.text)}</a>`).join("")}function o5(e,t,n){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const i=[...n.querySelectorAll("[data-toc-id]")],s=new Set(t.map(p=>p.id)),o=[...e.querySelectorAll("h2[id], h3[id]")].filter(p=>s.has(p.id));if(i.length===0||o.length===0)return()=>{};const l=e.closest(".codex-reading-sheet-read"),d=new Set,f=new IntersectionObserver(p=>{for(const y of p){const b=y.target instanceof HTMLElement?y.target.id:"";b&&(y.isIntersecting?d.add(b):d.delete(b))}const m=Cre(o,d)??kre(o,l)??o[0]?.id??null;l5(i,m)},{root:l,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const p of o)f.observe(p);return l5(i,o[0]?.id??null),()=>f.disconnect()}function Cre(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function kre(e,t){const n=t?t.getBoundingClientRect().top:0;let i=null;for(const s of e)if(s.getBoundingClientRect().top-n<=80)i=s.id;else break;return i}function l5(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(xre,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}const nI=1<<20;function Ere(e,t){const n=e.replace(/\r\n/g,`
277
+ `).split(`
278
+ `),i=t.replace(/\r\n/g,`
279
+ `).split(`
280
+ `),s=n.length+1,o=i.length+1;if(s*o>nI)return i.map((m,y)=>({text:m,changed:n[y]!==m}));const l=Array.from({length:s},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let y=i.length-1;y>=0;y-=1)l[m][y]=n[m]===i[y]?l[m+1][y+1]+1:Math.max(l[m+1][y],l[m][y+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&&l[f+1][p]>=l[f][p+1]?f+=1:(d.push({text:i[p],changed:!0}),p+=1);return d}function Are(e,t){const n=c5(e),i=c5(t),s=n.length+1,o=i.length+1,l=[];if(s*o>nI){const m=Math.max(n.length,i.length);for(let y=0;y<m;y+=1){const b=n[y],w=i[y];w!==void 0&&w===b?l.push({markdown:w,kind:"same"}):(b!==void 0&&l.push({markdown:b,kind:"removed"}),w!==void 0&&l.push({markdown:w,kind:"added"}))}return u5(l)}const d=Array.from({length:s},()=>new Uint16Array(o));for(let m=n.length-1;m>=0;m-=1)for(let y=i.length-1;y>=0;y-=1)d[m][y]=n[m]===i[y]?d[m+1][y+1]+1:Math.max(d[m+1][y],d[m][y+1]);let f=0,p=0;for(;f<n.length||p<i.length;)f<n.length&&p<i.length&&n[f]===i[p]?(l.push({markdown:i[p],kind:"same"}),f+=1,p+=1):f<n.length&&(p>=i.length||d[f+1][p]>=d[f][p+1])?(l.push({markdown:n[f],kind:"removed"}),f+=1):(l.push({markdown:i[p],kind:"added"}),p+=1);return u5(l)}function c5(e){const t=[];let n=[],i=null;for(const s of e.replace(/\r\n/g,`
281
+ `).split(`
282
+ `)){const o=s.trim();if(!i&&o===""){n.length&&(t.push(n.join(`
283
+ `)),n=[]);continue}if(n.push(s),i)o.startsWith(i)&&(i=null);else{const l=o.match(/^(`{3,}|~{3,})/);l&&(i=l[1])}}return n.length&&t.push(n.join(`
284
+ `)),t}function u5(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}
285
+
286
+ ${n.markdown}`,kind:i.kind}:t.push(n)}return t}function Rv(e){return e.map(t=>({value:t,label:t}))}function Tre({clis:e,models:t,efforts:n,cli:i,model:s,effort:o,onCliChange:l,onModelChange:d,onEffortChange:f}){const p=rt();return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"cowork-selector",children:[u.jsx("span",{children:p("codex.cowork.cli")}),u.jsx(Oi,{label:p("codex.cowork.cli"),value:i,options:Rv(e),onChange:l,disabled:!e.length,compact:!0})]}),u.jsxs("div",{className:"cowork-selector",children:[u.jsx("span",{children:p("codex.cowork.model")}),u.jsx(Oi,{label:p("codex.cowork.model"),value:s,options:Rv(t),onChange:d,disabled:!t.length,compact:!0})]}),u.jsxs("div",{className:"cowork-selector",children:[u.jsx("span",{children:p("codex.cowork.effort")}),u.jsx(Oi,{label:p("codex.cowork.effort"),value:o,options:Rv(n),onChange:f,disabled:!n.length,compact:!0})]})]})}function km(e){return`/entry/${encodeURIComponent(e)}`}function Rre(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function Mi(){return fr(Rre())}const iI="fleet.codex.cowork.settings",Mre="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",Lre=32;function Nre(e){let t=!1,n=null,i=null,s=0,o={clis:[],models:[],efforts:[]},l=Bre(),d=[],f="",p="",m="",y=null,b="",w="idle",S=!1,x=null,k=!1,L=!1,F=!1,q=null,T=!1,$=!1,I=!1,N=null,V="",K="",Q="published",Y=null,B=null,M=null;const D=()=>n?((!B||B.base!==n.baseDraft||B.draft!==n.draft)&&(B={base:n.baseDraft,draft:n.draft,lines:Ere(n.baseDraft,n.draft)}),B.lines):[],j=e.body.innerHTML,A=document.createElement("div");A.className="cowork-anchor";const O=document.createElement("div");O.className="cowork-dock-zone";const C=document.createElement("div");C.className="cowork-tip",C.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(A,O,C);const z=()=>{M?.unmount(),M=null},P=()=>{if(!F||t)return;const se=O.querySelector("[data-cowork-settings-host]");se&&(M||(M=L5.createRoot(se)),M.render(_.createElement(Tre,{clis:o.clis,models:o.models,efforts:o.efforts,cli:l.cli,model:l.model,effort:l.effort,onCliChange:oe=>R("cli",oe),onModelChange:oe=>R("model",oe),onEffortChange:oe=>R("effort",oe)})))},R=(se,oe)=>{if(l=se==="cli"?{cli:oe,model:"",effort:""}:{...l,[se]:oe},Lv(l),!n){se!=="effort"?kt().then(()=>{U()}).catch(()=>{}):P();return}se!=="effort"?kt().then(()=>de(()=>Ev(e.theaterId,n.id,l))).then(U).catch(ge=>{K=ge instanceof Error?ge.message:Mi()("codex.cowork.requestFailed"),U()}):de(()=>Ev(e.theaterId,n.id,l)).then(U).catch(()=>{})},W=()=>{if(t)return;const se=Mi(),oe=!!n&&n.state!=="closed",ge=oe?T?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(ge!==Q){if(Q=ge,!oe){e.body.innerHTML=j;return}e.body.innerHTML=T?`<div class="cowork-rendered-diff" aria-label="${Zt(se("codex.cowork.draftChangesAria"))}">${Ire(Mv(n.baseDraft),Mv(n.draft))}</div>`:es(Mv(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:Ee=>km(Ee),...cl(se)}).html}},G=()=>{if(t)return;if(!x){A.innerHTML="";return}const se=Mi(),oe=e.article.getBoundingClientRect().width||0,ge=k?Math.min(340,oe*.86)/2+8:56,Ee=Math.min(Math.max(x.left,ge),Math.max(oe-ge,ge)),je=`style="top:${x.top}px;left:${Ee}px"`;A.innerHTML=k?`<div class="cowork-composer" ${je} role="dialog" aria-label="${Zt(se("codex.cowork.addCommentAria"))}">
287
+ <blockquote>${He(h5(x.quote,140))}</blockquote>
288
+ <textarea class="cowork-composer-input" rows="2" placeholder="${Zt(se("codex.cowork.commentPlaceholder"))}" aria-label="${Zt(se("codex.cowork.commentAria"))}"></textarea>
289
+ <div class="cowork-composer-actions">
290
+ <button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">${He(se("common.cancel"))}</button>
291
+ <button type="button" class="cowork-solid" data-cowork-action="add-comment">${He(se("codex.cowork.add"))}</button>
292
+ </div>
293
+ </div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${je}><span aria-hidden="true">✦</span>${He(se("codex.cowork.comment"))}</button>`,k&&A.querySelector(".cowork-composer-input")?.focus()},U=()=>{if(t)return;const se=Mi(),oe=!!n&&n.state!=="closed"&&n.state!=="applied";O.classList.add("is-open");const ge=I||oe&&n.state==="running"&&w!=="complete"&&w!=="stopped";e.body.classList.toggle("is-cowork-running",ge);const Ee=oe&&n.baseDraft!==n.draft,je=Ee?D().filter(at=>at.changed).length:0;qe(`
294
+ ${ee(ge)}
295
+ ${L?yt():""}
296
+ ${F?$e():""}
297
+ ${Ee&&!ge?We(je):""}
298
+ <div class="cowork-bar${ge?" is-running":""}" data-cowork-form>
299
+ ${ge?'<span class="cowork-glow" aria-hidden="true"></span>':""}
300
+ <button type="button" class="cowork-chip${L?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${L}" aria-label="${Zt(se("codex.cowork.annotationsAria"))}" ${ge?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
301
+ <input class="cowork-dock-input" name="prompt" value="${Zt(V)}" placeholder="${Zt(d.length?se("codex.cowork.instructionOptional"):se("codex.cowork.askAi"))}" aria-label="${Zt(se("codex.cowork.instructionAria"))}" ${ge?"disabled":""}>
302
+ <button type="button" class="cowork-chip cowork-chip--config${F?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${F}" aria-label="${Zt(se("codex.cowork.agentSettingsAria"))}" ${ge?"disabled":""}>${He(l.cli||"agent")}</button>
303
+ ${ge?`<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="${Zt(se("codex.cowork.stopAria"))}"><span aria-hidden="true"></span></button>`:`<button type="button" class="cowork-send" data-cowork-action="send" aria-label="${Zt(se("codex.cowork.sendToAi"))}">↑</button>`}
304
+ </div>
305
+ ${K?`<p class="cowork-error" role="alert">${He(K)}</p>`:""}`),P()},ee=se=>{const oe=Mi();if(!(se||w!=="idle"))return"";const Ee=se?"running":w,je=oe(se?"codex.cowork.editingEntry":w==="complete"?"codex.cowork.revisionComplete":"codex.cowork.revisionStopped"),at=oe(S?"codex.cowork.expandStream":"codex.cowork.collapseStream"),Z=!!(b||f||se);return`<section class="cowork-revision-stream is-${Ee}${S?" is-collapsed":""}" aria-label="${Zt(oe("codex.cowork.revisionStreamAria"))}">
306
+ ${se?'<span class="cowork-revision-scan" aria-hidden="true"></span>':""}
307
+ <header class="cowork-revision-head"><span class="cowork-revision-mark" aria-hidden="true">✳</span><span class="cowork-revision-copy"><strong>Cowork</strong><small>${He(je)}</small></span>${Z?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!S}" aria-label="${Zt(at)}"><span aria-hidden="true"></span></button>`:""}</header>
308
+ ${Z?`<div class="cowork-revision-content" aria-hidden="${S}"><div class="cowork-revision-content-inner">
309
+ ${b||f?`<div class="cowork-revision-body">
310
+ ${b?`<p class="cowork-revision-instruction">${He(b)}</p>`:""}
311
+ ${f?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${m}</div></div>`:""}
312
+ </div>`:""}
313
+ ${se?`<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>${He(oe("codex.cowork.writingRevision"))}</strong></span></footer>`:""}
314
+ </div></div>`:""}
315
+ </section>`},ne=()=>{y!==null&&window.clearTimeout(y),y=null},me=()=>{p!==f&&(p=f,m=f?es(f,cl(Mi())).html:"")},Me=()=>{me();const se=O.querySelector(".cowork-revision-output");if(!se){U();return}se.innerHTML=m;const oe=se.closest(".cowork-revision-output-scroll");oe&&(oe.scrollTop=oe.scrollHeight)},ve=()=>{y===null&&(y=window.setTimeout(()=>{y=null,t||Me()},Lre))},Ye=()=>{ne(),me()},qe=se=>{if(se===Y)return;z(),Y=se;const oe=document.activeElement,ge=oe instanceof HTMLInputElement&&oe.name==="prompt"&&O.contains(oe)?"prompt":oe instanceof HTMLTextAreaElement&&oe.dataset.coworkComment&&O.contains(oe)?`comment:${oe.dataset.coworkComment}`:null;if(O.innerHTML=se,ge==="prompt"){const Ee=O.querySelector(".cowork-dock-input");Ee?.focus(),Ee?.setSelectionRange(Ee.value.length,Ee.value.length)}else if(ge?.startsWith("comment:")){const Ee=O.querySelector(`[data-cowork-comment="${CSS.escape(ge.slice(8))}"]`);Ee?.focus(),Ee?.setSelectionRange(Ee.value.length,Ee.value.length)}},yt=()=>{const se=Mi();return`
316
+ <div class="cowork-popover cowork-panel" role="region" aria-label="${Zt(se("codex.cowork.annotationsAria"))}">
317
+ ${d.length===0?`<p class="cowork-empty">${He(se("codex.cowork.emptyAnnotations"))}</p>`:d.map(oe=>`
318
+ <article class="cowork-card is-${oe.status}">
319
+ <blockquote>${He(h5(oe.quote,160))}</blockquote>
320
+ <textarea data-cowork-comment="${Zt(oe.id)}" aria-label="${Zt(se("codex.cowork.commentAria"))}" placeholder="${Zt(se("codex.cowork.addCommentPlaceholder"))}" ${oe.status==="sent"?"disabled":""}>${He(oe.comment)}</textarea>
321
+ <footer><span class="cowork-card-status">${He(oe.status==="sent"?se("codex.cowork.statusSent"):oe.status==="done"?se("codex.cowork.statusDone"):se("codex.cowork.statusReady"))}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${Zt(oe.id)}" aria-label="${Zt(se("codex.cowork.deleteAnnotation"))}">×</button></footer>
322
+ </article>`).join("")}
323
+ </div>`},$e=()=>{const se=Mi();return`
324
+ <div class="cowork-popover cowork-config" role="region" aria-label="${Zt(se("codex.cowork.agentSettingsAria"))}">
325
+ <div data-cowork-settings-host></div>
326
+ </div>`},We=se=>{const oe=Mi();if(q){const Ee=oe(q==="apply"?"codex.cowork.applyConfirm":"codex.cowork.discardConfirm"),je=q==="apply"?"apply-confirm":"discard-confirm";return`<div class="cowork-review is-confirm"><span>${He(Ee)}</span><button type="button" class="cowork-solid${q==="discard"?" cowork-solid--danger":""}" data-cowork-action="${je}">${He(oe(q==="apply"?"codex.cowork.apply":"codex.cowork.discard"))}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">${He(oe("codex.cowork.back"))}</button></div>`}const ge=se>0?oe(se===1?"codex.cowork.changedLines_one":"codex.cowork.changedLines_other",{count:se}):oe("codex.cowork.removedContent");return`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${He(ge)}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${He(oe(T?"codex.cowork.viewDraft":"codex.cowork.viewDiff"))}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">${He(oe("codex.cowork.apply"))}</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">${He(oe("codex.cowork.discard"))}</button></div>`},mt=()=>{if(!t){for(const se of[...e.body.querySelectorAll("mark.cowork-mark")]){const oe=se.parentNode;if(oe){for(;se.firstChild;)oe.insertBefore(se.firstChild,se);oe.removeChild(se)}}if(e.body.normalize(),!T)for(const se of d)se.quote&&ot(se)}},ot=se=>{const oe=[],ge=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let he=ge.nextNode();he;he=ge.nextNode())oe.push(he);let Ee="";const je=[];for(const he of oe)je.push(Ee.length),Ee+=he.data;const at=Ee.indexOf(se.quote);if(at<0)return;const Z=at+se.quote.length;for(let he=0;he<oe.length;he+=1){const ke=je[he],Ge=ke+oe[he].data.length,St=Math.max(at,ke),Pt=Math.min(Z,Ge);if(St>=Pt)continue;const Fe=document.createRange();Fe.setStart(oe[he],St-ke),Fe.setEnd(oe[he],Pt-ke);const Oe=document.createElement("mark");Oe.className="cowork-mark",Oe.dataset.annotationId=se.id;try{Fe.surroundContents(Oe)}catch{}}},Nt=se=>{const oe=d.find(at=>at.id===se.dataset.annotationId);if(!oe){C.hidden=!0;return}C.textContent=oe.comment.trim()||Mi()("codex.cowork.noCommentYet"),C.hidden=!1;const ge=se.getBoundingClientRect(),Ee=e.article.getBoundingClientRect(),je=C.offsetWidth/2+8;C.style.top=`${Math.max(ge.top-Ee.top-6,0)}px`,C.style.left=`${Math.min(Math.max(ge.left+ge.width/2-Ee.left,je),Math.max(Ee.width-je,je))}px`},Ot=()=>{W(),U(),mt()},kt=async()=>{o=await ere(e.theaterId,l.cli,l.model||void 0);const se=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",oe=o.defaultEffort&&o.efforts.includes(o.defaultEffort)?o.defaultEffort:o.efforts[0]??"";l={cli:o.clis.includes(l.cli)?l.cli:o.clis[0]??"",model:o.models.includes(l.model)?l.model:se,effort:o.efforts.includes(l.effort)?l.effort:oe},Lv(l)},ye=async se=>{n=se;const oe=se.annotations.map(Dre),ge=new Set(oe.map(Ee=>Ee.id));d=[...oe,...d.filter(Ee=>!ge.has(Ee.id))],(se.cli||se.model||se.effort)&&(l={cli:se.cli??l.cli,model:se.model??l.model,effort:se.effort??l.effort},Lv(l));try{await kt()}catch{}if(!t){if(n&&(n.cli!==l.cli||n.model!==l.model||n.effort!==l.effort))try{n=await Ev(e.theaterId,n.id,l)}catch{}t||(Je(),Ot())}},ze=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const se=await r5(e.theaterId,e.entryId,l);return await ye(se),se};U(),kt().then(U).catch(()=>{}),(async()=>{try{const se=await tre(e.theaterId,e.entryId);!t&&se&&await ye(se)}catch{}})();function Je(){n&&(i?.(),i=ore(e.theaterId,n.id,s,(se,oe)=>{if(oe&&oe<=s)return;s=Math.max(s,oe);const ge=n?.state==="running";if(se.session&&(n=se.session),se.type==="transcript"&&se.text&&n?.state==="running"){f=w==="running"?f+se.text:se.text,w="running",ve();return}se.type==="done"&&(Ye(),(!N?.cancelled||N.submitted)&&(w=ge||$||w==="stopped"||!!f||!!b?"complete":"idle",d=d.map(je=>je.status==="sent"?{...je,status:"done"}:je),$&&($=!1,n&&n.baseDraft!==n.draft&&(T=!0)))),(se.type==="error"||se.type==="session"&&ge&&n?.state!=="running")&&(Ye(),w="stopped",$=!1,d=d.map(Ee=>Ee.status==="sent"?{...Ee,status:"pending"}:Ee)),se.type==="error"&&se.text&&(K=se.text),Ot()}))}async function It(se,oe){d=[...d,{id:jre(),quote:se,comment:oe,status:"pending"}],x=null,k=!1,G(),U(),mt();try{await ze(),await de(()=>nre(e.theaterId,n.id,se)),await en()}catch{}}async function Ke(se){d=d.filter(oe=>oe.id!==se),U(),mt(),C.hidden=!0;try{await en()}catch{}}async function en(){n&&await de(()=>s5(e.theaterId,n.id,d.map(d5)))}async function we(){if(I||n?.state==="running")return;const se=d.filter(je=>je.status!=="done"),oe=V.trim(),ge=oe||(se.length?Mre:"");if(!ge)return;const Ee={cancelled:!1,submitted:!1};N=Ee,I=!0,d=se.map(je=>({...je,status:"sent"})),ne(),f="",p="",m="",b=oe,w="running",S=!1,V="",L=!1,F=!1,U(),mt();try{if(await ze(),Ee.cancelled||N!==Ee||(await de(()=>s5(e.theaterId,n.id,d.map(d5))),Ee.cancelled||N!==Ee))return;Ee.submitted=!0,await de(()=>ire(e.theaterId,n.id,ge)),$=!0}catch{!Ee.cancelled&&N===Ee&&($=!1,w="idle",d=d.map(je=>je.status==="sent"?{...je,status:"pending"}:je))}finally{!Ee.cancelled&&N===Ee&&(I=!1,N=null,U())}}async function De(){if(!n)return;const se=n.id;try{K="",await are(e.theaterId,se)}catch(oe){K=oe instanceof Error?oe.message:Mi()("codex.cowork.requestFailed"),U();return}i?.(),i=null,s=0,d=[],ne(),f="",p="",m="",b="",w="idle",S=!1,q=null,T=!1;try{await ye(await r5(e.theaterId,e.entryId,l))}catch{n=null,Ot()}}async function de(se){try{K="",n=await se(),Ot()}catch(oe){const ge=Mi();throw K=oe instanceof t1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(oe.code)?ge("codex.cowork.applyStale"):oe instanceof Error?oe.message:ge("codex.cowork.requestFailed"),Ot(),oe}}const Pe=se=>{if(k||n?.state==="running"||se.target instanceof Node&&A.contains(se.target))return;const oe=window.getSelection(),ge=oe?.toString().trim()??"";if(!ge||!oe||oe.rangeCount===0||!e.body.contains(oe.anchorNode))return;const Ee=oe.getRangeAt(0).getBoundingClientRect(),je=e.article.getBoundingClientRect();x={quote:ge,top:Ee.bottom-je.top+8,left:Math.min(Math.max(Ee.left+Ee.width/2-je.left,0),Math.max(je.width,0))},G()},st=se=>{if(se.target instanceof Element){if(se.target.closest(".cowork-pill")){se.preventDefault();return}!A.contains(se.target)&&x&&(x=null,k=!1,G())}},ft=se=>{if(se.target instanceof Element&&se.target.closest(".cowork-revision-output")){se.stopPropagation();return}if(se.key==="Escape"){x||k?(x=null,k=!1,G()):(L||F||q)&&(L=!1,F=!1,q=null,U());return}const oe=se.target;se.key==="Enter"&&!se.shiftKey&&oe instanceof HTMLTextAreaElement&&oe.classList.contains("cowork-composer-input")&&(se.preventDefault(),Dt()),se.key==="Enter"&&oe instanceof HTMLInputElement&&oe.name==="prompt"&&(se.preventDefault(),we())},Dt=()=>{const se=A.querySelector(".cowork-composer-input")?.value.trim()??"";x&&It(x.quote,se)},Gt=se=>{if(!(se.target instanceof Element))return;const oe=se.target.closest(".cowork-revision-output");oe&&se.stopPropagation();const ge=se.target.closest('[data-action="copy-code"]');if(ge){const at=ge.closest("pre")?.getAttribute("data-code");if(!at)return;Ore(ge,at);return}if(oe)return;const Ee=se.target.closest("[data-cowork-action]");if(!Ee)return;const je=Ee.dataset.coworkAction;if(je==="comment"&&(k=!0,G()),je==="cancel-comment"&&(x=null,k=!1,G()),je==="add-comment"&&Dt(),je==="toggle-panel"&&(L=!L,F=!1,U()),je==="toggle-config"&&(F=!F,L=!1,U()),je==="toggle-revision"){S=!S;const at=Ee.closest(".cowork-revision-stream");at?.classList.toggle("is-collapsed",S),Ee.setAttribute("aria-expanded",String(!S)),Ee.setAttribute("aria-label",S?Mi()("codex.cowork.expandStream"):Mi()("codex.cowork.collapseStream")),at?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(S))}if(je==="send"&&we(),je==="cancel-run"&&I&&N&&!N.submitted){N.cancelled=!0,I=!1,$=!1,w="stopped",d=d.map(at=>at.status==="sent"?{...at,status:"pending"}:at),U(),mt();return}je==="toggle-diff"&&(T=!T,Ot()),je==="delete-annotation"&&Ee.dataset.annotationId&&Ke(Ee.dataset.annotationId),je==="apply-arm"&&(q="apply",U()),je==="discard-arm"&&(q="discard",U()),je==="confirm-back"&&(q=null,U()),je==="apply-confirm"&&n&&(q=null,de(()=>sre(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),je==="discard-confirm"&&De(),je==="cancel-run"&&n&&de(()=>rre(e.theaterId,n.id)).then(()=>{w="stopped",d=d.map(at=>at.status==="sent"?{...at,status:"pending"}:at),U()}).catch(()=>{})},_t=se=>{const oe=se.target instanceof Element?se.target.closest("mark.cowork-mark"):null;oe?Nt(oe):C.hidden||(C.hidden=!0)},Tt=()=>{C.hidden=!0},Ne=se=>{const oe=se.target;if(oe instanceof Element&&oe.closest(".cowork-revision-output")){se.stopPropagation();return}if(oe instanceof HTMLInputElement&&oe.name==="prompt"){V=oe.value;return}if(oe instanceof HTMLTextAreaElement&&oe.dataset.coworkComment){const ge=oe.dataset.coworkComment;d=d.map(Ee=>Ee.id===ge?{...Ee,comment:oe.value,status:"pending"}:Ee)}},jt=se=>{const oe=se.target;if(oe instanceof Element&&oe.closest(".cowork-revision-output")){se.stopPropagation();return}oe instanceof HTMLTextAreaElement&&oe.dataset.coworkComment&&en().catch(()=>{})};return e.article.addEventListener("mouseup",Pe),e.article.addEventListener("mousedown",st),e.article.addEventListener("keydown",ft),e.article.addEventListener("click",Gt),e.article.addEventListener("input",Ne),e.article.addEventListener("change",jt),e.article.addEventListener("mouseover",_t),e.article.addEventListener("mouseleave",Tt),{destroy(){t=!0,ne(),z(),i?.(),e.article.removeEventListener("mouseup",Pe),e.article.removeEventListener("mousedown",st),e.article.removeEventListener("keydown",ft),e.article.removeEventListener("click",Gt),e.article.removeEventListener("input",Ne),e.article.removeEventListener("change",jt),e.article.removeEventListener("mouseover",_t),e.article.removeEventListener("mouseleave",Tt),A.remove(),O.remove(),C.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Ore(e,t){const n=navigator.clipboard;if(!n)return;let i;try{i=n.writeText(t)}catch{return}const s=e.textContent;i.then(()=>{e.isConnected&&(e.textContent=Mi()("codex.cowork.copied"),window.setTimeout(()=>{e.isConnected&&(e.textContent=s)},1200))}).catch(()=>{})}function Ire(e,t){return Are(e,t).map(n=>{const i=es(n.markdown,{resolveWikiLink:s=>km(s),...cl(Mi())}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function d5(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||Mi()("codex.cowork.defaultComment")}}function Dre(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function Mv(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function h5(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function jre(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Bre(){try{const e=JSON.parse(localStorage.getItem(iI)??"{}");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 Lv(e){try{localStorage.setItem(iI,JSON.stringify(e))}catch{}}function rI(){const e=Yi().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return hr(e,t)}function Li(){return fr(rI())}function Pre(){return rI()}const sI={create_wiki:"+",update_wiki:"↻"};function aI(e,t){return t(e==="create_wiki"?"codex.reading.opCreate":e==="update_wiki"?"codex.reading.opUpdate":"codex.reading.opPatch")}function zre(e,t){let n=!1,i=0,s=null,o=null,l=t,d=t.kind==="entry"?t.initialEntryId:"",f=t.subId,p="idle",m=null,y=null,b=null;Jd(e,nb(Li()));function w(I){const N=I.target;if(!(N instanceof Element))return;const V=N.closest("[data-patch-id]");if(V){I.preventDefault();const Y=V.dataset.patchId||void 0;l.onPatchOpen?.(Y);return}const K=N.closest("[data-entry-id]");if(K?.dataset.entryId){I.preventDefault(),l.onRelatedClick(K.dataset.entryId);return}const Q=N.closest("[data-drydock-action]");if(Q){I.preventDefault(),S(Q.dataset.drydockAction);return}}function S(I){if(I){if(I==="back"){l.onPatchOpen?.(void 0);return}if(I==="approve"){p="approving",m=null,k();return}if(I==="approve-confirm"){x("approve",void 0);return}if(I==="reject"){p="rejecting",m=null,k();return}if(I==="reject-submit"){const N=e.querySelector("#queue-reject-reason")?.value.trim();if(!N){m=Li()("codex.reading.rejectReasonRequired"),k();return}x("reject",N);return}if(I==="cancel"){p="idle",m=null,k();return}}}async function x(I,N){if(b){p="submitting",m=null,k();try{await Zie(l.theaterId,b,I,N),l.onDecided?.()}catch(V){p=I==="approve"?"approving":"rejecting",m=V instanceof Error?V.message:String(V),k()}}}function k(){const I=e.querySelector("[data-decision-bar-wrap]");I&&(I.innerHTML=oI(p,m))}e.addEventListener("click",w);function L(){o?.destroy(),o=null,s?.(),s=null}async function F(I){if(!n){Jf(e,t.tocContainer),L();try{const N=await Kie(l.theaterId,I);if(n)return;const{index:V}=el(),K=Li(),{html:Q,toc:Y}=es(N.body,{omitDuplicateTitle:N.frontmatter.title,resolveWikiLink:D=>km(D),...cl(K)});e.innerHTML=`
327
+ <article class="document">
328
+ <header class="document-header">
329
+ ${$re(N.frontmatter.title)}
330
+ <h1>${He(N.frontmatter.title)}</h1>
331
+ ${vre(N.frontmatter)}
332
+ </header>
333
+ <div class="markdown-body" id="codex-reader-body">
334
+ ${Q}
335
+ </div>
336
+ ${Fre(N.frontmatter.id,N.frontmatter.tags,V)}
337
+ </article>
338
+ `,t.tocContainer.innerHTML=Tv(Y);const B=e.querySelector("article");B&&Y.length>0&&(s=o5(B,Y,t.tocContainer));const M=e.querySelector("#codex-reader-body");B&&M&&(o=Nre({theaterId:l.theaterId,entryId:I,title:N.frontmatter.title,article:B,body:M,onApplied:()=>{F(I)}}))}catch(N){n||Qf(e,t.tocContainer,N)}}}async function q(I){if(!n){Jf(e,t.tocContainer),L(),y=null,b=null,p="idle",m=null;try{if(I){const N=await Vie(l.theaterId,I);if(n)return;y=N.meta,b=I;const V=Li(),{html:K,toc:Q}=es(N.wikiEntry.body,{omitDuplicateTitle:N.wikiEntry.title,resolveWikiLink:B=>km(B),...cl(V)});e.innerHTML=Wre(N,K),t.tocContainer.innerHTML=Tv(Q);const Y=e.querySelector("article");Y&&Q.length>0&&(s=o5(Y,Q,t.tocContainer))}else{const N=await YO(l.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Hre(N.items,Li()("codex.reading.reviewQueuePending"))}}catch(N){n||Qf(e,t.tocContainer,N)}}}async function T(I){if(!n){Jf(e,t.tocContainer),L();try{if(I){const N=await Qie(l.theaterId,I);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Kre(N)}else{const N=await Jie(l.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Vre(N)}}catch(N){n||Qf(e,t.tocContainer,N)}}}async function $(I){const N=++i,V=l.theaterId;Jf(e,t.tocContainer),L();try{const K=await Xie(V,I);if(n||N!==i||V!==l.theaterId)return;const Q=Li(),{html:Y,toc:B}=es(K.content,cl(Q)),M=I??Q("codex.reading.workspaceSchema");e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>${He(Q("codex.reading.schema"))}</span></li><li><span aria-current="page">${He(M)}</span></li></ol></nav><h1>${He(M)}</h1><span class="queue-dl-mono">${He(K.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${Y}</div></article>`,t.tocContainer.innerHTML=Tv(B)}catch(K){!n&&N===i&&V===l.theaterId&&Qf(e,t.tocContainer,K)}}return t.kind==="entry"&&t.initialEntryId?F(t.initialEntryId):t.kind==="drydock"?q(t.subId):t.kind==="conflicts"?T(t.subId):t.kind==="schema"&&$(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",w),L(),o?.destroy()},async setEntry(I){d=I,await F(I)},async navigateSub(I){f=I,t.kind==="drydock"?await q(I):t.kind==="conflicts"?await T(I):t.kind==="schema"&&await $(I)},refreshCallbacks(I){l={...l,...I}},async refreshLocale(){if(n)return;const I=e.parentElement,N=I?.scrollTop??0;Jd(e,nb(Li())),t.kind==="entry"&&d?await F(d):t.kind==="drydock"?await q(f):t.kind==="conflicts"?await T(f):t.kind==="schema"&&await $(f),I&&requestAnimationFrame(()=>{I.scrollTop=N})}}}function Jf(e,t){e.innerHTML=`<div class="codex-reader-loading" aria-live="polite" aria-busy="true">${He(Li()("common.loading"))}</div>`,t.innerHTML=""}function Qf(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${He(i)}</div>`,t.innerHTML=""}function $re(e){const t=Li();return`
339
+ <nav class="breadcrumb" aria-label="${Zt(t("codex.reading.entryLocationAria"))}">
340
+ <ol>
341
+ <li><span>Codex</span></li>
342
+ <li><span aria-current="page">${He(e)}</span></li>
343
+ </ol>
344
+ </nav>
345
+ `}function Fre(e,t,n){const i=new Set(t),s=n.filter(l=>l.id!==e).map(l=>({entry:l,matchingTags:l.tags.filter(d=>i.has(d))})).filter(l=>l.matchingTags.length>0).sort((l,d)=>d.matchingTags.length-l.matchingTags.length||l.entry.title.localeCompare(d.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);if(s.length===0)return"";const o=Li();return`
346
+ <section class="related-list">
347
+ <h2>${He(o("codex.reading.relatedEntries"))}</h2>
348
+ <div class="related-items">
349
+ ${s.map(l=>`<button class="related-card" type="button" data-entry-id="${Zt(l.entry.id)}">
350
+ <strong>${He(l.entry.title)}</strong>
351
+ <span>${tI(l.matchingTags)}</span>
352
+ </button>`).join("")}
353
+ </div>
354
+ </section>
355
+ `}function Hre(e,t){const n=Li();return e.length===0?`<div class="codex-reader-empty"><p class="queue-empty">${He(n("codex.reading.noPendingPatches"))}</p></div>`:`
356
+ <article class="document">
357
+ <header class="document-header">
358
+ <nav class="breadcrumb" aria-label="${Zt(n("codex.reading.entryLocationAria"))}">
359
+ <ol>
360
+ <li><span>Codex</span></li>
361
+ <li><span aria-current="page">${He(n("codex.reading.reviewQueue"))}</span></li>
362
+ </ol>
363
+ </nav>
364
+ <h1>${He(t)}</h1>
365
+ </header>
366
+ <div class="queue-row-list">
367
+ ${e.map(Ure).join("")}
368
+ </div>
369
+ </article>
370
+ `}function Ure(e){const t=Li(),n=e.op??"create_wiki",i=sI[n]??"?",s=aI(n,t),o=e.target??e.id,l=new Date(e.meta.createdAt).getTime(),f=[Number.isNaN(l)?"":jR(l,Pre())].filter(Boolean);return`
371
+ <button class="queue-row" type="button" data-patch-id="${Zt(e.id)}" aria-label="${Zt(s+": "+o)}">
372
+ <span class="queue-row-badge" aria-hidden="true">
373
+ <span class="op-badge">${i}</span>
374
+ </span>
375
+ <span class="queue-row-body">
376
+ <span class="queue-row-target">${He(o)}</span>
377
+ ${e.summary?`<span class="queue-row-summary">${He(e.summary)}</span>`:""}
378
+ ${f.length>0?`<span class="queue-row-meta">${f.map(He).join(" · ")}</span>`:""}
379
+ </span>
380
+ </button>
381
+ `}function Wre(e,t){const n=Li(),{patch:i,meta:s,wikiEntry:o,targetExists:l}=e,d=i.frontmatter.op,f=sI[d]??"?",p=aI(d,n),m=n(l?"codex.reading.replaceExisting":"codex.reading.createNew"),y=s.status==="pending";return`
382
+ <article class="document">
383
+ <header class="document-header">
384
+ <nav class="breadcrumb" aria-label="${Zt(n("codex.reading.entryLocationAria"))}">
385
+ <ol>
386
+ <li><span>Codex</span></li>
387
+ <li><span>${He(n("codex.reading.reviewQueue"))}</span></li>
388
+ <li><span aria-current="page">${He(p)}</span></li>
389
+ </ol>
390
+ </nav>
391
+ <button type="button" class="queue-back-btn" data-drydock-action="back">${He(n("codex.reading.backQueue"))}</button>
392
+ <h1><span class="op-badge">${f}</span> ${He(o.title)}</h1>
393
+ <p class="eyebrow">${He(i.frontmatter.target)} · v${o.version} · ${He(m)}</p>
394
+ ${qre(i.frontmatter.proposer,o.tags)}
395
+ </header>
396
+ <div class="markdown-body" id="codex-reader-body">
397
+ ${t}
398
+ </div>
399
+ <div class="queue-decision-section" data-decision-bar-wrap>
400
+ ${y?oI("idle",null):Gre(s)}
401
+ </div>
402
+ </article>
403
+ `}function qre(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${He(e)}</span>`),t.length>0&&n.push(tI(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function oI(e,t){const n=Li();return e==="submitting"?`<span class="queue-action-spinner" role="status" aria-label="${Zt(n("codex.reading.processingAria"))}"></span>`:e==="approving"?`
404
+ <p class="queue-decision-confirm">${He(n("codex.reading.applyConfirm"))}</p>
405
+ <div class="queue-action-buttons">
406
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">${He(n("codex.reading.yesApprove"))}</button>
407
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">${He(n("common.cancel"))}</button>
408
+ </div>
409
+ ${t?`<p class="queue-action-error">${He(t)}</p>`:""}
410
+ `:e==="rejecting"?`
411
+ <div class="queue-reject-form">
412
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="${Zt(n("codex.reading.rejectPlaceholder"))}" rows="3"></textarea>
413
+ <div class="queue-action-buttons">
414
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">${He(n("codex.reading.submitRejection"))}</button>
415
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">${He(n("common.cancel"))}</button>
416
+ </div>
417
+ ${t?`<p class="queue-action-error">${He(t)}</p>`:""}
418
+ </div>
419
+ `:`
420
+ <div class="queue-action-buttons">
421
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">${He(n("codex.reading.approve"))}</button>
422
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">${He(n("codex.reading.reject"))}</button>
423
+ </div>
424
+ `}function Gre(e){const t=Li(),n=e.status==="accepted",i=t(n?"codex.reading.approved":"codex.reading.rejected"),s=n?"queue-decision-decided--approve":"queue-decision-decided--reject",o=e.reason?` · ${He(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${He(i)}${o}</p>`}function Kre(e){const t=Li(),n=e.meta?.status??t("codex.reading.conflictOpen");return`
425
+ <article class="document">
426
+ <header class="document-header">
427
+ <nav class="breadcrumb" aria-label="${Zt(t("codex.reading.entryLocationAria"))}">
428
+ <ol><li><span>Codex</span></li><li><span>${He(t("codex.reading.conflicts"))}</span></li></ol>
429
+ </nav>
430
+ <h1>${He(e.id)}</h1>
431
+ <p class="eyebrow">${He(t("codex.reading.conflictEyebrow",{status:n}))}</p>
432
+ </header>
433
+ <div class="markdown-body">
434
+ ${e.current?`<h2>${He(t("codex.reading.current"))}</h2><pre><code>${He(e.current)}</code></pre>`:""}
435
+ ${e.proposed?`<h2>${He(t("codex.reading.proposed"))}</h2><pre><code>${He(e.proposed)}</code></pre>`:""}
436
+ </div>
437
+ </article>
438
+ `}function Vre(e){const t=Li();return e.length===0?`<div class="codex-reader-empty"><p>${He(t("codex.reading.noConflicts"))}</p></div>`:`
439
+ <article class="document">
440
+ <header class="document-header">
441
+ <h1>${He(t("codex.reading.conflicts"))}</h1>
442
+ </header>
443
+ <div class="markdown-body">
444
+ <ul class="queue-list">
445
+ ${e.map(n=>`<li class="queue-item">
446
+ <strong>${He(n.title||n.id)}</strong>
447
+ <span class="eyebrow">${He(n.status)}</span>
448
+ </li>`).join("")}
449
+ </ul>
450
+ </div>
451
+ </article>
452
+ `}let rl=null,qc=null,lI=null,go=null,sl=null,ya=null,Ep=null,Nv=null,Ap,iw=0;function f5(e){lI=e}function Yre(e,t){const n=Qre();n.parentElement!==e&&e.appendChild(n),qc||(qc=_re(n,{initialTheaterId:t,onRequest:i=>lI?.(i)}))}function Xre(e){qc?.setTheater(e)}function Zre(){qc?.refreshLocale(),ya?.refreshLocale()}function cI(e,t,n){const i=ese(),s=tse(),o=i.parentElement,l=n.kind==="entry"&&Ep==="entry"&&n.initialEntryId===Nv;o&&o!==e&&(iw=o.scrollTop),i.parentElement!==e&&e.appendChild(i),s.parentElement!==t&&t.appendChild(s),!ya||Ep!==n.kind?(ya?.destroy(),ya=zre(i,{...n,tocContainer:s}),Ep=n.kind,Ap=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==Nv?ya.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==Ap&&(Ap=n.subId,ya.navigateSub(n.subId)),Nv=n.kind==="entry"?n.initialEntryId??null:null,ya.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=l?iw:0;requestAnimationFrame(()=>{e.scrollTop=d})}function Jre(){const e=go?.parentElement;e&&(iw=e.scrollTop)}function uI(){ya?.destroy(),ya=null,Ep=null,Ap=void 0,go?.parentElement&&go.parentElement.removeChild(go),sl?.parentElement&&sl.parentElement.removeChild(sl)}function p5(){uI(),qc?.destroy(),qc=null,rl?.parentElement&&rl.parentElement.removeChild(rl)}function Qre(){return rl||(rl=document.createElement("div"),rl.className="codex-host"),rl}function ese(){return go||(go=document.createElement("div"),go.className="codex-reader-host"),go}function tse(){return sl||(sl=document.createElement("div"),sl.className="codex-toc-host"),sl}const nse={id:"codex",title:e=>fr(e)("rail.codex.title"),defaultWidth:420,icon:()=>u.jsx(ose,{}),render:e=>u.jsx(ise,{theaterId:e.theaterId})};function ise({theaterId:e}){const t=rt(),n=Im(),i=ps(),s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),d=_.useRef(""),f=_.useRef(n),[p,m]=_.useState(null),y=i.codexReader,b=y!==null,w=i.codexReaderExpanded,S=i.theaters.find(T=>T.id===i.activeTheaterId)??null,x=i.theaters.length>0,k=e??"",L=p?.contextKey===k&&p.hasWiki?p.id:null,F=L!==null,q=y?`${y.kind}:${y.kind==="entry"?y.entryId:y.kind==="drydock"?y.patchId??"":y.kind==="conflicts"?y.id??"":y.templateId??""}`:null;return _.useEffect(()=>{if(d.current=k,g_(),!e){m({contextKey:k,hasWiki:!1,id:null});return}sse(e).then(T=>{d.current===k&&m({contextKey:k,...T})}).catch(()=>{d.current===k&&m({contextKey:k,hasWiki:!1,id:null})})},[k,e]),_.useEffect(()=>{p?.contextKey===k&&!p.hasWiki&&p5()},[k,p]),_.useEffect(()=>()=>p5(),[]),_.useEffect(()=>{if(!F||!L)return;const T=s.current;if(T)return Yre(T,L),f5($=>{$.kind==="entry"?Ts({kind:"entry",entryId:$.id}):$.kind==="drydock"?Ts({kind:"drydock",patchId:$.patchId}):$.kind==="conflicts"?Ts({kind:"conflicts",id:$.id}):$.kind==="schema"&&Ts({kind:"schema",templateId:$.templateId})}),()=>{f5(null)}},[F,L,b,n]),_.useEffect(()=>{F&&L&&Xre(L)},[F,L]),_.useEffect(()=>{if(!F||!L||!b||w||!o.current||!l.current||!y)return;const T=y.kind,$=T==="drydock"?y.patchId:T==="conflicts"?y.id:T==="schema"?y.templateId:void 0;cI(o.current,l.current,{initialEntryId:T==="entry"?y.entryId:"",kind:T,subId:$,theaterId:L,onRelatedClick:I=>Ts({kind:"entry",entryId:I}),onClose:()=>g_(),onPatchOpen:I=>Ts({kind:"drydock",patchId:I}),onDecided:()=>{Cm(),Ts({kind:"drydock",patchId:void 0})}})},[F,L,b,w,q,n]),_.useEffect(()=>{f.current!==n&&(f.current=n,Zre())},[n]),_.useEffect(()=>{b||uI()},[b]),F?b?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":t("rail.codex.expandAria"),"data-codex-expand":"true",onClick:sp,children:t("rail.codex.expand")}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":t("rail.codex.closePaneAria"),onClick:g_,children:"✕"})]}),u.jsx("div",{ref:o,className:"codex-doc-scroll"}),u.jsx("div",{ref:l,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:s,className:"codex-nav-pane"})]}):u.jsx("div",{ref:s,className:"codex-rail-host"}):u.jsx(rse,{activeTheater:S,hasTheaters:x})}function rse({activeTheater:e,hasTheaters:t}){const n=rt();return t?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:n("rail.codex.unavailable")}),u.jsx("h1",{children:e?.label||n("rail.codex.thisTheater")}),u.jsx("p",{children:n("rail.codex.wikiUnavailable")})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:n("rail.codex.emptyEyebrow")}),u.jsx("h1",{children:n("rail.codex.addTheater")}),u.jsx("p",{children:n("rail.codex.addTheaterHint")})]})}async function sse(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 ase(await t.json())}function ase(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 ose(){return u.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),u.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),u.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function lse(e,t,n){const i=t.trim().toLocaleLowerCase();return e.filter(s=>i===""||s.name.toLocaleLowerCase().includes(i)||s.title.toLocaleLowerCase().includes(i)?n==="all"?!0:s.tasksTotal<=0?!1:n==="complete"?s.tasksDone>=s.tasksTotal:s.tasksDone<s.tasksTotal:!1)}function cse(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function rw(e){return e.replace(/\s+/g," ").trim()}function use(e,t){const n=i=>rw(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function dI(e,t,n=Date.now()){const i=Date.parse(e);return Number.isFinite(i)?jR(i,t,n):fr(t)("common.unknown")}function dse(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 hse(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function fse(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function pse(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(fse)?"ready":"blocked"}const mse="plans-changed",gse=3e4;function yse(e,t){let n=null,i=null,s=!1,o=!0;const l=()=>{const d=o;o=!1;let f=0;n=new EventSource(`/api/v1/plans/events?theaterId=${encodeURIComponent(e)}`),n.addEventListener(mse,()=>{t()}),n.onopen=()=>{f+=1,d&&f===1||t()},n.onerror=()=>{n?.readyState!==EventSource.CLOSED||i!==null||(s||t(),i=setTimeout(()=>{i=null,s||l()},gse))}};return l(),()=>{s=!0,i!==null&&clearTimeout(i),n?.close()}}const sw=new Set;let _se=0,Em=null;function vse(e,t){Em={theaterId:e,name:t,requestId:++_se},hI()}function bse(e){Em?.requestId===e.requestId&&(Em=null,hI())}function wse(){return _.useSyncExternalStore(Sse,m5,m5)}function Sse(e){return sw.add(e),()=>{sw.delete(e)}}function m5(){return Em}function hI(){for(const e of sw)e()}const xse=360,Cse={id:"plans",title:e=>fr(e)("rail.plans.title"),defaultWidth:360,icon:Mse,render:e=>u.jsx(kse,{...e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>(await Qj(t,e,n,i)).plans.map(o=>({id:o.name,title:o.title,subtitle:o.name,activate:()=>vse(t,o.name)}))};function kse(e){const t=e.theaterId;return u.jsx(Ese,{...e},t)}function Ese(e){const{requestExtraWidth:t,theaterId:n}=e,i=e.language??"en",[s,o]=_.useState({kind:"no-theater"}),[l,d]=_.useState({kind:"loading"}),[f,p]=_.useState(null),[m,y]=_.useState(0),[b,w]=_.useState(0),[S,x]=_.useState(()=>new Set),[k,L]=_.useState(null),F=wse(),q=_.useRef(0),T=_.useRef(0),$=_.useRef(null),I=_.useRef(l),N=_.useRef(null),V=_.useRef(!1),K=_.useRef(!1),Q=_.useRef(!1),Y=_.useRef(null),B=_.useRef(null),M=f?.theaterId===n?f.name:null;_.useEffect(()=>{!F||F.theaterId!==n||!n||(p({theaterId:n,name:F.name}),L(F))},[F,n]),_.useEffect(()=>{Y.current=M},[M]),_.useEffect(()=>{const P=++q.current;if(!n){o({kind:"no-theater"});return}const R=$.current!==null,W=Q.current;Q.current=!1,R||o({kind:"loading"}),Zj(n).then(G=>{if(P!==q.current)return;const U=new Map(G.plans.map(me=>[me.name,cse(me)])),ee=$.current;if(ee){const me=new Set(G.plans.filter(Me=>ee.get(Me.name)!==U.get(Me.name)).map(Me=>Me.name));me.size>0&&(B.current&&clearTimeout(B.current),x(me),B.current=setTimeout(()=>x(new Set),1200))}$.current=U,o({kind:"ready",plans:G.plans});const ne=Y.current;ne&&(U.has(ne)?U.get(ne)!==N.current&&w(me=>me+1):(N.current!==null||!V.current)&&(N.current=null,K.current=!0,w(me=>me+1)))}).catch(()=>{P===q.current&&(!R||W)&&o({kind:"error"})})},[n,m]),_.useEffect(()=>{const P=++T.current;if(!n||!M)return;V.current=!0,N.current=$.current?.get(M)??null;const R=K.current;K.current=!1,!R&&I.current.kind==="ready"&&I.current.plan.name===M||(I.current={kind:"loading"},d({kind:"loading"})),Jj(n,M).then(G=>{if(P===T.current){V.current=!1,N.current=$.current?.get(G.name)??null;const U={kind:"ready",plan:G};I.current=U,d(U)}}).catch(()=>{P===T.current&&(V.current=!1,N.current=null,I.current={kind:"error"},d({kind:"error"}))})},[b,M,n]),_.useEffect(()=>{if(n)return yse(n,()=>{y(P=>P+1)})},[n]),_.useEffect(()=>()=>{B.current&&clearTimeout(B.current)},[]),_.useLayoutEffect(()=>(t?.(M?xse:null),()=>t?.(null)),[t,M]);const D=_.useCallback(P=>{n&&p({theaterId:n,name:P})},[n]),j=_.useCallback(P=>{bse(P),L(R=>R?.requestId===P.requestId?null:R)},[]),A=_.useCallback(()=>{p(null),V.current=!1,N.current=null,I.current={kind:"loading"},d({kind:"loading"})},[]),C=_.useCallback(()=>{Q.current=!0,y(P=>P+1)},[]),z=_.useCallback(()=>w(P=>P+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${M?" is-reader-open":""}`,onKeyDown:P=>{P.key==="Escape"&&M&&A()},children:[M&&u.jsx(Tse,{state:l,language:i,onClose:A,onRetry:z}),M&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(Ase,{revealTarget:k,selectedName:M,state:s,language:i,onRetry:C,onRevealHandled:j,onSelect:D,pulsedNames:S})]})})}function Ase({revealTarget:e,selectedName:t,state:n,language:i,onRetry:s,onRevealHandled:o,onSelect:l,pulsedNames:d}){const f=rt(),[p,m]=_.useState(""),[y,b]=_.useState("all"),[w,S]=_.useState(null),x=_.useRef(new Map);if(_.useLayoutEffect(()=>{if(!(!e||n.kind==="loading")){if(n.kind!=="ready"){o(e);return}if(p!==""||y!=="all"){m(""),b("all");return}x.current.get(e.name)?.scrollIntoView({block:"nearest"}),o(e)}},[o,p,e,n,y]),n.kind==="no-theater")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Ov,{children:f("rail.plans.selectTheater")})});if(n.kind==="loading")return u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-loading",children:f("rail.plans.loadingList")})});if(n.kind==="error")return u.jsx("div",{className:"plans-list-pane",children:u.jsx(fI,{message:f("rail.plans.loadListError"),onRetry:s})});if(n.plans.length===0)return u.jsx("div",{className:"plans-list-pane",children:u.jsx(Ov,{detail:f("rail.plans.emptyDetail"),children:f("rail.plans.empty")})});const k=lse(n.plans,p,y),L=(T,$)=>{const I=(T+$+k.length)%k.length;x.current.get(k[I]?.name??"")?.focus()},F=(T,$)=>{(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),L($,T.key==="ArrowDown"?1:-1))},q=(T,$)=>{T.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${$}`).then(()=>{S($),window.setTimeout(()=>S(I=>I===$?null:I),1200)}).catch(()=>{})};return u.jsxs("div",{className:"plans-list-pane",children:[u.jsxs("div",{className:"plans-toolbar",children:[u.jsxs("label",{className:"plans-search-label",children:[u.jsx("span",{children:f("rail.plans.search")}),u.jsx("input",{className:"plans-search",value:p,onChange:T=>m(T.target.value)})]}),u.jsx("div",{className:"plans-filter-group","aria-label":f("rail.plans.statusAria"),children:["all","in-progress","complete"].map(T=>u.jsx("button",{type:"button",className:`plans-filter${y===T?" is-active":""}`,"aria-pressed":y===T,onClick:()=>b(T),children:f(T==="all"?"rail.plans.filterAll":T==="in-progress"?"rail.plans.filterInProgress":"rail.plans.filterComplete")},T))}),u.jsx("button",{type:"button",className:"plans-refresh",onClick:s,children:f("rail.plans.refresh")})]}),u.jsxs("div",{className:"plans-list","aria-label":f("rail.plans.listAria"),children:[k.length===0&&u.jsx(Ov,{children:f("rail.plans.noMatch")}),k.map((T,$)=>{const I=dse(T.tasksDone,T.tasksTotal),N=I===100;return u.jsxs("div",{className:`plans-row${t===T.name?" is-selected":""}${d.has(T.name)?" is-pulsing":""}`,children:[u.jsxs("button",{ref:V=>{V?x.current.set(T.name,V):x.current.delete(T.name)},type:"button",className:"plans-row-select",onClick:()=>l(T.name),onKeyDown:V=>F(V,$),children:[u.jsx("span",{className:"plans-row-name",children:T.name}),u.jsxs("span",{className:"plans-row-meta",children:[f("rail.plans.rowMeta",{waves:T.waveCount,done:T.tasksDone,total:T.tasksTotal,relative:dI(T.updatedAt,i)}),T.executionMode==="parallel"?f("rail.plans.rowMetaParallel"):""]}),I!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":f("rail.plans.progressAria",{progress:I}),children:u.jsx("span",{className:`plans-progress-fill${N?" is-complete":""}`,style:{width:`${I}%`}})})]}),u.jsx("button",{type:"button",className:"plans-copy",onClick:V=>q(V,T.name),"aria-label":w===T.name?f("rail.plans.copiedAria",{name:T.name}):f("rail.plans.copyAria",{name:T.name}),children:w===T.name?f("rail.plans.copied"):f("rail.plans.copy")})]},T.name)})]})]})}function Tse({state:e,language:t,onClose:n,onRetry:i}){const s=rt();return e.kind==="loading"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:s("rail.plans.readerTitle")}),u.jsx(aw,{onClose:n})]}),u.jsx("div",{className:"plans-loading",children:s("rail.plans.loadingPlan")})]}):e.kind==="error"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:s("rail.plans.readerTitle")}),u.jsx(aw,{onClose:n})]}),u.jsx(fI,{message:s("rail.plans.loadPlanError"),onRetry:i})]}):u.jsx(Rse,{plan:e.plan,language:t,onClose:n})}function Rse({plan:e,language:t,onClose:n}){const i=rt(),s=_.useMemo(()=>{const p=new DOMParser().parseFromString(es(e.content,cl(i)).html,"text/html");return Iv(p.body,i),p.body.innerHTML},[e.content,i]),o=_.useRef(null),l=_.useRef(null),d=_.useCallback((p,m)=>{const y=o.current;if(!y)return;const b=[...y.querySelectorAll(p)].find(S=>p==="h3"?use(S.textContent??"",m):rw(S.textContent??"")===rw(m));if(!b)return;const w=window.matchMedia("(prefers-reduced-motion: reduce)").matches;b.scrollIntoView({behavior:w?"auto":"smooth",block:"start"}),b.classList.remove("plans-heading-flash"),b.getBoundingClientRect(),b.classList.add("plans-heading-flash"),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>b.classList.remove("plans-heading-flash"),1200)},[]),f=_.useCallback(p=>{const m=p.target.closest('[data-action="copy-code"]');if(!m)return;const y=m.closest("pre")?.getAttribute("data-code");if(!y)return;navigator.clipboard?.writeText(y);const b=m.textContent;m.textContent=i("rail.plans.codeCopied"),window.setTimeout(()=>{m.textContent=b},1200)},[i]);return _.useEffect(()=>{const p=o.current;if(!p)return;Jd(p,nb(i)),Iv(p,i);const m=new MutationObserver(()=>Iv(p,i));return m.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>m.disconnect()},[s,i]),_.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsxs("div",{className:"plans-reader-heading",children:[u.jsx("h2",{className:"plans-reader-title",children:e.title}),u.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&u.jsx("span",{className:"plans-mode-badge",children:i("rail.plans.parallelBadge")}),i("rail.plans.readerMeta",{waves:e.waves.length,done:e.tasksDone,total:e.tasksTotal,relative:dI(e.updatedAt,t)})]})]}),u.jsx(aw,{onClose:n})]}),u.jsxs("div",{className:"plans-reader-body",children:[u.jsx("div",{className:"plans-wave-strip","aria-label":i("rail.plans.waveProgressAria"),children:e.waves.map((p,m)=>{const y=hse(p.tasksDone,p.tasksTotal);return u.jsxs("div",{className:`plans-wave is-${y}`,children:[u.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>d("h2",p.heading),children:p.heading}),p.tasksTotal>0&&u.jsxs("span",{className:"plans-wave-count",children:[p.tasksDone,"/",p.tasksTotal]}),p.lanes.length>0&&u.jsx("div",{className:"plans-lane-list",children:p.lanes.map((b,w)=>{const S=pse(e.waves,m,b);return u.jsxs("div",{className:`plans-lane is-${S}`,children:[u.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>d("h3",b.heading),children:b.id??b.heading}),b.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[b.tasksDone,"/",b.tasksTotal]}),S==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:i("rail.plans.laneReady")})]},b.id??`${p.index}-${w}`)})})]},p.index)})}),u.jsx("div",{ref:o,className:"plans-markdown markdown-body",onClick:f,dangerouslySetInnerHTML:{__html:s}})]})]})}function aw({onClose:e}){const t=rt();return u.jsx("button",{className:"plans-close",type:"button","aria-label":t("rail.plans.closePlanAria"),onClick:e,children:"✕"})}function Ov({children:e,detail:t}){return u.jsxs("div",{className:"plans-empty",children:[u.jsx("span",{children:e}),t&&u.jsx("span",{className:"plans-empty-detail",children:t})]})}function fI({message:e,onRetry:t}){const n=rt();return u.jsxs("div",{className:"plans-error-state",children:[u.jsx("span",{children:e}),u.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:n("common.retry")})]})}function Iv(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(i)||(n.removeAttribute("href"),n.setAttribute("role","link"),n.setAttribute("aria-disabled","true"))}for(const n of e.querySelectorAll("img, video, audio, embed, object, iframe")){const i=n.getAttribute("alt")?.trim()||n.getAttribute("title")?.trim(),s=n.ownerDocument.createElement("span");s.className="plans-md-blocked-image",n.tagName==="IMG"?s.textContent=i?t("rail.plans.imageBlockedNamed",{label:i}):t("rail.plans.imageBlocked"):s.textContent=i?t("rail.plans.mediaBlockedNamed",{label:i}):t("rail.plans.mediaBlocked"),n.replaceWith(s)}for(const n of e.querySelectorAll("source, track"))n.removeAttribute("src"),n.removeAttribute("srcset");for(const n of e.querySelectorAll("image, feImage"))n.remove();for(const n of e.querySelectorAll("use")){const i=n.getAttribute("href")??n.getAttribute("xlink:href")??"";i!==""&&!i.startsWith("#")&&n.remove()}}function Mse(){return u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const pI=[zie,nse,Cse];function Lse(e="right"){const{railPanels:t}=Qc();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const Nse=360;function Ose(e){const{codexReader:t}=ps();return e==="codex"&&t!==null?Nse:0}const Vr=240,Ise=312,n1="fleet-console.rail.panelWidths",g5="fleet-console.rail.panelWidth";function Dse(e){return[{label:e("rail.chrome.opacitySolid"),value:100},{label:"90",value:90},{label:"75",value:75},{label:"60",value:60}]}function Am(){try{const e=localStorage.getItem(n1);if(e===null)return Object.create(null);const t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))return Object.create(null);const n=Object.create(null);for(const[i,s]of Object.entries(t))typeof s=="number"&&Number.isFinite(s)&&s>=Vr&&(n[i]=Math.round(s));return n}catch{}return Object.create(null)}function y5(e){const t=Am();if(e===null)return t;try{const n=localStorage.getItem(g5);if(n===null)return t;const i=Number(n);Number.isFinite(i)&&i>=Vr&&(t[e]=Math.round(i),localStorage.setItem(n1,JSON.stringify(t))),localStorage.removeItem(g5)}catch{}return t}function _5(e,t,n,i){const s=e===null?void 0:i[e];return s!==void 0&&s>=Vr&&s<=n?s:Math.max(Vr,Math.min(n,Math.round(t??Ise)))}function v5(e,t){if(e!==null)try{const n=Am();n[e]=Math.round(t),localStorage.setItem(n1,JSON.stringify(n))}catch{}}function jse({theaterId:e,api:t}){const n=rt(),i=n("rail.theater.fallback"),s=_.useSyncExternalStore(Iw,()=>Co().theaters.find(G=>G.id===e)?.label??i,()=>i),o=xl(),l=hr(o.state?.language??"auto"),d=_.useRef(null),f=RM(),p=MM(),m=Hz(),y=Uz(),b=_.useRef(p),w=_.useRef(m),S=Lse(),x=pI,L=[...x,...S].find(G=>G.id===f)??null,F=L?Sl(L.title,l):"",q=L!==null,T=Ose(f)+(L?.preferredExtraWidth??0)+Fz(),[$,I]=_.useState(()=>window.innerWidth),N=Math.max(Vr,Math.floor($-148-T)),V=_.useRef(T);V.current=T;const K=_.useRef(f);K.current=f;const Q=_.useRef(L===null),Y=_.useRef(L?.id??null),[B,M]=_.useState(()=>{const G=y5(L?.id??null);return _5(f,L?.defaultWidth,N,G)}),D=_.useRef(B),j=_.useRef(B),[A,O]=_.useState(!1),[C,z]=_.useState(!1);_.useLayoutEffect(()=>{const G=()=>{const U=window.innerWidth;I(ee=>ee===U?ee:U)};return window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[]),_.useLayoutEffect(()=>{const G=L?.id??null;if(Y.current===G){if(A||L===null||f===null)return;const me=Am()[f];if(me===void 0||me>N||me===D.current)return;D.current=me,j.current=me,M(me);return}Y.current=G;const U=L!==null,ee=Q.current&&U?y5(f):Am();U&&(Q.current=!1);const ne=_5(f,L?.defaultWidth,N,ee);D.current=ne,j.current=ne,M(ne)},[f,L?.id,L?.defaultWidth,A,N]),_.useLayoutEffect(()=>{const G=A?j.current:D.current,U=Math.max(Vr,Math.min(N,G));U!==j.current&&(j.current=U,M(U))},[A,N]),_.useLayoutEffect(()=>{b.current&&!p&&QR(d.current,".command-band-rail-toggle"),b.current=p},[p]),_.useLayoutEffect(()=>{if(w.current===m)return;w.current=m,z(!0);let G=null;const U=window.requestAnimationFrame(()=>{G=window.requestAnimationFrame(()=>z(!1))});return()=>{window.cancelAnimationFrame(U),G!==null&&window.cancelAnimationFrame(G)}},[m]);const P=_.useCallback(G=>{G.preventDefault();const U=G.clientX,ee=j.current;O(!0);const ne=Me=>{const ve=U-Me.clientX,Ye=Math.max(Vr,Math.floor(window.innerWidth-148-V.current)),qe=Math.max(Vr,Math.min(Ye,Math.round(ee+ve)));j.current=qe,M(qe)},me=()=>{document.removeEventListener("pointermove",ne),document.removeEventListener("pointerup",me),D.current=j.current,O(!1),v5(K.current,D.current)};document.addEventListener("pointermove",ne),document.addEventListener("pointerup",me)},[]),R=_.useCallback(G=>{let U;const ee=G.shiftKey?64:16,ne=Math.max(Vr,Math.floor(window.innerWidth-148-V.current));switch(G.key){case"ArrowLeft":U=j.current+ee;break;case"ArrowRight":U=j.current-ee;break;case"Home":U=Vr;break;case"End":U=ne;break;default:return}G.preventDefault(),U=Math.max(Vr,Math.min(ne,Math.round(U))),D.current=U,j.current=U,M(U),v5(K.current,D.current)},[]),W=_.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:s},api:t,language:l,requestExtraWidth:G=>{f!==null&&$z(f,G)}}),[e,s,t,l,f]);return u.jsxs("div",{ref:d,className:`right-rail${q?" is-open":""}${p?" is-expanded":" is-closed"}${A?" is-dragging":""}${C?" is-switching":""}${m==="overlay"?" is-overlay":""}`,"data-rail-chrome":p?"expanded":"closed",role:"complementary","aria-label":n("rail.chrome.aria"),inert:!p,style:{"--right-rail-panel-width":`${q?B+T:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:m==="overlay"?{"--right-rail-overlay-alpha":y/100}:void 0,children:[L&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:P,onKeyDown:R,role:"separator","aria-orientation":"vertical",tabIndex:0,"aria-label":n("rail.chrome.resizePanel",{title:F}),"aria-controls":`rail-panel-${L.id}`,"aria-valuenow":Math.round(B),"aria-valuemin":Vr,"aria-valuemax":N}),L&&u.jsx(Bse,{activePanel:L,activePanelTitle:F,activeId:f,ctx:W,panelBehavior:m,overlayAlpha:y})]}),u.jsx("nav",{className:"right-rail-icons","aria-label":n("rail.chrome.toolsAria"),children:u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":n("rail.chrome.panelsAria"),children:[x.map(G=>u.jsx(b5,{panel:G,language:l,isActive:f===G.id},G.id)),x.length>0&&S.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,S.map(G=>u.jsx(b5,{panel:G,language:l,isActive:f===G.id},G.id))]})})]})}const Bse=_.memo(function({activePanel:t,activePanelTitle:n,activeId:i,ctx:s,panelBehavior:o,overlayAlpha:l}){const d=rt(),f=Dse(d);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[u.jsx("span",{className:"right-rail-panel-title",children:n}),u.jsx("button",{className:`right-rail-float-toggle${o==="overlay"?" is-active":""}`,type:"button","aria-pressed":o==="overlay","aria-label":d("rail.chrome.floatToggle"),onClick:Pz,children:d("rail.chrome.floatLabel")}),o==="overlay"?u.jsx("div",{className:"right-rail-opacity-segments",role:"group","aria-label":d("rail.chrome.opacityAria"),children:f.map(p=>{const m=p.value===l;return u.jsx("button",{className:`right-rail-opacity-segment${m?" is-active":""}`,type:"button","aria-pressed":m,onClick:()=>zz(p.value),children:p.label},p.value)})}):null,u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":d("rail.chrome.closePanel",{title:n}),onClick:jz,children:"✕"})]}),u.jsx("div",{id:`rail-panel-${t.id}`,className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:t.render(s)})]})});function b5({panel:e,language:t,isActive:n}){const i=_.useCallback(()=>Dz(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon,o=Sl(e.title,t);return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${n?" is-active":""}`,type:"button",role:"tab","aria-selected":n,"aria-label":o,title:o,onClick:i,children:s})}const Pse='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function zse(){const e=rt(),{codexReader:t,codexReaderExpanded:n,activeTheaterId:i}=ps(),s=_.useRef(null),o=_.useRef(null),l=_.useRef(null),d=t?`${t.kind}:${t.kind==="entry"?t.entryId:t.kind==="drydock"?t.patchId??"":t.kind==="conflicts"?t.id??"":t.templateId??""}`:null,f=t!==null&&n,p=_.useCallback(()=>{Jre(),hP()},[]);return _.useEffect(()=>{if(!f)return;const m=t;document.body.setAttribute("data-codex-reading","true");const y=document.querySelector(".operations-canvas"),b=document.querySelector(".operations-side-bar");y?.setAttribute("inert",""),b?.setAttribute("inert","");const w=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&$se(s.current,S)};return window.addEventListener("keydown",w,!0),()=>{window.removeEventListener("keydown",w,!0),document.body.removeAttribute("data-codex-reading"),y?.removeAttribute("inert"),b?.removeAttribute("inert");const S=m?.kind==="entry"?m.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()}},[f]),_.useEffect(()=>{if(!f||!o.current||!l.current||!t)return;const m=t.kind,y=m==="drydock"?t.patchId:m==="conflicts"?t.id:m==="schema"?t.templateId:void 0;cI(o.current,l.current,{initialEntryId:m==="entry"?t.entryId:"",kind:m,subId:y,theaterId:i,onRelatedClick:b=>{Ts({kind:"entry",entryId:b}),sp()},onClose:p,onPatchOpen:b=>{Ts({kind:"drydock",patchId:b}),sp()},onDecided:()=>{Cm(),Ts({kind:"drydock",patchId:void 0}),sp()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[f,d]),f?xa.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),u.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":e("chrome.codexReading.dialogAria"),children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:e("chrome.codexReading.eyebrow")}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":e("chrome.codexReading.closeAria"),onClick:p,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:o,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:l,className:"codex-reading-sheet-toc","aria-label":e("chrome.codexReading.onThisPage")})]})]})]}),document.body):null}function $se(e,t){if(!e)return;const n=[...e.querySelectorAll(Pse)].filter(o=>!o.closest("[inert]"));if(n.length===0)return;const i=n[0],s=n[n.length-1];t.shiftKey?document.activeElement===i&&(t.preventDefault(),s.focus()):document.activeElement===s&&(t.preventDefault(),i.focus())}const ep=eg().api,ow=560,lw=360,Tp=new Set;function Fse({state:e,claimBootPanelMinimization:t,onDeferredDeletion:n}){const i=_.useRef(null),s=dR(),o=hR(),l=Nm(),d=pR(),f=Qc(),[p,m]=_.useState([]),y=_.useMemo(()=>Hse(e).map(C=>C.id),[e.operations,e.activeTheaterId]),b=_.useRef(e),w=_.useRef(0);b.current=e,_.useEffect(()=>{vR(e.activeTheaterId)},[e.activeTheaterId]),_.useEffect(()=>{if(!e.activeTheaterId){m([]);return}C5().then(m).catch(()=>{})},[e.activeTheaterId]),_.useEffect(()=>{const C=z=>{if(!n7()||!z.altKey||z.metaKey||z.ctrlKey)return;const P=document.activeElement;if(P instanceof HTMLElement&&P.matches("input, textarea, [contenteditable='true']")&&!P.closest(".xterm"))return;if(z.code==="KeyS"&&!z.shiftKey){z.preventDefault(),z.stopImmediatePropagation(),Hp();return}if(z.code==="KeyF"&&!z.shiftKey){z.preventDefault(),z.stopImmediatePropagation(),SR();return}if(z.shiftKey||z.key!=="ArrowLeft"&&z.key!=="ArrowRight")return;const R=b.current,W=Rs(),G=R.operations.filter(me=>me.theaterId===R.activeTheaterId),U=mb()?dP(G,W.operationOrder,R.operationStatus,W.minimized,me=>R.activeTheaterId!==null&&zm(R.activeTheaterId,me,!1),Ww):cP(G,R.groups.filter(me=>me.theaterId===R.activeTheaterId),W.operationOrder,W.collapsedGroups,W.minimized);if(z.preventDefault(),z.stopImmediatePropagation(),U.length===0)return;const ee=Tr()??Os()??b.current.activeOperationId,ne=lP(U,ee,z.key==="ArrowRight"?1:-1);ne&&Dv(ne,f.operationKinds,ep,w,()=>yl(ne))};return window.addEventListener("keydown",C,!0),()=>window.removeEventListener("keydown",C,!0)},[o,l,s,f.operationKinds]),_.useEffect(()=>{for(const P of y)_R(P);if(!e.operationsHydrated||(VB(y),!e.activeTheaterId))return;const C=t(e.activeTheaterId);if(C===null)return;const z=new Set([b.current.pendingOperationFocus,Tr(),Os()].filter(P=>P!==null));yR(C.filter(P=>!z.has(P)))},[t,y,e.activeTheaterId,e.operationsHydrated]);const S=_.useCallback(C=>{const z=b.current.operations.find(U=>U.id===C);if(!z)return;const P=Rs(),R=P.operations[C]??z.geometry??Wse(z);P.operations[C]||Qv(C,R),P.minimized.includes(C)&&Q0(C),eb(C),Ki(C);const G=Use(i.current);G&&YB(C,G)},[]);_.useEffect(()=>{const C=e.pendingOperationFocus;C!==null&&(Dv(C,f.operationKinds,ep,w,()=>S(C)),tP())},[S,f.operationKinds,e.pendingOperationFocus]);const x=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(C=>C.theaterId===e.activeTheaterId);const k=_.useCallback((C,z)=>f.plugins.find(R=>R.id===C)?.renderLaunchIcon?.(z)??null,[f.plugins]),L=_.useCallback((C,z,P)=>{if(!b.current.activeTheaterId)return;const R={...w5(P),zIndex:gl()};jv(C,z,R,b.current.activeTheaterId,f.plugins)},[f.plugins]),F=_.useCallback((C,z)=>{if(!b.current.activeTheaterId)return;const P=qse(i.current),R={...w5(P),zIndex:gl()};jv(C,z,R,b.current.activeTheaterId,f.plugins)},[f.plugins]),q=_.useCallback((C,z,P)=>{b.current.activeTheaterId&&jv(C,z,P,b.current.activeTheaterId,f.plugins)},[f.plugins]),T=_.useCallback(C=>{const z=b.current.operations.find(P=>P.id===C);if(z){if(z.theaterId!==b.current.activeTheaterId){w.current+=1,yl(C);return}Dv(C,f.operationKinds,ep,w,()=>S(C))}},[S,f.operationKinds]),$=_.useCallback(C=>{b.current.activeOperationId===C&&Ki(null),$O(C),gR(C)},[]),I=_.useCallback((C,z)=>{rp(C,{accent:z}).then(()=>qi(null)).then(cr).catch(()=>{})},[]),N=_.useCallback((C,z)=>{Q5(C,z).then(()=>qi(null)).then(cr).catch(()=>{})},[]),V=_.useCallback((C,z)=>{rp(C,{groupId:z}).then(()=>qi(null)).then(cr).catch(()=>{})},[]),K=_.useCallback((C,z,P)=>{iB({theaterId:C,name:z,color:"blue"}).then(R=>P?rp(P,{groupId:R.id}).then(()=>{}):void 0).then(()=>Promise.all([qi(null).then(cr),ao().then(oo)])).catch(()=>{})},[]),Q=_.useCallback((C,z)=>{z&&h_(C,{color:z}).then(()=>ao()).then(oo).catch(()=>{})},[]),Y=_.useCallback((C,z)=>{h_(C,{name:z}).then(()=>ao()).then(oo).catch(()=>{})},[]),B=_.useCallback(C=>{const z=new Map(b.current.groups.map(R=>[R.id,R])),P=C.flatMap((R,W)=>{const G=z.get(R);return!G||G.order===W?[]:[h_(R,{order:W})]});P.length!==0&&Promise.allSettled(P).then(()=>ao()).then(oo).catch(()=>{})},[]),M=_.useCallback(C=>{const z=new Map(b.current.theaters.map(R=>[R.id,R])),P=C.flatMap((R,W)=>{const G=z.get(R);return!G||G.order===W?[]:[Yj(R,W)]});P.length!==0&&Promise.allSettled(P).then(()=>Hv(null)).then(zp).catch(()=>{})},[]),D=_.useCallback(C=>{rB(C).then(()=>Promise.all([qi(null).then(cr),ao().then(oo)])).catch(()=>{})},[]),j=_.useCallback(C=>{if(Tp.has(C))return;Tr()===C&&ts(),Tp.add(C);const z=b.current.operations.find(R=>R.id===C)?.pluginId,P=(z?f.plugins.find(R=>R.id===z):null)??null;OO(C,P).then(R=>n(R)).finally(()=>Tp.delete(C))},[n,f.plugins]),A=_.useCallback(async C=>{HR();try{const z=await J5(C),P=await Z5(z);UR(P),Hv(null).then(zp).catch(()=>{})}catch(z){ob(z instanceof Error?z.message:String(z))}},[]),O=_.useCallback(async C=>{const z=()=>Promise.all([qi(null).then(cr),ao().then(oo)]).then(()=>{}).catch(()=>{});try{const P=await eB(C);fP(C),await z(),n(P.deletion)}catch(P){ob(P instanceof Error?P.message:String(P))}},[n]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(yz,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:d,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:p,canLaunch:x,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:k,onLaunchKind:F,onClose:j,onMinimize:$,onFocus:T,onSetAccent:I,onRename:N,onSetGroupId:V,onCreateGroup:K,onSetGroupColor:Q,onRenameGroup:Y,onReorderGroups:B,onReorderTheaters:M,onUngroupAll:D,onSelectTheater:Dw,onAddTheater:A,onCancelAddTheater:eP,onForgetTheater:O}),u.jsx("div",{className:"operations-center-stage",ref:i,children:u.jsx(Aie,{state:e,catalog:p,canLaunch:x,renderKindIcon:k,onLaunchKind:L,onLaunchAtGeometry:q,onClose:j,onFocus:T,onRename:N,onSetAccent:I})}),u.jsx(jse,{theaterId:e.activeTheaterId,api:ep}),u.jsx(zse,{})]})}async function Dv(e,t,n,i,s){const o=++i.current,l=tE(),d=Tr();if(d!==null){if(d===e){Ki(e),Go(e);return}const f=Co().operations.find(b=>b.id===e),p=Rs().minimized.includes(e),m=f&&t.find(b=>b.pluginId===f.pluginId&&b.type===f.type);let y=!0;if(f&&m?.companions?.length&&m.canOpenCompanions){try{y=await m.canOpenCompanions({api:n,operation:f})}catch{y=!1}const b=Co(),w=b.operations.find(x=>x.id===e),S=!p&&Rs().minimized.includes(e);if(i.current!==o||tE()!==l||Tr()!==d||b.activeTheaterId!==f.theaterId||xw()!==f.theaterId||S||Tp.has(e)||!w||w.pluginId!==f.pluginId||w.type!==f.type||w.theaterId!==f.theaterId)return}if(f&&(!m||!m.companions?.length||!y)){if(ts(),Pp()){Rs().minimized.includes(e)&&Q0(e),eb(e),Ki(e),Go(e);return}s(),Go(e);return}Ki(e),bR(e),Go(e);return}if(Os()!==null){Ki(e),kw(e),Go(e);return}if(Pp()){Rs().minimized.includes(e)&&Q0(e),eb(e),Ki(e),Go(e);return}s(),Go(e)}function Hse(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(lb)}function Use(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Wse(e){return e.geometry??{x:0,y:0,width:ow,height:lw,zIndex:0}}function qse(e){const t=Rs(),n=e?.clientWidth??800,i=e?.clientHeight??600;return th({x:n/2,y:i/2},t.viewport)}function w5(e){return{x:e.x-ow/2,y:e.y-lw/2,width:ow,height:lw}}async function jv(e,t,n,i,s){const o=s.find(y=>y.id===e),d=eg(()=>{qi(null).then(cr).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 qi(null).then(cr).catch(()=>{}),!f)return;const p=xw()===i,m=Co().operations.some(y=>y.id===f);HB(i)===null&&(p&&m&&Os()!==null?(Ki(f),kw(f)):yl(f))}const Gse=3e4;let tp=1e3,yd=null,Bv=null,Pv=!1;function mI(){yd!==null&&(clearTimeout(yd),yd=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);Kse(i.operation)&&X8(i.operation)}catch{}}),e.addEventListener("update:available",()=>{nh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{LO(JSON.parse(n.data))}catch{OT()}}),e.onopen=()=>{tp=1e3,nh()},e.onerror=()=>{e.close(),OT(),yd=setTimeout(()=>{yd=null,tp=Math.min(tp*2,Gse),qi().then(cr).catch(()=>{}).finally(mI)},tp)}}function nh(){if(Bv){Pv=!0;return}Bv=qj(Co().activeTheaterId).then(F8).catch(()=>{}).finally(()=>{Bv=null,Pv&&(Pv=!1,nh())})}function Kse(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Vse=6e3,Yse=8e3;function Xse(){const e=ps(),t=_.useRef(new Set),n=_.useRef(null),i=Mr(),s=Qc(),o=xl(),[l,d]=_.useState([]),[f,p]=_.useState(Date.now()),m=_.useRef(l),y=_.useRef(!1);m.current=l;const b=UT(l,f),w=rt(),S=Im(),x=OR(o.state?.language??"auto");_.useEffect(()=>{document.documentElement.lang=S},[S]);const L=i.pathname.startsWith("/operations"),F=_.useMemo(()=>[...pI,...s.railPanels.filter(N=>(N.side??"right")==="right")],[s.railPanels]),q=_.useCallback(N=>n.current===null||t.current.has(N)?null:(t.current.add(N),n.current),[]);_.useEffect(()=>{const N=eg(()=>{qi().then(cr).catch(()=>{})}),V=s.plugins.map(K=>K.install?.(N)).filter(K=>typeof K=="function");return()=>{for(const K of V)K()}},[s.plugins]),_.useEffect(()=>{$8(L)},[L]),_.useEffect(()=>sz(),[]),_.useEffect(()=>{const N=new AbortController;X5(N.signal).then(Q=>{V8(Q),hE()}).catch(Q=>{N.signal.aborted||(ht({theaterError:Q instanceof Error?Q.message:String(Q)}),hE())});const V=Date.now();qi(null,N.signal).then(Q=>{n.current=Q.filter(Y=>Y.ts.createdAt<V).map(Y=>Y.id),Y8(Q)}).catch(()=>{}),ao(null,N.signal).then(oo).catch(()=>{}),nh();const K=window.setTimeout(nh,Vse);return()=>{window.clearTimeout(K),N.abort()}},[]),_.useEffect(()=>(DO({locale:x}),Zte),[x]);const T=_.useRef(null);_.useLayoutEffect(()=>{e.keyboardShortcutsOpen&&(T.current=Ote()??(document.activeElement instanceof HTMLElement?document.activeElement:null))},[e.keyboardShortcutsOpen]),_.useEffect(()=>{if(e.keyboardShortcutsOpen)return;const N=T.current;T.current=null,N?.isConnected&&N.focus()},[e.keyboardShortcutsOpen]),_.useEffect(()=>{if(l.length===0)return;const N=()=>{const K=Date.now();p(K),d(Q=>{const Y=Q.filter(B=>B.expiresAt>K);return m.current=Y,Y})};N();const V=window.setInterval(N,100);return()=>window.clearInterval(V)},[l.length]);const $=_.useCallback(N=>{!N||N.expiresAt<=Date.now()||(p(Date.now()),d(V=>{const K=Yte(V,N);return m.current=K,K}))},[]),I=_.useCallback(()=>{if(y.current)return;const N=Date.now(),V=UT(m.current,N);V&&(y.current=!0,nB(V.deletionId).then(()=>(d(K=>{const Q=K.filter(Y=>Y.deletionId!==V.deletionId);return m.current=Q,Q}),Promise.allSettled([Hv(null).then(zp),qi(null).then(cr),ao().then(oo)]))).catch(()=>{V.expiresAt<=Date.now()&&d(K=>{const Q=K.filter(Y=>Y.deletionId!==V.deletionId);return m.current=Q,Q})}).finally(()=>{y.current=!1}))},[]);return _.useEffect(()=>fne({getSideBarCollapsed:()=>Hd().collapsed,setSideBarCollapsed:fo,toggleOperationSearch:qR,toggleRailChrome:Kw,canUndoLastClose:()=>m.current.some(N=>N.expiresAt>Date.now()),undoLastClose:I}),[I]),u.jsxs("div",{className:"console-shell",children:[u.jsx(vte,{operationsViewVisible:L}),u.jsx("main",{className:"console-route-content",children:u.jsxs(uj,{children:[u.jsx(mc,{path:"/",element:u.jsx(u_,{to:"/operations",replace:!0})}),u.jsx(mc,{path:"/operations",element:u.jsx(Fse,{state:e,claimBootPanelMinimization:q,onDeferredDeletion:$})}),u.jsx(mc,{path:"/carrier-settings",element:u.jsx(u_,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),u.jsx(mc,{path:"/settings",element:u.jsx(One,{})}),u.jsx(mc,{path:"*",element:u.jsx(u_,{to:"/operations",replace:!0})})]})}),u.jsx($te,{state:e,railPanels:F,plugins:s.plugins,onDeferredDeletion:$}),e.keyboardShortcutsOpen?u.jsx(iM,{onClose:oP}):null,u.jsx(sne,{state:e}),u.jsx(Mte,{state:e}),u.jsx(HT,{open:e.connectionError!==null,tone:"error",title:w("chrome.toast.consoleLinkInterrupted"),message:e.connectionError??void 0}),u.jsx(HT,{open:b!==null,tone:"undo",title:b?.kind==="theater"?w("chrome.toast.theaterForgotten"):w("chrome.toast.operationClosed"),message:b?w("chrome.toast.secondsRemaining",{count:Xte(b,f)}):void 0,actionLabel:w("chrome.toast.undo"),onAction:I,progress:b?(b.expiresAt-f)/Yse:void 0})]})}globalThis.__fleetConsoleRuntime__={react:Rp,"react/jsx-runtime":SD,"@fleet-console/sdk/plugin/browser":HD,"@fleet-console/sdk/settings/browser":r4,"@fleet-console/sdk/operations/browser":MD,"@fleet-console/sdk/notifications/browser":a4,"@fleet-console/sdk/react/browser":l4};$c("instrument");G8();const gI=()=>{document.documentElement.classList.toggle("reduce-panel-motion",Yi().state?.reducePanelMotion===!0)};oR(gI);gI();try{const e=await rR();$c(e.theme),ab(e.uiFont),MB(e)}catch{}const Zse=await ate();mI();const S5=document.querySelector("#app");S5&&L5.createRoot(S5).render(u.jsx(_.StrictMode,{children:u.jsx(Ij,{basename:"/console",children:u.jsx(ste,{value:Zse,children:u.jsx(Xse,{})})})}));export{CG as _,Jse as a,cw as g,pn as k,jd as p};