@dotobokuri/fleet-console 1.34.0 → 1.35.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 (62) hide show
  1. package/dist/cli.mjs +23 -0
  2. package/dist/client/assets/{_baseUniq-kpxXKqaz.js → _baseUniq--isZn0gt.js} +1 -1
  3. package/dist/client/assets/{arc-Cf0soLes.js → arc-CbzUc80R.js} +1 -1
  4. package/dist/client/assets/{architectureDiagram-Q4EWVU46-DiRqbCQ7.js → architectureDiagram-Q4EWVU46-KMk7A7ht.js} +1 -1
  5. package/dist/client/assets/{blockDiagram-DXYQGD6D-DC25h3LU.js → blockDiagram-DXYQGD6D-BDIXylVL.js} +1 -1
  6. package/dist/client/assets/{c4Diagram-AHTNJAMY-BJLnKoD4.js → c4Diagram-AHTNJAMY-4BtEjWxc.js} +1 -1
  7. package/dist/client/assets/channel-DNy689Yu.js +1 -0
  8. package/dist/client/assets/{chunk-4BX2VUAB-DWUk4gCy.js → chunk-4BX2VUAB-B6P7vZc2.js} +1 -1
  9. package/dist/client/assets/{chunk-4TB4RGXK-DW4Ee9nw.js → chunk-4TB4RGXK-w5tBo1dz.js} +1 -1
  10. package/dist/client/assets/{chunk-55IACEB6-8z_Na955.js → chunk-55IACEB6-C_Bcd4uB.js} +1 -1
  11. package/dist/client/assets/{chunk-EDXVE4YY-C3Z4nalr.js → chunk-EDXVE4YY-BikIv-lO.js} +1 -1
  12. package/dist/client/assets/{chunk-FMBD7UC4-UIVDEAE7.js → chunk-FMBD7UC4-C785J70Z.js} +1 -1
  13. package/dist/client/assets/{chunk-OYMX7WX6-DpFWa4G9.js → chunk-OYMX7WX6-qhvy0Mwx.js} +1 -1
  14. package/dist/client/assets/{chunk-QZHKN3VN-BJndYOsb.js → chunk-QZHKN3VN-28VsIAWd.js} +1 -1
  15. package/dist/client/assets/{chunk-YZCP3GAM-DJcSuWBd.js → chunk-YZCP3GAM-Dj_CFH0t.js} +1 -1
  16. package/dist/client/assets/classDiagram-6PBFFD2Q-BN9_O5GO.js +1 -0
  17. package/dist/client/assets/classDiagram-v2-HSJHXN6E-BN9_O5GO.js +1 -0
  18. package/dist/client/assets/clone-CYXyhbsy.js +1 -0
  19. package/dist/client/assets/{cose-bilkent-S5V4N54A-C3m_quy1.js → cose-bilkent-S5V4N54A-CbwRTcWp.js} +1 -1
  20. package/dist/client/assets/{dagre-KV5264BT-DzDFWezD.js → dagre-KV5264BT-DmTFlNmc.js} +1 -1
  21. package/dist/client/assets/{diagram-5BDNPKRD-D3OFrOF_.js → diagram-5BDNPKRD-D5filFx0.js} +1 -1
  22. package/dist/client/assets/{diagram-G4DWMVQ6-CgCqSaI7.js → diagram-G4DWMVQ6-BstKtz5F.js} +1 -1
  23. package/dist/client/assets/{diagram-MMDJMWI5-CnJzOV_w.js → diagram-MMDJMWI5-BubZFKBf.js} +1 -1
  24. package/dist/client/assets/{diagram-TYMM5635-BrUz8pH4.js → diagram-TYMM5635-Dkt0qt66.js} +1 -1
  25. package/dist/client/assets/{erDiagram-SMLLAGMA-C1IvCMgN.js → erDiagram-SMLLAGMA-D32vcceA.js} +1 -1
  26. package/dist/client/assets/{flowDiagram-DWJPFMVM-DCrfhs19.js → flowDiagram-DWJPFMVM-8iX8d0Mm.js} +1 -1
  27. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-ChQcD1Li.js → ganttDiagram-T4ZO3ILL-DVdts0bT.js} +1 -1
  28. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-C5aEYdTT.js → gitGraphDiagram-UUTBAWPF-C36cV6di.js} +1 -1
  29. package/dist/client/assets/{graph-CpGaCv1x.js → graph-BfCG4izN.js} +1 -1
  30. package/dist/client/assets/index-0s24Vlsc.css +1 -0
  31. package/dist/client/assets/index-o0x3lJ2C.js +452 -0
  32. package/dist/client/assets/{infoDiagram-42DDH7IO-BMhiz3U-.js → infoDiagram-42DDH7IO-7hCUS4JK.js} +1 -1
  33. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-5_f4rhFk.js → ishikawaDiagram-UXIWVN3A-DYOGN_tm.js} +1 -1
  34. package/dist/client/assets/{journeyDiagram-VCZTEJTY-BHP2UyTZ.js → journeyDiagram-VCZTEJTY-C-RaUFGz.js} +1 -1
  35. package/dist/client/assets/{kanban-definition-6JOO6SKY-edTTflKa.js → kanban-definition-6JOO6SKY-7GR2tX78.js} +1 -1
  36. package/dist/client/assets/{layout-B7z9q0n7.js → layout-C9u6a9pL.js} +1 -1
  37. package/dist/client/assets/{linear-BDNnEnhj.js → linear-CoxISMQN.js} +1 -1
  38. package/dist/client/assets/{mermaid.core-DDcMYg9W.js → mermaid.core-Clx-Pww4.js} +4 -4
  39. package/dist/client/assets/{min-D6WC647e.js → min-B7iH_omx.js} +1 -1
  40. package/dist/client/assets/{mindmap-definition-QFDTVHPH-lvrJFtla.js → mindmap-definition-QFDTVHPH-BEg4jpMk.js} +1 -1
  41. package/dist/client/assets/{pieDiagram-DEJITSTG-D1h_ZTUL.js → pieDiagram-DEJITSTG-Cu-NdmIs.js} +1 -1
  42. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-DSAYqOT0.js → quadrantDiagram-34T5L4WZ-BW_7SRcp.js} +1 -1
  43. package/dist/client/assets/{requirementDiagram-MS252O5E-BtNZUJPU.js → requirementDiagram-MS252O5E-C_F2SkO4.js} +1 -1
  44. package/dist/client/assets/{sankeyDiagram-XADWPNL6-Ci2wj876.js → sankeyDiagram-XADWPNL6-B7f43JV1.js} +1 -1
  45. package/dist/client/assets/{sequenceDiagram-FGHM5R23-ES3fQi8m.js → sequenceDiagram-FGHM5R23-oARdfmhl.js} +1 -1
  46. package/dist/client/assets/{stateDiagram-FHFEXIEX-BAJV8Z8I.js → stateDiagram-FHFEXIEX-VKGucJY7.js} +1 -1
  47. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-DfRePizj.js +1 -0
  48. package/dist/client/assets/{timeline-definition-GMOUNBTQ-Bl7xwJpF.js → timeline-definition-GMOUNBTQ-DsImBBQe.js} +1 -1
  49. package/dist/client/assets/{vennDiagram-DHZGUBPP-Csv3w_qu.js → vennDiagram-DHZGUBPP-DdJLtnOA.js} +1 -1
  50. package/dist/client/assets/{wardley-RL74JXVD-CaXvusTS.js → wardley-RL74JXVD-Cn3hq_Uh.js} +1 -1
  51. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-DfKsNCHq.js → wardleyDiagram-NUSXRM2D-VZCV5eGr.js} +1 -1
  52. package/dist/client/assets/{xychartDiagram-5P7HB3ND-BmDHSI31.js → xychartDiagram-5P7HB3ND-BglQI2vQ.js} +1 -1
  53. package/dist/client/index.html +2 -2
  54. package/dist/fleet-plugins/repository/routes.mjs +4 -2
  55. package/package.json +1 -1
  56. package/dist/client/assets/channel-Deg6stWj.js +0 -1
  57. package/dist/client/assets/classDiagram-6PBFFD2Q-CpidLq53.js +0 -1
  58. package/dist/client/assets/classDiagram-v2-HSJHXN6E-CpidLq53.js +0 -1
  59. package/dist/client/assets/clone-CPyCexwP.js +0 -1
  60. package/dist/client/assets/index-DKrNZlfG.css +0 -1
  61. package/dist/client/assets/index-aW5PuGmI.js +0 -452
  62. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CiX1nm_r.js +0 -1
@@ -0,0 +1,452 @@
1
+ function kR(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 V0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function cle(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 Av={exports:{}},sd={};var kE;function $D(){if(kE)return sd;kE=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 sd.Fragment=t,sd.jsx=n,sd.jsxs=n,sd}var CE;function zD(){return CE||(CE=1,Av.exports=$D()),Av.exports}var c=zD();const FD=V0(c),HD=kR({__proto__:null,default:FD},[c]);var Tv={exports:{}},At={};var EE;function UD(){if(EE)return At;EE=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"),_=Symbol.iterator;function w(O){return O===null||typeof O!="object"?null:(O=_&&O[_]||O["@@iterator"],typeof O=="function"?O:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,k={};function C(O,W,K){this.props=O,this.context=W,this.refs=k,this.updater=K||S}C.prototype.isReactComponent={},C.prototype.setState=function(O,W){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,W,"setState")},C.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function B(){}B.prototype=C.prototype;function H(O,W,K){this.props=O,this.context=W,this.refs=k,this.updater=K||S}var T=H.prototype=new B;T.constructor=H,x(T,C.prototype),T.isPureReactComponent=!0;var $=Array.isArray;function j(){}var M={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function Y(O,W,K){var z=K.ref;return{$$typeof:e,type:O,key:W,ref:z!==void 0?z:null,props:K}}function te(O,W){return Y(O.type,W,O.props)}function J(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function P(O){var W={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(K){return W[K]})}var N=/\/+/g;function I(O,W){return typeof O=="object"&&O!==null&&O.key!=null?P(""+O.key):W.toString(36)}function D(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(j,j):(O.status="pending",O.then(function(W){O.status==="pending"&&(O.status="fulfilled",O.value=W)},function(W){O.status==="pending"&&(O.status="rejected",O.reason=W)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function E(O,W,K,z,G){var Z=typeof O;(Z==="undefined"||Z==="boolean")&&(O=null);var se=!1;if(O===null)se=!0;else switch(Z){case"bigint":case"string":case"number":se=!0;break;case"object":switch(O.$$typeof){case e:case t:se=!0;break;case m:return se=O._init,E(se(O._payload),W,K,z,G)}}if(se)return G=G(O),se=z===""?"."+I(O,0):z,$(G)?(K="",se!=null&&(K=se.replace(N,"$&/")+"/"),E(G,W,K,"",function($e){return $e})):G!=null&&(J(G)&&(G=te(G,K+(G.key==null||O&&O.key===G.key?"":(""+G.key).replace(N,"$&/")+"/")+se)),W.push(G)),1;se=0;var Se=z===""?".":z+":";if($(O))for(var pe=0;pe<O.length;pe++)z=O[pe],Z=Se+I(z,pe),se+=E(z,W,K,Z,G);else if(pe=w(O),typeof pe=="function")for(O=pe.call(O),pe=0;!(z=O.next()).done;)z=z.value,Z=Se+I(z,pe++),se+=E(z,W,K,Z,G);else if(Z==="object"){if(typeof O.then=="function")return E(D(O),W,K,z,G);throw W=String(O),Error("Objects are not valid as a React child (found: "+(W==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":W)+"). If you meant to render a collection of children, use an array instead.")}return se}function L(O,W,K){if(O==null)return O;var z=[],G=0;return E(O,z,"","",function(Z){return W.call(K,Z,G++)}),z}function R(O){if(O._status===-1){var W=O._result;W=W(),W.then(function(K){(O._status===0||O._status===-1)&&(O._status=1,O._result=K)},function(K){(O._status===0||O._status===-1)&&(O._status=2,O._result=K)}),O._status===-1&&(O._status=0,O._result=W)}if(O._status===1)return O._result.default;throw O._result}var q=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var W=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(W))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},U={map:L,forEach:function(O,W,K){L(O,function(){W.apply(this,arguments)},K)},count:function(O){var W=0;return L(O,function(){W++}),W},toArray:function(O){return L(O,function(W){return W})||[]},only:function(O){if(!J(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return At.Activity=y,At.Children=U,At.Component=C,At.Fragment=n,At.Profiler=s,At.PureComponent=H,At.StrictMode=i,At.Suspense=f,At.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,At.__COMPILER_RUNTIME={__proto__:null,c:function(O){return M.H.useMemoCache(O)}},At.cache=function(O){return function(){return O.apply(null,arguments)}},At.cacheSignal=function(){return null},At.cloneElement=function(O,W,K){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var z=x({},O.props),G=O.key;if(W!=null)for(Z in W.key!==void 0&&(G=""+W.key),W)!V.call(W,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&W.ref===void 0||(z[Z]=W[Z]);var Z=arguments.length-2;if(Z===1)z.children=K;else if(1<Z){for(var se=Array(Z),Se=0;Se<Z;Se++)se[Se]=arguments[Se+2];z.children=se}return Y(O.type,G,z)},At.createContext=function(O){return O={$$typeof:l,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:o,_context:O},O},At.createElement=function(O,W,K){var z,G={},Z=null;if(W!=null)for(z in W.key!==void 0&&(Z=""+W.key),W)V.call(W,z)&&z!=="key"&&z!=="__self"&&z!=="__source"&&(G[z]=W[z]);var se=arguments.length-2;if(se===1)G.children=K;else if(1<se){for(var Se=Array(se),pe=0;pe<se;pe++)Se[pe]=arguments[pe+2];G.children=Se}if(O&&O.defaultProps)for(z in se=O.defaultProps,se)G[z]===void 0&&(G[z]=se[z]);return Y(O,Z,G)},At.createRef=function(){return{current:null}},At.forwardRef=function(O){return{$$typeof:d,render:O}},At.isValidElement=J,At.lazy=function(O){return{$$typeof:m,_payload:{_status:-1,_result:O},_init:R}},At.memo=function(O,W){return{$$typeof:p,type:O,compare:W===void 0?null:W}},At.startTransition=function(O){var W=M.T,K={};M.T=K;try{var z=O(),G=M.S;G!==null&&G(K,z),typeof z=="object"&&z!==null&&typeof z.then=="function"&&z.then(j,q)}catch(Z){q(Z)}finally{W!==null&&K.types!==null&&(W.types=K.types),M.T=W}},At.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},At.use=function(O){return M.H.use(O)},At.useActionState=function(O,W,K){return M.H.useActionState(O,W,K)},At.useCallback=function(O,W){return M.H.useCallback(O,W)},At.useContext=function(O){return M.H.useContext(O)},At.useDebugValue=function(){},At.useDeferredValue=function(O,W){return M.H.useDeferredValue(O,W)},At.useEffect=function(O,W){return M.H.useEffect(O,W)},At.useEffectEvent=function(O){return M.H.useEffectEvent(O)},At.useId=function(){return M.H.useId()},At.useImperativeHandle=function(O,W,K){return M.H.useImperativeHandle(O,W,K)},At.useInsertionEffect=function(O,W){return M.H.useInsertionEffect(O,W)},At.useLayoutEffect=function(O,W){return M.H.useLayoutEffect(O,W)},At.useMemo=function(O,W){return M.H.useMemo(O,W)},At.useOptimistic=function(O,W){return M.H.useOptimistic(O,W)},At.useReducer=function(O,W,K){return M.H.useReducer(O,W,K)},At.useRef=function(O){return M.H.useRef(O)},At.useState=function(O){return M.H.useState(O)},At.useSyncExternalStore=function(O,W,K){return M.H.useSyncExternalStore(O,W,K)},At.useTransition=function(){return M.H.useTransition()},At.version="19.2.7",At}var AE;function Y0(){return AE||(AE=1,Tv.exports=UD()),Tv.exports}var g=Y0();const WD=V0(g),em=kR({__proto__:null,default:WD},[g]),qD="fc-operation-body";let Vi=class extends Error{status;body;constructor(t,n,i=null){super(n),this.name="ApiError",this.status=t,this.body=i}};async function CR(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new Vi(t.status,`Operation catalog request failed: ${t.status}`);const n=await t.json();return Array.isArray(n.plugins)?n.plugins.map(KD).filter(i=>i!==null):[]}function tm(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)||ER(t))throw new Vi(500,"Invalid operation response");return t}function ER(e){return mb(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function GD({children:e,className:t}){return c.jsx("div",{className:YD(qD,t),children:e})}function KD(e){if(!AR(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(VD).filter(n=>n!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function VD(e){return!AR(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 AR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mb(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>mb(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||mb(i,t))}function YD(...e){return e.filter(t=>!!t).join(" ")}const XD=Object.freeze(Object.defineProperty({__proto__:null,ApiError:Vi,OperationBody:GD,assertOperationNode:tm,fetchOperationCatalog:CR,hasForbiddenBrowserPayloadKey:ER},Symbol.toStringTag,{value:"Module"}));function ZD(e){return e}function JD(e){return e}function TR(e=()=>{}){const t=new Set;return{api:{fetch:(n,i,s)=>fetch(Rv(n,i),s).then(r4),subscribe:(n,i,s)=>{const o=new EventSource(Rv(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(Rv(n,i),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:s}),signal:o});if(!l.ok)throw new Vi(l.status,`Terminal ticket request failed: ${l.status}`);const d=await l.json();if(typeof d.ticket!="string"||typeof d.ttlMs!="number")throw new Vi(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 Vi(i.status,`Operation create failed: ${i.status}`);const s=await i.json();return tm(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 Vi(s.status,`Operation rename failed: ${s.status}`);const o=await s.json();return tm(o.operation)},remove:async n=>{const i=await fetch(`/api/v1/operations/${encodeURIComponent(n)}`,{method:"DELETE"});if(!i.ok)throw new Vi(i.status,`Operation remove failed: ${i.status}`)}},preferences:{read:(n,i)=>a4(n,i),write:(n,i)=>o4(n,i)},settings:{read:async n=>{const i=await fetch(TE(n));if(!i.ok)throw new Vi(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(TE(n),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new Vi(s.status,`Plugin settings write failed: ${s.status}`)}},status:{set:()=>{},clear:()=>{}}}}function RR(e,t){return g.useSyncExternalStore(e,t,t)}function QD(){const[e,t]=g.useState([]),n=g.useCallback(async()=>{const i=await fetch("/api/v1/operations");if(!i.ok)throw new Vi(i.status,`Operations request failed: ${i.status}`);const s=await i.json();t(Array.isArray(s.operations)?s.operations.map(tm):[])},[]);return g.useEffect(()=>{n()},[n]),{operations:e,refresh:n}}function e4(e,t){return g.useMemo(()=>({fetch:(n,i)=>e.fetch(t,n,i),subscribe:(n,i)=>e.subscribe(t,n,i)}),[e,t])}function t4(e,t){return g.useMemo(()=>({read:()=>e.read(t),write:n=>e.write(t,n)}),[e,t])}function n4(e,t,n){const[i,s]=g.useState(()=>e.read(t,n)),o=g.useCallback(l=>{s(l),e.write(t,l)},[e,t]);return[i,o]}function i4(e,t){return g.useMemo(()=>({set:n=>e.set(t,n),clear:()=>e.clear(t)}),[e,t])}async function r4(e){if(!e.ok){const t=await e.json().catch(()=>null);throw new Vi(e.status,`Plugin request failed: ${e.status}`,t)}return e}function Rv(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new Vi(400,"Invalid plugin id");const n=t.startsWith("/")?t:`/${t}`;if(n.includes(".."))throw new Vi(400,"Invalid plugin path");return`/plugins/${e}${n}`}const s4=/^[a-z0-9][a-z0-9._-]*$/;function TE(e){if(!s4.test(e))throw new Vi(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function a4(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 o4(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const l4=Object.freeze(Object.defineProperty({__proto__:null,React:em,createClientCapabilities:TR,defineOperationKind:JD,definePlugin:ZD,useOperationStatus:i4,useOperations:QD,usePluginApi:e4,usePluginSettings:t4,usePluginStorage:n4,useStoreSnapshot:RR},Symbol.toStringTag,{value:"Module"}));var Mv={exports:{}},Gi={};var RE;function c4(){if(RE)return Gi;RE=1;var e=Y0();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 Gi.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Gi.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)},Gi.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()}},Gi.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))},Gi.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},Gi.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,y=d(m,p.crossOrigin),_=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:_,fetchPriority:w}):m==="script"&&i.d.X(f,{crossOrigin:y,integrity:_,fetchPriority:w,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Gi.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)},Gi.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})}},Gi.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)},Gi.requestFormReset=function(f){i.d.r(f)},Gi.unstable_batchedUpdates=function(f,p){return f(p)},Gi.useFormState=function(f,p,m){return l.H.useFormState(f,p,m)},Gi.useFormStatus=function(){return l.H.useHostTransitionStatus()},Gi.version="19.2.7",Gi}var ME;function MR(){if(ME)return Mv.exports;ME=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(),Mv.exports=c4(),Mv.exports}var ea=MR();const nm=6,u4=232,d4=160,h4=8,f4=500;function p4(e,t,n){return Math.min(Math.max(e,t),n)}function m4(e){const t=[];for(let n=0;n<e.length;n+=1)e[n]?.disabled||t.push(n);return t}function g4(e,t,n){const i=Math.max(0,h4),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(d4,d):d,l),p=n?e.right-f:e.left,m=p4(p,i,Math.max(i,s-f-i));return t==="down"?{position:"fixed",left:m,width:f,top:Math.max(0,e.bottom+nm)}:{position:"fixed",left:m,width:f,bottom:Math.max(0,o-e.top+nm)}}function y4(e){const t=window.innerHeight-e.bottom-nm,n=e.top-nm;return t<u4&&n>t?"up":"down"}function NR({value:e,options:t,onChange:n,disabled:i=!1,id:s,compact:o=!1}){const l=g.useId(),d=s??`fc-select-${l.replace(/:/g,"")}`,f=g.useMemo(()=>t.map((L,R)=>`${d}-option-${R}-${L.value}`),[d,t]),p=g.useRef(null),m=g.useRef(null),y=g.useRef(null),[_,w]=g.useState(!1),[S,x]=g.useState(-1),[k,C]=g.useState("down"),[B,H]=g.useState({}),T=g.useRef(""),$=g.useRef(void 0),j=g.useMemo(()=>m4(t),[t]),M=g.useCallback(()=>{T.current="",$.current!==void 0&&(clearTimeout($.current),$.current=void 0)},[]),V=g.useCallback(()=>{w(!1),x(-1),M()},[M]),Y=g.useCallback(L=>{n(L),V(),m.current?.focus()},[V,n]),te=g.useCallback(()=>{const L=m.current;if(!L)return;const R=L.getBoundingClientRect(),q=y4(R);C(q),H(g4(R,q,o))},[o]),J=g.useCallback((L=!0)=>{if(i||_)return;w(!0);const R=t.findIndex(q=>q.value===e&&!q.disabled);L&&R>=0?x(R):x(j[0]??-1)},[i,j,_,t,e]),P=g.useCallback(L=>{if(!j.length)return;const R=j.indexOf(S),q=R>=0?R:L>0?-1:0,U=j[(q+L+j.length)%j.length];U!==void 0&&x(U)},[S,j]);g.useLayoutEffect(()=>{if(_)return te(),window.addEventListener("resize",te),window.addEventListener("scroll",te,!0),()=>{window.removeEventListener("resize",te),window.removeEventListener("scroll",te,!0)}},[_,te]),g.useEffect(()=>{if(!_)return;const L=q=>{const U=q.target;p.current?.contains(U)||y.current?.contains(U)||V()},R=q=>{if(q.key==="Escape"){q.stopPropagation(),V(),m.current?.focus();return}if(q.key==="Tab"){V();return}if(q.key==="ArrowDown"){q.preventDefault(),P(1);return}if(q.key==="ArrowUp"){q.preventDefault(),P(-1);return}if(q.key==="Home"){q.preventDefault();const U=j[0];U!==void 0&&x(U);return}if(q.key==="End"){q.preventDefault();const U=j.at(-1);U!==void 0&&x(U);return}if(q.key==="Enter"||q.key===" "){q.preventDefault(),q.stopPropagation();const U=t[S];U&&!U.disabled&&Y(U.value);return}if(q.key.length===1&&/\S/u.test(q.key)){T.current+=q.key.toLowerCase(),clearTimeout($.current),$.current=setTimeout(()=>{T.current=""},f4);const U=T.current,O=j.map(W=>t[W]).find(W=>W?.label.toLowerCase().startsWith(U));if(O){const W=t.indexOf(O);W>=0&&x(W)}}};return document.addEventListener("pointerdown",L,!0),document.addEventListener("keydown",R,!0),()=>{document.removeEventListener("pointerdown",L,!0),document.removeEventListener("keydown",R,!0)}},[S,V,Y,j,_,P,t]),g.useEffect(()=>()=>M(),[M]),g.useEffect(()=>{if(!_||S<0)return;const L=f[S];if(!L)return;document.getElementById(L)?.scrollIntoView?.({block:"nearest"})},[S,_,f]);const N=_&&S>=0?f[S]:void 0,I=g.useCallback(L=>{_||["ArrowDown","ArrowUp","Enter"," "].includes(L.key)&&(L.preventDefault(),J(L.key!=="ArrowDown"),L.key==="ArrowDown"&&P(1))},[_,P,J]),D=g.useCallback(()=>{i||(_?V():J(!0))},[V,i,_,J]),E=g.useCallback(L=>{const R=t[L];return{id:f[L]??`${d}-option-${L}`,role:"option",className:"fc-select__option","data-active":S===L?"true":"false","aria-selected":R?.value===e,"aria-disabled":R?.disabled?!0:void 0,onPointerEnter:()=>x(L),onClick:()=>{R&&!R.disabled&&Y(R.value)}}},[S,Y,d,f,t,e]);return{isOpen:_,activeOptionId:N,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":_,"aria-controls":d,"aria-activedescendant":N,onClick:D,onKeyDown:I},listboxProps:{ref:y,id:d,role:"listbox",className:o?"fc-select__popup fc-select__popup--compact":"fc-select__popup","data-open":_?"true":"false","data-placement":k,style:B},getOptionProps:E}}function qi({value:e,options:t,onChange:n,disabled:i=!1,compact:s=!1,className:o,id:l,label:d,"aria-labelledby":f}){const p=NR({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(" "),_=f?{"aria-labelledby":f}:d?{"aria-label":d}:{};return c.jsxs("div",{ref:p.rootRef,className:y,children:[c.jsxs("button",{...p.triggerProps,..._,children:[c.jsx("span",{className:"fc-select__value",children:m?.label??""}),c.jsx("span",{className:"fc-select__caret","aria-hidden":"true",children:"⌄"})]}),p.isOpen?ea.createPortal(c.jsx("ul",{...p.listboxProps,..._,children:t.map((w,S)=>c.jsx("li",{...p.getOptionProps(S),children:w.label},w.value))}),document.body):null]})}function v4(e){return e}function _4({title:e,description:t,children:n}){return c.jsxs("section",{className:"fc-settings-card",children:[e?c.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?c.jsx("p",{className:"fc-settings-card__desc",children:t}):null,c.jsx("div",{className:"fc-settings-card__body",children:n})]})}function b4({label:e,hint:t,children:n}){const i=g.useId(),s=g.useId();return c.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":i,"aria-describedby":t?s:void 0,children:[c.jsxs("div",{className:"fc-settings-row__copy",children:[c.jsx("div",{className:"fc-settings-row__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-row__hint",id:s,children:t}):null]}),c.jsx("div",{className:"fc-settings-row__control",children:n})]})}function w4({checked:e,onChange:t,label:n,disabled:i=!1}){const s=g.useId();return c.jsxs("label",{className:"fc-settings-toggle",htmlFor:s,children:[c.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)}),c.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),n?c.jsx("span",{className:"fc-settings-toggle__label",children:n}):null]})}function S4({value:e,options:t,onChange:n,label:i,disabled:s=!1}){const o=g.useId(),l=t.map(f=>({value:f.value,label:f.label})),d=c.jsx(qi,{value:e,options:l,onChange:n,disabled:s,label:i?void 0:"Select setting","aria-labelledby":i?o:void 0});return i?c.jsxs("label",{className:"fc-settings-select",children:[c.jsx("span",{className:"fc-settings-select__label",id:o,children:i}),d]}):c.jsx("div",{className:"fc-settings-select",children:d})}function x4({label:e,hint:t,children:n}){const i=g.useId(),s=g.useId();return c.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":i,"aria-describedby":t?s:void 0,children:[c.jsx("div",{className:"fc-settings-field__label",id:i,children:e}),t?c.jsx("div",{className:"fc-settings-field__hint",id:s,children:t}):null,c.jsx("div",{className:"fc-settings-field__control",children:n})]})}const k4=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:_4,SettingsField:x4,SettingsRow:b4,SettingsSelect:S4,SettingsToggle:w4,defineSettingsSection:v4},Symbol.toStringTag,{value:"Module"}));function C4(e){return e}const E4=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:C4},Symbol.toStringTag,{value:"Module"})),A4=c.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class nh extends g.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??A4:this.props.children}}const T4=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:nh,React:em,Select:qi,default:em,useSelect:NR},Symbol.toStringTag,{value:"Module"}));var Nv={exports:{}},ad={},Lv={exports:{}},Ov={};var NE;function R4(){return NE||(NE=1,(function(e){function t(E,L){var R=E.length;E.push(L);e:for(;0<R;){var q=R-1>>>1,U=E[q];if(0<s(U,L))E[q]=L,E[R]=U,R=q;else break e}}function n(E){return E.length===0?null:E[0]}function i(E){if(E.length===0)return null;var L=E[0],R=E.pop();if(R!==L){E[0]=R;e:for(var q=0,U=E.length,O=U>>>1;q<O;){var W=2*(q+1)-1,K=E[W],z=W+1,G=E[z];if(0>s(K,R))z<U&&0>s(G,K)?(E[q]=G,E[z]=R,q=z):(E[q]=K,E[W]=R,q=W);else if(z<U&&0>s(G,R))E[q]=G,E[z]=R,q=z;else break e}}return L}function s(E,L){var R=E.sortIndex-L.sortIndex;return R!==0?R:E.id-L.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,_=3,w=!1,S=!1,x=!1,k=!1,C=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function T(E){for(var L=n(p);L!==null;){if(L.callback===null)i(p);else if(L.startTime<=E)i(p),L.sortIndex=L.expirationTime,t(f,L);else break;L=n(p)}}function $(E){if(x=!1,T(E),!S)if(n(f)!==null)S=!0,j||(j=!0,P());else{var L=n(p);L!==null&&D($,L.startTime-E)}}var j=!1,M=-1,V=5,Y=-1;function te(){return k?!0:!(e.unstable_now()-Y<V)}function J(){if(k=!1,j){var E=e.unstable_now();Y=E;var L=!0;try{e:{S=!1,x&&(x=!1,B(M),M=-1),w=!0;var R=_;try{t:{for(T(E),y=n(f);y!==null&&!(y.expirationTime>E&&te());){var q=y.callback;if(typeof q=="function"){y.callback=null,_=y.priorityLevel;var U=q(y.expirationTime<=E);if(E=e.unstable_now(),typeof U=="function"){y.callback=U,T(E),L=!0;break t}y===n(f)&&i(f),T(E)}else i(f);y=n(f)}if(y!==null)L=!0;else{var O=n(p);O!==null&&D($,O.startTime-E),L=!1}}break e}finally{y=null,_=R,w=!1}L=void 0}}finally{L?P():j=!1}}}var P;if(typeof H=="function")P=function(){H(J)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,I=N.port2;N.port1.onmessage=J,P=function(){I.postMessage(null)}}else P=function(){C(J,0)};function D(E,L){M=C(function(){E(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(E){switch(_){case 1:case 2:case 3:var L=3;break;default:L=_}var R=_;_=L;try{return E()}finally{_=R}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(E,L){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var R=_;_=E;try{return L()}finally{_=R}},e.unstable_scheduleCallback=function(E,L,R){var q=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?q+R:q):R=q,E){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=R+U,E={id:m++,callback:L,priorityLevel:E,startTime:R,expirationTime:U,sortIndex:-1},R>q?(E.sortIndex=R,t(p,E),n(f)===null&&E===n(p)&&(x?(B(M),M=-1):x=!0,D($,R-q))):(E.sortIndex=U,t(f,E),S||w||(S=!0,j||(j=!0,P()))),E},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(E){var L=_;return function(){var R=_;_=L;try{return E.apply(this,arguments)}finally{_=R}}}})(Ov)),Ov}var LE;function M4(){return LE||(LE=1,Lv.exports=R4()),Lv.exports}var OE;function N4(){if(OE)return ad;OE=1;var e=M4(),t=Y0(),n=MR();function i(r){var a="https://react.dev/errors/"+r;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}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,u=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(u=a.return),r=a.return;while(r)}return a.tag===3?u: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 u=r,h=a;;){var v=u.return;if(v===null)break;var b=v.alternate;if(b===null){if(h=v.return,h!==null){u=h;continue}break}if(v.child===b.child){for(b=v.child;b;){if(b===u)return f(v),r;if(b===h)return f(v),a;b=b.sibling}throw Error(i(188))}if(u.return!==h.return)u=v,h=b;else{for(var A=!1,F=v.child;F;){if(F===u){A=!0,u=v,h=b;break}if(F===h){A=!0,h=v,u=b;break}F=F.sibling}if(!A){for(F=b.child;F;){if(F===u){A=!0,u=b,h=v;break}if(F===h){A=!0,h=b,u=v;break}F=F.sibling}if(!A)throw Error(i(189))}}if(u.alternate!==h)throw Error(i(190))}if(u.tag!==3)throw Error(i(188));return u.stateNode.current===u?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,_=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"),C=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),H=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function P(r){return r===null||typeof r!="object"?null:(r=J&&r[J]||r["@@iterator"],typeof r=="function"?r:null)}var N=Symbol.for("react.client.reference");function I(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===N?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case x:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case $:return"Suspense";case j:return"SuspenseList";case Y:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case H:return r.displayName||"Context";case B: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 M:return a=r.displayName||null,a!==null?a:I(r.type)||"Memo";case V:a=r._payload,r=r._init;try{return I(r(a))}catch{}}return null}var D=Array.isArray,E=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},q=[],U=-1;function O(r){return{current:r}}function W(r){0>U||(r.current=q[U],q[U]=null,U--)}function K(r,a){U++,q[U]=r.current,r.current=a}var z=O(null),G=O(null),Z=O(null),se=O(null);function Se(r,a){switch(K(Z,a),K(G,r),K(z,null),a.nodeType){case 9:case 11:r=(r=a.documentElement)&&(r=r.namespaceURI)?KC(r):0;break;default:if(r=a.tagName,a=a.namespaceURI)a=KC(a),r=VC(a,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}W(z),K(z,r)}function pe(){W(z),W(G),W(Z)}function $e(r){r.memoizedState!==null&&K(se,r);var a=z.current,u=VC(a,r.type);a!==u&&(K(G,r),K(z,u))}function je(r){G.current===r&&(W(z),W(G)),se.current===r&&(W(se),td._currentValue=R)}var St,Re;function ze(r){if(St===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);St=a&&a[1]||"",Re=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+St+r+Re}var lt=!1;function kt(r,a){if(!r||lt)return"";lt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var Ce=function(){throw Error()};if(Object.defineProperty(Ce.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ce,[])}catch(ye){var fe=ye}Reflect.construct(r,[],Ce)}else{try{Ce.call()}catch(ye){fe=ye}r.call(Ce.prototype)}}else{try{throw Error()}catch(ye){fe=ye}(Ce=r())&&typeof Ce.catch=="function"&&Ce.catch(function(){})}}catch(ye){if(ye&&fe&&typeof ye.stack=="string")return[ye.stack,fe.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=h.DetermineComponentFrameRoot(),A=b[0],F=b[1];if(A&&F){var ne=A.split(`
4
+ `),de=F.split(`
5
+ `);for(v=h=0;h<ne.length&&!ne[h].includes("DetermineComponentFrameRoot");)h++;for(;v<de.length&&!de[v].includes("DetermineComponentFrameRoot");)v++;if(h===ne.length||v===de.length)for(h=ne.length-1,v=de.length-1;1<=h&&0<=v&&ne[h]!==de[v];)v--;for(;1<=h&&0<=v;h--,v--)if(ne[h]!==de[v]){if(h!==1||v!==1)do if(h--,v--,0>v||ne[h]!==de[v]){var be=`
6
+ `+ne[h].replace(" at new "," at ");return r.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",r.displayName)),be}while(1<=h&&0<=v);break}}}finally{lt=!1,Error.prepareStackTrace=u}return(u=r?r.displayName||r.name:"")?ze(u):""}function mt(r,a){switch(r.tag){case 26:case 27:case 5:return ze(r.type);case 16:return ze("Lazy");case 13:return r.child!==a&&a!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return kt(r.type,!1);case 11:return kt(r.type.render,!1);case 1:return kt(r.type,!0);case 31:return ze("Activity");default:return""}}function Ct(r){try{var a="",u=null;do a+=mt(r,u),u=r,r=r.return;while(r);return a}catch(h){return`
7
+ Error generating stack: `+h.message+`
8
+ `+h.stack}}var dt=Object.prototype.hasOwnProperty,gt=e.unstable_scheduleCallback,at=e.unstable_cancelCallback,Pt=e.unstable_shouldYield,Ut=e.unstable_requestPaint,tt=e.unstable_now,cn=e.unstable_getCurrentPriorityLevel,ke=e.unstable_ImmediatePriority,De=e.unstable_UserBlockingPriority,Xe=e.unstable_NormalPriority,_t=e.unstable_LowPriority,ht=e.unstable_IdlePriority,nt=e.log,st=e.unstable_setDisableYieldValue,_e=null,Ne=null;function bt(r){if(typeof nt=="function"&&st(r),Ne&&typeof Ne.setStrictMode=="function")try{Ne.setStrictMode(_e,r)}catch{}}var Nt=Math.clz32?Math.clz32:me,hn=Math.log,le=Math.LN2;function me(r){return r>>>=0,r===0?32:31-(hn(r)/le|0)|0}var re=256,ge=262144,Te=4194304;function We(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 ee(r,a,u){var h=r.pendingLanes;if(h===0)return 0;var v=0,b=r.suspendedLanes,A=r.pingedLanes;r=r.warmLanes;var F=h&134217727;return F!==0?(h=F&~b,h!==0?v=We(h):(A&=F,A!==0?v=We(A):u||(u=F&~r,u!==0&&(v=We(u))))):(F=h&~b,F!==0?v=We(F):A!==0?v=We(A):u||(u=h&~r,u!==0&&(v=We(u)))),v===0?0:a!==0&&a!==v&&(a&b)===0&&(b=v&-v,u=a&-a,b>=u||b===32&&(u&4194048)!==0)?a:v}function he(r,a){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&a)===0}function Ee(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 Ve(){var r=Te;return Te<<=1,(Te&62914560)===0&&(Te=4194304),r}function Rt(r){for(var a=[],u=0;31>u;u++)a.push(r);return a}function ct(r,a){r.pendingLanes|=a,a!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Pe(r,a,u,h,v,b){var A=r.pendingLanes;r.pendingLanes=u,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=u,r.entangledLanes&=u,r.errorRecoveryDisabledLanes&=u,r.shellSuspendCounter=0;var F=r.entanglements,ne=r.expirationTimes,de=r.hiddenUpdates;for(u=A&~u;0<u;){var be=31-Nt(u),Ce=1<<be;F[be]=0,ne[be]=-1;var fe=de[be];if(fe!==null)for(de[be]=null,be=0;be<fe.length;be++){var ye=fe[be];ye!==null&&(ye.lane&=-536870913)}u&=~Ce}h!==0&&Ie(r,h,0),b!==0&&v===0&&r.tag!==0&&(r.suspendedLanes|=b&~(A&~a))}function Ie(r,a,u){r.pendingLanes|=a,r.suspendedLanes&=~a;var h=31-Nt(a);r.entangledLanes|=a,r.entanglements[h]=r.entanglements[h]|1073741824|u&261930}function it(r,a){var u=r.entangledLanes|=a;for(r=r.entanglements;u;){var h=31-Nt(u),v=1<<h;v&a|r[h]&a&&(r[h]|=a),u&=~v}}function Zt(r,a){var u=a&-a;return u=(u&42)!==0?1:xt(u),(u&(r.suspendedLanes|a))!==0?0:u}function xt(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 Fn(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Xn(){var r=L.p;return r!==0?r:(r=window.event,r===void 0?32:yE(r.type))}function pi(r,a){var u=L.p;try{return L.p=r,a()}finally{L.p=u}}var fn=Math.random().toString(36).slice(2),Kt="__reactFiber$"+fn,oe="__reactProps$"+fn,qe="__reactContainer$"+fn,ot="__reactEvents$"+fn,an="__reactListeners$"+fn,$t="__reactHandles$"+fn,On="__reactResources$"+fn,Si="__reactMarker$"+fn;function Ge(r){delete r[Kt],delete r[oe],delete r[ot],delete r[an],delete r[$t]}function Q(r){var a=r[Kt];if(a)return a;for(var u=r.parentNode;u;){if(a=u[qe]||u[Kt]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(r=tE(r);r!==null;){if(u=r[Kt])return u;r=tE(r)}return a}r=u,u=r.parentNode}return null}function ve(r){if(r=r[Kt]||r[qe]){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 zt(r){var a=r[On];return a||(a=r[On]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Et(r){r[Si]=!0}var pn=new Set,Cn={};function En(r,a){X(r,a),X(r+"Capture",a)}function X(r,a){for(Cn[r]=a,r=0;r<a.length;r++)pn.add(a[r])}var we=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]*$"),Me={},He={};function Ke(r){return dt.call(He,r)?!0:dt.call(Me,r)?!1:we.test(r)?He[r]=!0:(Me[r]=!0,!1)}function Yt(r,a,u){if(Ke(a))if(u===null)r.removeAttribute(a);else{switch(typeof u){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,""+u)}}function nn(r,a,u){if(u===null)r.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(a);return}r.setAttribute(a,""+u)}}function xn(r,a,u,h){if(h===null)r.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(u);return}r.setAttributeNS(a,u,""+h)}}function Xt(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function ni(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function As(r,a,u){var h=Object.getOwnPropertyDescriptor(r.constructor.prototype,a);if(!r.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var v=h.get,b=h.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return v.call(this)},set:function(A){u=""+A,b.call(this,A)}}),Object.defineProperty(r,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(A){u=""+A},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function yt(r){if(!r._valueTracker){var a=ni(r)?"checked":"value";r._valueTracker=As(r,a,""+r[a])}}function on(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return r&&(h=ni(r)?r.checked?"true":"false":r.value),r=h,r!==u?(a.setValue(r),!0):!1}function ii(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 lr=/[\n"\\]/g;function mn(r){return r.replace(lr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function zr(r,a,u,h,v,b,A,F){r.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.type=A:r.removeAttribute("type"),a!=null?A==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+Xt(a)):r.value!==""+Xt(a)&&(r.value=""+Xt(a)):A!=="submit"&&A!=="reset"||r.removeAttribute("value"),a!=null?Ts(r,A,Xt(a)):u!=null?Ts(r,A,Xt(u)):h!=null&&r.removeAttribute("value"),v==null&&b!=null&&(r.defaultChecked=!!b),v!=null&&(r.checked=v&&typeof v!="function"&&typeof v!="symbol"),F!=null&&typeof F!="function"&&typeof F!="symbol"&&typeof F!="boolean"?r.name=""+Xt(F):r.removeAttribute("name")}function cr(r,a,u,h,v,b,A,F){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(r.type=b),a!=null||u!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){yt(r);return}u=u!=null?""+Xt(u):"",a=a!=null?""+Xt(a):u,F||a===r.value||(r.value=a),r.defaultValue=a}h=h??v,h=typeof h!="function"&&typeof h!="symbol"&&!!h,r.checked=F?r.checked:!!h,r.defaultChecked=!!h,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(r.name=A),yt(r)}function Ts(r,a,u){a==="number"&&ii(r.ownerDocument)===r||r.defaultValue===""+u||(r.defaultValue=""+u)}function Zn(r,a,u,h){if(r=r.options,a){a={};for(var v=0;v<u.length;v++)a["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=a.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&h&&(r[u].defaultSelected=!0)}else{for(u=""+Xt(u),a=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,h&&(r[v].defaultSelected=!0);return}a!==null||r[v].disabled||(a=r[v])}a!==null&&(a.selected=!0)}}function ri(r,a,u){if(a!=null&&(a=""+Xt(a),a!==r.value&&(r.value=a),u==null)){r.defaultValue!==a&&(r.defaultValue=a);return}r.defaultValue=u!=null?""+Xt(u):""}function Rs(r,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(i(92));if(D(h)){if(1<h.length)throw Error(i(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Xt(a),r.defaultValue=u,h=r.textContent,h===u&&h!==""&&h!==null&&(r.value=h),yt(r)}function ut(r,a){if(a){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=a;return}}r.textContent=a}var Uo=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 Hn(r,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?r.setProperty(a,""):a==="float"?r.cssFloat="":r[a]="":h?r.setProperty(a,u):typeof u!="number"||u===0||Uo.has(a)?a==="float"?r.cssFloat=u:r[a]=(""+u).trim():r[a]=u+"px"}function rn(r,a,u){if(a!=null&&typeof a!="object")throw Error(i(62));if(r=r.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?r.setProperty(h,""):h==="float"?r.cssFloat="":r[h]="");for(var v in a)h=a[v],a.hasOwnProperty(v)&&u[v]!==h&&Hn(r,v,h)}else for(var b in a)a.hasOwnProperty(b)&&Hn(r,b,a[b])}function Ms(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 fs=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"]]),Wo=/^[\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 Ha(r){return Wo.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Oe(){}var Qe=null;function Mt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Wt=null,Pn=null;function Fr(r){var a=ve(r);if(a&&(r=a.stateNode)){var u=r[oe]||null;e:switch(r=a.stateNode,a.type){case"input":if(zr(r,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+mn(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==r&&h.form===r.form){var v=h[oe]||null;if(!v)throw Error(i(90));zr(h,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===r.form&&on(h)}break e;case"textarea":ri(r,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&Zn(r,!!u.multiple,a,!1)}}}var yu=!1;function Dh(r,a,u){if(yu)return r(a,u);yu=!0;try{var h=r(a);return h}finally{if(yu=!1,(Wt!==null||Pn!==null)&&(kf(),Wt&&(a=Wt,r=Pn,Pn=Wt=null,Fr(a),r)))for(a=0;a<r.length;a++)Fr(r[a])}}function vu(r,a){var u=r.stateNode;if(u===null)return null;var h=u[oe]||null;if(h===null)return null;u=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(u&&typeof u!="function")throw Error(i(231,a,typeof u));return u}var sa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ag=!1;if(sa)try{var _u={};Object.defineProperty(_u,"passive",{get:function(){Ag=!0}}),window.addEventListener("test",_u,_u),window.removeEventListener("test",_u,_u)}catch{Ag=!1}var Ua=null,Tg=null,Bh=null;function V1(){if(Bh)return Bh;var r,a=Tg,u=a.length,h,v="value"in Ua?Ua.value:Ua.textContent,b=v.length;for(r=0;r<u&&a[r]===v[r];r++);var A=u-r;for(h=1;h<=A&&a[u-h]===v[b-h];h++);return Bh=v.slice(r,1<h?1-h:void 0)}function Ph(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 $h(){return!0}function Y1(){return!1}function ur(r){function a(u,h,v,b,A){this._reactName=u,this._targetInst=v,this.type=h,this.nativeEvent=b,this.target=A,this.currentTarget=null;for(var F in r)r.hasOwnProperty(F)&&(u=r[F],this[F]=u?u(b):b[F]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?$h:Y1,this.isPropagationStopped=Y1,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=$h)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=$h)},persist:function(){},isPersistent:$h}),a}var qo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zh=ur(qo),bu=y({},qo,{view:0,detail:0}),Bj=ur(bu),Rg,Mg,wu,Fh=y({},bu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Lg,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!==wu&&(wu&&r.type==="mousemove"?(Rg=r.screenX-wu.screenX,Mg=r.screenY-wu.screenY):Mg=Rg=0,wu=r),Rg)},movementY:function(r){return"movementY"in r?r.movementY:Mg}}),X1=ur(Fh),Pj=y({},Fh,{dataTransfer:0}),$j=ur(Pj),zj=y({},bu,{relatedTarget:0}),Ng=ur(zj),Fj=y({},qo,{animationName:0,elapsedTime:0,pseudoElement:0}),Hj=ur(Fj),Uj=y({},qo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Wj=ur(Uj),qj=y({},qo,{data:0}),Z1=ur(qj),Gj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Kj={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"},Vj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yj(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=Vj[r])?!!a[r]:!1}function Lg(){return Yj}var Xj=y({},bu,{key:function(r){if(r.key){var a=Gj[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=Ph(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Kj[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Lg,charCode:function(r){return r.type==="keypress"?Ph(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Ph(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Zj=ur(Xj),Jj=y({},Fh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),J1=ur(Jj),Qj=y({},bu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Lg}),e6=ur(Qj),t6=y({},qo,{propertyName:0,elapsedTime:0,pseudoElement:0}),n6=ur(t6),i6=y({},Fh,{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}),r6=ur(i6),s6=y({},qo,{newState:0,oldState:0}),a6=ur(s6),o6=[9,13,27,32],Og=sa&&"CompositionEvent"in window,Su=null;sa&&"documentMode"in document&&(Su=document.documentMode);var l6=sa&&"TextEvent"in window&&!Su,Q1=sa&&(!Og||Su&&8<Su&&11>=Su),ex=" ",tx=!1;function nx(r,a){switch(r){case"keyup":return o6.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ix(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var $l=!1;function c6(r,a){switch(r){case"compositionend":return ix(a);case"keypress":return a.which!==32?null:(tx=!0,ex);case"textInput":return r=a.data,r===ex&&tx?null:r;default:return null}}function u6(r,a){if($l)return r==="compositionend"||!Og&&nx(r,a)?(r=V1(),Bh=Tg=Ua=null,$l=!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 Q1&&a.locale!=="ko"?null:a.data;default:return null}}var d6={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 rx(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!d6[r.type]:a==="textarea"}function sx(r,a,u,h){Wt?Pn?Pn.push(h):Pn=[h]:Wt=h,a=Nf(a,"onChange"),0<a.length&&(u=new zh("onChange","change",null,u,h),r.push({event:u,listeners:a}))}var xu=null,ku=null;function h6(r){FC(r,0)}function Hh(r){var a=Be(r);if(on(a))return r}function ax(r,a){if(r==="change")return a}var ox=!1;if(sa){var Ig;if(sa){var jg="oninput"in document;if(!jg){var lx=document.createElement("div");lx.setAttribute("oninput","return;"),jg=typeof lx.oninput=="function"}Ig=jg}else Ig=!1;ox=Ig&&(!document.documentMode||9<document.documentMode)}function cx(){xu&&(xu.detachEvent("onpropertychange",ux),ku=xu=null)}function ux(r){if(r.propertyName==="value"&&Hh(ku)){var a=[];sx(a,ku,r,Mt(r)),Dh(h6,a)}}function f6(r,a,u){r==="focusin"?(cx(),xu=a,ku=u,xu.attachEvent("onpropertychange",ux)):r==="focusout"&&cx()}function p6(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Hh(ku)}function m6(r,a){if(r==="click")return Hh(a)}function g6(r,a){if(r==="input"||r==="change")return Hh(a)}function y6(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var kr=typeof Object.is=="function"?Object.is:y6;function Cu(r,a){if(kr(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var u=Object.keys(r),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var v=u[h];if(!dt.call(a,v)||!kr(r[v],a[v]))return!1}return!0}function dx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function hx(r,a){var u=dx(r);r=0;for(var h;u;){if(u.nodeType===3){if(h=r+u.textContent.length,r<=a&&h>=a)return{node:u,offset:a-r};r=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=dx(u)}}function fx(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?fx(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function px(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var a=ii(r.document);a instanceof r.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)r=a.contentWindow;else break;a=ii(r.document)}return a}function Dg(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 v6=sa&&"documentMode"in document&&11>=document.documentMode,zl=null,Bg=null,Eu=null,Pg=!1;function mx(r,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Pg||zl==null||zl!==ii(h)||(h=zl,"selectionStart"in h&&Dg(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}),Eu&&Cu(Eu,h)||(Eu=h,h=Nf(Bg,"onSelect"),0<h.length&&(a=new zh("onSelect","select",null,a,u),r.push({event:a,listeners:h}),a.target=zl)))}function Go(r,a){var u={};return u[r.toLowerCase()]=a.toLowerCase(),u["Webkit"+r]="webkit"+a,u["Moz"+r]="moz"+a,u}var Fl={animationend:Go("Animation","AnimationEnd"),animationiteration:Go("Animation","AnimationIteration"),animationstart:Go("Animation","AnimationStart"),transitionrun:Go("Transition","TransitionRun"),transitionstart:Go("Transition","TransitionStart"),transitioncancel:Go("Transition","TransitionCancel"),transitionend:Go("Transition","TransitionEnd")},$g={},gx={};sa&&(gx=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function Ko(r){if($g[r])return $g[r];if(!Fl[r])return r;var a=Fl[r],u;for(u in a)if(a.hasOwnProperty(u)&&u in gx)return $g[r]=a[u];return r}var yx=Ko("animationend"),vx=Ko("animationiteration"),_x=Ko("animationstart"),_6=Ko("transitionrun"),b6=Ko("transitionstart"),w6=Ko("transitioncancel"),bx=Ko("transitionend"),wx=new Map,zg="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(" ");zg.push("scrollEnd");function ps(r,a){wx.set(r,a),En(a,[r])}var Uh=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)},Hr=[],Hl=0,Fg=0;function Wh(){for(var r=Hl,a=Fg=Hl=0;a<r;){var u=Hr[a];Hr[a++]=null;var h=Hr[a];Hr[a++]=null;var v=Hr[a];Hr[a++]=null;var b=Hr[a];if(Hr[a++]=null,h!==null&&v!==null){var A=h.pending;A===null?v.next=v:(v.next=A.next,A.next=v),h.pending=v}b!==0&&Sx(u,v,b)}}function qh(r,a,u,h){Hr[Hl++]=r,Hr[Hl++]=a,Hr[Hl++]=u,Hr[Hl++]=h,Fg|=h,r.lanes|=h,r=r.alternate,r!==null&&(r.lanes|=h)}function Hg(r,a,u,h){return qh(r,a,u,h),Gh(r)}function Vo(r,a){return qh(r,null,null,a),Gh(r)}function Sx(r,a,u){r.lanes|=u;var h=r.alternate;h!==null&&(h.lanes|=u);for(var v=!1,b=r.return;b!==null;)b.childLanes|=u,h=b.alternate,h!==null&&(h.childLanes|=u),b.tag===22&&(r=b.stateNode,r===null||r._visibility&1||(v=!0)),r=b,b=b.return;return r.tag===3?(b=r.stateNode,v&&a!==null&&(v=31-Nt(u),r=b.hiddenUpdates,h=r[v],h===null?r[v]=[a]:h.push(a),a.lane=u|536870912),b):null}function Gh(r){if(50<Vu)throw Vu=0,Zy=null,Error(i(185));for(var a=r.return;a!==null;)r=a,a=r.return;return r.tag===3?r.stateNode:null}var Ul={};function S6(r,a,u,h){this.tag=r,this.key=u,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 Cr(r,a,u,h){return new S6(r,a,u,h)}function Ug(r){return r=r.prototype,!(!r||!r.isReactComponent)}function aa(r,a){var u=r.alternate;return u===null?(u=Cr(r.tag,a,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=a,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&65011712,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,a=r.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u.refCleanup=r.refCleanup,u}function xx(r,a){r.flags&=65011714;var u=r.alternate;return u===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=u.childLanes,r.lanes=u.lanes,r.child=u.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=u.memoizedProps,r.memoizedState=u.memoizedState,r.updateQueue=u.updateQueue,r.type=u.type,a=u.dependencies,r.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),r}function Kh(r,a,u,h,v,b){var A=0;if(h=r,typeof r=="function")Ug(r)&&(A=1);else if(typeof r=="string")A=AD(r,u,z.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case Y:return r=Cr(31,u,a,v),r.elementType=Y,r.lanes=b,r;case x:return Yo(u.children,v,b,a);case k:A=8,v|=24;break;case C:return r=Cr(12,u,a,v|2),r.elementType=C,r.lanes=b,r;case $:return r=Cr(13,u,a,v),r.elementType=$,r.lanes=b,r;case j:return r=Cr(19,u,a,v),r.elementType=j,r.lanes=b,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case H:A=10;break e;case B:A=9;break e;case T:A=11;break e;case M:A=14;break e;case V:A=16,h=null;break e}A=29,u=Error(i(130,r===null?"null":typeof r,"")),h=null}return a=Cr(A,u,a,v),a.elementType=r,a.type=h,a.lanes=b,a}function Yo(r,a,u,h){return r=Cr(7,r,h,a),r.lanes=u,r}function Wg(r,a,u){return r=Cr(6,r,null,a),r.lanes=u,r}function kx(r){var a=Cr(18,null,null,0);return a.stateNode=r,a}function qg(r,a,u){return a=Cr(4,r.children!==null?r.children:[],r.key,a),a.lanes=u,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}var Cx=new WeakMap;function Ur(r,a){if(typeof r=="object"&&r!==null){var u=Cx.get(r);return u!==void 0?u:(a={value:r,source:a,stack:Ct(a)},Cx.set(r,a),a)}return{value:r,source:a,stack:Ct(a)}}var Wl=[],ql=0,Vh=null,Au=0,Wr=[],qr=0,Wa=null,Ns=1,Ls="";function oa(r,a){Wl[ql++]=Au,Wl[ql++]=Vh,Vh=r,Au=a}function Ex(r,a,u){Wr[qr++]=Ns,Wr[qr++]=Ls,Wr[qr++]=Wa,Wa=r;var h=Ns;r=Ls;var v=32-Nt(h)-1;h&=~(1<<v),u+=1;var b=32-Nt(a)+v;if(30<b){var A=v-v%5;b=(h&(1<<A)-1).toString(32),h>>=A,v-=A,Ns=1<<32-Nt(a)+v|u<<v|h,Ls=b+r}else Ns=1<<b|u<<v|h,Ls=r}function Gg(r){r.return!==null&&(oa(r,1),Ex(r,1,0))}function Kg(r){for(;r===Vh;)Vh=Wl[--ql],Wl[ql]=null,Au=Wl[--ql],Wl[ql]=null;for(;r===Wa;)Wa=Wr[--qr],Wr[qr]=null,Ls=Wr[--qr],Wr[qr]=null,Ns=Wr[--qr],Wr[qr]=null}function Ax(r,a){Wr[qr++]=Ns,Wr[qr++]=Ls,Wr[qr++]=Wa,Ns=a.id,Ls=a.overflow,Wa=r}var Di=null,An=null,Vt=!1,qa=null,Gr=!1,Vg=Error(i(519));function Ga(r){var a=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tu(Ur(a,r)),Vg}function Tx(r){var a=r.stateNode,u=r.type,h=r.memoizedProps;switch(a[Kt]=r,a[oe]=h,u){case"dialog":Ht("cancel",a),Ht("close",a);break;case"iframe":case"object":case"embed":Ht("load",a);break;case"video":case"audio":for(u=0;u<Xu.length;u++)Ht(Xu[u],a);break;case"source":Ht("error",a);break;case"img":case"image":case"link":Ht("error",a),Ht("load",a);break;case"details":Ht("toggle",a);break;case"input":Ht("invalid",a),cr(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Ht("invalid",a);break;case"textarea":Ht("invalid",a),Rs(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||qC(a.textContent,u)?(h.popover!=null&&(Ht("beforetoggle",a),Ht("toggle",a)),h.onScroll!=null&&Ht("scroll",a),h.onScrollEnd!=null&&Ht("scrollend",a),h.onClick!=null&&(a.onclick=Oe),a=!0):a=!1,a||Ga(r,!0)}function Rx(r){for(Di=r.return;Di;)switch(Di.tag){case 5:case 31:case 13:Gr=!1;return;case 27:case 3:Gr=!0;return;default:Di=Di.return}}function Gl(r){if(r!==Di)return!1;if(!Vt)return Rx(r),Vt=!0,!1;var a=r.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=r.type,u=!(u!=="form"&&u!=="button")||hv(r.type,r.memoizedProps)),u=!u),u&&An&&Ga(r),Rx(r),a===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));An=eE(r)}else if(a===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));An=eE(r)}else a===27?(a=An,ao(r.type)?(r=yv,yv=null,An=r):An=a):An=Di?Vr(r.stateNode.nextSibling):null;return!0}function Xo(){An=Di=null,Vt=!1}function Yg(){var r=qa;return r!==null&&(pr===null?pr=r:pr.push.apply(pr,r),qa=null),r}function Tu(r){qa===null?qa=[r]:qa.push(r)}var Xg=O(null),Zo=null,la=null;function Ka(r,a,u){K(Xg,a._currentValue),a._currentValue=u}function ca(r){r._currentValue=Xg.current,W(Xg)}function Zg(r,a,u){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===u)break;r=r.return}}function Jg(r,a,u,h){var v=r.child;for(v!==null&&(v.return=r);v!==null;){var b=v.dependencies;if(b!==null){var A=v.child;b=b.firstContext;e:for(;b!==null;){var F=b;b=v;for(var ne=0;ne<a.length;ne++)if(F.context===a[ne]){b.lanes|=u,F=b.alternate,F!==null&&(F.lanes|=u),Zg(b.return,u,r),h||(A=null);break e}b=F.next}}else if(v.tag===18){if(A=v.return,A===null)throw Error(i(341));A.lanes|=u,b=A.alternate,b!==null&&(b.lanes|=u),Zg(A,u,r),A=null}else A=v.child;if(A!==null)A.return=v;else for(A=v;A!==null;){if(A===r){A=null;break}if(v=A.sibling,v!==null){v.return=A.return,A=v;break}A=A.return}v=A}}function Kl(r,a,u,h){r=null;for(var v=a,b=!1;v!==null;){if(!b){if((v.flags&524288)!==0)b=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var A=v.alternate;if(A===null)throw Error(i(387));if(A=A.memoizedProps,A!==null){var F=v.type;kr(v.pendingProps.value,A.value)||(r!==null?r.push(F):r=[F])}}else if(v===se.current){if(A=v.alternate,A===null)throw Error(i(387));A.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(r!==null?r.push(td):r=[td])}v=v.return}r!==null&&Jg(a,r,u,h),a.flags|=262144}function Yh(r){for(r=r.firstContext;r!==null;){if(!kr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Jo(r){Zo=r,la=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Bi(r){return Mx(Zo,r)}function Xh(r,a){return Zo===null&&Jo(r),Mx(r,a)}function Mx(r,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},la===null){if(r===null)throw Error(i(308));la=a,r.dependencies={lanes:0,firstContext:a},r.flags|=524288}else la=la.next=a;return u}var x6=typeof AbortController<"u"?AbortController:function(){var r=[],a=this.signal={aborted:!1,addEventListener:function(u,h){r.push(h)}};this.abort=function(){a.aborted=!0,r.forEach(function(u){return u()})}},k6=e.unstable_scheduleCallback,C6=e.unstable_NormalPriority,si={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qg(){return{controller:new x6,data:new Map,refCount:0}}function Ru(r){r.refCount--,r.refCount===0&&k6(C6,function(){r.controller.abort()})}var Mu=null,ey=0,Vl=0,Yl=null;function E6(r,a){if(Mu===null){var u=Mu=[];ey=0,Vl=iv(),Yl={status:"pending",value:void 0,then:function(h){u.push(h)}}}return ey++,a.then(Nx,Nx),a}function Nx(){if(--ey===0&&Mu!==null){Yl!==null&&(Yl.status="fulfilled");var r=Mu;Mu=null,Vl=0,Yl=null;for(var a=0;a<r.length;a++)(0,r[a])()}}function A6(r,a){var u=[],h={status:"pending",value:null,reason:null,then:function(v){u.push(v)}};return r.then(function(){h.status="fulfilled",h.value=a;for(var v=0;v<u.length;v++)(0,u[v])(a)},function(v){for(h.status="rejected",h.reason=v,v=0;v<u.length;v++)(0,u[v])(void 0)}),h}var Lx=E.S;E.S=function(r,a){mC=tt(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&E6(r,a),Lx!==null&&Lx(r,a)};var Qo=O(null);function ty(){var r=Qo.current;return r!==null?r:kn.pooledCache}function Zh(r,a){a===null?K(Qo,Qo.current):K(Qo,a.pool)}function Ox(){var r=ty();return r===null?null:{parent:si._currentValue,pool:r}}var Xl=Error(i(460)),ny=Error(i(474)),Jh=Error(i(542)),Qh={then:function(){}};function Ix(r){return r=r.status,r==="fulfilled"||r==="rejected"}function jx(r,a,u){switch(u=r[u],u===void 0?r.push(a):u!==a&&(a.then(Oe,Oe),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,Bx(r),r;default:if(typeof a.status=="string")a.then(Oe,Oe);else{if(r=kn,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=a,r.status="pending",r.then(function(h){if(a.status==="pending"){var v=a;v.status="fulfilled",v.value=h}},function(h){if(a.status==="pending"){var v=a;v.status="rejected",v.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw r=a.reason,Bx(r),r}throw tl=a,Xl}}function el(r){try{var a=r._init;return a(r._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(tl=u,Xl):u}}var tl=null;function Dx(){if(tl===null)throw Error(i(459));var r=tl;return tl=null,r}function Bx(r){if(r===Xl||r===Jh)throw Error(i(483))}var Zl=null,Nu=0;function ef(r){var a=Nu;return Nu+=1,Zl===null&&(Zl=[]),jx(Zl,r,a)}function Lu(r,a){a=a.props.ref,r.ref=a!==void 0?a:null}function tf(r,a){throw a.$$typeof===_?Error(i(525)):(r=Object.prototype.toString.call(a),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r)))}function Px(r){function a(ae,ie){if(r){var ue=ae.deletions;ue===null?(ae.deletions=[ie],ae.flags|=16):ue.push(ie)}}function u(ae,ie){if(!r)return null;for(;ie!==null;)a(ae,ie),ie=ie.sibling;return null}function h(ae){for(var ie=new Map;ae!==null;)ae.key!==null?ie.set(ae.key,ae):ie.set(ae.index,ae),ae=ae.sibling;return ie}function v(ae,ie){return ae=aa(ae,ie),ae.index=0,ae.sibling=null,ae}function b(ae,ie,ue){return ae.index=ue,r?(ue=ae.alternate,ue!==null?(ue=ue.index,ue<ie?(ae.flags|=67108866,ie):ue):(ae.flags|=67108866,ie)):(ae.flags|=1048576,ie)}function A(ae){return r&&ae.alternate===null&&(ae.flags|=67108866),ae}function F(ae,ie,ue,xe){return ie===null||ie.tag!==6?(ie=Wg(ue,ae.mode,xe),ie.return=ae,ie):(ie=v(ie,ue),ie.return=ae,ie)}function ne(ae,ie,ue,xe){var rt=ue.type;return rt===x?be(ae,ie,ue.props.children,xe,ue.key):ie!==null&&(ie.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===V&&el(rt)===ie.type)?(ie=v(ie,ue.props),Lu(ie,ue),ie.return=ae,ie):(ie=Kh(ue.type,ue.key,ue.props,null,ae.mode,xe),Lu(ie,ue),ie.return=ae,ie)}function de(ae,ie,ue,xe){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==ue.containerInfo||ie.stateNode.implementation!==ue.implementation?(ie=qg(ue,ae.mode,xe),ie.return=ae,ie):(ie=v(ie,ue.children||[]),ie.return=ae,ie)}function be(ae,ie,ue,xe,rt){return ie===null||ie.tag!==7?(ie=Yo(ue,ae.mode,xe,rt),ie.return=ae,ie):(ie=v(ie,ue),ie.return=ae,ie)}function Ce(ae,ie,ue){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return ie=Wg(""+ie,ae.mode,ue),ie.return=ae,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case w:return ue=Kh(ie.type,ie.key,ie.props,null,ae.mode,ue),Lu(ue,ie),ue.return=ae,ue;case S:return ie=qg(ie,ae.mode,ue),ie.return=ae,ie;case V:return ie=el(ie),Ce(ae,ie,ue)}if(D(ie)||P(ie))return ie=Yo(ie,ae.mode,ue,null),ie.return=ae,ie;if(typeof ie.then=="function")return Ce(ae,ef(ie),ue);if(ie.$$typeof===H)return Ce(ae,Xh(ae,ie),ue);tf(ae,ie)}return null}function fe(ae,ie,ue,xe){var rt=ie!==null?ie.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return rt!==null?null:F(ae,ie,""+ue,xe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:return ue.key===rt?ne(ae,ie,ue,xe):null;case S:return ue.key===rt?de(ae,ie,ue,xe):null;case V:return ue=el(ue),fe(ae,ie,ue,xe)}if(D(ue)||P(ue))return rt!==null?null:be(ae,ie,ue,xe,null);if(typeof ue.then=="function")return fe(ae,ie,ef(ue),xe);if(ue.$$typeof===H)return fe(ae,ie,Xh(ae,ue),xe);tf(ae,ue)}return null}function ye(ae,ie,ue,xe,rt){if(typeof xe=="string"&&xe!==""||typeof xe=="number"||typeof xe=="bigint")return ae=ae.get(ue)||null,F(ie,ae,""+xe,rt);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case w:return ae=ae.get(xe.key===null?ue:xe.key)||null,ne(ie,ae,xe,rt);case S:return ae=ae.get(xe.key===null?ue:xe.key)||null,de(ie,ae,xe,rt);case V:return xe=el(xe),ye(ae,ie,ue,xe,rt)}if(D(xe)||P(xe))return ae=ae.get(ue)||null,be(ie,ae,xe,rt,null);if(typeof xe.then=="function")return ye(ae,ie,ue,ef(xe),rt);if(xe.$$typeof===H)return ye(ae,ie,ue,Xh(ie,xe),rt);tf(ie,xe)}return null}function Ye(ae,ie,ue,xe){for(var rt=null,Jt=null,et=ie,Ot=ie=0,Gt=null;et!==null&&Ot<ue.length;Ot++){et.index>Ot?(Gt=et,et=null):Gt=et.sibling;var Qt=fe(ae,et,ue[Ot],xe);if(Qt===null){et===null&&(et=Gt);break}r&&et&&Qt.alternate===null&&a(ae,et),ie=b(Qt,ie,Ot),Jt===null?rt=Qt:Jt.sibling=Qt,Jt=Qt,et=Gt}if(Ot===ue.length)return u(ae,et),Vt&&oa(ae,Ot),rt;if(et===null){for(;Ot<ue.length;Ot++)et=Ce(ae,ue[Ot],xe),et!==null&&(ie=b(et,ie,Ot),Jt===null?rt=et:Jt.sibling=et,Jt=et);return Vt&&oa(ae,Ot),rt}for(et=h(et);Ot<ue.length;Ot++)Gt=ye(et,ae,Ot,ue[Ot],xe),Gt!==null&&(r&&Gt.alternate!==null&&et.delete(Gt.key===null?Ot:Gt.key),ie=b(Gt,ie,Ot),Jt===null?rt=Gt:Jt.sibling=Gt,Jt=Gt);return r&&et.forEach(function(ho){return a(ae,ho)}),Vt&&oa(ae,Ot),rt}function ft(ae,ie,ue,xe){if(ue==null)throw Error(i(151));for(var rt=null,Jt=null,et=ie,Ot=ie=0,Gt=null,Qt=ue.next();et!==null&&!Qt.done;Ot++,Qt=ue.next()){et.index>Ot?(Gt=et,et=null):Gt=et.sibling;var ho=fe(ae,et,Qt.value,xe);if(ho===null){et===null&&(et=Gt);break}r&&et&&ho.alternate===null&&a(ae,et),ie=b(ho,ie,Ot),Jt===null?rt=ho:Jt.sibling=ho,Jt=ho,et=Gt}if(Qt.done)return u(ae,et),Vt&&oa(ae,Ot),rt;if(et===null){for(;!Qt.done;Ot++,Qt=ue.next())Qt=Ce(ae,Qt.value,xe),Qt!==null&&(ie=b(Qt,ie,Ot),Jt===null?rt=Qt:Jt.sibling=Qt,Jt=Qt);return Vt&&oa(ae,Ot),rt}for(et=h(et);!Qt.done;Ot++,Qt=ue.next())Qt=ye(et,ae,Ot,Qt.value,xe),Qt!==null&&(r&&Qt.alternate!==null&&et.delete(Qt.key===null?Ot:Qt.key),ie=b(Qt,ie,Ot),Jt===null?rt=Qt:Jt.sibling=Qt,Jt=Qt);return r&&et.forEach(function(PD){return a(ae,PD)}),Vt&&oa(ae,Ot),rt}function vn(ae,ie,ue,xe){if(typeof ue=="object"&&ue!==null&&ue.type===x&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case w:e:{for(var rt=ue.key;ie!==null;){if(ie.key===rt){if(rt=ue.type,rt===x){if(ie.tag===7){u(ae,ie.sibling),xe=v(ie,ue.props.children),xe.return=ae,ae=xe;break e}}else if(ie.elementType===rt||typeof rt=="object"&&rt!==null&&rt.$$typeof===V&&el(rt)===ie.type){u(ae,ie.sibling),xe=v(ie,ue.props),Lu(xe,ue),xe.return=ae,ae=xe;break e}u(ae,ie);break}else a(ae,ie);ie=ie.sibling}ue.type===x?(xe=Yo(ue.props.children,ae.mode,xe,ue.key),xe.return=ae,ae=xe):(xe=Kh(ue.type,ue.key,ue.props,null,ae.mode,xe),Lu(xe,ue),xe.return=ae,ae=xe)}return A(ae);case S:e:{for(rt=ue.key;ie!==null;){if(ie.key===rt)if(ie.tag===4&&ie.stateNode.containerInfo===ue.containerInfo&&ie.stateNode.implementation===ue.implementation){u(ae,ie.sibling),xe=v(ie,ue.children||[]),xe.return=ae,ae=xe;break e}else{u(ae,ie);break}else a(ae,ie);ie=ie.sibling}xe=qg(ue,ae.mode,xe),xe.return=ae,ae=xe}return A(ae);case V:return ue=el(ue),vn(ae,ie,ue,xe)}if(D(ue))return Ye(ae,ie,ue,xe);if(P(ue)){if(rt=P(ue),typeof rt!="function")throw Error(i(150));return ue=rt.call(ue),ft(ae,ie,ue,xe)}if(typeof ue.then=="function")return vn(ae,ie,ef(ue),xe);if(ue.$$typeof===H)return vn(ae,ie,Xh(ae,ue),xe);tf(ae,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint"?(ue=""+ue,ie!==null&&ie.tag===6?(u(ae,ie.sibling),xe=v(ie,ue),xe.return=ae,ae=xe):(u(ae,ie),xe=Wg(ue,ae.mode,xe),xe.return=ae,ae=xe),A(ae)):u(ae,ie)}return function(ae,ie,ue,xe){try{Nu=0;var rt=vn(ae,ie,ue,xe);return Zl=null,rt}catch(et){if(et===Xl||et===Jh)throw et;var Jt=Cr(29,et,null,ae.mode);return Jt.lanes=xe,Jt.return=ae,Jt}}}var nl=Px(!0),$x=Px(!1),Va=!1;function iy(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ry(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 Ya(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Xa(r,a,u){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(sn&2)!==0){var v=h.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),h.pending=a,a=Gh(r),Sx(r,null,u),a}return qh(r,h,a,u),Gh(r)}function Ou(r,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=r.pendingLanes,u|=h,a.lanes=u,it(r,u)}}function sy(r,a){var u=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var v=null,b=null;if(u=u.firstBaseUpdate,u!==null){do{var A={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};b===null?v=b=A:b=b.next=A,u=u.next}while(u!==null);b===null?v=b=a:b=b.next=a}else v=b=a;u={baseState:h.baseState,firstBaseUpdate:v,lastBaseUpdate:b,shared:h.shared,callbacks:h.callbacks},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=a:r.next=a,u.lastBaseUpdate=a}var ay=!1;function Iu(){if(ay){var r=Yl;if(r!==null)throw r}}function ju(r,a,u,h){ay=!1;var v=r.updateQueue;Va=!1;var b=v.firstBaseUpdate,A=v.lastBaseUpdate,F=v.shared.pending;if(F!==null){v.shared.pending=null;var ne=F,de=ne.next;ne.next=null,A===null?b=de:A.next=de,A=ne;var be=r.alternate;be!==null&&(be=be.updateQueue,F=be.lastBaseUpdate,F!==A&&(F===null?be.firstBaseUpdate=de:F.next=de,be.lastBaseUpdate=ne))}if(b!==null){var Ce=v.baseState;A=0,be=de=ne=null,F=b;do{var fe=F.lane&-536870913,ye=fe!==F.lane;if(ye?(qt&fe)===fe:(h&fe)===fe){fe!==0&&fe===Vl&&(ay=!0),be!==null&&(be=be.next={lane:0,tag:F.tag,payload:F.payload,callback:null,next:null});e:{var Ye=r,ft=F;fe=a;var vn=u;switch(ft.tag){case 1:if(Ye=ft.payload,typeof Ye=="function"){Ce=Ye.call(vn,Ce,fe);break e}Ce=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=ft.payload,fe=typeof Ye=="function"?Ye.call(vn,Ce,fe):Ye,fe==null)break e;Ce=y({},Ce,fe);break e;case 2:Va=!0}}fe=F.callback,fe!==null&&(r.flags|=64,ye&&(r.flags|=8192),ye=v.callbacks,ye===null?v.callbacks=[fe]:ye.push(fe))}else ye={lane:fe,tag:F.tag,payload:F.payload,callback:F.callback,next:null},be===null?(de=be=ye,ne=Ce):be=be.next=ye,A|=fe;if(F=F.next,F===null){if(F=v.shared.pending,F===null)break;ye=F,F=ye.next,ye.next=null,v.lastBaseUpdate=ye,v.shared.pending=null}}while(!0);be===null&&(ne=Ce),v.baseState=ne,v.firstBaseUpdate=de,v.lastBaseUpdate=be,b===null&&(v.shared.lanes=0),to|=A,r.lanes=A,r.memoizedState=Ce}}function zx(r,a){if(typeof r!="function")throw Error(i(191,r));r.call(a)}function Fx(r,a){var u=r.callbacks;if(u!==null)for(r.callbacks=null,r=0;r<u.length;r++)zx(u[r],a)}var Jl=O(null),nf=O(0);function Hx(r,a){r=va,K(nf,r),K(Jl,a),va=r|a.baseLanes}function oy(){K(nf,va),K(Jl,Jl.current)}function ly(){va=nf.current,W(Jl),W(nf)}var Er=O(null),Kr=null;function Za(r){var a=r.alternate;K(Jn,Jn.current&1),K(Er,r),Kr===null&&(a===null||Jl.current!==null||a.memoizedState!==null)&&(Kr=r)}function cy(r){K(Jn,Jn.current),K(Er,r),Kr===null&&(Kr=r)}function Ux(r){r.tag===22?(K(Jn,Jn.current),K(Er,r),Kr===null&&(Kr=r)):Ja()}function Ja(){K(Jn,Jn.current),K(Er,Er.current)}function Ar(r){W(Er),Kr===r&&(Kr=null),W(Jn)}var Jn=O(0);function rf(r){for(var a=r;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||mv(u)||gv(u)))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 ua=0,Lt=null,gn=null,ai=null,sf=!1,Ql=!1,il=!1,af=0,Du=0,ec=null,T6=0;function Un(){throw Error(i(321))}function uy(r,a){if(a===null)return!1;for(var u=0;u<a.length&&u<r.length;u++)if(!kr(r[u],a[u]))return!1;return!0}function dy(r,a,u,h,v,b){return ua=b,Lt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,E.H=r===null||r.memoizedState===null?Ek:Ey,il=!1,b=u(h,v),il=!1,Ql&&(b=qx(a,u,h,v)),Wx(r),b}function Wx(r){E.H=$u;var a=gn!==null&&gn.next!==null;if(ua=0,ai=gn=Lt=null,sf=!1,Du=0,ec=null,a)throw Error(i(300));r===null||oi||(r=r.dependencies,r!==null&&Yh(r)&&(oi=!0))}function qx(r,a,u,h){Lt=r;var v=0;do{if(Ql&&(ec=null),Du=0,Ql=!1,25<=v)throw Error(i(301));if(v+=1,ai=gn=null,r.updateQueue!=null){var b=r.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}E.H=Ak,b=a(u,h)}while(Ql);return b}function R6(){var r=E.H,a=r.useState()[0];return a=typeof a.then=="function"?Bu(a):a,r=r.useState()[0],(gn!==null?gn.memoizedState:null)!==r&&(Lt.flags|=1024),a}function hy(){var r=af!==0;return af=0,r}function fy(r,a,u){a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~u}function py(r){if(sf){for(r=r.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}sf=!1}ua=0,ai=gn=Lt=null,Ql=!1,Du=af=0,ec=null}function Zi(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ai===null?Lt.memoizedState=ai=r:ai=ai.next=r,ai}function Qn(){if(gn===null){var r=Lt.alternate;r=r!==null?r.memoizedState:null}else r=gn.next;var a=ai===null?Lt.memoizedState:ai.next;if(a!==null)ai=a,gn=r;else{if(r===null)throw Lt.alternate===null?Error(i(467)):Error(i(310));gn=r,r={memoizedState:gn.memoizedState,baseState:gn.baseState,baseQueue:gn.baseQueue,queue:gn.queue,next:null},ai===null?Lt.memoizedState=ai=r:ai=ai.next=r}return ai}function of(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bu(r){var a=Du;return Du+=1,ec===null&&(ec=[]),r=jx(ec,r,a),a=Lt,(ai===null?a.memoizedState:ai.next)===null&&(a=a.alternate,E.H=a===null||a.memoizedState===null?Ek:Ey),r}function lf(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Bu(r);if(r.$$typeof===H)return Bi(r)}throw Error(i(438,String(r)))}function my(r){var a=null,u=Lt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=Lt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(v){return v.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=of(),Lt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(r),h=0;h<r;h++)u[h]=te;return a.index++,u}function da(r,a){return typeof a=="function"?a(r):a}function cf(r){var a=Qn();return gy(a,gn,r)}function gy(r,a,u){var h=r.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=u;var v=r.baseQueue,b=h.pending;if(b!==null){if(v!==null){var A=v.next;v.next=b.next,b.next=A}a.baseQueue=v=b,h.pending=null}if(b=r.baseState,v===null)r.memoizedState=b;else{a=v.next;var F=A=null,ne=null,de=a,be=!1;do{var Ce=de.lane&-536870913;if(Ce!==de.lane?(qt&Ce)===Ce:(ua&Ce)===Ce){var fe=de.revertLane;if(fe===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null}),Ce===Vl&&(be=!0);else if((ua&fe)===fe){de=de.next,fe===Vl&&(be=!0);continue}else Ce={lane:0,revertLane:de.revertLane,gesture:null,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},ne===null?(F=ne=Ce,A=b):ne=ne.next=Ce,Lt.lanes|=fe,to|=fe;Ce=de.action,il&&u(b,Ce),b=de.hasEagerState?de.eagerState:u(b,Ce)}else fe={lane:Ce,revertLane:de.revertLane,gesture:de.gesture,action:de.action,hasEagerState:de.hasEagerState,eagerState:de.eagerState,next:null},ne===null?(F=ne=fe,A=b):ne=ne.next=fe,Lt.lanes|=Ce,to|=Ce;de=de.next}while(de!==null&&de!==a);if(ne===null?A=b:ne.next=F,!kr(b,r.memoizedState)&&(oi=!0,be&&(u=Yl,u!==null)))throw u;r.memoizedState=b,r.baseState=A,r.baseQueue=ne,h.lastRenderedState=b}return v===null&&(h.lanes=0),[r.memoizedState,h.dispatch]}function yy(r){var a=Qn(),u=a.queue;if(u===null)throw Error(i(311));u.lastRenderedReducer=r;var h=u.dispatch,v=u.pending,b=a.memoizedState;if(v!==null){u.pending=null;var A=v=v.next;do b=r(b,A.action),A=A.next;while(A!==v);kr(b,a.memoizedState)||(oi=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),u.lastRenderedState=b}return[b,h]}function Gx(r,a,u){var h=Lt,v=Qn(),b=Vt;if(b){if(u===void 0)throw Error(i(407));u=u()}else u=a();var A=!kr((gn||v).memoizedState,u);if(A&&(v.memoizedState=u,oi=!0),v=v.queue,by(Yx.bind(null,h,v,r),[r]),v.getSnapshot!==a||A||ai!==null&&ai.memoizedState.tag&1){if(h.flags|=2048,tc(9,{destroy:void 0},Vx.bind(null,h,v,u,a),null),kn===null)throw Error(i(349));b||(ua&127)!==0||Kx(h,a,u)}return u}function Kx(r,a,u){r.flags|=16384,r={getSnapshot:a,value:u},a=Lt.updateQueue,a===null?(a=of(),Lt.updateQueue=a,a.stores=[r]):(u=a.stores,u===null?a.stores=[r]:u.push(r))}function Vx(r,a,u,h){a.value=u,a.getSnapshot=h,Xx(a)&&Zx(r)}function Yx(r,a,u){return u(function(){Xx(a)&&Zx(r)})}function Xx(r){var a=r.getSnapshot;r=r.value;try{var u=a();return!kr(r,u)}catch{return!0}}function Zx(r){var a=Vo(r,2);a!==null&&mr(a,r,2)}function vy(r){var a=Zi();if(typeof r=="function"){var u=r;if(r=u(),il){bt(!0);try{u()}finally{bt(!1)}}}return a.memoizedState=a.baseState=r,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:r},a}function Jx(r,a,u,h){return r.baseState=u,gy(r,gn,typeof h=="function"?h:da)}function M6(r,a,u,h,v){if(hf(r))throw Error(i(485));if(r=a.action,r!==null){var b={payload:v,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){b.listeners.push(A)}};E.T!==null?u(!0):b.isTransition=!1,h(b),u=a.pending,u===null?(b.next=a.pending=b,Qx(a,b)):(b.next=u.next,a.pending=u.next=b)}}function Qx(r,a){var u=a.action,h=a.payload,v=r.state;if(a.isTransition){var b=E.T,A={};E.T=A;try{var F=u(v,h),ne=E.S;ne!==null&&ne(A,F),ek(r,a,F)}catch(de){_y(r,a,de)}finally{b!==null&&A.types!==null&&(b.types=A.types),E.T=b}}else try{b=u(v,h),ek(r,a,b)}catch(de){_y(r,a,de)}}function ek(r,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){tk(r,a,h)},function(h){return _y(r,a,h)}):tk(r,a,u)}function tk(r,a,u){a.status="fulfilled",a.value=u,nk(a),r.state=u,a=r.pending,a!==null&&(u=a.next,u===a?r.pending=null:(u=u.next,a.next=u,Qx(r,u)))}function _y(r,a,u){var h=r.pending;if(r.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,nk(a),a=a.next;while(a!==h)}r.action=null}function nk(r){r=r.listeners;for(var a=0;a<r.length;a++)(0,r[a])()}function ik(r,a){return a}function rk(r,a){if(Vt){var u=kn.formState;if(u!==null){e:{var h=Lt;if(Vt){if(An){t:{for(var v=An,b=Gr;v.nodeType!==8;){if(!b){v=null;break t}if(v=Vr(v.nextSibling),v===null){v=null;break t}}b=v.data,v=b==="F!"||b==="F"?v:null}if(v){An=Vr(v.nextSibling),h=v.data==="F!";break e}}Ga(h)}h=!1}h&&(a=u[0])}}return u=Zi(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ik,lastRenderedState:a},u.queue=h,u=xk.bind(null,Lt,h),h.dispatch=u,h=vy(!1),b=Cy.bind(null,Lt,!1,h.queue),h=Zi(),v={state:a,dispatch:null,action:r,pending:null},h.queue=v,u=M6.bind(null,Lt,v,b,u),v.dispatch=u,h.memoizedState=r,[a,u,!1]}function sk(r){var a=Qn();return ak(a,gn,r)}function ak(r,a,u){if(a=gy(r,a,ik)[0],r=cf(da)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Bu(a)}catch(A){throw A===Xl?Jh:A}else h=a;a=Qn();var v=a.queue,b=v.dispatch;return u!==a.memoizedState&&(Lt.flags|=2048,tc(9,{destroy:void 0},N6.bind(null,v,u),null)),[h,b,r]}function N6(r,a){r.action=a}function ok(r){var a=Qn(),u=gn;if(u!==null)return ak(a,u,r);Qn(),a=a.memoizedState,u=Qn();var h=u.queue.dispatch;return u.memoizedState=r,[a,h,!1]}function tc(r,a,u,h){return r={tag:r,create:u,deps:h,inst:a,next:null},a=Lt.updateQueue,a===null&&(a=of(),Lt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=r.next=r:(h=u.next,u.next=r,r.next=h,a.lastEffect=r),r}function lk(){return Qn().memoizedState}function uf(r,a,u,h){var v=Zi();Lt.flags|=r,v.memoizedState=tc(1|a,{destroy:void 0},u,h===void 0?null:h)}function df(r,a,u,h){var v=Qn();h=h===void 0?null:h;var b=v.memoizedState.inst;gn!==null&&h!==null&&uy(h,gn.memoizedState.deps)?v.memoizedState=tc(a,b,u,h):(Lt.flags|=r,v.memoizedState=tc(1|a,b,u,h))}function ck(r,a){uf(8390656,8,r,a)}function by(r,a){df(2048,8,r,a)}function L6(r){Lt.flags|=4;var a=Lt.updateQueue;if(a===null)a=of(),Lt.updateQueue=a,a.events=[r];else{var u=a.events;u===null?a.events=[r]:u.push(r)}}function uk(r){var a=Qn().memoizedState;return L6({ref:a,nextImpl:r}),function(){if((sn&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}function dk(r,a){return df(4,2,r,a)}function hk(r,a){return df(4,4,r,a)}function fk(r,a){if(typeof a=="function"){r=r();var u=a(r);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function pk(r,a,u){u=u!=null?u.concat([r]):null,df(4,4,fk.bind(null,a,r),u)}function wy(){}function mk(r,a){var u=Qn();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&uy(a,h[1])?h[0]:(u.memoizedState=[r,a],r)}function gk(r,a){var u=Qn();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&uy(a,h[1]))return h[0];if(h=r(),il){bt(!0);try{r()}finally{bt(!1)}}return u.memoizedState=[h,a],h}function Sy(r,a,u){return u===void 0||(ua&1073741824)!==0&&(qt&261930)===0?r.memoizedState=a:(r.memoizedState=u,r=yC(),Lt.lanes|=r,to|=r,u)}function yk(r,a,u,h){return kr(u,a)?u:Jl.current!==null?(r=Sy(r,u,h),kr(r,a)||(oi=!0),r):(ua&42)===0||(ua&1073741824)!==0&&(qt&261930)===0?(oi=!0,r.memoizedState=u):(r=yC(),Lt.lanes|=r,to|=r,a)}function vk(r,a,u,h,v){var b=L.p;L.p=b!==0&&8>b?b:8;var A=E.T,F={};E.T=F,Cy(r,!1,a,u);try{var ne=v(),de=E.S;if(de!==null&&de(F,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var be=A6(ne,h);Pu(r,a,be,Mr(r))}else Pu(r,a,h,Mr(r))}catch(Ce){Pu(r,a,{then:function(){},status:"rejected",reason:Ce},Mr())}finally{L.p=b,A!==null&&F.types!==null&&(A.types=F.types),E.T=A}}function O6(){}function xy(r,a,u,h){if(r.tag!==5)throw Error(i(476));var v=_k(r).queue;vk(r,v,a,R,u===null?O6:function(){return bk(r),u(h)})}function _k(r){var a=r.memoizedState;if(a!==null)return a;a={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:R},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:u},next:null},r.memoizedState=a,r=r.alternate,r!==null&&(r.memoizedState=a),a}function bk(r){var a=_k(r);a.next===null&&(a=r.alternate.memoizedState),Pu(r,a.next.queue,{},Mr())}function ky(){return Bi(td)}function wk(){return Qn().memoizedState}function Sk(){return Qn().memoizedState}function I6(r){for(var a=r.return;a!==null;){switch(a.tag){case 24:case 3:var u=Mr();r=Ya(u);var h=Xa(a,r,u);h!==null&&(mr(h,a,u),Ou(h,a,u)),a={cache:Qg()},r.payload=a;return}a=a.return}}function j6(r,a,u){var h=Mr();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},hf(r)?kk(a,u):(u=Hg(r,a,u,h),u!==null&&(mr(u,r,h),Ck(u,a,h)))}function xk(r,a,u){var h=Mr();Pu(r,a,u,h)}function Pu(r,a,u,h){var v={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(hf(r))kk(a,v);else{var b=r.alternate;if(r.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var A=a.lastRenderedState,F=b(A,u);if(v.hasEagerState=!0,v.eagerState=F,kr(F,A))return qh(r,a,v,0),kn===null&&Wh(),!1}catch{}if(u=Hg(r,a,v,h),u!==null)return mr(u,r,h),Ck(u,a,h),!0}return!1}function Cy(r,a,u,h){if(h={lane:2,revertLane:iv(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},hf(r)){if(a)throw Error(i(479))}else a=Hg(r,u,h,2),a!==null&&mr(a,r,2)}function hf(r){var a=r.alternate;return r===Lt||a!==null&&a===Lt}function kk(r,a){Ql=sf=!0;var u=r.pending;u===null?a.next=a:(a.next=u.next,u.next=a),r.pending=a}function Ck(r,a,u){if((u&4194048)!==0){var h=a.lanes;h&=r.pendingLanes,u|=h,a.lanes=u,it(r,u)}}var $u={readContext:Bi,use:lf,useCallback:Un,useContext:Un,useEffect:Un,useImperativeHandle:Un,useLayoutEffect:Un,useInsertionEffect:Un,useMemo:Un,useReducer:Un,useRef:Un,useState:Un,useDebugValue:Un,useDeferredValue:Un,useTransition:Un,useSyncExternalStore:Un,useId:Un,useHostTransitionStatus:Un,useFormState:Un,useActionState:Un,useOptimistic:Un,useMemoCache:Un,useCacheRefresh:Un};$u.useEffectEvent=Un;var Ek={readContext:Bi,use:lf,useCallback:function(r,a){return Zi().memoizedState=[r,a===void 0?null:a],r},useContext:Bi,useEffect:ck,useImperativeHandle:function(r,a,u){u=u!=null?u.concat([r]):null,uf(4194308,4,fk.bind(null,a,r),u)},useLayoutEffect:function(r,a){return uf(4194308,4,r,a)},useInsertionEffect:function(r,a){uf(4,2,r,a)},useMemo:function(r,a){var u=Zi();a=a===void 0?null:a;var h=r();if(il){bt(!0);try{r()}finally{bt(!1)}}return u.memoizedState=[h,a],h},useReducer:function(r,a,u){var h=Zi();if(u!==void 0){var v=u(a);if(il){bt(!0);try{u(a)}finally{bt(!1)}}}else v=a;return h.memoizedState=h.baseState=v,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:v},h.queue=r,r=r.dispatch=j6.bind(null,Lt,r),[h.memoizedState,r]},useRef:function(r){var a=Zi();return r={current:r},a.memoizedState=r},useState:function(r){r=vy(r);var a=r.queue,u=xk.bind(null,Lt,a);return a.dispatch=u,[r.memoizedState,u]},useDebugValue:wy,useDeferredValue:function(r,a){var u=Zi();return Sy(u,r,a)},useTransition:function(){var r=vy(!1);return r=vk.bind(null,Lt,r.queue,!0,!1),Zi().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,a,u){var h=Lt,v=Zi();if(Vt){if(u===void 0)throw Error(i(407));u=u()}else{if(u=a(),kn===null)throw Error(i(349));(qt&127)!==0||Kx(h,a,u)}v.memoizedState=u;var b={value:u,getSnapshot:a};return v.queue=b,ck(Yx.bind(null,h,b,r),[r]),h.flags|=2048,tc(9,{destroy:void 0},Vx.bind(null,h,b,u,a),null),u},useId:function(){var r=Zi(),a=kn.identifierPrefix;if(Vt){var u=Ls,h=Ns;u=(h&~(1<<32-Nt(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=af++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=T6++,a="_"+a+"r_"+u.toString(32)+"_";return r.memoizedState=a},useHostTransitionStatus:ky,useFormState:rk,useActionState:rk,useOptimistic:function(r){var a=Zi();a.memoizedState=a.baseState=r;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Cy.bind(null,Lt,!0,u),u.dispatch=a,[r,a]},useMemoCache:my,useCacheRefresh:function(){return Zi().memoizedState=I6.bind(null,Lt)},useEffectEvent:function(r){var a=Zi(),u={impl:r};return a.memoizedState=u,function(){if((sn&2)!==0)throw Error(i(440));return u.impl.apply(void 0,arguments)}}},Ey={readContext:Bi,use:lf,useCallback:mk,useContext:Bi,useEffect:by,useImperativeHandle:pk,useInsertionEffect:dk,useLayoutEffect:hk,useMemo:gk,useReducer:cf,useRef:lk,useState:function(){return cf(da)},useDebugValue:wy,useDeferredValue:function(r,a){var u=Qn();return yk(u,gn.memoizedState,r,a)},useTransition:function(){var r=cf(da)[0],a=Qn().memoizedState;return[typeof r=="boolean"?r:Bu(r),a]},useSyncExternalStore:Gx,useId:wk,useHostTransitionStatus:ky,useFormState:sk,useActionState:sk,useOptimistic:function(r,a){var u=Qn();return Jx(u,gn,r,a)},useMemoCache:my,useCacheRefresh:Sk};Ey.useEffectEvent=uk;var Ak={readContext:Bi,use:lf,useCallback:mk,useContext:Bi,useEffect:by,useImperativeHandle:pk,useInsertionEffect:dk,useLayoutEffect:hk,useMemo:gk,useReducer:yy,useRef:lk,useState:function(){return yy(da)},useDebugValue:wy,useDeferredValue:function(r,a){var u=Qn();return gn===null?Sy(u,r,a):yk(u,gn.memoizedState,r,a)},useTransition:function(){var r=yy(da)[0],a=Qn().memoizedState;return[typeof r=="boolean"?r:Bu(r),a]},useSyncExternalStore:Gx,useId:wk,useHostTransitionStatus:ky,useFormState:ok,useActionState:ok,useOptimistic:function(r,a){var u=Qn();return gn!==null?Jx(u,gn,r,a):(u.baseState=r,[r,u.queue.dispatch])},useMemoCache:my,useCacheRefresh:Sk};Ak.useEffectEvent=uk;function Ay(r,a,u,h){a=r.memoizedState,u=u(h,a),u=u==null?a:y({},a,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var Ty={enqueueSetState:function(r,a,u){r=r._reactInternals;var h=Mr(),v=Ya(h);v.payload=a,u!=null&&(v.callback=u),a=Xa(r,v,h),a!==null&&(mr(a,r,h),Ou(a,r,h))},enqueueReplaceState:function(r,a,u){r=r._reactInternals;var h=Mr(),v=Ya(h);v.tag=1,v.payload=a,u!=null&&(v.callback=u),a=Xa(r,v,h),a!==null&&(mr(a,r,h),Ou(a,r,h))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var u=Mr(),h=Ya(u);h.tag=2,a!=null&&(h.callback=a),a=Xa(r,h,u),a!==null&&(mr(a,r,u),Ou(a,r,u))}};function Tk(r,a,u,h,v,b,A){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(h,b,A):a.prototype&&a.prototype.isPureReactComponent?!Cu(u,h)||!Cu(v,b):!0}function Rk(r,a,u,h){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==r&&Ty.enqueueReplaceState(a,a.state,null)}function rl(r,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(r=r.defaultProps){u===a&&(u=y({},u));for(var v in r)u[v]===void 0&&(u[v]=r[v])}return u}function Mk(r){Uh(r)}function Nk(r){console.error(r)}function Lk(r){Uh(r)}function ff(r,a){try{var u=r.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function Ok(r,a,u){try{var h=r.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Ry(r,a,u){return u=Ya(u),u.tag=3,u.payload={element:null},u.callback=function(){ff(r,a)},u}function Ik(r){return r=Ya(r),r.tag=3,r}function jk(r,a,u,h){var v=u.type.getDerivedStateFromError;if(typeof v=="function"){var b=h.value;r.payload=function(){return v(b)},r.callback=function(){Ok(a,u,h)}}var A=u.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(r.callback=function(){Ok(a,u,h),typeof v!="function"&&(no===null?no=new Set([this]):no.add(this));var F=h.stack;this.componentDidCatch(h.value,{componentStack:F!==null?F:""})})}function D6(r,a,u,h,v){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&Kl(a,u,v,!0),u=Er.current,u!==null){switch(u.tag){case 31:case 13:return Kr===null?Cf():u.alternate===null&&Wn===0&&(Wn=3),u.flags&=-257,u.flags|=65536,u.lanes=v,h===Qh?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),ev(r,h,v)),!1;case 22:return u.flags|=65536,h===Qh?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),ev(r,h,v)),!1}throw Error(i(435,u.tag))}return ev(r,h,v),Cf(),!1}if(Vt)return a=Er.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=v,h!==Vg&&(r=Error(i(422),{cause:h}),Tu(Ur(r,u)))):(h!==Vg&&(a=Error(i(423),{cause:h}),Tu(Ur(a,u))),r=r.current.alternate,r.flags|=65536,v&=-v,r.lanes|=v,h=Ur(h,u),v=Ry(r.stateNode,h,v),sy(r,v),Wn!==4&&(Wn=2)),!1;var b=Error(i(520),{cause:h});if(b=Ur(b,u),Ku===null?Ku=[b]:Ku.push(b),Wn!==4&&(Wn=2),a===null)return!0;h=Ur(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,r=v&-v,u.lanes|=r,r=Ry(u.stateNode,h,r),sy(u,r),!1;case 1:if(a=u.type,b=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(no===null||!no.has(b))))return u.flags|=65536,v&=-v,u.lanes|=v,v=Ik(v),jk(v,r,u,h),sy(u,v),!1}u=u.return}while(u!==null);return!1}var My=Error(i(461)),oi=!1;function Pi(r,a,u,h){a.child=r===null?$x(a,null,u,h):nl(a,r.child,u,h)}function Dk(r,a,u,h,v){u=u.render;var b=a.ref;if("ref"in h){var A={};for(var F in h)F!=="ref"&&(A[F]=h[F])}else A=h;return Jo(a),h=dy(r,a,u,A,b,v),F=hy(),r!==null&&!oi?(fy(r,a,v),ha(r,a,v)):(Vt&&F&&Gg(a),a.flags|=1,Pi(r,a,h,v),a.child)}function Bk(r,a,u,h,v){if(r===null){var b=u.type;return typeof b=="function"&&!Ug(b)&&b.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=b,Pk(r,a,b,h,v)):(r=Kh(u.type,null,h,a,a.mode,v),r.ref=a.ref,r.return=a,a.child=r)}if(b=r.child,!Py(r,v)){var A=b.memoizedProps;if(u=u.compare,u=u!==null?u:Cu,u(A,h)&&r.ref===a.ref)return ha(r,a,v)}return a.flags|=1,r=aa(b,h),r.ref=a.ref,r.return=a,a.child=r}function Pk(r,a,u,h,v){if(r!==null){var b=r.memoizedProps;if(Cu(b,h)&&r.ref===a.ref)if(oi=!1,a.pendingProps=h=b,Py(r,v))(r.flags&131072)!==0&&(oi=!0);else return a.lanes=r.lanes,ha(r,a,v)}return Ny(r,a,u,h,v)}function $k(r,a,u,h){var v=h.children,b=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(b=b!==null?b.baseLanes|u:u,r!==null){for(h=a.child=r.child,v=0;h!==null;)v=v|h.lanes|h.childLanes,h=h.sibling;h=v&~b}else h=0,a.child=null;return zk(r,a,b,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},r!==null&&Zh(a,b!==null?b.cachePool:null),b!==null?Hx(a,b):oy(),Ux(a);else return h=a.lanes=536870912,zk(r,a,b!==null?b.baseLanes|u:u,u,h)}else b!==null?(Zh(a,b.cachePool),Hx(a,b),Ja(),a.memoizedState=null):(r!==null&&Zh(a,null),oy(),Ja());return Pi(r,a,v,u),a.child}function zu(r,a){return r!==null&&r.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function zk(r,a,u,h,v){var b=ty();return b=b===null?null:{parent:si._currentValue,pool:b},a.memoizedState={baseLanes:u,cachePool:b},r!==null&&Zh(a,null),oy(),Ux(a),r!==null&&Kl(r,a,h,!0),a.childLanes=v,null}function pf(r,a){return a=gf({mode:a.mode,children:a.children},r.mode),a.ref=r.ref,r.child=a,a.return=r,a}function Fk(r,a,u){return nl(a,r.child,null,u),r=pf(a,a.pendingProps),r.flags|=2,Ar(a),a.memoizedState=null,r}function B6(r,a,u){var h=a.pendingProps,v=(a.flags&128)!==0;if(a.flags&=-129,r===null){if(Vt){if(h.mode==="hidden")return r=pf(a,h),a.lanes=536870912,zu(null,r);if(cy(a),(r=An)?(r=QC(r,Gr),r=r!==null&&r.data==="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Ns,overflow:Ls}:null,retryLane:536870912,hydrationErrors:null},u=kx(r),u.return=a,a.child=u,Di=a,An=null)):r=null,r===null)throw Ga(a);return a.lanes=536870912,null}return pf(a,h)}var b=r.memoizedState;if(b!==null){var A=b.dehydrated;if(cy(a),v)if(a.flags&256)a.flags&=-257,a=Fk(r,a,u);else if(a.memoizedState!==null)a.child=r.child,a.flags|=128,a=null;else throw Error(i(558));else if(oi||Kl(r,a,u,!1),v=(u&r.childLanes)!==0,oi||v){if(h=kn,h!==null&&(A=Zt(h,u),A!==0&&A!==b.retryLane))throw b.retryLane=A,Vo(r,A),mr(h,r,A),My;Cf(),a=Fk(r,a,u)}else r=b.treeContext,An=Vr(A.nextSibling),Di=a,Vt=!0,qa=null,Gr=!1,r!==null&&Ax(a,r),a=pf(a,h),a.flags|=4096;return a}return r=aa(r.child,{mode:h.mode,children:h.children}),r.ref=a.ref,a.child=r,r.return=a,r}function mf(r,a){var u=a.ref;if(u===null)r!==null&&r.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(i(284));(r===null||r.ref!==u)&&(a.flags|=4194816)}}function Ny(r,a,u,h,v){return Jo(a),u=dy(r,a,u,h,void 0,v),h=hy(),r!==null&&!oi?(fy(r,a,v),ha(r,a,v)):(Vt&&h&&Gg(a),a.flags|=1,Pi(r,a,u,v),a.child)}function Hk(r,a,u,h,v,b){return Jo(a),a.updateQueue=null,u=qx(a,h,u,v),Wx(r),h=hy(),r!==null&&!oi?(fy(r,a,b),ha(r,a,b)):(Vt&&h&&Gg(a),a.flags|=1,Pi(r,a,u,b),a.child)}function Uk(r,a,u,h,v){if(Jo(a),a.stateNode===null){var b=Ul,A=u.contextType;typeof A=="object"&&A!==null&&(b=Bi(A)),b=new u(h,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=Ty,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=h,b.state=a.memoizedState,b.refs={},iy(a),A=u.contextType,b.context=typeof A=="object"&&A!==null?Bi(A):Ul,b.state=a.memoizedState,A=u.getDerivedStateFromProps,typeof A=="function"&&(Ay(a,u,A,h),b.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(A=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),A!==b.state&&Ty.enqueueReplaceState(b,b.state,null),ju(a,h,b,v),Iu(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(r===null){b=a.stateNode;var F=a.memoizedProps,ne=rl(u,F);b.props=ne;var de=b.context,be=u.contextType;A=Ul,typeof be=="object"&&be!==null&&(A=Bi(be));var Ce=u.getDerivedStateFromProps;be=typeof Ce=="function"||typeof b.getSnapshotBeforeUpdate=="function",F=a.pendingProps!==F,be||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(F||de!==A)&&Rk(a,b,h,A),Va=!1;var fe=a.memoizedState;b.state=fe,ju(a,h,b,v),Iu(),de=a.memoizedState,F||fe!==de||Va?(typeof Ce=="function"&&(Ay(a,u,Ce,h),de=a.memoizedState),(ne=Va||Tk(a,u,ne,h,fe,de,A))?(be||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=de),b.props=h,b.state=de,b.context=A,h=ne):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{b=a.stateNode,ry(r,a),A=a.memoizedProps,be=rl(u,A),b.props=be,Ce=a.pendingProps,fe=b.context,de=u.contextType,ne=Ul,typeof de=="object"&&de!==null&&(ne=Bi(de)),F=u.getDerivedStateFromProps,(de=typeof F=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(A!==Ce||fe!==ne)&&Rk(a,b,h,ne),Va=!1,fe=a.memoizedState,b.state=fe,ju(a,h,b,v),Iu();var ye=a.memoizedState;A!==Ce||fe!==ye||Va||r!==null&&r.dependencies!==null&&Yh(r.dependencies)?(typeof F=="function"&&(Ay(a,u,F,h),ye=a.memoizedState),(be=Va||Tk(a,u,be,h,fe,ye,ne)||r!==null&&r.dependencies!==null&&Yh(r.dependencies))?(de||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(h,ye,ne),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(h,ye,ne)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||A===r.memoizedProps&&fe===r.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||A===r.memoizedProps&&fe===r.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=ye),b.props=h,b.state=ye,b.context=ne,h=be):(typeof b.componentDidUpdate!="function"||A===r.memoizedProps&&fe===r.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||A===r.memoizedProps&&fe===r.memoizedState||(a.flags|=1024),h=!1)}return b=h,mf(r,a),h=(a.flags&128)!==0,b||h?(b=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,r!==null&&h?(a.child=nl(a,r.child,null,v),a.child=nl(a,null,u,v)):Pi(r,a,u,v),a.memoizedState=b.state,r=a.child):r=ha(r,a,v),r}function Wk(r,a,u,h){return Xo(),a.flags|=256,Pi(r,a,u,h),a.child}var Ly={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oy(r){return{baseLanes:r,cachePool:Ox()}}function Iy(r,a,u){return r=r!==null?r.childLanes&~u:0,a&&(r|=Rr),r}function qk(r,a,u){var h=a.pendingProps,v=!1,b=(a.flags&128)!==0,A;if((A=b)||(A=r!==null&&r.memoizedState===null?!1:(Jn.current&2)!==0),A&&(v=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,r===null){if(Vt){if(v?Za(a):Ja(),(r=An)?(r=QC(r,Gr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(a.memoizedState={dehydrated:r,treeContext:Wa!==null?{id:Ns,overflow:Ls}:null,retryLane:536870912,hydrationErrors:null},u=kx(r),u.return=a,a.child=u,Di=a,An=null)):r=null,r===null)throw Ga(a);return gv(r)?a.lanes=32:a.lanes=536870912,null}var F=h.children;return h=h.fallback,v?(Ja(),v=a.mode,F=gf({mode:"hidden",children:F},v),h=Yo(h,v,u,null),F.return=a,h.return=a,F.sibling=h,a.child=F,h=a.child,h.memoizedState=Oy(u),h.childLanes=Iy(r,A,u),a.memoizedState=Ly,zu(null,h)):(Za(a),jy(a,F))}var ne=r.memoizedState;if(ne!==null&&(F=ne.dehydrated,F!==null)){if(b)a.flags&256?(Za(a),a.flags&=-257,a=Dy(r,a,u)):a.memoizedState!==null?(Ja(),a.child=r.child,a.flags|=128,a=null):(Ja(),F=h.fallback,v=a.mode,h=gf({mode:"visible",children:h.children},v),F=Yo(F,v,u,null),F.flags|=2,h.return=a,F.return=a,h.sibling=F,a.child=h,nl(a,r.child,null,u),h=a.child,h.memoizedState=Oy(u),h.childLanes=Iy(r,A,u),a.memoizedState=Ly,a=zu(null,h));else if(Za(a),gv(F)){if(A=F.nextSibling&&F.nextSibling.dataset,A)var de=A.dgst;A=de,h=Error(i(419)),h.stack="",h.digest=A,Tu({value:h,source:null,stack:null}),a=Dy(r,a,u)}else if(oi||Kl(r,a,u,!1),A=(u&r.childLanes)!==0,oi||A){if(A=kn,A!==null&&(h=Zt(A,u),h!==0&&h!==ne.retryLane))throw ne.retryLane=h,Vo(r,h),mr(A,r,h),My;mv(F)||Cf(),a=Dy(r,a,u)}else mv(F)?(a.flags|=192,a.child=r.child,a=null):(r=ne.treeContext,An=Vr(F.nextSibling),Di=a,Vt=!0,qa=null,Gr=!1,r!==null&&Ax(a,r),a=jy(a,h.children),a.flags|=4096);return a}return v?(Ja(),F=h.fallback,v=a.mode,ne=r.child,de=ne.sibling,h=aa(ne,{mode:"hidden",children:h.children}),h.subtreeFlags=ne.subtreeFlags&65011712,de!==null?F=aa(de,F):(F=Yo(F,v,u,null),F.flags|=2),F.return=a,h.return=a,h.sibling=F,a.child=h,zu(null,h),h=a.child,F=r.child.memoizedState,F===null?F=Oy(u):(v=F.cachePool,v!==null?(ne=si._currentValue,v=v.parent!==ne?{parent:ne,pool:ne}:v):v=Ox(),F={baseLanes:F.baseLanes|u,cachePool:v}),h.memoizedState=F,h.childLanes=Iy(r,A,u),a.memoizedState=Ly,zu(r.child,h)):(Za(a),u=r.child,r=u.sibling,u=aa(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,r!==null&&(A=a.deletions,A===null?(a.deletions=[r],a.flags|=16):A.push(r)),a.child=u,a.memoizedState=null,u)}function jy(r,a){return a=gf({mode:"visible",children:a},r.mode),a.return=r,r.child=a}function gf(r,a){return r=Cr(22,r,null,a),r.lanes=0,r}function Dy(r,a,u){return nl(a,r.child,null,u),r=jy(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function Gk(r,a,u){r.lanes|=a;var h=r.alternate;h!==null&&(h.lanes|=a),Zg(r.return,a,u)}function By(r,a,u,h,v,b){var A=r.memoizedState;A===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:v,treeForkCount:b}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=h,A.tail=u,A.tailMode=v,A.treeForkCount=b)}function Kk(r,a,u){var h=a.pendingProps,v=h.revealOrder,b=h.tail;h=h.children;var A=Jn.current,F=(A&2)!==0;if(F?(A=A&1|2,a.flags|=128):A&=1,K(Jn,A),Pi(r,a,h,u),h=Vt?Au:0,!F&&r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Gk(r,u,a);else if(r.tag===19)Gk(r,u,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(v){case"forwards":for(u=a.child,v=null;u!==null;)r=u.alternate,r!==null&&rf(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=a.child,a.child=null):(v=u.sibling,u.sibling=null),By(a,!1,v,u,b,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,v=a.child,a.child=null;v!==null;){if(r=v.alternate,r!==null&&rf(r)===null){a.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}By(a,!0,u,null,b,h);break;case"together":By(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function ha(r,a,u){if(r!==null&&(a.dependencies=r.dependencies),to|=a.lanes,(u&a.childLanes)===0)if(r!==null){if(Kl(r,a,u,!1),(u&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,u=aa(r,r.pendingProps),a.child=u,u.return=a;r.sibling!==null;)r=r.sibling,u=u.sibling=aa(r,r.pendingProps),u.return=a;u.sibling=null}return a.child}function Py(r,a){return(r.lanes&a)!==0?!0:(r=r.dependencies,!!(r!==null&&Yh(r)))}function P6(r,a,u){switch(a.tag){case 3:Se(a,a.stateNode.containerInfo),Ka(a,si,r.memoizedState.cache),Xo();break;case 27:case 5:$e(a);break;case 4:Se(a,a.stateNode.containerInfo);break;case 10:Ka(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,cy(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(Za(a),a.flags|=128,null):(u&a.child.childLanes)!==0?qk(r,a,u):(Za(a),r=ha(r,a,u),r!==null?r.sibling:null);Za(a);break;case 19:var v=(r.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(Kl(r,a,u,!1),h=(u&a.childLanes)!==0),v){if(h)return Kk(r,a,u);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),K(Jn,Jn.current),h)break;return null;case 22:return a.lanes=0,$k(r,a,u,a.pendingProps);case 24:Ka(a,si,r.memoizedState.cache)}return ha(r,a,u)}function Vk(r,a,u){if(r!==null)if(r.memoizedProps!==a.pendingProps)oi=!0;else{if(!Py(r,u)&&(a.flags&128)===0)return oi=!1,P6(r,a,u);oi=(r.flags&131072)!==0}else oi=!1,Vt&&(a.flags&1048576)!==0&&Ex(a,Au,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(r=el(a.elementType),a.type=r,typeof r=="function")Ug(r)?(h=rl(r,h),a.tag=1,a=Uk(null,a,r,h,u)):(a.tag=0,a=Ny(null,a,r,h,u));else{if(r!=null){var v=r.$$typeof;if(v===T){a.tag=11,a=Dk(null,a,r,h,u);break e}else if(v===M){a.tag=14,a=Bk(null,a,r,h,u);break e}}throw a=I(r)||r,Error(i(306,a,""))}}return a;case 0:return Ny(r,a,a.type,a.pendingProps,u);case 1:return h=a.type,v=rl(h,a.pendingProps),Uk(r,a,h,v,u);case 3:e:{if(Se(a,a.stateNode.containerInfo),r===null)throw Error(i(387));h=a.pendingProps;var b=a.memoizedState;v=b.element,ry(r,a),ju(a,h,null,u);var A=a.memoizedState;if(h=A.cache,Ka(a,si,h),h!==b.cache&&Jg(a,[si],u,!0),Iu(),h=A.element,b.isDehydrated)if(b={element:h,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=Wk(r,a,h,u);break e}else if(h!==v){v=Ur(Error(i(424)),a),Tu(v),a=Wk(r,a,h,u);break e}else for(r=a.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,An=Vr(r.firstChild),Di=a,Vt=!0,qa=null,Gr=!0,u=$x(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Xo(),h===v){a=ha(r,a,u);break e}Pi(r,a,h,u)}a=a.child}return a;case 26:return mf(r,a),r===null?(u=sE(a.type,null,a.pendingProps,null))?a.memoizedState=u:Vt||(u=a.type,r=a.pendingProps,h=Lf(Z.current).createElement(u),h[Kt]=a,h[oe]=r,$i(h,u,r),Et(h),a.stateNode=h):a.memoizedState=sE(a.type,r.memoizedProps,a.pendingProps,r.memoizedState),null;case 27:return $e(a),r===null&&Vt&&(h=a.stateNode=nE(a.type,a.pendingProps,Z.current),Di=a,Gr=!0,v=An,ao(a.type)?(yv=v,An=Vr(h.firstChild)):An=v),Pi(r,a,a.pendingProps.children,u),mf(r,a),r===null&&(a.flags|=4194304),a.child;case 5:return r===null&&Vt&&((v=h=An)&&(h=pD(h,a.type,a.pendingProps,Gr),h!==null?(a.stateNode=h,Di=a,An=Vr(h.firstChild),Gr=!1,v=!0):v=!1),v||Ga(a)),$e(a),v=a.type,b=a.pendingProps,A=r!==null?r.memoizedProps:null,h=b.children,hv(v,b)?h=null:A!==null&&hv(v,A)&&(a.flags|=32),a.memoizedState!==null&&(v=dy(r,a,R6,null,null,u),td._currentValue=v),mf(r,a),Pi(r,a,h,u),a.child;case 6:return r===null&&Vt&&((r=u=An)&&(u=mD(u,a.pendingProps,Gr),u!==null?(a.stateNode=u,Di=a,An=null,r=!0):r=!1),r||Ga(a)),null;case 13:return qk(r,a,u);case 4:return Se(a,a.stateNode.containerInfo),h=a.pendingProps,r===null?a.child=nl(a,null,h,u):Pi(r,a,h,u),a.child;case 11:return Dk(r,a,a.type,a.pendingProps,u);case 7:return Pi(r,a,a.pendingProps,u),a.child;case 8:return Pi(r,a,a.pendingProps.children,u),a.child;case 12:return Pi(r,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,Ka(a,a.type,h.value),Pi(r,a,h.children,u),a.child;case 9:return v=a.type._context,h=a.pendingProps.children,Jo(a),v=Bi(v),h=h(v),a.flags|=1,Pi(r,a,h,u),a.child;case 14:return Bk(r,a,a.type,a.pendingProps,u);case 15:return Pk(r,a,a.type,a.pendingProps,u);case 19:return Kk(r,a,u);case 31:return B6(r,a,u);case 22:return $k(r,a,u,a.pendingProps);case 24:return Jo(a),h=Bi(si),r===null?(v=ty(),v===null&&(v=kn,b=Qg(),v.pooledCache=b,b.refCount++,b!==null&&(v.pooledCacheLanes|=u),v=b),a.memoizedState={parent:h,cache:v},iy(a),Ka(a,si,v)):((r.lanes&u)!==0&&(ry(r,a),ju(a,null,null,u),Iu()),v=r.memoizedState,b=a.memoizedState,v.parent!==h?(v={parent:h,cache:h},a.memoizedState=v,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=v),Ka(a,si,h)):(h=b.cache,Ka(a,si,h),h!==v.cache&&Jg(a,[si],u,!0))),Pi(r,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(i(156,a.tag))}function fa(r){r.flags|=4}function $y(r,a,u,h,v){if((a=(r.mode&32)!==0)&&(a=!1),a){if(r.flags|=16777216,(v&335544128)===v)if(r.stateNode.complete)r.flags|=8192;else if(wC())r.flags|=8192;else throw tl=Qh,ny}else r.flags&=-16777217}function Yk(r,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!uE(a))if(wC())r.flags|=8192;else throw tl=Qh,ny}function yf(r,a){a!==null&&(r.flags|=4),r.flags&16384&&(a=r.tag!==22?Ve():536870912,r.lanes|=a,sc|=a)}function Fu(r,a){if(!Vt)switch(r.tailMode){case"hidden":a=r.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:h.sibling=null}}function Tn(r){var a=r.alternate!==null&&r.alternate.child===r.child,u=0,h=0;if(a)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,h|=v.subtreeFlags&65011712,h|=v.flags&65011712,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,h|=v.subtreeFlags,h|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=h,r.childLanes=u,a}function $6(r,a,u){var h=a.pendingProps;switch(Kg(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Tn(a),null;case 1:return Tn(a),null;case 3:return u=a.stateNode,h=null,r!==null&&(h=r.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),ca(si),pe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(r===null||r.child===null)&&(Gl(a)?fa(a):r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Yg())),Tn(a),null;case 26:var v=a.type,b=a.memoizedState;return r===null?(fa(a),b!==null?(Tn(a),Yk(a,b)):(Tn(a),$y(a,v,null,h,u))):b?b!==r.memoizedState?(fa(a),Tn(a),Yk(a,b)):(Tn(a),a.flags&=-16777217):(r=r.memoizedProps,r!==h&&fa(a),Tn(a),$y(a,v,r,h,u)),null;case 27:if(je(a),u=Z.current,v=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==h&&fa(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Tn(a),null}r=z.current,Gl(a)?Tx(a):(r=nE(v,h,u),a.stateNode=r,fa(a))}return Tn(a),null;case 5:if(je(a),v=a.type,r!==null&&a.stateNode!=null)r.memoizedProps!==h&&fa(a);else{if(!h){if(a.stateNode===null)throw Error(i(166));return Tn(a),null}if(b=z.current,Gl(a))Tx(a);else{var A=Lf(Z.current);switch(b){case 1:b=A.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:b=A.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":b=A.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":b=A.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":b=A.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof h.is=="string"?A.createElement("select",{is:h.is}):A.createElement("select"),h.multiple?b.multiple=!0:h.size&&(b.size=h.size);break;default:b=typeof h.is=="string"?A.createElement(v,{is:h.is}):A.createElement(v)}}b[Kt]=a,b[oe]=h;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)b.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=b;e:switch($i(b,v,h),v){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&fa(a)}}return Tn(a),$y(a,a.type,r===null?null:r.memoizedProps,a.pendingProps,u),null;case 6:if(r&&a.stateNode!=null)r.memoizedProps!==h&&fa(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(i(166));if(r=Z.current,Gl(a)){if(r=a.stateNode,u=a.memoizedProps,h=null,v=Di,v!==null)switch(v.tag){case 27:case 5:h=v.memoizedProps}r[Kt]=a,r=!!(r.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||qC(r.nodeValue,u)),r||Ga(a,!0)}else r=Lf(r).createTextNode(h),r[Kt]=a,a.stateNode=r}return Tn(a),null;case 31:if(u=a.memoizedState,r===null||r.memoizedState!==null){if(h=Gl(a),u!==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[Kt]=a}else Xo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Tn(a),r=!1}else u=Yg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=u),r=!0;if(!r)return a.flags&256?(Ar(a),a):(Ar(a),null);if((a.flags&128)!==0)throw Error(i(558))}return Tn(a),null;case 13:if(h=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(v=Gl(a),h!==null&&h.dehydrated!==null){if(r===null){if(!v)throw Error(i(318));if(v=a.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(i(317));v[Kt]=a}else Xo(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Tn(a),v=!1}else v=Yg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=v),v=!0;if(!v)return a.flags&256?(Ar(a),a):(Ar(a),null)}return Ar(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,r=r!==null&&r.memoizedState!==null,u&&(h=a.child,v=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(v=h.alternate.memoizedState.cachePool.pool),b=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(b=h.memoizedState.cachePool.pool),b!==v&&(h.flags|=2048)),u!==r&&u&&(a.child.flags|=8192),yf(a,a.updateQueue),Tn(a),null);case 4:return pe(),r===null&&ov(a.stateNode.containerInfo),Tn(a),null;case 10:return ca(a.type),Tn(a),null;case 19:if(W(Jn),h=a.memoizedState,h===null)return Tn(a),null;if(v=(a.flags&128)!==0,b=h.rendering,b===null)if(v)Fu(h,!1);else{if(Wn!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(b=rf(r),b!==null){for(a.flags|=128,Fu(h,!1),r=b.updateQueue,a.updateQueue=r,yf(a,r),a.subtreeFlags=0,r=u,u=a.child;u!==null;)xx(u,r),u=u.sibling;return K(Jn,Jn.current&1|2),Vt&&oa(a,h.treeForkCount),a.child}r=r.sibling}h.tail!==null&&tt()>Sf&&(a.flags|=128,v=!0,Fu(h,!1),a.lanes=4194304)}else{if(!v)if(r=rf(b),r!==null){if(a.flags|=128,v=!0,r=r.updateQueue,a.updateQueue=r,yf(a,r),Fu(h,!0),h.tail===null&&h.tailMode==="hidden"&&!b.alternate&&!Vt)return Tn(a),null}else 2*tt()-h.renderingStartTime>Sf&&u!==536870912&&(a.flags|=128,v=!0,Fu(h,!1),a.lanes=4194304);h.isBackwards?(b.sibling=a.child,a.child=b):(r=h.last,r!==null?r.sibling=b:a.child=b,h.last=b)}return h.tail!==null?(r=h.tail,h.rendering=r,h.tail=r.sibling,h.renderingStartTime=tt(),r.sibling=null,u=Jn.current,K(Jn,v?u&1|2:u&1),Vt&&oa(a,h.treeForkCount),r):(Tn(a),null);case 22:case 23:return Ar(a),ly(),h=a.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(Tn(a),a.subtreeFlags&6&&(a.flags|=8192)):Tn(a),u=a.updateQueue,u!==null&&yf(a,u.retryQueue),u=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),r!==null&&W(Qo),null;case 24:return u=null,r!==null&&(u=r.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),ca(si),Tn(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function z6(r,a){switch(Kg(a),a.tag){case 1:return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return ca(si),pe(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 26:case 27:case 5:return je(a),null;case 31:if(a.memoizedState!==null){if(Ar(a),a.alternate===null)throw Error(i(340));Xo()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 13:if(Ar(a),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Xo()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return W(Jn),null;case 4:return pe(),null;case 10:return ca(a.type),null;case 22:case 23:return Ar(a),ly(),r!==null&&W(Qo),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 24:return ca(si),null;case 25:return null;default:return null}}function Xk(r,a){switch(Kg(a),a.tag){case 3:ca(si),pe();break;case 26:case 27:case 5:je(a);break;case 4:pe();break;case 31:a.memoizedState!==null&&Ar(a);break;case 13:Ar(a);break;case 19:W(Jn);break;case 10:ca(a.type);break;case 22:case 23:Ar(a),ly(),r!==null&&W(Qo);break;case 24:ca(si)}}function Hu(r,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var v=h.next;u=v;do{if((u.tag&r)===r){h=void 0;var b=u.create,A=u.inst;h=b(),A.destroy=h}u=u.next}while(u!==v)}}catch(F){dn(a,a.return,F)}}function Qa(r,a,u){try{var h=a.updateQueue,v=h!==null?h.lastEffect:null;if(v!==null){var b=v.next;h=b;do{if((h.tag&r)===r){var A=h.inst,F=A.destroy;if(F!==void 0){A.destroy=void 0,v=a;var ne=u,de=F;try{de()}catch(be){dn(v,ne,be)}}}h=h.next}while(h!==b)}}catch(be){dn(a,a.return,be)}}function Zk(r){var a=r.updateQueue;if(a!==null){var u=r.stateNode;try{Fx(a,u)}catch(h){dn(r,r.return,h)}}}function Jk(r,a,u){u.props=rl(r.type,r.memoizedProps),u.state=r.memoizedState;try{u.componentWillUnmount()}catch(h){dn(r,a,h)}}function Uu(r,a){try{var u=r.ref;if(u!==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 u=="function"?r.refCleanup=u(h):u.current=h}}catch(v){dn(r,a,v)}}function Os(r,a){var u=r.ref,h=r.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(v){dn(r,a,v)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(v){dn(r,a,v)}else u.current=null}function Qk(r){var a=r.type,u=r.memoizedProps,h=r.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(v){dn(r,r.return,v)}}function zy(r,a,u){try{var h=r.stateNode;lD(h,r.type,u,a),h[oe]=a}catch(v){dn(r,r.return,v)}}function eC(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ao(r.type)||r.tag===4}function Fy(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||eC(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&&ao(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 Hy(r,a,u){var h=r.tag;if(h===5||h===6)r=r.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(r,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(r),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Oe));else if(h!==4&&(h===27&&ao(r.type)&&(u=r.stateNode,a=null),r=r.child,r!==null))for(Hy(r,a,u),r=r.sibling;r!==null;)Hy(r,a,u),r=r.sibling}function vf(r,a,u){var h=r.tag;if(h===5||h===6)r=r.stateNode,a?u.insertBefore(r,a):u.appendChild(r);else if(h!==4&&(h===27&&ao(r.type)&&(u=r.stateNode),r=r.child,r!==null))for(vf(r,a,u),r=r.sibling;r!==null;)vf(r,a,u),r=r.sibling}function tC(r){var a=r.stateNode,u=r.memoizedProps;try{for(var h=r.type,v=a.attributes;v.length;)a.removeAttributeNode(v[0]);$i(a,h,u),a[Kt]=r,a[oe]=u}catch(b){dn(r,r.return,b)}}var pa=!1,li=!1,Uy=!1,nC=typeof WeakSet=="function"?WeakSet:Set,xi=null;function F6(r,a){if(r=r.containerInfo,uv=$f,r=px(r),Dg(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var v=h.anchorOffset,b=h.focusNode;h=h.focusOffset;try{u.nodeType,b.nodeType}catch{u=null;break e}var A=0,F=-1,ne=-1,de=0,be=0,Ce=r,fe=null;t:for(;;){for(var ye;Ce!==u||v!==0&&Ce.nodeType!==3||(F=A+v),Ce!==b||h!==0&&Ce.nodeType!==3||(ne=A+h),Ce.nodeType===3&&(A+=Ce.nodeValue.length),(ye=Ce.firstChild)!==null;)fe=Ce,Ce=ye;for(;;){if(Ce===r)break t;if(fe===u&&++de===v&&(F=A),fe===b&&++be===h&&(ne=A),(ye=Ce.nextSibling)!==null)break;Ce=fe,fe=Ce.parentNode}Ce=ye}u=F===-1||ne===-1?null:{start:F,end:ne}}else u=null}u=u||{start:0,end:0}}else u=null;for(dv={focusedElem:r,selectionRange:u},$f=!1,xi=a;xi!==null;)if(a=xi,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,xi=r;else for(;xi!==null;){switch(a=xi,b=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(u=0;u<r.length;u++)v=r[u],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&b!==null){r=void 0,u=a,v=b.memoizedProps,b=b.memoizedState,h=u.stateNode;try{var Ye=rl(u.type,v);r=h.getSnapshotBeforeUpdate(Ye,b),h.__reactInternalSnapshotBeforeUpdate=r}catch(ft){dn(u,u.return,ft)}}break;case 3:if((r&1024)!==0){if(r=a.stateNode.containerInfo,u=r.nodeType,u===9)pv(r);else if(u===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":pv(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,xi=r;break}xi=a.return}}function iC(r,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:ga(r,u),h&4&&Hu(5,u);break;case 1:if(ga(r,u),h&4)if(r=u.stateNode,a===null)try{r.componentDidMount()}catch(A){dn(u,u.return,A)}else{var v=rl(u.type,a.memoizedProps);a=a.memoizedState;try{r.componentDidUpdate(v,a,r.__reactInternalSnapshotBeforeUpdate)}catch(A){dn(u,u.return,A)}}h&64&&Zk(u),h&512&&Uu(u,u.return);break;case 3:if(ga(r,u),h&64&&(r=u.updateQueue,r!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{Fx(r,a)}catch(A){dn(u,u.return,A)}}break;case 27:a===null&&h&4&&tC(u);case 26:case 5:ga(r,u),a===null&&h&4&&Qk(u),h&512&&Uu(u,u.return);break;case 12:ga(r,u);break;case 31:ga(r,u),h&4&&aC(r,u);break;case 13:ga(r,u),h&4&&oC(r,u),h&64&&(r=u.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(u=X6.bind(null,u),gD(r,u))));break;case 22:if(h=u.memoizedState!==null||pa,!h){a=a!==null&&a.memoizedState!==null||li,v=pa;var b=li;pa=h,(li=a)&&!b?ya(r,u,(u.subtreeFlags&8772)!==0):ga(r,u),pa=v,li=b}break;case 30:break;default:ga(r,u)}}function rC(r){var a=r.alternate;a!==null&&(r.alternate=null,rC(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&Ge(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 In=null,dr=!1;function ma(r,a,u){for(u=u.child;u!==null;)sC(r,a,u),u=u.sibling}function sC(r,a,u){if(Ne&&typeof Ne.onCommitFiberUnmount=="function")try{Ne.onCommitFiberUnmount(_e,u)}catch{}switch(u.tag){case 26:li||Os(u,a),ma(r,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:li||Os(u,a);var h=In,v=dr;ao(u.type)&&(In=u.stateNode,dr=!1),ma(r,a,u),Ju(u.stateNode),In=h,dr=v;break;case 5:li||Os(u,a);case 6:if(h=In,v=dr,In=null,ma(r,a,u),In=h,dr=v,In!==null)if(dr)try{(In.nodeType===9?In.body:In.nodeName==="HTML"?In.ownerDocument.body:In).removeChild(u.stateNode)}catch(b){dn(u,a,b)}else try{In.removeChild(u.stateNode)}catch(b){dn(u,a,b)}break;case 18:In!==null&&(dr?(r=In,ZC(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,u.stateNode),fc(r)):ZC(In,u.stateNode));break;case 4:h=In,v=dr,In=u.stateNode.containerInfo,dr=!0,ma(r,a,u),In=h,dr=v;break;case 0:case 11:case 14:case 15:Qa(2,u,a),li||Qa(4,u,a),ma(r,a,u);break;case 1:li||(Os(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&Jk(u,a,h)),ma(r,a,u);break;case 21:ma(r,a,u);break;case 22:li=(h=li)||u.memoizedState!==null,ma(r,a,u),li=h;break;default:ma(r,a,u)}}function aC(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{fc(r)}catch(u){dn(a,a.return,u)}}}function oC(r,a){if(a.memoizedState===null&&(r=a.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{fc(r)}catch(u){dn(a,a.return,u)}}function H6(r){switch(r.tag){case 31:case 13:case 19:var a=r.stateNode;return a===null&&(a=r.stateNode=new nC),a;case 22:return r=r.stateNode,a=r._retryCache,a===null&&(a=r._retryCache=new nC),a;default:throw Error(i(435,r.tag))}}function _f(r,a){var u=H6(r);a.forEach(function(h){if(!u.has(h)){u.add(h);var v=Z6.bind(null,r,h);h.then(v,v)}})}function hr(r,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var v=u[h],b=r,A=a,F=A;e:for(;F!==null;){switch(F.tag){case 27:if(ao(F.type)){In=F.stateNode,dr=!1;break e}break;case 5:In=F.stateNode,dr=!1;break e;case 3:case 4:In=F.stateNode.containerInfo,dr=!0;break e}F=F.return}if(In===null)throw Error(i(160));sC(b,A,v),In=null,dr=!1,b=v.alternate,b!==null&&(b.return=null),v.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)lC(a,r),a=a.sibling}var ms=null;function lC(r,a){var u=r.alternate,h=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:hr(a,r),fr(r),h&4&&(Qa(3,r,r.return),Hu(3,r),Qa(5,r,r.return));break;case 1:hr(a,r),fr(r),h&512&&(li||u===null||Os(u,u.return)),h&64&&pa&&(r=r.updateQueue,r!==null&&(h=r.callbacks,h!==null&&(u=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var v=ms;if(hr(a,r),fr(r),h&512&&(li||u===null||Os(u,u.return)),h&4){var b=u!==null?u.memoizedState:null;if(h=r.memoizedState,u===null)if(h===null)if(r.stateNode===null){e:{h=r.type,u=r.memoizedProps,v=v.ownerDocument||v;t:switch(h){case"title":b=v.getElementsByTagName("title")[0],(!b||b[Si]||b[Kt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=v.createElement(h),v.head.insertBefore(b,v.querySelector("head > title"))),$i(b,h,u),b[Kt]=r,Et(b),h=b;break e;case"link":var A=lE("link","href",v).get(h+(u.href||""));if(A){for(var F=0;F<A.length;F++)if(b=A[F],b.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&b.getAttribute("rel")===(u.rel==null?null:u.rel)&&b.getAttribute("title")===(u.title==null?null:u.title)&&b.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){A.splice(F,1);break t}}b=v.createElement(h),$i(b,h,u),v.head.appendChild(b);break;case"meta":if(A=lE("meta","content",v).get(h+(u.content||""))){for(F=0;F<A.length;F++)if(b=A[F],b.getAttribute("content")===(u.content==null?null:""+u.content)&&b.getAttribute("name")===(u.name==null?null:u.name)&&b.getAttribute("property")===(u.property==null?null:u.property)&&b.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&b.getAttribute("charset")===(u.charSet==null?null:u.charSet)){A.splice(F,1);break t}}b=v.createElement(h),$i(b,h,u),v.head.appendChild(b);break;default:throw Error(i(468,h))}b[Kt]=r,Et(b),h=b}r.stateNode=h}else cE(v,r.type,r.stateNode);else r.stateNode=oE(v,h,r.memoizedProps);else b!==h?(b===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):b.count--,h===null?cE(v,r.type,r.stateNode):oE(v,h,r.memoizedProps)):h===null&&r.stateNode!==null&&zy(r,r.memoizedProps,u.memoizedProps)}break;case 27:hr(a,r),fr(r),h&512&&(li||u===null||Os(u,u.return)),u!==null&&h&4&&zy(r,r.memoizedProps,u.memoizedProps);break;case 5:if(hr(a,r),fr(r),h&512&&(li||u===null||Os(u,u.return)),r.flags&32){v=r.stateNode;try{ut(v,"")}catch(Ye){dn(r,r.return,Ye)}}h&4&&r.stateNode!=null&&(v=r.memoizedProps,zy(r,v,u!==null?u.memoizedProps:v)),h&1024&&(Uy=!0);break;case 6:if(hr(a,r),fr(r),h&4){if(r.stateNode===null)throw Error(i(162));h=r.memoizedProps,u=r.stateNode;try{u.nodeValue=h}catch(Ye){dn(r,r.return,Ye)}}break;case 3:if(jf=null,v=ms,ms=Of(a.containerInfo),hr(a,r),ms=v,fr(r),h&4&&u!==null&&u.memoizedState.isDehydrated)try{fc(a.containerInfo)}catch(Ye){dn(r,r.return,Ye)}Uy&&(Uy=!1,cC(r));break;case 4:h=ms,ms=Of(r.stateNode.containerInfo),hr(a,r),fr(r),ms=h;break;case 12:hr(a,r),fr(r);break;case 31:hr(a,r),fr(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,_f(r,h)));break;case 13:hr(a,r),fr(r),r.child.flags&8192&&r.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(wf=tt()),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,_f(r,h)));break;case 22:v=r.memoizedState!==null;var ne=u!==null&&u.memoizedState!==null,de=pa,be=li;if(pa=de||v,li=be||ne,hr(a,r),li=be,pa=de,fr(r),h&8192)e:for(a=r.stateNode,a._visibility=v?a._visibility&-2:a._visibility|1,v&&(u===null||ne||pa||li||sl(r)),u=null,a=r;;){if(a.tag===5||a.tag===26){if(u===null){ne=u=a;try{if(b=ne.stateNode,v)A=b.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{F=ne.stateNode;var Ce=ne.memoizedProps.style,fe=Ce!=null&&Ce.hasOwnProperty("display")?Ce.display:null;F.style.display=fe==null||typeof fe=="boolean"?"":(""+fe).trim()}}catch(Ye){dn(ne,ne.return,Ye)}}}else if(a.tag===6){if(u===null){ne=a;try{ne.stateNode.nodeValue=v?"":ne.memoizedProps}catch(Ye){dn(ne,ne.return,Ye)}}}else if(a.tag===18){if(u===null){ne=a;try{var ye=ne.stateNode;v?JC(ye,!0):JC(ne.stateNode,!1)}catch(Ye){dn(ne,ne.return,Ye)}}}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;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=r.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,_f(r,u))));break;case 19:hr(a,r),fr(r),h&4&&(h=r.updateQueue,h!==null&&(r.updateQueue=null,_f(r,h)));break;case 30:break;case 21:break;default:hr(a,r),fr(r)}}function fr(r){var a=r.flags;if(a&2){try{for(var u,h=r.return;h!==null;){if(eC(h)){u=h;break}h=h.return}if(u==null)throw Error(i(160));switch(u.tag){case 27:var v=u.stateNode,b=Fy(r);vf(r,b,v);break;case 5:var A=u.stateNode;u.flags&32&&(ut(A,""),u.flags&=-33);var F=Fy(r);vf(r,F,A);break;case 3:case 4:var ne=u.stateNode.containerInfo,de=Fy(r);Hy(r,de,ne);break;default:throw Error(i(161))}}catch(be){dn(r,r.return,be)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function cC(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var a=r;cC(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),r=r.sibling}}function ga(r,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)iC(r,a.alternate,a),a=a.sibling}function sl(r){for(r=r.child;r!==null;){var a=r;switch(a.tag){case 0:case 11:case 14:case 15:Qa(4,a,a.return),sl(a);break;case 1:Os(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&Jk(a,a.return,u),sl(a);break;case 27:Ju(a.stateNode);case 26:case 5:Os(a,a.return),sl(a);break;case 22:a.memoizedState===null&&sl(a);break;case 30:sl(a);break;default:sl(a)}r=r.sibling}}function ya(r,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,v=r,b=a,A=b.flags;switch(b.tag){case 0:case 11:case 15:ya(v,b,u),Hu(4,b);break;case 1:if(ya(v,b,u),h=b,v=h.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(de){dn(h,h.return,de)}if(h=b,v=h.updateQueue,v!==null){var F=h.stateNode;try{var ne=v.shared.hiddenCallbacks;if(ne!==null)for(v.shared.hiddenCallbacks=null,v=0;v<ne.length;v++)zx(ne[v],F)}catch(de){dn(h,h.return,de)}}u&&A&64&&Zk(b),Uu(b,b.return);break;case 27:tC(b);case 26:case 5:ya(v,b,u),u&&h===null&&A&4&&Qk(b),Uu(b,b.return);break;case 12:ya(v,b,u);break;case 31:ya(v,b,u),u&&A&4&&aC(v,b);break;case 13:ya(v,b,u),u&&A&4&&oC(v,b);break;case 22:b.memoizedState===null&&ya(v,b,u),Uu(b,b.return);break;case 30:break;default:ya(v,b,u)}a=a.sibling}}function Wy(r,a){var u=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(u=r.memoizedState.cachePool.pool),r=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(r=a.memoizedState.cachePool.pool),r!==u&&(r!=null&&r.refCount++,u!=null&&Ru(u))}function qy(r,a){r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&Ru(r))}function gs(r,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)uC(r,a,u,h),a=a.sibling}function uC(r,a,u,h){var v=a.flags;switch(a.tag){case 0:case 11:case 15:gs(r,a,u,h),v&2048&&Hu(9,a);break;case 1:gs(r,a,u,h);break;case 3:gs(r,a,u,h),v&2048&&(r=null,a.alternate!==null&&(r=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==r&&(a.refCount++,r!=null&&Ru(r)));break;case 12:if(v&2048){gs(r,a,u,h),r=a.stateNode;try{var b=a.memoizedProps,A=b.id,F=b.onPostCommit;typeof F=="function"&&F(A,a.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(ne){dn(a,a.return,ne)}}else gs(r,a,u,h);break;case 31:gs(r,a,u,h);break;case 13:gs(r,a,u,h);break;case 23:break;case 22:b=a.stateNode,A=a.alternate,a.memoizedState!==null?b._visibility&2?gs(r,a,u,h):Wu(r,a):b._visibility&2?gs(r,a,u,h):(b._visibility|=2,nc(r,a,u,h,(a.subtreeFlags&10256)!==0||!1)),v&2048&&Wy(A,a);break;case 24:gs(r,a,u,h),v&2048&&qy(a.alternate,a);break;default:gs(r,a,u,h)}}function nc(r,a,u,h,v){for(v=v&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=r,A=a,F=u,ne=h,de=A.flags;switch(A.tag){case 0:case 11:case 15:nc(b,A,F,ne,v),Hu(8,A);break;case 23:break;case 22:var be=A.stateNode;A.memoizedState!==null?be._visibility&2?nc(b,A,F,ne,v):Wu(b,A):(be._visibility|=2,nc(b,A,F,ne,v)),v&&de&2048&&Wy(A.alternate,A);break;case 24:nc(b,A,F,ne,v),v&&de&2048&&qy(A.alternate,A);break;default:nc(b,A,F,ne,v)}a=a.sibling}}function Wu(r,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=r,h=a,v=h.flags;switch(h.tag){case 22:Wu(u,h),v&2048&&Wy(h.alternate,h);break;case 24:Wu(u,h),v&2048&&qy(h.alternate,h);break;default:Wu(u,h)}a=a.sibling}}var qu=8192;function ic(r,a,u){if(r.subtreeFlags&qu)for(r=r.child;r!==null;)dC(r,a,u),r=r.sibling}function dC(r,a,u){switch(r.tag){case 26:ic(r,a,u),r.flags&qu&&r.memoizedState!==null&&TD(u,ms,r.memoizedState,r.memoizedProps);break;case 5:ic(r,a,u);break;case 3:case 4:var h=ms;ms=Of(r.stateNode.containerInfo),ic(r,a,u),ms=h;break;case 22:r.memoizedState===null&&(h=r.alternate,h!==null&&h.memoizedState!==null?(h=qu,qu=16777216,ic(r,a,u),qu=h):ic(r,a,u));break;default:ic(r,a,u)}}function hC(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 Gu(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];xi=h,pC(h,r)}hC(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)fC(r),r=r.sibling}function fC(r){switch(r.tag){case 0:case 11:case 15:Gu(r),r.flags&2048&&Qa(9,r,r.return);break;case 3:Gu(r);break;case 12:Gu(r);break;case 22:var a=r.stateNode;r.memoizedState!==null&&a._visibility&2&&(r.return===null||r.return.tag!==13)?(a._visibility&=-3,bf(r)):Gu(r);break;default:Gu(r)}}function bf(r){var a=r.deletions;if((r.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];xi=h,pC(h,r)}hC(r)}for(r=r.child;r!==null;){switch(a=r,a.tag){case 0:case 11:case 15:Qa(8,a,a.return),bf(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,bf(a));break;default:bf(a)}r=r.sibling}}function pC(r,a){for(;xi!==null;){var u=xi;switch(u.tag){case 0:case 11:case 15:Qa(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:Ru(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,xi=h;else e:for(u=r;xi!==null;){h=xi;var v=h.sibling,b=h.return;if(rC(h),h===u){xi=null;break e}if(v!==null){v.return=b,xi=v;break e}xi=b}}}var U6={getCacheForType:function(r){var a=Bi(si),u=a.data.get(r);return u===void 0&&(u=r(),a.data.set(r,u)),u},cacheSignal:function(){return Bi(si).controller.signal}},W6=typeof WeakMap=="function"?WeakMap:Map,sn=0,kn=null,Ft=null,qt=0,un=0,Tr=null,eo=!1,rc=!1,Gy=!1,va=0,Wn=0,to=0,al=0,Ky=0,Rr=0,sc=0,Ku=null,pr=null,Vy=!1,wf=0,mC=0,Sf=1/0,xf=null,no=null,mi=0,io=null,ac=null,_a=0,Yy=0,Xy=null,gC=null,Vu=0,Zy=null;function Mr(){return(sn&2)!==0&&qt!==0?qt&-qt:E.T!==null?iv():Xn()}function yC(){if(Rr===0)if((qt&536870912)===0||Vt){var r=ge;ge<<=1,(ge&3932160)===0&&(ge=262144),Rr=r}else Rr=536870912;return r=Er.current,r!==null&&(r.flags|=32),Rr}function mr(r,a,u){(r===kn&&(un===2||un===9)||r.cancelPendingCommit!==null)&&(oc(r,0),ro(r,qt,Rr,!1)),ct(r,u),((sn&2)===0||r!==kn)&&(r===kn&&((sn&2)===0&&(al|=u),Wn===4&&ro(r,qt,Rr,!1)),Is(r))}function vC(r,a,u){if((sn&6)!==0)throw Error(i(327));var h=!u&&(a&127)===0&&(a&r.expiredLanes)===0||he(r,a),v=h?K6(r,a):Qy(r,a,!0),b=h;do{if(v===0){rc&&!h&&ro(r,a,0,!1);break}else{if(u=r.current.alternate,b&&!q6(u)){v=Qy(r,a,!1),b=!1;continue}if(v===2){if(b=a,r.errorRecoveryDisabledLanes&b)var A=0;else A=r.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var F=r;v=Ku;var ne=F.current.memoizedState.isDehydrated;if(ne&&(oc(F,A).flags|=256),A=Qy(F,A,!1),A!==2){if(Gy&&!ne){F.errorRecoveryDisabledLanes|=b,al|=b,v=4;break e}b=pr,pr=v,b!==null&&(pr===null?pr=b:pr.push.apply(pr,b))}v=A}if(b=!1,v!==2)continue}}if(v===1){oc(r,0),ro(r,a,0,!0);break}e:{switch(h=r,b=v,b){case 0:case 1:throw Error(i(345));case 4:if((a&4194048)!==a)break;case 6:ro(h,a,Rr,!eo);break e;case 2:pr=null;break;case 3:case 5:break;default:throw Error(i(329))}if((a&62914560)===a&&(v=wf+300-tt(),10<v)){if(ro(h,a,Rr,!eo),ee(h,0,!0)!==0)break e;_a=a,h.timeoutHandle=YC(_C.bind(null,h,u,pr,xf,Vy,a,Rr,al,sc,eo,b,"Throttled",-0,0),v);break e}_C(h,u,pr,xf,Vy,a,Rr,al,sc,eo,b,null,-0,0)}}break}while(!0);Is(r)}function _C(r,a,u,h,v,b,A,F,ne,de,be,Ce,fe,ye){if(r.timeoutHandle=-1,Ce=a.subtreeFlags,Ce&8192||(Ce&16785408)===16785408){Ce={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Oe},dC(a,b,Ce);var Ye=(b&62914560)===b?wf-tt():(b&4194048)===b?mC-tt():0;if(Ye=RD(Ce,Ye),Ye!==null){_a=b,r.cancelPendingCommit=Ye(AC.bind(null,r,a,b,u,h,v,A,F,ne,be,Ce,null,fe,ye)),ro(r,b,A,!de);return}}AC(r,a,b,u,h,v,A,F,ne)}function q6(r){for(var a=r;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var v=u[h],b=v.getSnapshot;v=v.value;try{if(!kr(b(),v))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;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 ro(r,a,u,h){a&=~Ky,a&=~al,r.suspendedLanes|=a,r.pingedLanes&=~a,h&&(r.warmLanes|=a),h=r.expirationTimes;for(var v=a;0<v;){var b=31-Nt(v),A=1<<b;h[b]=-1,v&=~A}u!==0&&Ie(r,u,a)}function kf(){return(sn&6)===0?(Yu(0),!1):!0}function Jy(){if(Ft!==null){if(un===0)var r=Ft.return;else r=Ft,la=Zo=null,py(r),Zl=null,Nu=0,r=Ft;for(;r!==null;)Xk(r.alternate,r),r=r.return;Ft=null}}function oc(r,a){var u=r.timeoutHandle;u!==-1&&(r.timeoutHandle=-1,dD(u)),u=r.cancelPendingCommit,u!==null&&(r.cancelPendingCommit=null,u()),_a=0,Jy(),kn=r,Ft=u=aa(r.current,null),qt=a,un=0,Tr=null,eo=!1,rc=he(r,a),Gy=!1,sc=Rr=Ky=al=to=Wn=0,pr=Ku=null,Vy=!1,(a&8)!==0&&(a|=a&32);var h=r.entangledLanes;if(h!==0)for(r=r.entanglements,h&=a;0<h;){var v=31-Nt(h),b=1<<v;a|=r[v],h&=~b}return va=a,Wh(),u}function bC(r,a){Lt=null,E.H=$u,a===Xl||a===Jh?(a=Dx(),un=3):a===ny?(a=Dx(),un=4):un=a===My?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Tr=a,Ft===null&&(Wn=1,ff(r,Ur(a,r.current)))}function wC(){var r=Er.current;return r===null?!0:(qt&4194048)===qt?Kr===null:(qt&62914560)===qt||(qt&536870912)!==0?r===Kr:!1}function SC(){var r=E.H;return E.H=$u,r===null?$u:r}function xC(){var r=E.A;return E.A=U6,r}function Cf(){Wn=4,eo||(qt&4194048)!==qt&&Er.current!==null||(rc=!0),(to&134217727)===0&&(al&134217727)===0||kn===null||ro(kn,qt,Rr,!1)}function Qy(r,a,u){var h=sn;sn|=2;var v=SC(),b=xC();(kn!==r||qt!==a)&&(xf=null,oc(r,a)),a=!1;var A=Wn;e:do try{if(un!==0&&Ft!==null){var F=Ft,ne=Tr;switch(un){case 8:Jy(),A=6;break e;case 3:case 2:case 9:case 6:Er.current===null&&(a=!0);var de=un;if(un=0,Tr=null,lc(r,F,ne,de),u&&rc){A=0;break e}break;default:de=un,un=0,Tr=null,lc(r,F,ne,de)}}G6(),A=Wn;break}catch(be){bC(r,be)}while(!0);return a&&r.shellSuspendCounter++,la=Zo=null,sn=h,E.H=v,E.A=b,Ft===null&&(kn=null,qt=0,Wh()),A}function G6(){for(;Ft!==null;)kC(Ft)}function K6(r,a){var u=sn;sn|=2;var h=SC(),v=xC();kn!==r||qt!==a?(xf=null,Sf=tt()+500,oc(r,a)):rc=he(r,a);e:do try{if(un!==0&&Ft!==null){a=Ft;var b=Tr;t:switch(un){case 1:un=0,Tr=null,lc(r,a,b,1);break;case 2:case 9:if(Ix(b)){un=0,Tr=null,CC(a);break}a=function(){un!==2&&un!==9||kn!==r||(un=7),Is(r)},b.then(a,a);break e;case 3:un=7;break e;case 4:un=5;break e;case 7:Ix(b)?(un=0,Tr=null,CC(a)):(un=0,Tr=null,lc(r,a,b,7));break;case 5:var A=null;switch(Ft.tag){case 26:A=Ft.memoizedState;case 5:case 27:var F=Ft;if(A?uE(A):F.stateNode.complete){un=0,Tr=null;var ne=F.sibling;if(ne!==null)Ft=ne;else{var de=F.return;de!==null?(Ft=de,Ef(de)):Ft=null}break t}}un=0,Tr=null,lc(r,a,b,5);break;case 6:un=0,Tr=null,lc(r,a,b,6);break;case 8:Jy(),Wn=6;break e;default:throw Error(i(462))}}V6();break}catch(be){bC(r,be)}while(!0);return la=Zo=null,E.H=h,E.A=v,sn=u,Ft!==null?0:(kn=null,qt=0,Wh(),Wn)}function V6(){for(;Ft!==null&&!Pt();)kC(Ft)}function kC(r){var a=Vk(r.alternate,r,va);r.memoizedProps=r.pendingProps,a===null?Ef(r):Ft=a}function CC(r){var a=r,u=a.alternate;switch(a.tag){case 15:case 0:a=Hk(u,a,a.pendingProps,a.type,void 0,qt);break;case 11:a=Hk(u,a,a.pendingProps,a.type.render,a.ref,qt);break;case 5:py(a);default:Xk(u,a),a=Ft=xx(a,va),a=Vk(u,a,va)}r.memoizedProps=r.pendingProps,a===null?Ef(r):Ft=a}function lc(r,a,u,h){la=Zo=null,py(a),Zl=null,Nu=0;var v=a.return;try{if(D6(r,v,a,u,qt)){Wn=1,ff(r,Ur(u,r.current)),Ft=null;return}}catch(b){if(v!==null)throw Ft=v,b;Wn=1,ff(r,Ur(u,r.current)),Ft=null;return}a.flags&32768?(Vt||h===1?r=!0:rc||(qt&536870912)!==0?r=!1:(eo=r=!0,(h===2||h===9||h===3||h===6)&&(h=Er.current,h!==null&&h.tag===13&&(h.flags|=16384))),EC(a,r)):Ef(a)}function Ef(r){var a=r;do{if((a.flags&32768)!==0){EC(a,eo);return}r=a.return;var u=$6(a.alternate,a,va);if(u!==null){Ft=u;return}if(a=a.sibling,a!==null){Ft=a;return}Ft=a=r}while(a!==null);Wn===0&&(Wn=5)}function EC(r,a){do{var u=z6(r.alternate,r);if(u!==null){u.flags&=32767,Ft=u;return}if(u=r.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(r=r.sibling,r!==null)){Ft=r;return}Ft=r=u}while(r!==null);Wn=6,Ft=null}function AC(r,a,u,h,v,b,A,F,ne){r.cancelPendingCommit=null;do Af();while(mi!==0);if((sn&6)!==0)throw Error(i(327));if(a!==null){if(a===r.current)throw Error(i(177));if(b=a.lanes|a.childLanes,b|=Fg,Pe(r,u,b,A,F,ne),r===kn&&(Ft=kn=null,qt=0),ac=a,io=r,_a=u,Yy=b,Xy=v,gC=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,J6(Xe,function(){return LC(),null})):(r.callbackNode=null,r.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=E.T,E.T=null,v=L.p,L.p=2,A=sn,sn|=4;try{F6(r,a,u)}finally{sn=A,L.p=v,E.T=h}}mi=1,TC(),RC(),MC()}}function TC(){if(mi===1){mi=0;var r=io,a=ac,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=E.T,E.T=null;var h=L.p;L.p=2;var v=sn;sn|=4;try{lC(a,r);var b=dv,A=px(r.containerInfo),F=b.focusedElem,ne=b.selectionRange;if(A!==F&&F&&F.ownerDocument&&fx(F.ownerDocument.documentElement,F)){if(ne!==null&&Dg(F)){var de=ne.start,be=ne.end;if(be===void 0&&(be=de),"selectionStart"in F)F.selectionStart=de,F.selectionEnd=Math.min(be,F.value.length);else{var Ce=F.ownerDocument||document,fe=Ce&&Ce.defaultView||window;if(fe.getSelection){var ye=fe.getSelection(),Ye=F.textContent.length,ft=Math.min(ne.start,Ye),vn=ne.end===void 0?ft:Math.min(ne.end,Ye);!ye.extend&&ft>vn&&(A=vn,vn=ft,ft=A);var ae=hx(F,ft),ie=hx(F,vn);if(ae&&ie&&(ye.rangeCount!==1||ye.anchorNode!==ae.node||ye.anchorOffset!==ae.offset||ye.focusNode!==ie.node||ye.focusOffset!==ie.offset)){var ue=Ce.createRange();ue.setStart(ae.node,ae.offset),ye.removeAllRanges(),ft>vn?(ye.addRange(ue),ye.extend(ie.node,ie.offset)):(ue.setEnd(ie.node,ie.offset),ye.addRange(ue))}}}}for(Ce=[],ye=F;ye=ye.parentNode;)ye.nodeType===1&&Ce.push({element:ye,left:ye.scrollLeft,top:ye.scrollTop});for(typeof F.focus=="function"&&F.focus(),F=0;F<Ce.length;F++){var xe=Ce[F];xe.element.scrollLeft=xe.left,xe.element.scrollTop=xe.top}}$f=!!uv,dv=uv=null}finally{sn=v,L.p=h,E.T=u}}r.current=a,mi=2}}function RC(){if(mi===2){mi=0;var r=io,a=ac,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=E.T,E.T=null;var h=L.p;L.p=2;var v=sn;sn|=4;try{iC(r,a.alternate,a)}finally{sn=v,L.p=h,E.T=u}}mi=3}}function MC(){if(mi===4||mi===3){mi=0,Ut();var r=io,a=ac,u=_a,h=gC;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?mi=5:(mi=0,ac=io=null,NC(r,r.pendingLanes));var v=r.pendingLanes;if(v===0&&(no=null),Fn(u),a=a.stateNode,Ne&&typeof Ne.onCommitFiberRoot=="function")try{Ne.onCommitFiberRoot(_e,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=E.T,v=L.p,L.p=2,E.T=null;try{for(var b=r.onRecoverableError,A=0;A<h.length;A++){var F=h[A];b(F.value,{componentStack:F.stack})}}finally{E.T=a,L.p=v}}(_a&3)!==0&&Af(),Is(r),v=r.pendingLanes,(u&261930)!==0&&(v&42)!==0?r===Zy?Vu++:(Vu=0,Zy=r):Vu=0,Yu(0)}}function NC(r,a){(r.pooledCacheLanes&=a)===0&&(a=r.pooledCache,a!=null&&(r.pooledCache=null,Ru(a)))}function Af(){return TC(),RC(),MC(),LC()}function LC(){if(mi!==5)return!1;var r=io,a=Yy;Yy=0;var u=Fn(_a),h=E.T,v=L.p;try{L.p=32>u?32:u,E.T=null,u=Xy,Xy=null;var b=io,A=_a;if(mi=0,ac=io=null,_a=0,(sn&6)!==0)throw Error(i(331));var F=sn;if(sn|=4,fC(b.current),uC(b,b.current,A,u),sn=F,Yu(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot=="function")try{Ne.onPostCommitFiberRoot(_e,b)}catch{}return!0}finally{L.p=v,E.T=h,NC(r,a)}}function OC(r,a,u){a=Ur(u,a),a=Ry(r.stateNode,a,2),r=Xa(r,a,2),r!==null&&(ct(r,2),Is(r))}function dn(r,a,u){if(r.tag===3)OC(r,r,u);else for(;a!==null;){if(a.tag===3){OC(a,r,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(no===null||!no.has(h))){r=Ur(u,r),u=Ik(2),h=Xa(a,u,2),h!==null&&(jk(u,h,a,r),ct(h,2),Is(h));break}}a=a.return}}function ev(r,a,u){var h=r.pingCache;if(h===null){h=r.pingCache=new W6;var v=new Set;h.set(a,v)}else v=h.get(a),v===void 0&&(v=new Set,h.set(a,v));v.has(u)||(Gy=!0,v.add(u),r=Y6.bind(null,r,a,u),a.then(r,r))}function Y6(r,a,u){var h=r.pingCache;h!==null&&h.delete(a),r.pingedLanes|=r.suspendedLanes&u,r.warmLanes&=~u,kn===r&&(qt&u)===u&&(Wn===4||Wn===3&&(qt&62914560)===qt&&300>tt()-wf?(sn&2)===0&&oc(r,0):Ky|=u,sc===qt&&(sc=0)),Is(r)}function IC(r,a){a===0&&(a=Ve()),r=Vo(r,a),r!==null&&(ct(r,a),Is(r))}function X6(r){var a=r.memoizedState,u=0;a!==null&&(u=a.retryLane),IC(r,u)}function Z6(r,a){var u=0;switch(r.tag){case 31:case 13:var h=r.stateNode,v=r.memoizedState;v!==null&&(u=v.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),IC(r,u)}function J6(r,a){return gt(r,a)}var Tf=null,cc=null,tv=!1,Rf=!1,nv=!1,so=0;function Is(r){r!==cc&&r.next===null&&(cc===null?Tf=cc=r:cc=cc.next=r),Rf=!0,tv||(tv=!0,eD())}function Yu(r,a){if(!nv&&Rf){nv=!0;do for(var u=!1,h=Tf;h!==null;){if(r!==0){var v=h.pendingLanes;if(v===0)var b=0;else{var A=h.suspendedLanes,F=h.pingedLanes;b=(1<<31-Nt(42|r)+1)-1,b&=v&~(A&~F),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(u=!0,PC(h,b))}else b=qt,b=ee(h,h===kn?b:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(b&3)===0||he(h,b)||(u=!0,PC(h,b));h=h.next}while(u);nv=!1}}function Q6(){jC()}function jC(){Rf=tv=!1;var r=0;so!==0&&uD()&&(r=so);for(var a=tt(),u=null,h=Tf;h!==null;){var v=h.next,b=DC(h,a);b===0?(h.next=null,u===null?Tf=v:u.next=v,v===null&&(cc=u)):(u=h,(r!==0||(b&3)!==0)&&(Rf=!0)),h=v}mi!==0&&mi!==5||Yu(r),so!==0&&(so=0)}function DC(r,a){for(var u=r.suspendedLanes,h=r.pingedLanes,v=r.expirationTimes,b=r.pendingLanes&-62914561;0<b;){var A=31-Nt(b),F=1<<A,ne=v[A];ne===-1?((F&u)===0||(F&h)!==0)&&(v[A]=Ee(F,a)):ne<=a&&(r.expiredLanes|=F),b&=~F}if(a=kn,u=qt,u=ee(r,r===a?u:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),h=r.callbackNode,u===0||r===a&&(un===2||un===9)||r.cancelPendingCommit!==null)return h!==null&&h!==null&&at(h),r.callbackNode=null,r.callbackPriority=0;if((u&3)===0||he(r,u)){if(a=u&-u,a===r.callbackPriority)return a;switch(h!==null&&at(h),Fn(u)){case 2:case 8:u=De;break;case 32:u=Xe;break;case 268435456:u=ht;break;default:u=Xe}return h=BC.bind(null,r),u=gt(u,h),r.callbackPriority=a,r.callbackNode=u,a}return h!==null&&h!==null&&at(h),r.callbackPriority=2,r.callbackNode=null,2}function BC(r,a){if(mi!==0&&mi!==5)return r.callbackNode=null,r.callbackPriority=0,null;var u=r.callbackNode;if(Af()&&r.callbackNode!==u)return null;var h=qt;return h=ee(r,r===kn?h:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),h===0?null:(vC(r,h,a),DC(r,tt()),r.callbackNode!=null&&r.callbackNode===u?BC.bind(null,r):null)}function PC(r,a){if(Af())return null;vC(r,a,!0)}function eD(){hD(function(){(sn&6)!==0?gt(ke,Q6):jC()})}function iv(){if(so===0){var r=Vl;r===0&&(r=re,re<<=1,(re&261888)===0&&(re=256)),so=r}return so}function $C(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ha(""+r)}function zC(r,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,r.id&&u.setAttribute("form",r.id),a.parentNode.insertBefore(u,a),r=new FormData(r),u.parentNode.removeChild(u),r}function tD(r,a,u,h,v){if(a==="submit"&&u&&u.stateNode===v){var b=$C((v[oe]||null).action),A=h.submitter;A&&(a=(a=A[oe]||null)?$C(a.formAction):A.getAttribute("formAction"),a!==null&&(b=a,A=null));var F=new zh("action","action",null,h,v);r.push({event:F,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(so!==0){var ne=A?zC(v,A):new FormData(v);xy(u,{pending:!0,data:ne,method:v.method,action:b},null,ne)}}else typeof b=="function"&&(F.preventDefault(),ne=A?zC(v,A):new FormData(v),xy(u,{pending:!0,data:ne,method:v.method,action:b},b,ne))},currentTarget:v}]})}}for(var rv=0;rv<zg.length;rv++){var sv=zg[rv],nD=sv.toLowerCase(),iD=sv[0].toUpperCase()+sv.slice(1);ps(nD,"on"+iD)}ps(yx,"onAnimationEnd"),ps(vx,"onAnimationIteration"),ps(_x,"onAnimationStart"),ps("dblclick","onDoubleClick"),ps("focusin","onFocus"),ps("focusout","onBlur"),ps(_6,"onTransitionRun"),ps(b6,"onTransitionStart"),ps(w6,"onTransitionCancel"),ps(bx,"onTransitionEnd"),X("onMouseEnter",["mouseout","mouseover"]),X("onMouseLeave",["mouseout","mouseover"]),X("onPointerEnter",["pointerout","pointerover"]),X("onPointerLeave",["pointerout","pointerover"]),En("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),En("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),En("onBeforeInput",["compositionend","keypress","textInput","paste"]),En("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),En("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xu="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(" "),rD=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xu));function FC(r,a){a=(a&4)!==0;for(var u=0;u<r.length;u++){var h=r[u],v=h.event;h=h.listeners;e:{var b=void 0;if(a)for(var A=h.length-1;0<=A;A--){var F=h[A],ne=F.instance,de=F.currentTarget;if(F=F.listener,ne!==b&&v.isPropagationStopped())break e;b=F,v.currentTarget=de;try{b(v)}catch(be){Uh(be)}v.currentTarget=null,b=ne}else for(A=0;A<h.length;A++){if(F=h[A],ne=F.instance,de=F.currentTarget,F=F.listener,ne!==b&&v.isPropagationStopped())break e;b=F,v.currentTarget=de;try{b(v)}catch(be){Uh(be)}v.currentTarget=null,b=ne}}}}function Ht(r,a){var u=a[ot];u===void 0&&(u=a[ot]=new Set);var h=r+"__bubble";u.has(h)||(HC(a,r,2,!1),u.add(h))}function av(r,a,u){var h=0;a&&(h|=4),HC(u,r,h,a)}var Mf="_reactListening"+Math.random().toString(36).slice(2);function ov(r){if(!r[Mf]){r[Mf]=!0,pn.forEach(function(u){u!=="selectionchange"&&(rD.has(u)||av(u,!1,r),av(u,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[Mf]||(a[Mf]=!0,av("selectionchange",!1,a))}}function HC(r,a,u,h){switch(yE(a)){case 2:var v=LD;break;case 8:v=OD;break;default:v=Sv}u=v.bind(null,a,u,r),v=void 0,!Ag||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),h?v!==void 0?r.addEventListener(a,u,{capture:!0,passive:v}):r.addEventListener(a,u,!0):v!==void 0?r.addEventListener(a,u,{passive:v}):r.addEventListener(a,u,!1)}function lv(r,a,u,h,v){var b=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var A=h.tag;if(A===3||A===4){var F=h.stateNode.containerInfo;if(F===v)break;if(A===4)for(A=h.return;A!==null;){var ne=A.tag;if((ne===3||ne===4)&&A.stateNode.containerInfo===v)return;A=A.return}for(;F!==null;){if(A=Q(F),A===null)return;if(ne=A.tag,ne===5||ne===6||ne===26||ne===27){h=b=A;continue e}F=F.parentNode}}h=h.return}Dh(function(){var de=b,be=Mt(u),Ce=[];e:{var fe=wx.get(r);if(fe!==void 0){var ye=zh,Ye=r;switch(r){case"keypress":if(Ph(u)===0)break e;case"keydown":case"keyup":ye=Zj;break;case"focusin":Ye="focus",ye=Ng;break;case"focusout":Ye="blur",ye=Ng;break;case"beforeblur":case"afterblur":ye=Ng;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=X1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=$j;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=e6;break;case yx:case vx:case _x:ye=Hj;break;case bx:ye=n6;break;case"scroll":case"scrollend":ye=Bj;break;case"wheel":ye=r6;break;case"copy":case"cut":case"paste":ye=Wj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=J1;break;case"toggle":case"beforetoggle":ye=a6}var ft=(a&4)!==0,vn=!ft&&(r==="scroll"||r==="scrollend"),ae=ft?fe!==null?fe+"Capture":null:fe;ft=[];for(var ie=de,ue;ie!==null;){var xe=ie;if(ue=xe.stateNode,xe=xe.tag,xe!==5&&xe!==26&&xe!==27||ue===null||ae===null||(xe=vu(ie,ae),xe!=null&&ft.push(Zu(ie,xe,ue))),vn)break;ie=ie.return}0<ft.length&&(fe=new ye(fe,Ye,null,u,be),Ce.push({event:fe,listeners:ft}))}}if((a&7)===0){e:{if(fe=r==="mouseover"||r==="pointerover",ye=r==="mouseout"||r==="pointerout",fe&&u!==Qe&&(Ye=u.relatedTarget||u.fromElement)&&(Q(Ye)||Ye[qe]))break e;if((ye||fe)&&(fe=be.window===be?be:(fe=be.ownerDocument)?fe.defaultView||fe.parentWindow:window,ye?(Ye=u.relatedTarget||u.toElement,ye=de,Ye=Ye?Q(Ye):null,Ye!==null&&(vn=o(Ye),ft=Ye.tag,Ye!==vn||ft!==5&&ft!==27&&ft!==6)&&(Ye=null)):(ye=null,Ye=de),ye!==Ye)){if(ft=X1,xe="onMouseLeave",ae="onMouseEnter",ie="mouse",(r==="pointerout"||r==="pointerover")&&(ft=J1,xe="onPointerLeave",ae="onPointerEnter",ie="pointer"),vn=ye==null?fe:Be(ye),ue=Ye==null?fe:Be(Ye),fe=new ft(xe,ie+"leave",ye,u,be),fe.target=vn,fe.relatedTarget=ue,xe=null,Q(be)===de&&(ft=new ft(ae,ie+"enter",Ye,u,be),ft.target=ue,ft.relatedTarget=vn,xe=ft),vn=xe,ye&&Ye)t:{for(ft=sD,ae=ye,ie=Ye,ue=0,xe=ae;xe;xe=ft(xe))ue++;xe=0;for(var rt=ie;rt;rt=ft(rt))xe++;for(;0<ue-xe;)ae=ft(ae),ue--;for(;0<xe-ue;)ie=ft(ie),xe--;for(;ue--;){if(ae===ie||ie!==null&&ae===ie.alternate){ft=ae;break t}ae=ft(ae),ie=ft(ie)}ft=null}else ft=null;ye!==null&&UC(Ce,fe,ye,ft,!1),Ye!==null&&vn!==null&&UC(Ce,vn,Ye,ft,!0)}}e:{if(fe=de?Be(de):window,ye=fe.nodeName&&fe.nodeName.toLowerCase(),ye==="select"||ye==="input"&&fe.type==="file")var Jt=ax;else if(rx(fe))if(ox)Jt=g6;else{Jt=p6;var et=f6}else ye=fe.nodeName,!ye||ye.toLowerCase()!=="input"||fe.type!=="checkbox"&&fe.type!=="radio"?de&&Ms(de.elementType)&&(Jt=ax):Jt=m6;if(Jt&&(Jt=Jt(r,de))){sx(Ce,Jt,u,be);break e}et&&et(r,fe,de),r==="focusout"&&de&&fe.type==="number"&&de.memoizedProps.value!=null&&Ts(fe,"number",fe.value)}switch(et=de?Be(de):window,r){case"focusin":(rx(et)||et.contentEditable==="true")&&(zl=et,Bg=de,Eu=null);break;case"focusout":Eu=Bg=zl=null;break;case"mousedown":Pg=!0;break;case"contextmenu":case"mouseup":case"dragend":Pg=!1,mx(Ce,u,be);break;case"selectionchange":if(v6)break;case"keydown":case"keyup":mx(Ce,u,be)}var Ot;if(Og)e:{switch(r){case"compositionstart":var Gt="onCompositionStart";break e;case"compositionend":Gt="onCompositionEnd";break e;case"compositionupdate":Gt="onCompositionUpdate";break e}Gt=void 0}else $l?nx(r,u)&&(Gt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(Gt="onCompositionStart");Gt&&(Q1&&u.locale!=="ko"&&($l||Gt!=="onCompositionStart"?Gt==="onCompositionEnd"&&$l&&(Ot=V1()):(Ua=be,Tg="value"in Ua?Ua.value:Ua.textContent,$l=!0)),et=Nf(de,Gt),0<et.length&&(Gt=new Z1(Gt,r,null,u,be),Ce.push({event:Gt,listeners:et}),Ot?Gt.data=Ot:(Ot=ix(u),Ot!==null&&(Gt.data=Ot)))),(Ot=l6?c6(r,u):u6(r,u))&&(Gt=Nf(de,"onBeforeInput"),0<Gt.length&&(et=new Z1("onBeforeInput","beforeinput",null,u,be),Ce.push({event:et,listeners:Gt}),et.data=Ot)),tD(Ce,r,de,u,be)}FC(Ce,a)})}function Zu(r,a,u){return{instance:r,listener:a,currentTarget:u}}function Nf(r,a){for(var u=a+"Capture",h=[];r!==null;){var v=r,b=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||b===null||(v=vu(r,u),v!=null&&h.unshift(Zu(r,v,b)),v=vu(r,a),v!=null&&h.push(Zu(r,v,b))),r.tag===3)return h;r=r.return}return[]}function sD(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function UC(r,a,u,h,v){for(var b=a._reactName,A=[];u!==null&&u!==h;){var F=u,ne=F.alternate,de=F.stateNode;if(F=F.tag,ne!==null&&ne===h)break;F!==5&&F!==26&&F!==27||de===null||(ne=de,v?(de=vu(u,b),de!=null&&A.unshift(Zu(u,de,ne))):v||(de=vu(u,b),de!=null&&A.push(Zu(u,de,ne)))),u=u.return}A.length!==0&&r.push({event:a,listeners:A})}var aD=/\r\n?/g,oD=/\u0000|\uFFFD/g;function WC(r){return(typeof r=="string"?r:""+r).replace(aD,`
9
+ `).replace(oD,"")}function qC(r,a){return a=WC(a),WC(r)===a}function yn(r,a,u,h,v,b){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||ut(r,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&ut(r,""+h);break;case"className":nn(r,"class",h);break;case"tabIndex":nn(r,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":nn(r,u,h);break;case"style":rn(r,h,b);break;case"data":if(a!=="object"){nn(r,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){r.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){r.removeAttribute(u);break}h=Ha(""+h),r.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){r.setAttribute(u,"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 b=="function"&&(u==="formAction"?(a!=="input"&&yn(r,a,"name",v.name,v,null),yn(r,a,"formEncType",v.formEncType,v,null),yn(r,a,"formMethod",v.formMethod,v,null),yn(r,a,"formTarget",v.formTarget,v,null)):(yn(r,a,"encType",v.encType,v,null),yn(r,a,"method",v.method,v,null),yn(r,a,"target",v.target,v,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){r.removeAttribute(u);break}h=Ha(""+h),r.setAttribute(u,h);break;case"onClick":h!=null&&(r.onclick=Oe);break;case"onScroll":h!=null&&Ht("scroll",r);break;case"onScrollEnd":h!=null&&Ht("scrollend",r);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(u=h.__html,u!=null){if(v.children!=null)throw Error(i(60));r.innerHTML=u}}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}u=Ha(""+h),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);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(u,""+h):r.removeAttribute(u);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(u,""):r.removeAttribute(u);break;case"capture":case"download":h===!0?r.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?r.setAttribute(u,h):r.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?r.setAttribute(u,h):r.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?r.removeAttribute(u):r.setAttribute(u,h);break;case"popover":Ht("beforetoggle",r),Ht("toggle",r),Yt(r,"popover",h);break;case"xlinkActuate":xn(r,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":xn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":xn(r,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":xn(r,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":xn(r,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":xn(r,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":xn(r,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":xn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":xn(r,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Yt(r,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=fs.get(u)||u,Yt(r,u,h))}}function cv(r,a,u,h,v,b){switch(u){case"style":rn(r,h,b);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(u=h.__html,u!=null){if(v.children!=null)throw Error(i(60));r.innerHTML=u}}break;case"children":typeof h=="string"?ut(r,h):(typeof h=="number"||typeof h=="bigint")&&ut(r,""+h);break;case"onScroll":h!=null&&Ht("scroll",r);break;case"onScrollEnd":h!=null&&Ht("scrollend",r);break;case"onClick":h!=null&&(r.onclick=Oe);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cn.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(v=u.endsWith("Capture"),a=u.slice(2,v?u.length-7:void 0),b=r[oe]||null,b=b!=null?b[u]:null,typeof b=="function"&&r.removeEventListener(a,b,v),typeof h=="function")){typeof b!="function"&&b!==null&&(u in r?r[u]=null:r.hasAttribute(u)&&r.removeAttribute(u)),r.addEventListener(a,h,v);break e}u in r?r[u]=h:h===!0?r.setAttribute(u,""):Yt(r,u,h)}}}function $i(r,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ht("error",r),Ht("load",r);var h=!1,v=!1,b;for(b in u)if(u.hasOwnProperty(b)){var A=u[b];if(A!=null)switch(b){case"src":h=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:yn(r,a,b,A,u,null)}}v&&yn(r,a,"srcSet",u.srcSet,u,null),h&&yn(r,a,"src",u.src,u,null);return;case"input":Ht("invalid",r);var F=b=A=v=null,ne=null,de=null;for(h in u)if(u.hasOwnProperty(h)){var be=u[h];if(be!=null)switch(h){case"name":v=be;break;case"type":A=be;break;case"checked":ne=be;break;case"defaultChecked":de=be;break;case"value":b=be;break;case"defaultValue":F=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(i(137,a));break;default:yn(r,a,h,be,u,null)}}cr(r,b,F,ne,de,A,v,!1);return;case"select":Ht("invalid",r),h=A=b=null;for(v in u)if(u.hasOwnProperty(v)&&(F=u[v],F!=null))switch(v){case"value":b=F;break;case"defaultValue":A=F;break;case"multiple":h=F;default:yn(r,a,v,F,u,null)}a=b,u=A,r.multiple=!!h,a!=null?Zn(r,!!h,a,!1):u!=null&&Zn(r,!!h,u,!0);return;case"textarea":Ht("invalid",r),b=v=h=null;for(A in u)if(u.hasOwnProperty(A)&&(F=u[A],F!=null))switch(A){case"value":h=F;break;case"defaultValue":v=F;break;case"children":b=F;break;case"dangerouslySetInnerHTML":if(F!=null)throw Error(i(91));break;default:yn(r,a,A,F,u,null)}Rs(r,h,v,b);return;case"option":for(ne in u)u.hasOwnProperty(ne)&&(h=u[ne],h!=null)&&(ne==="selected"?r.selected=h&&typeof h!="function"&&typeof h!="symbol":yn(r,a,ne,h,u,null));return;case"dialog":Ht("beforetoggle",r),Ht("toggle",r),Ht("cancel",r),Ht("close",r);break;case"iframe":case"object":Ht("load",r);break;case"video":case"audio":for(h=0;h<Xu.length;h++)Ht(Xu[h],r);break;case"image":Ht("error",r),Ht("load",r);break;case"details":Ht("toggle",r);break;case"embed":case"source":case"link":Ht("error",r),Ht("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(de in u)if(u.hasOwnProperty(de)&&(h=u[de],h!=null))switch(de){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,a));default:yn(r,a,de,h,u,null)}return;default:if(Ms(a)){for(be in u)u.hasOwnProperty(be)&&(h=u[be],h!==void 0&&cv(r,a,be,h,u,void 0));return}}for(F in u)u.hasOwnProperty(F)&&(h=u[F],h!=null&&yn(r,a,F,h,u,null))}function lD(r,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,b=null,A=null,F=null,ne=null,de=null,be=null;for(ye in u){var Ce=u[ye];if(u.hasOwnProperty(ye)&&Ce!=null)switch(ye){case"checked":break;case"value":break;case"defaultValue":ne=Ce;default:h.hasOwnProperty(ye)||yn(r,a,ye,null,h,Ce)}}for(var fe in h){var ye=h[fe];if(Ce=u[fe],h.hasOwnProperty(fe)&&(ye!=null||Ce!=null))switch(fe){case"type":b=ye;break;case"name":v=ye;break;case"checked":de=ye;break;case"defaultChecked":be=ye;break;case"value":A=ye;break;case"defaultValue":F=ye;break;case"children":case"dangerouslySetInnerHTML":if(ye!=null)throw Error(i(137,a));break;default:ye!==Ce&&yn(r,a,fe,ye,h,Ce)}}zr(r,A,F,ne,de,be,b,v);return;case"select":ye=A=F=fe=null;for(b in u)if(ne=u[b],u.hasOwnProperty(b)&&ne!=null)switch(b){case"value":break;case"multiple":ye=ne;default:h.hasOwnProperty(b)||yn(r,a,b,null,h,ne)}for(v in h)if(b=h[v],ne=u[v],h.hasOwnProperty(v)&&(b!=null||ne!=null))switch(v){case"value":fe=b;break;case"defaultValue":F=b;break;case"multiple":A=b;default:b!==ne&&yn(r,a,v,b,h,ne)}a=F,u=A,h=ye,fe!=null?Zn(r,!!u,fe,!1):!!h!=!!u&&(a!=null?Zn(r,!!u,a,!0):Zn(r,!!u,u?[]:"",!1));return;case"textarea":ye=fe=null;for(F in u)if(v=u[F],u.hasOwnProperty(F)&&v!=null&&!h.hasOwnProperty(F))switch(F){case"value":break;case"children":break;default:yn(r,a,F,null,h,v)}for(A in h)if(v=h[A],b=u[A],h.hasOwnProperty(A)&&(v!=null||b!=null))switch(A){case"value":fe=v;break;case"defaultValue":ye=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(i(91));break;default:v!==b&&yn(r,a,A,v,h,b)}ri(r,fe,ye);return;case"option":for(var Ye in u)fe=u[Ye],u.hasOwnProperty(Ye)&&fe!=null&&!h.hasOwnProperty(Ye)&&(Ye==="selected"?r.selected=!1:yn(r,a,Ye,null,h,fe));for(ne in h)fe=h[ne],ye=u[ne],h.hasOwnProperty(ne)&&fe!==ye&&(fe!=null||ye!=null)&&(ne==="selected"?r.selected=fe&&typeof fe!="function"&&typeof fe!="symbol":yn(r,a,ne,fe,h,ye));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 ft in u)fe=u[ft],u.hasOwnProperty(ft)&&fe!=null&&!h.hasOwnProperty(ft)&&yn(r,a,ft,null,h,fe);for(de in h)if(fe=h[de],ye=u[de],h.hasOwnProperty(de)&&fe!==ye&&(fe!=null||ye!=null))switch(de){case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(i(137,a));break;default:yn(r,a,de,fe,h,ye)}return;default:if(Ms(a)){for(var vn in u)fe=u[vn],u.hasOwnProperty(vn)&&fe!==void 0&&!h.hasOwnProperty(vn)&&cv(r,a,vn,void 0,h,fe);for(be in h)fe=h[be],ye=u[be],!h.hasOwnProperty(be)||fe===ye||fe===void 0&&ye===void 0||cv(r,a,be,fe,h,ye);return}}for(var ae in u)fe=u[ae],u.hasOwnProperty(ae)&&fe!=null&&!h.hasOwnProperty(ae)&&yn(r,a,ae,null,h,fe);for(Ce in h)fe=h[Ce],ye=u[Ce],!h.hasOwnProperty(Ce)||fe===ye||fe==null&&ye==null||yn(r,a,Ce,fe,h,ye)}function GC(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cD(){if(typeof performance.getEntriesByType=="function"){for(var r=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var v=u[h],b=v.transferSize,A=v.initiatorType,F=v.duration;if(b&&F&&GC(A)){for(A=0,F=v.responseEnd,h+=1;h<u.length;h++){var ne=u[h],de=ne.startTime;if(de>F)break;var be=ne.transferSize,Ce=ne.initiatorType;be&&GC(Ce)&&(ne=ne.responseEnd,A+=be*(ne<F?1:(F-de)/(ne-de)))}if(--h,a+=8*(b+A)/(v.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 uv=null,dv=null;function Lf(r){return r.nodeType===9?r:r.ownerDocument}function KC(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 VC(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 hv(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 fv=null;function uD(){var r=window.event;return r&&r.type==="popstate"?r===fv?!1:(fv=r,!0):(fv=null,!1)}var YC=typeof setTimeout=="function"?setTimeout:void 0,dD=typeof clearTimeout=="function"?clearTimeout:void 0,XC=typeof Promise=="function"?Promise:void 0,hD=typeof queueMicrotask=="function"?queueMicrotask:typeof XC<"u"?function(r){return XC.resolve(null).then(r).catch(fD)}:YC;function fD(r){setTimeout(function(){throw r})}function ao(r){return r==="head"}function ZC(r,a){var u=a,h=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"||u==="/&"){if(h===0){r.removeChild(v),fc(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Ju(r.ownerDocument.documentElement);else if(u==="head"){u=r.ownerDocument.head,Ju(u);for(var b=u.firstChild;b;){var A=b.nextSibling,F=b.nodeName;b[Si]||F==="SCRIPT"||F==="STYLE"||F==="LINK"&&b.rel.toLowerCase()==="stylesheet"||u.removeChild(b),b=A}}else u==="body"&&Ju(r.ownerDocument.body);u=v}while(u);fc(a)}function JC(r,a){var u=r;r=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(r===0)break;r--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||r++;u=h}while(u)}function pv(r){var a=r.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":pv(u),Ge(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}r.removeChild(u)}}function pD(r,a,u,h){for(;r.nodeType===1;){var v=u;if(r.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(h){if(!r[Si])switch(a){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(b=r.getAttribute("rel"),b==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(b!==v.rel||r.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||r.getAttribute("title")!==(v.title==null?null:v.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(b=r.getAttribute("src"),(b!==(v.src==null?null:v.src)||r.getAttribute("type")!==(v.type==null?null:v.type)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&b&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(a==="input"&&r.type==="hidden"){var b=v.name==null?null:""+v.name;if(v.type==="hidden"&&r.getAttribute("name")===b)return r}else return r;if(r=Vr(r.nextSibling),r===null)break}return null}function mD(r,a,u){if(a==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!u||(r=Vr(r.nextSibling),r===null))return null;return r}function QC(r,a){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!a||(r=Vr(r.nextSibling),r===null))return null;return r}function mv(r){return r.data==="$?"||r.data==="$~"}function gv(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function gD(r,a){var u=r.ownerDocument;if(r.data==="$~")r._reactRetry=a;else if(r.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),r._reactRetry=h}}function Vr(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 yv=null;function eE(r){r=r.nextSibling;for(var a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"||u==="/&"){if(a===0)return Vr(r.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}r=r.nextSibling}return null}function tE(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return r;a--}else u!=="/$"&&u!=="/&"||a++}r=r.previousSibling}return null}function nE(r,a,u){switch(a=Lf(u),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]);Ge(r)}var Yr=new Map,iE=new Set;function Of(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ba=L.d;L.d={f:yD,r:vD,D:_D,C:bD,L:wD,m:SD,X:kD,S:xD,M:CD};function yD(){var r=ba.f(),a=kf();return r||a}function vD(r){var a=ve(r);a!==null&&a.tag===5&&a.type==="form"?bk(a):ba.r(r)}var uc=typeof document>"u"?null:document;function rE(r,a,u){var h=uc;if(h&&typeof a=="string"&&a){var v=mn(a);v='link[rel="'+r+'"][href="'+v+'"]',typeof u=="string"&&(v+='[crossorigin="'+u+'"]'),iE.has(v)||(iE.add(v),r={rel:r,crossOrigin:u,href:a},h.querySelector(v)===null&&(a=h.createElement("link"),$i(a,"link",r),Et(a),h.head.appendChild(a)))}}function _D(r){ba.D(r),rE("dns-prefetch",r,null)}function bD(r,a){ba.C(r,a),rE("preconnect",r,a)}function wD(r,a,u){ba.L(r,a,u);var h=uc;if(h&&r&&a){var v='link[rel="preload"][as="'+mn(a)+'"]';a==="image"&&u&&u.imageSrcSet?(v+='[imagesrcset="'+mn(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(v+='[imagesizes="'+mn(u.imageSizes)+'"]')):v+='[href="'+mn(r)+'"]';var b=v;switch(a){case"style":b=dc(r);break;case"script":b=hc(r)}Yr.has(b)||(r=y({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:r,as:a},u),Yr.set(b,r),h.querySelector(v)!==null||a==="style"&&h.querySelector(Qu(b))||a==="script"&&h.querySelector(ed(b))||(a=h.createElement("link"),$i(a,"link",r),Et(a),h.head.appendChild(a)))}}function SD(r,a){ba.m(r,a);var u=uc;if(u&&r){var h=a&&typeof a.as=="string"?a.as:"script",v='link[rel="modulepreload"][as="'+mn(h)+'"][href="'+mn(r)+'"]',b=v;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=hc(r)}if(!Yr.has(b)&&(r=y({rel:"modulepreload",href:r},a),Yr.set(b,r),u.querySelector(v)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(ed(b)))return}h=u.createElement("link"),$i(h,"link",r),Et(h),u.head.appendChild(h)}}}function xD(r,a,u){ba.S(r,a,u);var h=uc;if(h&&r){var v=zt(h).hoistableStyles,b=dc(r);a=a||"default";var A=v.get(b);if(!A){var F={loading:0,preload:null};if(A=h.querySelector(Qu(b)))F.loading=5;else{r=y({rel:"stylesheet",href:r,"data-precedence":a},u),(u=Yr.get(b))&&vv(r,u);var ne=A=h.createElement("link");Et(ne),$i(ne,"link",r),ne._p=new Promise(function(de,be){ne.onload=de,ne.onerror=be}),ne.addEventListener("load",function(){F.loading|=1}),ne.addEventListener("error",function(){F.loading|=2}),F.loading|=4,If(A,a,h)}A={type:"stylesheet",instance:A,count:1,state:F},v.set(b,A)}}}function kD(r,a){ba.X(r,a);var u=uc;if(u&&r){var h=zt(u).hoistableScripts,v=hc(r),b=h.get(v);b||(b=u.querySelector(ed(v)),b||(r=y({src:r,async:!0},a),(a=Yr.get(v))&&_v(r,a),b=u.createElement("script"),Et(b),$i(b,"link",r),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},h.set(v,b))}}function CD(r,a){ba.M(r,a);var u=uc;if(u&&r){var h=zt(u).hoistableScripts,v=hc(r),b=h.get(v);b||(b=u.querySelector(ed(v)),b||(r=y({src:r,async:!0,type:"module"},a),(a=Yr.get(v))&&_v(r,a),b=u.createElement("script"),Et(b),$i(b,"link",r),u.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},h.set(v,b))}}function sE(r,a,u,h){var v=(v=Z.current)?Of(v):null;if(!v)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=dc(u.href),u=zt(v).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){r=dc(u.href);var b=zt(v).hoistableStyles,A=b.get(r);if(A||(v=v.ownerDocument||v,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(r,A),(b=v.querySelector(Qu(r)))&&!b._p&&(A.instance=b,A.state.loading=5),Yr.has(r)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Yr.set(r,u),b||ED(v,r,u,A.state))),a&&h===null)throw Error(i(528,""));return A}if(a&&h!==null)throw Error(i(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=hc(u),u=zt(v).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function dc(r){return'href="'+mn(r)+'"'}function Qu(r){return'link[rel="stylesheet"]['+r+"]"}function aE(r){return y({},r,{"data-precedence":r.precedence,precedence:null})}function ED(r,a,u,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}),$i(a,"link",u),Et(a),r.head.appendChild(a))}function hc(r){return'[src="'+mn(r)+'"]'}function ed(r){return"script[async]"+r}function oE(r,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=r.querySelector('style[data-href~="'+mn(u.href)+'"]');if(h)return a.instance=h,Et(h),h;var v=y({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),Et(h),$i(h,"style",v),If(h,u.precedence,r),a.instance=h;case"stylesheet":v=dc(u.href);var b=r.querySelector(Qu(v));if(b)return a.state.loading|=4,a.instance=b,Et(b),b;h=aE(u),(v=Yr.get(v))&&vv(h,v),b=(r.ownerDocument||r).createElement("link"),Et(b);var A=b;return A._p=new Promise(function(F,ne){A.onload=F,A.onerror=ne}),$i(b,"link",h),a.state.loading|=4,If(b,u.precedence,r),a.instance=b;case"script":return b=hc(u.src),(v=r.querySelector(ed(b)))?(a.instance=v,Et(v),v):(h=u,(v=Yr.get(b))&&(h=y({},u),_v(h,v)),r=r.ownerDocument||r,v=r.createElement("script"),Et(v),$i(v,"link",h),r.head.appendChild(v),a.instance=v);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,If(h,u.precedence,r));return a.instance}function If(r,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=h.length?h[h.length-1]:null,b=v,A=0;A<h.length;A++){var F=h[A];if(F.dataset.precedence===a)b=F;else if(b!==v)break}b?b.parentNode.insertBefore(r,b.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(r,a.firstChild))}function vv(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.title==null&&(r.title=a.title)}function _v(r,a){r.crossOrigin==null&&(r.crossOrigin=a.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=a.referrerPolicy),r.integrity==null&&(r.integrity=a.integrity)}var jf=null;function lE(r,a,u){if(jf===null){var h=new Map,v=jf=new Map;v.set(u,h)}else v=jf,h=v.get(u),h||(h=new Map,v.set(u,h));if(h.has(r))return h;for(h.set(r,null),u=u.getElementsByTagName(r),v=0;v<u.length;v++){var b=u[v];if(!(b[Si]||b[Kt]||r==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var A=b.getAttribute(a)||"";A=r+A;var F=h.get(A);F?F.push(b):h.set(A,[b])}}return h}function cE(r,a,u){r=r.ownerDocument||r,r.head.insertBefore(u,a==="title"?r.querySelector("head > title"):null)}function AD(r,a,u){if(u===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 uE(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function TD(r,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var v=dc(h.href),b=a.querySelector(Qu(v));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(r.count++,r=Df.bind(r),a.then(r,r)),u.state.loading|=4,u.instance=b,Et(b);return}b=a.ownerDocument||a,h=aE(h),(v=Yr.get(v))&&vv(h,v),b=b.createElement("link"),Et(b);var A=b;A._p=new Promise(function(F,ne){A.onload=F,A.onerror=ne}),$i(b,"link",h),u.instance=b}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(r.count++,u=Df.bind(r),a.addEventListener("load",u),a.addEventListener("error",u))}}var bv=0;function RD(r,a){return r.stylesheets&&r.count===0&&Pf(r,r.stylesheets),0<r.count||0<r.imgCount?function(u){var h=setTimeout(function(){if(r.stylesheets&&Pf(r,r.stylesheets),r.unsuspend){var b=r.unsuspend;r.unsuspend=null,b()}},6e4+a);0<r.imgBytes&&bv===0&&(bv=62500*cD());var v=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Pf(r,r.stylesheets),r.unsuspend)){var b=r.unsuspend;r.unsuspend=null,b()}},(r.imgBytes>bv?50:800)+a);return r.unsuspend=u,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(v)}}:null}function Df(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Pf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Bf=null;function Pf(r,a){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Bf=new Map,a.forEach(MD,r),Bf=null,Df.call(r))}function MD(r,a){if(!(a.state.loading&4)){var u=Bf.get(r);if(u)var h=u.get(null);else{u=new Map,Bf.set(r,u);for(var v=r.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<v.length;b++){var A=v[b];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(u.set(A.dataset.precedence,A),h=A)}h&&u.set(null,h)}v=a.instance,A=v.getAttribute("data-precedence"),b=u.get(A)||h,b===h&&u.set(null,v),u.set(A,v),this.count++,h=Df.bind(this),v.addEventListener("load",h),v.addEventListener("error",h),b?b.parentNode.insertBefore(v,b.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(v,r.firstChild)),a.state.loading|=4}}var td={$$typeof:H,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function ND(r,a,u,h,v,b,A,F,ne){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=Rt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.hiddenUpdates=Rt(null),this.identifierPrefix=h,this.onUncaughtError=v,this.onCaughtError=b,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.incompleteTransitions=new Map}function dE(r,a,u,h,v,b,A,F,ne,de,be,Ce){return r=new ND(r,a,u,A,ne,de,be,Ce,F),a=1,b===!0&&(a|=24),b=Cr(3,null,null,a),r.current=b,b.stateNode=r,a=Qg(),a.refCount++,r.pooledCache=a,a.refCount++,b.memoizedState={element:h,isDehydrated:u,cache:a},iy(b),r}function hE(r){return r?(r=Ul,r):Ul}function fE(r,a,u,h,v,b){v=hE(v),h.context===null?h.context=v:h.pendingContext=v,h=Ya(a),h.payload={element:u},b=b===void 0?null:b,b!==null&&(h.callback=b),u=Xa(r,h,a),u!==null&&(mr(u,r,a),Ou(u,r,a))}function pE(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<a?u:a}}function wv(r,a){pE(r,a),(r=r.alternate)&&pE(r,a)}function mE(r){if(r.tag===13||r.tag===31){var a=Vo(r,67108864);a!==null&&mr(a,r,67108864),wv(r,67108864)}}function gE(r){if(r.tag===13||r.tag===31){var a=Mr();a=xt(a);var u=Vo(r,a);u!==null&&mr(u,r,a),wv(r,a)}}var $f=!0;function LD(r,a,u,h){var v=E.T;E.T=null;var b=L.p;try{L.p=2,Sv(r,a,u,h)}finally{L.p=b,E.T=v}}function OD(r,a,u,h){var v=E.T;E.T=null;var b=L.p;try{L.p=8,Sv(r,a,u,h)}finally{L.p=b,E.T=v}}function Sv(r,a,u,h){if($f){var v=xv(h);if(v===null)lv(r,a,h,zf,u),vE(r,h);else if(jD(v,r,a,u,h))h.stopPropagation();else if(vE(r,h),a&4&&-1<ID.indexOf(r)){for(;v!==null;){var b=ve(v);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var A=We(b.pendingLanes);if(A!==0){var F=b;for(F.pendingLanes|=2,F.entangledLanes|=2;A;){var ne=1<<31-Nt(A);F.entanglements[1]|=ne,A&=~ne}Is(b),(sn&6)===0&&(Sf=tt()+500,Yu(0))}}break;case 31:case 13:F=Vo(b,2),F!==null&&mr(F,b,2),kf(),wv(b,2)}if(b=xv(h),b===null&&lv(r,a,h,zf,u),b===v)break;v=b}v!==null&&h.stopPropagation()}else lv(r,a,h,null,u)}}function xv(r){return r=Mt(r),kv(r)}var zf=null;function kv(r){if(zf=null,r=Q(r),r!==null){var a=o(r);if(a===null)r=null;else{var u=a.tag;if(u===13){if(r=l(a),r!==null)return r;r=null}else if(u===31){if(r=d(a),r!==null)return r;r=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null)}}return zf=r,null}function yE(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(cn()){case ke:return 2;case De:return 8;case Xe:case _t:return 32;case ht:return 268435456;default:return 32}default:return 32}}var Cv=!1,oo=null,lo=null,co=null,nd=new Map,id=new Map,uo=[],ID="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 vE(r,a){switch(r){case"focusin":case"focusout":oo=null;break;case"dragenter":case"dragleave":lo=null;break;case"mouseover":case"mouseout":co=null;break;case"pointerover":case"pointerout":nd.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":id.delete(a.pointerId)}}function rd(r,a,u,h,v,b){return r===null||r.nativeEvent!==b?(r={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:b,targetContainers:[v]},a!==null&&(a=ve(a),a!==null&&mE(a)),r):(r.eventSystemFlags|=h,a=r.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),r)}function jD(r,a,u,h,v){switch(a){case"focusin":return oo=rd(oo,r,a,u,h,v),!0;case"dragenter":return lo=rd(lo,r,a,u,h,v),!0;case"mouseover":return co=rd(co,r,a,u,h,v),!0;case"pointerover":var b=v.pointerId;return nd.set(b,rd(nd.get(b)||null,r,a,u,h,v)),!0;case"gotpointercapture":return b=v.pointerId,id.set(b,rd(id.get(b)||null,r,a,u,h,v)),!0}return!1}function _E(r){var a=Q(r.target);if(a!==null){var u=o(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){r.blockedOn=a,pi(r.priority,function(){gE(u)});return}}else if(a===31){if(a=d(u),a!==null){r.blockedOn=a,pi(r.priority,function(){gE(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Ff(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var u=xv(r.nativeEvent);if(u===null){u=r.nativeEvent;var h=new u.constructor(u.type,u);Qe=h,u.target.dispatchEvent(h),Qe=null}else return a=ve(u),a!==null&&mE(a),r.blockedOn=u,!1;a.shift()}return!0}function bE(r,a,u){Ff(r)&&u.delete(a)}function DD(){Cv=!1,oo!==null&&Ff(oo)&&(oo=null),lo!==null&&Ff(lo)&&(lo=null),co!==null&&Ff(co)&&(co=null),nd.forEach(bE),id.forEach(bE)}function Hf(r,a){r.blockedOn===a&&(r.blockedOn=null,Cv||(Cv=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,DD)))}var Uf=null;function wE(r){Uf!==r&&(Uf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uf===r&&(Uf=null);for(var a=0;a<r.length;a+=3){var u=r[a],h=r[a+1],v=r[a+2];if(typeof h!="function"){if(kv(h||u)===null)continue;break}var b=ve(u);b!==null&&(r.splice(a,3),a-=3,xy(b,{pending:!0,data:v,method:u.method,action:h},h,v))}}))}function fc(r){function a(ne){return Hf(ne,r)}oo!==null&&Hf(oo,r),lo!==null&&Hf(lo,r),co!==null&&Hf(co,r),nd.forEach(a),id.forEach(a);for(var u=0;u<uo.length;u++){var h=uo[u];h.blockedOn===r&&(h.blockedOn=null)}for(;0<uo.length&&(u=uo[0],u.blockedOn===null);)_E(u),u.blockedOn===null&&uo.shift();if(u=(r.ownerDocument||r).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var v=u[h],b=u[h+1],A=v[oe]||null;if(typeof b=="function")A||wE(u);else if(A){var F=null;if(b&&b.hasAttribute("formAction")){if(v=b,A=b[oe]||null)F=A.formAction;else if(kv(v)!==null)continue}else F=A.action;typeof F=="function"?u[h+1]=F:(u.splice(h,3),h-=3),wE(u)}}}function SE(){function r(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(A){return v=A})},focusReset:"manual",scroll:"manual"})}function a(){v!==null&&(v(),v=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,v=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),v!==null&&(v(),v=null)}}}function Ev(r){this._internalRoot=r}Wf.prototype.render=Ev.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(i(409));var u=a.current,h=Mr();fE(u,h,r,a,null,null)},Wf.prototype.unmount=Ev.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;fE(r.current,2,null,r,null,null),kf(),a[qe]=null}};function Wf(r){this._internalRoot=r}Wf.prototype.unstable_scheduleHydration=function(r){if(r){var a=Xn();r={blockedOn:null,target:r,priority:a};for(var u=0;u<uo.length&&a!==0&&a<uo[u].priority;u++);uo.splice(u,0,r),u===0&&_E(r)}};var xE=t.version;if(xE!=="19.2.7")throw Error(i(527,xE,"19.2.7"));L.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 BD={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var qf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qf.isDisabled&&qf.supportsFiber)try{_e=qf.inject(BD),Ne=qf}catch{}}return ad.createRoot=function(r,a){if(!s(r))throw Error(i(299));var u=!1,h="",v=Mk,b=Nk,A=Lk;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=dE(r,1,!1,null,null,u,h,null,v,b,A,SE),r[qe]=a.current,ov(r),new Ev(a)},ad.hydrateRoot=function(r,a,u){if(!s(r))throw Error(i(299));var h=!1,v="",b=Mk,A=Nk,F=Lk,ne=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(v=u.identifierPrefix),u.onUncaughtError!==void 0&&(b=u.onUncaughtError),u.onCaughtError!==void 0&&(A=u.onCaughtError),u.onRecoverableError!==void 0&&(F=u.onRecoverableError),u.formState!==void 0&&(ne=u.formState)),a=dE(r,1,!0,a,u??null,h,v,ne,b,A,F,SE),a.context=hE(null),u=a.current,h=Mr(),h=xt(h),v=Ya(h),v.callback=null,Xa(u,v,h),u=h,a.current.lanes=u,ct(a,u),Is(a),r[qe]=a.current,ov(r),new Wf(a)},ad.version="19.2.7",ad}var IE;function L4(){if(IE)return Nv.exports;IE=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(),Nv.exports=N4(),Nv.exports}var LR=L4();var jE="popstate";function DE(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function O4(e={}){function t(i,s){let o=s.state?.masked,{pathname:l,search:d,hash:f}=o||i.location;return gb("",{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:ih(s)}return j4(t,n,null,e)}function Dn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ws(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function I4(){return Math.random().toString(36).substring(2,10)}function BE(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 gb(e,t,n=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ou(t):t,state:n,key:t&&t.key||i||I4(),mask:s}}function ih({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 ou(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 j4(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(),C=k==null?null:k-p;p=k,f&&f({action:d,location:x.location,delta:C})}function _(k,C){d="PUSH";let B=DE(k)?k:gb(x.location,k,C);p=m()+1;let H=BE(B,p),T=x.createHref(B.mask||B);try{l.pushState(H,"",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,C){d="REPLACE";let B=DE(k)?k:gb(x.location,k,C);p=m();let H=BE(B,p),T=x.createHref(B.mask||B);l.replaceState(H,"",T),o&&f&&f({action:d,location:x.location,delta:0})}function S(k){return D4(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(jE,y),f=k,()=>{s.removeEventListener(jE,y),f=null}},createHref(k){return t(s,k)},createURL:S,encodeLocation(k){let C=S(k);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:_,replace:w,go(k){return l.go(k)}};return x}function D4(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),Dn(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:ih(t);return s=s.replace(/ $/,"%20"),!n&&s.startsWith("//")&&(s=i+s),new URL(s,i)}function OR(e,t,n="/"){return B4(e,t,n,!1)}function B4(e,t,n,i,s){let o=typeof t=="string"?ou(t):t,l=Pa(o.pathname||"/",n);if(l==null)return null;let d=P4(e),f=null,p=X4(l);for(let m=0;f==null&&m<d.length;++m)f=V4(d[m],p,i);return f}function P4(e){let t=IR(e);return $4(t),t}function IR(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;Dn(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=bs([i,m.relativePath]),_=n.concat(m);l.children&&l.children.length>0&&(Dn(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),IR(l.children,t,_,y,f)),!(l.path==null&&!l.index)&&t.push({path:y,score:G4(y,l.index),routesMeta:_})};return e.forEach((l,d)=>{if(l.path===""||!l.path?.includes("?"))o(l,d);else for(let f of jR(l.path))o(l,d,!0,f)}),t}function jR(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=jR(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 $4(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:K4(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var z4=/^:[\w-]+$/,F4=3,H4=2,U4=1,W4=10,q4=-2,PE=e=>e==="*";function G4(e,t){let n=e.split("/"),i=n.length;return n.some(PE)&&(i+=q4),t&&(i+=H4),n.filter(s=>!PE(s)).reduce((s,o)=>s+(z4.test(o)?F4:o===""?U4:W4),i)}function K4(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 V4(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=im({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},m),_=f.route;if(!y&&p&&n&&!i[i.length-1].route.index&&(y=im({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!y)return null;Object.assign(s,y.params),l.push({params:s,pathname:bs([o,y.pathname]),pathnameBase:eB(bs([o,y.pathnameBase])),route:_}),y.pathnameBase!=="/"&&(o=bs([o,y.pathnameBase]))}return l}function im(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=Y4(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},_)=>{if(m==="*"){let S=d[_]||"";l=o.slice(0,o.length-S.length).replace(/(.)\/+$/,"$1")}const w=d[_];return y&&!w?p[m]=void 0:p[m]=(w||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:e}}function Y4(e,t=!1,n=!0){ws(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 X4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ws(!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 Pa(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 Z4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function J4(e,t="/"){let{pathname:n,search:i="",hash:s=""}=typeof e=="string"?ou(e):e,o;return n?(n=DR(n),n.startsWith("/")?o=$E(n.substring(1),"/"):o=$E(n,t)):o=t,{pathname:o,search:tB(i),hash:nB(s)}}function $E(e,t){let n=rm(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Iv(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 Q4(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function X0(e){let t=Q4(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function tg(e,t,n,i=!1){let s;typeof e=="string"?s=ou(e):(s={...e},Dn(!s.pathname||!s.pathname.includes("?"),Iv("?","pathname","search",s)),Dn(!s.pathname||!s.pathname.includes("#"),Iv("#","pathname","hash",s)),Dn(!s.search||!s.search.includes("#"),Iv("#","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 _=l.split("/");for(;_[0]==="..";)_.shift(),y-=1;s.pathname=_.join("/")}d=y>=0?t[y]:"/"}let f=J4(s,d),p=l&&l!=="/"&&l.endsWith("/"),m=(o||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||m)&&(f.pathname+="/"),f}var DR=e=>e.replace(/\/\/+/g,"/"),bs=e=>DR(e.join("/")),rm=e=>e.replace(/\/+$/,""),eB=e=>rm(e).replace(/^\/*/,"/"),tB=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nB=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,iB=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 rB(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function sB(e){let t=e.map(n=>n.route.path).filter(Boolean);return bs(t)||"/"}var BR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function PR(e,t){let n=e;if(typeof n!="string"||!Z4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,s=!1;if(BR)try{let o=new URL(window.location.href),l=n.startsWith("//")?new URL(o.protocol+n):new URL(n),d=Pa(l.pathname,t);l.origin===o.origin&&d!=null?n=d+l.search+l.hash:s=!0}catch{ws(!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 $R=["POST","PUT","PATCH","DELETE"];new Set($R);var aB=["GET",...$R];new Set(aB);var lu=g.createContext(null);lu.displayName="DataRouter";var ng=g.createContext(null);ng.displayName="DataRouterState";var zR=g.createContext(!1);function oB(){return g.useContext(zR)}var FR=g.createContext({isTransitioning:!1});FR.displayName="ViewTransition";var lB=g.createContext(new Map);lB.displayName="Fetchers";var cB=g.createContext(null);cB.displayName="Await";var Pr=g.createContext(null);Pr.displayName="Navigation";var kh=g.createContext(null);kh.displayName="Location";var ta=g.createContext({outlet:null,matches:[],isDataRoute:!1});ta.displayName="Route";var Z0=g.createContext(null);Z0.displayName="RouteError";var HR="REACT_ROUTER_ERROR",uB="REDIRECT",dB="ROUTE_ERROR_RESPONSE";function hB(e){if(e.startsWith(`${HR}:${uB}:{`))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 fB(e){if(e.startsWith(`${HR}:${dB}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new iB(t.status,t.statusText,t.data)}catch{}}function pB(e,{relative:t}={}){Dn(cu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=g.useContext(Pr),{hash:s,pathname:o,search:l}=Ch(e,{relative:t}),d=o;return n!=="/"&&(d=o==="/"?n:bs([n,o])),i.createHref({pathname:d,search:l,hash:s})}function cu(){return g.useContext(kh)!=null}function $r(){return Dn(cu(),"useLocation() may be used only in the context of a <Router> component."),g.useContext(kh).location}var UR="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function WR(e){g.useContext(Pr).static||g.useLayoutEffect(e)}function uu(){let{isDataRoute:e}=g.useContext(ta);return e?AB():mB()}function mB(){Dn(cu(),"useNavigate() may be used only in the context of a <Router> component.");let e=g.useContext(lu),{basename:t,navigator:n}=g.useContext(Pr),{matches:i}=g.useContext(ta),{pathname:s}=$r(),o=JSON.stringify(X0(i)),l=g.useRef(!1);return WR(()=>{l.current=!0}),g.useCallback((f,p={})=>{if(ws(l.current,UR),!l.current)return;if(typeof f=="number"){n.go(f);return}let m=tg(f,JSON.parse(o),s,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:bs([t,m.pathname])),(p.replace?n.replace:n.push)(m,p.state,p)},[t,n,o,s,e])}g.createContext(null);function Ch(e,{relative:t}={}){let{matches:n}=g.useContext(ta),{pathname:i}=$r(),s=JSON.stringify(X0(n));return g.useMemo(()=>tg(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function gB(e,t){return qR(e,t)}function qR(e,t,n){Dn(cu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=g.useContext(Pr),{matches:s}=g.useContext(ta),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||"";KR(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=$r(),y;if(t){let k=typeof t=="string"?ou(t):t;Dn(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 _=y.pathname||"/",w=_;if(f!=="/"){let k=f.replace(/^\//,"").split("/");w="/"+_.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})):OR(e,{pathname:w});ws(p||S!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),ws(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=wB(S&&S.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:bs([f,i.encodeLocation?i.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?f:bs([f,i.encodeLocation?i.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),s,n);return t&&x?g.createElement(kh.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},x):x}function yB(){let e=EB(),t=rB(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=g.createElement(g.Fragment,null,g.createElement("p",null,"💿 Hey developer 👋"),g.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",g.createElement("code",{style:o},"ErrorBoundary")," or"," ",g.createElement("code",{style:o},"errorElement")," prop on your route.")),g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},t),n?g.createElement("pre",{style:s},n):null,l)}var vB=g.createElement(yB,null),GR=class extends g.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=fB(e.digest);n&&(e=n)}let t=e!==void 0?g.createElement(ta.Provider,{value:this.props.routeContext},g.createElement(Z0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?g.createElement(_B,{error:e},t):t}};GR.contextType=zR;var jv=new WeakMap;function _B({children:e,error:t}){let{basename:n}=g.useContext(Pr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let i=hB(t.digest);if(i){let s=jv.get(t);if(s)throw s;let o=PR(i.location,n);if(BR&&!jv.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 jv.set(t,l),l}return g.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function bB({routeContext:e,match:t,children:n}){let i=g.useContext(lu);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),g.createElement(ta.Provider,{value:e},n)}function wB(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);Dn(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:_,errors:w}=i,S=y.route.loader&&!_.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:sB(i.matches),errorInfo:y})}:void 0;return s.reduceRight((m,y,_)=>{let w,S=!1,x=null,k=null;i&&(w=o&&y.route.id?o[y.route.id]:void 0,x=y.route.errorElement||vB,l&&(d<0&&_===0?(KR("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,k=null):d===_&&(S=!0,k=y.route.hydrateFallbackElement||null)));let C=t.concat(s.slice(0,_+1)),B=()=>{let H;return w?H=x:S?H=k:y.route.Component?H=g.createElement(y.route.Component,null):y.route.element?H=y.route.element:H=m,g.createElement(bB,{match:y,routeContext:{outlet:m,matches:C,isDataRoute:i!=null},children:H})};return i&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?g.createElement(GR,{location:i.location,revalidation:i.revalidation,component:x,error:w,children:B(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:p}):B()},null)}function J0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function SB(e){let t=g.useContext(lu);return Dn(t,J0(e)),t}function xB(e){let t=g.useContext(ng);return Dn(t,J0(e)),t}function kB(e){let t=g.useContext(ta);return Dn(t,J0(e)),t}function Q0(e){let t=kB(e),n=t.matches[t.matches.length-1];return Dn(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function CB(){return Q0("useRouteId")}function EB(){let e=g.useContext(Z0),t=xB("useRouteError"),n=Q0("useRouteError");return e!==void 0?e:t.errors?.[n]}function AB(){let{router:e}=SB("useNavigate"),t=Q0("useNavigate"),n=g.useRef(!1);return WR(()=>{n.current=!0}),g.useCallback(async(s,o={})=>{ws(n.current,UR),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var zE={};function KR(e,t,n){!t&&!zE[e]&&(zE[e]=!0,ws(!1,n))}g.memo(TB);function TB({routes:e,manifest:t,future:n,state:i,isStatic:s,onError:o}){return qR(e,void 0,{manifest:t,state:i,isStatic:s,onError:o})}function Dv({to:e,replace:t,state:n,relative:i}){Dn(cu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=g.useContext(Pr);ws(!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}=g.useContext(ta),{pathname:l}=$r(),d=uu(),f=tg(e,X0(o),l,i==="path"),p=JSON.stringify(f);return g.useEffect(()=>{d(JSON.parse(p),{replace:t,state:n,relative:i})},[d,p,i,t,n]),null}function Cc(e){Dn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function RB({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:s,static:o=!1,useTransitions:l}){Dn(!cu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=e.replace(/^\/*/,"/"),f=g.useMemo(()=>({basename:d,navigator:s,static:o,useTransitions:l,future:{}}),[d,s,o,l]);typeof n=="string"&&(n=ou(n));let{pathname:p="/",search:m="",hash:y="",state:_=null,key:w="default",mask:S}=n,x=g.useMemo(()=>{let k=Pa(p,d);return k==null?null:{location:{pathname:k,search:m,hash:y,state:_,key:w,mask:S},navigationType:i}},[d,p,m,y,_,w,i,S]);return ws(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:g.createElement(Pr.Provider,{value:f},g.createElement(kh.Provider,{children:t,value:x}))}function MB({children:e,location:t}){return gB(yb(e),t)}function yb(e,t=[]){let n=[];return g.Children.forEach(e,(i,s)=>{if(!g.isValidElement(i))return;let o=[...t,s];if(i.type===g.Fragment){n.push.apply(n,yb(i.props.children,o));return}Dn(i.type===Cc,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Dn(!i.props.index||!i.props.children,"An index route cannot have child routes.");let 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=yb(i.props.children,o)),n.push(l)}),n}var Cp="get",Ep="application/x-www-form-urlencoded";function ig(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function NB(e){return ig(e)&&e.tagName.toLowerCase()==="button"}function LB(e){return ig(e)&&e.tagName.toLowerCase()==="form"}function OB(e){return ig(e)&&e.tagName.toLowerCase()==="input"}function IB(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function jB(e,t){return e.button===0&&(!t||t==="_self")&&!IB(e)}var Gf=null;function DB(){if(Gf===null)try{new FormData(document.createElement("form"),0),Gf=!1}catch{Gf=!0}return Gf}var BB=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Bv(e){return e!=null&&!BB.has(e)?(ws(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ep}"`),null):e}function PB(e,t){let n,i,s,o,l;if(LB(e)){let d=e.getAttribute("action");i=d?Pa(d,t):null,n=e.getAttribute("method")||Cp,s=Bv(e.getAttribute("enctype"))||Ep,o=new FormData(e)}else if(NB(e)||OB(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?Pa(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Cp,s=Bv(e.getAttribute("formenctype"))||Bv(d.getAttribute("enctype"))||Ep,o=new FormData(d,e),!DB()){let{name:p,type:m,value:y}=e;if(m==="image"){let _=p?`${p}.`:"";o.append(`${_}x`,"0"),o.append(`${_}y`,"0")}else p&&o.append(p,y)}}else{if(ig(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Cp,i=null,s=Ep,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 eS(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function VR(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&&Pa(s.pathname,t)==="/"?s.pathname=`${rm(t)}/_root.${i}`:s.pathname=`${rm(s.pathname)}.${i}`,s}async function $B(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 zB(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 FB(e,t,n){let i=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let l=await $B(o,n);return l.links?l.links():[]}return[]}));return qB(i.flat(1).filter(zB).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function FE(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 HB(e,t,{includeHydrateFallback:n}={}){return UB(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 UB(e){return[...new Set(e)]}function WB(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function qB(e,t){let n=new Set;return new Set(t),e.reduce((i,s)=>{let o=JSON.stringify(WB(s));return n.has(o)||(n.add(o),i.push({key:o,link:s})),i},[])}function tS(){let e=g.useContext(lu);return eS(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function GB(){let e=g.useContext(ng);return eS(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var nS=g.createContext(void 0);nS.displayName="FrameworkContext";function iS(){let e=g.useContext(nS);return eS(e,"You must render this element inside a <HydratedRouter> element"),e}function KB(e,t){let n=g.useContext(nS),[i,s]=g.useState(!1),[o,l]=g.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:y}=t,_=g.useRef(null);g.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let x=C=>{C.forEach(B=>{l(B.isIntersecting)})},k=new IntersectionObserver(x,{threshold:.5});return _.current&&k.observe(_.current),()=>{k.disconnect()}}},[e]),g.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,_,{}]:[o,_,{onFocus:od(d,w),onBlur:od(f,S),onMouseEnter:od(p,w),onMouseLeave:od(m,S),onTouchStart:od(y,w)}]:[!1,_,{}]}function od(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function VB({page:e,...t}){let n=oB(),{router:i}=tS(),s=g.useMemo(()=>OR(i.routes,e,i.basename),[i.routes,e,i.basename]);return s?n?g.createElement(XB,{page:e,matches:s,...t}):g.createElement(ZB,{page:e,matches:s,...t}):null}function YB(e){let{manifest:t,routeModules:n}=iS(),[i,s]=g.useState([]);return g.useEffect(()=>{let o=!1;return FB(e,t,n).then(l=>{o||s(l)}),()=>{o=!0}},[e,t,n]),i}function XB({page:e,matches:t,...n}){let i=$r(),{future:s}=iS(),{basename:o}=tS(),l=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let d=VR(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 g.createElement(g.Fragment,null,l.map(d=>g.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function ZB({page:e,matches:t,...n}){let i=$r(),{future:s,manifest:o,routeModules:l}=iS(),{basename:d}=tS(),{loaderData:f,matches:p}=GB(),m=g.useMemo(()=>FE(e,t,p,o,i,"data"),[e,t,p,o,i]),y=g.useMemo(()=>FE(e,t,p,o,i,"assets"),[e,t,p,o,i]),_=g.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let x=new Set,k=!1;if(t.forEach(B=>{let H=o.routes[B.route.id];!H||!H.hasLoader||(!m.some(T=>T.route.id===B.route.id)&&B.route.id in f&&l[B.route.id]?.shouldRevalidate||H.hasClientLoader?k=!0:x.add(B.route.id))}),x.size===0)return[];let C=VR(e,d,s.v8_trailingSlashAwareDataRequests,"data");return k&&x.size>0&&C.searchParams.set("_routes",t.filter(B=>x.has(B.route.id)).map(B=>B.route.id).join(",")),[C.pathname+C.search]},[d,s.v8_trailingSlashAwareDataRequests,f,i,o,m,t,e,l]),w=g.useMemo(()=>HB(y,o),[y,o]),S=YB(y);return g.createElement(g.Fragment,null,_.map(x=>g.createElement("link",{key:x,rel:"prefetch",as:"fetch",href:x,...n})),w.map(x=>g.createElement("link",{key:x,rel:"modulepreload",href:x,...n})),S.map(({key:x,link:k})=>g.createElement("link",{key:x,nonce:n.nonce,...k,crossOrigin:k.crossOrigin??n.crossOrigin})))}function JB(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var QB=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{QB&&(window.__reactRouterVersion="7.17.0")}catch{}function e8({basename:e,children:t,useTransitions:n,window:i}){let s=g.useRef();s.current==null&&(s.current=O4({window:i,v5Compat:!0}));let o=s.current,[l,d]=g.useState({action:o.action,location:o.location}),f=g.useCallback(p=>{n===!1?d(p):g.startTransition(()=>d(p))},[n]);return g.useLayoutEffect(()=>o.listen(f),[o,f]),g.createElement(RB,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,useTransitions:n})}var YR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,rh=g.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:_,defaultShouldRevalidate:w,...S},x){let{basename:k,navigator:C,useTransitions:B}=g.useContext(Pr),H=typeof m=="string"&&YR.test(m),T=PR(m,k);m=T.to;let $=pB(m,{relative:s}),j=$r(),M=null;if(d){let D=tg(d,[],j.mask?j.mask.pathname:"/",!0);k!=="/"&&(D.pathname=D.pathname==="/"?k:bs([k,D.pathname])),M=C.createHref(D)}let[V,Y,te]=KB(i,S),J=r8(m,{replace:l,mask:d,state:f,target:p,preventScrollReset:y,relative:s,viewTransition:_,defaultShouldRevalidate:w,useTransitions:B});function P(D){t&&t(D),D.defaultPrevented||J(D)}let N=!(T.isExternal||o),I=g.createElement("a",{...S,...te,href:(N?M:void 0)||T.absoluteURL||$,onClick:N?P:t,ref:JB(x,Y),target:p,"data-discover":!H&&n==="render"?"true":void 0});return V&&!H?g.createElement(g.Fragment,null,I,g.createElement(VB,{page:$})):I});rh.displayName="Link";var t8=g.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=Ch(l,{relative:p.relative}),_=$r(),w=g.useContext(ng),{navigator:S,basename:x}=g.useContext(Pr),k=w!=null&&c8(y)&&d===!0,C=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,B=_.pathname,H=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;n||(B=B.toLowerCase(),H=H?H.toLowerCase():null,C=C.toLowerCase()),H&&x&&(H=Pa(H,x)||H);const T=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let $=B===C||!s&&B.startsWith(C)&&B.charAt(T)==="/",j=H!=null&&(H===C||!s&&H.startsWith(C)&&H.charAt(C.length)==="/"),M={isActive:$,isPending:j,isTransitioning:k},V=$?t:void 0,Y;typeof i=="function"?Y=i(M):Y=[i,$?"active":null,j?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let te=typeof o=="function"?o(M):o;return g.createElement(rh,{...p,"aria-current":V,className:Y,ref:m,style:te,to:l,viewTransition:d},typeof f=="function"?f(M):f)});t8.displayName="NavLink";var n8=g.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:s,state:o,method:l=Cp,action:d,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:_,...w},S)=>{let{useTransitions:x}=g.useContext(Pr),k=o8(),C=l8(d,{relative:p}),B=l.toLowerCase()==="get"?"get":"post",H=typeof d=="string"&&YR.test(d),T=$=>{if(f&&f($),$.defaultPrevented)return;$.preventDefault();let j=$.nativeEvent.submitter,M=j?.getAttribute("formmethod")||l,V=()=>k(j||$.currentTarget,{fetcherKey:t,method:M,navigate:n,replace:s,state:o,relative:p,preventScrollReset:m,viewTransition:y,defaultShouldRevalidate:_});x&&n!==!1?g.startTransition(()=>V()):V()};return g.createElement("form",{ref:S,method:B,action:C,onSubmit:i?f:T,...w,"data-discover":!H&&e==="render"?"true":void 0})});n8.displayName="Form";function i8(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function XR(e){let t=g.useContext(lu);return Dn(t,i8(e)),t}function r8(e,{target:t,replace:n,mask:i,state:s,preventScrollReset:o,relative:l,viewTransition:d,defaultShouldRevalidate:f,useTransitions:p}={}){let m=uu(),y=$r(),_=Ch(e,{relative:l});return g.useCallback(w=>{if(jB(w,t)){w.preventDefault();let S=n!==void 0?n:ih(y)===ih(_),x=()=>m(e,{replace:S,mask:i,state:s,preventScrollReset:o,relative:l,viewTransition:d,defaultShouldRevalidate:f});p?g.startTransition(()=>x()):x()}},[y,m,_,n,i,s,t,e,o,l,d,f,p])}var s8=0,a8=()=>`__${String(++s8)}__`;function o8(){let{router:e}=XR("useSubmit"),{basename:t}=g.useContext(Pr),n=CB(),i=e.fetch,s=e.navigate;return g.useCallback(async(o,l={})=>{let{action:d,method:f,encType:p,formData:m,body:y}=PB(o,t);if(l.navigate===!1){let _=l.fetcherKey||a8();await i(_,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 l8(e,{relative:t}={}){let{basename:n}=g.useContext(Pr),i=g.useContext(ta);Dn(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),o={...Ch(e||".",{relative:t})},l=$r();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:bs([n,o.pathname])),ih(o)}function c8(e,{relative:t}={}){let n=g.useContext(FR);Dn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=XR("useViewTransitionState"),s=Ch(e,{relative:t});if(!n.isTransitioning)return!1;let o=Pa(n.currentLocation.pathname,i)||n.currentLocation.pathname,l=Pa(n.nextLocation.pathname,i)||n.nextLocation.pathname;return im(s.pathname,l)!=null||im(s.pathname,o)!=null}const u8=["canonicalCwd","cwd","providerSession","realpath","ticket","token","transcriptPath"];let Sn=class extends Error{status;constructor(t,n){super(n),this.name="ApiError",this.status=t}};async function vb(e){return(await ZR(e)).theaters}async function ZR(e){const t=await fetch("/api/v1/theaters",{signal:e});await ti(t);const n=await t.json();if(!Array.isArray(n.theaters))throw new Sn(t.status,"Invalid Theater response");return{theaters:n.theaters.map(i=>sS(i,t.status))}}async function d8(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/status${n}`,{signal:t});return await ti(i),C8(await i.json(),i.status)}async function h8(e){const t=await fetch("/api/v1/environment",{cache:"no-store",signal:e});return await ti(t),E8(await t.json(),t.status)}async function f8(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 ti(i),T8(await i.json(),i.status)}async function p8(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await ti(t),A8(await t.json(),t.status)}async function JR(e,t){const n=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await ti(n);const i=await n.json();return sS(i,n.status)}async function m8(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 ti(i),sS(await i.json(),i.status)}async function g8(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 ti(n),O8(await n.json(),n.status)}async function QR(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 ti(n);const i=await n.json();if(typeof i.folderGrantId!="string")throw new Sn(n.status,"Invalid folder grant response");return i.folderGrantId}async function y8(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 ti(n),await n.json()}async function v8(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 ti(i),await i.json()}async function _8(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 ti(s),await s.json()}async function b8(e,t){const n=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await ti(n),nM(await n.json(),n.status)}async function w8(e,t){const n=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await ti(n),nM(await n.json(),n.status)}async function S8(e,t){const n=await fetch(`/api/v1/deletions/${encodeURIComponent(e)}/restore`,{method:"POST",signal:t});await ti(n);const i=await n.json();if(!i||i.ok!==!0||i.kind!=="operation"&&i.kind!=="theater"||typeof i.targetId!="string"||jo(i))throw new Sn(n.status,"Invalid deletion restore response");return{ok:!0,kind:i.kind,targetId:i.targetId}}async function Yi(e,t){const n=e?`?theaterId=${encodeURIComponent(e)}`:"",i=await fetch(`/api/v1/operations${n}`,{signal:t});await ti(i);const s=await i.json();if(!Array.isArray(s.operations))throw new Sn(i.status,"Invalid operations response");return s.operations.map(o=>tM(o,i.status))}async function So(e,t){const i=await fetch("/api/v1/operations/groups",{signal:t});await ti(i);const s=await i.json();if(!Array.isArray(s.groups))throw new Sn(i.status,"Invalid groups response");return s.groups.map(o=>rS(o,i.status))}async function x8(e,t){const n=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await ti(n);const i=await n.json();return rS(i.group,n.status)}async function Pv(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 ti(i);const s=await i.json();return rS(s.group,i.status)}async function k8(e,t){const n=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await ti(n)}async function eM(e,t,n){return Ap(e,{title:t},n)}async function Ap(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 ti(i);const s=await i.json();return tM(s.operation,i.status)}function tM(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"||jo(n)||jo(n.payload))throw new Sn(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 rS(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 Sn(t,"Invalid group response");return{id:n.id,theaterId:n.theaterId,name:n.name,color:n.color,order:n.order,createdAt:n.createdAt}}function sS(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"||jo(n))throw new Sn(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 C8(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 Sn(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 E8(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 Sn(t,"Invalid environment response");return n}function A8(e,t){const n=e;if(!n||n.status!=="accepted")throw new Sn(t,"Invalid update response");return{status:"accepted"}}function T8(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 Sn(t,"Invalid release notes response");return{notes:n.notes.map(i=>R8(i,t)),sourceRef:"main",fetchedAt:n.fetchedAt,stale:n.stale}}function R8(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 Sn(t,"Invalid release notes response");return{version:n.version,date:n.date,sections:n.sections.map(i=>M8(i,t)),localizationFallback:n.localizationFallback}}function M8(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 Sn(t,"Invalid release notes response");return{heading:n.heading,items:n.items.map(i=>N8(i,t))}}function N8(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&&!L8(n.product))throw new Sn(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 L8(e){return e==="fleet-cli"||e==="fleet-console"||e==="fleet-desktop"||e==="fleet-plugin"||e==="fleet-core"}function O8(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)||jo(n))throw new Sn(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=>I8(i,t)),truncated:n.truncated===!0?!0:void 0}}function I8(e,t){const n=e;if(!n||typeof n.name!="string"||typeof n.path!="string"||n.kind!=="dir"||typeof n.accessible!="boolean"||jo(n))throw new Sn(t,"Invalid folder entry response");return{name:n.name,path:n.path,kind:"dir",accessible:n.accessible}}function jo(e){if(!e||typeof e!="object")return!1;const t=e;return u8.some(n=>n in t)}function nM(e,t){const n=e;if(!n||n.ok!==!0||jo(n))throw new Sn(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)||jo(i))throw new Sn(t,"Invalid deferred deletion receipt");return{ok:!0,deletion:{deletionId:i.deletionId,kind:i.kind,targetId:i.targetId,expiresAt:i.expiresAt}}}async function ti(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 Sn(e.status,t)}function qs(e,t){const n=e[t];return(i,s)=>{const o=n[i];return typeof o!="string"?i:s?j8(o,s):o}}function jl(e,t){return typeof e=="function"?e(t):e}function j8(e,t){return e.replace(/{([^{}]+)}/g,(n,i)=>{const s=t[i];return s===void 0?n:String(s)})}const D8=200,B8=.5,P8="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",$8=["monospace","serif","sans-serif"],Id=new Map;function z8(e,t={}){const n=rg(e);if(!n)return!1;const i=n.toLocaleLowerCase(),s=Id.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=$8.some(f=>{const p=HE(l,`${iM(n)}, ${f}`),m=HE(l,f);return Math.abs(p-m)>B8});return F8(i,d,t.maxEntries??D8),d}function iM(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function sm(e,t){const n=rg(e);return n?`${iM(n)}, ${t}`:t}function rg(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function HE(e,t){return e.font=`28px ${t}`,e.measureText(P8).width}function F8(e,t,n){if(Id.size>=Math.max(1,n)){const i=Id.keys().next().value;i&&Id.delete(i)}Id.set(e,t)}const Pc={min:12,max:18,step:1,defaultValue:14},Kd={source:"builtin",id:"manrope",size:Pc.defaultValue},am=[{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"]}],H8={manrope:"settings.typography.font.manrope","jetbrains-mono":"settings.typography.font.jetbrains-mono","source-code-pro":"settings.typography.font.source-code-pro"};function U8(e){if(!e||typeof e!="object")return Kd;const t=e,n=W8(t.size);if(t.source==="builtin"&&G8(t.id))return{source:"builtin",id:t.id,size:n};if(t.source==="system"&&typeof t.familyName=="string"){const i=rg(t.familyName);if(i)return{source:"system",familyName:i,size:n}}return Kd}function W8(e){return typeof e!="number"||!Number.isInteger(e)||e<Pc.min||e>Pc.max?Pc.defaultValue:e}function rM(e){return e.source==="system"?sm(e.familyName,am[0].family):q8(e.id).family}function q8(e){return am.find(t=>t.id===e)??am[0]}function G8(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}async function sM(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await aM(t),oM(await t.json(),t.status)}async function K8(e,t){const n=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await aM(n);const i=await n.json();if(!i||typeof i!="object"||!("state"in i))throw new Sn(n.status,"Invalid global settings mutation response");return{state:oM(i.state,n.status)}}async function aM(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 Sn(e.status,t)}function oM(e,t){const n=e;if(!n||n.consolePortMode!=="dynamic"&&n.consolePortMode!=="static"||n.consoleStaticPort!==null&&!V8(n.consoleStaticPort)||typeof n.reducePanelMotion!="boolean"||!X8(n.seenFeatureTours)||n.theme!=="instrument"&&n.theme!=="maritime"&&n.theme!=="carbon"||!Y8(n.language))throw new Sn(t,"Invalid global settings state response");return{consolePortMode:n.consolePortMode,consoleStaticPort:n.consoleStaticPort,reducePanelMotion:n.reducePanelMotion,seenFeatureTours:n.seenFeatureTours,theme:n.theme,uiFont:U8(n.uiFont),language:n.language}}function V8(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function Y8(e){return e==="auto"||e==="en"||e==="ko"}function X8(e){return Array.isArray(e)&&e.length<=64&&e.every(t=>typeof t=="string"&&t.length<=64)&&new Set(e).size===e.length}const _b=new Set;let sh={loadStatus:"pending",loading:!1,state:null,savingField:null,error:null};function na(){return g.useSyncExternalStore(lM,Ii,Ii)}function Ii(){return sh}function Z8(e){No({loadStatus:"ready",loading:!1,state:e,error:null})}function J8(e){No({loadStatus:"failed",loading:!1,state:null,error:aS(e)})}function lM(e){return _b.add(e),()=>{_b.delete(e)}}async function Q8(e){No({loading:!0,error:null});try{const t=await sM(e);No({loadStatus:"ready",loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;No({loadStatus:"failed",loading:!1,error:aS(t)})}}async function Ss(e,t){if(sh.savingField!==null)return!1;const n=sh.state,i=n?{...n,[e]:t}:null;No({state:i,savingField:e,error:null});try{const s=await K8({[e]:t});return No({state:s.state,savingField:null,error:null}),!0}catch(s){return No({state:n,savingField:null,error:aS(s)}),!1}}function No(e){sh={...sh,...e};for(const t of _b)t()}function aS(e){return e instanceof Error?e.message:String(e)}const eP="fleet-console.canvas.",cM="fleet-console.formation-layout",tP=400,bb=640,wb=400,UE=40,nP=320,iP=200,rP=8,sP=0,WE=96,aP=.25,oP=1,$v=.2,qE=.5,lP=.001,Oc={x:0,y:0,zoom:1},$c={viewport:Oc,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Sb=new Set,xb=new Set,kb=new Set,Cb=new Set,Eb=new Set,br=new Map,Vc=new Map;let Bt=null,Lo=null,pt=$c,ln=null,uM=0,bl={},_r=!1,oS=AP(),Eo=Oc,wl=null,ah=null,om=0;function lS(e){return Sb.add(e),()=>{Sb.delete(e)}}function Fs(){return pt}function dM(e){return Bt===e?pt:gS(e)}function Gs(){return ln?.mode==="maximized"?ln.operationId:null}function Br(){return ln?.mode==="companion"?ln.operationId:null}function GE(){return uM}function cP(e){const t=Bt===e?ln:br.get(e)??null;return t?.mode==="companion"?t.operationId:null}function KE(e){return Bt===e?ln:br.get(e)??null}function VE(e,t){t?br.set(e,t):br.delete(e),!(Bt!==e||fS(ln,t))&&(ln=t,du())}function lm(){return _r}function YE(){return oS}function sg(){return Bt}function cS(){return g.useSyncExternalStore(lS,Fs,Fs)}function hM(){return g.useSyncExternalStore(kM,Gs,Gs)}function fM(){return g.useSyncExternalStore(kM,Br,Br)}function uP(e){const t=g.useSyncExternalStore(wP,ZE,ZE);return e===null?{}:t[e]??{}}function dP(e,t,n){const i=bl[e]??{};i[t]!==n&&(bl={...bl,[e]:{...i,[t]:n}},CM())}function ag(){return g.useSyncExternalStore(_P,lm,lm)}function pM(){return g.useSyncExternalStore(bP,YE,YE)}function mM(){return g.useSyncExternalStore(lS,JE,JE)}function wr(e){pt={viewport:e.viewport??pt.viewport,operations:e.operations??pt.operations,operationOrder:e.operationOrder??pt.operationOrder,operationAccent:e.operationAccent??pt.operationAccent,minimized:e.minimized??pt.minimized,collapsedGroups:e.collapsedGroups??pt.collapsedGroups},kP(),hS()}function Ab(e){const t=pt.collapsedGroups.includes(e)?pt.collapsedGroups.filter(n=>n!==e):[...pt.collapsedGroups,e];wr({collapsedGroups:t})}function hP(e,t){if(Bt===e){Ab(t);return}const n=gS(e),i=n.collapsedGroups.includes(t)?n.collapsedGroups.filter(s=>s!==t):[...n.collapsedGroups,t];yS(e,{...n,collapsedGroups:i}),pt={...pt},hS()}function fP(){return g.useSyncExternalStore(lS,QE,QE)}function Tb(e){pS();const t=vS(e);Eo=t,wr({viewport:t})}function gM(e){const t=vS(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||TM()){Tb(t);return}Eo=t,wl===null&&(wl=window.requestAnimationFrame(AM))}function Rb(e,t){const n=Rl();wr({operations:{...pt.operations,[e]:{..._S(t,n),zIndex:n}}})}function pP(e,t,n=nP,i=iP,s=rP,o=sP,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,C=Math.min(n,k),B=Math.min(Math.max(C,k),x),H=f,T=Math.min(i,H),$=Math.min(Math.max(T,H),f);return Array.from({length:t},(j,M)=>({x:e.x+o+M*(B+s),y:e.y+o,width:B,height:$}))}if(l==="rows"){const x=d,k=Math.min(n,x),C=Math.min(Math.max(k,x),d),B=Math.max(0,f-s*(t-1)),H=B/t,T=Math.min(i,H),$=Math.min(Math.max(T,H),B);return Array.from({length:t},(j,M)=>({x:e.x+o,y:e.y+o+M*($+s),width:C,height:$}))}const p=Math.ceil(Math.sqrt(t)),m=Math.ceil(t/p),y=Math.max(0,f-s*(m-1)),_=y/m,w=Math.min(i,_),S=Math.min(Math.max(w,_),y);return Array.from({length:t},(x,k)=>{const C=Math.floor(k/p),B=k%p,H=C===m-1?t-(m-1)*p:p,T=Math.max(0,d-s*(H-1)),$=T/H,j=Math.min(n,$),M=Math.min(Math.max(j,$),T);return{x:e.x+o+B*(M+s),y:e.y+o+C*(S+s),width:M,height:S}})}function yM(e){pt.minimized.includes(e)||(Gs()===e&&Do(),Br()===e&&Sr(),wr({minimized:[...pt.minimized,e]}))}function vM(e){const t=new Set,i=[...pt.minimized.filter(l=>t.has(l)||!(l in pt.operations)?!1:(t.add(l),!0)),...e.filter(l=>t.has(l)||!(l in pt.operations)?!1:(t.add(l),!0))];if(EM(pt.minimized,i))return;const s=Gs(),o=Br();s&&i.includes(s)&&Do(),o&&i.includes(o)&&Sr(),wr({minimized:i})}function Mb(e){if(!pt.minimized.includes(e))return;Gs()===e&&Do();const t=pt.minimized.filter(s=>s!==e),n=pt.operations[e];if(!n){wr({minimized:t});return}const i=Rl();wr({minimized:t,operations:{...pt.operations,[e]:{...n,zIndex:i}}})}function zv(e){wr({operationOrder:MM(e)})}function Rl(){return om+=1,om}function _M(e){const t=pt.operations[e];if(t)return t;const n=Object.keys(pt.operations).length,i={x:n*UE,y:n*UE,width:bb,height:wb,zIndex:Rl()};return wr({operations:{...pt.operations,[e]:i}}),i}function mP(e){const t=new Set(e),n={};let i=!1;for(const[_,w]of Object.entries(pt.operations))t.has(_)?n[_]=w:i=!0;const s=pt.minimized.filter(_=>t.has(_)),o=s.length!==pt.minimized.length,l=pt.operationOrder.filter(_=>t.has(_)),d=l.length!==pt.operationOrder.length,f=Object.fromEntries(Object.entries(pt.operationAccent).filter(([_])=>t.has(_))),p=Object.keys(f).length!==Object.keys(pt.operationAccent).length,m=Gs(),y=Br();m&&(!t.has(m)||s.includes(m))&&Do(),y&&s.includes(y)&&Sr(),(i||o||d||p)&&wr({operations:n,minimized:s,operationOrder:l,operationAccent:f})}function bM(e){CP(),pS(),xP(),Bt=e,pt=e?gS(e):$c;const t=e?br.get(e)??null:null,n=!fS(ln,t);ln=t;const i=e?Vc.has(e):!1,s=_r!==i;_r=i,Eo=pt.viewport,om=Math.max(om,NM(pt.operations)),hS(),n&&du(),s&&Yc()}function gP(e,t){const n=pt.operations[e];if(!n)return;const i=Math.max(aP,Math.min(oP,Math.min((t.width-WE)/n.width,(t.height-WE)/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};pS(),Eo=s;const o=Rl(),l=pt.minimized.includes(e);wr({viewport:s,operations:{...pt.operations,[e]:{..._S(n,o),zIndex:o}},...l?{minimized:pt.minimized.filter(d=>d!==e)}:{}})}function uS(e){const t={mode:"maximized",operationId:e};Bt&&br.set(Bt,t),SM(t)}function Do(){Bt&&br.get(Bt)?.mode==="maximized"&&br.delete(Bt),ln?.mode==="maximized"&&(ln=null,du())}function wM(e){og(e);const t=ln?.mode==="companion"?ln.returnTo:ln?.mode==="maximized"?"maximized":"underlay";SM({mode:"companion",operationId:e,returnTo:t})}function SM(e){ln?.mode==="companion"&&!(e.mode==="companion"&&e.operationId===ln.operationId)&&og(ln.operationId);const t=pt.minimized.filter(s=>s!==e.operationId),n=!EM(pt.minimized,t),i=!fS(ln,e);i&&(ln=e),i&&Bt&&br.set(Bt,e),n&&wr({minimized:t}),i&&du()}function yP(){if(ln?.mode!=="companion")return;const e=ln;ln=e.returnTo==="maximized"&&e.operationId in pt.operations&&!pt.minimized.includes(e.operationId)?{mode:"maximized",operationId:e.operationId}:null,Bt&&(ln?br.set(Bt,ln):br.delete(Bt)),og(e.operationId),du()}function Sr(){if(ln?.mode!=="companion")return;const e=ln.operationId;ln=null,Bt&&br.delete(Bt),og(e),du()}function xM(){if(Bt){if(Br()!==null){ah?.(Bt),Sr(),_r||(Vc.set(Bt,!0),_r=!0,Yc());return}if(_r){dS();return}ah?.(Bt),Do(),Sr(),Vc.set(Bt,!0),_r=!0,Yc()}}function Fv(e){if(Bt){if(Br()!==null){XE(e),ah?.(Bt),Sr(),_r||(Vc.set(Bt,!0),_r=!0,Yc());return}if(_r&&oS===e){dS();return}XE(e),_r||(ah?.(Bt),Do(),Sr(),Vc.set(Bt,!0),_r=!0,Yc())}}function dS(e=Bt){e&&Vc.delete(e),!(Bt!==e||!_r)&&(_r=!1,Yc())}function vP(e){ah=e}function XE(e){oS=e,TP(e),SP()}function _P(e){return Cb.add(e),()=>{Cb.delete(e)}}function bP(e){return Eb.add(e),()=>{Eb.delete(e)}}function hS(){for(const e of Sb)e()}function kM(e){return xb.add(e),()=>{xb.delete(e)}}function wP(e){return kb.add(e),()=>{kb.delete(e)}}function ZE(){return bl}function CM(){for(const e of kb)e()}function og(e){if(!(e in bl))return;const t={...bl};delete t[e],bl=t,CM()}function Yc(){for(const e of Cb)e()}function SP(){for(const e of Eb)e()}function JE(){return pt.minimized}function QE(){return pt.collapsedGroups}function du(){uM+=1;for(const e of xb)e()}function xP(){Bt&&(ln?br.set(Bt,ln):br.delete(Bt))}function fS(e,t){return e?.mode===t?.mode&&e?.operationId===t?.operationId&&(e?.mode!=="companion"||t?.mode!=="companion"||e.returnTo===t.returnTo)}function EM(e,t){return e.length===t.length&&e.every((n,i)=>n===t[i])}function AM(){const e=pt.viewport,t=Eo.x-e.x,n=Eo.y-e.y,i=Eo.zoom-e.zoom;if(Math.abs(t)<qE&&Math.abs(n)<qE&&Math.abs(i)<lP){wl=null,wr({viewport:Eo});return}wr({viewport:{x:e.x+t*$v,y:e.y+n*$v,zoom:e.zoom+i*$v}}),wl=typeof window<"u"?window.requestAnimationFrame(AM):null}function pS(){wl===null||typeof window>"u"||(window.cancelAnimationFrame(wl),wl=null)}function TM(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function mS(){return Ii().state?.reducePanelMotion===!0||TM()}function kP(){!Bt||typeof window>"u"||(EP(),Lo=window.setTimeout(()=>{Lo=null,yS(Bt,pt)},tP))}function CP(){!Lo||!Bt||typeof window>"u"||(window.clearTimeout(Lo),Lo=null,yS(Bt,pt))}function EP(){!Lo||typeof window>"u"||(window.clearTimeout(Lo),Lo=null)}function gS(e){if(typeof window>"u")return $c;try{const t=window.localStorage.getItem(RM(e));if(!t)return $c;const n=JSON.parse(t);return RP(n)}catch{return $c}}function yS(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(RM(e),JSON.stringify(t))}catch{}}function AP(){if(typeof window>"u")return"grid";try{const e=window.localStorage.getItem(cM);return e==="columns"||e==="rows"||e==="grid"?e:"grid"}catch{return"grid"}}function TP(e){if(!(typeof window>"u"))try{window.localStorage.setItem(cM,e)}catch{}}function RM(e){return`${eP}${e}`}function RP(e){if(!Xc(e))return $c;const t=LP(e.operations);return{viewport:vS(e.viewport),operations:t,operationOrder:MM(e.operationOrder),operationAccent:MP(e.operationAccent),minimized:NP(e.minimized,t),collapsedGroups:IP(e.collapsedGroups)}}function MM(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 MP(e){if(!Xc(e))return{};const t={};for(const[n,i]of Object.entries(e))typeof i=="string"&&(t[n]=i);return t}function NP(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 vS(e){if(!Xc(e))return Oc;const t=Vd(e.x,Oc.x),n=Vd(e.y,Oc.y),i=Nb(e.zoom,Oc.zoom);return{x:t,y:n,zoom:i}}function LP(e){if(!Xc(e))return{};const t={};for(const[n,i]of Object.entries(e))Xc(i)&&(t[n]=_S(i,OP(t)));return t}function _S(e,t){return Xc(e)?{x:Vd(e.x,0),y:Vd(e.y,0),width:Nb(e.width,bb),height:Nb(e.height,wb),zIndex:Vd(e.zIndex,t)}:{x:0,y:0,width:bb,height:wb,zIndex:t}}function OP(e){return NM(e)+1}function NM(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function Vd(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Nb(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Xc(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function IP(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const i of e)typeof i!="string"||t.has(i)||(t.add(i),n.push(i));return n}const cm=new Set;let La=new Set,LM=!1;function jP(e){if(!La.has(e)){La=new Set(La),La.add(e);for(const t of cm)t()}}function OM(e){return LM?!1:(bS(e),!0)}function Tp(e){LM=e}function bS(e){if(La.has(e)){La=new Set(La),La.delete(e);for(const t of cm)t()}}function Bo(){return La}function IM(e){return cm.add(e),()=>{cm.delete(e)}}function jM(e,t=DM()){return sr(e,t)}function sr(e,t=DM()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function DM(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const DP={"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.hintTriage":"Triage","canvas.empty.guide":"Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.","canvas.triage.picked":"Picked","canvas.triage.railCurrent":"Now","canvas.triage.railLead":"Up next","canvas.triage.railEmpty":"None","canvas.triage.railCleared":"{count} cleared","canvas.triage.curtainKicker":"TRIAGE MODE","canvas.triage.curtainTitle":"Triage started","canvas.triage.curtainBody":"Bringing up {waiting} waiting items one at a time. {stowed} panels stowed.","canvas.triage.curtainBodyEmpty":"Nothing is waiting. All {stowed} panels stowed.","canvas.triage.clearMark":"All clear","canvas.triage.clearTitle":"Nothing is waiting on you","canvas.triage.clearBody":"Panels return here when an agent needs an answer. Stowed panels go back to their coordinates when you turn the mode off.","canvas.triage.clearBodyIdle":"Nothing is waiting on you. {count} idle panels sit in the left list. Click one to bring it up.","canvas.formation.curtainKicker":"FORMATION VIEW","canvas.formation.curtainTitle":"Full board","canvas.formation.curtainBody":"Arranging {count} Operations on the grid.","canvas.formation.slotAria":"Slot {index}","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.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}"},BP={"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.hintTriage":"선별 처리","canvas.empty.guide":"Shift-드래그로 Shell을 만듭니다. 우클릭으로 동작을 열고, 드래그로 이동·스크롤로 확대합니다.","canvas.triage.picked":"지목","canvas.triage.railCurrent":"이번 차례","canvas.triage.railLead":"다음 차례","canvas.triage.railEmpty":"없음","canvas.triage.railCleared":"{count}건 처리","canvas.triage.curtainKicker":"TRIAGE MODE","canvas.triage.curtainTitle":"선별 처리 개시","canvas.triage.curtainBody":"답을 기다리는 {waiting}건을 한 건씩 세웁니다. 나머지 {stowed}개는 접었습니다.","canvas.triage.curtainBodyEmpty":"대기 중인 작업이 없습니다. {stowed}개를 모두 접었습니다.","canvas.triage.clearMark":"모두 정리됨","canvas.triage.clearTitle":"기다리는 작업이 없습니다","canvas.triage.clearBody":"에이전트가 답을 요청하면 이 자리에 다시 올라옵니다. 접힌 패널은 모드를 끄면 원래 좌표로 돌아갑니다.","canvas.triage.clearBodyIdle":"기다리는 작업은 없습니다. 유휴 상태인 {count}개는 왼쪽 목록에 있습니다. 눌러서 올릴 수 있습니다.","canvas.formation.curtainKicker":"FORMATION VIEW","canvas.formation.curtainTitle":"전체 조망","canvas.formation.curtainBody":"{count}개 Operation을 격자에 정렬합니다.","canvas.formation.slotAria":"슬롯 {index}","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.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}"},PP={"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.viewModeAuto":"View mode: Auto","chrome.commandBand.viewModeMobile":"View mode: Mobile","chrome.commandBand.viewModeDesktop":"View mode: Desktop","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.triage":"Triage","chrome.commandBand.triageToggle":"Triage mode (Alt+T)","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"},$P={"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.viewModeAuto":"보기 모드: 자동","chrome.commandBand.viewModeMobile":"보기 모드: 모바일","chrome.commandBand.viewModeDesktop":"보기 모드: 데스크톱","chrome.commandBand.formationView":"Formation 보기","chrome.commandBand.resetCanvasView":"캔버스 보기 초기화","chrome.commandBand.formationGrid":"Formation 보기 — 격자 레이아웃","chrome.commandBand.formationColumns":"Formation 보기 — 열 레이아웃","chrome.commandBand.formationRows":"Formation 보기 — 행 레이아웃","chrome.commandBand.triage":"선별 처리","chrome.commandBand.triageToggle":"선별 처리 모드 (Alt+T)","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":"이 페이지"},zP={"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","featureTour.next":"Next","featureTour.done":"Get started","featureTour.skip":"Skip","featureTour.gotIt":"Got it","featureTour.progress":"{current} / {total}","featureTour.triage.spotlightTitle":"Triage mode is new","featureTour.triage.spotlightBody":"It stands up one waiting item at a time so you can clear them back to back. Click here, or press Alt+T.","featureTour.triage.step1Title":"One at a time","featureTour.triage.step1Body":"Only what is waiting stays. Answer it and the next item takes the same spot.","featureTour.triage.step2Title":"You can jump the queue","featureTour.triage.step2Body":"Click anything in the left list or the rail below to bring it up now. The rail also shows what is next.","featureTour.triage.step3Title":"Turn it off and nothing is lost","featureTour.triage.step3Body":"Press it again, or Alt+T, and every panel returns to its coordinates."},FP={"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":"서버 내부 오류가 발생했습니다","featureTour.next":"다음","featureTour.done":"시작하기","featureTour.skip":"건너뛰기","featureTour.gotIt":"알겠습니다","featureTour.progress":"{current} / {total}","featureTour.triage.spotlightTitle":"선별 처리 모드가 추가되었습니다","featureTour.triage.spotlightBody":"답을 기다리는 작업만 한 건씩 세워 연속으로 처리합니다. 눌러서 켜거나 Alt+T를 누르십시오.","featureTour.triage.step1Title":"한 번에 하나만 세웁니다","featureTour.triage.step1Body":"답을 기다리는 작업만 남습니다. 답을 보내면 다음 건이 같은 자리에 섭니다.","featureTour.triage.step2Title":"순서는 가로챌 수 있습니다","featureTour.triage.step2Body":"좌측 목록이나 아래 대기 레일에서 무엇이든 클릭하면 그 건이 바로 올라옵니다. 레일이 다음 순서도 함께 보여줍니다.","featureTour.triage.step3Title":"끄면 원래 화면 그대로입니다","featureTour.triage.step3Body":"다시 누르거나 Alt+T를 누르면 패널이 원래 자리로 돌아갑니다."},HP={"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.toggleTriage":"Triage mode","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.triageDefer":"Defer the current item to the back of the queue (Triage)","shortcuts.map.toggleFormation":"Toggle Formation view","shortcuts.map.toggleTriage":"Toggle Triage mode","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.","mobile.tabs.aria":"Mobile navigation","mobile.tabs.operations":"Operations","mobile.tabs.alerts":"Alerts","mobile.tabs.tools":"Tools","mobile.operations.kicker":"Fleet Console","mobile.operations.title":"Operations","mobile.operations.empty":"Start a new Operation to begin.","mobile.operations.hasAlert":"Has alert","mobile.status.awaiting":"Awaiting input","mobile.status.running":"Running","mobile.status.idle":"Idle","mobile.status.dormant":"Dormant","mobile.session.backAria":"Back to operations","mobile.session.close":"Close","mobile.session.closeArmed":"Tap again to close","mobile.alerts.title":"Alerts","mobile.alerts.empty":"No active alerts.","mobile.tools.title":"Tools","mobile.tools.empty":"No mobile tools are available yet."},UP={"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.toggleTriage":"선별 처리 모드","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.triageDefer":"현재 건을 대기열 맨 뒤로 미루기 (선별 처리)","shortcuts.map.toggleFormation":"Formation 보기 전환","shortcuts.map.toggleTriage":"선별 처리 모드 켜기/끄기","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":"항목이 없습니다.","mobile.tabs.aria":"모바일 내비게이션","mobile.tabs.operations":"작업","mobile.tabs.alerts":"알림","mobile.tabs.tools":"도구","mobile.operations.kicker":"Fleet Console","mobile.operations.title":"작업","mobile.operations.empty":"새 Operation을 시작해 작업을 시작하세요.","mobile.operations.hasAlert":"알림 있음","mobile.status.awaiting":"입력 대기","mobile.status.running":"진행 중","mobile.status.idle":"유휴","mobile.status.dormant":"휴면","mobile.session.backAria":"작업 목록으로 돌아가기","mobile.session.close":"닫기","mobile.session.closeArmed":"한 번 더 누르면 닫힙니다","mobile.alerts.title":"알림","mobile.alerts.empty":"활성 알림이 없습니다.","mobile.tools.title":"도구","mobile.tools.empty":"아직 사용할 수 있는 모바일 도구가 없습니다."},e2={en:{...zP,...PP,...DP,...HP},ko:{...FP,...$P,...BP,...UP}};function Sl(e){return{copyLabel:e("common.copy"),copyAriaLabel:t=>e("common.copyCodeAria",{language:t})}}function Lb(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 BM={en:"en-US",ko:"ko-KR"},WP=[{amount:60,unit:"second"},{amount:60,unit:"minute"},{amount:24,unit:"hour"},{amount:Number.POSITIVE_INFINITY,unit:"day"}];function PM(e,t,n=Date.now()){const i=new Intl.RelativeTimeFormat(BM[t],{numeric:"auto"});let s=(e-n)/1e3;for(const o of WP){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 qP(e,t){const n=GP(e);return KP(n)?new Intl.DateTimeFormat(BM[t],{dateStyle:"medium"}).format(n):VP(e)}function GP(e){return e instanceof Date?e:new Date(e)}function KP(e){return!Number.isNaN(e.getTime())}function VP(e){return typeof e=="string"?e:String(e)}function t2(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(c.jsx(g.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 YP={en:qs(e2,"en"),ko:qs(e2,"ko")};function lg(){const e=na();return sr(e.state?.language??"auto")}function Ze(){const e=lg();return g.useMemo(()=>xr(e),[e])}function xr(e){return YP[e]}function Li(e,t){const n=t[e.id];return n||(e.payload?.resumeAvailable===!0?"dormant":"idle")}function Eh(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function XP(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function ZP(e){const t=xr(XP()),n=Eh(e);return t(n==="running"?"activity.running":n==="awaiting"?"activity.awaiting":n==="dormant"?"activity.dormant":"activity.idle")}const JP=150,QP=500,$M=8,e7="__unassigned__";async function t7(e,t,n,i){const s=sr(Ii().state?.language??"auto");return(await Promise.all(e.map(async l=>{if(!l.search)return null;const d=await n7(l,t,n,i);return!d||d.length===0?null:{panelId:l.id,panelTitle:jl(l.title,s),results:d.slice(0,$M)}}))).filter(l=>l!==null)}async function n7(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,QP)}),f=Promise.resolve().then(()=>e.search({query:t,theaterId:n,limit:$M,signal:s.signal})).then(p=>p,()=>null);return await Promise.race([f,d])}finally{l!==null&&clearTimeout(l),o&&i.removeEventListener("abort",o)}}function i7(e){const t=new Map(e.theaters.map(i=>[i.id,i])),n=[];for(const i of e.operations)i.theaterId&&n.push(a7(i,t.get(i.theaterId),e.operationStatus));return n}function r7(e,t){const n=wS(t);return n.length===0?e:e.filter(i=>{const s=o7(i);return n.every(o=>s.includes(o))})}function s7(e){const t=[],n=new Map;for(const i of e){const s=i.theaterId??e7,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 wS(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function a7(e,t,n){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation",activity:Li(e,n)}}function o7(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const Ob="fleet-console.activeTheaterId",zM="fleet-console.commissioningSeen",oh="commissioning",FM="fleet-console.whatsNewSeenVersion",HM="fleet-console.notificationPreferences",UM=1,l7="instrument",Kf={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Ib=new Set;let n2=0,jb=null,i2=!1,Je={connection:"connecting",connectionError:null,channel:"unknown",activeTheme:l7,version:"",updateAvailable:!1,latestVersion:null,portMode:"dynamic",requestedPort:null,effectivePort:0,portHonored:!0,theaters:[],operations:[],operationsHydrated:!1,groups:[],activeTheaterId:null,activeOperationId:null,activeOperationAcknowledged:!0,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:W7(),codexReader:null,codexReaderExpanded:!1};function Us(){return Je}function SS(e){return Ib.add(e),()=>{Ib.delete(e)}}function vt(e){Je={...Je,...e},z7()}function c7(e){Je.operationsViewActive!==e&&vt({operationsViewActive:e})}function Zc(e){p7(e),vt({activeTheme:e})}function Db(e){g7(e)}function u7(e){vt({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,...ZM({...Je,version:e.version})})}function d7(){vt({releaseNotesLoading:!0,releaseNotesError:null})}function h7(e){const t={...Je,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:Je.selectedReleaseNoteKey&&QM(e.notes,Je.selectedReleaseNoteKey)?Je.selectedReleaseNoteKey:JM(e.notes)};vt({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,...ZM(t)})}function f7(e){vt({releaseNotesLoading:!1,releaseNotesError:e})}function p7(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function m7(){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 g7(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",rM(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function um(e){const t=XM(e,Je.activeTheaterId);vt({theaters:e,activeTheaterId:t})}function y7(e){um(e.theaters)}function tr(e){vt({operations:e,operationsHydrated:!0})}function v7(e){const t=new Set(e.map(i=>i.id)),n=Je.operations.filter(i=>!t.has(i.id));vt({operations:[...e,...n],operationsHydrated:!0})}function _7(e){const t=Je.operations.findIndex(i=>i.id===e.id);if(t===-1)return;const n=[...Je.operations];n[t]=e,vt({operations:n})}function xo(e){vt({groups:e})}function xS(e){cg(e),vt({activeTheaterId:e})}function _i(e,t){const n=e===null?!0:t?.acknowledged===!1?!1:OM(e);Je.activeOperationId===e&&Je.activeOperationAcknowledged===n||vt({activeOperationId:e,activeOperationAcknowledged:n})}function b7(e,t){Je.operationStatus[e]!==t&&vt({operationStatus:{...Je.operationStatus,[e]:t}})}function w7(e){if(!(e in Je.operationStatus))return;const t={...Je.operationStatus};delete t[e],vt({operationStatus:t})}function S7(e){if(!e.operationId)return;const t=Je.operations.find(l=>l.id===e.operationId);if(!t)return;const n=t.theaterId??null,i=Je.theaters.find(l=>l.id===n)?.label??n??"Unknown",s=t.title,o=H7(e.kind);n2+=1,vt({operationNotifications:{...Je.operationNotifications,[e.operationId]:{kind:o,operationId:e.operationId,theaterId:n,theaterLabel:i,operationLabel:s,lastRaisedSeq:n2}}})}function WM(){vt({addingTheater:!0,theaterError:null})}function qM(e){const t=[e,...Je.theaters.filter(n=>n.id!==e.id)];cg(e.id),vt({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function x7(){vt({addingTheater:!1,theaterError:null})}function Bb(e){vt({addingTheater:!1,theaterError:e})}function Ml(e){const t=Je.operations.find(i=>i.id===e);if(!t)return;cg(t.theaterId);const n=OM(e);vt({activeTheaterId:t.theaterId,activeOperationId:e,activeOperationAcknowledged:n,pendingOperationFocus:e,operationNotifications:YM(Je.operationNotifications,e)})}function r2(){Je.pendingOperationFocus!==null&&vt({pendingOperationFocus:null})}function k7(){vt({pendingSideBarAddTheater:!0})}function C7(){Je.pendingSideBarAddTheater&&vt({pendingSideBarAddTheater:!1})}function E7(e){vt({pendingSideBarTheaterLaunch:e})}function s2(){Je.pendingSideBarTheaterLaunch!==null&&vt({pendingSideBarTheaterLaunch:null})}function Ea(e){vt({keyboardFocusRequest:{operationId:e,requestId:(Je.keyboardFocusRequest?.requestId??0)+1}})}function GM(){vt({launchMenuRequest:{requestId:(Je.launchMenuRequest?.requestId??0)+1}})}function A7(){Je.launchMenuRequest!==null&&vt({launchMenuRequest:null})}function T7(){Je.keyboardShortcutsOpen||vt({keyboardShortcutsOpen:!0})}function R7(){Je.keyboardShortcutsOpen&&vt({keyboardShortcutsOpen:!1})}function M7(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 kS(e,t){if(t.length===0)return[...e].sort(Pb);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:Pb(i,s)})}function CS(e,t,n,i=[]){const s=kS(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 N7(e,t,n,i,s){const o=new Set(s);return CS(e,t,n,i).filter(l=>!o.has(l.id)).map(l=>l.id)}function Pb(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function ld(){vt({operationSearchOpen:!1})}function KM(){vt({operationSearchOpen:!Je.operationSearchOpen})}function VM(){Je.releaseNotes.length===0||Je.whatsNewOpen||vt({whatsNewOpen:!0,selectedReleaseNoteKey:Je.selectedReleaseNoteKey??JM(Je.releaseNotes)})}function Vf(){Je.whatsNewOpen&&(Je.automaticWhatsNewVersion&&K7(Je.automaticWhatsNewVersion),vt({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function a2(e){QM(Je.releaseNotes,e)&&vt({selectedReleaseNoteKey:e})}function cd(){const e=Ii().state;e&&!e.seenFeatureTours.includes(oh)&&Ss("seenFeatureTours",[...e.seenFeatureTours,oh]),Je.onboardingOpen&&vt({onboardingOpen:!1})}function zs(e){vt({codexReader:e,codexReaderExpanded:!1})}function Rp(){Je.codexReader!==null&&vt({codexReaderExpanded:!0})}function L7(){vt({codexReaderExpanded:!1})}function Hv(){vt({codexReader:null,codexReaderExpanded:!1})}function o2(){if(Je.bootstrapped)return;const e=Ii();if(e.loadStatus==="pending")return;if(e.loadStatus==="failed"||!e.state){vt({bootstrapped:!0,onboardingOpen:!1});return}const t=e.state.seenFeatureTours.includes(oh)||eN(),n=Je.theaters.length===0&&!t;vt({bootstrapped:!0,onboardingOpen:n?!0:Je.onboardingOpen})}async function O7(){if(i2)return!1;i2=!0;const e=Ii();if(e.loadStatus!=="ready"||!e.state||e.state.seenFeatureTours.includes(oh)||!eN())return!1;const t=await Ss("seenFeatureTours",[...e.state.seenFeatureTours,oh]);return t&&q7(),t}function I7(e){const t=Je.theaters.filter(d=>d.id!==e),n=XM(t,Je.activeTheaterId===e?null:Je.activeTheaterId),i=F7(Je.operationNotifications,e),s=new Set(Je.operations.filter(d=>d.theaterId===e).map(d=>d.id)),o=Je.activeOperationId&&s.has(Je.activeOperationId)?null:Je.activeOperationId,l=o===null?!0:Je.activeOperationAcknowledged;cg(n),vt({theaters:t,activeTheaterId:n,activeOperationId:o,activeOperationAcknowledged:l,operationNotifications:i})}function j7(e){const t=YM(Je.operationNotifications,e);t!==Je.operationNotifications&&vt({operationNotifications:t})}function D7(e){const t={...Je.notificationPreferences,globalMute:e};AS(t),vt({notificationPreferences:t})}function B7(e){const t={...Je.notificationPreferences,dnd:e};AS(t),vt({notificationPreferences:t})}function P7(e){const t={...Je.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const n={...Je.notificationPreferences,mutedTheaterIds:t};AS(n),vt({notificationPreferences:n})}function $7(e){return i7(e)}function z7(){for(const e of Ib)e()}function YM(e,t){if(!e[t])return e;const n={...e};return delete n[t],n}function F7(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 XM(e,t){const n=new Set(e.map(s=>s.id)),i=U7();return i&&n.has(i)?i:t&&n.has(t)?t:e[0]?.id??null}function H7(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function ZM(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||G7()===n.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:n.version,selectedReleaseNoteKey:ES(n.version,t)}}function JM(e){return e[0]?ES(e[0].version,0):null}function QM(e,t){return e.some((n,i)=>ES(n.version,i)===t)}function ES(e,t){return`${e}:${t}`}function U7(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Ob)}catch{return null}}function cg(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Ob,e):window.localStorage.removeItem(Ob)}catch{}}function W7(){if(typeof window>"u")return Kf;try{const e=window.localStorage.getItem(HM);if(!e)return Kf;const t=JSON.parse(e);return V7(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:Kf}catch{return Kf}}function eN(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(zM)==="1"}catch{return!1}}function q7(){if(!(typeof window>"u"))try{window.localStorage.removeItem(zM)}catch{}}function G7(){if(jb!==null)return jb;if(typeof window>"u")return null;try{return window.localStorage.getItem(FM)}catch{return null}}function K7(e){if(jb=e,!(typeof window>"u"))try{window.localStorage.setItem(FM,e)}catch{}}function AS(e){if(!(typeof window>"u"))try{window.localStorage.setItem(HM,JSON.stringify({version:UM,preferences:e}))}catch{}}function V7(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==UM||!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"}const tN="fleet-console.operations.side-width",nN="fleet-console.operations.side-collapsed",iN="fleet-console.operations.theater-collapsed",ug=280,l2=ug,$b=new Set,zb=new Set,Fb=new Set,Hb=new Set;let xl={width:s$(),collapsed:a$()},Mp=o$(),dm=!1,Ec=new Set,Ac=new Set,Y7=0,rN=new Map,c2=new Map,u2=new Set,Ub=new Set;function sN(){return g.useSyncExternalStore(l$,lh,lh)}function X7(){return g.useSyncExternalStore(u$,h2,h2)}function Z7(){return g.useSyncExternalStore(e$,qb,qb)}function J7(e,t,n){const i=g.useCallback(()=>TS(e,t,n),[e,t,n]);return g.useSyncExternalStore(t$,i,i)}function Q7(e){const t=Math.max(ug,Math.min(uN(),e));if(xl.width!==t){xl={...xl,width:t};try{typeof window<"u"&&localStorage.setItem(tN,String(t))}catch{}dN()}}function Ao(e){if(xl.collapsed!==e){xl={...xl,collapsed:e};try{typeof window<"u"&&localStorage.setItem(nN,e?"1":"0")}catch{}dN()}}function d2(e,t){const n=new Set(Mp);t?n.add(e):n.delete(e);const i=Array.from(n);if(i.join("\0")!==Mp.join("\0")){Mp=i;try{typeof window<"u"&&localStorage.setItem(iN,JSON.stringify(i))}catch{}c$()}}function Wb(e){if(dm!==e){dm=e;for(const t of Fb)t()}}function hm(){Wb(!dm)}function qb(){return dm}function e$(e){return Fb.add(e),()=>Fb.delete(e)}function TS(e,t,n){const i=cN(e,t);return Ec.has(i)?!0:Ac.has(i)?!1:n}function aN(e,t,n){const i=cN(e,t);TS(e,t,n)?(Ec=new Set(Ec),Ec.delete(i),Ac=new Set(Ac).add(i)):(Ac=new Set(Ac),Ac.delete(i),Ec=new Set(Ec).add(i));for(const s of Hb)s()}function t$(e){return Hb.add(e),()=>Hb.delete(e)}function n$(e){for(const t of e)rN.set(t,++Y7)}function oN(e){return rN.get(e)}function lN(e){const t=new Map(e.operations.map(s=>[s.id,Li(s,e.operationStatus)])),n=e.operations.filter(s=>e.operationStatus[s.id]===void 0||u2.has(s.id)?!1:(u2.add(s.id),!0)).map(s=>s.id),i=e.operations.filter(s=>{const o=c2.get(s.id);return o!==void 0&&o!==t.get(s.id)&&!n.includes(s.id)}).map(s=>s.id);n$(i),i.forEach(s=>Ub.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&&e.activeOperationAcknowledged===!0||jP(s.id):bS(s.id));return c2=t,i}function i$(){const e=Array.from(Ub);return Ub=new Set,e}function r$(){return SS(()=>{const e=Us();lN({operations:e.operations,operationStatus:e.operationStatus,activeTheaterId:e.activeTheaterId,activeOperationId:e.activeOperationId,activeOperationAcknowledged:e.activeOperationAcknowledged})})}function cN(e,t){return`${e}:${t}`}function uN(){return typeof window<"u"?Math.max(ug,window.innerWidth-480):800}function s$(){try{if(typeof window>"u")return l2;const e=localStorage.getItem(tN);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(ug,Math.min(uN(),t))}}catch{}return l2}function a$(){try{return typeof window<"u"&&localStorage.getItem(nN)==="1"}catch{return!1}}function o$(){try{if(typeof window>"u")return[];const e=localStorage.getItem(iN),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function dN(){for(const e of $b)e()}function lh(){return xl}function l$(e){return $b.add(e),()=>$b.delete(e)}function c$(){for(const e of zb)e()}function h2(){return Mp}function u$(e){return zb.add(e),()=>zb.delete(e)}const d$=1e4,h$=600,ns=new Map,ds=new Map,Jc=new Map,fm=new Map,dg=new Map,Ks=new Map,hu=new Set,hg=new Map,pm=new Map,xs=new Map,zc=new Map;let f2=!1;const Gb=new Set;let hN=0;vP(e=>Qc(e,!1));function _s(e){return e!==null&&ns.has(e)}function Qc(e,t){if(t){dS(e),ns.has(e)||(ns.size===0&&(f2=qb()),zc.set(e,KE(e)),ns.set(e,!0),Jc.set(e,0),fm.set(e,Date.now())),Wb(!0),Tp(ns.size>0),VE(e,null),Vs();return}if(!ns.has(e)){Tp(ns.size>0);return}const n=zc.get(e)??null,i=dM(e),s=n&&i.operations[n.operationId]&&!i.minimized.includes(n.operationId)?n:null;if(sg()===e&&KE(e)?.mode==="companion"&&Sr(),ns.delete(e),ds.delete(e),Jc.delete(e),fm.delete(e),zc.delete(e),_N(e),Tp(ns.size>0),ns.size===0){const{activeOperationId:o,activeOperationAcknowledged:l}=Us();o!==null&&!l&&_i(o),Wb(f2)}VE(e,s),Vs()}function fN(e){return g.useSyncExternalStore(gN,()=>_s(e),()=>_s(e))}function eu(e,t){xs.set(t,e),hu.delete(t);const n=Ks.delete(t);if(ds.get(e)===t){n&&Vs();return}ds.set(e,t),Vs()}function Uv(e){return ds.get(e)??null}function f$(e,t){xs.set(t,e),Ks.delete(t),dg.set(t,Date.now()),Jc.set(e,(Jc.get(e)??0)+1),ds.get(e)===t&&ds.delete(e),Vs()}function p$(e){return Jc.get(e)??0}function pN(e,t){xs.set(t,e),Ks.delete(t),hu.add(t),bS(t),ds.get(e)===t&&ds.delete(e),Vs()}function m$(e){ns.has(e)?Qc(e,!1):(ds.delete(e),Jc.delete(e),fm.delete(e),zc.delete(e),_N(e),Tp(ns.size>0),Vs())}function mN(e){const t=xs.get(e);hu.delete(e),dg.delete(e),Ks.delete(e),hg.delete(e),pm.delete(e),xs.delete(e),t&&ds.get(t)===e&&ds.delete(t);for(const[n,i]of zc)i?.operationId===e&&zc.set(n,null);Vs()}function gN(e){return Gb.add(e),()=>Gb.delete(e)}function p2(){return hN}function g$(e){return fm.get(e)??null}function y$(e,t,n=Date.now()){xs.set(t,e);let i=0;for(const[s,o]of Ks)xs.get(s)===e&&(i=Math.max(i,o));Ks.set(t,Math.max(n,i+1)),Vs()}function Wv(e){return hu.has(e)}function v$(e){return Ks.has(e)}function yN(e){return(e?.closest(".canvas-operation[data-operation-id]")??null)?.dataset.operationId??null}function _$(e,t,n,i=Date.now()){let s=!1;for(const o of t){if(o.theaterId!==e)continue;xs.get(o.id)!==e&&(xs.set(o.id,e),s=!0);const l=Li(o,n);(l==="running"||l==="dormant")&&Ks.delete(o.id)&&(s=!0),pm.get(o.id)!==l&&(pm.set(o.id,l),hg.set(o.id,i),s=!0)}s&&Vs()}function m2(e,t){return(e==="awaiting"||e==="idle")&&(t==="running"||t==="dormant")}function Np(e,t){const n=Li(e,t);return n==="awaiting"||n==="idle"&&Bo().has(e.id)}function b$(e,t,n,i=()=>{}){const s=globalThis.setTimeout(()=>{const o=n();i(),o&&f$(e,t)},h$);return()=>globalThis.clearTimeout(s)}function w$(e,t){return(e?.theaterId!==t.theaterId||e.operationId!==t.operationId)&&Sr(),t}function vN(e,t,n,i=Date.now()){const s=ds.get(e)??null,o=[];for(const d of t){if(d.theaterId!==e)continue;const f=Li(d,n),p=d.id===s;if(!p&&hu.has(d.id)||!p&&!Np(d,n))continue;const m=dg.get(d.id)??Number.NEGATIVE_INFINITY,y=i-m,_=f==="awaiting"&&y>=0&&y<=d$;o.push({operation:d,activity:f,picked:p,deferredAt:Ks.get(d.id)??null,seenAt:hg.get(d.id)??i,priority:p?0:_?1:f==="awaiting"?2:3})}const l=(d,f)=>d.seenAt-f.seenAt||d.operation.ts.createdAt-f.operation.ts.createdAt||d.operation.id.localeCompare(f.operation.id);return o.sort((d,f)=>{const p=d.deferredAt,m=f.deferredAt;return p!==null!=(m!==null)?+(p!==null)-+(m!==null):p!==null&&m!==null?p-m||d.priority-f.priority||l(d,f):d.priority-f.priority||l(d,f)}),o.map(({operation:d,activity:f,picked:p})=>({operation:d,activity:f,picked:p}))}function _N(e){for(const[t,n]of xs)n===e&&(hu.delete(t),dg.delete(t),Ks.delete(t),hg.delete(t),pm.delete(t),xs.delete(t))}function Vs(){hN+=1;for(const e of Gb)e()}function g2(e,t){return e!==null&&e===t?e:null}function S$(e,t,n,i){return CS(e.filter(s=>s.theaterId===n),t.filter(s=>s.theaterId===n),i)}function x$(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 k$(e,t){return!(t instanceof Node&&e.contains(t))}function C$(e,t,n,i,s=12){const o=i-s-n-t,l=s-t;return Math.max(l,Math.min(e,o))}const E$=288,y2=520,A$=120,ol=12;function bN({anchor:e,viewportBounds:t,placement:n="cursor",catalog:i,canLaunch:s,renderKindIcon:o,onLaunchKind:l,onClose:d}){const f=Ze(),p=g.useRef(null),m=g.useRef(null),[y,_]=g.useState(null);return g.useLayoutEffect(()=>{const w=m.current;if(!w)return;const S=()=>{const k=w.getBoundingClientRect();_(C=>C&&Math.abs(C.width-k.width)<.5&&Math.abs(C.height-k.height)<.5?C:{width:k.width,height:k.height})};if(S(),typeof ResizeObserver>"u")return;const x=new ResizeObserver(S);return x.observe(w),()=>x.disconnect()},[]),g.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]),g.useEffect(()=>{m.current?.focus()},[]),c.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${n==="above"?"operation-launch-control--up":""}`,ref:p,style:R$(e,t,n,y),"data-canvas-blocker":!0,children:c.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":f("canvas.menu.aria"),tabIndex:-1,ref:m,children:[c.jsxs("div",{className:"canvas-context-menu-head",children:[c.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:c.jsx(T$,{})}),c.jsx("span",{className:"canvas-context-menu-head-text",children:c.jsx("strong",{children:f("canvas.menu.title")})})]}),c.jsx("p",{className:"canvas-context-menu-section",children:f("canvas.menu.launch")}),i.length>0?i.map((w,S)=>c.jsxs("div",{children:[S>0?c.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,c.jsx("p",{className:"canvas-context-menu-plugin",children:w.title}),w.kinds.map(x=>{const k=x.disabled===!0||!s;return c.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:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:o(w.id,x)??c.jsx(M$,{})}),c.jsx("span",{className:"theater-menu-label",children:x.title}),x.disabledReason?c.jsx("span",{className:"operation-launch-menu-reason",children:x.disabledReason}):null]},`${w.id}:${x.id}`)})]},w.id)):c.jsx("p",{className:"theater-menu-empty",children:f("canvas.menu.empty")})]})})}function T$(){return c.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function R$(e,t,n,i){const o={"--canvas-menu-max-height":`${t?Math.max(A$,Math.min(y2,t.height-ol*2)):y2}px`},l=i?.width??E$,d=i?.height??0,f=t?Math.max(ol,Math.min(e.x,t.width-l-ol)):e.x;if(n==="above")return{...o,left:f,bottom:Math.max(ol,e.y)};if(!t)return{...o,left:f,top:e.y};const p=e.y+d+ol<=t.height?e.y:e.y-d,m=Math.max(ol,Math.min(p,t.height-d-ol));return{...o,left:f,top:m}}function M$(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function wN(e,t){const n=document.activeElement;e===null||!(n instanceof Node)||!e.contains(n)||document.querySelector(t)?.focus()}const Yf="directory-browser-sectors";function SN({open:e,onCancel:t,onConfirm:n}){const i=Ze(),[s,o]=g.useState(null),[l,d]=g.useState(null),[f,p]=g.useState(null),[m,y]=g.useState(""),[_,w]=g.useState(""),[S,x]=g.useState(0),k=g.useRef(null),C=g.useRef(null),B=async(E,L)=>{d(E),p(null),y(""),x(0);try{const R=await g8(E,L);o(R)}catch(R){if(R instanceof DOMException&&R.name==="AbortError")return;p(R instanceof Sn?R.message:String(R))}finally{d(null)}};g.useEffect(()=>{if(!e)return;const E=new AbortController;return B(null,E.signal),()=>E.abort()},[e]),g.useEffect(()=>{e&&k.current?.focus()},[e,s?.path]);const H=s?.entries??[],T=g.useMemo(()=>{const E=m.trim().toLowerCase();return E===""?H:H.filter(L=>L.name.toLowerCase().includes(E))},[H,m]),$=g.useMemo(()=>s?N$(s):[],[s]),j=s?v2(s.path):null,M=s?.roots??[],V=M.length>1,Y=T.length===0?-1:Math.min(S,T.length-1);if(g.useEffect(()=>{if(Y<0)return;C.current?.querySelector(`[data-index="${Y}"]`)?.scrollIntoView({block:"nearest"})},[Y,s?.path]),!e)return null;const te=E=>{E.accessible&&l===null&&B(E.path)},J=()=>{s?.parentPath!=null&&l===null&&B(s.parentPath)},P=()=>{const E=_.trim();E!==""&&l===null&&B(E)},N=s?.path??null,I=Y>=0?`${Yf}-${Y}`:void 0,D=E=>{switch(E.key){case"Escape":m!==""?y(""):t();return;case"ArrowDown":E.preventDefault(),x(L=>Math.min(L+1,Math.max(T.length-1,0)));return;case"ArrowUp":E.preventDefault(),x(L=>Math.max(L-1,0));return;case"Enter":{E.preventDefault();const L=T[Y];L&&te(L);return}case"Backspace":m===""&&(E.preventDefault(),J());return;default:return}};return ea.createPortal(c.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[c.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":i("common.close"),onClick:t}),c.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":i("chrome.directoryBrowser.dialogAria"),onKeyDown:D,children:[c.jsxs("header",{className:"directory-browser-header",children:[c.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:c.jsx(I$,{})}),c.jsxs("div",{className:"directory-browser-heading",children:[c.jsx("span",{className:"directory-browser-kicker",children:i("chrome.directoryBrowser.kicker")}),c.jsx("h2",{children:i("chrome.directoryBrowser.title")})]}),c.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":i("common.close"),children:"×"})]}),V?c.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":i("chrome.directoryBrowser.drives"),children:[c.jsx("span",{className:"directory-browser-kicker",children:i("chrome.directoryBrowser.locations")}),c.jsx("div",{className:"directory-browser-root-chips",children:M.map(E=>{const L=j!=null&&v2(E)===j;return c.jsx("button",{type:"button",className:`directory-browser-root-chip ${L?"is-active":""}`,"aria-current":L?"location":void 0,disabled:l!==null,title:E,onClick:()=>{l===null&&B(E)},onKeyDown:R=>R.stopPropagation(),children:O$(E)},E)})})]}):null,c.jsx("nav",{className:"directory-browser-course","aria-label":i("chrome.directoryBrowser.path"),children:$.map((E,L)=>{const R=L===$.length-1;return c.jsxs("span",{className:"directory-browser-course-seg",children:[L>0?c.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,c.jsx("button",{type:"button",className:`directory-browser-crumb ${R?"is-current":""}`,"aria-current":R?"location":void 0,disabled:R||l!==null,title:E.path,onClick:()=>{B(E.path)},children:E.label})]},E.path)})}),c.jsxs("div",{className:"directory-browser-toolbar",children:[c.jsxs("div",{className:"directory-browser-filter",children:[c.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:c.jsx(D$,{})}),c.jsx("input",{ref:k,type:"text",className:"directory-browser-filter-input",placeholder:i("chrome.directoryBrowser.filterPlaceholder"),"aria-label":i("chrome.directoryBrowser.filterAria"),"aria-controls":Yf,value:m,spellCheck:!1,autoComplete:"off",onChange:E=>{y(E.target.value),x(0)}})]}),c.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||l!==null,title:i("chrome.directoryBrowser.upTitle"),onClick:J,children:[c.jsx(B$,{}),c.jsx("span",{children:i("chrome.directoryBrowser.up")})]})]}),c.jsxs("div",{className:"directory-browser-jump",children:[c.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:i("chrome.directoryBrowser.jumpPlaceholder"),"aria-label":i("chrome.directoryBrowser.jumpAria"),value:_,spellCheck:!1,autoComplete:"off",onChange:E=>w(E.target.value),onKeyDown:E=>{E.stopPropagation(),E.key==="Enter"&&(E.preventDefault(),P())}}),c.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:_.trim()===""||l!==null,onClick:P,onKeyDown:E=>E.stopPropagation(),children:i("chrome.directoryBrowser.go")})]}),f?c.jsx("p",{className:"directory-browser-error",role:"alert",children:f}):null,c.jsx("div",{className:"directory-browser-list",id:Yf,role:"listbox","aria-label":i("chrome.directoryBrowser.folders"),"aria-busy":l!==null,"aria-activedescendant":I,ref:C,children:l!==null?c.jsxs("p",{className:"directory-browser-state is-live",children:[c.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),i("chrome.directoryBrowser.loadingFolders")]}):T.length===0?c.jsx("p",{className:"directory-browser-state",children:i(m!==""?"chrome.directoryBrowser.noMatch":"chrome.directoryBrowser.noFolders")}):T.map((E,L)=>c.jsxs("div",{id:`${Yf}-${L}`,"data-index":L,role:"option","aria-selected":L===Y,"aria-disabled":!E.accessible,className:`directory-browser-sector ${L===Y?"is-active":""} ${E.accessible?"":"is-locked"}`,title:E.path,onClick:()=>{x(L),te(E)},children:[c.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:c.jsx(j$,{})}),c.jsx("span",{className:"directory-browser-sector-name",children:E.name}),E.accessible?c.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):c.jsxs("span",{className:"directory-browser-sector-lock",children:[c.jsx(P$,{})," ",i("chrome.directoryBrowser.locked")]})]},E.path))}),s?.truncated?c.jsx("p",{className:"directory-browser-note",children:i("chrome.directoryBrowser.truncated")}):null,c.jsxs("footer",{className:"directory-browser-actions",children:[c.jsxs("div",{className:"directory-browser-target",children:[c.jsx("span",{className:"directory-browser-target-label",children:i("chrome.directoryBrowser.theaterRoot")}),c.jsx("span",{className:"directory-browser-target-path",title:N??"",children:N??i("common.loading")})]}),c.jsxs("div",{className:"directory-browser-buttons",children:[c.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:i("common.cancel")}),c.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:N===null||l!==null,onClick:()=>N&&n(N),children:i("chrome.directoryBrowser.addTheater")})]})]})]})]}),document.body)}function N$(e){if(L$(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 L$(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function v2(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function O$(e){return e.replace(/[\\/]+$/,"")||e}function I$(){return c.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[c.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),c.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function j$(){return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function D$(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function B$(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function P$(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function Cs(){return g.useSyncExternalStore(SS,Us,Us)}const RS=[{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 $$(e){return RS.map(t=>({key:t.key,label:e(t.labelKey),color:t.color}))}const z$={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 xN(e){return typeof e!="string"||e.length===0?null:RS.some(t=>t.key===e)?e:z$[e]??null}function os(e){const t=xN(e);return t?RS.find(n=>n.key===t)?.color??null:null}function Yd(e){return typeof e.accent=="string"?e.accent:null}const _2=8,F$=268;function MS({accentKey:e,includeNone:t,onSelect:n}){const i=Ze(),s=$$(i),o=xN(e);return c.jsxs(c.Fragment,{children:[t?c.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:[c.jsx("span",{className:"accent-tone-flag accent-tone-flag--none","aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:i("canvas.accent.none")})]}):null,s.map(l=>c.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:[c.jsx("span",{className:"accent-tone-flag",style:{background:l.color},"aria-hidden":"true"}),c.jsx("span",{className:"accent-tone-name",children:l.label})]},l.key))]})}function H$({anchor:e,accentKey:t,onSelect:n,onClose:i}){const s=Ze(),[o,l]=g.useState(void 0);g.useLayoutEffect(()=>{const f=Math.max(8,Math.min(e.left,window.innerWidth-8)),p=e.bottom+_2,m=p+F$>window.innerHeight;l(m?{position:"fixed",left:f,top:"auto",bottom:Math.round(window.innerHeight-e.top+_2)}:{position:"fixed",left:f,top:Math.round(p)})},[e]),g.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 ea.createPortal(c.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:i,children:o?c.jsx("div",{className:"accent-popover-card",role:"menu","aria-label":s("canvas.accent.menuAria"),style:o,onPointerDown:f=>f.stopPropagation(),children:c.jsx(MS,{accentKey:t,includeNone:!0,onSelect:d})}):null}),document.body)}const b2=8,U$=320;function w2(e){const t=Ze(),{anchor:n,onClose:i}=e,[s,o]=g.useState(void 0);return g.useLayoutEffect(()=>{const l=Math.max(8,Math.min(n.left,window.innerWidth-208)),d=n.bottom+b2,f=d+U$>window.innerHeight;o(f?{position:"fixed",left:l,top:"auto",bottom:Math.round(window.innerHeight-n.top+b2)}:{position:"fixed",left:l,top:Math.round(d)})},[n]),g.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]),ea.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?c.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"?c.jsx(W$,{...e}):c.jsx(q$,{...e})}):null}),document.body)}function W$({operation:e,groups:t,accentKey:n,actions:i,onClose:s}){const o=Ze(),[l,d]=g.useState(!1),[f,p]=g.useState(()=>o("canvas.groupMenu.defaultName",{n:t.length+1})),m=g.useRef(!1),y=g.useRef(null);g.useEffect(()=>{l&&y.current?.select()},[l]);const _=()=>{const w=f.trim();w&&(i.onCreateGroup(w),s())};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:o("canvas.groupMenu.sectionGroup")}),t.map(w=>{const S=os(w.color),x=e.groupId===w.id;return c.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:[c.jsx("span",{className:"group-context-menu-item__dot",style:S?{background:S}:void 0,"aria-hidden":"true"}),c.jsx("span",{className:"group-context-menu-item__name",children:w.name}),x?c.jsx(G$,{}):null]},w.id)}),l?c.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(),_()),w.key==="Escape"&&(w.preventDefault(),d(!1))},onBlur:()=>d(!1),"aria-label":o("canvas.groupMenu.newGroupNameAria"),placeholder:o("canvas.groupMenu.groupNamePlaceholder")}):c.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>d(!0),children:c.jsx("span",{className:"group-context-menu-item__new-label",children:o("canvas.groupMenu.newGroup")})}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:o("canvas.groupMenu.sectionAccent")}),c.jsx(MS,{accentKey:n,includeNone:!0,onSelect:w=>{i.onSetAccent(w),s()}})]})}function q$({group:e,actions:t,onClose:n}){const i=Ze(),[s,o]=g.useState(e.name),[l,d]=g.useState(!1),f=g.useRef(!1),p=()=>{const m=s.trim();if(!m||m===e.name){n();return}t.onRename(m),n()};return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"group-context-menu-section-label",children:i("canvas.groupMenu.sectionColor")}),c.jsx(MS,{accentKey:e.color,includeNone:!1,onSelect:m=>{m&&t.onSetColor(m),n()}}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("div",{className:"group-context-menu-section-label",children:i("canvas.groupMenu.sectionRename")}),c.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")}),c.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${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 G$(){return c.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:c.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function K$(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","→"]],description:e("shortcuts.map.triageDefer")},{combos:[["Alt","F"]],description:e("shortcuts.map.toggleFormation")},{combos:[["Alt","T"]],description:e("shortcuts.map.toggleTriage")},{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 jd="data-keyboard-shortcuts-open",V$='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function kN(){return document.body.getAttribute(jd)==="true"}function Y$(){return!kN()}function CN({onClose:e}){const t=Ze(),n=g.useMemo(()=>K$(t),[t]),i=g.useRef(null);g.useEffect(()=>{const o=i.current,l=document.querySelector(".console-shell"),d=document.body.getAttribute(jd);return document.body.setAttribute(jd,"true"),l&&(l.inert=!0),o?.focus(),()=>{d===null?document.body.removeAttribute(jd):document.body.setAttribute(jd,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(V$)??[]];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 ea.createPortal(c.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:c.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:[c.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[c.jsx("strong",{children:t("chrome.shortcuts.title")}),c.jsx("button",{type:"button",onClick:e,"aria-label":t("chrome.shortcuts.closeAria"),children:"✕"})]}),n.map(o=>c.jsxs("section",{className:"keyboard-shortcuts-group",children:[c.jsx("h3",{children:o.title}),c.jsx("dl",{children:o.entries.map(l=>c.jsxs("div",{children:[c.jsx("dt",{children:l.combos.map((d,f)=>c.jsxs("span",{children:[f>0?t("chrome.shortcuts.or"):null,d.map(p=>c.jsx("kbd",{children:p==="Mod"?t("chrome.shortcuts.modKey"):p},p))]},d.join("+")))}),c.jsx("dd",{children:l.description})]},`${o.title}:${l.description}`))})]},o.title))]})}),document.body)}const X$=1400,Z$="https://github.com/sbluemin/fleet-harness",J$="https://github.com/sbluemin/fleet-harness/stargazers",Q$="https://api.github.com/repos/sbluemin/fleet-harness",NS="fleet-console.github-stars",ez=360*60*1e3,S2='[role="menuitem"]:not([disabled])';function tz(){const e=Cs();return c.jsxs("div",{className:"side-bar-brand-foot",children:[c.jsx(iz,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),c.jsx(rz,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function nz({className:e="brand-foot-home"}){const t=Ze();return c.jsxs(rh,{className:e,to:"/operations","aria-label":t("chrome.brandFoot.operations"),children:[c.jsx(mz,{}),c.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function iz({latestVersion:e,updateAvailable:t}){const n=Ze(),i=g.useRef(null),s=g.useRef(null),o=g.useRef(null),[l,d]=g.useState(!1),f=uu();EN(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 c.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[c.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:[c.jsx(x2,{}),c.jsx("span",{children:n("chrome.brandFoot.systemMenu")})]}),l?c.jsxs("div",{ref:o,className:"brand-foot-dropup-menu",role:"menu","aria-label":n("chrome.brandFoot.systemMenu"),children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>p("/settings"),children:[c.jsx(x2,{}),c.jsx("span",{children:n("chrome.brandFoot.settings")})]}),t?c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(sz,{latestVersion:e})]}):null]}):null]})}function rz({releaseDisabled:e,version:t}){const n=Ze(),i=g.useRef(null),s=g.useRef(null),o=g.useRef(null),[l,d]=g.useState(!1),[f,p]=g.useState(!1);return EN(i,s,o,l,d),c.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[c.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:c.jsx(gz,{})}),l?c.jsxs("div",{ref:o,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":n("chrome.brandFoot.help"),children:[c.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{d(!1),VM()},children:[c.jsx(yz,{}),c.jsx("span",{children:n("chrome.brandFoot.whatsNew")})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{d(!1),p(!0)},children:[c.jsx(vz,{}),c.jsx("span",{children:n("chrome.brandFoot.keyboardShortcuts")})]}),c.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),c.jsx(az,{menuItem:!0,version:t})]}):null,f?c.jsx(CN,{onClose:()=>{p(!1),s.current?.focus()}}):null]})}function EN(e,t,n,i,s){g.useEffect(()=>{if(!i)return;const o=window.requestAnimationFrame(()=>{n.current?.querySelector(S2)?.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(S2)??[]];if(p.length===0)return;f.preventDefault();const m=p.findIndex(_=>_===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 sz({latestVersion:e}){const t=Ze(),[n,i]=g.useState("idle"),[s,o]=g.useState(null),l=g.useRef(null),d=oz(n,s,e,t);g.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 p8()).status!=="accepted"){i("error"),o("invalid_response");return}i("accepted"),l.current=window.setTimeout(()=>{l.current=null,i("completed")},X$)}catch(p){const m=p instanceof Sn?p.message:"network_error";o(m),i(cz(m)?"blocked":"error")}}};return c.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 az({menuItem:e=!1,version:t}){const n=Ze(),i=uz(),s=i.count!==null;return c.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":n("chrome.brandFoot.github"),children:[c.jsx("a",{className:"brand-foot-github-link",href:Z$,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":n("chrome.brandFoot.openGithub"),title:n("chrome.brandFoot.githubRepo"),children:c.jsx(_z,{})}),c.jsxs("a",{className:"brand-foot-github-stars",href:J$,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:[c.jsx(bz,{}),s?c.jsx("span",{className:"brand-foot-github-stars-count",children:pz(i.count)}):null]}),c.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function oz(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"?lz(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 lz(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 cz(e){return e==="local_channel"||e==="managed_runtime_update_requires_relaunch"||e==="update_already_in_progress"||e==="update_not_available"}function uz(){const[e,t]=g.useState(()=>{const n=dz();return n===null?{count:null,status:"idle"}:{count:n,status:"ready"}});return g.useEffect(()=>{if(hz())return;let n=!1;return t(i=>i.status==="ready"?i:{...i,status:"loading"}),fetch(Q$,{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}fz(s),t({count:s,status:"ready"})}).catch(()=>{n||t(i=>({count:i.count,status:i.count===null?"error":"ready"}))}),()=>{n=!0}},[]),e}function dz(){try{const e=window.localStorage.getItem(NS);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function hz(){try{const e=window.localStorage.getItem(NS);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<ez}catch{return!1}}function fz(e){try{window.localStorage.setItem(NS,JSON.stringify({count:e,at:Date.now()}))}catch{}}function pz(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function mz(){return c.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),c.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),c.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),c.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),c.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),c.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function x2(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function gz(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function yz(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function vz(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function _z(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function bz(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function wz(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 _=y.dataset.sideBarChipId;if(!_||_===i)continue;const w=y.getBoundingClientRect();if(e<=w.top+w.height/2)return{groupId:o.groupId,index:Math.max(0,o.entryIds.indexOf(_))}}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 Sz(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 xz(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 kz(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 Cz(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 Ez(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 Az(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 Tz(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 Rz(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 Mz='button[role^="menuitem"]:not(:disabled)',Nz="data-accent-option";function Lz({open:e,menuSelector:t,returnFocusRef:n,requestedAction:i,onEscape:s}){g.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(Mz)),_=(C,B)=>{const H=y();for(const[T,$]of H.entries())$.tabIndex=T===C?0:-1;B&&H[C]?.focus()},w=y();if(w.length>0){const C=i==="set-accent"?w.findIndex(H=>H.hasAttribute(Nz)):0,B=Math.max(0,C);_(B,!1),n.current!==null&&(l=window.requestAnimationFrame(()=>{!o&&m.isConnected&&_(B,!0)}))}const S=C=>{const B=y();if(B.length===0)return;if(C.key==="Escape"){C.preventDefault(),C.stopPropagation();const $=n.current;s(),$?.focus();return}if(C.key==="Enter"&&document.activeElement instanceof HTMLButtonElement&&m.contains(document.activeElement)){C.preventDefault(),C.stopPropagation(),document.activeElement.click();return}if(C.key!=="ArrowDown"&&C.key!=="ArrowUp")return;C.preventDefault(),C.stopPropagation();const H=B.findIndex($=>$===document.activeElement),T=C.key==="ArrowDown"?(H+1)%B.length:H<=0?B.length-1:H-1;_(T,!0)},x=C=>{if(C.target instanceof HTMLInputElement)for(const B of y())B.tabIndex=-1},k=new MutationObserver(()=>{const C=y();if(document.activeElement instanceof HTMLInputElement&&m.contains(document.activeElement)){for(const H of C)H.tabIndex=-1;return}const B=C.findIndex(H=>H.tabIndex===0);C.length>0&&_(Math.max(0,B),!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 Lp=null;const Kb=new Set;function Oz(e,t){Lp={operationId:e,action:t},Iz()}function AN(e){return Kb.add(e),TN(e),()=>Kb.delete(e)}function Iz(){for(const e of Kb)if(TN(e))return}function TN(e){return Lp===null||!e(Lp)?!1:(Lp=null,!0)}function LS(e){const{currentTitle:t,onCommit:n,onBegin:i}=e,s=g.useRef(null),o=g.useRef(!1),l=g.useRef(!1),[d,f]=g.useState(!1),[p,m]=g.useState("");g.useEffect(()=>{d&&(s.current?.focus(),s.current?.select())},[d]);const y=()=>{i?.(),l.current=!1,m(t),f(!0)},_=()=>{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:_,commit:w,setDraftTitle:m,handleKeyDown:k=>{if(k.key==="Enter"){k.preventDefault(),w();return}k.key==="Escape"&&(k.preventDefault(),_())},handleBlur:()=>{if(l.current){l.current=!1;return}w()}}}function mm({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:_=!1,onArmClose:w,onDisarmClose:S,onClose:x,onMinimize:k,onFocus:C,onKeyboardMove:B,onPointerDragStart:H,onOpenAccent:T,onRename:$}){const j=Ze(),M=g.useRef(null),V=g.useRef(!1),{operation:Y,active:te,minimized:J,notificationCount:P,status:N}=e,I=jz(Y),D=o&&s?j("sidebar.chip.inGroup",{name:s.name}):"",E=l?j("sidebar.chip.unseenContext"):"",L=te?j("sidebar.chip.focusedAria",{title:I,groupContext:D,unseenContext:E}):j("sidebar.chip.focusAria",{title:I,groupContext:D,unseenContext:E}),R=LS({currentTitle:I,onCommit:Z=>$(Y.id,Z),onBegin:S}),q=["side-bar-chip",l?"side-bar-chip--unseen":"",te?"side-bar-chip--active":"",J?"side-bar-chip--minimized":"",d?"side-bar-chip--status-landed":"",p?"side-bar-chip--dragging":"",y?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),U=["side-bar-chip-close",n?"is-armed":""].filter(Boolean).join(" "),O={"--i":t,...i?{"--user-accent":i}:{},...p?{"--drag-dy":`${Math.round(m)}px`}:{}},W=()=>{if(S(),V.current){V.current=!1;return}C(Y.id)},K=Z=>{Z.stopPropagation()},z=Z=>{if(Z.stopPropagation(),!n){w(Y.id);return}S(),x(Y.id)},G=Z=>{Z.preventDefault(),S(),T(Y.id,Z.currentTarget.getBoundingClientRect())};return g.useEffect(()=>AN(Z=>{if(Z.operationId!==Y.id||_)return!1;const se=M.current;return!se||se.closest("[inert]")?!1:Z.action==="rename"?(R.begin(),!0):Z.action==="assign-group"||Z.action==="set-accent"?(S(),se.scrollIntoView({block:"nearest"}),T(Y.id,se.getBoundingClientRect(),se,Z.action),!0):(S(),k(Y.id),se.focus(),!0)}),[S,k,T,Y.id,_,R]),c.jsxs("li",{ref:M,"data-side-bar-chip-id":Y.id,"data-reorder-enabled":f?"true":"false",className:q,role:"button",tabIndex:0,"aria-haspopup":_?void 0:"menu","aria-label":L,"aria-current":te?"true":void 0,title:j(_?"sidebar.chip.previewTitle":te?"sidebar.chip.activeTitle":"sidebar.chip.idleTitle"),style:O,onClick:W,onContextMenu:_?void 0:G,onFocus:()=>{n||S()},onPointerDown:f?Z=>H(Z,Y.id):void 0,onPointerUp:()=>{p&&(V.current=!0)},onKeyDown:Z=>{if(Z.target===Z.currentTarget){if(!_&&f&&Z.altKey&&Z.shiftKey&&(Z.key==="ArrowUp"||Z.key==="ArrowDown")){Z.preventDefault(),B(Y.id,Z.key==="ArrowUp"?-1:1);return}if(!_&&(Z.key==="ContextMenu"||Z.shiftKey&&Z.key==="F10")){Z.preventDefault(),S(),T(Y.id,Z.currentTarget.getBoundingClientRect(),Z.currentTarget);return}(Z.key==="Enter"||Z.key===" ")&&(Z.preventDefault(),W())}},children:[c.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:c.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??c.jsx($z,{})})}),R.renaming?c.jsx("input",{className:"side-bar-chip-rename-input",ref:R.inputRef,value:R.draftTitle,"aria-label":j("sidebar.chip.renameAria",{title:I}),onChange:Z=>R.setDraftTitle(Z.target.value),onKeyDown:R.handleKeyDown,onBlur:R.handleBlur,onPointerDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation()}):c.jsx("span",{className:"side-bar-chip-name",onDoubleClick:_?void 0:R.begin,children:I}),P>0?c.jsx("span",{className:"side-bar-chip-count",children:P}):null,s&&o&&!_?c.jsx("span",{className:"side-bar-chip-group-pill",title:s.name,"aria-hidden":"true",style:{"--group-mark":s.color},children:s.name}):s&&!o?c.jsx("span",{className:"side-bar-chip-group-mark",title:s.name,"aria-label":j("sidebar.chip.groupAria",{name:s.name}),style:{"--group-mark":s.color}}):null,l?c.jsx("span",{className:"side-bar-chip-unseen","aria-hidden":"true",title:j("sidebar.chip.unseenTitle")}):null,o?null:c.jsx("span",{className:`side-bar-chip-status ${Dz(N)}`,role:"img","aria-label":k2(N),title:k2(N)}),!_&&!J?c.jsx("button",{type:"button",className:"side-bar-chip-minimize",onPointerDown:K,onClick:Z=>{Z.stopPropagation(),S(),k(Y.id)},"aria-label":j("sidebar.chip.minimizeAria",{title:I}),title:j("sidebar.chip.minimizeTitle"),children:c.jsx(Pz,{})}):null,_?null:c.jsx("button",{type:"button",className:U,onPointerDown:K,onClick:z,"aria-label":n?j("sidebar.chip.confirmCloseAria",{title:I}):j("sidebar.chip.closeAria",{title:I}),title:j(n?"sidebar.chip.confirmCloseTitle":"sidebar.chip.closeTitle"),children:n?j("sidebar.chip.closeArmed"):c.jsx(Bz,{})})]})}function jz(e){return e.title}function Dz(e){const t=Eh(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 k2(e){return ZP(e)}function Bz(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function Pz(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function $z(){return c.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:c.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function RN({group:e,count:t,collapsed:n,dragging:i,dropTarget:s,dragOffsetY:o,onToggle:l,onContextMenu:d,onPointerDragStart:f}){const p=Ze(),m=g.useRef(!1),y=os(e.color),_=["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=C=>{C.preventDefault(),d(e.id,C.currentTarget.getBoundingClientRect())},x=C=>{C.target instanceof Element&&C.target.closest("button")||f(C,e.id)},k=()=>{i&&(m.current=!0)};return c.jsxs("div",{className:_,style:w,onContextMenu:S,onPointerDown:x,onPointerUp:k,role:"group","aria-label":e.name,children:[c.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:c.jsx(zz,{collapsed:n})}),c.jsx("span",{className:"side-bar-group-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-group-header__name",children:e.name}),c.jsx("span",{className:"side-bar-group-header__count","aria-label":p("sidebar.group.operationsCount",{count:t}),children:t})]})}function zz({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:c.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function MN(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 Fz=1500,Hz=6,C2=34,E2=18,Uz=500;function Wz(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 NN({theaterId:e,section:t,unseenCount:n=0,children:i}){const s=Ze(),o=t.entries.length===0,l=J7(e,t.status,o);return c.jsxs("li",{className:["side-bar-status-section",`side-bar-status-section--${t.status}`,o?"side-bar-status-section--empty":""].filter(Boolean).join(" "),children:[c.jsxs("div",{className:`side-bar-status-header side-bar-status-header--${t.status}`,children:[c.jsx("button",{type:"button",className:"side-bar-status-header__toggle",onClick:()=>aN(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:c.jsx(qz,{collapsed:l})}),c.jsx("span",{className:"side-bar-status-header__dot","aria-hidden":"true"}),c.jsx("span",{className:"side-bar-status-header__label",children:t.label}),n>0?c.jsx("span",{className:"side-bar-status-header__unseen",children:n}):null,c.jsx("span",{className:"side-bar-status-header__count",children:t.entries.length})]}),l?null:c.jsx("ol",{className:"side-bar-group-chips","aria-label":s("sidebar.status.sectionOperations",{label:t.label}),children:o?c.jsx("li",{className:"side-bar-status-empty-hint",children:s("sidebar.status.noOperations")}):i})]})}function qz({collapsed:e}){return c.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-status-header__arrow${e?" is-collapsed":""}`,children:c.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function Gz({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:_,onClose:w,onMinimize:S,onFocus:x,onSetAccent:k,onRename:C,onSetGroupId:B,onCreateGroup:H,onSetGroupColor:T,onRenameGroup:$,onReorderGroups:j,onReorderTheaters:M,onUngroupAll:V,onSelectTheater:Y,onAddTheater:te,onCancelAddTheater:J,onForgetTheater:P}){const N=Ze(),I=g.useRef(null),D=g.useRef(null),E=sN(),{width:L,collapsed:R}=E,q=Z7(),U=g.useRef(R),O=cS(),W=g.useRef(null),K=g.useRef(new Set),z=g.useRef(!1),[G,Z]=g.useState(null),[se,Se]=g.useState(new Set),[pe,$e]=g.useState(null),je=g.useRef(null),St=g.useRef([]),Re=g.useRef([]),ze=g.useRef([]),lt=g.useRef([]),kt=g.useRef([]),mt=g.useRef(B),Ct=g.useRef(j),dt=g.useRef(M),gt=g.useRef(null),[at,Pt]=g.useState(null),[Ut,tt]=g.useState(null),[cn,ke]=g.useState(!1),[De,Xe]=g.useState(!1),_t=fP(),ht=X7(),{operationStatus:nt,activeOperationAcknowledged:st,pendingSideBarAddTheater:_e,pendingSideBarTheaterLaunch:Ne,launchMenuRequest:bt}=Cs(),Nt=g.useSyncExternalStore(IM,Bo,Bo);g.useLayoutEffect(()=>{!U.current&&R&&wN(I.current,".command-band-sidebar-toggle"),U.current=R},[R]);const hn=n.filter(X=>X.theaterId===t),le=i.filter(X=>X.theaterId===t),me=new Set(s),re=new Set(_t),ge=kS(hn,O.operationOrder).map(X=>{const we=MN(d,X),Me=we?y(X.pluginId,we):null;return{operation:X,active:o===X.id,minimized:me.has(X.id),notificationCount:l[X.id]?1:0,status:Li(X,nt),icon:Me}}),Te=LN(ge,le,O.operationOrder),We=ON(ge,oN,N),ee=Nt,he=X=>X!==o&&ee.has(X),Ee=new Map(ge.map((X,we)=>[X.operation.id,we])),Ve=new Map(le.map(X=>{const we=os(X.color);return[X.id,we?{name:X.name,color:we}:null]})),Rt=Te.some(X=>X.group!==null),ct=Te.flatMap(X=>X.groupId?[X.groupId]:[]),Pe=Te.flatMap(X=>re.has(X.groupId??"")?[]:X.entries),Ie=ge.map(X=>X.operation.id),it=n.map(X=>`${X.id}:${Li(X,nt)}`).join("\0"),Zt=g.useCallback(()=>{W.current!==null&&(window.clearTimeout(W.current),W.current=null)},[]),xt=g.useCallback(()=>{Zt(),Z(null)},[Zt]),Fn=g.useCallback(X=>{Zt(),Z(X),W.current=window.setTimeout(()=>{W.current=null,Z(null)},Fz)},[Zt]);g.useEffect(()=>Zt,[Zt]),g.useEffect(()=>AN(X=>{const we=n.find(Me=>Me.id===X.operationId);if(!we||we.theaterId!==t)return!1;if(R)return Ao(!1),!1;if(ht.includes(we.theaterId))return d2(we.theaterId,!1),!1;if(q){const Me=OS(Li(we,nt),we.id,Nt);return TS(we.theaterId,Me,!1)&&aN(we.theaterId,Me,!1),!1}return we.groupId&&re.has(we.groupId)&&Ab(we.groupId),!1}),[t,R,re,ht,Nt,nt,n,q]),g.useEffect(()=>{G!==null&&(ge.some(X=>X.operation.id===G)||xt())},[G,ge,xt]),g.useEffect(()=>{lN({operations:n,operationStatus:nt,activeTheaterId:t,activeOperationId:o,activeOperationAcknowledged:st});const X=i$();if(!z.current){z.current=!0;return}if(!q){for(const Me of K.current)window.clearTimeout(Me);K.current.clear(),Se(Me=>Me.size===0?Me:new Set);return}if(X.length===0)return;Se(Me=>{const He=new Set(Me);for(const Ke of X)He.add(Ke);return He});const we=window.setTimeout(()=>{K.current.delete(we),Se(Me=>{const He=new Set(Me);for(const Ke of X)He.delete(Ke);return He.size===Me.size?Me:He})},Uz);K.current.add(we)},[q,it,t,o,st]),g.useEffect(()=>()=>{for(const X of K.current)window.clearTimeout(X);K.current.clear()},[]),g.useEffect(()=>{if(!bt)return;A7();const we=I.current?.querySelector(".side-bar-theater-section--active .side-bar-theater-launch-btn")?.getBoundingClientRect();Pt(null),tt({anchor:we?{x:we.right+8,y:we.top}:{x:16,y:64},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},[bt]);const Xn=at?.kind==="chip"?ge.find(X=>X.operation.id===at.operationId)?.operation??null:null,pi=at?.kind==="group"?i.find(X=>X.id===at.groupId)??null:null,fn=at?.kind==="theater"?e.find(X=>X.id===at.theaterId)??null:null,Kt=(X,we)=>{if(q)return;const Me=Pe.findIndex(nn=>nn.operation.id===X);if(Me===-1)return;const He=Math.max(0,Math.min(Pe.length-1,Me+we));if(He===Me)return;const Ke=Pe.map(nn=>nn.operation.id),Yt=Rz(Ke,X,He);zv(Ez(Ie,Ke,Yt))},oe=Te.map(X=>({groupId:X.groupId,entryIds:X.entries.map(we=>we.operation.id)}));g.useEffect(()=>{St.current=ge,Re.current=Ie,ze.current=oe,lt.current=ct,kt.current=e.map(X=>X.id),mt.current=B,Ct.current=j,dt.current=M});const qe=X=>{je.current=X,$e(X)};g.useEffect(()=>{q&&je.current?.kind==="chip"&&qe(null)},[q]);const ot=pe?.pointerId??null;g.useEffect(()=>{if(ot===null)return;const X=He=>{if(He.pointerId!==ot)return;const Ke=je.current;if(!Ke)return;if(He.buttons===0){qe(null);return}const Yt=Math.hypot(He.clientX-Ke.startX,He.clientY-Ke.startY);if(!Ke.dragging&&Yt<Hz)return;if(Ke.dragging&&He.preventDefault(),Jz(He.clientY,D.current),Ke.kind==="chip"){const xn=wz(He.clientY,ze.current,D.current,Ke.sourceId);qe({...Ke,currentY:He.clientY,dragging:!0,dropIndex:xn.index,dropGroupId:xn.groupId});return}if(Ke.kind==="theater"){const xn=xz(He.clientY,kt.current,D.current,Ke.sourceTheaterId);qe({...Ke,currentY:He.clientY,dragging:!0,dropIndex:xn});return}const nn=Sz(He.clientY,lt.current,D.current,Ke.sourceGroupId);qe({...Ke,currentY:He.clientY,dragging:!0,dropIndex:nn})},we=He=>{if(He.pointerId!==ot)return;const Ke=je.current;if(qe(null),!Ke?.dragging)return;if(Ke.kind==="theater"){const mn=Tz(kt.current,Ke.sourceTheaterId,Ke.dropIndex);if(mn.join("\0")===kt.current.join("\0"))return;dt.current(mn);return}if(Ke.kind==="group"){const mn=Az(lt.current,Ke.sourceGroupId,Ke.dropIndex);if(mn.join("\0")===lt.current.join("\0"))return;Ct.current(mn);return}const{sourceId:Yt,sourceGroupId:nn,dropIndex:xn,dropGroupId:Xt}=Ke,ni=ze.current,As=Re.current;if(Xt!==nn){const zr=ni.find(cr=>cr.groupId===Xt)?.entryIds??[];zv(kz(As,Yt,xn,zr)),mt.current(Yt,Xt);return}const on=ni.find(mn=>mn.groupId===nn)?.entryIds??[],ii=on.indexOf(Yt);if(ii===-1||xn===ii)return;const lr=Cz(As,Yt,xn,on);zv(lr)},Me=He=>{He.pointerId===ot&&qe(null)};return window.addEventListener("pointermove",X),window.addEventListener("pointerup",we),window.addEventListener("pointercancel",Me),()=>{window.removeEventListener("pointermove",X),window.removeEventListener("pointerup",we),window.removeEventListener("pointercancel",Me)}},[ot]);const an=(X,we)=>{if(q||X.button!==0||X.target instanceof Element&&X.target.closest("button"))return;Pt(null),xt();const He=ge.find(Ke=>Ke.operation.id===we)?.operation.groupId??null;qe({kind:"chip",sourceId:we,sourceGroupId:He,pointerId:X.pointerId,startX:X.clientX,startY:X.clientY,currentY:X.clientY,dragging:!1,dropIndex:Ie.indexOf(we),dropGroupId:He})},$t=(X,we)=>{X.button===0&&(X.target instanceof Element&&X.target.closest("button")||ct.includes(we)&&(Pt(null),xt(),qe({kind:"group",sourceGroupId:we,pointerId:X.pointerId,startX:X.clientX,startY:X.clientY,currentY:X.clientY,dragging:!1,dropIndex:ct.indexOf(we)})))},On=(X,we)=>{if(X.button!==0||X.target instanceof Element&&X.target.closest("button"))return;const Me=e.map(He=>He.id);Me.includes(we)&&(Pt(null),xt(),qe({kind:"theater",sourceTheaterId:we,pointerId:X.pointerId,startX:X.clientX,startY:X.clientY,currentY:X.clientY,dragging:!1,dropIndex:Me.indexOf(we)}))},Si=g.useCallback(X=>{X.preventDefault();const we=X.clientX,Me=E.width;Xe(!0);const He=Yt=>{const nn=Yt.clientX-we;Q7(Me+nn)},Ke=()=>{Xe(!1),document.removeEventListener("pointermove",He),document.removeEventListener("pointerup",Ke),document.removeEventListener("pointercancel",Ke)};document.addEventListener("pointermove",He),document.addEventListener("pointerup",Ke),document.addEventListener("pointercancel",Ke)},[E.width]),Ge=()=>{Ao(!R)},Q=()=>{tt(null),Pt(null),ke(!0)},ve=()=>{ke(!1),J()},Be=X=>{ke(!1),te(X)},zt=X=>{X.defaultPrevented||(X.preventDefault(),Pt(null),tt({anchor:{x:X.clientX,y:X.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Et=g.useCallback(()=>{const X=at?.returnFocus??null;Pt(null),X?.focus()},[at]);gt.current=at?.returnFocus??null,Lz({open:at!==null,menuSelector:at?.kind==="theater"?'.side-bar-theater-menu[role="menu"]':'.group-context-menu-card[role="menu"]',returnFocusRef:gt,requestedAction:at?.kind==="chip"?at.requestedAction:void 0,onEscape:Et});const pn=(X,we)=>{we!==t&&Y(we),Pt(null),tt({anchor:{x:X.right+8,y:X.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Cn=(X,we)=>{X.stopPropagation(),pn(X.currentTarget.getBoundingClientRect(),we)};g.useEffect(()=>{_e&&(C7(),R&&Ao(!1),Q())},[_e]),g.useEffect(()=>{const X=Ne;if(X===null)return;if(R){Ao(!1);return}if(!e.some(Ke=>Ke.id===X)){s2();return}const we=()=>{s2();const Yt=Array.from(I.current?.querySelectorAll("[data-theater-id]")??[]).find(nn=>nn.dataset.theaterId===X)?.querySelector(".side-bar-theater-launch-btn");Yt&&pn(Yt.getBoundingClientRect(),X)};if(I.current!==null&&Math.abs(I.current.getBoundingClientRect().width-L)<=1){we();return}const He=window.setTimeout(we,220);return()=>window.clearTimeout(He)},[Ne,R]);const En=X=>{d2(X,!ht.includes(X))};return c.jsxs("aside",{className:`operations-side-bar ${R?"is-closed":"is-expanded"}`,ref:I,"data-sidebar-state":R?"closed":"expanded","data-resizing":De?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${L}px`},inert:R,onContextMenu:zt,children:[!R&&m?c.jsx("p",{className:"side-bar-theater-error",children:m}):null,c.jsxs("ol",{className:"operations-side-bar-chips",ref:D,"aria-label":N("sidebar.list.aria"),children:[e.map((X,we)=>{const Me=X.id===t,He=n.filter(yt=>yt.theaterId===X.id),Ke=!q&&Kz(He,nt),Yt=at?.kind==="theater"&&at.theaterId===X.id,nn=ht.includes(X.id),xn=pe?.kind==="theater"&&pe.sourceTheaterId===X.id&&pe.dragging,Xt=xn&&pe?.kind==="theater"?pe.currentY-pe.startY:0,ni=pe?.kind==="theater"&&pe.dragging&&pe.sourceTheaterId!==X.id&&pe.dropIndex===we,As=pe?.kind==="theater"&&pe.dragging&&pe.sourceTheaterId!==X.id&&we===e.length-1&&pe.dropIndex===e.length;if(!Me){const yt=dM(X.id),on=Yz({theaterId:X.id,operations:n,operationOrder:yt.operationOrder,minimizedSet:new Set(yt.minimized),activeOperationId:null,operationNotifications:l,operationStatus:nt,catalog:d,renderKindIcon:y});return c.jsx(Xz,{theater:X,entries:nn?[]:on,groups:i.filter(ii=>ii.theaterId===X.id),collapsedGroups:new Set(yt.collapsedGroups),operationAccent:yt.operationAccent,collapsed:nn,statusAxis:q,statusActionsOpen:Yt,showStatusLiveTick:Ke,statusLandingIds:se,dragging:xn,dropBefore:ni,dropAfter:As,dragOffsetY:Xt,onSelectTheater:Y,onFocus:x,onToggleCollapsed:En,onToggleStatusAxis:hm,onOpenActions:(ii,lr)=>{tt(null),Pt({kind:"theater",theaterId:X.id,anchor:ii,returnFocus:lr})},onOpenLaunch:Cn,onContextMenu:(ii,lr)=>{tt(null),Pt({kind:"theater",theaterId:X.id,anchor:ii,returnFocus:lr})},onPointerDragStart:On},X.id)}return c.jsxs("li",{className:["side-bar-theater-section side-bar-theater-section--active",ni?"side-bar-theater-section--drop-before":"",As?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":X.id,children:[c.jsx(IN,{theater:X,active:!0,collapsed:nn,statusAxis:q,statusActionsOpen:Yt,showStatusLiveTick:Ke,dragging:xn,dropTarget:ni,dragOffsetY:Xt,onSelectTheater:Y,onToggleCollapsed:En,onToggleStatusAxis:hm,onOpenActions:(yt,on)=>{tt(null),Pt({kind:"theater",theaterId:X.id,anchor:yt,returnFocus:on})},onOpenLaunch:Cn,onContextMenu:(yt,on)=>{tt(null),Pt({kind:"theater",theaterId:X.id,anchor:yt,returnFocus:on})},onPointerDragStart:On}),nn?null:c.jsx("ol",{className:"side-bar-theater-groups","aria-label":N("sidebar.theater.operationsAria",{theater:X.label}),children:q?We.map(yt=>c.jsx(NN,{theaterId:X.id,section:yt,unseenCount:yt.entries.filter(on=>he(on.operation.id)).length,children:yt.entries.map(on=>{const ii=Ee.get(on.operation.id)??0,lr=O.operationAccent[on.operation.id]??Yd(on.operation),mn=lr?os(lr):null,zr=on.operation.groupId?Ve.get(on.operation.groupId)??null:null;return c.jsx(mm,{entry:on,index:ii,isCloseArmed:G===on.operation.id,accentValue:mn,groupMark:zr,statusAxis:!0,idleUnseen:he(on.operation.id),statusLanded:se.has(on.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,onArmClose:Fn,onDisarmClose:xt,onClose:w,onMinimize:S,onFocus:x,onKeyboardMove:Kt,onPointerDragStart:an,onOpenAccent:(cr,Ts,Zn,ri)=>{Pt({kind:"chip",operationId:cr,anchor:Ts,returnFocus:Zn,requestedAction:ri})},onRename:C},on.operation.id)})},yt.status)):Te.map(yt=>{const on=yt.groupId!==null&&re.has(yt.groupId),ii=yt.group?os(yt.group.color):null,lr=ii?{"--grp-color":ii}:void 0,mn=yt.groupId?ct.indexOf(yt.groupId):-1,zr=pe?.kind==="group"&&pe.sourceGroupId===yt.groupId&&pe.dragging,cr=pe?.kind==="group"&&pe.dragging&&yt.groupId!==null&&pe.sourceGroupId!==yt.groupId&&pe.dropIndex===mn,Ts=pe?.kind==="group"&&pe.dragging&&yt.groupId!==null&&pe.sourceGroupId!==yt.groupId&&mn===ct.length-1&&pe.dropIndex===ct.length,Zn=[yt.groupId?"side-bar-group-section":"side-bar-ungrouped-section",cr?"side-bar-group-section--drop-before":"",Ts?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return c.jsxs("li",{"data-drop-zone-group-id":yt.groupId??"__ungrouped__",className:Zn,style:lr,children:[yt.group?c.jsx(RN,{group:yt.group,count:yt.entries.length,collapsed:on,dragging:zr,dragOffsetY:zr?pe.currentY-pe.startY:0,dropTarget:cr,onToggle:Ab,onContextMenu:(ri,Rs)=>Pt({kind:"group",groupId:ri,anchor:Rs}),onPointerDragStart:$t}):Rt&&yt.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":N("sidebar.ungrouped.aria"),children:c.jsx("span",{children:N("sidebar.ungrouped.label")})}):null,on?null:c.jsx("ol",{className:["side-bar-group-chips",pe?.kind==="chip"&&pe.dragging&&pe.dropGroupId===yt.groupId&&pe.dropGroupId!==pe.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":yt.groupId??"__ungrouped__","aria-label":yt.group?yt.group.name:N("sidebar.ungrouped.label"),children:yt.entries.map(ri=>{const Rs=ge.indexOf(ri),ut=yt.entries.indexOf(ri),Uo=O.operationAccent[ri.operation.id]??Yd(ri.operation),Hn=Uo?os(Uo):null;return c.jsx(mm,{entry:ri,index:Rs,isCloseArmed:G===ri.operation.id,accentValue:Hn,idleUnseen:he(ri.operation.id),dragging:pe?.kind==="chip"&&pe.sourceId===ri.operation.id&&pe.dragging,dragOffsetY:pe?.kind==="chip"&&pe.sourceId===ri.operation.id&&pe.dragging?pe.currentY-pe.startY:0,dropTarget:pe?.kind==="chip"&&pe.dragging===!0&&pe.dropGroupId===yt.groupId&&pe.dropGroupId===pe.sourceGroupId&&pe.dropIndex===ut&&pe.sourceId!==ri.operation.id,onArmClose:Fn,onDisarmClose:xt,onClose:w,onMinimize:S,onFocus:x,onKeyboardMove:Kt,onPointerDragStart:an,onOpenAccent:(rn,Ms,fs,Wo)=>{Pt({kind:"chip",operationId:rn,anchor:Ms,returnFocus:fs,requestedAction:Wo})},onRename:C},ri.operation.id)})})]},yt.groupId??"__ungrouped__")})})]},X.id)}),c.jsx("li",{children:c.jsxs("button",{type:"button",className:"side-bar-ghost-theater-row",onClick:Q,disabled:p,children:[c.jsx("span",{className:"side-bar-ghost-theater-anchor","aria-hidden":"true",children:c.jsx(IS,{})}),c.jsx("span",{className:"side-bar-ghost-theater-label",children:N("sidebar.theater.newTheater")})]})})]}),c.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:Si,onDoubleClick:Ge,"aria-hidden":"true"}),Ut?ea.createPortal(c.jsx(bN,{anchor:Ut.anchor,viewportBounds:Ut.viewportBounds,placement:"cursor",catalog:d,canLaunch:f,renderKindIcon:y,onLaunchKind:(X,we)=>{tt(null),_(X,we)},onClose:()=>tt(null)},`${Ut.anchor.x}:${Ut.anchor.y}`),document.body):null,at?.kind==="chip"&&Xn?c.jsx(w2,{kind:"chip",operation:Xn,groups:i.filter(X=>X.theaterId===Xn.theaterId),accentKey:O.operationAccent[Xn.id]??Yd(Xn),anchor:at.anchor,actions:{onSetAccent:X=>k(Xn.id,X),onSetGroupId:X=>B(Xn.id,X),onCreateGroup:X=>H(Xn.theaterId,X,Xn.id)},onClose:Et}):at?.kind==="group"&&pi?c.jsx(w2,{kind:"group-header",group:pi,anchor:at.anchor,actions:{onSetColor:X=>T(pi.id,X),onRename:X=>$(pi.id,X),onUngroupAll:()=>V(pi.id)},onClose:Et}):at?.kind==="theater"&&fn?c.jsx(Zz,{theater:fn,groupCount:i.filter(X=>X.theaterId===fn.id).length,anchor:at.anchor,onCreateGroup:X=>{H(fn.id,X),Et()},onForgetTheater:()=>{P(fn.id),Et()},onClose:Et}):null,c.jsx(SN,{open:cn,onCancel:ve,onConfirm:Be}),R?null:c.jsx(tz,{})]})}function LN(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 ON(e,t,n=xr("en")){const i=Bo();return Wz(n).map(({status:s,label:o})=>({status:s,label:o,entries:e.filter(l=>OS(l.status??"idle",l.operation.id,i)===s).sort((l,d)=>{const f=t?.(l.operation.id),p=t?.(d.operation.id);return f===void 0&&p===void 0?0:f===void 0?1:p===void 0?-1:p-f})}))}function OS(e,t,n){return e==="idle"&&n.has(t)?"awaiting":e}function Kz(e,t){const n=Bo();return e.some(i=>OS(Li(i,t),i.id,n)==="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=os(i.color);return s?{name:i.name,color:s}:null}function Yz({theaterId:e,operations:t,operationOrder:n,minimizedSet:i,activeOperationId:s,operationNotifications:o,operationStatus:l,catalog:d,renderKindIcon:f}){return kS(t.filter(p=>p.theaterId===e),n).map(p=>{const m=MN(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:Li(p,l),icon:y}})}function IN({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:_,onOpenLaunch:w,onContextMenu:S,onPointerDragStart:x}){const k=Ze(),C=g.useRef(!1),B=["side-bar-theater-header",t?"is-active":"",l?"side-bar-theater-header--dragging":"",d?"side-bar-theater-header--drop-target":""].filter(Boolean).join(" "),H=l?{"--drag-dy":`${Math.round(f)}px`}:void 0,T=te=>{te.preventDefault(),S(te.currentTarget.getBoundingClientRect())},$=te=>{if(te.target===te.currentTarget){if(te.key==="ContextMenu"||te.shiftKey&&te.key==="F10"){te.preventDefault(),S(te.currentTarget.getBoundingClientRect(),te.currentTarget);return}te.key!=="Enter"&&te.key!==" "||(te.preventDefault(),V())}},j=te=>{te.target instanceof Element&&te.target.closest("button")||x(te,e.id)},M=()=>{l&&(C.current=!0)},V=()=>{if(!t){p(e.id);return}m(e.id)},Y=()=>{if(C.current){C.current=!1;return}V()};return c.jsxs("div",{role:"button",tabIndex:0,"aria-haspopup":"menu",className:B,style:H,onClick:Y,onKeyDown:$,onContextMenu:T,onPointerDown:j,onPointerUp:M,"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:[c.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:jS(e.label)}),c.jsx("span",{className:"side-bar-theater-name",children:e.label}),c.jsx(Qz,{collapsed:n}),c.jsxs("span",{className:"side-bar-theater-row-controls",role:"group","aria-label":k("sidebar.theater.controlsAria",{theater:e.label}),children:[c.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:te=>{te.stopPropagation(),y()},children:[c.jsx(eF,{}),o?c.jsx("span",{className:"side-bar-status-axis-live-tick","aria-hidden":"true"}):null]}),c.jsxs("span",{className:"side-bar-theater-split-control",role:"group","aria-label":k("sidebar.theater.operationControlsAria",{theater:e.label}),children:[c.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:te=>w(te,e.id),children:c.jsx(IS,{})}),c.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:te=>{te.stopPropagation(),_(te.currentTarget.getBoundingClientRect(),te.currentTarget)},children:c.jsx(tF,{})})]})]})]})}function Xz({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:_,dragOffsetY:w,onSelectTheater:S,onFocus:x,onToggleCollapsed:k,onToggleStatusAxis:C,onOpenActions:B,onOpenLaunch:H,onContextMenu:T,onPointerDragStart:$}){const j=Ze(),M=LN(t,n),V=ON(t,oN,j),Y=Bo(),te=M.some(J=>J.group!==null);return c.jsxs("li",{className:["side-bar-theater-section",y?"side-bar-theater-section--drop-before":"",_?"side-bar-theater-section--drop-after":""].filter(Boolean).join(" "),"data-theater-id":e.id,children:[c.jsx(IN,{theater:e,active:!1,collapsed:o,statusAxis:l,statusActionsOpen:d,showStatusLiveTick:f,dragging:m,dropTarget:y,dragOffsetY:w,onSelectTheater:S,onToggleCollapsed:k,onToggleStatusAxis:C,onOpenActions:B,onOpenLaunch:H,onContextMenu:T,onPointerDragStart:$}),!o&&(l?V.length:M.length)>0?c.jsx("ol",{className:"side-bar-theater-groups","aria-label":j("sidebar.theater.operationsAria",{theater:e.label}),children:l?V.map(J=>c.jsx(NN,{theaterId:e.id,section:J,unseenCount:J.entries.filter(P=>Y.has(P.operation.id)).length,children:J.entries.map((P,N)=>{const I=s[P.operation.id]??Yd(P.operation),D=I?os(I):null;return c.jsx(mm,{entry:P,index:N,isCloseArmed:!1,accentValue:D,groupMark:Vz(P,n),statusAxis:!0,idleUnseen:Y.has(P.operation.id),statusLanded:p.has(P.operation.id),reorderEnabled:!1,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},P.operation.id)})},J.status)):M.map(J=>{const P=J.groupId!==null&&i.has(J.groupId),N=J.group?os(J.group.color):null;return c.jsxs("li",{className:J.groupId?"side-bar-group-section":"side-bar-ungrouped-section",style:N?{"--grp-color":N}:void 0,children:[J.group?c.jsx(RN,{group:J.group,count:J.entries.length,collapsed:P,dragging:!1,dragOffsetY:0,dropTarget:!1,onToggle:I=>hP(e.id,I),onContextMenu:()=>{},onPointerDragStart:()=>{}}):te&&J.entries.length>0?c.jsx("div",{className:"side-bar-ungrouped-label","aria-label":j("sidebar.ungrouped.aria"),children:c.jsx("span",{children:j("sidebar.ungrouped.label")})}):null,P?null:c.jsx("ol",{className:"side-bar-group-chips","aria-label":J.group?J.group.name:j("sidebar.ungrouped.label"),children:J.entries.map((I,D)=>{const E=s[I.operation.id]??Yd(I.operation),L=E?os(E):null;return c.jsx(mm,{entry:I,index:D,isCloseArmed:!1,accentValue:L,idleUnseen:Y.has(I.operation.id),dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onMinimize:()=>{},onFocus:x,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},I.operation.id)})})]},J.groupId??"__ungrouped__")})}):null]})}function Zz({theater:e,groupCount:t,anchor:n,onCreateGroup:i,onForgetTheater:s,onClose:o}){const l=Ze(),[d,f]=g.useState(!1),[p,m]=g.useState(()=>l("sidebar.theater.defaultGroupName",{n:t+1})),y=g.useRef(!1),_=g.useRef(null),w=g.useRef(null),[S,x]=g.useState(n.bottom+6);g.useLayoutEffect(()=>{const C=w.current?.getBoundingClientRect().height??0,B=window.innerHeight-C-8;x(Math.max(8,Math.min(n.bottom+6,B)))},[n,d]),g.useEffect(()=>{d&&_.current?.select()},[d]),g.useEffect(()=>{const C=B=>{B.key==="Escape"&&(B.preventDefault(),o())};return window.addEventListener("keydown",C),window.addEventListener("resize",o),window.addEventListener("scroll",o,!0),()=>{window.removeEventListener("keydown",C),window.removeEventListener("resize",o),window.removeEventListener("scroll",o,!0)}},[o]);const k=()=>{const C=p.trim();C&&i(C)};return ea.createPortal(c.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:o,children:c.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:C=>C.stopPropagation(),children:[d?c.jsx("input",{ref:_,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:p,onChange:C=>m(C.target.value),onCompositionStart:()=>{y.current=!0},onCompositionEnd:()=>{y.current=!1},onKeyDown:C=>{C.key==="Enter"&&!y.current&&(C.preventDefault(),k()),C.key==="Escape"&&(C.preventDefault(),f(!1))},onBlur:()=>f(!1),"aria-label":l("sidebar.theater.newGroupNameAria"),placeholder:l("sidebar.theater.groupNamePlaceholder")}):c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>f(!0),children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(IS,{})}),c.jsx("span",{className:"theater-menu-label",children:l("sidebar.theater.newGroup")})]}),c.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),c.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:s,children:[c.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:c.jsx(iF,{})}),c.jsx("span",{className:"theater-menu-label",children:l("sidebar.theater.forget")})]})]})}),document.body)}function Jz(e,t){if(!t)return;const n=t.getBoundingClientRect();e<n.top+C2?t.scrollTop-=E2:e>n.bottom-C2&&(t.scrollTop+=E2)}function Qz({collapsed:e}){return c.jsx("svg",{className:`side-bar-theater-chevron${e?" is-collapsed":""}`,viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function eF(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"4",cy:"4",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 4h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("circle",{cx:"4",cy:"8",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 8h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),c.jsx("circle",{cx:"4",cy:"12",r:"1.5",fill:"currentColor"}),c.jsx("path",{d:"M8 12h5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function tF(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"3.2",cy:"8",r:"1.35",fill:"currentColor"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.35",fill:"currentColor"}),c.jsx("circle",{cx:"12.8",cy:"8",r:"1.35",fill:"currentColor"})]})}function IS(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function jS(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(i=>nF(i)):jN(e).filter(i=>/[\p{L}\p{N}]/u.test(i))).slice(0,2).join("").toUpperCase()||"--"}function nF(e){return jN(e).slice(0,1)}function jN(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function iF(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function rF({theaters:e,operations:t,activeTheaterId:n,addingTheater:i,onSelectTheater:s,onAddTheater:o,style:l,containerRef:d}){const f=Ze(),p=[e.map(m=>{const y=t.filter(_=>_.theaterId===m.id).length;return{key:m.id,role:"menuitemradio",label:m.label,checked:m.id===n,mark:jS(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 c.jsx(DN,{menuLabel:f("chrome.commandBand.switchTheater"),sections:p,style:l,containerRef:d})}function sF({operations:e,activeOperationId:t,theaterLabel:n,onSelectOperation:i,onRenameOperation:s,onNewOperation:o,style:l,containerRef:d}){const f=Ze(),p=[e.map(m=>({key:m.id,role:"menuitemradio",label:m.title,checked:m.id===t,meta:oF(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 c.jsx(DN,{menuLabel:f("chrome.commandBand.switchOperation"),sections:p,emptyNote:e.length===0?f("chrome.commandBand.noOperationsInTheater"):null,style:l,containerRef:d})}function DN({menuLabel:e,sections:t,emptyNote:n,style:i,containerRef:s}){const o=()=>Array.from(s.current?.querySelectorAll(".command-band-menu-item:not(:disabled)")??[]);g.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(_=>_===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 c.jsxs("div",{ref:s,className:"command-band-menu",role:"menu","aria-label":e,style:i,onKeyDown:l,children:[n?c.jsx("p",{className:"command-band-menu-empty",children:n}):null,d.map((f,p)=>c.jsxs(g.Fragment,{children:[p>0||n?c.jsx("div",{className:"command-band-menu-divider","aria-hidden":"true"}):null,f.map(m=>c.jsxs("button",{type:"button",role:m.role,"aria-checked":m.role==="menuitemradio"?m.checked===!0:void 0,className:`command-band-menu-item${m.checked?" is-active":""}${m.action?" command-band-menu-action":""}`,disabled:m.disabled,onClick:m.onSelect,children:[c.jsx("span",{className:"command-band-menu-check","aria-hidden":"true",children:m.checked?c.jsx(aF,{}):null}),m.mark!==void 0?c.jsx("span",{className:"command-band-theater-mark","aria-hidden":"true",children:m.mark}):null,c.jsx("span",{className:"command-band-menu-label",children:m.label}),m.meta?c.jsx("span",{className:"command-band-menu-meta",children:m.meta}):null]},m.key))]},f[0]?.key??p))]})}function qv(){return c.jsx("span",{className:"command-band-trigger-caret","aria-hidden":"true",children:c.jsx("svg",{viewBox:"0 0 10 10",children:c.jsx("path",{d:"M2 3.5 5 6.5 8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})}function aF(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function oF(e){const t=e.payload.cliLabel;if(typeof t=="string")return t;const n=e.payload.cliId;return typeof n=="string"?n:null}const gm="fleet-console.rail.activePanelId",BN="fleet-console.rail.chromeExpanded",PN="fleet-console.rail.panelBehavior",$N="fleet-console.rail.overlayAlpha",lF="fleet-console.repository.source",Vb=new Set;let bi={activeRailPanelId:_F(),railChromeExpanded:bF(),panelExtraWidth:0,panelBehavior:wF(),overlayAlpha:SF()};function Ah(e){return Vb.add(e),()=>{Vb.delete(e)}}function Th(){return bi}function cF(e){bi.activeRailPanelId!==e&&(Dl({...bi,activeRailPanelId:e,panelExtraWidth:0}),BS(e))}function uF(e){const t=bi.activeRailPanelId===e?null:e;Dl({...bi,activeRailPanelId:t,panelExtraWidth:0}),BS(t)}function A2(e){cF(e)}function dF(){bi.activeRailPanelId!==null&&(Dl({...bi,activeRailPanelId:null,panelExtraWidth:0}),BS(null))}function Yb(e){bi.railChromeExpanded!==e&&(Dl({...bi,railChromeExpanded:e}),xF(e))}function DS(){Yb(!bi.railChromeExpanded)}function hF(e){bi.panelBehavior!==e&&(Dl({...bi,panelBehavior:e}),kF(e))}function fF(){hF(bi.panelBehavior==="push"?"overlay":"push")}function pF(e){bi.overlayAlpha!==e&&(Dl({...bi,overlayAlpha:e}),CF(e))}function mF(e,t){if(e!==bi.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!==bi.panelExtraWidth&&Dl({...bi,panelExtraWidth:s})}function zN(){return g.useSyncExternalStore(Ah,Th).activeRailPanelId}function FN(){return g.useSyncExternalStore(Ah,Th).railChromeExpanded}function gF(){return g.useSyncExternalStore(Ah,Th).panelExtraWidth}function yF(){return g.useSyncExternalStore(Ah,Th).panelBehavior}function vF(){return g.useSyncExternalStore(Ah,Th).overlayAlpha}function _F(){try{const e=localStorage.getItem(gm);if(e==="diff"||e==="history"){try{localStorage.setItem(gm,"repository"),e==="history"&&localStorage.setItem(lF,"history")}catch{}return"repository"}return e}catch{return null}}function bF(){try{return localStorage.getItem(BN)!=="0"}catch{return!0}}function wF(){try{const e=localStorage.getItem(PN);return e==="overlay"||e==="push"?e:"push"}catch{return"push"}}function SF(){try{const e=localStorage.getItem($N);return e==="90"||e==="75"||e==="60"?Number(e):100}catch{return 100}}function BS(e){try{e===null?localStorage.removeItem(gm):localStorage.setItem(gm,e)}catch{}}function xF(e){try{localStorage.setItem(BN,e?"1":"0")}catch{}}function kF(e){try{localStorage.setItem(PN,e)}catch{}}function CF(e){try{localStorage.setItem($N,String(e))}catch{}}function Dl(e){bi=e;for(const t of Vb)t()}const T2={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 EF(e){return e?{...T2,...e}:T2}function HN(e){const{sizeRange:t}=e,n=EF(e.labels),[i,s]=g.useState(""),[o,l]=g.useState(e.size),d=g.useRef(Promise.resolve()),f=g.useId(),p=g.useMemo(()=>AF(e,n),[e,n]),m=g.useMemo(()=>TF(p,i),[p,i]),y=g.useMemo(()=>m.map((M,V)=>({row:M,index:V})),[m]),[_,w]=g.useState(()=>RF(p,e.selected)),S=p.find(M=>ym(M.selection,e.selected))??null,x=y[Math.min(_,Math.max(0,y.length-1))]?.row??null,k=`${f}-built-ins`,C=`${f}-installed`;g.useEffect(()=>{l(e.size)},[e.size]),g.useEffect(()=>{_>=y.length&&w(Math.max(0,y.length-1))},[_,y.length]);const B=g.useCallback(M=>{const V=M2(M,t);l(V),d.current=d.current.catch(()=>{}).then(()=>e.onSizeCommit(V))},[e.onSizeCommit,t]),H=g.useCallback(M=>{m.length&&w(V=>(V+M+m.length)%m.length)},[m.length]),T=g.useCallback(()=>{x&&!x.unavailable&&e.onSelectionChange(x.selection)},[x,e]),$=g.useCallback((M,V)=>{w(M),e.onSelectionChange(V)},[e]),j=M=>{M.key==="ArrowDown"?(M.preventDefault(),H(1)):M.key==="ArrowUp"?(M.preventDefault(),H(-1)):M.key==="Home"?(M.preventDefault(),w(0)):M.key==="End"?(M.preventDefault(),w(Math.max(0,m.length-1))):(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),T())};return c.jsx("section",{className:"fc-font-browser","aria-label":n.browserAria,"data-disabled":e.disabled?"true":void 0,children:c.jsxs("div",{className:"fc-font-browser__panes",children:[c.jsxs("div",{className:"fc-font-browser__chooser",children:[c.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${f}-search`,children:n.searchLabel}),c.jsx("input",{id:`${f}-search`,className:"fc-font-browser__search",type:"search",value:i,disabled:e.disabled,placeholder:n.searchPlaceholder,onChange:M=>{s(M.currentTarget.value),w(0)}}),e.loading?c.jsx("p",{className:"fc-font-browser__state",role:"status",children:n.loading}):null,e.error?c.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,c.jsxs("div",{id:f,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":n.choicesAria,"aria-activedescendant":x?UN(f,_):void 0,"aria-busy":e.loading||void 0,onKeyDown:j,children:[c.jsx(R2,{groupId:k,label:n.builtInGroup,unavailableLabel:n.unavailable,rows:y.filter(({row:M})=>M.source==="builtin"),activeRow:x,selected:e.selected,listboxId:f,disabled:e.disabled,onSelect:$}),c.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),c.jsx(R2,{groupId:C,label:n.installedGroup,unavailableLabel:n.unavailable,rows:y.filter(({row:M})=>M.source==="system"),activeRow:x,selected:e.selected,listboxId:f,disabled:e.disabled,onSelect:$}),!e.loading&&!y.length?c.jsx("p",{className:"fc-font-browser__state",children:n.noMatch}):null]})]}),c.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[c.jsxs("div",{className:"fc-font-browser__preview-head",children:[c.jsx("span",{className:"fc-font-browser__preview-label",children:n.preview}),c.jsx("span",{className:`fc-font-browser__availability${S?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:S?.unavailable?n.unavailable:n.available})]}),c.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:S?.previewFamily??e.fallbackStack,fontSize:`${o}px`},children:e.previewText}),c.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":n.fontSizeAria,children:[c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o<=t.min,onClick:()=>B(o-t.step),"aria-label":n.decreaseSizeAria,children:"−"}),c.jsxs("output",{className:"fc-font-browser__size-value","aria-label":n.sizeValueAria,children:[o,"px"]}),c.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o>=t.max,onClick:()=>B(o+t.step),"aria-label":n.increaseSizeAria,children:"+"})]}),c.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:M=>l(M2(Number(M.currentTarget.value),t)),onPointerUp:M=>B(Number(M.currentTarget.value)),onKeyUp:M=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(M.key)&&B(Number(M.currentTarget.value))}})]})]})})}function R2({groupId:e,label:t,unavailableLabel:n,rows:i,activeRow:s,selected:o,listboxId:l,disabled:d,onSelect:f}){return c.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[c.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),i.map(({row:p,index:m})=>c.jsxs("button",{id:UN(l,m),type:"button",className:`fc-font-browser__row${ym(p.selection,s?.selection??null)?" is-active":""}${p.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":ym(p.selection,o),disabled:d||p.unavailable,onClick:()=>f(m,p.selection),children:[c.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:p.previewFamily},children:p.label}),p.description?c.jsx("span",{className:"fc-font-browser__row-meta",children:p.description}):null,p.unavailable?c.jsx("span",{className:"fc-font-browser__row-status",children:n}):null]},p.id))]})}function AF(e,t){const n=new Set,i=e.builtIns.flatMap(l=>{const d=[l.id,l.label,...l.aliases??[]].map(Xd);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-${Xd(l.family)}`,label:l.family,family:l.family,previewFamily:sm(l.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:l.family},description:l.monospace?t.monospace:t.systemFont,unavailable:!z8(l.family)})),o=e.selected.source==="system"?e.selected.familyName:null;return o!==null&&!s.some(l=>l.family===o)&&s.unshift({id:`system-${Xd(o)}`,label:e.selectedSystemFont??o,family:o,previewFamily:sm(o,e.fallbackStack),source:"system",selection:{source:"system",familyName:o},description:t.savedSystemFont,unavailable:!0}),[...i,...s]}function TF(e,t){const n=Xd(t);return n?e.filter(i=>Xd(`${i.label} ${i.description??""}`).includes(n)):e}function Xd(e){return e.trim().toLocaleLowerCase()}function UN(e,t){return`${e}-option-${t}`}function RF(e,t){const n=e.findIndex(i=>ym(i.selection,t));return n>=0?n:0}function ym(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function M2(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 MF="/api/v1/settings/fonts/system";class ml extends Error{status;constructor(t,n=null){super(t),this.name="SystemFontsFetchError",this.status=n}}function NF(e){if(!qN(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new ml("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(LF)}}async function WN(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new ml("System font fetching is unavailable in this environment.");let n;try{n=await t(MF,{method:"GET",signal:e.signal})}catch(s){throw s instanceof DOMException&&s.name==="AbortError"?s:new ml("System fonts could not be loaded.")}if(!n.ok)throw new ml("System fonts could not be loaded.",n.status);let i;try{i=await n.json()}catch{throw new ml("System font response is not valid JSON.",n.status)}return NF(i)}function LF(e){if(!qN(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new ml("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function OF(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qN(e,t){return OF(e)&&Object.keys(e).length===t.length&&t.every(n=>Object.hasOwn(e,n))}const N2=250,IF=5e3,L2=1,jF=1013,DF=4e3,BF=4001;function PF(e){const t=new AbortController,n=new TextEncoder;let i=N2,s=null,o=null,l=null,d=!1;const f=()=>{o?.dispose(),o=null},p=(_,w)=>{l={cols:_,rows:w},s?.readyState===L2&&s.send(JSON.stringify({type:"resize",cols:_,rows:w}))},m=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:_}=await zF(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await y($F(_,e.location,e.wsPath),e),i=N2}catch(_){if(t.signal.aborted)return;e.onStatus?.("connecting",_ instanceof Error?_.message:String(_))}await HF(i,t.signal),i=Math.min(i*2,IF)}},y=async(_,w)=>{await new Promise((S,x)=>{const k=(w.webSocketFactory??FF)(_);s=k,k.binaryType="arraybuffer",k.onopen=()=>{w.onStatus?.("live"),f(),o=w.terminal.onData(C=>{k.readyState===L2&&k.send(n.encode(C))}),l&&p(l.cols,l.rows)},k.onmessage=C=>{C.data instanceof ArrayBuffer&&w.terminal.write(new Uint8Array(C.data))},k.onerror=()=>{x(new Error("Terminal WebSocket error"))},k.onclose=C=>{f(),s===k&&(s=null);const B=C?.code;B===DF?(t.abort(),w.onStatus?.("closed","terminal_replaced")):B===BF?(t.abort(),w.onStatus?.("closed","terminal_closed"),w.onExit?.()):B===jF&&(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 $F(e,t=window.location,n){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${n}?ticket=${encodeURIComponent(e)}`}async function zF(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 FF(e){return new WebSocket(e)}async function HF(e,t){await new Promise(n=>{const i=()=>{clearTimeout(s),t.removeEventListener("abort",i),n()},s=setTimeout(i,e);t.addEventListener("abort",i)})}var UF=2,WF=1,qF=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(UF,Math.floor(m/e.css.cell.width)),rows:Math.max(WF,Math.floor(p/e.css.cell.height))}}};var Gv=[[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]],GF=[[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]],gi;function KF(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 VF=class{constructor(){if(this.version="6",!gi){gi=new Uint8Array(65536),gi.fill(1),gi[0]=0,gi.fill(0,1,32),gi.fill(0,127,160),gi.fill(2,4352,4448),gi[9001]=2,gi[9002]=2,gi.fill(2,11904,42192),gi[12351]=1,gi.fill(2,44032,55204),gi.fill(2,63744,64256),gi.fill(2,65040,65050),gi.fill(2,65072,65136),gi.fill(2,65280,65377),gi.fill(2,65504,65511);for(let t=0;t<Gv.length;++t)gi.fill(0,Gv[t][0],Gv[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?gi[t]:KF(t,GF)?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=_m.extractWidth(n);o===0?s=!1:o>i&&(i=o)}return _m.createPropertyValue(0,i,s)}},YF=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?O2.isErrorNoTelemetry(t)?new O2(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)}},XF=new YF;function Kv(e){ZF(e)||XF.onUnexpectedError(e)}var Xb="Canceled";function ZF(e){return e instanceof JF?!0:e instanceof Error&&e.name===Xb&&e.message===Xb}var JF=class extends Error{constructor(){super(Xb),this.name=this.message}},O2=class Zb extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Zb)return t;let n=new Zb;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function QF(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var e9;(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})(e9||={});var GN;(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 j=0;for(let M of T)if($(M,j++))return!0;return!1}e.some=m;function y(T,$){for(let j of T)if($(j))return j}e.find=y;function*_(T,$){for(let j of T)$(j)&&(yield j)}e.filter=_;function*w(T,$){let j=0;for(let M of T)yield $(M,j++)}e.map=w;function*S(T,$){let j=0;for(let M of T)yield*$(M,j++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,j){let M=j;for(let V of T)M=$(M,V);return M}e.reduce=k;function*C(T,$,j=T.length){for($<0&&($+=T.length),j<0?j+=T.length:j>T.length&&(j=T.length);$<j;$++)yield T[$]}e.slice=C;function B(T,$=Number.POSITIVE_INFINITY){let j=[];if($===0)return[j,T];let M=T[Symbol.iterator]();for(let V=0;V<$;V++){let Y=M.next();if(Y.done)return[j,e.empty()];j.push(Y.value)}return[j,{[Symbol.iterator](){return M}}]}e.consume=B;async function H(T){let $=[];for await(let j of T)$.push(j);return Promise.resolve($)}e.asyncToArray=H})(GN||={});function KN(e){if(GN.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 t9(...e){return VN(()=>KN(e))}function VN(e){return{dispose:QF(()=>{e()})}}var YN=class XN{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{KN(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?XN.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)}};YN.DISABLE_DISPOSED_WARNING=!1;var PS=YN,vm=class{constructor(){this._store=new PS,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)}};vm.None=Object.freeze({dispose(){}});var n9=globalThis.performance&&typeof globalThis.performance.now=="function",i9=class ZN{static create(t){return new ZN(t)}constructor(t){this._now=n9&&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}},r9;(e=>{e.None=()=>vm.None;function t(P,N){return y(P,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(P){return(N,I=null,D)=>{let E=!1,L;return L=P(R=>{if(!E)return L?L.dispose():E=!0,N.call(I,R)},null,D),E&&L.dispose(),L}}e.once=n;function i(P,N,I){return p((D,E=null,L)=>P(R=>D.call(E,N(R)),null,L),I)}e.map=i;function s(P,N,I){return p((D,E=null,L)=>P(R=>{N(R),D.call(E,R)},null,L),I)}e.forEach=s;function o(P,N,I){return p((D,E=null,L)=>P(R=>N(R)&&D.call(E,R),null,L),I)}e.filter=o;function l(P){return P}e.signal=l;function d(...P){return(N,I=null,D)=>{let E=t9(...P.map(L=>L(R=>N.call(I,R))));return m(E,D)}}e.any=d;function f(P,N,I,D){let E=I;return i(P,L=>(E=N(E,L),E),D)}e.reduce=f;function p(P,N){let I,D={onWillAddFirstListener(){I=P(E.fire,E)},onDidRemoveLastListener(){I?.dispose()}},E=new vo(D);return N?.add(E),E.event}function m(P,N){return N instanceof Array?N.push(P):N&&N.add(P),P}function y(P,N,I=100,D=!1,E=!1,L,R){let q,U,O,W=0,K,z={leakWarningThreshold:L,onWillAddFirstListener(){q=P(Z=>{W++,U=N(U,Z),D&&!O&&(G.fire(U),U=void 0),K=()=>{let se=U;U=void 0,O=void 0,(!D||W>1)&&G.fire(se),W=0},typeof I=="number"?(clearTimeout(O),O=setTimeout(K,I)):O===void 0&&(O=0,queueMicrotask(K))})},onWillRemoveListener(){E&&W>0&&K?.()},onDidRemoveLastListener(){K=void 0,q.dispose()}},G=new vo(z);return R?.add(G),G.event}e.debounce=y;function _(P,N=0,I){return e.debounce(P,(D,E)=>D?(D.push(E),D):[E],N,void 0,!0,void 0,I)}e.accumulate=_;function w(P,N=(D,E)=>D===E,I){let D=!0,E;return o(P,L=>{let R=D||!N(L,E);return D=!1,E=L,R},I)}e.latch=w;function S(P,N,I){return[e.filter(P,N,I),e.filter(P,D=>!N(D),I)]}e.split=S;function x(P,N=!1,I=[],D){let E=I.slice(),L=P(U=>{E?E.push(U):q.fire(U)});D&&D.add(L);let R=()=>{E?.forEach(U=>q.fire(U)),E=null},q=new vo({onWillAddFirstListener(){L||(L=P(U=>q.fire(U)),D&&D.add(L))},onDidAddFirstListener(){E&&(N?setTimeout(R):R())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return D&&D.add(q),q.event}e.buffer=x;function k(P,N){return(I,D,E)=>{let L=N(new B);return P(function(R){let q=L.evaluate(R);q!==C&&I.call(D,q)},void 0,E)}}e.chain=k;let C=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(I=>(N(I),I)),this}filter(N){return this.steps.push(I=>N(I)?I:C),this}reduce(N,I){let D=I;return this.steps.push(E=>(D=N(D,E),D)),this}latch(N=(I,D)=>I===D){let I=!0,D;return this.steps.push(E=>{let L=I||!N(E,D);return I=!1,D=E,L?E:C}),this}evaluate(N){for(let I of this.steps)if(N=I(N),N===C)break;return N}}function H(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.on(N,D),L=()=>P.removeListener(N,D),R=new vo({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromNodeEventEmitter=H;function T(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.addEventListener(N,D),L=()=>P.removeEventListener(N,D),R=new vo({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromDOMEventEmitter=T;function $(P){return new Promise(N=>n(P)(N))}e.toPromise=$;function j(P){let N=new vo;return P.then(I=>{N.fire(I)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=j;function M(P,N){return P(I=>N.fire(I))}e.forward=M;function V(P,N,I){return N(I),P(D=>N(D))}e.runAndSubscribe=V;class Y{constructor(N,I){this._observable=N,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new vo(D),I&&I.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,I){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(P,N){return new Y(P,N).emitter.event}e.fromObservable=te;function J(P){return(N,I,D)=>{let E=0,L=!1,R={beginUpdate(){E++},endUpdate(){E--,E===0&&(P.reportChanges(),L&&(L=!1,N.call(I)))},handlePossibleChange(){},handleChange(){L=!0}};P.addObserver(R),P.reportChanges();let q={dispose(){P.removeObserver(R)}};return D instanceof PS?D.add(q):Array.isArray(D)&&D.push(q),q}}e.fromObservableLight=J})(r9||={});var Jb=class Qb{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Qb._idPool++}`,Qb.all.add(this)}start(t){this._stopWatch=new i9,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}}};Jb.all=new Set,Jb._idPool=0;var s9=Jb,a9=-1,JN=class QN{constructor(t,n,i=(QN._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 c9(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}};JN._idPool=1;var o9=JN,l9=class eL{constructor(t){this.value=t}static create(){let t=new Error;return new eL(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},c9=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},u9=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},d9=0,Vv=class{constructor(t){this.value=t,this.id=d9++}},h9=2,f9,vo=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new o9(t?.onListenerError??Kv,this._options?.leakWarningThreshold??a9):void 0,this._perfMon=this._options?._profName?new s9(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 u9(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Kv)(p),vm.None}if(this._disposed)return vm.None;n&&(t=t.bind(n));let s=new Vv(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=l9.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Vv?(this._deliveryQueue??=new p9,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=VN(()=>{o?.(),this._removeListener(s)});return i instanceof PS?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*h9<=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||Kv;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 Vv)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}},p9=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}},_m=class Op{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new vo,this.onChange=this._onChange.event;let t=new VF;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=Op.extractWidth(d);Op.extractShouldJoin(d)&&(f-=Op.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Yv=[[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]],m9=[[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]],Xv=[[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]],g9=[[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]],wa;function I2(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 y9=class{constructor(){if(this.version="11",!wa){wa=new Uint8Array(65536),wa.fill(1),wa[0]=0,wa.fill(0,1,32),wa.fill(0,127,160);for(let t=0;t<Yv.length;++t)wa.fill(0,Yv[t][0],Yv[t][1]+1);for(let t=0;t<Xv.length;++t)wa.fill(2,Xv[t][0],Xv[t][1]+1)}}wcwidth(t){return t<32?0:t<127?1:t<65536?wa[t]:I2(t,m9)?0:I2(t,g9)?2:1}charProperties(t,n){let i=this.wcwidth(t),s=i===0&&n!==0;if(s){let o=_m.extractWidth(n);o===0?s=!1:o>i&&(i=o)}return _m.createPropertyValue(0,i,s)}},v9=class{activate(t){t.unicode.register(new y9)}dispose(){}};var _9=(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},b9=(e,t)=>(n,i)=>t(n,i,e),w9=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?j2.isErrorNoTelemetry(e)?new j2(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)}},S9=new w9;function Zv(e){x9(e)||S9.onUnexpectedError(e)}var ew="Canceled";function x9(e){return e instanceof k9?!0:e instanceof Error&&e.name===ew&&e.message===ew}var k9=class extends Error{constructor(){super(ew),this.name=this.message}},j2=class tw extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof tw)return t;let n=new tw;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},C9;(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})(C9||={});function E9(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var tL;(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 j=0;for(let M of T)if($(M,j++))return!0;return!1}e.some=m;function y(T,$){for(let j of T)if($(j))return j}e.find=y;function*_(T,$){for(let j of T)$(j)&&(yield j)}e.filter=_;function*w(T,$){let j=0;for(let M of T)yield $(M,j++)}e.map=w;function*S(T,$){let j=0;for(let M of T)yield*$(M,j++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,j){let M=j;for(let V of T)M=$(M,V);return M}e.reduce=k;function*C(T,$,j=T.length){for($<0&&($+=T.length),j<0?j+=T.length:j>T.length&&(j=T.length);$<j;$++)yield T[$]}e.slice=C;function B(T,$=Number.POSITIVE_INFINITY){let j=[];if($===0)return[j,T];let M=T[Symbol.iterator]();for(let V=0;V<$;V++){let Y=M.next();if(Y.done)return[j,e.empty()];j.push(Y.value)}return[j,{[Symbol.iterator](){return M}}]}e.consume=B;async function H(T){let $=[];for await(let j of T)$.push(j);return Promise.resolve($)}e.asyncToArray=H})(tL||={});function nL(e){if(tL.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 iL(...e){return Xi(()=>nL(e))}function Xi(e){return{dispose:E9(()=>{e()})}}var rL=class sL{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{nL(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?sL.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)}};rL.DISABLE_DISPOSED_WARNING=!1;var Fc=rL,ks=class{constructor(){this._store=new Fc,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)}};ks.None=Object.freeze({dispose(){}});var ud=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}},$S=typeof process<"u"&&"title"in process,fg=$S?"node":navigator.userAgent,A9=$S?"node":navigator.platform,T9=fg.includes("Firefox"),R9=fg.includes("Edge"),aL=/^((?!chrome|android).)*safari/i.test(fg);function M9(){if(!aL)return 0;let e=fg.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}A9.indexOf("Linux")>=0;var N9="",Ei=0,Ai=0,Ti=0,Kn=0,Qr={css:"#00000000",rgba:0},nr;(e=>{function t(s,o,l,d){return d!==void 0?`#${ll(s)}${ll(o)}${ll(l)}${ll(d)}`:`#${ll(s)}${ll(o)}${ll(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})(nr||={});var Dd;(e=>{function t(f,p){if(Kn=(p.rgba&255)/255,Kn===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,y=p.rgba>>16&255,_=p.rgba>>8&255,w=f.rgba>>24&255,S=f.rgba>>16&255,x=f.rgba>>8&255;Ei=w+Math.round((m-w)*Kn),Ai=S+Math.round((y-S)*Kn),Ti=x+Math.round((_-x)*Kn);let k=nr.toCss(Ei,Ai,Ti),C=nr.toRgba(Ei,Ai,Ti);return{css:k,rgba:C}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let y=kl.ensureContrastRatio(f.rgba,p.rgba,m);if(y)return nr.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=i;function s(f){let p=(f.rgba|255)>>>0;return[Ei,Ai,Ti]=kl.toChannels(p),{css:nr.toCss(Ei,Ai,Ti),rgba:p}}e.opaque=s;function o(f,p){return Kn=Math.round(p*255),[Ei,Ai,Ti]=kl.toChannels(f.rgba),{css:nr.toCss(Ei,Ai,Ti,Kn),rgba:nr.toRgba(Ei,Ai,Ti,Kn)}}e.opacity=o;function l(f,p){return Kn=f.rgba&255,o(f,Kn*p/255)}e.multiplyOpacity=l;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(Dd||={});var L9;(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 Ei=parseInt(s.slice(1,2).repeat(2),16),Ai=parseInt(s.slice(2,3).repeat(2),16),Ti=parseInt(s.slice(3,4).repeat(2),16),nr.toColor(Ei,Ai,Ti);case 5:return Ei=parseInt(s.slice(1,2).repeat(2),16),Ai=parseInt(s.slice(2,3).repeat(2),16),Ti=parseInt(s.slice(3,4).repeat(2),16),Kn=parseInt(s.slice(4,5).repeat(2),16),nr.toColor(Ei,Ai,Ti,Kn);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 Ei=parseInt(o[1]),Ai=parseInt(o[2]),Ti=parseInt(o[3]),Kn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),nr.toColor(Ei,Ai,Ti,Kn);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),[Ei,Ai,Ti,Kn]=t.getImageData(0,0,1,1).data,Kn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:nr.toRgba(Ei,Ai,Ti,Kn),css:s}}e.toColor=i})(L9||={});var Ji;(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})(Ji||={});var kl;(e=>{function t(l,d){if(Kn=(d&255)/255,Kn===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,y=l>>24&255,_=l>>16&255,w=l>>8&255;return Ei=y+Math.round((f-y)*Kn),Ai=_+Math.round((p-_)*Kn),Ti=w+Math.round((m-w)*Kn),nr.toRgba(Ei,Ai,Ti)}e.blend=t;function n(l,d,f){let p=Ji.relativeLuminance(l>>8),m=Ji.relativeLuminance(d>>8);if(Sa(p,m)<f){if(m<p){let w=i(l,d,f),S=Sa(p,Ji.relativeLuminance(w>>8));if(S<f){let x=s(l,d,f),k=Sa(p,Ji.relativeLuminance(x>>8));return S>k?w:x}return w}let y=s(l,d,f),_=Sa(p,Ji.relativeLuminance(y>>8));if(_<f){let w=i(l,d,f),S=Sa(p,Ji.relativeLuminance(w>>8));return _>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,_=d>>24&255,w=d>>16&255,S=d>>8&255,x=Sa(Ji.relativeLuminance2(_,w,S),Ji.relativeLuminance2(p,m,y));for(;x<f&&(_>0||w>0||S>0);)_-=Math.max(0,Math.ceil(_*.1)),w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),x=Sa(Ji.relativeLuminance2(_,w,S),Ji.relativeLuminance2(p,m,y));return(_<<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,_=d>>24&255,w=d>>16&255,S=d>>8&255,x=Sa(Ji.relativeLuminance2(_,w,S),Ji.relativeLuminance2(p,m,y));for(;x<f&&(_<255||w<255||S<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=Sa(Ji.relativeLuminance2(_,w,S),Ji.relativeLuminance2(p,m,y));return(_<<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})(kl||={});function ll(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Sa(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function ui(e){if(!e)throw new Error("value must not be falsy");return e}function zS(e){return 57508<=e&&e<=57558}function O9(e){return 57520<=e&&e<=57527}function I9(e){return 57344<=e&&e<=63743}function j9(e){return 9472<=e&&e<=9631}function D9(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 B9(e,t,n,i){return t===1&&n>Math.ceil(i*1.5)&&e!==void 0&&e>255&&!D9(e)&&!zS(e)&&!I9(e)}function oL(e){return zS(e)||j9(e)}function P9(){return{css:{canvas:Xf(),cell:Xf()},device:{canvas:Xf(),cell:Xf(),char:{width:0,height:0,left:0,top:0}}}}function Xf(){return{width:0,height:0}}function $9(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var zi=0,ki=0,js=!1,xa=!1,Zf=!1,gr,Jv=0,z9=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,ki=0,zi=0,xa=!1,js=!1,Zf=!1,gr=this._themeService.colors,Jv=0,e.getCode()!==0&&e.extended.underlineStyle===4){let s=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Jv=t*i%(Math.round(s)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,"bottom",s=>{s.backgroundColorRGB&&(ki=s.backgroundColorRGB.rgba>>8&16777215,xa=!0),s.foregroundColorRGB&&(zi=s.foregroundColorRGB.rgba>>8&16777215,js=!0)}),Zf=this._selectionRenderModel.isCellSelected(this._terminal,t,n),Zf){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:ki=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:ki=(this.result.fg&16777215)<<8|255;break;default:ki=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:ki=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:ki=(this.result.bg&16777215)<<8|255;break}ki=kl.blend(ki,(this._coreBrowserService.isFocused?gr.selectionBackgroundOpaque:gr.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else ki=(this._coreBrowserService.isFocused?gr.selectionBackgroundOpaque:gr.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(xa=!0,gr.selectionForeground&&(zi=gr.selectionForeground.rgba>>8&16777215,js=!0),oL(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)zi=(this._coreBrowserService.isFocused?gr.selectionBackgroundOpaque:gr.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:zi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:zi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:zi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:zi=(this.result.fg&16777215)<<8|255;break;default:zi=this._themeService.colors.foreground.rgba}zi=kl.blend(zi,(this._coreBrowserService.isFocused?gr.selectionBackgroundOpaque:gr.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}js=!0}}this._decorationService.forEachDecorationAtCell(t,n,"top",s=>{s.backgroundColorRGB&&(ki=s.backgroundColorRGB.rgba>>8&16777215,xa=!0),s.foregroundColorRGB&&(zi=s.foregroundColorRGB.rgba>>8&16777215,js=!0)}),xa&&(Zf?ki=e.bg&-16777216&-134217729|ki|50331648:ki=e.bg&-16777216|ki|50331648),js&&(zi=e.fg&-16777216&-67108865|zi|50331648),this.result.fg&67108864&&(xa&&!js&&((this.result.bg&50331648)===0?zi=this.result.fg&-134217728|gr.background.rgba>>8&16777215&16777215|50331648:zi=this.result.fg&-134217728|this.result.bg&67108863,js=!0),!xa&&js&&((this.result.fg&50331648)===0?ki=this.result.bg&-67108864|gr.foreground.rgba>>8&16777215&16777215|50331648:ki=this.result.bg&-67108864|this.result.fg&67108863,xa=!0)),gr=void 0,this.result.bg=xa?ki:this.result.bg,this.result.fg=js?zi:this.result.fg,this.result.ext&=536870911,this.result.ext|=Jv<<29&3758096384}},F9=.5,lL=T9||R9?"bottom":"ideographic",H9={"▀":[{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}]},U9={"░":[[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]]},W9={"─":{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`}},ch={"":{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}};ch[""]=ch[""];ch[""]=ch[""];function q9(e,t,n,i,s,o,l,d){let f=H9[t];if(f)return G9(e,f,n,i,s,o),!0;let p=U9[t];if(p)return K9(e,p,n,i,s,o),!0;let m=W9[t];if(m)return V9(e,m,n,i,s,o,d),!0;let y=ch[t];return y?(Y9(e,y,n,i,s,o,l,d),!0):!1}function G9(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 D2=new Map;function K9(e,t,n,i,s,o){let l=D2.get(t);l||(l=new Map,D2.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 _=ui(y.getContext("2d")),w=new ImageData(p,m),S,x,k,C;if(d.startsWith("#"))S=parseInt(d.slice(1,3),16),x=parseInt(d.slice(3,5),16),k=parseInt(d.slice(5,7),16),C=d.length>7&&parseInt(d.slice(7,9),16)||1;else if(d.startsWith("rgba"))[S,x,k,C]=d.substring(5,d.length-1).split(",").map(B=>parseFloat(B));else throw new Error(`Unexpected fillStyle color format "${d}" when drawing pattern glyph`);for(let B=0;B<m;B++)for(let H=0;H<p;H++)w.data[(B*p+H)*4]=S,w.data[(B*p+H)*4+1]=x,w.data[(B*p+H)*4+2]=k,w.data[(B*p+H)*4+3]=t[B][H]*(C*255);_.putImageData(w,0,0),f=ui(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],_=cL[y];if(!_){console.error(`Could not find drawing instructions for "${y}"`);continue}let w=m.substring(1).split(",");!w[0]||!w[1]||_(e,uL(w,s,o,n,i,!0,l))}e.stroke(),e.closePath()}}function Y9(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],_=cL[y];if(!_){console.error(`Could not find drawing instructions for "${y}"`);continue}let w=m.substring(1).split(",");!w[0]||!w[1]||_(e,uL(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 B2(e,t,n=0){return Math.max(Math.min(e,t),n)}var cL={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 uL(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]=B2(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]=B2(Math.round(p[m]+.5)-.5,n,0)),p[m]+=s;return p}var P2=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={}}},$2=class{constructor(){this._data=new P2}set(e,t,n,i,s){this._data.get(e,t)||this._data.set(e,t,new P2),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()}},dL=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()}},X9=class extends dL{_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())}}},Z9=class extends dL{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},J9=!$S&&"requestIdleCallback"in window?Z9:X9,Ic=class hL{constructor(){this.fg=0,this.bg=0,this.extended=new fL}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 hL;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}},fL=class pL{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 pL(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Q9=globalThis.performance&&typeof globalThis.performance.now=="function",eH=class mL{static create(t){return new mL(t)}constructor(t){this._now=Q9&&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}},Oa;(e=>{e.None=()=>ks.None;function t(P,N){return y(P,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(P){return(N,I=null,D)=>{let E=!1,L;return L=P(R=>{if(!E)return L?L.dispose():E=!0,N.call(I,R)},null,D),E&&L.dispose(),L}}e.once=n;function i(P,N,I){return p((D,E=null,L)=>P(R=>D.call(E,N(R)),null,L),I)}e.map=i;function s(P,N,I){return p((D,E=null,L)=>P(R=>{N(R),D.call(E,R)},null,L),I)}e.forEach=s;function o(P,N,I){return p((D,E=null,L)=>P(R=>N(R)&&D.call(E,R),null,L),I)}e.filter=o;function l(P){return P}e.signal=l;function d(...P){return(N,I=null,D)=>{let E=iL(...P.map(L=>L(R=>N.call(I,R))));return m(E,D)}}e.any=d;function f(P,N,I,D){let E=I;return i(P,L=>(E=N(E,L),E),D)}e.reduce=f;function p(P,N){let I,D={onWillAddFirstListener(){I=P(E.fire,E)},onDidRemoveLastListener(){I?.dispose()}},E=new Nn(D);return N?.add(E),E.event}function m(P,N){return N instanceof Array?N.push(P):N&&N.add(P),P}function y(P,N,I=100,D=!1,E=!1,L,R){let q,U,O,W=0,K,z={leakWarningThreshold:L,onWillAddFirstListener(){q=P(Z=>{W++,U=N(U,Z),D&&!O&&(G.fire(U),U=void 0),K=()=>{let se=U;U=void 0,O=void 0,(!D||W>1)&&G.fire(se),W=0},typeof I=="number"?(clearTimeout(O),O=setTimeout(K,I)):O===void 0&&(O=0,queueMicrotask(K))})},onWillRemoveListener(){E&&W>0&&K?.()},onDidRemoveLastListener(){K=void 0,q.dispose()}},G=new Nn(z);return R?.add(G),G.event}e.debounce=y;function _(P,N=0,I){return e.debounce(P,(D,E)=>D?(D.push(E),D):[E],N,void 0,!0,void 0,I)}e.accumulate=_;function w(P,N=(D,E)=>D===E,I){let D=!0,E;return o(P,L=>{let R=D||!N(L,E);return D=!1,E=L,R},I)}e.latch=w;function S(P,N,I){return[e.filter(P,N,I),e.filter(P,D=>!N(D),I)]}e.split=S;function x(P,N=!1,I=[],D){let E=I.slice(),L=P(U=>{E?E.push(U):q.fire(U)});D&&D.add(L);let R=()=>{E?.forEach(U=>q.fire(U)),E=null},q=new Nn({onWillAddFirstListener(){L||(L=P(U=>q.fire(U)),D&&D.add(L))},onDidAddFirstListener(){E&&(N?setTimeout(R):R())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return D&&D.add(q),q.event}e.buffer=x;function k(P,N){return(I,D,E)=>{let L=N(new B);return P(function(R){let q=L.evaluate(R);q!==C&&I.call(D,q)},void 0,E)}}e.chain=k;let C=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(I=>(N(I),I)),this}filter(N){return this.steps.push(I=>N(I)?I:C),this}reduce(N,I){let D=I;return this.steps.push(E=>(D=N(D,E),D)),this}latch(N=(I,D)=>I===D){let I=!0,D;return this.steps.push(E=>{let L=I||!N(E,D);return I=!1,D=E,L?E:C}),this}evaluate(N){for(let I of this.steps)if(N=I(N),N===C)break;return N}}function H(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.on(N,D),L=()=>P.removeListener(N,D),R=new Nn({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromNodeEventEmitter=H;function T(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.addEventListener(N,D),L=()=>P.removeEventListener(N,D),R=new Nn({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromDOMEventEmitter=T;function $(P){return new Promise(N=>n(P)(N))}e.toPromise=$;function j(P){let N=new Nn;return P.then(I=>{N.fire(I)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=j;function M(P,N){return P(I=>N.fire(I))}e.forward=M;function V(P,N,I){return N(I),P(D=>N(D))}e.runAndSubscribe=V;class Y{constructor(N,I){this._observable=N,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Nn(D),I&&I.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,I){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(P,N){return new Y(P,N).emitter.event}e.fromObservable=te;function J(P){return(N,I,D)=>{let E=0,L=!1,R={beginUpdate(){E++},endUpdate(){E--,E===0&&(P.reportChanges(),L&&(L=!1,N.call(I)))},handlePossibleChange(){},handleChange(){L=!0}};P.addObserver(R),P.reportChanges();let q={dispose(){P.removeObserver(R)}};return D instanceof Fc?D.add(q):Array.isArray(D)&&D.push(q),q}}e.fromObservableLight=J})(Oa||={});var nw=class iw{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${iw._idPool++}`,iw.all.add(this)}start(t){this._stopWatch=new eH,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}}};nw.all=new Set,nw._idPool=0;var tH=nw,nH=-1,gL=class yL{constructor(t,n,i=(yL._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 sH(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}};gL._idPool=1;var iH=gL,rH=class vL{constructor(t){this.value=t}static create(){let t=new Error;return new vL(t.stack??"")}print(){console.warn(this.value.split(`
22
+ `).slice(2).join(`
23
+ `))}},sH=class extends Error{constructor(t,n){super(t),this.name="ListenerLeakError",this.stack=n}},aH=class extends Error{constructor(t,n){super(t),this.name="ListenerRefusalError",this.stack=n}},oH=0,Qv=class{constructor(t){this.value=t,this.id=oH++}},lH=2,cH,Nn=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new iH(t?.onListenerError??Zv,this._options?.leakWarningThreshold??nH):void 0,this._perfMon=this._options?._profName?new tH(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 aH(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Zv)(p),ks.None}if(this._disposed)return ks.None;n&&(t=t.bind(n));let s=new Qv(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=rH.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof Qv?(this._deliveryQueue??=new uH,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=Xi(()=>{o?.(),this._removeListener(s)});return i instanceof Fc?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*lH<=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||Zv;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 Qv)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}},uH=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}},z2={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}},dd=2,hd,_o=class Tc{constructor(t,n,i){this._document=t,this._config=n,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new $2,this._cacheMapCombined=new $2,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ic,this._textureSize=512,this._onAddTextureAtlasCanvas=new Nn,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Nn,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=_L(t,this._config.deviceCellWidth*4+dd*2,this._config.deviceCellHeight+dd*2),this._tmpCtx=ui(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 J9;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(Tc.maxAtlasPages&&this._pages.length>=Math.max(4,Tc.maxAtlasPages)){let n=this._pages.filter(p=>p.canvas.width*2<=(Tc.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 hd=t.get(n,i,s,o),hd||(hd=this._drawToCache(n,i,s,o,l,d),t.set(n,i,s,o,hd)),hd}_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 Qr;let o;switch(t){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(n);break;case 50331648:let l=Ic.toColorRGB(n);o=nr.toColor(l[0],l[1],l[2]);break;default:i?o=Dd.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return this._config.allowTransparency||(o=Dd.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 _;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&p&&l<8&&(l+=8),_=this._getColorFromAnsiIndex(l);break;case 50331648:let w=Ic.toColorRGB(l);_=nr.toColor(w[0],w[1],w[2]);break;default:d?_=this._config.colors.background:_=this._config.colors.foreground}return this._config.allowTransparency&&(_=Dd.opaque(_)),f&&(_=Dd.multiplyOpacity(_,F9)),_}_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),_=y.getColor(t,s);if(_!==void 0)return _||void 0;let w=this._resolveBackgroundRgba(n,i,d),S=this._resolveForegroundRgba(o,l,d,f),x=kl.ensureContrastRatio(w,S,this._config.minimumContrastRatio/(p?2:1));if(!x){y.setColor(t,s,null);return}let k=nr.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)+dd*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let p=Math.min(this._config.deviceCellHeight+dd*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 z2;let m=!!this._workAttributeData.isBold(),y=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),w=!!this._workAttributeData.isItalic(),S=!!this._workAttributeData.isUnderline(),x=!!this._workAttributeData.isStrikethrough(),k=!!this._workAttributeData.isOverline(),C=this._workAttributeData.getFgColor(),B=this._workAttributeData.getFgColorMode(),H=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(y){let U=C;C=H,H=U;let O=B;B=T,T=O}let $=this._getBackgroundColor(T,H,y,_);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=$.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let j=m?this._config.fontWeightBold:this._config.fontWeight,M=w?"italic":"";this._tmpCtx.font=`${M} ${j} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=lL;let V=d.length===1&&zS(d.charCodeAt(0)),Y=d.length===1&&O9(d.charCodeAt(0)),te=this._getForegroundColor(n,T,H,i,B,C,y,_,m,oL(d.charCodeAt(0)));this._tmpCtx.fillStyle=te.css;let J=Y?0:dd*2,P=!1;this._config.customGlyphs!==!1&&(P=q9(this._tmpCtx,d,J,J,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let N=!V,I;if(typeof t=="number"?I=this._unicodeService.wcwidth(t):I=this._unicodeService.getStringCellWidth(t),S){this._tmpCtx.save();let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),O=U%2===1?.5:0;if(this._tmpCtx.lineWidth=U,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())N=!1,this._tmpCtx.strokeStyle=`rgb(${Ic.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{N=!1;let se=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&se<8&&(se+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(se).css}this._tmpCtx.beginPath();let W=J,K=Math.ceil(J+this._config.deviceCharHeight)-O-(o?U*2:0),z=K+U,G=K+U*2,Z=this._workAttributeData.getUnderlineVariantOffset();for(let se=0;se<I;se++){this._tmpCtx.save();let Se=W+se*this._config.deviceCellWidth,pe=W+(se+1)*this._config.deviceCellWidth,$e=Se+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Se,K),this._tmpCtx.lineTo(pe,K),this._tmpCtx.moveTo(Se,G),this._tmpCtx.lineTo(pe,G);break;case 3:let je=U<=1?G:Math.ceil(J+this._config.deviceCharHeight-U/2)-O,St=U<=1?K:Math.ceil(J+this._config.deviceCharHeight+U/2)-O,Re=new Path2D;Re.rect(Se,K,this._config.deviceCellWidth,G-K),this._tmpCtx.clip(Re),this._tmpCtx.moveTo(Se-this._config.deviceCellWidth/2,z),this._tmpCtx.bezierCurveTo(Se-this._config.deviceCellWidth/2,St,Se,St,Se,z),this._tmpCtx.bezierCurveTo(Se,je,$e,je,$e,z),this._tmpCtx.bezierCurveTo($e,St,pe,St,pe,z),this._tmpCtx.bezierCurveTo(pe,je,pe+this._config.deviceCellWidth/2,je,pe+this._config.deviceCellWidth/2,z);break;case 4:let ze=Z===0?0:Z>=U?U*2-Z:U-Z;Z>=U||ze===0?(this._tmpCtx.setLineDash([Math.round(U),Math.round(U)]),this._tmpCtx.moveTo(Se+ze,K),this._tmpCtx.lineTo(pe,K)):(this._tmpCtx.setLineDash([Math.round(U),Math.round(U)]),this._tmpCtx.moveTo(Se,K),this._tmpCtx.lineTo(Se+ze,K),this._tmpCtx.moveTo(Se+ze+U,K),this._tmpCtx.lineTo(pe,K)),Z=$9(pe-Se,U,Z);break;case 5:let lt=.6,kt=.3,mt=pe-Se,Ct=Math.floor(lt*mt),dt=Math.floor(kt*mt),gt=mt-Ct-dt;this._tmpCtx.setLineDash([Ct,dt,gt]),this._tmpCtx.moveTo(Se,K),this._tmpCtx.lineTo(pe,K);break;default:this._tmpCtx.moveTo(Se,K),this._tmpCtx.lineTo(pe,K);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!P&&this._config.fontSize>=12&&!this._config.allowTransparency&&d!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let se=this._tmpCtx.measureText(d);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in se&&se.actualBoundingBoxDescent>0){this._tmpCtx.save();let Se=new Path2D;Se.rect(W,K-Math.ceil(U/2),this._config.deviceCellWidth*I,G-K+Math.ceil(U/2)),this._tmpCtx.clip(Se),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=$.css,this._tmpCtx.strokeText(d,J,J+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(k){let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),O=U%2===1?.5:0;this._tmpCtx.lineWidth=U,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+O),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*I,J+O),this._tmpCtx.stroke()}if(P||this._tmpCtx.fillText(d,J,J+this._config.deviceCharHeight),d==="_"&&!this._config.allowTransparency){let U=t_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),$,te,N);if(U)for(let O=1;O<=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,J,J+this._config.deviceCharHeight-O),U=t_(this._tmpCtx.getImageData(J,J,this._config.deviceCellWidth,this._config.deviceCellHeight),$,te,N),!!U);O++);}if(x){let U=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),O=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=U,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(J,J+Math.floor(this._config.deviceCharHeight/2)-O),this._tmpCtx.lineTo(J+this._config.deviceCharWidth*I,J+Math.floor(this._config.deviceCharHeight/2)-O),this._tmpCtx.stroke()}this._tmpCtx.restore();let D=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),E;if(this._config.allowTransparency?E=dH(D):E=t_(D,$,te,N),E)return z2;let L=this._findGlyphBoundingBox(D,this._workBoundingBox,f,Y,P,J),R,q;for(;;){if(this._activePages.length===0){let U=this._createNewPage();R=U,q=U.currentRow,q.height=L.size.y;break}R=this._activePages[this._activePages.length-1],q=R.currentRow;for(let U of this._activePages)L.size.y<=U.currentRow.height&&(R=U,q=U.currentRow);for(let U=this._activePages.length-1;U>=0;U--)for(let O of this._activePages[U].fixedRows)O.height<=q.height&&L.size.y<=O.height&&(R=this._activePages[U],q=O);if(L.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)),R=this._overflowSizePage,q=this._overflowSizePage.currentRow,q.x+L.size.x>=R.canvas.width&&(q.x=0,q.y+=q.height,q.height=0);break}if(q.y+L.size.y>=R.canvas.height||q.height>L.size.y+2){let U=!1;if(R.currentRow.y+R.currentRow.height+L.size.y>=R.canvas.height){let O;for(let W of this._activePages)if(W.currentRow.y+W.currentRow.height+L.size.y<W.canvas.height){O=W;break}if(O)R=O;else if(Tc.maxAtlasPages&&this._pages.length>=Tc.maxAtlasPages&&q.y+L.size.y<=R.canvas.height&&q.height>=L.size.y&&q.x+L.size.x<=R.canvas.width)U=!0;else{let W=this._createNewPage();R=W,q=W.currentRow,q.height=L.size.y,U=!0}}U||(R.currentRow.height>0&&R.fixedRows.push(R.currentRow),q={x:0,y:R.currentRow.y+R.currentRow.height,height:L.size.y},R.fixedRows.push(q),R.currentRow={x:0,y:q.y+q.height,height:0})}if(q.x+L.size.x<=R.canvas.width)break;q===R.currentRow?(q.x=0,q.y+=q.height,q.height=0):R.fixedRows.splice(R.fixedRows.indexOf(q),1)}return L.texturePage=this._pages.indexOf(R),L.texturePosition.x=q.x,L.texturePosition.y=q.y,L.texturePositionClipSpace.x=q.x/R.canvas.width,L.texturePositionClipSpace.y=q.y/R.canvas.height,L.sizeClipSpace.x/=R.canvas.width,L.sizeClipSpace.y/=R.canvas.height,q.height=Math.max(q.height,L.size.y),q.x+=L.size.x,R.ctx.putImageData(D,L.texturePosition.x-this._workBoundingBox.left,L.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,L.size.x,L.size.y),R.addGlyph(L),R.version++,L}_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 _=m*this._tmpCanvas.width*4+y*4+3;if(t.data[_]!==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 _=y*this._tmpCanvas.width*4+m*4+3;if(t.data[_]!==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 _=y*this._tmpCanvas.width*4+m*4+3;if(t.data[_]!==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 _=m*this._tmpCanvas.width*4+y*4+3;if(t.data[_]!==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=_L(t,n,n),this.ctx=ui(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 t_(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 _=0;_<e.data.length;_+=4)e.data[_]===s&&e.data[_+1]===o&&e.data[_+2]===l||i&&Math.abs(e.data[_]-s)+Math.abs(e.data[_+1]-o)+Math.abs(e.data[_+2]-l)<m?e.data[_+3]=0:y=!1;return y}function dH(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function _L(e,t,n){let i=e.createElement("canvas");return i.width=t,i.height=n,i}function hH(e,t,n,i,s,o,l,d){let f={foreground:o.foreground,background:o.background,cursor:Qr,cursorAccent:Qr,selectionForeground:Qr,selectionBackgroundTransparent:Qr,selectionBackgroundOpaque:Qr,selectionInactiveBackgroundTransparent:Qr,selectionInactiveBackgroundOpaque:Qr,overviewRulerBorder:Qr,scrollbarSliderBackground:Qr,scrollbarSliderHoverBackground:Qr,scrollbarSliderActiveBackground:Qr,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 F2(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 fH(e){return(e&50331648)===16777216||(e&50331648)===33554432}var as=[];function bL(e,t,n,i,s,o,l,d,f){let p=hH(i,s,o,l,t,n,d,f);for(let _=0;_<as.length;_++){let w=as[_],S=w.ownedBy.indexOf(e);if(S>=0){if(F2(w.config,p))return w.atlas;w.ownedBy.length===1?(w.atlas.dispose(),as.splice(_,1)):w.ownedBy.splice(S,1);break}}for(let _=0;_<as.length;_++){let w=as[_];if(F2(w.config,p))return w.ownedBy.push(e),w.atlas}let m=e._core,y={atlas:new _o(document,p,m.unicodeService),config:p,ownedBy:[e]};return as.push(y),y.atlas}function H2(e){for(let t=0;t<as.length;t++){let n=as[t].ownedBy.indexOf(e);if(n!==-1){as[t].ownedBy.length===1?(as[t].atlas.dispose(),as.splice(t,1)):as[t].ownedBy.splice(n,1);break}}}var Jf=600,pH=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=Jf){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Jf-(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=Jf-(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})},Jf)},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 U2(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 Xi(()=>i?.disconnect())}function mH(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var W2=class wL extends Ic{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new fL,this.combinedData=""}static fromCharData(t){let n=new wL;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?mH(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()]}},SL=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function xL(e,t,n){let i=ui(e.createProgram());if(e.attachShader(i,ui(q2(e,e.VERTEX_SHADER,t))),e.attachShader(i,ui(q2(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 q2(e,t,n){let i=ui(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 gH(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 yH=class{constructor(t){this.texture=t,this.version=-1}},vH=`#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 _H(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 bo=11,pc=bo*Float32Array.BYTES_PER_ELEMENT,bH=2,qn=0,Rn,n_=0,fd=0,wH=class extends ks{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;_o.maxAtlasPages===void 0&&(_o.maxAtlasPages=Math.min(32,ui(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),_o.maxTextureSize=ui(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=ui(xL(o,vH,_H(_o.maxAtlasPages))),this._register(Xi(()=>o.deleteProgram(this._program))),this._projectionLocation=ui(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=ui(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=ui(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(Xi(()=>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(Xi(()=>o.deleteBuffer(p))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p),o.bufferData(o.ELEMENT_ARRAY_BUFFER,f,o.STATIC_DRAW),this._attributesBuffer=ui(o.createBuffer()),this._register(Xi(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,pc,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,pc,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,pc,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,pc,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,pc,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,pc,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let m=new Int32Array(_o.maxAtlasPages);for(let y=0;y<_o.maxAtlasPages;y++)m[y]=y;o.uniform1iv(this._textureLocation,m),o.uniformMatrix4fv(this._projectionLocation,!1,SL),this._atlasTextures=[];for(let y=0;y<_o.maxAtlasPages;y++){let _=new yH(ui(o.createTexture()));this._register(Xi(()=>o.deleteTexture(_.texture))),o.activeTexture(o.TEXTURE0+y),o.bindTexture(o.TEXTURE_2D,_.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]=_}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(qn=(i*this._terminal.cols+n)*bo,s===0||s===void 0){t.fill(0,qn,qn+bo-1-bH);return}this._atlas&&(f&&f.length>1?Rn=this._atlas.getRasterizedGlyphCombinedChar(f,o,l,d,!1,this._terminal.element):Rn=this._atlas.getRasterizedGlyph(s,o,l,d,!1,this._terminal.element),n_=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==m&&Rn.offset.x>n_?(fd=Rn.offset.x-n_,t[qn]=-(Rn.offset.x-fd)+this._dimensions.device.char.left,t[qn+1]=-Rn.offset.y+this._dimensions.device.char.top,t[qn+2]=(Rn.size.x-fd)/this._dimensions.device.canvas.width,t[qn+3]=Rn.size.y/this._dimensions.device.canvas.height,t[qn+4]=Rn.texturePage,t[qn+5]=Rn.texturePositionClipSpace.x+fd/this._atlas.pages[Rn.texturePage].canvas.width,t[qn+6]=Rn.texturePositionClipSpace.y,t[qn+7]=Rn.sizeClipSpace.x-fd/this._atlas.pages[Rn.texturePage].canvas.width,t[qn+8]=Rn.sizeClipSpace.y):(t[qn]=-Rn.offset.x+this._dimensions.device.char.left,t[qn+1]=-Rn.offset.y+this._dimensions.device.char.top,t[qn+2]=Rn.size.x/this._dimensions.device.canvas.width,t[qn+3]=Rn.size.y/this._dimensions.device.canvas.height,t[qn+4]=Rn.texturePage,t[qn+5]=Rn.texturePositionClipSpace.x,t[qn+6]=Rn.texturePositionClipSpace.y,t[qn+7]=Rn.sizeClipSpace.x,t[qn+8]=Rn.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&B9(s,p,Rn.size.x,this._dimensions.device.cell.width)&&(t[qn+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,n=t.cols*t.rows*bo;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+=bo}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*bo,d=this._vertices.attributes.subarray(l,l+t.lineLengths[o]*bo);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/bo)}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}},SH=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 xH(){return new SH}var bm=4,Ip=1,jp=2,i_=3,kH=2147483648,CH=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=xH()}resize(t,n){let i=t*n*bm;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)}},EH=`#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
+ }`,AH=`#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
+ }`,Ra=8,r_=Ra*Float32Array.BYTES_PER_ELEMENT,TH=20*Ra,G2=class{constructor(){this.attributes=new Float32Array(TH),this.count=0}},ka=0,K2=0,V2=0,Y2=0,X2=0,Z2=0,J2=0,RH=class extends ks{constructor(e,t,n,i){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=i,this._vertices=new G2,this._verticesCursor=new G2;let s=this._gl;this._program=ui(xL(s,EH,AH)),this._register(Xi(()=>s.deleteProgram(this._program))),this._projectionLocation=ui(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(Xi(()=>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(Xi(()=>s.deleteBuffer(f))),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,f),s.bufferData(s.ELEMENT_ARRAY_BUFFER,d,s.STATIC_DRAW),this._attributesBuffer=ui(s.createBuffer()),this._register(Xi(()=>s.deleteBuffer(this._attributesBuffer))),s.bindBuffer(s.ARRAY_BUFFER,this._attributesBuffer),s.enableVertexAttribArray(0),s.vertexAttribPointer(0,2,s.FLOAT,!1,r_,0),s.vertexAttribDivisor(0,1),s.enableVertexAttribArray(1),s.vertexAttribPointer(1,2,s.FLOAT,!1,r_,2*Float32Array.BYTES_PER_ELEMENT),s.vertexAttribDivisor(1,1),s.enableVertexAttribArray(2),s.vertexAttribPointer(2,4,s.FLOAT,!1,r_,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,SL),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,_,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)*bm,y=e.cells[m+Ip],_=e.cells[m+jp],w=!!(_&67108864),(y!==d||_!==f&&(p||w))&&((d!==0||p&&f!==0)&&(S=i++*Ra,this._updateRectangle(n,S,f,d,l,o,s)),l=o,d=y,f=_,p=w);(d!==0||p&&f!==0)&&(S=i++*Ra,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++*Ra,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++*Ra,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++*Ra,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++*Ra,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:ka=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:ka=(n&16777215)<<8;break;default:ka=this._themeService.colors.foreground.rgba}else switch(i&50331648){case 16777216:case 33554432:ka=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:ka=(i&16777215)<<8;break;default:ka=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=gH(e.attributes,this._terminal.rows*this._terminal.cols*Ra)),K2=s*this._dimensions.device.cell.width,V2=l*this._dimensions.device.cell.height,Y2=(ka>>24&255)/255,X2=(ka>>16&255)/255,Z2=(ka>>8&255)/255,J2=1,this._addRectangle(e.attributes,t,K2,V2,(o-s)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Y2,X2,Z2,J2)}_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])}},MH=class extends ks{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(Xi(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=ui(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=bL(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=lL,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}`}},NH=class extends MH{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&&fH(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()}},gl=typeof window=="object"?window:globalThis,rw=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Nn,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Nn,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}};rw.INSTANCE=new rw;var kL=rw;function LH(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}kL.INSTANCE.onDidChangeZoomLevel;kL.INSTANCE.onDidChangeFullscreen;var fu=typeof navigator=="object"?navigator.userAgent:"";fu.indexOf("Firefox")>=0;fu.indexOf("AppleWebKit")>=0;var OH=fu.indexOf("Chrome")>=0;!OH&&fu.indexOf("Safari")>=0;fu.indexOf("Electron/")>=0;fu.indexOf("Android")>=0;var s_=!1;if(typeof gl.matchMedia=="function"){let e=gl.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=gl.matchMedia("(display-mode: fullscreen)");s_=e.matches,LH(gl,e,({matches:n})=>{s_&&t.matches||(s_=n)})}var jc="en",a_=!1,CL=!1,Qf,Dp=jc,Q2=jc,IH,Aa,Cl=globalThis,Ir;typeof Cl.vscode<"u"&&typeof Cl.vscode.process<"u"?Ir=Cl.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Ir=process);var jH=typeof Ir?.versions?.electron=="string",DH=jH&&Ir?.type==="renderer";if(typeof Ir=="object"){Ir.platform,Ir.platform,a_=Ir.platform==="linux",a_&&Ir.env.SNAP&&Ir.env.SNAP_REVISION,Ir.env.CI||Ir.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Qf=jc,Dp=jc;let e=Ir.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Qf=t.userLocale,Q2=t.osLocale,Dp=t.resolvedLanguage||jc,IH=t.languagePack?.translationsConfigFile}catch{}CL=!0}else typeof navigator=="object"&&!DH?(Aa=navigator.userAgent,Aa.indexOf("Windows")>=0,Aa.indexOf("Macintosh")>=0,(Aa.indexOf("Macintosh")>=0||Aa.indexOf("iPad")>=0||Aa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,a_=Aa.indexOf("Linux")>=0,Aa?.indexOf("Mobi")>=0,Dp=globalThis._VSCODE_NLS_LANGUAGE||jc,Qf=navigator.language.toLowerCase(),Q2=Qf):console.error("Unable to resolve platform.");var eA=CL,Ys=Aa,fo=Dp,BH;(e=>{function t(){return fo}e.value=t;function n(){return fo.length===2?fo==="en":fo.length>=3?fo[0]==="e"&&fo[1]==="n"&&fo[2]==="-":!1}e.isDefaultVariant=n;function i(){return fo==="en"}e.isDefault=i})(BH||={});var PH=typeof Cl.postMessage=="function"&&!Cl.importScripts;(()=>{if(PH){let e=[];Cl.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}),Cl.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var $H=!!(Ys&&Ys.indexOf("Chrome")>=0);Ys&&Ys.indexOf("Firefox")>=0;!$H&&Ys&&Ys.indexOf("Safari")>=0;Ys&&Ys.indexOf("Edg/")>=0;Ys&&Ys.indexOf("Android")>=0;var mc=typeof navigator=="object"?navigator:{};eA||document.queryCommandSupported&&document.queryCommandSupported("copy")||mc&&mc.clipboard&&mc.clipboard.writeText,eA||mc&&mc.clipboard&&mc.clipboard.readText;var FS=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 FS,tA=new FS,nA=new FS;new Array(230);var zH;(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 tA.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return nA.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return tA.strToKeyCode(d)||nA.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})(zH||={});var EL=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),FH;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof HH?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Oa.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:EL})})(FH||={});var HH=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?EL:(this._emitter||(this._emitter=new Nn),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},UH;(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})(UH||={});var iA=class es{static fromArray(t){return new es(n=>{n.emitMany(t)})}static fromPromise(t){return new es(async n=>{n.emitMany(await t)})}static fromPromises(t){return new es(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new es(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 Nn,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 Oa.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new es(async i=>{for await(let s of t)i.emitOne(n(s))})}map(t){return es.map(this,t)}static filter(t,n){return new es(async i=>{for await(let s of t)n(s)&&i.emitOne(s)})}filter(t){return es.filter(this,t)}static coalesce(t){return es.filter(t,n=>!!n)}coalesce(){return es.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return es.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};iA.EMPTY=iA.fromArray([]);var{getWindow:WH}=(function(){let e=new Map,t={window:gl,disposables:new Fc};e.set(gl.vscodeWindowId,t);let n=new Nn,i=new Nn,s=new Nn;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 ks.None;let d=new Fc,f={window:l,disposables:d.add(new Fc)};return e.set(l.vscodeWindowId,f),d.add(Xi(()=>{e.delete(l.vscodeWindowId),i.fire(l)})),d.add(sw(l,GH.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:gl},getDocument(l){return WH(l).document}}})(),qH=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 sw(e,t,n,i){return new qH(e,t,n,i)}var GH={BEFORE_UNLOAD:"beforeunload"},KH=class extends ks{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 ud,this._charAtlasDisposable=this._register(new ud),this._observerDisposable=this._register(new ud),this._model=new CH,this._workCell=new W2,this._workCell2=new W2,this._rectangleRenderer=this._register(new ud),this._glyphRenderer=this._register(new ud),this._onChangeTextureAtlas=this._register(new Nn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Nn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Nn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Nn),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Nn),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 z9(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new NH(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,d,this._themeService)],this.dimensions=P9(),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(sw(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(sw(this._canvas,"webglcontextrestored",y=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,H2(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=U2(this._canvas,this._coreBrowserService.window,(y,_)=>this._setCanvasDevicePixelDimensions(y,_)),this._register(this._coreBrowserService.onWindowChange(y=>{this._observerDisposable.value=U2(this._canvas,y,(_,w)=>this._setCanvasDevicePixelDimensions(_,w))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Xi(()=>{for(let y of this._renderLayers)y.dispose();this._canvas.parentElement?.removeChild(this._canvas),H2(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 RH(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new wH(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=bL(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=iL(Oa.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Oa.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 pH(()=>{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,_=!0,w,S,x,k,C,B,H,T,$;t=rA(t,i.rows-1,0),n=rA(n,i.rows-1,0);let j=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",M=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=M-i.buffer.ydisp,Y=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),te=-1,J=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let P=!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=M===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,_=T>=y,w=T,p.length>0&&T===p[0][0]&&_){S=p.shift();let N=this._model.selection.isCellSelected(this._terminal,S[0],d);for(H=S[0]+1;H<S[1];H++)_&&=N===this._model.selection.isCellSelected(this._terminal,H,d);_&&=!x||Y<S[0]||Y>=S[1],_?(m=!0,s=new VH(s,f.translateToString(!0,S[0],S[1]),S[1]-S[0]),w=S[1]-1):y=S[1]}if(k=s.getChars(),C=s.getCode(),H=(l*i.cols+T)*bm,this._cellColorResolver.resolve(s,T,d,this.dimensions.device.cell.width),J&&d===M&&(T===Y&&(this._model.cursor={x:Y,y:V,width:s.getWidth(),style:this._coreBrowserService.isFocused?j:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},te=Y+s.getWidth()-1),T>=Y&&T<=te&&(this._coreBrowserService.isFocused&&j==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),C!==0&&(this._model.lineLengths[l]=T+1),!(this._model.cells[H]===C&&this._model.cells[H+Ip]===this._cellColorResolver.result.bg&&this._model.cells[H+jp]===this._cellColorResolver.result.fg&&this._model.cells[H+i_]===this._cellColorResolver.result.ext)&&(P=!0,k.length>1&&(C|=kH),this._model.cells[H]=C,this._model.cells[H+Ip]=this._cellColorResolver.result.bg,this._model.cells[H+jp]=this._cellColorResolver.result.fg,this._model.cells[H+i_]=this._cellColorResolver.result.ext,B=s.getWidth(),this._glyphRenderer.value.updateCell(T,l,C,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,k,B,o),m)){for(s=this._workCell,T++;T<=w;T++)$=(l*i.cols+T)*bm,this._glyphRenderer.value.updateCell(T,l,0,0,0,0,N9,0,0),this._model.cells[$]=0,this._model.cells[$+Ip]=this._cellColorResolver.result.bg,this._model.cells[$+jp]=this._cellColorResolver.result.fg,this._model.cells[$+i_]=this._cellColorResolver.result.ext;T--}}P&&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})}},VH=class extends Ic{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 rA(e,t,n=0){return Math.max(Math.min(e,t),n)}var sA="di$target",aA="di$dependencies",l_=new Map;function ia(e){if(l_.has(e))return l_.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");YH(t,n,s)};return t._id=e,l_.set(e,t),t}function YH(e,t,n){t[sA]===t?t[aA].push({id:e,index:n}):(t[aA]=[{id:e,index:n}],t[sA]=t)}ia("BufferService");ia("CoreMouseService");ia("CoreService");ia("CharsetService");ia("InstantiationService");ia("LogService");var XH=ia("OptionsService");ia("OscLinkService");ia("UnicodeService");ia("DecorationService");var ZH={trace:0,debug:1,info:2,warn:3,error:4,off:5},JH="xterm.js: ",oA=class extends ks{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=ZH[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?"":JH)+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)}};oA=_9([b9(0,XH)],oA);var QH=class extends ks{constructor(t){if(aL&&M9()<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 Nn),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Nn),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Nn),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Nn),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 KH(t,d,f,p,i,m,s,y,this._preserveDrawingBuffer)),this._register(Oa.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Oa.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Oa.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Oa.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(Xi(()=>{if(this._terminal._core._store._isDisposed)return;let _=this._terminal._core._renderService;_.setRenderer(this._terminal._core._createRenderer()),_.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var AL=Object.defineProperty,eU=Object.getOwnPropertyDescriptor,tU=(e,t)=>{for(var n in t)AL(e,n,{get:t[n],enumerable:!0})},Yn=(e,t,n,i)=>{for(var s=i>1?void 0:i?eU(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&&AL(t,n,s),s},Ue=(e,t)=>(n,i)=>t(n,i,e),lA="Terminal input",aw={get:()=>lA,set:e=>lA=e},cA="Too much output to announce, navigate to rows manually to read",ow={get:()=>cA,set:e=>cA=e};function nU(e){return e.replace(/\r?\n/g,"\r")}function iU(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function rU(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function sU(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");TL(s,t,n,i)}}function TL(e,t,n,i){e=nU(e),e=iU(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function RL(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 uA(e,t,n,i,s){RL(e,t,n),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function ko(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function pg(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 aU=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}},oU=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 _=!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,C=k-S;for(;p<C;){if(p>=n)return 0;if(x=e[p++],(x&192)!==128){p--,_=!0;break}else this.interim[S++]=x,w<<=6,w|=x&63}_||(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}},ML="",To=" ",Rh=class NL{constructor(){this.fg=0,this.bg=0,this.extended=new wm}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 NL;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}},wm=class LL{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 LL(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ls=class OL extends Rh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new wm,this.combinedData=""}static fromCharData(t){let n=new OL;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?ko(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()]}},dA="di$target",lw="di$dependencies",c_=new Map;function lU(e){return e[lw]||[]}function ji(e){if(c_.has(e))return c_.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");cU(t,n,s)};return t._id=e,c_.set(e,t),t}function cU(e,t,n){t[dA]===t?t[lw].push({id:e,index:n}):(t[lw]=[{id:e,index:n}],t[dA]=t)}var ar=ji("BufferService"),IL=ji("CoreMouseService"),Bl=ji("CoreService"),uU=ji("CharsetService"),HS=ji("InstantiationService"),jL=ji("LogService"),or=ji("OptionsService"),DL=ji("OscLinkService"),dU=ji("UnicodeService"),Mh=ji("DecorationService"),cw=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 ls,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 _={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:_,activate:(S,x)=>s?s.activate(S,x,_):hU(S,x),hover:(S,x)=>s?.hover?.(S,x,_),leave:(S,x)=>s?.leave?.(S,x,_)})}p=!1,o.hasExtendedAttrs()&&o.extended.urlId?(f=m,d=o.extended.urlId):(f=-1,d=-1)}}t(i)}};cw=Yn([Ue(0,ar),Ue(1,or),Ue(2,DL)],cw);function hU(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 mg=ji("CharSizeService"),$a=ji("CoreBrowserService"),US=ji("MouseService"),za=ji("RenderService"),fU=ji("SelectionService"),BL=ji("CharacterJoinerService"),pu=ji("ThemeService"),PL=ji("LinkProviderService"),pU=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?hA.isErrorNoTelemetry(e)?new hA(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)}},mU=new pU;function Bp(e){gU(e)||mU.onUnexpectedError(e)}var uw="Canceled";function gU(e){return e instanceof yU?!0:e instanceof Error&&e.name===uw&&e.message===uw}var yU=class extends Error{constructor(){super(uw),this.name=this.message}};function vU(e){return new Error(`Illegal argument: ${e}`)}var hA=class dw extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof dw)return t;let n=new dw;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},hw=class $L extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,$L.prototype)}};function Nr(e,t=0){return e[e.length-(1+t)]}var _U;(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})(_U||={});function bU(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var zL;(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 j=0;for(let M of T)if($(M,j++))return!0;return!1}e.some=m;function y(T,$){for(let j of T)if($(j))return j}e.find=y;function*_(T,$){for(let j of T)$(j)&&(yield j)}e.filter=_;function*w(T,$){let j=0;for(let M of T)yield $(M,j++)}e.map=w;function*S(T,$){let j=0;for(let M of T)yield*$(M,j++)}e.flatMap=S;function*x(...T){for(let $ of T)yield*$}e.concat=x;function k(T,$,j){let M=j;for(let V of T)M=$(M,V);return M}e.reduce=k;function*C(T,$,j=T.length){for($<0&&($+=T.length),j<0?j+=T.length:j>T.length&&(j=T.length);$<j;$++)yield T[$]}e.slice=C;function B(T,$=Number.POSITIVE_INFINITY){let j=[];if($===0)return[j,T];let M=T[Symbol.iterator]();for(let V=0;V<$;V++){let Y=M.next();if(Y.done)return[j,e.empty()];j.push(Y.value)}return[j,{[Symbol.iterator](){return M}}]}e.consume=B;async function H(T){let $=[];for await(let j of T)$.push(j);return Promise.resolve($)}e.asyncToArray=H})(zL||={});function Nl(e){if(zL.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 wU(...e){return Bn(()=>Nl(e))}function Bn(e){return{dispose:bU(()=>{e()})}}var FL=class HL{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{Nl(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?HL.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)}};FL.DISABLE_DISPOSED_WARNING=!1;var Oo=FL,Dt=class{constructor(){this._store=new Oo,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)}};Dt.None=Object.freeze({dispose(){}});var tu=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}},Ia=typeof window=="object"?window:globalThis,fw=class pw{constructor(t){this.element=t,this.next=pw.Undefined,this.prev=pw.Undefined}};fw.Undefined=new fw(void 0);var $n=fw,fA=class{constructor(){this._first=$n.Undefined,this._last=$n.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===$n.Undefined}clear(){let e=this._first;for(;e!==$n.Undefined;){let t=e.next;e.prev=$n.Undefined,e.next=$n.Undefined,e=t}this._first=$n.Undefined,this._last=$n.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new $n(e);if(this._first===$n.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!==$n.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==$n.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==$n.Undefined&&e.next!==$n.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===$n.Undefined&&e.next===$n.Undefined?(this._first=$n.Undefined,this._last=$n.Undefined):e.next===$n.Undefined?(this._last=this._last.prev,this._last.next=$n.Undefined):e.prev===$n.Undefined&&(this._first=this._first.next,this._first.prev=$n.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==$n.Undefined;)yield e.element,e=e.next}},SU=globalThis.performance&&typeof globalThis.performance.now=="function",xU=class UL{static create(t){return new UL(t)}constructor(t){this._now=SU&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Wi;(e=>{e.None=()=>Dt.None;function t(P,N){return y(P,()=>{},0,void 0,!0,void 0,N)}e.defer=t;function n(P){return(N,I=null,D)=>{let E=!1,L;return L=P(R=>{if(!E)return L?L.dispose():E=!0,N.call(I,R)},null,D),E&&L.dispose(),L}}e.once=n;function i(P,N,I){return p((D,E=null,L)=>P(R=>D.call(E,N(R)),null,L),I)}e.map=i;function s(P,N,I){return p((D,E=null,L)=>P(R=>{N(R),D.call(E,R)},null,L),I)}e.forEach=s;function o(P,N,I){return p((D,E=null,L)=>P(R=>N(R)&&D.call(E,R),null,L),I)}e.filter=o;function l(P){return P}e.signal=l;function d(...P){return(N,I=null,D)=>{let E=wU(...P.map(L=>L(R=>N.call(I,R))));return m(E,D)}}e.any=d;function f(P,N,I,D){let E=I;return i(P,L=>(E=N(E,L),E),D)}e.reduce=f;function p(P,N){let I,D={onWillAddFirstListener(){I=P(E.fire,E)},onDidRemoveLastListener(){I?.dispose()}},E=new Le(D);return N?.add(E),E.event}function m(P,N){return N instanceof Array?N.push(P):N&&N.add(P),P}function y(P,N,I=100,D=!1,E=!1,L,R){let q,U,O,W=0,K,z={leakWarningThreshold:L,onWillAddFirstListener(){q=P(Z=>{W++,U=N(U,Z),D&&!O&&(G.fire(U),U=void 0),K=()=>{let se=U;U=void 0,O=void 0,(!D||W>1)&&G.fire(se),W=0},typeof I=="number"?(clearTimeout(O),O=setTimeout(K,I)):O===void 0&&(O=0,queueMicrotask(K))})},onWillRemoveListener(){E&&W>0&&K?.()},onDidRemoveLastListener(){K=void 0,q.dispose()}},G=new Le(z);return R?.add(G),G.event}e.debounce=y;function _(P,N=0,I){return e.debounce(P,(D,E)=>D?(D.push(E),D):[E],N,void 0,!0,void 0,I)}e.accumulate=_;function w(P,N=(D,E)=>D===E,I){let D=!0,E;return o(P,L=>{let R=D||!N(L,E);return D=!1,E=L,R},I)}e.latch=w;function S(P,N,I){return[e.filter(P,N,I),e.filter(P,D=>!N(D),I)]}e.split=S;function x(P,N=!1,I=[],D){let E=I.slice(),L=P(U=>{E?E.push(U):q.fire(U)});D&&D.add(L);let R=()=>{E?.forEach(U=>q.fire(U)),E=null},q=new Le({onWillAddFirstListener(){L||(L=P(U=>q.fire(U)),D&&D.add(L))},onDidAddFirstListener(){E&&(N?setTimeout(R):R())},onDidRemoveLastListener(){L&&L.dispose(),L=null}});return D&&D.add(q),q.event}e.buffer=x;function k(P,N){return(I,D,E)=>{let L=N(new B);return P(function(R){let q=L.evaluate(R);q!==C&&I.call(D,q)},void 0,E)}}e.chain=k;let C=Symbol("HaltChainable");class B{constructor(){this.steps=[]}map(N){return this.steps.push(N),this}forEach(N){return this.steps.push(I=>(N(I),I)),this}filter(N){return this.steps.push(I=>N(I)?I:C),this}reduce(N,I){let D=I;return this.steps.push(E=>(D=N(D,E),D)),this}latch(N=(I,D)=>I===D){let I=!0,D;return this.steps.push(E=>{let L=I||!N(E,D);return I=!1,D=E,L?E:C}),this}evaluate(N){for(let I of this.steps)if(N=I(N),N===C)break;return N}}function H(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.on(N,D),L=()=>P.removeListener(N,D),R=new Le({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromNodeEventEmitter=H;function T(P,N,I=D=>D){let D=(...q)=>R.fire(I(...q)),E=()=>P.addEventListener(N,D),L=()=>P.removeEventListener(N,D),R=new Le({onWillAddFirstListener:E,onDidRemoveLastListener:L});return R.event}e.fromDOMEventEmitter=T;function $(P){return new Promise(N=>n(P)(N))}e.toPromise=$;function j(P){let N=new Le;return P.then(I=>{N.fire(I)},()=>{N.fire(void 0)}).finally(()=>{N.dispose()}),N.event}e.fromPromise=j;function M(P,N){return P(I=>N.fire(I))}e.forward=M;function V(P,N,I){return N(I),P(D=>N(D))}e.runAndSubscribe=V;class Y{constructor(N,I){this._observable=N,this._counter=0,this._hasChanged=!1;let D={onWillAddFirstListener:()=>{N.addObserver(this)},onDidRemoveLastListener:()=>{N.removeObserver(this)}};this.emitter=new Le(D),I&&I.add(this.emitter)}beginUpdate(N){this._counter++}handlePossibleChange(N){}handleChange(N,I){this._hasChanged=!0}endUpdate(N){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function te(P,N){return new Y(P,N).emitter.event}e.fromObservable=te;function J(P){return(N,I,D)=>{let E=0,L=!1,R={beginUpdate(){E++},endUpdate(){E--,E===0&&(P.reportChanges(),L&&(L=!1,N.call(I)))},handlePossibleChange(){},handleChange(){L=!0}};P.addObserver(R),P.reportChanges();let q={dispose(){P.removeObserver(R)}};return D instanceof Oo?D.add(q):Array.isArray(D)&&D.push(q),q}}e.fromObservableLight=J})(Wi||={});var mw=class gw{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${gw._idPool++}`,gw.all.add(this)}start(t){this._stopWatch=new xU,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}}};mw.all=new Set,mw._idPool=0;var kU=mw,CU=-1,WL=class qL{constructor(t,n,i=(qL._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 TU(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}};WL._idPool=1;var EU=WL,AU=class GL{constructor(t){this.value=t}static create(){let t=new Error;return new GL(t.stack??"")}print(){console.warn(this.value.split(`
87
+ `).slice(2).join(`
88
+ `))}},TU=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},RU=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},MU=0,u_=class{constructor(e){this.value=e,this.id=MU++}},NU=2,LU,Le=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new EU(t?.onListenerError??Bp,this._options?.leakWarningThreshold??CU):void 0,this._perfMon=this._options?._profName?new kU(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 RU(`${d}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||Bp)(p),Dt.None}if(this._disposed)return Dt.None;n&&(t=t.bind(n));let s=new u_(t),o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=AU.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof u_?(this._deliveryQueue??=new OU,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let l=Bn(()=>{o?.(),this._removeListener(s)});return i instanceof Oo?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*NU<=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||Bp;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 u_)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}},OU=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}},yw=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Le,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Le,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}};yw.INSTANCE=new yw;var WS=yw;function IU(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}WS.INSTANCE.onDidChangeZoomLevel;function jU(e){return WS.INSTANCE.getZoomFactor(e)}WS.INSTANCE.onDidChangeFullscreen;var mu=typeof navigator=="object"?navigator.userAgent:"",vw=mu.indexOf("Firefox")>=0,DU=mu.indexOf("AppleWebKit")>=0,qS=mu.indexOf("Chrome")>=0,BU=!qS&&mu.indexOf("Safari")>=0;mu.indexOf("Electron/")>=0;mu.indexOf("Android")>=0;var d_=!1;if(typeof Ia.matchMedia=="function"){let e=Ia.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Ia.matchMedia("(display-mode: fullscreen)");d_=e.matches,IU(Ia,e,({matches:n})=>{d_&&t.matches||(d_=n)})}var Dc="en",_w=!1,bw=!1,Pp=!1,KL=!1,ep,$p=Dc,pA=Dc,PU,Ta,El=globalThis,jr;typeof El.vscode<"u"&&typeof El.vscode.process<"u"?jr=El.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(jr=process);var $U=typeof jr?.versions?.electron=="string",zU=$U&&jr?.type==="renderer";if(typeof jr=="object"){_w=jr.platform==="win32",bw=jr.platform==="darwin",Pp=jr.platform==="linux",Pp&&jr.env.SNAP&&jr.env.SNAP_REVISION,jr.env.CI||jr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ep=Dc,$p=Dc;let e=jr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ep=t.userLocale,pA=t.osLocale,$p=t.resolvedLanguage||Dc,PU=t.languagePack?.translationsConfigFile}catch{}KL=!0}else typeof navigator=="object"&&!zU?(Ta=navigator.userAgent,_w=Ta.indexOf("Windows")>=0,bw=Ta.indexOf("Macintosh")>=0,(Ta.indexOf("Macintosh")>=0||Ta.indexOf("iPad")>=0||Ta.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Pp=Ta.indexOf("Linux")>=0,Ta?.indexOf("Mobi")>=0,$p=globalThis._VSCODE_NLS_LANGUAGE||Dc,ep=navigator.language.toLowerCase(),pA=ep):console.error("Unable to resolve platform.");var VL=_w,Ws=bw,FU=Pp,mA=KL,Xs=Ta,po=$p,HU;(e=>{function t(){return po}e.value=t;function n(){return po.length===2?po==="en":po.length>=3?po[0]==="e"&&po[1]==="n"&&po[2]==="-":!1}e.isDefaultVariant=n;function i(){return po==="en"}e.isDefault=i})(HU||={});var UU=typeof El.postMessage=="function"&&!El.importScripts;(()=>{if(UU){let e=[];El.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}),El.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var WU=!!(Xs&&Xs.indexOf("Chrome")>=0);Xs&&Xs.indexOf("Firefox")>=0;!WU&&Xs&&Xs.indexOf("Safari")>=0;Xs&&Xs.indexOf("Edg/")>=0;Xs&&Xs.indexOf("Android")>=0;var gc=typeof navigator=="object"?navigator:{};mA||document.queryCommandSupported&&document.queryCommandSupported("copy")||gc&&gc.clipboard&&gc.clipboard.writeText,mA||gc&&gc.clipboard&&gc.clipboard.readText;var GS=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}},h_=new GS,gA=new GS,yA=new GS,qU=new Array(230),YL;(e=>{function t(d){return h_.keyCodeToStr(d)}e.toString=t;function n(d){return h_.strToKeyCode(d)}e.fromString=n;function i(d){return gA.keyCodeToStr(d)}e.toUserSettingsUS=i;function s(d){return yA.keyCodeToStr(d)}e.toUserSettingsGeneral=s;function o(d){return gA.strToKeyCode(d)||yA.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 h_.keyCodeToStr(d)}e.toElectronAccelerator=l})(YL||={});var GU=class XL{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 XL&&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 KU([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},KU=class{constructor(e){if(e.length===0)throw vU("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 VU(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return YL.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(vw)switch(t){case 59:return 85;case 60:if(FU)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ws)return 57;break}else if(DU&&(Ws&&t===93||!Ws&&t===92))return 57;return qU[t]||0}var YU=Ws?256:2048,XU=512,ZU=1024,JU=Ws?2048:256,vA=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=VU(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|=YU),this.altKey&&(t|=XU),this.shiftKey&&(t|=ZU),this.metaKey&&(t|=JU),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new GU(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},_A=new WeakMap;function QU(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 eW=class{static getSameOriginWindowChain(e){let t=_A.get(e);if(!t){t=[],_A.set(e,t);let n=e,i;do i=QU(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}}},tp=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=eW.getPositionOfChildWindowRelativeToAncestorWindow(t,n.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},bA=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(qS){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?vw&&!Ws?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")BU&&VL?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?vw&&!Ws?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()}},ZL=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),tW;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof nW?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Wi.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:ZL})})(tW||={});var nW=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?ZL:(this._emitter||(this._emitter=new Le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},KS=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 hw("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,t()},n)}setIfNotSet(t,n){if(this._isDisposed)throw new hw("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,t()},n))}},iW=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 hw("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=Bn(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},rW;(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})(rW||={});var wA=class ts{static fromArray(t){return new ts(n=>{n.emitMany(t)})}static fromPromise(t){return new ts(async n=>{n.emitMany(await t)})}static fromPromises(t){return new ts(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new ts(async n=>{await Promise.all(t.map(async i=>{for await(let s of i)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Le,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 Wi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new ts(async i=>{for await(let s of t)i.emitOne(n(s))})}map(t){return ts.map(this,t)}static filter(t,n){return new ts(async i=>{for await(let s of t)n(s)&&i.emitOne(s)})}filter(t){return ts.filter(this,t)}static coalesce(t){return ts.filter(t,n=>!!n)}coalesce(){return ts.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return ts.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};wA.EMPTY=wA.fromArray([]);var{getWindow:Hs,getWindowId:sW,onDidRegisterWindow:aW}=(function(){let e=new Map,t={window:Ia,disposables:new Oo};e.set(Ia.vscodeWindowId,t);let n=new Le,i=new Le,s=new Le;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 Dt.None;let d=new Oo,f={window:l,disposables:d.add(new Oo)};return e.set(l.vscodeWindowId,f),d.add(Bn(()=>{e.delete(l.vscodeWindowId),i.fire(l)})),d.add(wt(l,Ci.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:Ia},getDocument(l){return Hs(l).document}}})(),oW=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 wt(e,t,n,i){return new oW(e,t,n,i)}var SA=function(e,t,n,i){return wt(e,t,n,i)},VS,lW=class extends iW{constructor(e){super(),this.defaultTarget=e&&Hs(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},xA=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){Bp(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(xA.sort),l.shift().execute();i.set(o,!1)};VS=(o,l,d=0)=>{let f=sW(o),p=new xA(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 cW(e){let t=e.getBoundingClientRect(),n=Hs(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Ci={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"},uW=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=yr(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=yr(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=yr(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=yr(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=yr(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=yr(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=yr(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=yr(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=yr(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=yr(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=yr(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=yr(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=yr(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=yr(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 yr(e){return typeof e=="number"?`${e}px`:e}function Zd(e){return new uW(e)}var JL=class{constructor(){this._hooks=new Oo,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(Bn(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Hs(e)}this._hooks.add(wt(o,Ci.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(wt(o,Ci.POINTER_UP,l=>this.stopMonitoring(!0)))}};function dW(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 Ps;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Ps||={});var Bd=class Ki extends Dt{constructor(){super(),this.dispatched=!1,this.targets=new fA,this.ignoreTargets=new fA,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Wi.runAndSubscribe(aW,({window:t,disposables:n})=>{n.add(wt(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add(wt(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add(wt(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Ia,disposables:this._store}))}static addTarget(t){if(!Ki.isTouchDevice())return Dt.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let n=Ki.INSTANCE.targets.push(t);return Bn(n)}static ignoreTarget(t){if(!Ki.isTouchDevice())return Dt.None;Ki.INSTANCE||(Ki.INSTANCE=new Ki);let n=Ki.INSTANCE.ignoreTargets.push(t);return Bn(n)}static isTouchDevice(){return"ontouchstart"in Ia||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(Ps.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<Ki.HOLD_DELAY&&Math.abs(f.initialPageX-Nr(f.rollingPageX))<30&&Math.abs(f.initialPageY-Nr(f.rollingPageY))<30){let m=this.newGestureEvent(Ps.Tap,f.initialTarget);m.pageX=Nr(f.rollingPageX),m.pageY=Nr(f.rollingPageY),this.dispatchEvent(m)}else if(p>=Ki.HOLD_DELAY&&Math.abs(f.initialPageX-Nr(f.rollingPageX))<30&&Math.abs(f.initialPageY-Nr(f.rollingPageY))<30){let m=this.newGestureEvent(Ps.Contextmenu,f.initialTarget);m.pageX=Nr(f.rollingPageX),m.pageY=Nr(f.rollingPageY),this.dispatchEvent(m)}else if(s===1){let m=Nr(f.rollingPageX),y=Nr(f.rollingPageY),_=Nr(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)/_,w>0?1:-1,m,Math.abs(S)/_,S>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Ps.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===Ps.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>Ki.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===Ps.Change||t.type===Ps.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=VS(t,()=>{let m=Date.now(),y=m-i,_=0,w=0,S=!0;s+=Ki.SCROLL_FRICTION*y,d+=Ki.SCROLL_FRICTION*y,s>0&&(S=!1,_=o*s*y),d>0&&(S=!1,w=f*d*y);let x=this.newGestureEvent(Ps.Change);x.translationX=_,x.translationY=w,n.forEach(k=>k.dispatchEvent(x)),S||this.inertia(t,n,m,s,o,l+_,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(Ps.Change,l.initialTarget);d.translationX=o.pageX-Nr(l.rollingPageX),d.translationY=o.pageY-Nr(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)}};Bd.SCROLL_FRICTION=-.005,Bd.HOLD_DELAY=700,Bd.CLEAR_TAP_COUNT_TIME=400,Yn([dW],Bd,"isTouchDevice",1);var hW=Bd,YS=class extends Dt{onclick(e,t){this._register(wt(e,Ci.CLICK,n=>t(new tp(Hs(e),n))))}onmousedown(e,t){this._register(wt(e,Ci.MOUSE_DOWN,n=>t(new tp(Hs(e),n))))}onmouseover(e,t){this._register(wt(e,Ci.MOUSE_OVER,n=>t(new tp(Hs(e),n))))}onmouseleave(e,t){this._register(wt(e,Ci.MOUSE_LEAVE,n=>t(new tp(Hs(e),n))))}onkeydown(e,t){this._register(wt(e,Ci.KEY_DOWN,n=>t(new vA(n))))}onkeyup(e,t){this._register(wt(e,Ci.KEY_UP,n=>t(new vA(n))))}oninput(e,t){this._register(wt(e,Ci.INPUT,t))}onblur(e,t){this._register(wt(e,Ci.BLUR,t))}onfocus(e,t){this._register(wt(e,Ci.FOCUS,t))}onchange(e,t){this._register(wt(e,Ci.CHANGE,t))}ignoreGesture(e){return hW.ignoreTarget(e)}},kA=11,fW=class extends YS{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=kA+"px",this.domNode.style.height=kA+"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 JL),this._register(SA(this.bgDomNode,Ci.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(SA(this.domNode,Ci.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new lW),this._pointerdownScheduleRepeatTimer=this._register(new KS)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Hs(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()}},pW=class ww{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 ww(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 ww(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}}},mW=class extends Dt{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new pW(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 EA(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=EA.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)))}},CA=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function f_(e,t){let n=t-e;return function(i){return e+n*vW(i)}}function gW(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var EA=class Sw{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),gW(f_(t,s),f_(o,n),.33)}return f_(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 CA(i,s,!1)}return new CA(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return Sw.start(t,n,i)}static start(t,n,i){i=i+10;let s=Date.now()-10;return new Sw(t,n,s,i)}};function yW(e){return Math.pow(e,3)}function vW(e){return 1-yW(1-e)}var _W=class extends Dt{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 KS)}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":"")))}},bW=140,QL=class extends YS{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 _W(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new JL),this._shouldRender=!0,this.domNode=Zd(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(wt(this.domNode.domNode,Ci.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new fW(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Zd(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(wt(this.slider.domNode,Ci.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=cW(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(VL&&l>bW){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()}},e3=class xw{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 xw(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=xw._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)}},wW=class extends QL{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new e3(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}},SW=class extends QL{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new e3(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}},xW=500,AA=50,kW=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},kw=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(qS){let n=Hs(t.browserEvent),i=jU(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 kW(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}};kw.INSTANCE=new kw;var CW=kw,EW=class extends YS{constructor(e,t,n){super(),this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Le),this.onWillScroll=this._onWillScroll.event,this._options=TW(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 SW(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new wW(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=Zd(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Zd(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Zd(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 KS),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nl(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,Ws&&(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 bA(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nl(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new bA(n))};this._mouseWheelToDispose.push(wt(this._listenOnDomNode,Ci.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=CW.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=!Ws&&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=AA*s,m=d.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(f,m)}if(o){let p=AA*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(),xW)}},AW=class extends EW{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 TW(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,Ws&&(t.className+=" mac"),t}var Cw=class extends Dt{constructor(e,t,n,i,s,o,l,d){super(),this._bufferService=n,this._optionsService=l,this._renderService=d,this._onRequestScrollLines=this._register(new Le),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new mW({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:p=>VS(i.window,p)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new AW(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(Wi.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Bn(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Bn(()=>this._styleElement.remove())),this._register(Wi.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
89
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(p=>this._handleScroll(p)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Cw=Yn([Ue(2,ar),Ue(3,$a),Ue(4,IL),Ue(5,pu),Ue(6,or),Ue(7,za)],Cw);var Ew=class extends Dt{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(Bn(()=>{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()}};Ew=Yn([Ue(1,ar),Ue(2,$a),Ue(3,Mh),Ue(4,za)],Ew);var RW=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)}},Ds={full:0,left:0,center:0,right:0},mo={full:0,left:0,center:0,right:0},pd={full:0,left:0,center:0,right:0},Sm=class extends Dt{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 RW,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(Bn(()=>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);mo.full=this._canvas.width,mo.left=e,mo.center=t,mo.right=e,this._refreshDrawHeightConstants(),pd.full=1,pd.left=1,pd.center=1+mo.left,pd.right=1+mo.left+mo.center}_refreshDrawHeightConstants(){Ds.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);Ds.left=t,Ds.center=t,Ds.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Ds.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(pd[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Ds[e.position||"full"]/2),mo[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Ds[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}))}};Sm=Yn([Ue(2,ar),Ue(3,Mh),Ue(4,za),Ue(5,or),Ue(6,pu),Ue(7,$a)],Sm);var Ae;(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=""))(Ae||={});var zp;(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="Ÿ"))(zp||={});var t3;(e=>e.ST=`${Ae.ESC}\\`)(t3||={});var Aw=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(`${Ae.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)}}};Aw=Yn([Ue(2,ar),Ue(3,or),Ue(4,Bl),Ue(5,za)],Aw);var Ri=0,Mi=0,Ni=0,Vn=0,TA={css:"#00000000",rgba:0},di;(e=>{function t(s,o,l,d){return d!==void 0?`#${cl(s)}${cl(o)}${cl(l)}${cl(d)}`:`#${cl(s)}${cl(o)}${cl(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})(di||={});var Mn;(e=>{function t(f,p){if(Vn=(p.rgba&255)/255,Vn===1)return{css:p.css,rgba:p.rgba};let m=p.rgba>>24&255,y=p.rgba>>16&255,_=p.rgba>>8&255,w=f.rgba>>24&255,S=f.rgba>>16&255,x=f.rgba>>8&255;Ri=w+Math.round((m-w)*Vn),Mi=S+Math.round((y-S)*Vn),Ni=x+Math.round((_-x)*Vn);let k=di.toCss(Ri,Mi,Ni),C=di.toRgba(Ri,Mi,Ni);return{css:k,rgba:C}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,p,m){let y=Fp.ensureContrastRatio(f.rgba,p.rgba,m);if(y)return di.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=i;function s(f){let p=(f.rgba|255)>>>0;return[Ri,Mi,Ni]=Fp.toChannels(p),{css:di.toCss(Ri,Mi,Ni),rgba:p}}e.opaque=s;function o(f,p){return Vn=Math.round(p*255),[Ri,Mi,Ni]=Fp.toChannels(f.rgba),{css:di.toCss(Ri,Mi,Ni,Vn),rgba:di.toRgba(Ri,Mi,Ni,Vn)}}e.opacity=o;function l(f,p){return Vn=f.rgba&255,o(f,Vn*p/255)}e.multiplyOpacity=l;function d(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=d})(Mn||={});var zn;(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 Ri=parseInt(s.slice(1,2).repeat(2),16),Mi=parseInt(s.slice(2,3).repeat(2),16),Ni=parseInt(s.slice(3,4).repeat(2),16),di.toColor(Ri,Mi,Ni);case 5:return Ri=parseInt(s.slice(1,2).repeat(2),16),Mi=parseInt(s.slice(2,3).repeat(2),16),Ni=parseInt(s.slice(3,4).repeat(2),16),Vn=parseInt(s.slice(4,5).repeat(2),16),di.toColor(Ri,Mi,Ni,Vn);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 Ri=parseInt(o[1]),Mi=parseInt(o[2]),Ni=parseInt(o[3]),Vn=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),di.toColor(Ri,Mi,Ni,Vn);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),[Ri,Mi,Ni,Vn]=t.getImageData(0,0,1,1).data,Vn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:di.toRgba(Ri,Mi,Ni,Vn),css:s}}e.toColor=i})(zn||={});var Qi;(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})(Qi||={});var Fp;(e=>{function t(l,d){if(Vn=(d&255)/255,Vn===1)return d;let f=d>>24&255,p=d>>16&255,m=d>>8&255,y=l>>24&255,_=l>>16&255,w=l>>8&255;return Ri=y+Math.round((f-y)*Vn),Mi=_+Math.round((p-_)*Vn),Ni=w+Math.round((m-w)*Vn),di.toRgba(Ri,Mi,Ni)}e.blend=t;function n(l,d,f){let p=Qi.relativeLuminance(l>>8),m=Qi.relativeLuminance(d>>8);if(Ca(p,m)<f){if(m<p){let w=i(l,d,f),S=Ca(p,Qi.relativeLuminance(w>>8));if(S<f){let x=s(l,d,f),k=Ca(p,Qi.relativeLuminance(x>>8));return S>k?w:x}return w}let y=s(l,d,f),_=Ca(p,Qi.relativeLuminance(y>>8));if(_<f){let w=i(l,d,f),S=Ca(p,Qi.relativeLuminance(w>>8));return _>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,_=d>>24&255,w=d>>16&255,S=d>>8&255,x=Ca(Qi.relativeLuminance2(_,w,S),Qi.relativeLuminance2(p,m,y));for(;x<f&&(_>0||w>0||S>0);)_-=Math.max(0,Math.ceil(_*.1)),w-=Math.max(0,Math.ceil(w*.1)),S-=Math.max(0,Math.ceil(S*.1)),x=Ca(Qi.relativeLuminance2(_,w,S),Qi.relativeLuminance2(p,m,y));return(_<<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,_=d>>24&255,w=d>>16&255,S=d>>8&255,x=Ca(Qi.relativeLuminance2(_,w,S),Qi.relativeLuminance2(p,m,y));for(;x<f&&(_<255||w<255||S<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),w=Math.min(255,w+Math.ceil((255-w)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),x=Ca(Qi.relativeLuminance2(_,w,S),Qi.relativeLuminance2(p,m,y));return(_<<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})(Fp||={});function cl(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Ca(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var MW=class extends Rh{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()]}},xm=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new ls}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||To.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++)xm._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||To.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}};xm=Yn([Ue(0,ar)],xm);function NW(e){return 57508<=e&&e<=57558}function LW(e){return 9472<=e&&e<=9631}function OW(e){return NW(e)||LW(e)}function IW(){return{css:{canvas:np(),cell:np()},device:{canvas:np(),cell:np(),char:{width:0,height:0,left:0,top:0}}}}function np(){return{width:0,height:0}}var Tw=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 ls,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=[],_=this._characterJoinerService.getJoinedCharacters(t),w=this._themeService.colors,S=e.getNoBgTrimmedLength();n&&S<o+1&&(S=o+1);let x,k=0,C="",B=0,H=0,T=0,$=0,j=!1,M=0,V=!1,Y=0,te=0,J=[],P=p!==-1&&m!==-1;for(let N=0;N<S;N++){e.loadCell(N,this._workCell);let I=this._workCell.getWidth();if(I===0)continue;let D=!1,E=N>=te,L=N,R=this._workCell;if(_.length>0&&N===_[0][0]&&E){let Re=_.shift(),ze=this._isCellInSelection(Re[0],t);for(B=Re[0]+1;B<Re[1];B++)E&&=ze===this._isCellInSelection(B,t);E&&=!n||o<Re[0]||o>=Re[1],E?(D=!0,R=new MW(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),L=Re[1]-1,I=R.getWidth()):te=Re[1]}let q=this._isCellInSelection(N,t),U=n&&N===o,O=P&&N>=p&&N<=m,W=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{W=!0});let K=R.getChars()||To;if(K===" "&&(R.isUnderline()||R.isOverline())&&(K=" "),Y=I*d-f.get(K,R.isBold(),R.isItalic()),!x)x=this._document.createElement("span");else if(k&&(q&&V||!q&&!V&&R.bg===H)&&(q&&V&&w.selectionForeground||R.fg===T)&&R.extended.ext===$&&O===j&&Y===M&&!U&&!D&&!W&&E){R.isInvisible()?C+=To:C+=K,k++;continue}else k&&(x.textContent=C),x=this._document.createElement("span"),k=0,C="";if(H=R.bg,T=R.fg,$=R.extended.ext,j=O,M=Y,V=q,D&&o>=N&&o<=L&&(o=N),!this._coreService.isCursorHidden&&U&&this._coreService.isCursorInitialized){if(J.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&J.push("xterm-cursor-blink"),J.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":J.push("xterm-cursor-outline");break;case"block":J.push("xterm-cursor-block");break;case"bar":J.push("xterm-cursor-bar");break;case"underline":J.push("xterm-cursor-underline");break}}if(R.isBold()&&J.push("xterm-bold"),R.isItalic()&&J.push("xterm-italic"),R.isDim()&&J.push("xterm-dim"),R.isInvisible()?C=To:C=R.getChars()||To,R.isUnderline()&&(J.push(`xterm-underline-${R.extended.underlineStyle}`),C===" "&&(C=" "),!R.isUnderlineColorDefault()))if(R.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Rh.toColorRGB(R.getUnderlineColor()).join(",")})`;else{let Re=R.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&R.isBold()&&Re<8&&(Re+=8),x.style.textDecorationColor=w.ansi[Re].css}R.isOverline()&&(J.push("xterm-overline"),C===" "&&(C=" ")),R.isStrikethrough()&&J.push("xterm-strikethrough"),O&&(x.style.textDecoration="underline");let z=R.getFgColor(),G=R.getFgColorMode(),Z=R.getBgColor(),se=R.getBgColorMode(),Se=!!R.isInverse();if(Se){let Re=z;z=Z,Z=Re;let ze=G;G=se,se=ze}let pe,$e,je=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Re=>{Re.options.layer!=="top"&&je||(Re.backgroundColorRGB&&(se=50331648,Z=Re.backgroundColorRGB.rgba>>8&16777215,pe=Re.backgroundColorRGB),Re.foregroundColorRGB&&(G=50331648,z=Re.foregroundColorRGB.rgba>>8&16777215,$e=Re.foregroundColorRGB),je=Re.options.layer==="top")}),!je&&q&&(pe=this._coreBrowserService.isFocused?w.selectionBackgroundOpaque:w.selectionInactiveBackgroundOpaque,Z=pe.rgba>>8&16777215,se=50331648,je=!0,w.selectionForeground&&(G=50331648,z=w.selectionForeground.rgba>>8&16777215,$e=w.selectionForeground)),je&&J.push("xterm-decoration-top");let St;switch(se){case 16777216:case 33554432:St=w.ansi[Z],J.push(`xterm-bg-${Z}`);break;case 50331648:St=di.toColor(Z>>16,Z>>8&255,Z&255),this._addStyle(x,`background-color:#${RA((Z>>>0).toString(16),"0",6)}`);break;default:Se?(St=w.foreground,J.push("xterm-bg-257")):St=w.background}switch(pe||R.isDim()&&(pe=Mn.multiplyOpacity(St,.5)),G){case 16777216:case 33554432:R.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(x,St,w.ansi[z],R,pe,void 0)||J.push(`xterm-fg-${z}`);break;case 50331648:let Re=di.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(x,St,Re,R,pe,$e)||this._addStyle(x,`color:#${RA(z.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,St,w.foreground,R,pe,$e)||Se&&J.push("xterm-fg-257")}J.length&&(x.className=J.join(" "),J.length=0),!U&&!D&&!W&&E?k++:x.textContent=C,Y!==this.defaultSpacing&&(x.style.letterSpacing=`${Y}px`),y.push(x),N=L}return x&&k&&(x.textContent=C),y}_applyMinimumContrast(e,t,n,i,s,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||OW(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=Mn.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]}};Tw=Yn([Ue(1,BL),Ue(2,or),Ue(3,$a),Ue(4,Bl),Ue(5,Mh),Ue(6,pu)],Tw);function RA(e,t,n){for(;e.length<n;)e=t+e;return e}var jW=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}},DW=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 BW(){return new DW}var p_="xterm-dom-renderer-owner-",Xr="xterm-rows",ip="xterm-fg-",MA="xterm-bg-",md="xterm-focus",rp="xterm-selection",PW=1,Rw=class extends Dt{constructor(e,t,n,i,s,o,l,d,f,p,m,y,_,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=_,this._themeService=w,this._terminalClass=PW++,this._rowElements=[],this._selectionRenderModel=BW(),this.onRequestRedraw=this._register(new Le).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Xr),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(rp),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=IW(),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(Tw,document),this._element.classList.add(p_+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(Bn(()=>{this._element.classList.remove(p_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new jW(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} .${Xr} 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} .${Xr} { 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} .${Xr} .xterm-dim { color: ${Mn.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} .${Xr}.${md} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Xr}.${md} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Xr}.${md} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Xr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Xr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Xr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Xr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Xr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${rp} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${rp} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${rp} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${ip}${o} { color: ${l.css}; }${this._terminalSelector} .${ip}${o}.xterm-dim { color: ${Mn.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${MA}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${ip}257 { color: ${Mn.opaque(e.background).css}; }${this._terminalSelector} .${ip}257.xterm-dim { color: ${Mn.multiplyOpacity(Mn.opaque(e.background),.5).css}; }${this._terminalSelector} .${MA}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(md),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(md),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`.${p_}${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,_=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,_,p,m,this.dimensions.css.cell.width,this._widthCache,o?w===n?e:0:-1,o?(w===i?t:s)-1:-1))}}};Rw=Yn([Ue(7,HS),Ue(8,mg),Ue(9,or),Ue(10,ar),Ue(11,Bl),Ue(12,$a),Ue(13,pu)],Rw);var Mw=class extends Dt{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Le),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new zW(this._optionsService))}catch{this._measureStrategy=this._register(new $W(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())}};Mw=Yn([Ue(2,or)],Mw);var n3=class extends Dt{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)}},$W=class extends n3{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}},zW=class extends n3{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}},FW=class extends Dt{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 HW(this._window)),this._onDprChange=this._register(new Le),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Le),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(Wi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(wt(this._textarea,"focus",()=>this._isFocused=!0)),this._register(wt(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}},HW=class extends Dt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new tu),this._onDprChange=this._register(new Le),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Bn(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=wt(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)}},UW=class extends Dt{constructor(){super(),this.linkProviders=[],this._register(Bn(()=>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 XS(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 WW(e,t,n,i,s,o,l,d,f){if(!o)return;let p=XS(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 Nw=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,s){return WW(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=XS(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])}}};Nw=Yn([Ue(0,za),Ue(1,mg)],Nw);var qW=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=[]}},i3={};tU(i3,{getSafariVersion:()=>KW,isChromeOS:()=>o3,isFirefox:()=>r3,isIpad:()=>VW,isIphone:()=>YW,isLegacyEdge:()=>GW,isLinux:()=>ZS,isMac:()=>km,isNode:()=>gg,isSafari:()=>s3,isWindows:()=>a3});var gg=typeof process<"u"&&"title"in process,Nh=gg?"node":navigator.userAgent,Lh=gg?"node":navigator.platform,r3=Nh.includes("Firefox"),GW=Nh.includes("Edge"),s3=/^((?!chrome|android).)*safari/i.test(Nh);function KW(){if(!s3)return 0;let e=Nh.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var km=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Lh),VW=Lh==="iPad",YW=Lh==="iPhone",a3=["Windows","Win16","Win32","WinCE"].includes(Lh),ZS=Lh.indexOf("Linux")>=0,o3=/\bCrOS\b/.test(Nh),l3=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()}},XW=class extends l3{_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())}}},ZW=class extends l3{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Cm=!gg&&"requestIdleCallback"in window?ZW:XW,JW=class{constructor(){this._queue=new Cm}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Lw=class extends Dt{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 tu),this._pausedResizeTask=new JW,this._observerDisposable=this._register(new tu),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 Le),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Le),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Le),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Le),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new qW((p,m)=>this._renderRows(p,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new QW(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Bn(()=>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=Bn(()=>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()}};Lw=Yn([Ue(2,or),Ue(3,mg),Ue(4,Bl),Ue(5,Mh),Ue(6,ar),Ue(7,$a),Ue(8,pu)],Lw);var QW=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 eq(e,t,n,i){let s=n.buffer.x,o=n.buffer.y;if(!n.buffer.hasScrollback)return iq(s,o,e,t,n,i)+yg(o,t,n,i)+rq(s,o,e,t,n,i);let l;if(o===t)return l=s>e?"D":"C",dh(Math.abs(s-e),uh(l,i));l=o>t?"D":"C";let d=Math.abs(o-t),f=nq(o>t?e:s,n)+(d-1)*n.cols+1+tq(o>t?s:e);return dh(f,uh(l,i))}function tq(e,t){return e-1}function nq(e,t){return t.cols-e}function iq(e,t,n,i,s,o){return yg(t,i,s,o).length===0?"":dh(u3(e,t,e,t-Ll(t,s),!1,s).length,uh("D",o))}function yg(e,t,n,i){let s=e-Ll(e,n),o=t-Ll(t,n),l=Math.abs(s-o)-sq(e,t,n);return dh(l,uh(c3(e,t),i))}function rq(e,t,n,i,s,o){let l;yg(t,i,s,o).length>0?l=i-Ll(i,s):l=t;let d=i,f=aq(e,t,n,i,s,o);return dh(u3(e,l,n,d,f==="C",s).length,uh(f,o))}function sq(e,t,n){let i=0,s=e-Ll(e,n),o=t-Ll(t,n);for(let l=0;l<Math.abs(s-o);l++){let d=c3(e,t)==="A"?-1:1;n.buffer.lines.get(s+d*l)?.isWrapped&&i++}return i}function Ll(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 aq(e,t,n,i,s,o){let l;return yg(n,i,s,o).length>0?l=i-Ll(i,s):l=t,e<n&&l<=i||e>=n&&l<i?"C":"D"}function c3(e,t){return e>t?"A":"B"}function u3(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 uh(e,t){let n=t?"O":"[";return Ae.ESC+n+e}function dh(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var oq=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 NA(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 m_=50,lq=15,cq=50,uq=500,dq=" ",hq=new RegExp(dq,"g"),Ow=class extends Dt{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 ls,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Le),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Le),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Le),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Le),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 oq(this._bufferService),this._activeSelectionMode=0,this._register(Bn(()=>{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(hq," ")).join(a3?`\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())),ZS&&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=NA(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=XS(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,-m_),m_),t/=m_,t/Math.abs(t)+Math.round(t*(lq-1)))}shouldForceSelection(e){return km?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(),cq)}_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&&!(km&&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<uq&&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=eq(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,_=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],C=e[0];o.getWidth(k)===0&&(m++,k--),o.getWidth(C)===2&&(y++,C++);let B=o.getString(C).length;for(B>1&&(w+=B-1,f+=B-1);k>0&&d>0&&!this._isCharWordSeparator(o.loadCell(k-1,this._workCell));){o.loadCell(k-1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,k--):H>1&&(_+=H-1,d-=H-1),d--,k--}for(;C<o.length&&f+1<l.length&&!this._isCharWordSeparator(o.loadCell(C+1,this._workCell));){o.loadCell(C+1,this._workCell);let H=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,C++):H>1&&(w+=H-1,f+=H-1),f++,C++}}f++;let S=d+p-m+_,x=Math.min(this._bufferService.cols,f-d+m+y-_-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 C=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(C){let B=this._bufferService.cols-C.start;S-=B,x+=B}}}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 C=this._getWordAt([0,e[1]+1],!1,!1,!0);C&&(x+=C.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=NA(n,this._bufferService.cols)}};Ow=Yn([Ue(3,ar),Ue(4,Bl),Ue(5,US),Ue(6,or),Ue(7,za),Ue(8,$a)],Ow);var LA=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={}}},OA=class{constructor(){this._color=new LA,this._css=new LA}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()}},yi=Object.freeze((()=>{let e=[zn.toColor("#2e3436"),zn.toColor("#cc0000"),zn.toColor("#4e9a06"),zn.toColor("#c4a000"),zn.toColor("#3465a4"),zn.toColor("#75507b"),zn.toColor("#06989a"),zn.toColor("#d3d7cf"),zn.toColor("#555753"),zn.toColor("#ef2929"),zn.toColor("#8ae234"),zn.toColor("#fce94f"),zn.toColor("#729fcf"),zn.toColor("#ad7fa8"),zn.toColor("#34e2e2"),zn.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:di.toCss(i,s,o),rgba:di.toRgba(i,s,o)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:di.toCss(i,i,i),rgba:di.toRgba(i,i,i)})}return e})()),hl=zn.toColor("#ffffff"),Pd=zn.toColor("#000000"),IA=zn.toColor("#ffffff"),jA=Pd,gd={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},fq=hl,Iw=class extends Dt{constructor(e){super(),this._optionsService=e,this._contrastCache=new OA,this._halfContrastCache=new OA,this._onChangeColors=this._register(new Le),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:hl,background:Pd,cursor:IA,cursorAccent:jA,selectionForeground:void 0,selectionBackgroundTransparent:gd,selectionBackgroundOpaque:Mn.blend(Pd,gd),selectionInactiveBackgroundTransparent:gd,selectionInactiveBackgroundOpaque:Mn.blend(Pd,gd),scrollbarSliderBackground:Mn.opacity(hl,.2),scrollbarSliderHoverBackground:Mn.opacity(hl,.4),scrollbarSliderActiveBackground:Mn.opacity(hl,.5),overviewRulerBorder:hl,ansi:yi.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=_n(e.foreground,hl),t.background=_n(e.background,Pd),t.cursor=Mn.blend(t.background,_n(e.cursor,IA)),t.cursorAccent=Mn.blend(t.background,_n(e.cursorAccent,jA)),t.selectionBackgroundTransparent=_n(e.selectionBackground,gd),t.selectionBackgroundOpaque=Mn.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=_n(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Mn.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?_n(e.selectionForeground,TA):void 0,t.selectionForeground===TA&&(t.selectionForeground=void 0),Mn.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Mn.opacity(t.selectionBackgroundTransparent,.3)),Mn.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Mn.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=_n(e.scrollbarSliderBackground,Mn.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=_n(e.scrollbarSliderHoverBackground,Mn.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=_n(e.scrollbarSliderActiveBackground,Mn.opacity(t.foreground,.5)),t.overviewRulerBorder=_n(e.overviewRulerBorder,fq),t.ansi=yi.slice(),t.ansi[0]=_n(e.black,yi[0]),t.ansi[1]=_n(e.red,yi[1]),t.ansi[2]=_n(e.green,yi[2]),t.ansi[3]=_n(e.yellow,yi[3]),t.ansi[4]=_n(e.blue,yi[4]),t.ansi[5]=_n(e.magenta,yi[5]),t.ansi[6]=_n(e.cyan,yi[6]),t.ansi[7]=_n(e.white,yi[7]),t.ansi[8]=_n(e.brightBlack,yi[8]),t.ansi[9]=_n(e.brightRed,yi[9]),t.ansi[10]=_n(e.brightGreen,yi[10]),t.ansi[11]=_n(e.brightYellow,yi[11]),t.ansi[12]=_n(e.brightBlue,yi[12]),t.ansi[13]=_n(e.brightMagenta,yi[13]),t.ansi[14]=_n(e.brightCyan,yi[14]),t.ansi[15]=_n(e.brightWhite,yi[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]=_n(e.extendedAnsi[i],yi[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()}}};Iw=Yn([Ue(0,or)],Iw);function _n(e,t){if(e!==void 0)try{return zn.toColor(e)}catch{}return t}var pq=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)}},mq=class{constructor(){this._services=new pq,this._services.set(HS,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=lU(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)}},gq={trace:0,debug:1,info:2,warn:3,error:4,off:5},yq="xterm.js: ",jw=class extends Dt{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=gq[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?"":yq)+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)}};jw=Yn([Ue(0,or)],jw);var DA=class extends Dt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Le),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Le),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Le),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}},jt=3,ci=Object.freeze(new Rh),sp=0,g_=2,$d=class d3{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*jt);let s=n||ls.fromCharData([0,ML,1,0]);for(let o=0;o<t;++o)this.setCell(o,s);this.length=t}get(t){let n=this._data[t*jt+0],i=n&2097151;return[this._data[t*jt+1],n&2097152?this._combined[t]:i?ko(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*jt+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*jt+0]=t|2097152|n[2]<<22):this._data[t*jt+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*jt+0]>>22}hasWidth(t){return this._data[t*jt+0]&12582912}getFg(t){return this._data[t*jt+1]}getBg(t){return this._data[t*jt+2]}hasContent(t){return this._data[t*jt+0]&4194303}getCodePoint(t){let n=this._data[t*jt+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*jt+0]&2097152}getString(t){let n=this._data[t*jt+0];return n&2097152?this._combined[t]:n&2097151?ko(n&2097151):""}isProtected(t){return this._data[t*jt+2]&536870912}loadCell(t,n){return sp=t*jt,n.content=this._data[sp+0],n.fg=this._data[sp+1],n.bg=this._data[sp+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*jt+0]=n.content,this._data[t*jt+1]=n.fg,this._data[t*jt+2]=n.bg}setCellFromCodepoint(t,n,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*jt+0]=n|i<<22,this._data[t*jt+1]=s.fg,this._data[t*jt+2]=s.bg}addCodepointToCell(t,n,i){let s=this._data[t*jt+0];s&2097152?this._combined[t]+=ko(n):s&2097151?(this._combined[t]=ko(s&2097151)+ko(n),s&=-2097152,s|=2097152):s=n|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*jt+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 ls;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 ls;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*g_<this._data.buffer.byteLength;let i=t*jt;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*g_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*g_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new d3(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*jt+0]&4194303)return t+(this._data[t*jt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*jt+0]&4194303||this._data[t*jt+2]&50331648)return t+(this._data[t*jt+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<jt;p++)this._data[(i+f)*jt+p]=l[(n+f)*jt+p];l[(n+f)*jt+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}else for(let f=0;f<s;f++){for(let p=0;p<jt;p++)this._data[(i+f)*jt+p]=l[(n+f)*jt+p];l[(n+f)*jt+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*jt+0],d=l&2097151,f=l&2097152?this._combined[n]:d?ko(d):To;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 vq(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,_=hh(m,y,t),w=1,S=0;for(;w<m.length;){let k=hh(m,w,t),C=k-S,B=n-_,H=Math.min(C,B);m[y].copyCellsFrom(m[w],S,_,H,!1),_+=H,_===n&&(y++,_=0),S+=H,S===k&&(w++,S=0),_===0&&y!==0&&m[y-1].getWidth(n-1)===2&&(m[y].copyCellsFrom(m[y-1],n-1,_++,1,!1),m[y-1].setCell(n-1,s))}m[y].replaceCells(_,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 _q(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 bq(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 wq(e,t,n){let i=[],s=e.map((f,p)=>hh(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=hh(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 hh(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 h3=class f3{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=f3._nextId++,this._onDispose=this.register(new Le),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nl(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};h3._nextId=1;var Sq=h3,wi={},fl=wi.B;wi[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:"≥","{":"π","|":"≠","}":"£","~":"·"};wi.A={"#":"£"};wi.B=void 0;wi[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};wi.C=wi[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};wi.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};wi.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};wi.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};wi.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};wi.E=wi[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};wi.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};wi.H=wi[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};wi["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var BA=4294967295,PA=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=ci.clone(),this.savedCharset=fl,this.markers=[],this._nullCell=ls.fromCharData([0,ML,1,0]),this._whitespaceCell=ls.fromCharData([0,To,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Cm,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new DA(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 wm),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 wm),this._whitespaceCell}getBlankLine(e,t){return new $d(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>BA?BA:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=ci);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 DA(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(ci),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 $d(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 $d(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=vq(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(ci),n);if(i.length>0){let s=_q(this.lines,i);bq(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(ci),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new $d(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(ci),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 H=this.ybase+this.y;if(H>=l&&H<l+f.length)continue}let p=f[f.length-1].getTrimmedLength(),m=wq(f,this._cols,e),y=m.length-f.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+y):_=Math.max(0,this.lines.length-this.lines.maxLength+y);let w=[];for(let H=0;H<y;H++){let T=this.getBlankLine(ci,!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,C=p;for(;k>=0;){let H=Math.min(C,x);if(f[S]===void 0)break;if(f[S].copyCellsFrom(f[k],C-H,x-H,H,!0),x-=H,x===0&&(S--,x=m[S]),C-=H,C===0){k--;let T=Math.max(k,0);C=hh(f,T,this._cols)}}for(let H=0;H<f.length;H++)m[H]<e&&f[H].setCell(m[H],i);let B=y-_;for(;B-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+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 _=0;for(let x=Math.min(this.lines.maxLength-1,f+o-1);x>=0;x--)if(y&&y.start>p+_){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}),_+=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 Sq(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)}},xq=class extends Dt{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Le),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 PA(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new PA(!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)}},p3=2,m3=1,Dw=class extends Dt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Le),this.onResize=this._onResize.event,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p3),this.rows=Math.max(e.rawOptions.rows||0,m3),this.buffers=this._register(new xq(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))}};Dw=Yn([Ue(0,or)],Dw);var yc={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:km,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},kq=["normal","bold","100","200","300","400","500","600","700","800","900"],Cq=class extends Dt{constructor(e){super(),this._onOptionChange=this._register(new Le),this.onOptionChange=this._onOptionChange.event;let t={...yc};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(Bn(()=>{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 yc))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in yc))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=yc[e]),!Eq(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=yc[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=kq.includes(t)?t:yc[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 Eq(e){return e==="block"||e==="underline"||e==="bar"}function zd(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]&&zd(e[i],t-1);return n}var $A=Object.freeze({insertMode:!1}),zA=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Bw=class extends Dt{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 Le),this.onData=this._onData.event,this._onUserInput=this._register(new Le),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Le),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Le),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=zd($A),this.decPrivateModes=zd(zA)}reset(){this.modes=zd($A),this.decPrivateModes=zd(zA)}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))}};Bw=Yn([Ue(0,ar),Ue(1,jL),Ue(2,or)],Bw);var FA={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function y_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var v_=String.fromCharCode,HA={DEFAULT:e=>{let t=[y_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${v_(t[0])}${v_(t[1])}${v_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${y_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${y_(e,!0)};${e.x};${e.y}${t}`}},Pw=class extends Dt{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 Le),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(FA))this.addProtocol(i,FA[i]);for(let i of Object.keys(HA))this.addEncoding(i,HA[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)}};Pw=Yn([Ue(0,ar),Ue(1,Bl),Ue(2,or)],Pw);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]],Aq=[[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]],vi;function Tq(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 Rq=class{constructor(){if(this.version="6",!vi){vi=new Uint8Array(65536),vi.fill(1),vi[0]=0,vi.fill(0,1,32),vi.fill(0,127,160),vi.fill(2,4352,4448),vi[9001]=2,vi[9002]=2,vi.fill(2,11904,42192),vi[12351]=1,vi.fill(2,44032,55204),vi.fill(2,63744,64256),vi.fill(2,65040,65050),vi.fill(2,65072,65136),vi.fill(2,65280,65377),vi.fill(2,65504,65511);for(let e=0;e<__.length;++e)vi.fill(0,__[e][0],__[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?vi[e]:Tq(e,Aq)?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=yl.extractWidth(t);s===0?i=!1:s>n&&(n=s)}return yl.createPropertyValue(0,n,i)}},yl=class Hp{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Le,this.onChange=this._onChange.event;let t=new Rq;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=Hp.extractWidth(d);Hp.extractShouldJoin(d)&&(f-=Hp.extractWidth(i)),n+=f,i=d}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Mq=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 UA(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 yd=2147483647,Nq=256,g3=class $w{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>Nq)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 $w;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 $w(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>yd?yd: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>yd?yd: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,yd):t}},vd=[],Lq=class{constructor(){this._state=0,this._active=vd,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=vd}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=vd,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||vd,!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",pg(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=vd,this._id=-1,this._state=0}}},Lr=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+=pg(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}},_d=[],Oq=class{constructor(){this._handlers=Object.create(null),this._active=_d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_d}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=_d,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||_d,!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",pg(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=_d,this._ident=0}},Fd=new g3;Fd.addParam(0);var WA=class{constructor(e){this._handler=e,this._data="",this._params=Fd,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Fd,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=pg(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=Fd,this._data="",this._hitLimit=!1,n));return this._params=Fd,this._data="",this._hitLimit=!1,t}},Iq=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}},ss=160,jq=(function(){let e=new Iq(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(ss,0,2,0),e.add(ss,8,5,8),e.add(ss,6,0,6),e.add(ss,11,0,11),e.add(ss,13,13,13),e})(),Dq=class extends Dt{constructor(e=jq){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 g3,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(Bn(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Lq),this._dcsParser=this._register(new Oq),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:ss)],s>>4){case 2:for(let _=d+1;;++_){if(_>=t||(i=e[_])<32||i>126&&i<ss){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<ss){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<ss){this._printHandler(e,d,_),d=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<ss){this._printHandler(e,d,_),d=_-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 _=d+1;;++_)if(_>=t||(i=e[_])===24||i===26||i===27||i>127&&i<ss){this._dcsParser.put(e,d,_),d=_-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 _=d+1;;_++)if(_>=t||(i=e[_])<32||i>127&&i<ss){this._oscParser.put(e,d,_),d=_-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}}},Bq=/^([\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})$/,Pq=/^[\da-f]+$/;function qA(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=Bq.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),Pq.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 b_(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 $q(e,t=16){let[n,i,s]=e;return`rgb:${b_(n,t)}/${b_(i,t)}/${b_(s,t)}`}var zq={"(":0,")":1,"*":2,"+":3,"-":1,".":2},go=131072,GA=10;function KA(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 VA=5e3,YA=0,Fq=class extends Dt{constructor(e,t,n,i,s,o,l,d,f=new Dq){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 aU,this._utf8Decoder=new oU,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=ci.clone(),this._eraseAttrDataInternal=ci.clone(),this._onRequestBell=this._register(new Le),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Le),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Le),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Le),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Le),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Le),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Le),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Le),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Le),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Le),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Le),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Le),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Le),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 zw(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(Ae.BEL,()=>this.bell()),this._parser.setExecuteHandler(Ae.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ae.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Ae.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Ae.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Ae.BS,()=>this.backspace()),this._parser.setExecuteHandler(Ae.HT,()=>this.tab()),this._parser.setExecuteHandler(Ae.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Ae.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(zp.IND,()=>this.index()),this._parser.setExecuteHandler(zp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(zp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Lr(p=>(this.setTitle(p),this.setIconName(p),!0))),this._parser.registerOscHandler(1,new Lr(p=>this.setIconName(p))),this._parser.registerOscHandler(2,new Lr(p=>this.setTitle(p))),this._parser.registerOscHandler(4,new Lr(p=>this.setOrReportIndexedColor(p))),this._parser.registerOscHandler(8,new Lr(p=>this.setHyperlink(p))),this._parser.registerOscHandler(10,new Lr(p=>this.setOrReportFgColor(p))),this._parser.registerOscHandler(11,new Lr(p=>this.setOrReportBgColor(p))),this._parser.registerOscHandler(12,new Lr(p=>this.setOrReportCursorColor(p))),this._parser.registerOscHandler(104,new Lr(p=>this.restoreIndexedColor(p))),this._parser.registerOscHandler(110,new Lr(p=>this.restoreFgColor(p))),this._parser.registerOscHandler(111,new Lr(p=>this.restoreBgColor(p))),this._parser.registerOscHandler(112,new Lr(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 wi)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 WA((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"),VA))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${VA} 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>go&&(o=this._parseStack.position+go)}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<go&&(this._parseBuffer=new Uint32Array(Math.min(e.length,go))),l||this._dirtyRowTracker.clearRange(),e.length>go)for(let p=o;p<e.length;p+=go){let m=p+go<e.length?p+go: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 _=this._parser.precedingJoinState;for(let w=t;w<n;++w){if(i=e[w],i<127&&o){let C=o[String.fromCharCode(i)];C&&(i=C.charCodeAt(0))}let S=this._unicodeService.charProperties(i,_);s=yl.extractWidth(S);let x=yl.extractShouldJoin(S),k=x?yl.extractWidth(_):0;if(_=S,l&&this._onA11yChar.fire(ko(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-k>d){if(f){let C=y,B=this._activeBuffer.x-k;for(this._activeBuffer.x=k,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),k>0&&y instanceof $d&&y.copyCellsFrom(C,B,0,k,!1);B<d;)C.setCellFromCodepoint(B++,0,1,m)}else if(this._activeBuffer.x=d-1,s===2)continue}if(x&&this._activeBuffer.x){let C=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-C,i,s);for(let B=s-k;--B>=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=_,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=>KA(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new WA(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Lr(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(ci));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=yl.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(Ae.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(Ae.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(Ae.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(Ae.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(Ae.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,fl),this._charsetService.setgCharset(1,fl),this._charsetService.setgCharset(2,fl),this._charsetService.setgCharset(3,fl);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,_=(x,k)=>(l.triggerDataEvent(`${Ae.ESC}[${t?"":"?"}${x};${k}$y`),!0),w=x=>x?1:2,S=e.params[0];return t?S===2?_(S,4):S===4?_(S,w(l.modes.insertMode)):S===12?_(S,3):S===20?_(S,w(y.convertEol)):_(S,0):S===1?_(S,w(i.applicationCursorKeys)):S===3?_(S,y.windowOptions.setWinLines?f===80?2:f===132?1:0:0):S===6?_(S,w(i.origin)):S===7?_(S,w(i.wraparound)):S===8?_(S,3):S===9?_(S,w(s==="X10")):S===12?_(S,w(y.cursorBlink)):S===25?_(S,w(!l.isCursorHidden)):S===45?_(S,w(i.reverseWraparound)):S===66?_(S,w(i.applicationKeypad)):S===67?_(S,4):S===1e3?_(S,w(s==="VT200")):S===1002?_(S,w(s==="DRAG")):S===1003?_(S,w(s==="ANY")):S===1004?_(S,w(i.sendFocus)):S===1005?_(S,4):S===1006?_(S,w(o==="SGR")):S===1015?_(S,4):S===1016?_(S,w(o==="SGR_PIXELS")):S===1048?_(S,1):S===47||S===1047||S===1049?_(S,w(p===m)):S===2004?_(S,w(i.bracketedPasteMode)):S===2026?_(S,w(i.synchronizedOutput)):_(S,0)}_updateAttrColor(e,t,n,i,s){return t===2?(e|=50331648,e&=-16777216,e|=Rh.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=ci.fg,e.bg=ci.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|=ci.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=ci.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|=ci.fg&16777215,i.bg&=-67108864,i.bg|=ci.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Ae.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Ae.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(`${Ae.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=ci.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(!KA(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(`${Ae.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>GA&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>GA&&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(XA(o))if(s==="?")t.push({type:0,index:o});else{let l=qA(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=qA(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]);XA(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,fl),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(zq[e[0]],wi[e[1]]||fl),!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=ci.clone(),this._eraseAttrDataInternal=ci.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 ls;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(`${Ae.ESC}${l}${Ae.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)}},zw=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&&(YA=e,e=t,t=YA),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};zw=Yn([Ue(0,ar)],zw);function XA(e){return 0<=e&&e<256}var Hq=5e7,ZA=12,Uq=50,Wq=class extends Dt{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 Le),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>Hq)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>=ZA?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>=ZA)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Uq&&(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()}},Fw=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)))}};Fw=Yn([Ue(0,ar)],Fw);var JA=!1,qq=class extends Dt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new tu),this._onBinary=this._register(new Le),this.onBinary=this._onBinary.event,this._onData=this._register(new Le),this.onData=this._onData.event,this._onLineFeed=this._register(new Le),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Le),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Le),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Le),this._instantiationService=new mq,this.optionsService=this._register(new Cq(e)),this._instantiationService.setService(or,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Dw)),this._instantiationService.setService(ar,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(jw)),this._instantiationService.setService(jL,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Bw)),this._instantiationService.setService(Bl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Pw)),this._instantiationService.setService(IL,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(yl)),this._instantiationService.setService(dU,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Mq),this._instantiationService.setService(uU,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Fw),this._instantiationService.setService(DL,this._oscLinkService),this._inputHandler=this._register(new Fq(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Wi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Wi.forward(this._bufferService.onResize,this._onResize)),this._register(Wi.forward(this.coreService.onData,this._onData)),this._register(Wi.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new Wq((t,n)=>this._inputHandler.parse(t,n))),this._register(Wi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Le),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&&!JA&&(this._logService.warn("writeSync is unreliable and will be removed soon."),JA=!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,p3),t=Math.max(t,m3),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(UA.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(UA(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Bn(()=>{for(let t of e)t.dispose()})}}},Gq={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 Kq(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=Ae.ESC+"OA":s.key=Ae.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=Ae.ESC+"OD":s.key=Ae.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=Ae.ESC+"OC":s.key=Ae.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=Ae.ESC+"OB":s.key=Ae.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":Ae.DEL,e.altKey&&(s.key=Ae.ESC+s.key);break;case 9:if(e.shiftKey){s.key=Ae.ESC+"[Z";break}s.key=Ae.HT,s.cancel=!0;break;case 13:s.key=e.altKey?Ae.ESC+Ae.CR:Ae.CR,s.cancel=!0;break;case 27:s.key=Ae.ESC,e.altKey&&(s.key=Ae.ESC+Ae.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;o?s.key=Ae.ESC+"[1;"+(o+1)+"D":t?s.key=Ae.ESC+"OD":s.key=Ae.ESC+"[D";break;case 39:if(e.metaKey)break;o?s.key=Ae.ESC+"[1;"+(o+1)+"C":t?s.key=Ae.ESC+"OC":s.key=Ae.ESC+"[C";break;case 38:if(e.metaKey)break;o?s.key=Ae.ESC+"[1;"+(o+1)+"A":t?s.key=Ae.ESC+"OA":s.key=Ae.ESC+"[A";break;case 40:if(e.metaKey)break;o?s.key=Ae.ESC+"[1;"+(o+1)+"B":t?s.key=Ae.ESC+"OB":s.key=Ae.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=Ae.ESC+"[2~");break;case 46:o?s.key=Ae.ESC+"[3;"+(o+1)+"~":s.key=Ae.ESC+"[3~";break;case 36:o?s.key=Ae.ESC+"[1;"+(o+1)+"H":t?s.key=Ae.ESC+"OH":s.key=Ae.ESC+"[H";break;case 35:o?s.key=Ae.ESC+"[1;"+(o+1)+"F":t?s.key=Ae.ESC+"OF":s.key=Ae.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=Ae.ESC+"[5;"+(o+1)+"~":s.key=Ae.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=Ae.ESC+"[6;"+(o+1)+"~":s.key=Ae.ESC+"[6~";break;case 112:o?s.key=Ae.ESC+"[1;"+(o+1)+"P":s.key=Ae.ESC+"OP";break;case 113:o?s.key=Ae.ESC+"[1;"+(o+1)+"Q":s.key=Ae.ESC+"OQ";break;case 114:o?s.key=Ae.ESC+"[1;"+(o+1)+"R":s.key=Ae.ESC+"OR";break;case 115:o?s.key=Ae.ESC+"[1;"+(o+1)+"S":s.key=Ae.ESC+"OS";break;case 116:o?s.key=Ae.ESC+"[15;"+(o+1)+"~":s.key=Ae.ESC+"[15~";break;case 117:o?s.key=Ae.ESC+"[17;"+(o+1)+"~":s.key=Ae.ESC+"[17~";break;case 118:o?s.key=Ae.ESC+"[18;"+(o+1)+"~":s.key=Ae.ESC+"[18~";break;case 119:o?s.key=Ae.ESC+"[19;"+(o+1)+"~":s.key=Ae.ESC+"[19~";break;case 120:o?s.key=Ae.ESC+"[20;"+(o+1)+"~":s.key=Ae.ESC+"[20~";break;case 121:o?s.key=Ae.ESC+"[21;"+(o+1)+"~":s.key=Ae.ESC+"[21~";break;case 122:o?s.key=Ae.ESC+"[23;"+(o+1)+"~":s.key=Ae.ESC+"[23~";break;case 123:o?s.key=Ae.ESC+"[24;"+(o+1)+"~":s.key=Ae.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=Ae.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=Ae.DEL:e.keyCode===219?s.key=Ae.ESC:e.keyCode===220?s.key=Ae.FS:e.keyCode===221&&(s.key=Ae.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let l=Gq[e.keyCode]?.[e.shiftKey?1:0];if(l)s.key=Ae.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=Ae.ESC+f}else if(e.keyCode===32)s.key=Ae.ESC+(e.ctrlKey?Ae.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let d=e.code.slice(3,4);e.shiftKey||(d=d.toLowerCase()),s.key=Ae.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=Ae.US),e.key==="@"&&(s.key=Ae.NUL));break}return s}var ei=0,Vq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Cm,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Cm,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||(ei=this._search(t),ei===-1)||this._getKey(this._array[ei])!==t)return!1;do if(this._array[ei]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ei),!0;while(++ei<this._array.length&&this._getKey(this._array[ei])===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&&(ei=this._search(e),!(ei<0||ei>=this._array.length)&&this._getKey(this._array[ei])===e))do yield this._array[ei];while(++ei<this._array.length&&this._getKey(this._array[ei])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ei=this._search(e),!(ei<0||ei>=this._array.length)&&this._getKey(this._array[ei])===e))do t(this._array[ei]);while(++ei<this._array.length&&this._getKey(this._array[ei])===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}},w_=0,QA=0,Yq=class extends Dt{constructor(){super(),this._decorations=new Vq(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Le),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Le),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Bn(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Xq(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=>{w_=s.options.x??0,QA=w_+(s.options.width??1),e>=w_&&e<QA&&(!n||(s.options.layer??"bottom")===n)&&i(s)})}},Xq=class extends Oo{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Le),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Le),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=zn.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=zn.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Zq=1e3,Jq=class{constructor(e,t=Zq){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)}},eT=20,Em=class extends Dt{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 Jq(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(wt(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Bn(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<eT+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
94
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===eT+1&&(this._liveRegion.textContent+=ow.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 _=f<y.length?y[f]:y.slice(-1)[0]+1;return _>=this._terminal.cols&&(++m,_=0),{row:m,column:_}},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})`}};Em=Yn([Ue(1,HS),Ue(2,$a),Ue(3,za)],Em);var Hw=class extends Dt{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 Le),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Le),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Bn(()=>{Nl(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(wt(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(wt(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(wt(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(wt(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&&Qq(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,Nl(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}}};Hw=Yn([Ue(1,US),Ue(2,za),Ue(3,ar),Ue(4,PL)],Hw);function Qq(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 eG=class extends qq{constructor(e={}){super(e),this._linkifier=this._register(new tu),this.browser=i3,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new tu),this._onCursorMove=this._register(new Le),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Le),this.onKey=this._onKey.event,this._onRender=this._register(new Le),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Le),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Le),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Le),this.onBell=this._onBell.event,this._onFocus=this._register(new Le),this._onBlur=this._register(new Le),this._onA11yCharEmitter=this._register(new Le),this._onA11yTabEmitter=this._register(new Le),this._onWillOpen=this._register(new Le),this._setup(),this._decorationService=this._instantiationService.createInstance(Yq),this._instantiationService.setService(Mh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(UW),this._instantiationService.setService(PL,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(cw)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(Wi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Wi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Wi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Wi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Bn(()=>{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=Mn.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${Ae.ESC}]${i};${$q(s)}${t3.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=di.toColor(...t.color));else{let o=n;this._themeService.modifyColors(l=>l[o]=di.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(Em,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Ae.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(Ae.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(wt(this.element,"copy",t=>{this.hasSelection()&&rU(t,this._selectionService)}));let e=t=>sU(t,this.textarea,this.coreService,this.optionsService);this._register(wt(this.textarea,"paste",e)),this._register(wt(this.element,"paste",e)),r3?this._register(wt(this.element,"mousedown",t=>{t.button===2&&uA(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(wt(this.element,"contextmenu",t=>{uA(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ZS&&this._register(wt(this.element,"auxclick",t=>{t.button===1&&RL(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(wt(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(wt(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(wt(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(wt(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(wt(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(wt(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(wt(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(wt(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",aw.get()),o3||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(FW,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService($a,this._coreBrowserService),this._register(wt(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(wt(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Mw,this._document,this._helperContainer),this._instantiationService.setService(mg,this._charSizeService),this._themeService=this._instantiationService.createInstance(Iw),this._instantiationService.setService(pu,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(xm),this._instantiationService.setService(BL,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Lw,this.rows,this.screenElement)),this._instantiationService.setService(za,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(Aw,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Nw),this._instantiationService.setService(US,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Hw,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(Cw,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(Ow,this.element,this.screenElement,i)),this._instantiationService.setService(fU,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(Wi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Ew,this.screenElement)),this._register(wt(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(Em,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Sm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Sm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Rw,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(wt(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(wt(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=Ae.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){TL(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=Kq(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===Ae.ETX||n.key===Ae.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)&&(tG(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(ci));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(Ae.ESC+"[I"):this.coreService.triggerDataEvent(Ae.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(`${Ae.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(`${Ae.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function tG(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var nG=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)}},iG=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 ls)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},tT=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 iG(t)}getNullCell(){return new ls}},rG=class extends Dt{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Le),this.onBufferChange=this._onBufferChange.event,this._normal=new tT(this._core.buffers.normal,"normal"),this._alternate=new tT(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)}},sG=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)}},aG=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}},oG=["cols","rows"],Bs=0,lG=class extends Dt{constructor(e){super(),this._core=this._register(new eG(e)),this._addonManager=this._register(new nG),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(oG.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 sG(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new aG(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 rG(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 aw.get()},set promptLabel(e){aw.set(e)},get tooMuchOutput(){return ow.get()},set tooMuchOutput(e){ow.set(e)}}}_verifyIntegers(...e){for(Bs of e)if(Bs===1/0||isNaN(Bs)||Bs%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Bs of e)if(Bs&&(Bs===1/0||isNaN(Bs)||Bs%1!==0||Bs<0))throw new Error("This API only accepts positive integers")}};function cG(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)},_=()=>{t=!1,s=!1,f(),d()},w=S=>{if(o===null){if(t||n||dG(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 uG(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:_}}function uG(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function dG(e){return e.isComposing===!0||e.keyCode===229||e.which===229}function hG({terminal:e,selectionTarget:t,windowTarget:n,clipboard:i}){let s=!1,o=!1,l=!1;const d=()=>{o=!1,l=!1},f=_=>{nT(_)&&(o=!0,l=!1)},p=()=>{o&&(l=!0)},m=_=>{const w=o&&l&&nT(_);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 nT(e){return e.button===0}function fG(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 pG={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",linkHandler:fG((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},mG="Symbols Nerd Font Mono",ap=`ui-monospace, "SF Mono", Menlo, "${mG}", monospace`,JS=14,y3=10,v3=22,gG={min:y3,max:v3},yG="cascadia",fh=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${ap}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${ap}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${ap}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${ap}`,meta:"Variable · Adobe mono"}],Hc=fh[0];function vG(e){return fh.find(t=>t.id===e)??Hc}function ph(){return{source:"curated",id:yG,customName:"",family:Hc.family,size:JS}}function QS(e,t){const n=vG(e);return{source:"curated",id:n.id,customName:"",family:n.family,size:n1(t)}}function e1(e,t){const n=wG(e);return{source:"custom",id:null,customName:n,family:sm(n,Hc.family),size:n1(t)}}function _3(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=n1(typeof t.size=="number"?t.size:JS);return t.source==="custom"&&typeof t.customName=="string"?e1(t.customName,n):typeof t.id=="string"&&bG(t.id)?QS(t.id,n):null}function t1(e){if(!e)return ph();try{const t=_3(JSON.parse(e));if(t!==null)return t}catch{}return ph()}function _G(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function n1(e){return Number.isFinite(e)?Math.min(v3,Math.max(y3,Math.round(e))):JS}function bG(e){return fh.some(t=>t.id===e)}function wG(e){return rg(e)}const Am="fleet-plugin.terminal.renderer",Uc="fleet-plugin.terminal.font",iT="fleet-console.terminalRenderer",rT="fleet-console.terminalFont",Uw=new Set;let Io=IG(),Tm=null,Al=0,op=null;function SG(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Am)!==null||window.localStorage.getItem(Uc)!==null)return;const e=window.localStorage.getItem(iT),t=window.localStorage.getItem(rT),n=e==="webgl"||e==="dom"?e:"webgl",i=t1(t);window.localStorage.setItem(Am,n),window.localStorage.setItem(Uc,_G(i)),window.localStorage.removeItem(iT),window.localStorage.removeItem(rT)}catch{}}function xG(e){Al+=1,Tm=e,TG()}function b3(){return g.useSyncExternalStore(OG,sT,sT)}function kG(e){NG(e),nu({renderer:e})}function CG(e){const t=QS(e,Io.font.size);Al+=1,nu({font:t}),vg(t)}function EG(e){const t=e1(e,Io.font.size);Al+=1,nu({font:t}),vg(t)}function AG(e){const t=Io.font.source==="custom"?e1(Io.font.customName,e):QS(Io.font.id,e);Al+=1,nu({font:t}),vg(t)}async function TG(){if(!Tm)return;const e=Al;try{const t=await Tm.read("terminal");if(t!==null){const n=_3(t.font);if(n!==null){if(e!==Al)return;nu({font:n});try{window.localStorage.removeItem(Uc)}catch{}return}}if(typeof window<"u"){let n=null;try{n=window.localStorage.getItem(Uc)}catch{}if(n!==null){const i=t1(n);if(e!==Al)return;nu({font:i}),vg(i);try{window.localStorage.removeItem(Uc)}catch{}}}}catch{}}async function vg(e){const t=Tm;if(t)try{await w3(t,{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function w3(e,t){const n=async()=>{const o=await e.read("terminal");await e.write("terminal",{...o??{},...t})},i=op,s=i?i.catch(()=>{}).then(n):n();return op=s,s.finally(()=>{op===s&&(op=null)}).catch(()=>{}),s}function RG(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Am);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function MG(){if(typeof window>"u")return ph();try{return t1(window.localStorage.getItem(Uc))}catch{return ph()}}function NG(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Am,e)}catch{}}function LG(){for(const e of Uw)e()}function nu(e){Io={...Io,...e},LG()}function OG(e){return Uw.add(e),()=>{Uw.delete(e)}}function sT(){return Io}function IG(){return typeof window>"u"?{renderer:"webgl",font:ph()}:(SG(),{renderer:RG(),font:MG()})}function aT({baseY:e,viewportY:t}){return t>=e}function jG(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=aT(e.getViewport()),t){n=null;return}s()},recordUnclassifiedViewportChange:()=>{},resumeFollowing:()=>{t=!0,n=null,f()},preserveAfterGeometryChange:p=>{p(),l(),d()},restoreAfterOutputParsing:()=>{if(t){f();return}aT(e.getViewport())||s()},dispose:()=>{i!==null&&e.cancelFrame(i),i=null}}}function DG({getPlatform:e,getSelection:t,writeText:n}){return{handleKeyEvent(i){if(!BG(i,e()))return!0;i.preventDefault?.(),i.stopPropagation?.();const s=t();return s&&!i.repeat&&n(s).catch(()=>{}),!1}}}function BG(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 PG="Symbols Nerd Font Mono",$G=`1em "${PG}"`,zG=650;let lp=null;function S3(){return lp||(lp=HG(),lp)}async function FG(){await UG(S3(),zG)}async function HG(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load($G)}catch{}}async function UG(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 WG=80,qG=16,GG=250,KG=1024*1024,VG=120,YG={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)"},XG={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)"},ZG={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 i1({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}=b3(),y=g.useRef(null),_=g.useRef(null),w=g.useRef(null),S=g.useRef(null),x=g.useRef(null),k=g.useRef(null),C=g.useRef(null),[B,H]=g.useState(d),T=g.useRef(s);T.current=s;const $=g.useRef(o);$.current=o;const[j,M]=g.useState("connecting"),[V,Y]=g.useState(0),[te,J]=g.useState(0);g.useEffect(()=>{const I=y.current;if(!I)return;let D=!1,E=null,L=null,R=null;return(async()=>{if(await FG(),D)return;const U=oT(f),O=new lG({...pG,fontFamily:m.family,fontSize:m.size*B,theme:U});_.current=O;const W=new qF;C.current=W,O.loadAddon(W),O.open(I),lT(I,U);const K=hG({terminal:O,selectionTarget:I,windowTarget:window,clipboard:navigator.clipboard});O.loadAddon(new v9),O.unicode.activeVersion="11";const z=cG(()=>O.input(`
98
+ `)),G=I.querySelector("textarea.xterm-helper-textarea, textarea")??I;G.addEventListener("compositionstart",z.onCompositionStart),G.addEventListener("compositionend",z.onCompositionEnd),G.addEventListener("focusout",z.onCompositionCancel);const Z=DG({getPlatform:()=>navigator.platform,getSelection:()=>O.getSelection(),writeText:ze=>navigator.clipboard.writeText(ze)});O.attachCustomKeyEventHandler(ze=>Z.handleKeyEvent(ze)&&z.handleKeyEvent(ze));const se=jG({getViewport:()=>O.buffer.active,scrollToBottom:()=>JG(O),scrollToLine:ze=>QG(O,ze),requestFrame:ze=>window.requestAnimationFrame(ze),cancelFrame:ze=>window.cancelAnimationFrame(ze)});k.current=se;const Se=eK(I,G,se.recordUserViewportChange),pe=iK(O,$.current!==!1,se.restoreAfterOutputParsing);x.current=pe;const $e=PF({operationId:e,ticketPath:t,wsPath:n,terminal:{onData:ze=>O.onData(lt=>{se.resumeFollowing(),ze(lt)}),write:pe.write},onExit:()=>T.current?.(),onStatus:(ze,lt)=>{M(lt?`${ze}: ${lt}`:ze)}});w.current=$e;const je=()=>{se.preserveAfterGeometryChange(()=>{W.fit(),$e.resize(O.cols,O.rows),O.refresh(0,O.rows-1)})},St=()=>{L&&clearTimeout(L),L=setTimeout(()=>{L=null,D||je()},WG)},Re=async()=>{await document.fonts?.ready,!D&&(je(),$e.start(),J(ze=>ze+1),$.current!==!1&&O.focus())};E=new ResizeObserver(St),E.observe(I),Re(),R=()=>{L&&clearTimeout(L),G.removeEventListener("compositionstart",z.onCompositionStart),G.removeEventListener("compositionend",z.onCompositionEnd),G.removeEventListener("focusout",z.onCompositionCancel),z.dispose(),$e.dispose(),K.dispose(),Se.dispose(),pe.dispose(),se.dispose(),_.current=null,w.current=null,x.current=null,k.current=null,C.current=null;try{O.dispose()}catch{}},Y(ze=>ze+1)})(),()=>{D=!0,E?.disconnect(),R?.()}},[e,t,n]),g.useEffect(()=>{x.current?.setActive(o!==!1),o&&(_.current?.focus(),k.current?.resumeFollowing())},[o,l,te]),g.useEffect(()=>{const I=_.current;if(!I)return;let D=!1;if(p==="webgl")try{const E=new QH;S.current=E,E.onContextLoss(()=>{if(!D){try{E.dispose()}catch{}S.current===E&&(S.current=null)}}),I.loadAddon(E)}catch{try{S.current?.dispose()}catch{}S.current=null}return()=>{D=!0;const E=S.current;if(E){S.current=null;try{E.dispose()}catch{}}}},[p,e,V]),g.useEffect(()=>{const I=_.current,D=y.current;if(!I||!D)return;const E=oT(f);I.options.theme=E,lT(D,E)},[f,V]),g.useEffect(()=>{const I=_.current;I&&(I.options.fontFamily=m.family,cT(I,C.current,w.current,k.current))},[m.family,V]),g.useEffect(()=>{if(d===B)return;const I=setTimeout(()=>H(d),VG);return()=>clearTimeout(I)},[d,B]),g.useEffect(()=>{const I=_.current;I&&(I.options.fontSize=m.size*B,cT(I,C.current,w.current,k.current))},[B,m.size,V]);const P=j.startsWith("live"),N=B===1?void 0:{width:`${B*100}%`,height:`${B*100}%`,transform:`scale(${1/B})`,transformOrigin:"0 0"};return c.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:c.jsxs("div",{className:"terminal-shell",children:[P?null:c.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[c.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),j]}),c.jsx("div",{className:"terminal-viewport",children:c.jsx("div",{className:"terminal-canvas",ref:y,style:N})})]})})}function oT(e){return e==="carbon"?ZG:e==="maritime"?XG:YG}function lT(e,t){const n=e.querySelector(".xterm-viewport");n&&(t.background?n.style.backgroundColor=t.background:n.style.removeProperty("background-color"))}function JG(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function QG(e,t){e&&(e.scrollToLine(t),e.rows>0&&e.refresh(0,e.rows-1))}function eK(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=tK(w,i)},m=()=>{s&&l()},y=()=>{const w=s;s=!1,w&&l()},_=w=>{nK(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",_,!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",_,!0),o!==null&&window.cancelAnimationFrame(o)}}}function tK(e,t){return e.pointerType==="touch"||e.target===t?!0:e.composedPath().some(n=>n.classList?.contains("scrollbar")===!0)}function nK(e){return e.key==="PageUp"||e.key==="PageDown"||e.key==="Home"||e.key==="End"}function iK(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=rK(d,l);d=[],l=0,e.write(y,()=>{s||n()})},m=()=>{s||o||l===0||(o=setTimeout(p,i?qG:GG))};return{write:y=>{if(!(s||y.byteLength===0)){if(d.push(y),l+=y.byteLength,l>=KG){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 rK(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 cT(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 sK=new Set(["path","cwd","canonicalcwd","transcriptpath","providersession","sessionid","token","ticket","url","mcpurl","rawtranscript"]),aK=50*1024;function mh(e){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(mh):Object.entries(e).some(([t,n])=>sK.has(t.toLowerCase())||mh(n))}function oK(e){if(mh(e)||!Ol(e)||!Array.isArray(e.clis))return null;const t=e.clis.map(uK);return t.every(n=>n!==null)?{clis:t}:null}function lK(e){return mh(e)||!Ol(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"&&x3(e.error)?{type:"error",error:e.error}:e.type==="artifact"&&Ol(e.artifact)&&typeof e.artifact.id=="string"&&typeof e.artifact.title=="string"&&typeof e.artifact.html=="string"&&typeof e.artifact.createdAt=="number"&&dK(e.artifact.html)<=aK?{type:"artifact",artifact:{id:e.artifact.id,title:e.artifact.title,html:e.artifact.html,createdAt:e.artifact.createdAt}}:null}function cK(e){return!mh(e)&&Ol(e)&&x3(e.error)?e.error:null}function uK(e){if(!Ol(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=>Ol(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 x3(e){return Ol(e)&&typeof e.code=="string"&&typeof e.message=="string"}function Ol(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dK(e){return new TextEncoder().encode(e).byteLength}class Ww extends Error{constructor(t,n){super(n),this.code=t}code}const Oh=e=>`analysis/${encodeURIComponent(e)}`,hK="/plugins/terminal/analysis/stream",fK={type:"error",error:{code:"analysis_session_not_found",message:"Analysis session was not found."}},k3=250,pK=4e3;let cs=null,iu=0,qw=0,C3=new Set,r1=!1,Wc=null,Up=k3;const Tl=new Map;function mK(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 gK(e){const t=await bg(e,"analysis/catalog"),n=await t.json().catch(()=>null),i=oK(n);if(i)return i;throw wg(t.status,n)}async function yK(e,t){try{const n=await bg(e,`${Oh(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 vK(e,t,n,i){await a1(e,`${Oh(t)}/start`,n,i)}async function _K(e,t,n){await a1(e,`${Oh(t)}/message`,{text:n})}async function S_(e,t){await a1(e,`${Oh(t)}/stop`,{})}async function E3(e,t){const n=await bg(e,`${Oh(t)}/artifacts`,{method:"DELETE"});if(!n.ok)throw wg(n.status,await n.json().catch(()=>null))}function bK(e,t,n){return wK(t,n)}function wK(e,t){let n=Tl.get(e);return n||(n={listeners:new Set,confirmedEpoch:null},Tl.set(e,n)),n.listeners.add(t),xK(),queueMicrotask(()=>{n.listeners.has(t)&&cs?.readyState===EventSource.OPEN&&(!r1||!C3.has(e)||n.confirmedEpoch===null&&(n.confirmedEpoch=qw,t({type:"connected"})))}),()=>{n.listeners.delete(t),n.listeners.size===0&&Tl.delete(e),SK()}}function _g(){for(const e of Tl.values())if(e.listeners.size>0)return!0;return!1}function s1(){r1=!1}function A3(){Up=k3}function T3(){Wc!==null&&(clearTimeout(Wc),Wc=null)}function SK(){_g()||(T3(),s1(),cs?.close(),cs=null,A3())}function R3(){T3(),s1(),cs?.close(),iu+=1;const e=iu,t=new EventSource(hK);cs=t,kK(t,e)}function xK(){if(!(cs&&cs.readyState!==EventSource.CLOSED)){if(cs?.readyState===EventSource.CLOSED){_g()&&M3();return}R3()}}function kK(e,t){e.onmessage=n=>{cs!==e||iu!==t||typeof n.data=="string"&&TK(n.data,t)},e.onerror=()=>{cs!==e||iu!==t||(s1(),e.readyState!==EventSource.CONNECTING&&e.readyState===EventSource.CLOSED&&_g()&&M3())}}function M3(){if(Wc!==null)return;const e=Up;Up=Math.min(Up*2,pK),Wc=setTimeout(()=>{Wc=null,_g()&&(cs!==null&&cs.readyState!==EventSource.CLOSED||R3())},e)}function Gw(e,t){const n=Tl.get(e);if(n)for(const i of n.listeners)i(t)}function CK(e,t){if(iu!==t)return;const n=new Set(e);for(const[i,s]of Tl)s.confirmedEpoch!==null&&!n.has(i)&&(Gw(i,fK),s.confirmedEpoch=null);qw+=1,C3=n,r1=!0,A3();for(const i of e){const s=Tl.get(i);s&&(s.confirmedEpoch=qw,Gw(i,{type:"connected"}))}}function N3(e,t){const n=Object.keys(e);return n.length===t.size&&n.every(i=>t.has(i))}function EK(e){if(!N3(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 AK(e){if(!N3(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=lK(e.event);return t?{operationId:e.operationId,event:t}:null}function TK(e,t){if(iu!==t)return;let n;try{n=JSON.parse(e)}catch{return}if(!n||typeof n!="object"||Array.isArray(n))return;const i=n,s=EK(i);if(s){CK(s,t);return}const o=AK(i);o&&Gw(o.operationId,o.event)}async function a1(e,t,n,i){const s=await bg(e,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),...i?{signal:i}:{}});if(!s.ok)throw wg(s.status,await s.json().catch(()=>null))}async function bg(e,t,n){try{return await e.fetch("terminal",t,n)}catch(i){throw i instanceof Vi?wg(i.status,i.body):i}}function wg(e,t){const n=cK(t);return new Ww(n?.code??`analysis_http_${e}`,n?.message??"Analysis is unavailable.")}const RK={"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.sortie.count":"{count} on sortie","terminal.sortie.more":"+{count}","terminal.sortie.open":"Open Carrier Streams — {count} on sortie","terminal.sortie.phase.tool":"Using {tool}","terminal.sortie.phase.writing":"Writing","terminal.sortie.phase.reasoning":"Reasoning","terminal.sortie.phase.working":"Working","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."},MK={"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.sortie.count":"{count}척 출격 중","terminal.sortie.more":"+{count}","terminal.sortie.open":"Carrier Streams 열기 — {count}척 출격 중","terminal.sortie.phase.tool":"{tool} 사용 중","terminal.sortie.phase.writing":"작성 중","terminal.sortie.phase.reasoning":"추론 중","terminal.sortie.phase.working":"작업 중","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":"분석 요청이 실패했습니다."},uT={en:RK,ko:MK},NK={en:qs(uT,"en"),ko:qs(uT,"ko")};function Tt(e){return NK[e??"en"]}function L3(e,t=BK()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}let Kw=L3(Wp()??"auto");const Vw=new Set;let dT=!1,x_=null,k_=null;function hT(){return Kw}function LK(e){return Vw.add(e),()=>{Vw.delete(e)}}function cp(e){if(Kw!==e){Kw=e;for(const t of Vw)t()}}function Wp(){if(typeof document>"u")return null;const e=document.documentElement.lang;return e==="en"||e==="ko"?e:null}function OK(){if(typeof document<"u"&&!x_&&(x_=new MutationObserver(()=>{const t=Wp();t&&cp(t)}),x_.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]})),dT)return;dT=!0;const e=Wp();if(e){cp(e);return}typeof fetch=="function"&&(k_=new AbortController,fetch("/api/v1/settings/global",{signal:k_.signal}).then(async t=>{if(!t.ok)return;const n=await t.json();if(k_?.signal.aborted)return;const i=Wp();if(i){cp(i);return}cp(L3(typeof n.language=="string"?n.language:"auto"))}).catch(()=>{}))}function ra(){return OK(),g.useSyncExternalStore(LK,hT,hT)}function IK(e){const t=Tt(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 jK(e,t){const n=Tt(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=DK[t];return i?n(i):t}const DK={"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 BK(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const PK=32,Yw={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 $K(e,t){if(t.type==="catalog")return{...e,catalog:t.catalog,...fT(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 bd(e,t.message,t.now);if(t.type==="session-lost")return{...bd(e,"Analysis session ended — send again to restart.",t.now),started:!1};if(t.type==="start-failed")return{...bd(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{...bd(e,`Stop failed: ${t.message}`,t.now),started:!1};if(t.type==="reset"){const i=e.catalog;return i?{...Yw,catalog:i,selectionLocked:e.selectionLocked,...fT(i,t.selection)}:{...Yw,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:FK(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,PK),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}:bd(e,n.error.message,t.now)}function zK(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 fT(e,t){const n=zK(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 bd(e,t,n){return{...e,queue:[],busy:!1,phase:"error",runEndedAt:n,artifactAuthoring:null,error:t}}function FK(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 gh=new Map,vc=new Map;function o1(e){const t=HK(e.operationId,e.api,e.settings,e.language);return{state:g.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),dispatch:t.dispatch,send:t.send,stop:t.stop,reset:t.reset}}function HK(e,t,n,i){const s=gh.get(e);if(s)return s.updateContext(n,i),s;const o=KK(e,t,n,i);return gh.set(e,o),o}function UK(e){gh.get(e)?.dispose()}function WK(e){gh.get(e)?.dispatch({type:"artifacts-chip-rearm"})}const qK=2e3,GK=12e4;function KK(e,t,n,i){let s=Yw,o=n,l=i,d=null,f=!1,p=null,m=null,y=null,_=null,w=null,S=null,x=Promise.resolve(),k=0,C=null,B=0,H=0;const T=new Set,$=D=>{if(f)return;const E=D.type==="select-cli"||D.type==="select-model"||D.type==="select-effort";if(E&&s.selectionLocked)return;const L=$K(s,D);if(L!==s){E&&C!==null&&(clearTimeout(C),C=null),s=E&&L.selectionSaved?{...L,selectionSaved:!1}:L;for(const R of T)R();E&&j({cliId:s.cliId,model:s.model,effort:s.effort})}},j=D=>{const E=o;if(!E)return;const L=++k;x=x.then(async()=>{try{if(await w3(E,{analyst:{selection:D}}),d=D,f||L!==k)return;$({type:"selection-saved"}),C=setTimeout(()=>{C=null,$({type:"selection-saved-clear"})},1500)}catch{}})},M=()=>{m!==null&&(clearTimeout(m),m=null)},V=()=>{M(),m=setTimeout(()=>{m=null,$({type:"error",message:"Analysis response timed out.",now:Date.now()})},GK)},Y=()=>{M(),B+=1,H+=1;const D=p;p=null,D?.()},te=()=>{Y(),$({type:"session-lost",now:Date.now()})},J=async()=>{if(p)return;const D=++B;let E=null;const L=new Promise(R=>{E=R});p=bK(t,e,R=>{if(D!==B||f)return;if(R.type==="connected"){$({type:"event",event:R,now:Date.now()}),E?.(),E=null;return}if(R.type==="error"&&mT(R.error.code)){E?.(),E=null,te();return}(R.type==="complete"||R.type==="error")&&M();const q=R.type==="complete"?s.queue[0]:void 0;$({type:"event",event:R,now:Date.now()}),q!==void 0&&!s.busy&&!f&&D===B&&($({type:"queue-cancel",index:0}),N.send(q))}),await Promise.race([L,new Promise(R=>setTimeout(R,qK))])},N={getSnapshot:()=>s,subscribe:D=>(T.add(D),()=>T.delete(D)),dispatch:$,send:async D=>{const E=vc.get(e);if(E&&await E,S)try{await S}catch{return}w&&await w;const L=D.trim();if(!L||s.busy||f)return;const R=!s.started,q=++H,U={cliId:s.cliId,model:s.model,effort:s.effort,...l?{language:l}:{}};if($({type:"sending",started:R,text:L,now:Date.now()}),R){const O=new AbortController,W=vK(t,e,U,O.signal);_=O,y=W;try{await W}catch(K){if(f||q!==H)return;if(!(K instanceof Ww&&K.code==="analysis_session_exists")){$({type:"start-failed",message:wd(K),now:Date.now()});return}}finally{_===O&&(_=null),y===W&&(y=null)}if(f||q!==H||!s.started||(await J(),q!==H||!s.started))return}try{if(await _K(t,e,L),q!==H||!s.busy||!s.started)return;V()}catch(O){if(f||q!==H)return;O instanceof Ww&&mT(O.code)?te():$({type:"error",message:wd(O),now:Date.now()})}},stop:async()=>{if(S){await S.catch(()=>{});return}if(w)return w;if(f||!s.started)return;Y(),$({type:"stopped",now:Date.now()});const D=S_(t,e).catch(E=>{$({type:"stop-failed",message:wd(E),now:Date.now()})});w=D,await D,w===D&&(w=null)},reset:async()=>{if(S)return S;if(f)return;$({type:"selection-lock",locked:!0});const D=s.started||s.phase!=="idle"||s.entries.length>0||s.artifacts.length>0;Y();const E=(async()=>{w&&await w,y&&await y.catch(()=>{}),await x,D&&await S_(t,e),await E3(t,e).catch(()=>{}),$({type:"reset",selection:d})})().catch(L=>{throw $({type:"error",message:`Reset failed: ${wd(L)}`,now:Date.now()}),L});S=E;try{await E}finally{S===E&&(S=null),$({type:"selection-lock",locked:!1})}},dispose:()=>{if(f)return;const D=vc.get(e),E=S,L=w,R=y,q=x,U=_;f=!0,gh.delete(e),Y(),C!==null&&clearTimeout(C),T.clear(),U?.abort();const O=(async()=>{D&&await D,R&&await R.catch(()=>{}),E&&await E.catch(()=>{}),L&&await L.catch(()=>{}),await q,await S_(t,e)})().catch(()=>{});vc.set(e,O),O.finally(()=>{vc.get(e)===O&&vc.delete(e)})},updateContext:(D,E)=>{D&&(o=D),l=E}};return(vc.get(e)??Promise.resolve()).then(()=>Promise.all([gK(t),VK(o)])).then(([D,E])=>{d=E,$({type:"catalog",catalog:D,selection:E})}).catch(D=>$({type:"error",message:wd(D),now:Date.now()})),N}async function VK(e){if(!e)return null;try{const t=await e.read("terminal");if(!t)return null;const n=pT(t.analyst),i=pT(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 pT(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function wd(e){return e instanceof Error?e.message:"Analysis is unavailable."}function mT(e){return e==="analysis_exited"||e==="analysis_session_not_found"}function YK({context:e}){const{state:t,dispatch:n}=o1(e),i=e.language??"en",s=Tt(i),o=g.useMemo(()=>[...t.artifacts].reverse(),[t.artifacts]),l=t.artifacts[0]?.id??null,[d,f]=g.useState(null),[p,m]=g.useState(!1),y=g.useId(),_=g.useRef(null);g.useEffect(()=>{l&&f(l)},[l]);const w=o.find(x=>x.id===d)??o.at(-1)??null,S=o.length;return g.useEffect(()=>{if(!p)return;const x=C=>{C.target instanceof Node&&!_.current?.contains(C.target)&&m(!1)},k=C=>{C.key==="Escape"&&m(!1)};return document.addEventListener("pointerdown",x),document.addEventListener("keydown",k),()=>{document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",k)}},[p]),g.useEffect(()=>{S||m(!1)},[S]),c.jsxs("section",{className:"session-analyst__artifacts","aria-label":s("terminal.companion.artifacts"),children:[c.jsxs("header",{className:"session-analyst__panel-head session-analyst__panel-head--artifacts",children:[c.jsx("span",{className:"session-analyst__panel-mark session-analyst__panel-mark--artifact","aria-hidden":"true",children:"◇"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:s("terminal.companion.artifacts")}),c.jsx("small",{children:s("terminal.artifacts.subtitle")})]}),c.jsxs("div",{className:"session-analyst__artifact-list-shell",ref:_,children:[c.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:[c.jsx("strong",{children:S})," ",c.jsx("span",{children:i==="ko"?"개":S===1?"item":"items"}),c.jsx("i",{"aria-hidden":"true"})]}),p?c.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 c.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:[c.jsx("span",{className:"session-analyst__artifact-list-mark","aria-hidden":"true",children:"◇"}),c.jsx("strong",{children:x.title}),c.jsx(O3,{createdAt:x.createdAt,language:i})]},x.id)})}):null]}),c.jsx("button",{type:"button",className:"session-analyst__clear",onClick:()=>{m(!1),n({type:"clear-artifacts"}),E3(e.api,e.operationId).catch(()=>{})},disabled:!S,children:s("terminal.artifacts.clear")})]}),S===0?c.jsxs("div",{className:"session-analyst__artifacts-empty",children:[c.jsx("strong",{children:s("terminal.artifacts.emptyTitle")}),s("terminal.artifacts.emptyBody")]}):c.jsx("div",{className:"session-analyst__artifact-content",children:w?c.jsx(XK,{artifact:w,theme:e.theme,language:i},w.id):null})]})}function XK({artifact:e,theme:t,language:n}){if(!e.id)return null;const i=Tt(n),s=getComputedStyle(document.documentElement),o=s.getPropertyValue("--ink-veil").trim()||"Canvas",l=s.getPropertyValue("--ink-pearl").trim()||"CanvasText";return c.jsxs("article",{"aria-label":i("terminal.artifacts.selectedPreview"),children:[c.jsxs("header",{children:[c.jsx("span",{className:"session-analyst__artifact-title",children:e.title}),c.jsx(O3,{createdAt:e.createdAt,language:n})]}),c.jsx("iframe",{title:e.title,src:mK(e.id,t,o,l),sandbox:"allow-scripts"})]})}function O3({createdAt:e,language:t}){const n=Tt(t),i=new Date(e),s=Number.isFinite(i.getTime());return c.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 ZK="modulepreload",JK=function(e){return"/console/"+e},gT={},QK=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=JK(p),p in gT)return;gT[p]=!0;const m=p.endsWith(".css"),y=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${y}`))return;const _=document.createElement("link");if(_.rel=m?"stylesheet":ZK,m||(_.as="script"),_.crossOrigin="",_.href=p,d&&_.setAttribute("nonce",d),document.head.appendChild(_),m)return new Promise((w,S)=>{_.addEventListener("load",w),_.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:I3,setPrototypeOf:yT,isFrozen:eV,getPrototypeOf:tV,getOwnPropertyDescriptor:nV}=Object;let{freeze:rr,seal:hs,create:Rc}=Object,{apply:Xw,construct:Zw}=typeof Reflect<"u"&&Reflect;rr||(rr=function(t){return t});hs||(hs=function(t){return t});Xw||(Xw=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)});Zw||(Zw=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 Sd=hi(Array.prototype.forEach),iV=hi(Array.prototype.lastIndexOf),vT=hi(Array.prototype.pop),xd=hi(Array.prototype.push),rV=hi(Array.prototype.splice),er=Array.isArray,Hd=hi(String.prototype.toLowerCase),C_=hi(String.prototype.toString),_T=hi(String.prototype.match),_c=hi(String.prototype.replace),bT=hi(String.prototype.indexOf),sV=hi(String.prototype.trim),aV=hi(Number.prototype.toString),oV=hi(Boolean.prototype.toString),wT=typeof BigInt>"u"?null:hi(BigInt.prototype.toString),ST=typeof Symbol>"u"?null:hi(Symbol.prototype.toString),Gn=hi(Object.prototype.hasOwnProperty),kd=hi(Object.prototype.toString),Fi=hi(RegExp.prototype.test),up=lV(TypeError);function hi(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 Xw(e,t,i)}}function lV(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Zw(e,n)}}function It(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hd;if(yT&&yT(e,null),!er(t))return e;let i=t.length;for(;i--;){let s=t[i];if(typeof s=="string"){const o=n(s);o!==s&&(eV(t)||(t[i]=o),s=o)}e[s]=!0}return e}function cV(e){for(let t=0;t<e.length;t++)Gn(e,t)||(e[t]=null);return e}function vr(e){const t=Rc(null);for(const[n,i]of I3(e))Gn(e,n)&&(er(i)?t[n]=cV(i):i&&typeof i=="object"&&i.constructor===Object?t[n]=vr(i):t[n]=i);return t}function uV(e){switch(typeof e){case"string":return e;case"number":return aV(e);case"boolean":return oV(e);case"bigint":return wT?wT(e):"0";case"symbol":return ST?ST(e):"Symbol()";case"undefined":return kd(e);case"function":case"object":{if(e===null)return kd(e);const t=e,n=Mc(t,"toString");if(typeof n=="function"){const i=n(t);return typeof i=="string"?i:kd(i)}return kd(e)}default:return kd(e)}}function Mc(e,t){for(;e!==null;){const i=nV(e,t);if(i){if(i.get)return hi(i.get);if(typeof i.value=="function")return hi(i.value)}e=tV(e)}function n(){return null}return n}function dV(e){try{return Fi(e,""),!0}catch{return!1}}const xT=rr(["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"]),E_=rr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),A_=rr(["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"]),hV=rr(["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"]),T_=rr(["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"]),fV=rr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),kT=rr(["#text"]),CT=rr(["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"]),R_=rr(["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"]),ET=rr(["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"]),dp=rr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pV=hs(/\{\{[\w\W]*|[\w\W]*\}\}/gm),mV=hs(/<%[\w\W]*|[\w\W]*%>/gm),gV=hs(/\$\{[\w\W]*/gm),yV=hs(/^data-[\-\w.\u00B7-\uFFFF]+$/),vV=hs(/^aria-[\-\w]+$/),j3=hs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_V=hs(/^(?:\w+script|data):/i),bV=hs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),D3=hs(/^html$/i),wV=hs(/^[a-z][.\w]*(-[.\w]+)+$/i);var AT=Object.freeze({__proto__:null,ARIA_ATTR:vV,ATTR_WHITESPACE:bV,CUSTOM_ELEMENT:wV,DATA_ATTR:yV,DOCTYPE_NAME:D3,ERB_EXPR:mV,IS_ALLOWED_URI:j3,IS_SCRIPT_OR_DATA:_V,MUSTACHE_EXPR:pV,TMPLIT_EXPR:gV});const Cd={element:1,text:3,progressingInstruction:7,comment:8,document:9},SV=function(){return typeof window>"u"?null:window},xV=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}},TT=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function B3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:SV();const t=Ge=>B3(Ge);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:_,trustedTypes:w}=e,S=f.prototype,x=Mc(S,"cloneNode"),k=Mc(S,"remove"),C=Mc(S,"nextSibling"),B=Mc(S,"childNodes"),H=Mc(S,"parentNode");if(typeof l=="function"){const Ge=n.createElement("template");Ge.content&&Ge.content.ownerDocument&&(n=Ge.content.ownerDocument)}let T,$="";const{implementation:j,createNodeIterator:M,createDocumentFragment:V,getElementsByTagName:Y}=n,{importNode:te}=i;let J=TT();t.isSupported=typeof I3=="function"&&typeof H=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:N,TMPLIT_EXPR:I,DATA_ATTR:D,ARIA_ATTR:E,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:q}=AT;let{IS_ALLOWED_URI:U}=AT,O=null;const W=It({},[...xT,...E_,...A_,...T_,...kT]);let K=null;const z=It({},[...CT,...R_,...ET,...dp]);let G=Object.seal(Rc(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}})),Z=null,se=null;const Se=Object.seal(Rc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let pe=!0,$e=!0,je=!1,St=!0,Re=!1,ze=!0,lt=!1,kt=!1,mt=!1,Ct=!1,dt=!1,gt=!1,at=!0,Pt=!1;const Ut="user-content-";let tt=!0,cn=!1,ke={},De=null;const Xe=It({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let _t=null;const ht=It({},["audio","video","img","source","image","track"]);let nt=null;const st=It({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),_e="http://www.w3.org/1998/Math/MathML",Ne="http://www.w3.org/2000/svg",bt="http://www.w3.org/1999/xhtml";let Nt=bt,hn=!1,le=null;const me=It({},[_e,Ne,bt],C_);let re=It({},["mi","mo","mn","ms","mtext"]),ge=It({},["annotation-xml"]);const Te=It({},["title","style","font","a","script"]);let We=null;const ee=["application/xhtml+xml","text/html"],he="text/html";let Ee=null,Ve=null;const Rt=n.createElement("form"),ct=function(Q){return Q instanceof RegExp||Q instanceof Function},Pe=function(){let Q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ve&&Ve===Q)return;(!Q||typeof Q!="object")&&(Q={}),Q=vr(Q),We=ee.indexOf(Q.PARSER_MEDIA_TYPE)===-1?he:Q.PARSER_MEDIA_TYPE,Ee=We==="application/xhtml+xml"?C_:Hd,O=Gn(Q,"ALLOWED_TAGS")&&er(Q.ALLOWED_TAGS)?It({},Q.ALLOWED_TAGS,Ee):W,K=Gn(Q,"ALLOWED_ATTR")&&er(Q.ALLOWED_ATTR)?It({},Q.ALLOWED_ATTR,Ee):z,le=Gn(Q,"ALLOWED_NAMESPACES")&&er(Q.ALLOWED_NAMESPACES)?It({},Q.ALLOWED_NAMESPACES,C_):me,nt=Gn(Q,"ADD_URI_SAFE_ATTR")&&er(Q.ADD_URI_SAFE_ATTR)?It(vr(st),Q.ADD_URI_SAFE_ATTR,Ee):st,_t=Gn(Q,"ADD_DATA_URI_TAGS")&&er(Q.ADD_DATA_URI_TAGS)?It(vr(ht),Q.ADD_DATA_URI_TAGS,Ee):ht,De=Gn(Q,"FORBID_CONTENTS")&&er(Q.FORBID_CONTENTS)?It({},Q.FORBID_CONTENTS,Ee):Xe,Z=Gn(Q,"FORBID_TAGS")&&er(Q.FORBID_TAGS)?It({},Q.FORBID_TAGS,Ee):vr({}),se=Gn(Q,"FORBID_ATTR")&&er(Q.FORBID_ATTR)?It({},Q.FORBID_ATTR,Ee):vr({}),ke=Gn(Q,"USE_PROFILES")?Q.USE_PROFILES&&typeof Q.USE_PROFILES=="object"?vr(Q.USE_PROFILES):Q.USE_PROFILES:!1,pe=Q.ALLOW_ARIA_ATTR!==!1,$e=Q.ALLOW_DATA_ATTR!==!1,je=Q.ALLOW_UNKNOWN_PROTOCOLS||!1,St=Q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Re=Q.SAFE_FOR_TEMPLATES||!1,ze=Q.SAFE_FOR_XML!==!1,lt=Q.WHOLE_DOCUMENT||!1,Ct=Q.RETURN_DOM||!1,dt=Q.RETURN_DOM_FRAGMENT||!1,gt=Q.RETURN_TRUSTED_TYPE||!1,mt=Q.FORCE_BODY||!1,at=Q.SANITIZE_DOM!==!1,Pt=Q.SANITIZE_NAMED_PROPS||!1,tt=Q.KEEP_CONTENT!==!1,cn=Q.IN_PLACE||!1,U=dV(Q.ALLOWED_URI_REGEXP)?Q.ALLOWED_URI_REGEXP:j3,Nt=typeof Q.NAMESPACE=="string"?Q.NAMESPACE:bt,re=Gn(Q,"MATHML_TEXT_INTEGRATION_POINTS")&&Q.MATHML_TEXT_INTEGRATION_POINTS&&typeof Q.MATHML_TEXT_INTEGRATION_POINTS=="object"?vr(Q.MATHML_TEXT_INTEGRATION_POINTS):It({},["mi","mo","mn","ms","mtext"]),ge=Gn(Q,"HTML_INTEGRATION_POINTS")&&Q.HTML_INTEGRATION_POINTS&&typeof Q.HTML_INTEGRATION_POINTS=="object"?vr(Q.HTML_INTEGRATION_POINTS):It({},["annotation-xml"]);const ve=Gn(Q,"CUSTOM_ELEMENT_HANDLING")&&Q.CUSTOM_ELEMENT_HANDLING&&typeof Q.CUSTOM_ELEMENT_HANDLING=="object"?vr(Q.CUSTOM_ELEMENT_HANDLING):Rc(null);if(G=Rc(null),Gn(ve,"tagNameCheck")&&ct(ve.tagNameCheck)&&(G.tagNameCheck=ve.tagNameCheck),Gn(ve,"attributeNameCheck")&&ct(ve.attributeNameCheck)&&(G.attributeNameCheck=ve.attributeNameCheck),Gn(ve,"allowCustomizedBuiltInElements")&&typeof ve.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=ve.allowCustomizedBuiltInElements),Re&&($e=!1),dt&&(Ct=!0),ke&&(O=It({},kT),K=Rc(null),ke.html===!0&&(It(O,xT),It(K,CT)),ke.svg===!0&&(It(O,E_),It(K,R_),It(K,dp)),ke.svgFilters===!0&&(It(O,A_),It(K,R_),It(K,dp)),ke.mathMl===!0&&(It(O,T_),It(K,ET),It(K,dp))),Se.tagCheck=null,Se.attributeCheck=null,Gn(Q,"ADD_TAGS")&&(typeof Q.ADD_TAGS=="function"?Se.tagCheck=Q.ADD_TAGS:er(Q.ADD_TAGS)&&(O===W&&(O=vr(O)),It(O,Q.ADD_TAGS,Ee))),Gn(Q,"ADD_ATTR")&&(typeof Q.ADD_ATTR=="function"?Se.attributeCheck=Q.ADD_ATTR:er(Q.ADD_ATTR)&&(K===z&&(K=vr(K)),It(K,Q.ADD_ATTR,Ee))),Gn(Q,"ADD_URI_SAFE_ATTR")&&er(Q.ADD_URI_SAFE_ATTR)&&It(nt,Q.ADD_URI_SAFE_ATTR,Ee),Gn(Q,"FORBID_CONTENTS")&&er(Q.FORBID_CONTENTS)&&(De===Xe&&(De=vr(De)),It(De,Q.FORBID_CONTENTS,Ee)),Gn(Q,"ADD_FORBID_CONTENTS")&&er(Q.ADD_FORBID_CONTENTS)&&(De===Xe&&(De=vr(De)),It(De,Q.ADD_FORBID_CONTENTS,Ee)),tt&&(O["#text"]=!0),lt&&It(O,["html","head","body"]),O.table&&(It(O,["tbody"]),delete Z.tbody),Q.TRUSTED_TYPES_POLICY){if(typeof Q.TRUSTED_TYPES_POLICY.createHTML!="function")throw up('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw up('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=Q.TRUSTED_TYPES_POLICY,$=T.createHTML("")}else T===void 0&&(T=xV(w,s)),T!==null&&typeof $=="string"&&($=T.createHTML(""));rr&&rr(Q),Ve=Q},Ie=It({},[...E_,...A_,...hV]),it=It({},[...T_,...fV]),Zt=function(Q){let ve=H(Q);(!ve||!ve.tagName)&&(ve={namespaceURI:Nt,tagName:"template"});const Be=Hd(Q.tagName),zt=Hd(ve.tagName);return le[Q.namespaceURI]?Q.namespaceURI===Ne?ve.namespaceURI===bt?Be==="svg":ve.namespaceURI===_e?Be==="svg"&&(zt==="annotation-xml"||re[zt]):!!Ie[Be]:Q.namespaceURI===_e?ve.namespaceURI===bt?Be==="math":ve.namespaceURI===Ne?Be==="math"&&ge[zt]:!!it[Be]:Q.namespaceURI===bt?ve.namespaceURI===Ne&&!ge[zt]||ve.namespaceURI===_e&&!re[zt]?!1:!it[Be]&&(Te[Be]||!Ie[Be]):!!(We==="application/xhtml+xml"&&le[Q.namespaceURI]):!1},xt=function(Q){xd(t.removed,{element:Q});try{H(Q).removeChild(Q)}catch{k(Q)}},Fn=function(Q,ve){try{xd(t.removed,{attribute:ve.getAttributeNode(Q),from:ve})}catch{xd(t.removed,{attribute:null,from:ve})}if(ve.removeAttribute(Q),Q==="is")if(Ct||dt)try{xt(ve)}catch{}else try{ve.setAttribute(Q,"")}catch{}},Xn=function(Q){let ve=null,Be=null;if(mt)Q="<remove></remove>"+Q;else{const pn=_T(Q,/^[\r\n\t ]+/);Be=pn&&pn[0]}We==="application/xhtml+xml"&&Nt===bt&&(Q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Q+"</body></html>");const zt=T?T.createHTML(Q):Q;if(Nt===bt)try{ve=new _().parseFromString(zt,We)}catch{}if(!ve||!ve.documentElement){ve=j.createDocument(Nt,"template",null);try{ve.documentElement.innerHTML=hn?$:zt}catch{}}const Et=ve.body||ve.documentElement;return Q&&Be&&Et.insertBefore(n.createTextNode(Be),Et.childNodes[0]||null),Nt===bt?Y.call(ve,lt?"html":"body")[0]:lt?ve.documentElement:Et},pi=function(Q){return M.call(Q.ownerDocument||Q,Q,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},fn=function(Q){return Q instanceof y&&(typeof Q.nodeName!="string"||typeof Q.textContent!="string"||typeof Q.removeChild!="function"||!(Q.attributes instanceof m)||typeof Q.removeAttribute!="function"||typeof Q.setAttribute!="function"||typeof Q.namespaceURI!="string"||typeof Q.insertBefore!="function"||typeof Q.hasChildNodes!="function")},Kt=function(Q){return typeof d=="function"&&Q instanceof d};function oe(Ge,Q,ve){Sd(Ge,Be=>{Be.call(t,Q,ve,Ve)})}const qe=function(Q){let ve=null;if(oe(J.beforeSanitizeElements,Q,null),fn(Q))return xt(Q),!0;const Be=Ee(Q.nodeName);if(oe(J.uponSanitizeElement,Q,{tagName:Be,allowedTags:O}),ze&&Q.hasChildNodes()&&!Kt(Q.firstElementChild)&&Fi(/<[/\w!]/g,Q.innerHTML)&&Fi(/<[/\w!]/g,Q.textContent)||ze&&Q.namespaceURI===bt&&Be==="style"&&Kt(Q.firstElementChild)||Q.nodeType===Cd.progressingInstruction||ze&&Q.nodeType===Cd.comment&&Fi(/<[/\w]/g,Q.data))return xt(Q),!0;if(Z[Be]||!(Se.tagCheck instanceof Function&&Se.tagCheck(Be))&&!O[Be]){if(!Z[Be]&&$t(Be)&&(G.tagNameCheck instanceof RegExp&&Fi(G.tagNameCheck,Be)||G.tagNameCheck instanceof Function&&G.tagNameCheck(Be)))return!1;if(tt&&!De[Be]){const zt=H(Q)||Q.parentNode,Et=B(Q)||Q.childNodes;if(Et&&zt){const pn=Et.length;for(let Cn=pn-1;Cn>=0;--Cn){const En=x(Et[Cn],!0);zt.insertBefore(En,C(Q))}}}return xt(Q),!0}return Q instanceof f&&!Zt(Q)||(Be==="noscript"||Be==="noembed"||Be==="noframes")&&Fi(/<\/no(script|embed|frames)/i,Q.innerHTML)?(xt(Q),!0):(Re&&Q.nodeType===Cd.text&&(ve=Q.textContent,Sd([P,N,I],zt=>{ve=_c(ve,zt," ")}),Q.textContent!==ve&&(xd(t.removed,{element:Q.cloneNode()}),Q.textContent=ve)),oe(J.afterSanitizeElements,Q,null),!1)},ot=function(Q,ve,Be){if(se[ve]||at&&(ve==="id"||ve==="name")&&(Be in n||Be in Rt))return!1;const zt=K[ve]||Se.attributeCheck instanceof Function&&Se.attributeCheck(ve,Q);if(!($e&&!se[ve]&&Fi(D,ve))){if(!(pe&&Fi(E,ve))){if(!zt||se[ve]){if(!($t(Q)&&(G.tagNameCheck instanceof RegExp&&Fi(G.tagNameCheck,Q)||G.tagNameCheck instanceof Function&&G.tagNameCheck(Q))&&(G.attributeNameCheck instanceof RegExp&&Fi(G.attributeNameCheck,ve)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(ve,Q))||ve==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&Fi(G.tagNameCheck,Be)||G.tagNameCheck instanceof Function&&G.tagNameCheck(Be))))return!1}else if(!nt[ve]){if(!Fi(U,_c(Be,R,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&Q!=="script"&&bT(Be,"data:")===0&&_t[Q])){if(!(je&&!Fi(L,_c(Be,R,"")))){if(Be)return!1}}}}}}return!0},an=It({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),$t=function(Q){return!an[Hd(Q)]&&Fi(q,Q)},On=function(Q){oe(J.beforeSanitizeAttributes,Q,null);const{attributes:ve}=Q;if(!ve||fn(Q))return;const Be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let zt=ve.length;for(;zt--;){const Et=ve[zt],{name:pn,namespaceURI:Cn,value:En}=Et,X=Ee(pn),we=En;let Me=pn==="value"?we:sV(we);if(Be.attrName=X,Be.attrValue=Me,Be.keepAttr=!0,Be.forceKeepAttr=void 0,oe(J.uponSanitizeAttribute,Q,Be),Me=Be.attrValue,Pt&&(X==="id"||X==="name")&&bT(Me,Ut)!==0&&(Fn(pn,Q),Me=Ut+Me),ze&&Fi(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Me)){Fn(pn,Q);continue}if(X==="attributename"&&_T(Me,"href")){Fn(pn,Q);continue}if(Be.forceKeepAttr)continue;if(!Be.keepAttr){Fn(pn,Q);continue}if(!St&&Fi(/\/>/i,Me)){Fn(pn,Q);continue}Re&&Sd([P,N,I],Ke=>{Me=_c(Me,Ke," ")});const He=Ee(Q.nodeName);if(!ot(He,X,Me)){Fn(pn,Q);continue}if(T&&typeof w=="object"&&typeof w.getAttributeType=="function"&&!Cn)switch(w.getAttributeType(He,X)){case"TrustedHTML":{Me=T.createHTML(Me);break}case"TrustedScriptURL":{Me=T.createScriptURL(Me);break}}if(Me!==we)try{Cn?Q.setAttributeNS(Cn,pn,Me):Q.setAttribute(pn,Me),fn(Q)?xt(Q):vT(t.removed)}catch{Fn(pn,Q)}}oe(J.afterSanitizeAttributes,Q,null)},Si=function(Q){let ve=null;const Be=pi(Q);for(oe(J.beforeSanitizeShadowDOM,Q,null);ve=Be.nextNode();)oe(J.uponSanitizeShadowNode,ve,null),qe(ve),On(ve),ve.content instanceof o&&Si(ve.content);oe(J.afterSanitizeShadowDOM,Q,null)};return t.sanitize=function(Ge){let Q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,Be=null,zt=null,Et=null;if(hn=!Ge,hn&&(Ge="<!-->"),typeof Ge!="string"&&!Kt(Ge)&&(Ge=uV(Ge),typeof Ge!="string"))throw up("dirty is not a string, aborting");if(!t.isSupported)return Ge;if(kt||Pe(Q),t.removed=[],typeof Ge=="string"&&(cn=!1),cn){const En=Ge.nodeName;if(typeof En=="string"){const X=Ee(En);if(!O[X]||Z[X])throw up("root node is forbidden and cannot be sanitized in-place")}}else if(Ge instanceof d)ve=Xn("<!---->"),Be=ve.ownerDocument.importNode(Ge,!0),Be.nodeType===Cd.element&&Be.nodeName==="BODY"||Be.nodeName==="HTML"?ve=Be:ve.appendChild(Be);else{if(!Ct&&!Re&&!lt&&Ge.indexOf("<")===-1)return T&&gt?T.createHTML(Ge):Ge;if(ve=Xn(Ge),!ve)return Ct?null:gt?$:""}ve&&mt&&xt(ve.firstChild);const pn=pi(cn?Ge:ve);for(;zt=pn.nextNode();)qe(zt),On(zt),zt.content instanceof o&&Si(zt.content);if(cn)return Ge;if(Ct){if(Re){ve.normalize();let En=ve.innerHTML;Sd([P,N,I],X=>{En=_c(En,X," ")}),ve.innerHTML=En}if(dt)for(Et=V.call(ve.ownerDocument);ve.firstChild;)Et.appendChild(ve.firstChild);else Et=ve;return(K.shadowroot||K.shadowrootmode)&&(Et=te.call(i,Et,!0)),Et}let Cn=lt?ve.outerHTML:ve.innerHTML;return lt&&O["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&Fi(D3,ve.ownerDocument.doctype.name)&&(Cn="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
99
+ `+Cn),Re&&Sd([P,N,I],En=>{Cn=_c(Cn,En," ")}),T&&gt?T.createHTML(Cn):Cn},t.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pe(Ge),kt=!0},t.clearConfig=function(){Ve=null,kt=!1},t.isValidAttribute=function(Ge,Q,ve){Ve||Pe({});const Be=Ee(Ge),zt=Ee(Q);return ot(Be,zt,ve)},t.addHook=function(Ge,Q){typeof Q=="function"&&xd(J[Ge],Q)},t.removeHook=function(Ge,Q){if(Q!==void 0){const ve=iV(J[Ge],Q);return ve===-1?void 0:rV(J[Ge],ve,1)[0]}return vT(J[Ge])},t.removeHooks=function(Ge){J[Ge]=[]},t.removeAllHooks=function(){J=TT()},t}var Jd=B3();function l1(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pl=l1();function P3(e){Pl=e}var Qd={exec:()=>null};function tn(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(ir.caret,"$1"),n=n.replace(s,l),i},getRegex:()=>new RegExp(n,t)};return i}var kV=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ir={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")},CV=/^(?:[ \t]*(?:\n|$))+/,EV=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,AV=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ih=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,TV=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,c1=/(?:[*+-]|\d{1,9}[.)])/,$3=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,z3=tn($3).replace(/bull/g,c1).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(),RV=tn($3).replace(/bull/g,c1).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(),u1=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,MV=/^[^\n]+/,d1=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,NV=tn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",d1).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),LV=tn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,c1).getRegex(),Sg="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",h1=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,OV=tn("^ {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",h1).replace("tag",Sg).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),F3=tn(u1).replace("hr",Ih).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",Sg).getRegex(),IV=tn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",F3).getRegex(),f1={blockquote:IV,code:EV,def:NV,fences:AV,heading:TV,hr:Ih,html:OV,lheading:z3,list:LV,newline:CV,paragraph:F3,table:Qd,text:MV},RT=tn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ih).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",Sg).getRegex(),jV={...f1,lheading:RV,table:RT,paragraph:tn(u1).replace("hr",Ih).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",RT).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",Sg).getRegex()},DV={...f1,html:tn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",h1).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:Qd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:tn(u1).replace("hr",Ih).replace("heading",` *#{1,6} *[^
100
+ ]`).replace("lheading",z3).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},BV=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,PV=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,H3=/^( {2,}|\\)\n(?!\s*$)/,$V=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xg=/[\p{P}\p{S}]/u,p1=/[\s\p{P}\p{S}]/u,U3=/[^\s\p{P}\p{S}]/u,zV=tn(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,p1).getRegex(),W3=/(?!~)[\p{P}\p{S}]/u,FV=/(?!~)[\s\p{P}\p{S}]/u,HV=/(?:[^\s\p{P}\p{S}]|~)/u,UV=tn(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",kV?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),q3=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,WV=tn(q3,"u").replace(/punct/g,xg).getRegex(),qV=tn(q3,"u").replace(/punct/g,W3).getRegex(),G3="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",GV=tn(G3,"gu").replace(/notPunctSpace/g,U3).replace(/punctSpace/g,p1).replace(/punct/g,xg).getRegex(),KV=tn(G3,"gu").replace(/notPunctSpace/g,HV).replace(/punctSpace/g,FV).replace(/punct/g,W3).getRegex(),VV=tn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,U3).replace(/punctSpace/g,p1).replace(/punct/g,xg).getRegex(),YV=tn(/\\(punct)/,"gu").replace(/punct/g,xg).getRegex(),XV=tn(/^<(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(),ZV=tn(h1).replace("(?:-->|$)","-->").getRegex(),JV=tn("^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",ZV).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Rm=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,QV=tn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Rm).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),K3=tn(/^!?\[(label)\]\[(ref)\]/).replace("label",Rm).replace("ref",d1).getRegex(),V3=tn(/^!?\[(ref)\](?:\[\])?/).replace("ref",d1).getRegex(),eY=tn("reflink|nolink(?!\\()","g").replace("reflink",K3).replace("nolink",V3).getRegex(),MT=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,m1={_backpedal:Qd,anyPunctuation:YV,autolink:XV,blockSkip:UV,br:H3,code:PV,del:Qd,emStrongLDelim:WV,emStrongRDelimAst:GV,emStrongRDelimUnd:VV,escape:BV,link:QV,nolink:V3,punctuation:zV,reflink:K3,reflinkSearch:eY,tag:JV,text:$V,url:Qd},tY={...m1,link:tn(/^!?\[(label)\]\((.*?)\)/).replace("label",Rm).getRegex(),reflink:tn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Rm).getRegex()},Jw={...m1,emStrongRDelimAst:KV,emStrongLDelim:qV,url:tn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",MT).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:tn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",MT).getRegex()},nY={...Jw,br:tn(H3).replace("{2,}","*").getRegex(),text:tn(Jw.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},hp={normal:f1,gfm:jV,pedantic:DV},Ed={normal:m1,gfm:Jw,breaks:nY,pedantic:tY},iY={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},NT=e=>iY[e];function $s(e,t){if(t){if(ir.escapeTest.test(e))return e.replace(ir.escapeReplace,NT)}else if(ir.escapeTestNoEncode.test(e))return e.replace(ir.escapeReplaceNoEncode,NT);return e}function LT(e){try{e=encodeURI(e).replace(ir.percentDecode,"%")}catch{return null}return e}function OT(e,t){let n=e.replace(ir.findPipe,(o,l,d)=>{let f=!1,p=l;for(;--p>=0&&d[p]==="\\";)f=!f;return f?"|":" |"}),i=n.split(ir.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(ir.slashPipe,"|");return i}function Ad(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 rY(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 IT(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 sY(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 Mm=class{options;rules;lexer;constructor(e){this.options=e||Pl}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:Ad(n,`
103
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],i=sY(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=Ad(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:Ad(t[0],`
104
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Ad(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 _=o.at(-1);if(_?.type==="code")break;if(_?.type==="blockquote"){let w=_,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(_?.type==="list"){let w=_,S=w.raw+`
113
+ `+n.join(`
114
+ `),x=this.list(S);o[o.length-1]=x,i=i.substring(0,i.length-_.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,C=>" ".repeat(3*C.length)),_=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(_)&&(p+=_+`
118
+ `,e=e.substring(_.length+1),f=!0),!f){let C=this.rules.other.nextBulletRegex(S),B=this.rules.other.hrRegex(S),H=this.rules.other.fencesBeginRegex(S),T=this.rules.other.headingBeginRegex(S),$=this.rules.other.htmlBeginRegex(S);for(;e;){let j=e.split(`
119
+ `,1)[0],M;if(_=j,this.options.pedantic?(_=_.replace(this.rules.other.listReplaceNesting," "),M=_):M=_.replace(this.rules.other.tabCharGlobal," "),H.test(_)||T.test(_)||$.test(_)||C.test(_)||B.test(_))break;if(M.search(this.rules.other.nonSpaceChar)>=S||!_.trim())m+=`
120
+ `+M.slice(S);else{if(w||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||H.test(y)||T.test(y)||B.test(y))break;m+=`
121
+ `+_}!w&&!_.trim()&&(w=!0),p+=j+`
122
+ `,e=e.substring(j.length+1),y=M.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=OT(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(OT(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=Ad(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=rY(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)),IT(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 IT(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 _=y.slice(2,-2);return{type:"strong",raw:y,text:_,tokens:this.lexer.inlineTokens(_)}}}}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}}}},ys=class Qw{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Pl,this.options.tokenizer=this.options.tokenizer||new Mm,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:ir,block:hp.normal,inline:Ed.normal};this.options.pedantic?(n.block=hp.pedantic,n.inline=Ed.pedantic):this.options.gfm&&(n.block=hp.gfm,this.options.breaks?n.inline=Ed.breaks:n.inline=Ed.gfm),this.tokenizer.rules=n}static get rules(){return{block:hp,inline:Ed}}static lex(t,n){return new Qw(n).lex(t)}static lexInline(t,n){return new Qw(n).inlineTokens(t)}lex(t){t=t.replace(ir.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(ir.tabCharGlobal," ").replace(ir.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),_;this.options.extensions.startInline.forEach(w=>{_=w.call({lexer:this},y),typeof _=="number"&&_>=0&&(m=Math.min(m,_))}),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}},Nm=class{options;parser;constructor(e){this.options=e||Pl}space(e){return""}code({text:e,lang:t,escaped:n}){let i=(t||"").match(ir.notSpaceStart)?.[0],s=e.replace(ir.endingNewline,"")+`
139
+ `;return i?'<pre><code class="language-'+$s(i)+'">'+(n?s:$s(s,!0))+`</code></pre>
140
+ `:"<pre><code>"+(n?s:$s(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+" "+$s(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>${$s(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=LT(e);if(s===null)return i;e=s;let o='<a href="'+e+'"';return t&&(o+=' title="'+$s(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=LT(e);if(s===null)return $s(n);e=s;let o=`<img src="${e}" alt="${n}"`;return t&&(o+=` title="${$s(t)}"`),o+=">",o}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:$s(e.text)}},g1=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""}},vs=class e0{options;renderer;textRenderer;constructor(t){this.options=t||Pl,this.options.renderer=this.options.renderer||new Nm,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new g1}static parse(t,n){return new e0(n).parse(t)}static parseInline(t,n){return new e0(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}},Ud=class{options;block;constructor(e){this.options=e||Pl}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?ys.lex:ys.lexInline}provideParser(){return this.block?vs.parse:vs.parseInline}},Y3=class{defaults=l1();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=vs;Renderer=Nm;TextRenderer=g1;Lexer=ys;Tokenizer=Mm;Hooks=Ud;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 Nm(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 Mm(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 Ud;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];Ud.passThroughHooks.has(o)?s[l]=p=>{if(this.defaults.async&&Ud.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 ys.lex(e,t??this.defaults)}parser(e,t){return vs.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?ys.lex:ys.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?vs.parse:vs.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?ys.lex:ys.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?vs.parse:vs.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>"+$s(n.message+"",!0)+"</pre>";return t?Promise.resolve(i):i}if(t)return Promise.reject(n);throw n}}},Il=new Y3;function wn(e,t){return Il.parse(e,t)}wn.options=wn.setOptions=function(e){return Il.setOptions(e),wn.defaults=Il.defaults,P3(wn.defaults),wn};wn.getDefaults=l1;wn.defaults=Pl;wn.use=function(...e){return Il.use(...e),wn.defaults=Il.defaults,P3(wn.defaults),wn};wn.walkTokens=function(e,t){return Il.walkTokens(e,t)};wn.parseInline=Il.parseInline;wn.Parser=vs;wn.parser=vs.parse;wn.Renderer=Nm;wn.TextRenderer=g1;wn.Lexer=ys;wn.lexer=ys.lex;wn.Tokenizer=Mm;wn.Hooks=Ud;wn.parse=wn;wn.options;wn.setOptions;wn.use;wn.walkTokens;wn.parseInline;vs.parse;ys.lex;var M_,jT;function aY(){if(jT)return M_;jT=1;function e(ee){return ee instanceof Map?ee.clear=ee.delete=ee.set=function(){throw new Error("map is read-only")}:ee instanceof Set&&(ee.add=ee.clear=ee.delete=function(){throw new Error("set is read-only")}),Object.freeze(ee),Object.getOwnPropertyNames(ee).forEach(he=>{const Ee=ee[he],Ve=typeof Ee;(Ve==="object"||Ve==="function")&&!Object.isFrozen(Ee)&&e(Ee)}),ee}class t{constructor(he){he.data===void 0&&(he.data={}),this.data=he.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(ee){return ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function i(ee,...he){const Ee=Object.create(null);for(const Ve in ee)Ee[Ve]=ee[Ve];return he.forEach(function(Ve){for(const Rt in Ve)Ee[Rt]=Ve[Rt]}),Ee}const s="</span>",o=ee=>!!ee.scope,l=(ee,{prefix:he})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const Ee=ee.split(".");return[`${he}${Ee.shift()}`,...Ee.map((Ve,Rt)=>`${Ve}${"_".repeat(Rt+1)}`)].join(" ")}return`${he}${ee}`};class d{constructor(he,Ee){this.buffer="",this.classPrefix=Ee.classPrefix,he.walk(this)}addText(he){this.buffer+=n(he)}openNode(he){if(!o(he))return;const Ee=l(he.scope,{prefix:this.classPrefix});this.span(Ee)}closeNode(he){o(he)&&(this.buffer+=s)}value(){return this.buffer}span(he){this.buffer+=`<span class="${he}">`}}const f=(ee={})=>{const he={children:[]};return Object.assign(he,ee),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 Ee=f({scope:he});this.add(Ee),this.stack.push(Ee)}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,Ee){return typeof Ee=="string"?he.addText(Ee):Ee.children&&(he.openNode(Ee),Ee.children.forEach(Ve=>this._walk(he,Ve)),he.closeNode(Ee)),he}static _collapse(he){typeof he!="string"&&he.children&&(he.children.every(Ee=>typeof Ee=="string")?he.children=[he.children.join("")]:he.children.forEach(Ee=>{p._collapse(Ee)}))}}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,Ee){const Ve=he.root;Ee&&(Ve.scope=`language:${Ee}`),this.add(Ve)}toHTML(){return new d(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function y(ee){return ee?typeof ee=="string"?ee:ee.source:null}function _(ee){return x("(?=",ee,")")}function w(ee){return x("(?:",ee,")*")}function S(ee){return x("(?:",ee,")?")}function x(...ee){return ee.map(Ee=>y(Ee)).join("")}function k(ee){const he=ee[ee.length-1];return typeof he=="object"&&he.constructor===Object?(ee.splice(ee.length-1,1),he):{}}function C(...ee){return"("+(k(ee).capture?"":"?:")+ee.map(Ve=>y(Ve)).join("|")+")"}function B(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function H(ee,he){const Ee=ee&&ee.exec(he);return Ee&&Ee.index===0}const T=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function $(ee,{joinWith:he}){let Ee=0;return ee.map(Ve=>{Ee+=1;const Rt=Ee;let ct=y(Ve),Pe="";for(;ct.length>0;){const Ie=T.exec(ct);if(!Ie){Pe+=ct;break}Pe+=ct.substring(0,Ie.index),ct=ct.substring(Ie.index+Ie[0].length),Ie[0][0]==="\\"&&Ie[1]?Pe+="\\"+String(Number(Ie[1])+Rt):(Pe+=Ie[0],Ie[0]==="("&&Ee++)}return Pe}).map(Ve=>`(${Ve})`).join(he)}const j=/\b\B/,M="[a-zA-Z]\\w*",V="[a-zA-Z_]\\w*",Y="\\b\\d+(\\.\\d+)?",te="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",J="\\b(0b[01]+)",P="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",N=(ee={})=>{const he=/^#![ ]*\//;return ee.binary&&(ee.begin=x(he,/.*\b/,ee.binary,/\b.*/)),i({scope:"meta",begin:he,end:/$/,relevance:0,"on:begin":(Ee,Ve)=>{Ee.index!==0&&Ve.ignoreMatch()}},ee)},I={begin:"\\\\[\\s\\S]",relevance:0},D={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[I]},E={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[I]},L={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/},R=function(ee,he,Ee={}){const Ve=i({scope:"comment",begin:ee,end:he,contains:[]},Ee);Ve.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Rt=C("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 Ve.contains.push({begin:x(/[ ]+/,"(",Rt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Ve},q=R("//","$"),U=R("/\\*","\\*/"),O=R("#","$"),W={scope:"number",begin:Y,relevance:0},K={scope:"number",begin:te,relevance:0},z={scope:"number",begin:J,relevance:0},G={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[I,{begin:/\[/,end:/\]/,relevance:0,contains:[I]}]},Z={scope:"title",begin:M,relevance:0},se={scope:"title",begin:V,relevance:0},Se={begin:"\\.\\s*"+V,relevance:0};var $e=Object.freeze({__proto__:null,APOS_STRING_MODE:D,BACKSLASH_ESCAPE:I,BINARY_NUMBER_MODE:z,BINARY_NUMBER_RE:J,COMMENT:R,C_BLOCK_COMMENT_MODE:U,C_LINE_COMMENT_MODE:q,C_NUMBER_MODE:K,C_NUMBER_RE:te,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(he,Ee)=>{Ee.data._beginMatch=he[1]},"on:end":(he,Ee)=>{Ee.data._beginMatch!==he[1]&&Ee.ignoreMatch()}})},HASH_COMMENT_MODE:O,IDENT_RE:M,MATCH_NOTHING_RE:j,METHOD_GUARD:Se,NUMBER_MODE:W,NUMBER_RE:Y,PHRASAL_WORDS_MODE:L,QUOTE_STRING_MODE:E,REGEXP_MODE:G,RE_STARTERS_RE:P,SHEBANG:N,TITLE_MODE:Z,UNDERSCORE_IDENT_RE:V,UNDERSCORE_TITLE_MODE:se});function je(ee,he){ee.input[ee.index-1]==="."&&he.ignoreMatch()}function St(ee,he){ee.className!==void 0&&(ee.scope=ee.className,delete ee.className)}function Re(ee,he){he&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=je,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function ze(ee,he){Array.isArray(ee.illegal)&&(ee.illegal=C(...ee.illegal))}function lt(ee,he){if(ee.match){if(ee.begin||ee.end)throw new Error("begin & end are not supported with match");ee.begin=ee.match,delete ee.match}}function kt(ee,he){ee.relevance===void 0&&(ee.relevance=1)}const mt=(ee,he)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const Ee=Object.assign({},ee);Object.keys(ee).forEach(Ve=>{delete ee[Ve]}),ee.keywords=Ee.keywords,ee.begin=x(Ee.beforeMatch,_(Ee.begin)),ee.starts={relevance:0,contains:[Object.assign(Ee,{endsParent:!0})]},ee.relevance=0,delete Ee.beforeMatch},Ct=["of","and","for","in","not","or","if","then","parent","list","value"],dt="keyword";function gt(ee,he,Ee=dt){const Ve=Object.create(null);return typeof ee=="string"?Rt(Ee,ee.split(" ")):Array.isArray(ee)?Rt(Ee,ee):Object.keys(ee).forEach(function(ct){Object.assign(Ve,gt(ee[ct],he,ct))}),Ve;function Rt(ct,Pe){he&&(Pe=Pe.map(Ie=>Ie.toLowerCase())),Pe.forEach(function(Ie){const it=Ie.split("|");Ve[it[0]]=[ct,at(it[0],it[1])]})}}function at(ee,he){return he?Number(he):Pt(ee)?0:1}function Pt(ee){return Ct.includes(ee.toLowerCase())}const Ut={},tt=ee=>{console.error(ee)},cn=(ee,...he)=>{console.log(`WARN: ${ee}`,...he)},ke=(ee,he)=>{Ut[`${ee}/${he}`]||(console.log(`Deprecated as of ${ee}. ${he}`),Ut[`${ee}/${he}`]=!0)},De=new Error;function Xe(ee,he,{key:Ee}){let Ve=0;const Rt=ee[Ee],ct={},Pe={};for(let Ie=1;Ie<=he.length;Ie++)Pe[Ie+Ve]=Rt[Ie],ct[Ie+Ve]=!0,Ve+=B(he[Ie-1]);ee[Ee]=Pe,ee[Ee]._emit=ct,ee[Ee]._multi=!0}function _t(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw tt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),De;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw tt("beginScope must be object"),De;Xe(ee,ee.begin,{key:"beginScope"}),ee.begin=$(ee.begin,{joinWith:""})}}function ht(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw tt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),De;if(typeof ee.endScope!="object"||ee.endScope===null)throw tt("endScope must be object"),De;Xe(ee,ee.end,{key:"endScope"}),ee.end=$(ee.end,{joinWith:""})}}function nt(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function st(ee){nt(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),_t(ee),ht(ee)}function _e(ee){function he(Pe,Ie){return new RegExp(y(Pe),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Ie?"g":""))}class Ee{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Ie,it){it.position=this.position++,this.matchIndexes[this.matchAt]=it,this.regexes.push([it,Ie]),this.matchAt+=B(Ie)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Ie=this.regexes.map(it=>it[1]);this.matcherRe=he($(Ie,{joinWith:"|"}),!0),this.lastIndex=0}exec(Ie){this.matcherRe.lastIndex=this.lastIndex;const it=this.matcherRe.exec(Ie);if(!it)return null;const Zt=it.findIndex((Fn,Xn)=>Xn>0&&Fn!==void 0),xt=this.matchIndexes[Zt];return it.splice(0,Zt),Object.assign(it,xt)}}class Ve{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Ie){if(this.multiRegexes[Ie])return this.multiRegexes[Ie];const it=new Ee;return this.rules.slice(Ie).forEach(([Zt,xt])=>it.addRule(Zt,xt)),it.compile(),this.multiRegexes[Ie]=it,it}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Ie,it){this.rules.push([Ie,it]),it.type==="begin"&&this.count++}exec(Ie){const it=this.getMatcher(this.regexIndex);it.lastIndex=this.lastIndex;let Zt=it.exec(Ie);if(this.resumingScanAtSamePosition()&&!(Zt&&Zt.index===this.lastIndex)){const xt=this.getMatcher(0);xt.lastIndex=this.lastIndex+1,Zt=xt.exec(Ie)}return Zt&&(this.regexIndex+=Zt.position+1,this.regexIndex===this.count&&this.considerAll()),Zt}}function Rt(Pe){const Ie=new Ve;return Pe.contains.forEach(it=>Ie.addRule(it.begin,{rule:it,type:"begin"})),Pe.terminatorEnd&&Ie.addRule(Pe.terminatorEnd,{type:"end"}),Pe.illegal&&Ie.addRule(Pe.illegal,{type:"illegal"}),Ie}function ct(Pe,Ie){const it=Pe;if(Pe.isCompiled)return it;[St,lt,st,mt].forEach(xt=>xt(Pe,Ie)),ee.compilerExtensions.forEach(xt=>xt(Pe,Ie)),Pe.__beforeBegin=null,[Re,ze,kt].forEach(xt=>xt(Pe,Ie)),Pe.isCompiled=!0;let Zt=null;return typeof Pe.keywords=="object"&&Pe.keywords.$pattern&&(Pe.keywords=Object.assign({},Pe.keywords),Zt=Pe.keywords.$pattern,delete Pe.keywords.$pattern),Zt=Zt||/\w+/,Pe.keywords&&(Pe.keywords=gt(Pe.keywords,ee.case_insensitive)),it.keywordPatternRe=he(Zt,!0),Ie&&(Pe.begin||(Pe.begin=/\B|\b/),it.beginRe=he(it.begin),!Pe.end&&!Pe.endsWithParent&&(Pe.end=/\B|\b/),Pe.end&&(it.endRe=he(it.end)),it.terminatorEnd=y(it.end)||"",Pe.endsWithParent&&Ie.terminatorEnd&&(it.terminatorEnd+=(Pe.end?"|":"")+Ie.terminatorEnd)),Pe.illegal&&(it.illegalRe=he(Pe.illegal)),Pe.contains||(Pe.contains=[]),Pe.contains=[].concat(...Pe.contains.map(function(xt){return bt(xt==="self"?Pe:xt)})),Pe.contains.forEach(function(xt){ct(xt,it)}),Pe.starts&&ct(Pe.starts,Ie),it.matcher=Rt(it),it}if(ee.compilerExtensions||(ee.compilerExtensions=[]),ee.contains&&ee.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ee.classNameAliases=i(ee.classNameAliases||{}),ct(ee)}function Ne(ee){return ee?ee.endsWithParent||Ne(ee.starts):!1}function bt(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(he){return i(ee,{variants:null},he)})),ee.cachedVariants?ee.cachedVariants:Ne(ee)?i(ee,{starts:ee.starts?i(ee.starts):null}):Object.isFrozen(ee)?i(ee):ee}var Nt="11.11.1";class hn extends Error{constructor(he,Ee){super(he),this.name="HTMLInjectionError",this.html=Ee}}const le=n,me=i,re=Symbol("nomatch"),ge=7,Te=function(ee){const he=Object.create(null),Ee=Object.create(null),Ve=[];let Rt=!0;const ct="Could not find the language '{}', did you forget to load/include a language module?",Pe={disableAutodetect:!0,name:"Plain text",contains:[]};let Ie={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:m};function it(X){return Ie.noHighlightRe.test(X)}function Zt(X){let we=X.className+" ";we+=X.parentNode?X.parentNode.className:"";const Me=Ie.languageDetectRe.exec(we);if(Me){const He=Q(Me[1]);return He||(cn(ct.replace("{}",Me[1])),cn("Falling back to no-highlight mode for this block.",X)),He?Me[1]:"no-highlight"}return we.split(/\s+/).find(He=>it(He)||Q(He))}function xt(X,we,Me){let He="",Ke="";typeof we=="object"?(He=X,Me=we.ignoreIllegals,Ke=we.language):(ke("10.7.0","highlight(lang, code, ...args) has been deprecated."),ke("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Ke=X,He=we),Me===void 0&&(Me=!0);const Yt={code:He,language:Ke};Cn("before:highlight",Yt);const nn=Yt.result?Yt.result:Fn(Yt.language,Yt.code,Me);return nn.code=Yt.code,Cn("after:highlight",nn),nn}function Fn(X,we,Me,He){const Ke=Object.create(null);function Yt(Oe,Qe){return Oe.keywords[Qe]}function nn(){if(!ut.keywords){Hn.addText(rn);return}let Oe=0;ut.keywordPatternRe.lastIndex=0;let Qe=ut.keywordPatternRe.exec(rn),Mt="";for(;Qe;){Mt+=rn.substring(Oe,Qe.index);const Wt=Zn.case_insensitive?Qe[0].toLowerCase():Qe[0],Pn=Yt(ut,Wt);if(Pn){const[Fr,yu]=Pn;if(Hn.addText(Mt),Mt="",Ke[Wt]=(Ke[Wt]||0)+1,Ke[Wt]<=ge&&(Ms+=yu),Fr.startsWith("_"))Mt+=Qe[0];else{const Dh=Zn.classNameAliases[Fr]||Fr;ni(Qe[0],Dh)}}else Mt+=Qe[0];Oe=ut.keywordPatternRe.lastIndex,Qe=ut.keywordPatternRe.exec(rn)}Mt+=rn.substring(Oe),Hn.addText(Mt)}function xn(){if(rn==="")return;let Oe=null;if(typeof ut.subLanguage=="string"){if(!he[ut.subLanguage]){Hn.addText(rn);return}Oe=Fn(ut.subLanguage,rn,!0,Uo[ut.subLanguage]),Uo[ut.subLanguage]=Oe._top}else Oe=pi(rn,ut.subLanguage.length?ut.subLanguage:null);ut.relevance>0&&(Ms+=Oe.relevance),Hn.__addSublanguage(Oe._emitter,Oe.language)}function Xt(){ut.subLanguage!=null?xn():nn(),rn=""}function ni(Oe,Qe){Oe!==""&&(Hn.startScope(Qe),Hn.addText(Oe),Hn.endScope())}function As(Oe,Qe){let Mt=1;const Wt=Qe.length-1;for(;Mt<=Wt;){if(!Oe._emit[Mt]){Mt++;continue}const Pn=Zn.classNameAliases[Oe[Mt]]||Oe[Mt],Fr=Qe[Mt];Pn?ni(Fr,Pn):(rn=Fr,nn(),rn=""),Mt++}}function yt(Oe,Qe){return Oe.scope&&typeof Oe.scope=="string"&&Hn.openNode(Zn.classNameAliases[Oe.scope]||Oe.scope),Oe.beginScope&&(Oe.beginScope._wrap?(ni(rn,Zn.classNameAliases[Oe.beginScope._wrap]||Oe.beginScope._wrap),rn=""):Oe.beginScope._multi&&(As(Oe.beginScope,Qe),rn="")),ut=Object.create(Oe,{parent:{value:ut}}),ut}function on(Oe,Qe,Mt){let Wt=H(Oe.endRe,Mt);if(Wt){if(Oe["on:end"]){const Pn=new t(Oe);Oe["on:end"](Qe,Pn),Pn.isMatchIgnored&&(Wt=!1)}if(Wt){for(;Oe.endsParent&&Oe.parent;)Oe=Oe.parent;return Oe}}if(Oe.endsWithParent)return on(Oe.parent,Qe,Mt)}function ii(Oe){return ut.matcher.regexIndex===0?(rn+=Oe[0],1):(Ha=!0,0)}function lr(Oe){const Qe=Oe[0],Mt=Oe.rule,Wt=new t(Mt),Pn=[Mt.__beforeBegin,Mt["on:begin"]];for(const Fr of Pn)if(Fr&&(Fr(Oe,Wt),Wt.isMatchIgnored))return ii(Qe);return Mt.skip?rn+=Qe:(Mt.excludeBegin&&(rn+=Qe),Xt(),!Mt.returnBegin&&!Mt.excludeBegin&&(rn=Qe)),yt(Mt,Oe),Mt.returnBegin?0:Qe.length}function mn(Oe){const Qe=Oe[0],Mt=we.substring(Oe.index),Wt=on(ut,Oe,Mt);if(!Wt)return re;const Pn=ut;ut.endScope&&ut.endScope._wrap?(Xt(),ni(Qe,ut.endScope._wrap)):ut.endScope&&ut.endScope._multi?(Xt(),As(ut.endScope,Oe)):Pn.skip?rn+=Qe:(Pn.returnEnd||Pn.excludeEnd||(rn+=Qe),Xt(),Pn.excludeEnd&&(rn=Qe));do ut.scope&&Hn.closeNode(),!ut.skip&&!ut.subLanguage&&(Ms+=ut.relevance),ut=ut.parent;while(ut!==Wt.parent);return Wt.starts&&yt(Wt.starts,Oe),Pn.returnEnd?0:Qe.length}function zr(){const Oe=[];for(let Qe=ut;Qe!==Zn;Qe=Qe.parent)Qe.scope&&Oe.unshift(Qe.scope);Oe.forEach(Qe=>Hn.openNode(Qe))}let cr={};function Ts(Oe,Qe){const Mt=Qe&&Qe[0];if(rn+=Oe,Mt==null)return Xt(),0;if(cr.type==="begin"&&Qe.type==="end"&&cr.index===Qe.index&&Mt===""){if(rn+=we.slice(Qe.index,Qe.index+1),!Rt){const Wt=new Error(`0 width match regex (${X})`);throw Wt.languageName=X,Wt.badRule=cr.rule,Wt}return 1}if(cr=Qe,Qe.type==="begin")return lr(Qe);if(Qe.type==="illegal"&&!Me){const Wt=new Error('Illegal lexeme "'+Mt+'" for mode "'+(ut.scope||"<unnamed>")+'"');throw Wt.mode=ut,Wt}else if(Qe.type==="end"){const Wt=mn(Qe);if(Wt!==re)return Wt}if(Qe.type==="illegal"&&Mt==="")return rn+=`
160
+ `,1;if(Wo>1e5&&Wo>Qe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return rn+=Mt,Mt.length}const Zn=Q(X);if(!Zn)throw tt(ct.replace("{}",X)),new Error('Unknown language: "'+X+'"');const ri=_e(Zn);let Rs="",ut=He||ri;const Uo={},Hn=new Ie.__emitter(Ie);zr();let rn="",Ms=0,fs=0,Wo=0,Ha=!1;try{if(Zn.__emitTokens)Zn.__emitTokens(we,Hn);else{for(ut.matcher.considerAll();;){Wo++,Ha?Ha=!1:ut.matcher.considerAll(),ut.matcher.lastIndex=fs;const Oe=ut.matcher.exec(we);if(!Oe)break;const Qe=we.substring(fs,Oe.index),Mt=Ts(Qe,Oe);fs=Oe.index+Mt}Ts(we.substring(fs))}return Hn.finalize(),Rs=Hn.toHTML(),{language:X,value:Rs,relevance:Ms,illegal:!1,_emitter:Hn,_top:ut}}catch(Oe){if(Oe.message&&Oe.message.includes("Illegal"))return{language:X,value:le(we),illegal:!0,relevance:0,_illegalBy:{message:Oe.message,index:fs,context:we.slice(fs-100,fs+100),mode:Oe.mode,resultSoFar:Rs},_emitter:Hn};if(Rt)return{language:X,value:le(we),illegal:!1,relevance:0,errorRaised:Oe,_emitter:Hn,_top:ut};throw Oe}}function Xn(X){const we={value:le(X),illegal:!1,relevance:0,_top:Pe,_emitter:new Ie.__emitter(Ie)};return we._emitter.addText(X),we}function pi(X,we){we=we||Ie.languages||Object.keys(he);const Me=Xn(X),He=we.filter(Q).filter(Be).map(Xt=>Fn(Xt,X,!1));He.unshift(Me);const Ke=He.sort((Xt,ni)=>{if(Xt.relevance!==ni.relevance)return ni.relevance-Xt.relevance;if(Xt.language&&ni.language){if(Q(Xt.language).supersetOf===ni.language)return 1;if(Q(ni.language).supersetOf===Xt.language)return-1}return 0}),[Yt,nn]=Ke,xn=Yt;return xn.secondBest=nn,xn}function fn(X,we,Me){const He=we&&Ee[we]||Me;X.classList.add("hljs"),X.classList.add(`language-${He}`)}function Kt(X){let we=null;const Me=Zt(X);if(it(Me))return;if(Cn("before:highlightElement",{el:X,language:Me}),X.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",X);return}if(X.children.length>0&&(Ie.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(X)),Ie.throwUnescapedHTML))throw new hn("One of your code blocks includes unescaped HTML.",X.innerHTML);we=X;const He=we.textContent,Ke=Me?xt(He,{language:Me,ignoreIllegals:!0}):pi(He);X.innerHTML=Ke.value,X.dataset.highlighted="yes",fn(X,Me,Ke.language),X.result={language:Ke.language,re:Ke.relevance,relevance:Ke.relevance},Ke.secondBest&&(X.secondBest={language:Ke.secondBest.language,relevance:Ke.secondBest.relevance}),Cn("after:highlightElement",{el:X,result:Ke,text:He})}function oe(X){Ie=me(Ie,X)}const qe=()=>{$t(),ke("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function ot(){$t(),ke("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let an=!1;function $t(){function X(){$t()}if(document.readyState==="loading"){an||window.addEventListener("DOMContentLoaded",X,!1),an=!0;return}document.querySelectorAll(Ie.cssSelector).forEach(Kt)}function On(X,we){let Me=null;try{Me=we(ee)}catch(He){if(tt("Language definition for '{}' could not be registered.".replace("{}",X)),Rt)tt(He);else throw He;Me=Pe}Me.name||(Me.name=X),he[X]=Me,Me.rawDefinition=we.bind(null,ee),Me.aliases&&ve(Me.aliases,{languageName:X})}function Si(X){delete he[X];for(const we of Object.keys(Ee))Ee[we]===X&&delete Ee[we]}function Ge(){return Object.keys(he)}function Q(X){return X=(X||"").toLowerCase(),he[X]||he[Ee[X]]}function ve(X,{languageName:we}){typeof X=="string"&&(X=[X]),X.forEach(Me=>{Ee[Me.toLowerCase()]=we})}function Be(X){const we=Q(X);return we&&!we.disableAutodetect}function zt(X){X["before:highlightBlock"]&&!X["before:highlightElement"]&&(X["before:highlightElement"]=we=>{X["before:highlightBlock"](Object.assign({block:we.el},we))}),X["after:highlightBlock"]&&!X["after:highlightElement"]&&(X["after:highlightElement"]=we=>{X["after:highlightBlock"](Object.assign({block:we.el},we))})}function Et(X){zt(X),Ve.push(X)}function pn(X){const we=Ve.indexOf(X);we!==-1&&Ve.splice(we,1)}function Cn(X,we){const Me=X;Ve.forEach(function(He){He[Me]&&He[Me](we)})}function En(X){return ke("10.7.0","highlightBlock will be removed entirely in v12.0"),ke("10.7.0","Please use highlightElement now."),Kt(X)}Object.assign(ee,{highlight:xt,highlightAuto:pi,highlightAll:$t,highlightElement:Kt,highlightBlock:En,configure:oe,initHighlighting:qe,initHighlightingOnLoad:ot,registerLanguage:On,unregisterLanguage:Si,listLanguages:Ge,getLanguage:Q,registerAliases:ve,autoDetection:Be,inherit:me,addPlugin:Et,removePlugin:pn}),ee.debugMode=function(){Rt=!1},ee.safeMode=function(){Rt=!0},ee.versionString=Nt,ee.regex={concat:x,lookahead:_,either:C,optional:S,anyNumberOfTimes:w};for(const X in $e)typeof $e[X]=="object"&&e($e[X]);return Object.assign(ee,$e),ee},We=Te({});return We.newInstance=()=>Te({}),M_=We,We.HighlightJS=We,We.default=We,M_}var oY=aY();const Zr=V0(oY);function DT(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]},_=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],w=e.SHEBANG({binary:`(${_.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"],C={match:/(\/[a-z._-]+)+/},B=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],H=["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:[...B,...H,"set","shopt",...T,...$]},contains:[w,e.SHEBANG(),S,y,o,l,C,d,f,p,m,n]}}const BT="[A-Za-z$_][0-9A-Za-z$_]*",lY=["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"],cY=["true","false","null","undefined","NaN","Infinity"],X3=["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"],Z3=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],J3=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],uY=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],dY=[].concat(J3,X3,Z3);function PT(e){const t=e.regex,n=(R,{after:q})=>{const U="</"+R[0].slice(1);return R.input.indexOf(U,q)!==-1},i=BT,s={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,q)=>{const U=R[0].length+R.index,O=R.input[U];if(O==="<"||O===","){q.ignoreMatch();return}O===">"&&(n(R,{after:U})||q.ignoreMatch());let W;const K=R.input.substring(U);if(W=K.match(/^\s*=/)){q.ignoreMatch();return}if((W=K.match(/^\s+extends\s+/))&&W.index===0){q.ignoreMatch();return}}},d={$pattern:BT,keyword:lY,literal:cY,built_in:dY,"variable.language":uY},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},_={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"xml"}},S={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,_]},B={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},H=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,{match:/\$\d+/},y];_.contains=H.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(H)});const T=[].concat(B,_.contains),$=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},M={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:{_:[...X3,...Z3]}},Y={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P(R){return t.concat("(?!",R.join("|"),")")}const N={match:t.concat(/\b/,P([...J3,"super","import"].map(R=>`${R}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};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}),Y,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,B,{match:/\$\d+/},y,V,{scope:"attr",match:i+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin: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"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},N,J,M,D,{match:/\$[(.]/}]}}function hY(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 $T(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:[]}),_=e.inherit(m,{contains:[]});p.contains.push(_),m.contains.push(y);let w=[n,f];return[p,m,y,_].forEach(C=>{C.contains=C.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 zT(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]},_="[0-9](_?[0-9])*",w=`(\\b(${_}))?\\.(${_})|\\b(${_})\\.`,S=`\\b|${i.join("|")}`,x={className:"number",relevance:0,variants:[{begin:`(\\b(${_})|(${w}))[eE][+-]?(${_})[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(${_})[jJ](?=${S})`}]},k={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:d,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},C={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:[C]},{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,C,y]}]}}const Lm="[A-Za-z$_][0-9A-Za-z$_]*",Q3=["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"],eO=["true","false","null","undefined","NaN","Infinity"],tO=["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"],nO=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],iO=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],rO=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],sO=[].concat(iO,tO,nO);function fY(e){const t=e.regex,n=(R,{after:q})=>{const U="</"+R[0].slice(1);return R.input.indexOf(U,q)!==-1},i=Lm,s={begin:"<>",end:"</>"},o=/<[A-Za-z0-9\\._:-]+\s*\/>/,l={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,q)=>{const U=R[0].length+R.index,O=R.input[U];if(O==="<"||O===","){q.ignoreMatch();return}O===">"&&(n(R,{after:U})||q.ignoreMatch());let W;const K=R.input.substring(U);if(W=K.match(/^\s*=/)){q.ignoreMatch();return}if((W=K.match(/^\s+extends\s+/))&&W.index===0){q.ignoreMatch();return}}},d={$pattern:Lm,keyword:Q3,literal:eO,built_in:sO,"variable.language":rO},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},_={className:"subst",begin:"\\$\\{",end:"\\}",keywords:d,contains:[]},w={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"xml"}},S={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"css"}},x={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"graphql"}},k={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,_]},B={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:i+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},H=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,{match:/\$\d+/},y];_.contains=H.concat({begin:/\{/,end:/\}/,keywords:d,contains:["self"].concat(H)});const T=[].concat(B,_.contains),$=T.concat([{begin:/(\s*)\(/,end:/\)/,keywords:d,contains:["self"].concat(T)}]),j={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$},M={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:{_:[...tO,...nO]}},Y={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},te={variants:[{match:[/function/,/\s+/,i,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[j],illegal:/%/},J={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function P(R){return t.concat("(?!",R.join("|"),")")}const N={match:t.concat(/\b/,P([...iO,"super","import"].map(R=>`${R}\\s*\\(`)),i,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(i,/(?![0-9A-Za-z$_(])/))),end:i,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},D={match:[/get|set/,/\s+/,i,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},j]},E="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,i,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(E)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[j]};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}),Y,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,w,S,x,k,B,{match:/\$\d+/},y,V,{scope:"attr",match:i+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[B,e.REGEXP_MODE,{className:"function",begin:E,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:d,contains:$}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin: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"]}]}]},te,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[j,e.inherit(e.TITLE_MODE,{begin:i,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+i,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[j]},N,J,M,D,{match:/\$[(.]/}]}}function FT(e){const t=e.regex,n=fY(e),i=Lm,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:Lm,keyword:Q3.concat(f),literal:eO,built_in:sO.concat(s),"variable.language":rO},m={className:"meta",begin:"@"+i},y=(x,k,C)=>{const B=x.contains.findIndex(H=>H.label===k);if(B===-1)throw new Error("can not find mode to replace");x.contains.splice(B,1,C)};Object.assign(n.keywords,p),n.exports.PARAMS_CONTAINS.push(m);const _=n.contains.find(x=>x.scope==="attr"),w=Object.assign({},_,{match:t.concat(i,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,_,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 pY=/\[\[wiki:([^\]]+)\]\]/g,mY=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,gY=/^(\S[^:]*?):[ \t]*(.*)$/,yY=new Y3({gfm:!0,breaks:!1}),HT={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},N_=NY();function us(e,t={}){const{entries:n,content:i}=bY(e),s=xY(i,t.resolveWikiLink),o=yY.parse(s,{async:!1}),l=SY(n),d=Jd.sanitize(l+o,HT),f=new DOMParser().parseFromString(d,"text/html");return CY(f,t.omitDuplicateTitle),kY(f),EY(f,{copyLabel:t.copyLabel??"Copy",copyAriaLabel:t.copyAriaLabel??(m=>`Copy ${m} code`)}),TY(f),{html:Jd.sanitize(f.body.innerHTML,HT),toc:RY(f)}}function vY(e){const t=new TextEncoder().encode(e);let n="";for(const i of t)n+=String.fromCharCode(i);return btoa(n)}function _Y(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 bY(e){const t=mY.exec(e);return t?{entries:wY(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function wY(e){const t=[];for(const n of e.split(/\r?\n/)){const i=n.replace(/\s+$/,"");if(i.trim()==="")continue;const s=gY.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 SY(e){return e.length===0?"":`<dl class="frontmatter">${e.map(n=>`<dt>${eh(n.key)}</dt><dd>${eh(n.value)}</dd>`).join("")}</dl>`}function xY(e,t){return e.replace(pY,(n,i)=>{const s=i.trim();if(!s)return"";if(!t)return eh(`[[wiki:${s}]]`);const o=t(s);if(o===null)return eh(`[[wiki:${s}]]`);const l=eh(s),d=encodeURIComponent(s);return`<a href="${o}" data-entry-id="${d}">${l}</a>`})}function kY(e){const t=new Map;for(const n of e.querySelectorAll("h2, h3")){const i=n.textContent?.trim()??"",s=IY(i||"section"),o=t.get(s)??0;t.set(s,o+1),n.id=o===0?s:`${s}-${o+1}`}}function CY(e,t){if(!t)return;const n=e.body.querySelector("h1, h2, h3, h4, h5, h6");!n||n.tagName.toLowerCase()!=="h1"||UT(n.textContent??"")===UT(t)&&n.remove()}function EY(e,t){for(const n of e.querySelectorAll("pre > code")){const i=LY(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",vY(s)),d.setAttribute("data-diagram-state","pending"),o.replaceWith(d);continue}const l=MY(s,i);n.innerHTML=l,n.classList.add("hljs"),o.classList.add("code-block"),o.dataset.code=s,o.insertBefore(AY(e,i||"text",t),o.firstChild)}}function AY(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 TY(e){for(const t of e.querySelectorAll("a")){const n=t.getAttribute("href")??"";OY(n)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function RY(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 MY(e,t){return t&&N_.getLanguage(t)?N_.highlight(e,{language:t}).value:N_.highlightAuto(e).value}function NY(){return Zr.registerLanguage("bash",DT),Zr.registerLanguage("sh",DT),Zr.registerLanguage("javascript",PT),Zr.registerLanguage("js",PT),Zr.registerLanguage("json",hY),Zr.registerLanguage("markdown",$T),Zr.registerLanguage("md",$T),Zr.registerLanguage("python",zT),Zr.registerLanguage("py",zT),Zr.registerLanguage("typescript",FT),Zr.registerLanguage("ts",FT),Zr}function LY(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function OY(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function IY(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function UT(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function eh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const aO={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 Or=aO;const jY=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",DY=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),BY=/^on/i,PY={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},WT="diagramInteractionBound",$Y=/^oklch\s*\(\s*([^)]+)\s*\)$/i,zY=/^(-?\d+(?:\.\d+)?)(deg)?$/i,is=[25,50,75,100,125,150,200],FY=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let L_=null;const qT=new WeakSet;let HY=0,UY=0,yh=null;function Co(e){const t=e.trim();if(!t)return t;const n=dX(t);return n?hX(n):t}function vh(e,t){if(t&&(Or={...aO,...t}),qT.has(e))return;qT.add(e),GT(e);const n=e instanceof Node?e:document.body;new MutationObserver(s=>{let o=!1;for(const l of s)if(l.type==="childList"){yh&&!yh.trigger.isConnected&&Wd(!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&&GT(e)}).observe(n,{childList:!0,subtree:!0})}function GT(e){const t=e.querySelectorAll(jY);for(const n of t)n.dataset.diagramHydrating!=="true"&&(n.dataset.diagramHydrating="true",n.dataset.diagramState="pending",WY(n))}async function WY(e){const t=e.getAttribute("data-mermaid-source")??"";let n="";try{n=_Y(t)}catch{O_(e,"Invalid diagram source");return}if(!n.trim()){O_(e,"Empty diagram source");return}try{const i=await GY(),s=`mermaid-diagram-${++HY}`,{svg:o}=await i.render(s,n);e.innerHTML=qY(o),YY(e,o),XY(e),ZY(e),e.dataset.diagramState="rendered"}catch(i){const s=i instanceof Error?i.message:String(i);O_(e,s)}}function O_(e,t){e.dataset.diagramState="error",e.textContent=Or.renderFailed(t)}function qY(e){const t=(n,i)=>{BY.test(i.attrName)&&(i.keepAttr=!1)};Jd.addHook("uponSanitizeAttribute",t);try{return Jd.sanitize(e,PY)}finally{Jd.removeHook("uponSanitizeAttribute",t)}}async function GY(){return L_||(L_=(async()=>{const e=await QK(()=>import("./mermaid.core-Clx-Pww4.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:KY(),themeCSS:VY(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),L_}function KY(){const e=getComputedStyle(document.documentElement),t=(x,k)=>{const C=e.getPropertyValue(x).trim();return Co(C||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"),_=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(FY.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:_,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 VY(){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 YY(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=lO(p);m&&f.setAttribute("href",m)}}function XY(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",`${Bc(i)} ${Bc(s)} ${Bc(o)} ${Bc(l)}`)}function ZY(e){e.tabIndex=0,e.setAttribute("aria-label",Or.openExpandedAria),lX(e),e.dataset[WT]!=="true"&&(e.dataset[WT]="true",e.addEventListener("click",JY),e.addEventListener("keydown",QY))}function JY(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Om(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),oO(t))}function QY(e){if(e.key!=="Enter"&&e.key!==" "||Om(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),oO(t))}function oO(e){const t=e.querySelector("svg");if(!t)return;Wd(!1);const n=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",i=document.createElement(n?"dialog":"div"),s=++UY,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=Or.lightboxTitle;const p=document.createElement("button");p.className="diagram-lightbox__close",p.type="button",p.setAttribute("aria-label",Or.closeExpandedAria),p.textContent=Or.close;const m=document.createElement("div");m.className="diagram-lightbox__controls",m.setAttribute("aria-label",Or.zoomControlsAria);const y=fp("−",Or.zoomOutAria,"out"),_=document.createElement("span");_.className="diagram-lightbox__zoom-readout",_.setAttribute("aria-live","polite");const w=fp("+",Or.zoomInAria,"in"),S=fp(Or.fit,Or.fitAria,"fit"),x=fp(Or.reset,Or.resetAria,"reset");m.append(y,_,w,S,x);const k=document.createElement("div");k.className="diagram-lightbox__viewport";const C=nX(t),B=t.cloneNode(!0);B.removeAttribute("style"),rX(B,`diagram-lightbox-svg-${s}`),k.append(B),d.append(f,m,p),l.append(d,k),i.append(l),document.body.append(i);const H=new eX(k,B,_,C);y.addEventListener("click",()=>H.zoomOut()),w.addEventListener("click",()=>H.zoomIn()),S.addEventListener("click",()=>H.fit()),x.addEventListener("click",()=>H.reset());const T=sX(i),$=V=>{(V.target===i||V.target===p)&&Wd(!0)},j=V=>{if(V.key==="Escape"){V.preventDefault(),Wd(!0);return}H.handleKeyboard(V)||V.key==="Tab"&&oX(V,i)},M={dialog:i,trigger:e,inertStates:T,onClick:$,onKeyDown:j,cleanupPanZoom:()=>H.destroy()};n&&(M.onCancel=V=>{V.preventDefault(),Wd(!0)},i.addEventListener("cancel",M.onCancel),i.showModal()),i.addEventListener("click",$),document.addEventListener("keydown",j,!0),yh=M,H.fit(),p.focus()}function fp(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 eX{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=is.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,is.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(is.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=is.findIndex(d=>d>s),l=o===-1?is.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*(pp(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(pp(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const n=pp(this.zoomIndex),i=n/100;this.svg.setAttribute("width",Bc(this.baseSize.width*i)),this.svg.setAttribute("height",Bc(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||Om(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=pp(this.pinchStart.zoomIndex)*i;this.applyZoom(iX(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,is.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(n,t.clientX,t.clientY)};onDoubleClick=t=>{Om(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===is.indexOf(200)?is.indexOf(100):is.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 tX(e){const t=KT(e.getAttribute("width")),n=KT(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 nX(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:tX(e)}function KT(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 Bc(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function iX(e){let t=0,n=Number.POSITIVE_INFINITY;return is.forEach((i,s)=>{const o=Math.abs(i-e);o<n&&(n=o,t=s)}),t}function pp(e){return is[e]??is[0]}function rX(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 Wd(e){const t=yh;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),aX(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),yh=null,e&&t.trigger.isConnected&&t.trigger.focus())}function sX(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 aX(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 oX(e,t){const n=Array.from(t.querySelectorAll(DY)).filter(uX);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 lX(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Om(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!cX(t)}function cX(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function uX(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function lO(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:lO(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 dX(e){const t=$Y.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=I_(d,1),y=I_(f,.4),_=fX(p);if(m===null||y===null||_===null)return null;let w=1;if(i>=0){const S=I_(o,1);if(S===null)return null;w=S}return{L:m,C:y,h:_,alpha:w}}function hX(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,_=-1.2684380046*f+2.6097574011*p-.3413193965*m,w=-.0041960863*f-.7034186147*p+1.707614701*m,S=mp(j_(y)),x=mp(j_(_)),k=mp(j_(w));if(e.alpha<1){const C=mp(e.alpha);return`#${ul(S)}${ul(x)}${ul(k)}${ul(C)}`}return`#${ul(S)}${ul(x)}${ul(k)}`}function I_(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 fX(e){const t=zY.exec(e);if(!t)return null;const n=Number(t[1]);return Number.isFinite(n)?n:null}function j_(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 mp(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function ul(e){return e.toString(16).padStart(2,"0")}const pX=32;function D_(e){const t=Tt(e);return{copyLabel:t("terminal.markdown.copy"),copyAriaLabel:n=>t("terminal.markdown.copyCodeAria",{language:n})}}const cO=g.memo(function({text:t,streaming:n,className:i,language:s="en"}){const o=g.useRef(t),l=g.useRef(n?t:""),d=g.useRef(null),[f,p]=g.useState(()=>n?us(t,D_(s)).html:"");o.current=t;const m=g.useMemo(()=>n?null:us(t,D_(s)).html,[n,t,s]);return g.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(us(y,D_(s)).html))},pX))},[n,t,s]),g.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]),c.jsx("div",{className:i,dangerouslySetInnerHTML:{__html:m??f}})}),mX=[{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"}],gX=[{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"}],yX=[{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"}],Na="session-analyst-artifacts";function vX({context:e}){const{state:t,dispatch:n,send:i,stop:s,reset:o}=o1(e),l=e.language??"en",d=Tt(l),f=TX(),[p,m]=g.useState(0),[y,_]=g.useState(!1),w=t.catalog?.clis.find(z=>z.cliId===t.cliId),S=w?.models.find(z=>z.id===t.model),x=t.entries.length>0,k=t.artifacts.length,C=e.hiddenCompanionPanelIds,B=e.onSetCompanionPanelVisible,H=C!==void 0&&B!==void 0,T=C?.includes(Na)??!1,$=k>0&&!T,j=t.artifactAuthoring!==null&&k===0,M=g.useRef(0),[V,Y]=g.useState(0),te=g.useRef(null),J=g.useRef(null),P=g.useRef(null),N=t.entries.at(-1),I=t.draft.startsWith("/")?yX.filter(z=>z.command.toLowerCase().startsWith(t.draft.toLowerCase())):[],D=!y&&I.length>0,E=`analysis-${e.operationId}-slash-listbox`,L=z=>`analysis-${e.operationId}-slash-${z.slice(1)}`,R=D?I[Math.min(p,I.length-1)]:void 0,q=g.useRef(x).current,U=x&&!q;g.useLayoutEffect(()=>{const z=J.current;!z||!x||(z.scrollTop=z.scrollHeight)},[x,N?.text,t.entries.length,t.latestActivity,t.phase,t.artifactAuthoring,t.artifactPublished]),g.useLayoutEffect(()=>{const z=P.current;z&&VT(z)},[t.draft]),g.useLayoutEffect(()=>{const z=P.current;if(!z||typeof ResizeObserver>"u")return;const G=new ResizeObserver(()=>VT(z));return G.observe(z),()=>G.disconnect()},[]),g.useEffect(()=>{const z=J.current;z&&vh(z,IK(l))},[l]),g.useEffect(()=>{const z=M.current;if(M.current=k,!(!H||!B)){if(k===0){if(t.artifactsAutoOpenArmed||n({type:"artifacts-chip-rearm"}),!T){const G=document.activeElement instanceof Element&&document.activeElement.closest(".session-analyst__artifacts")!==null;B(Na,!1),G&&window.requestAnimationFrame(()=>te.current?.focus())}return}if(z===0&&T&&t.artifactsAutoOpenArmed){B(Na,!0);return}k>z&&T&&Y(G=>G+1)}},[k,T,n,B,t.artifactsAutoOpenArmed,H]);const O=async(z,G)=>{const Z=z.trim();if(Z){if(t.busy){n({type:"queue-push",text:Z}),G&&n({type:"set-draft",draft:""});return}G&&n({type:"set-draft",draft:""}),await i(Z)}},W=z=>{const G=I[z];G&&(n({type:"set-draft",draft:d(G.templateKey)}),_(!0),m(0),window.requestAnimationFrame(()=>P.current?.focus()))},K=g.useCallback(z=>{const G=z.target.closest('[data-action="copy-code"]');if(!G)return;const Z=G.closest("pre")?.getAttribute("data-code");Z&&_X(G,Z,l)},[l]);return c.jsxs("section",{className:`session-analyst__chat-pane ${x?"has-interacted":"is-initial"}`,"aria-label":d("terminal.analyst.chatAria"),"data-phase":t.phase,children:[H?c.jsxs("button",{ref:te,type:"button",className:`session-analyst-handle session-analyst-handle--artifacts${k===0?" is-waiting":""}${j?" is-authoring":""}`,"aria-label":d($?"terminal.analyst.hideArtifacts":"terminal.analyst.openArtifacts"),"aria-pressed":$,"aria-disabled":k===0,tabIndex:k===0?-1:void 0,title:j?d("terminal.analyst.authoringTooltip"):k===0?d("terminal.analyst.artifactsEmptyTooltip"):void 0,onClick:()=>{!B||k===0||($&&n({type:"artifacts-chip-disarm"}),B(Na,!$))},children:[c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:$?"«":"»"}),k>0?c.jsx("span",{className:`session-analyst-handle__count${V>0?" is-pulsing":""}`,children:k},V):null,j?c.jsx("span",{className:"session-analyst-handle__count",children:"…"}):null,c.jsx("span",{className:"session-analyst-handle__label",children:d("terminal.analyst.artifactsHandle")})]}):null,c.jsx(bX,{state:t,language:l,onReset:()=>{o().catch(()=>{})}}),c.jsxs("div",{className:"session-analyst__workspace",children:[c.jsxs("section",{ref:J,className:"session-analyst__chat","aria-live":"polite","aria-busy":t.busy,children:[x?c.jsx("ol",{className:"session-analyst__transcript",onClick:K,children:t.entries.map((z,G)=>c.jsx("li",{className:`session-analyst__message session-analyst__message--${z.role}`,children:z.role==="analyst"?c.jsx(cO,{className:"session-analyst__response markdown-body",text:z.text,streaming:t.busy&&G===t.entries.length-1,language:l}):z.text},`${z.role}-${G}`))}):c.jsxs("div",{className:"session-analyst__hero-wrap",children:[c.jsxs("header",{className:"session-analyst__hero",children:[c.jsx("span",{className:"session-analyst__sigil","aria-hidden":"true",children:"✳"}),c.jsx("h2",{children:d("terminal.analyst.askAboutSession")}),c.jsx("p",{children:d("terminal.analyst.heroBody")})]}),c.jsx("div",{className:"session-analyst__suggestions",children:mX.map(z=>c.jsxs("button",{type:"button",onClick:()=>{O(d(z.textKey),!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":z.tone,"aria-hidden":"true",children:z.icon}),d(z.textKey)]},z.textKey))})]}),t.artifactAuthoring||t.artifactPublished?c.jsx(wX,{state:t,language:l,onOpen:H&&B?()=>B(Na,!0):void 0}):null,t.phase!=="idle"?c.jsx(SX,{state:t,language:l}):null]}),t.queue.length>0?c.jsx("div",{className:"session-analyst__queue","aria-live":"polite",children:t.queue.map((z,G)=>c.jsxs("div",{className:"session-analyst__queue-item",children:[c.jsx("span",{className:"session-analyst__queue-tag",children:d("terminal.analyst.queued")}),c.jsx("span",{className:"session-analyst__queue-text",children:z}),c.jsx("button",{type:"button","aria-label":d("terminal.analyst.cancelQueued",{"index + 1":G+1}),onClick:()=>n({type:"queue-cancel",index:G}),children:"✕"})]},`${z}-${G}`))}):null,t.phase==="complete"&&!t.busy&&x?c.jsxs("div",{className:"session-analyst__followups",children:[c.jsx("span",{className:"session-analyst__followups-label",children:d("terminal.analyst.followUp")}),c.jsx("div",{className:"session-analyst__followups-row",children:gX.map(z=>c.jsxs("button",{type:"button",onClick:()=>{O(d(z.textKey),!1)},children:[c.jsx("span",{className:"session-analyst__suggestion-icon","data-tone":z.tone,"aria-hidden":"true",children:z.icon}),d(z.labelKey)]},z.labelKey))})]}):null,c.jsxs("form",{className:`session-analyst__composer ${x?"is-docked":"is-initial"}${U?" is-docking":""}${t.busy?" is-working":""}`,"aria-busy":t.busy,onSubmit:z=>{z.preventDefault(),O(t.draft,!0)},children:[D?c.jsxs("div",{id:E,className:"session-analyst__slash",role:"listbox","aria-label":d("terminal.analyst.commands"),children:[c.jsx("span",{className:"session-analyst__slash-heading",children:d("terminal.analyst.commands")}),I.map((z,G)=>c.jsxs("button",{type:"button",id:L(z.command),role:"option","aria-selected":G===p,className:G===p?"is-selected":void 0,onMouseDown:Z=>Z.preventDefault(),onClick:()=>W(G),children:[c.jsx("span",{children:z.command}),c.jsx("small",{children:d(z.descriptionKey)})]},z.command))]}):null,x?null:c.jsxs("div",{className:"session-analyst__selector-strip","aria-label":d("terminal.analyst.initialSettings"),children:[c.jsx("span",{className:"session-analyst__select",children:c.jsx(qi,{compact:!0,label:d("terminal.analyst.cli"),value:t.cliId,disabled:t.started||t.selectionLocked||!t.catalog,options:t.catalog?.clis.map(z=>({value:z.cliId,label:z.label,disabled:!z.available}))??[],onChange:z=>n({type:"select-cli",cliId:z})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(qi,{compact:!0,label:d("terminal.analyst.model"),value:t.model,disabled:t.started||t.selectionLocked||!S,options:w?.models.map(z=>({value:z.id,label:z.label}))??[],onChange:z=>n({type:"select-model",model:z})})}),c.jsx("span",{className:"session-analyst__select",children:c.jsx(qi,{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(z=>({value:z,label:z})):[{value:"",label:d("terminal.analyst.na")}],onChange:z=>n({type:"select-effort",effort:z})})}),c.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"):""})]}),c.jsxs("div",{className:"session-analyst__composer-surface",children:[c.jsx("label",{className:"session-analyst__sr-only",htmlFor:`analysis-${e.operationId}`,children:d("terminal.analyst.askAboutSession")}),c.jsx("textarea",{ref:P,id:`analysis-${e.operationId}`,role:"combobox","aria-expanded":D,"aria-controls":E,"aria-activedescendant":R?L(R.command):void 0,rows:1,placeholder:d("terminal.analyst.composerPlaceholder"),value:t.draft,onChange:z=>{n({type:"set-draft",draft:z.target.value}),m(0),_(!1)},onKeyDown:z=>{if(D&&!z.nativeEvent.isComposing){if(z.key==="ArrowDown"){z.preventDefault(),m(G=>(G+1)%I.length);return}if(z.key==="ArrowUp"){z.preventDefault(),m(G=>(G-1+I.length)%I.length);return}if(z.key==="Enter"){z.preventDefault(),W(Math.min(p,I.length-1));return}if(z.key==="Escape"){z.preventDefault(),_(!0);return}}z.key!=="Enter"||z.shiftKey||z.nativeEvent.isComposing||(z.preventDefault(),O(t.draft,!0))}}),t.busy?c.jsx("button",{type:"button",className:"session-analyst__send session-analyst__stop","aria-label":d("terminal.analyst.stop"),onClick:()=>{s()},children:c.jsx("span",{"aria-hidden":"true"})}):null,c.jsx("button",{type:"submit",className:"session-analyst__send","aria-label":d(t.busy?"terminal.analyst.queueQuestion":"terminal.analyst.send"),disabled:!t.draft.trim(),children:c.jsx("svg",{width:"14",height:"14",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.6","aria-hidden":"true",children:c.jsx("path",{d:"M6 10 V2 M2.5 5.5 L6 2 l3.5 3.5"})})})]}),t.busy?c.jsx("div",{className:"session-analyst__composer-hint",children:d("terminal.analyst.queueHint")}):null]})]})]})}function VT(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 _X(e,t,n){const i=navigator.clipboard;if(!i)return;let s;try{s=i.writeText(t)}catch{return}const o=e.textContent,l=Tt(n);s.then(()=>{e.isConnected&&(e.textContent=l("terminal.analyst.copied"),window.setTimeout(()=>{e.isConnected&&(e.textContent=o)},1200))}).catch(()=>{})}function bX({state:e,language:t,onReset:n}){const i=Tt(t),s=e.started||e.phase!=="idle"||e.draft.length>0||e.queue.length>0||e.entries.length>0||e.artifacts.length>0;return c.jsxs("header",{className:"session-analyst__panel-head",children:[c.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:i("terminal.companion.sessionAnalyst")}),c.jsx("small",{children:i("terminal.analyst.subtitle")})]}),c.jsx("button",{type:"button",className:"session-analyst__reset","aria-label":i("terminal.analyst.resetAria"),onClick:n,disabled:!s,children:i("terminal.analyst.reset")}),c.jsxs("span",{className:"session-analyst__panel-state",children:[c.jsx("i",{"aria-hidden":"true"}),CX(e,t)]})]})}function wX({state:e,language:t,onOpen:n}){const i=Tt(t),s=AX(e.artifactAuthoring?.startedAt??null);if(e.artifactAuthoring)return c.jsxs("div",{className:"session-analyst__author-card is-authoring",children:[c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"✳"}),c.jsx("strong",{className:"session-analyst__author-title",children:i("terminal.analyst.publishingArtifact")}),c.jsx("time",{className:"session-analyst__author-time",children:t0(s)})]}),c.jsx("p",{className:"session-analyst__author-sub",children:i("terminal.analyst.authoringBody")}),c.jsx("div",{className:"session-analyst__author-track","aria-hidden":"true",children:c.jsx("span",{})})]});const o=e.artifactPublished;return o?c.jsx("div",{className:"session-analyst__author-card is-done",children:c.jsxs("div",{className:"session-analyst__author-head",children:[c.jsx("span",{className:"session-analyst__author-sigil","aria-hidden":"true",children:"◆"}),c.jsx("strong",{className:"session-analyst__author-title",children:i("terminal.analyst.artifactPublished",{title:o.artifact.title})}),o.durationMs===null?null:c.jsx("time",{className:"session-analyst__author-time",children:t0(o.durationMs)}),n?c.jsx("button",{type:"button",className:"session-analyst__author-open",onClick:n,children:i("terminal.analyst.openInArtifacts")}):null]})}):null}function SX({state:e,language:t}){const n=Tt(t),i=EX(e),s=t0(i),o=kX(e.latestActivity,t);if(e.phase==="complete")return null;if(e.phase==="stopped")return c.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=xX(e.latestActivity,t);return c.jsxs("div",{className:`session-analyst__pulse${l?" is-error":""}`,role:l?"alert":"status","aria-live":l?void 0:"polite",children:[l?null:c.jsx("span",{className:"session-analyst__pulse-scan","aria-hidden":"true"}),c.jsxs("div",{className:"session-analyst__pulse-main",children:[c.jsx("span",{className:"session-analyst__pulse-orbit","aria-hidden":"true"}),c.jsxs("span",{className:"session-analyst__pulse-copy",children:[c.jsx("strong",{children:l?jK(t,e.error??""):d.label},`${e.phase}-${d.label}`),c.jsx("small",{children:l?t==="ko"?o:`Last confirmed activity: ${o}`:d.note})]}),c.jsx("time",{children:s})]}),c.jsx("span",{className:"session-analyst__truth-mark",children:n("terminal.analyst.lastConfirmedOnly")})]})}function xX(e,t){const n=Tt(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 kX(e,t){const n=Tt(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 CX(e,t){const n=Tt(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 EX(e){const[t,n]=g.useState(()=>Date.now());return g.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 AX(e){const[t,n]=g.useState(()=>Date.now());return g.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 t0(e){return`${Math.floor(e/1e3)}s`}function TX(){const[e,t]=g.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return g.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 Zs extends Error{constructor(t,n){super(n),this.status=t}status}const RX=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function MX(e){const t=await fetch("/api/v1/plugins/terminal/carriers",{signal:e});return await v1(t),dO(await t.json(),t.status)}async function uO(e){const t=await fetch("/api/v1/plugins/terminal/carriers/options",{signal:e});return await v1(t),IX(await t.json(),t.status)}async function NX(e,t,n){return y1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}`,"PATCH",t,n)}async function LX(e,t,n,i){return y1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",n,i)}async function OX(e,t,n){return y1(`/api/v1/plugins/terminal/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},n)}async function y1(e,t,n,i){const s=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:i});await v1(s);const o=await s.json();if(!o||typeof o!="object"||!("state"in o))throw new Zs(s.status,"Invalid carrier settings mutation response");return{state:dO(o.state,s.status)}}async function v1(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 Zs(e.status,t)}function dO(e,t){hO(e,t);const n=e;if(!n||typeof n.generation!="number"||!Array.isArray(n.carriers))throw new Zs(t,"Invalid carrier settings state response");return{generation:n.generation,carriers:n.carriers.map(i=>jX(i,t))}}function IX(e,t){hO(e,t);const n=e;if(!n||!Array.isArray(n.cliTypes)||!n.taskForceConstraints||typeof n.taskForceConstraints.minBackends!="number")throw new Zs(t,"Invalid carrier settings options response");return{cliTypes:n.cliTypes.map(i=>DX(i,t)),taskForceConstraints:{minBackends:n.taskForceConstraints.minBackends}}}function jX(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 Zs(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=>PX(i,t))}}}function DX(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 Zs(t,"Invalid carrier settings CLI option");return{id:n.id,displayName:n.displayName,models:n.models.map(i=>BX(i,t)),defaultModel:n.defaultModel}}function BX(e,t){const n=e;if(!n||typeof n.modelId!="string"||typeof n.name!="string")throw new Zs(t,"Invalid carrier settings model option");if(n.effort!==void 0&&(!Array.isArray(n.effort.levels)||typeof n.effort.default!="string"))throw new Zs(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 PX(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 Zs(t,"Invalid carrier settings Task Force backend");return{cliType:n.cliType,model:n.model,...n.effort?{effort:n.effort}:{}}}function hO(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(RX.has(s))throw new Zs(t,"Carrier settings response leaked a restricted field");o&&typeof o=="object"&&n.push(o)}}}const $X=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class Es extends Error{status;constructor(t,n){super(n),this.name="AgentApiError",this.status=t}}async function fO(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.agentClis))throw new Es(t.status,"Invalid agent state response");return n.agentClis.map(i=>VX(i,t.status))}async function zX(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.clis))throw new Es(t.status,"Invalid Agent CLI state response");return n}async function FX(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Es(t.status,"Invalid tenants response");return n.tenants.map(i=>YX(i,t.status))}async function HX(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.tenants))throw new Es(t.status,"Invalid jobs response");return n.tenants}async function UX(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.sessions))throw new Es(t.status,"Invalid agent sessions response");return n.sessions.map(i=>kg(i,t.status))}async function WX(e){const t=await fetch("/api/v1/operations",{signal:e});await Fa(t);const n=await t.json();if(!Array.isArray(n.operations))throw new Es(t.status,"Invalid operations response");return{operations:n.operations.map(i=>XX(i,t.status))}}async function qX(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 Fa(i),kg(await i.json(),i.status)}async function GX(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 Fa(n),kg(await n.json(),n.status)}async function KX(e,t){const n=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Fa(n)}function kg(e,t){const n=e;if(!n||typeof n.sessionId!="string"||typeof n.cwdLabel!="string"||typeof n.status!="string"||typeof n.createdAt!="number"||n0(n))throw new Es(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 Fa(e){if(!e.ok)throw new Es(e.status,`Agent plugin request failed: ${e.status}`)}function VX(e,t){const n=e;if(!n||typeof n.id!="string"||typeof n.label!="string")throw new Es(t,"Invalid Agent CLI metadata response");return{id:n.id,label:n.label,available:n.available===!0,signedIn:n.signedIn!==!1}}function YX(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 Es(t,"Invalid tenant response");return n}function XX(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"||n0(n)||n0(n.payload))throw new Es(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 n0(e){return i0(e,new Set($X))}function i0(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>i0(n,t)):Object.entries(e).some(([n,i])=>t.has(n)||i0(i,t))}const ZX=new Set(["nimitz","genesis","sentinel","vanguard"]);function JX(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 pO(e){if(e)return ZX.has(e)?e:void 0}function mO(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function QX(e){return e==="err"||e==="error"}function Im(e,t){if(QX(e.status))return{kind:"error",tone:"error"};if(e.status==="aborted")return{kind:"aborted",tone:"error"};if(e.status==="done")return{kind:"done",tone:"done"};if(t==="error")return{kind:"error",tone:"error"};if(t==="aborted")return{kind:"aborted",tone:"error"};if(t==="done")return{kind:"done",tone:"done"};const n=e.tools.at(-1);return n&&_1(n.status)==="live"?{kind:"tool",tone:"live",toolName:n.name}:e.text.length>0?{kind:"writing",tone:"live"}:e.thought.length>0?{kind:"reasoning",tone:"live"}:{kind:"working",tone:"live"}}function _1(e){return e==="done"||e==="completed"?"done":e==="error"||e==="failed"?"error":"live"}function eZ(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 tZ="active",r0=new Set(["done","error","aborted"]);function nZ(e,t){let n=yO(s0(e,t.jobId,t.updatedAt),t.request);for(const i of t.events)n=gO(n,i);return r0.has(t.status)&&!r0.has(n.status)&&(n={...n,status:t.status}),n}function gO(e,t){if(t.id<=e.lastEventId)return e;const n=t.event,i={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:aZ(e.recentEvents,t)};switch(t.type){case"job:registered":return rZ(i,n);case"job:finalized":return{...i,status:jn(n.status)??"done",finishedAt:wo(n.finishedAt)??t.at,summary:jn(n.summary),error:jn(n.error)};case"track:begin":return bc(yO(i,n.request),n,t.id,s=>({...s,startedAt:wo(n.startedAt)??t.at,requestPreview:jn(n.requestPreview)}));case"track:status":return bc(i,n,t.id,s=>({...s,status:jn(n.status)??s.status}));case"track:text":return bc(i,n,t.id,s=>{const o=s.text+(jn(n.text)??"");return{...s,status:"stream",text:o,sentTextLength:s.sentTextLength+(wo(n.textLength)??jn(n.text)?.length??0),latestLine:oZ(o)||s.latestLine}});case"track:thought":return bc(i,n,t.id,s=>{const o=s.thought+(jn(n.text)??"");return{...s,thought:o,sentThoughtLength:s.sentThoughtLength+(wo(n.textLength)??jn(n.text)?.length??0)}});case"track:tool":return bc(i,n,t.id,s=>({...s,status:"stream",tools:sZ(s.tools,n)}));case"track:finalized":return bc(i,n,t.id,s=>{const o=YT(s.text,s.sentTextLength,jn(n.fallbackText),wo(n.fallbackTextLength)),l=YT(s.thought,s.sentThoughtLength,jn(n.fallbackThought),wo(n.fallbackThoughtLength));return{...s,status:jn(n.status)??"done",finishedAt:wo(n.finishedAt)??t.at,error:jn(n.error),text:o.text,sentTextLength:o.sentLength,thought:l.text,sentThoughtLength:l.sentLength}});default:return i}}function yO(e,t){if(e.request)return e;const n=iZ(t);return n?{...e,request:n}:e}function iZ(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 s0(e,t,n){return{jobId:t,tenantId:e,status:tZ,updatedAt:n,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function b1(e){return r0.has(e)}function rZ(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??vO(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:jn(t.label)??e.label,ownerCarrierId:jn(t.ownerCarrierId)??e.ownerCarrierId,kind:jn(t.kind)??e.kind,signatureCli:jn(t.signatureCli)??e.signatureCli,startedAt:wo(t.startedAt)??e.startedAt,trackOrder:i,tracks:s}}function bc(e,t,n,i){const s=jn(t.trackId);if(!s)return e;const o=e.tracks[s],l={...i(o??vO(s)),lastEventId:n};return{...e,trackOrder:o?e.trackOrder:[...e.trackOrder,s],tracks:{...e.tracks,[s]:l}}}function vO(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function sZ(e,t){const n=jn(t.title),i=jn(t.toolCallId)??jn(t.toolId)??jn(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){_1(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??jn(t.name)??l?.name,input:t.input??l?.input,output:t.output??l?.output,status:jn(t.status)??l?.status};return o>=0?[...e.slice(0,o),d,...e.slice(o+1)]:[...e,d]}function YT(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 aZ(e,t){return[...e,t].slice(-120)}function oZ(e){const t=e.trim();if(!t)return"";const n=t.split(`
214
+ `);return n[n.length-1]?.trim()??""}function jn(e){return typeof e=="string"?e:void 0}function wo(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const lZ=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function cZ(){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=dZ(s);o&&n.push(o),i=e.indexOf(`
217
+
218
+ `)}return n}}function uZ(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=ZT(t.session);return i?{kind:"session",tenantId:i.tenantId??i.sessionId,session:i}:null}if(e.event==="session:attention"){const i=ZT(t.session);return i?{kind:"attention",tenantId:i.tenantId??i.sessionId,session:i,reason:hZ(t.reason)}:null}const n=XT(t.event)??XT(t);return n?{kind:"event",tenantId:n.tenantId,tenantLabel:t.tenant?.tenantLabel,event:n}:null}function dZ(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 XT(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 ZT(e){try{return kg(e,200)}catch{return null}}function hZ(e){return typeof e=="string"&&lZ.has(e)?e:void 0}const w1={droppedCount:0},a0=new Set;let Ln={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function _O(){return RR(fZ,bO)}function bO(){return Ln}function fZ(e){return a0.add(e),()=>{a0.delete(e)}}function Dr(e){Ln={...Ln,...e},_Z()}function wO(e){Dr({agentClis:e})}function pZ(e){const t={};for(const n of e)t[n.sessionId]=n;Dr({sessions:t,sessionOrder:[...e].sort((n,i)=>i.createdAt-n.createdAt).map(n=>n.sessionId)})}function jm(e){const t=!!Ln.sessions[e.sessionId];Dr({sessions:{...Ln.sessions,[e.sessionId]:e},sessionOrder:t?Ln.sessionOrder:[e.sessionId,...Ln.sessionOrder],turnState:{...Ln.turnState,[e.sessionId]:e.turnState}})}function SO(e){const{[e]:t,...n}=Ln.sessions,{[e]:i,...s}=Ln.turnState;Dr({sessions:n,sessionOrder:Ln.sessionOrder.filter(o=>o!==e),activeTerminalSessionId:Ln.activeTerminalSessionId===e?null:Ln.activeTerminalSessionId,turnState:s})}function xO(e){Dr({activeTerminalSessionId:e})}function mZ(e){Dr({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Ln.tenantOrder.filter(t=>!e.some(n=>n.tenantId===t)&&Ln.tenantJobs[t])]})}function gZ(e){const t={};for(const n of e){const i={};for(const s of n.jobs)i[s.jobId]=nZ(n.tenantId,s);t[n.tenantId]={tenantId:n.tenantId,tenantLabel:n.tenantLabel,jobOrder:n.jobs.map(s=>s.jobId),jobs:i,truncation:n.truncation??w1}}Dr({tenantJobs:t,tenantOrder:[...e.map(n=>n.tenantId),...Ln.tenantOrder.filter(n=>t[n])]})}function yZ(e,t){const n=e.tenantId,i=e.jobId??bZ(e),s=Ln.tenantJobs[n]??{tenantId:n,tenantLabel:t,jobOrder:[],jobs:{},truncation:w1},o=i?s.jobs[i]??s0(n,i,e.at):s0(n,"__unknown__",e.at),l=gO(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 Dr({tenantJobs:{...Ln.tenantJobs,[n]:f},tenantOrder:Ln.tenantOrder.includes(n)?Ln.tenantOrder:[n,...Ln.tenantOrder]}),{job:l,unknownTenant:!Ln.tenantJobs[n]}}function vZ(e,t,n){const i=Ln.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:w1};Dr({tenantJobs:{...Ln.tenantJobs,[e]:{...i,tenantLabel:t??i.tenantLabel,truncation:n}}})}function S1(e){const t=e.tenantId;if(!t)return[];const n=Ln.tenantJobs[t];return n?n.jobOrder.map(i=>n.jobs[i]).filter(i=>!!i):[]}function _Z(){for(const e of a0)e()}function bZ(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const JT=250,wZ=5e3,o0=new Map;function SZ(e){const t=new AbortController;return xZ(t.signal,e),()=>t.abort()}async function xZ(e,t){let n=JT;for(;!e.aborted;){Dr({connection:"connecting"});try{await EZ(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}`);Dr({connection:"live",connectionError:null}),n=JT,await kZ(i.body.getReader(),e,t),e.aborted||Dr({connection:"connecting",connectionError:null})}catch(i){if(e.aborted)return;Dr({connection:"connecting",connectionError:i instanceof Error?i.message:String(i)})}if(e.aborted)return;await TZ(n,e),n=Math.min(n*2,wZ)}}async function kZ(e,t,n){const i=new TextDecoder,s=cZ();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=uZ(l);if(d){if(d.kind==="truncation"&&d.truncation){vZ(d.tenantId,d.tenantLabel,d.truncation);continue}if(d.kind==="session"&&d.session){jm(d.session),Dm(n,d.session.sessionId,x1(d.session));continue}if(d.kind==="attention"&&d.session){jm(d.session),d.reason!=="idle_prompt"&&Dm(n,d.session.sessionId,"awaiting");continue}d.event&&(yZ(d.event,d.tenantLabel),CZ(n,d.event.tenantId))}}}}function x1(e){return e.status==="dormant"?"dormant":e.attentionPending===!0?"awaiting":e.modelActivity==="working"?"running":e.modelActivity==="not-working"?QT(e)?"running":"idle":e.turnState==="running"||e.turnState==="ended"&&QT(e)?"running":"idle"}function QT(e){return S1(e).some(t=>!b1(t.status))}function Dm(e,t,n){const i=o0.get(t);e.status.set(t,n),o0.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 CZ(e,t){const{sessions:n}=bO();for(const i of Object.values(n))i.tenantId===t&&o0.get(i.sessionId)!=="awaiting"&&Dm(e,i.sessionId,x1(i))}async function EZ(e,t){const[n,i,s,o,l]=await Promise.all([fO(e),UX(e),FX(e),HX(e),WX(e)]);wO(n),pZ(i),mZ(s),gZ(o);for(const d of i)Dm(t,d.sessionId,x1(d));AZ(l.operations,t)}function AZ(e,t){for(const n of e)n.pluginId==="terminal"&&n.type==="agent.streaming"&&t.operations.remove(n.id).catch(()=>{})}async function TZ(e,t){await new Promise(n=>{const i=()=>{clearTimeout(s),t.removeEventListener("abort",i),n()},s=setTimeout(i,e);t.addEventListener("abort",i)})}class Cg extends Error{status;constructor(t,n){super(n),this.name="TerminalModelAuthApiError",this.status=t}}async function RZ(e){const t=await fetch("/plugins/terminal/model-auth/state",{signal:e});return await k1(t),CO(await t.json(),t.status)}async function MZ(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 k1(i),kO(await i.json(),i.status)}async function NZ(e,t){const n=await fetch(`/plugins/terminal/model-auth/providers/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});return await k1(n),kO(await n.json(),n.status)}async function k1(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 Cg(e.status,t)}function kO(e,t){const n=e;if(!n||typeof n!="object"||!("state"in n))throw new Cg(t,"Invalid model auth mutation response");return{state:CO(n.state,t)}}function CO(e,t){const n=e;if(!n||typeof n!="object"||!Array.isArray(n.providers))throw new Cg(t,"Invalid model auth state response");return{providers:n.providers.map(i=>LZ(i,t))}}function LZ(e,t){const n=e;if(typeof n.cli!="string"||typeof n.displayName!="string"||typeof n.signedIn!="boolean")throw new Cg(t,"Invalid model auth provider response");return{cli:n.cli,displayName:n.displayName,signedIn:n.signedIn}}const l0=new Set;let c0={loading:!1,state:null,busyCli:null,error:null},ja=0;function OZ(){return g.useSyncExternalStore(IZ,e5,e5)}function e5(){return c0}function IZ(e){return l0.add(e),()=>l0.delete(e)}async function jZ(e){const t=++ja;Da({loading:!0,error:null});try{const n=await RZ(e);if(t!==ja)return;Da({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==ja)return;Da({loading:!1,error:C1(n)})}}async function DZ(e,t){const n=++ja;Da({busyCli:e,error:null});try{const i=await MZ(e,t);return n!==ja||(Da({state:i.state,busyCli:null,error:null}),await EO()),!0}catch(i){return n!==ja||Da({busyCli:null,error:C1(i)}),!1}}async function BZ(e){const t=++ja;Da({busyCli:e,error:null});try{const n=await NZ(e);return t!==ja||(Da({state:n.state,busyCli:null,error:null}),await EO()),!0}catch(n){return t!==ja||Da({busyCli:null,error:C1(n)}),!1}}async function EO(){try{wO(await fO())}catch{}}function Da(e){c0={...c0,...e};for(const t of l0)t()}function C1(e){return e instanceof Error?e.message:String(e)}class AO extends Error{status;constructor(t,n){super(n),this.name="TerminalSettingsApiError",this.status=t}}async function PZ(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await TO(t),RO(await t.json(),t.status)}async function $Z(e,t){const n=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await TO(n),RO(await n.json(),n.status)}async function TO(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 AO(e.status,t)}function RO(e,t){const n=e;if(!n||typeof n.enableMetaphor!="boolean"||!zZ(n.agentIdleDormantMinutes))throw new AO(t,"Invalid Terminal settings response");return{enableMetaphor:n.enableMetaphor,kimiModel:FZ(n.kimiModel),agentIdleDormantMinutes:n.agentIdleDormantMinutes}}function zZ(e){return e===null?!0:typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)&&e>0}function FZ(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 u0=new Set;let Bm={loading:!1,state:null,savingField:null,error:null},qp=0;function E1(){return g.useSyncExternalStore(HZ,t5,t5)}function t5(){return Bm}function HZ(e){return u0.add(e),()=>{u0.delete(e)}}async function A1(e){const t=++qp;qc({loading:!0,error:null});try{const n=await PZ(e);if(t!==qp)return;qc({loading:!1,state:n,error:null})}catch(n){if(e?.aborted||t!==qp)return;qc({loading:!1,error:MO(n)})}}async function T1(e,t){const n=Bm.state;if(!n||e==="kimiModel"&&t===null)return!1;qp+=1;const i={...n,[e]:t},s=UZ(e,i);qc({state:i,savingField:e,error:null});try{const o=await $Z(s);return qc({state:o,savingField:null,error:null}),!0}catch(o){return qc({state:n,savingField:null,error:MO(o)}),!1}}function UZ(e,t){return e==="enableMetaphor"?{enableMetaphor:t.enableMetaphor}:e==="agentIdleDormantMinutes"?{agentIdleDormantMinutes:t.agentIdleDormantMinutes}:{kimiModel:t.kimiModel}}function qc(e){Bm={...Bm,...e};for(const t of u0)t()}function MO(e){return e instanceof Error?e.message:String(e)}const WZ=["webgl","dom"],qZ="/plugins/terminal/agent/ticket",GZ="/plugins/terminal/ws",KZ=56,VZ={...gG,step:1,defaultValue:14},YZ={cascadia:"terminal.settings.fontMetaCascadia",jetbrains:"terminal.settings.fontMetaJetbrains","fira-code":"terminal.settings.fontMetaFiraCode","source-code-pro":"terminal.settings.fontMetaSourceCodePro"},XZ=5e3,_h="carrier-streams",ru="session-analyst-chat",ZZ=[ru,Na],JZ=[_h,ru,Na],QZ={live:"terminal.streams.status.live",done:"terminal.streams.status.done",error:"terminal.streams.status.error"};function n5(e,t){return e.kind==="tool"&&e.toolName?t("terminal.sortie.phase.tool",{tool:e.toolName}):e.kind==="writing"?t("terminal.sortie.phase.writing"):e.kind==="reasoning"?t("terminal.sortie.phase.reasoning"):t("terminal.sortie.phase.working")}const NO={pluginId:"terminal",type:"agent",title:e=>Tt(e)("terminal.kind.agent"),subtitle:e=>qd(e.payload,"cliLabel")??void 0,render:e=>c.jsx(uJ,{context:e}),canOpenCompanions:()=>!0,companions:[{id:_h,title:e=>Tt(e)("terminal.companion.carrierStreams"),hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(dJ,{context:e})},{id:ru,title:e=>Tt(e)("terminal.companion.sessionAnalyst"),hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(vX,{context:e})},{id:Na,title:e=>Tt(e)("terminal.companion.artifacts"),hideCaption:!0,defaultHidden:!0,render:e=>c.jsx(YK,{context:e})}]},LO={id:"general",title:e=>Tt(e)("terminal.settings.general"),render:()=>c.jsx(mJ,{})},OO={id:"agent-cli",title:e=>Tt(e)("terminal.settings.agentCli"),render:()=>c.jsx(vJ,{})},IO={id:"agent.attention",title:e=>Tt(e)("terminal.notifications.agentInputWaiting")},eJ={id:"agent.ended",title:e=>Tt(e)("terminal.notifications.agentTurnEnded")},d0={id:"agent.resume-failed",title:e=>Tt(e)("terminal.notifications.resumeFailed")},Td={id:"terminal",operationKinds:[NO],settingsSections:[LO,OO],notificationKinds:[IO,eJ,d0],install:e=>tJ(e),closeOperation:async e=>{try{await KX(e)}finally{UK(e),SO(e)}},resumeOperation:async e=>{try{await BO(e),Pm?.dismiss(e)}catch(t){throw Pm?.emit({kind:d0.id,operationId:e,message:"Resume failed — the saved session has expired."}),t}},launch:async({theaterId:e,kind:t})=>{const n=await qX(e,t.id);return jm(n),xO(n.sessionId),{id:n.sessionId}},renderLaunchIcon:e=>e.id==="claude-kimi"?c.jsx(NJ,{}):e.id==="claude"?c.jsx(RJ,{}):e.id==="codex"?c.jsx(MJ,{}):c.jsx(TJ,{})};let Pm=null;function tJ(e){Pm=e.notifications;const t=SZ({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync});return()=>{Pm=null,t()}}function nJ(e,t){const n=g.useRef(null),i=g.useRef(null),s=g.useRef(!0),o=g.useCallback(l=>{s.current!==l&&(s.current=l)},[]);return g.useEffect(()=>{const l=n.current;if(!l)return;const d=()=>{const f=l.scrollHeight-l.scrollTop-l.clientHeight;o(f<=KZ)};return l.addEventListener("scroll",d,{passive:!0}),()=>l.removeEventListener("scroll",d)},[e,o]),g.useLayoutEffect(()=>{o(!0);const l=n.current;l&&(l.scrollTop=l.scrollHeight)},[e,o]),g.useLayoutEffect(()=>{const l=n.current;!l||!s.current||(l.scrollTop=l.scrollHeight)},[t]),g.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 iJ(e,t){const[n,i]=g.useState(Date.now);return g.useEffect(()=>{if(e===void 0||t!==void 0)return;const s=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(s)},[e,t]),e===void 0?"":JX((t??n)-e)}function rJ(e){const[t,n]=g.useState({operationId:e.operationId,readiness:"unknown"}),i=t.operationId===e.operationId?t.readiness:"unknown";return g.useEffect(()=>{let s=!1,o=!1,l;n({operationId:e.operationId,readiness:"unknown"});const d=async()=>{if(o)return;o=!0;const f=await yK(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()},XZ),()=>{s=!0,l!==void 0&&window.clearInterval(l)}},[e.api,e.operationId]),i}function bh(e,t){return!!e.companionsOpen&&!(e.hiddenCompanionPanelIds??[]).includes(t)}function sJ(e,t){if(!e.onSetCompanionPanelVisible){e.onRequestCompanions?.(!0);return}bh(e,t)||(e.companionsOpen||e.onRequestCompanions?.(!0),e.onSetCompanionPanelVisible(t,!0))}function jO(e,t,n=[t]){if(!e.onSetCompanionPanelVisible){e.onRequestCompanions?.(!e.companionsOpen);return}if(!bh(e,t)){e.companionsOpen||e.onRequestCompanions?.(!0),e.onSetCompanionPanelVisible(t,!0);return}for(const l of n)e.onSetCompanionPanelVisible(l,!1);JZ.filter(l=>!n.includes(l)&&bh(e,l)).length===0&&e.onRequestCompanions?.(!1)}function aJ({context:e,ready:t,working:n}){const i=bh(e,ru),s=e.language??"en",o=Tt(s);return c.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&&jO(e,ru,ZZ)},children:[n?c.jsx("span",{className:"session-analyst-handle__live","aria-hidden":"true"}):null,c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:i?"«":"»"}),c.jsx("span",{className:"session-analyst-handle__label",children:o(i?"terminal.handle.exit":"terminal.handle.analyze")})]})}function oJ({context:e,live:t}){const n=bh(e,_h),i=e.language??"en",s=Tt(i);return c.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:()=>jO(e,_h),children:[t?c.jsx("span",{className:"session-analyst-handle__live","aria-hidden":"true"}):null,c.jsx("span",{className:"session-analyst-handle__chev","aria-hidden":"true",children:n?"«":"»"}),c.jsx("span",{className:"session-analyst-handle__label",children:s(n?"terminal.handle.exit":"terminal.handle.streams")})]})}const lJ=2;function cJ({context:e,jobs:t}){const n=e.language??"en",i=Tt(n),s=t.flatMap(p=>b1(p.status)?[]:p.trackOrder.flatMap(m=>{const y=p.tracks[m];return y&&mO(y.status)?[{job:p,track:y}]:[]}));if(s.length===0)return null;const o=s.slice(0,lJ),l=s.length-o.length,d=o.map(({job:p,track:m})=>`${m.displayName} ${n5(Im(m,p.status),i)}`).join(", "),f=l>0?`, ${i("terminal.sortie.more",{count:l})}`:"";return c.jsxs("button",{type:"button",className:"carrier-sortie-ribbon","aria-label":`${i("terminal.sortie.open",{count:s.length})}: ${d}${f}`,onClick:()=>sJ(e,_h),children:[c.jsx("span",{className:"carrier-sortie-ribbon__scan","aria-hidden":"true"}),c.jsx("span",{className:"carrier-sortie-ribbon__count",children:i("terminal.sortie.count",{count:s.length})}),c.jsxs("span",{className:"carrier-sortie-ribbon__roster",children:[o.map(({job:p,track:m})=>{const y=pO(p.ownerCarrierId);return c.jsxs("span",{className:"carrier-sortie-ribbon__track","data-captain":y,children:[c.jsx("span",{className:"carrier-sortie-ribbon__name",title:m.displayName,children:m.displayName}),c.jsx("span",{className:"carrier-sortie-ribbon__phase",children:n5(Im(m,p.status),i)})]},`${p.jobId}:${m.trackId}`)}),l>0?c.jsx("span",{className:"carrier-sortie-ribbon__more",children:i("terminal.sortie.more",{count:l})}):null]}),c.jsx("span",{className:"carrier-sortie-ribbon__chev","aria-hidden":"true",children:"»"})]})}function uJ({context:e}){const n=_O().sessions[e.operationId]??PO(e),i=rJ(e),{state:s}=o1(e),o=S1(n),l=DO(o),d=g.useRef(!0);g.useEffect(()=>{const p=e.companionsOpen??!1,m=d.current;d.current=p,m&&!p&&WK(e.operationId)},[e.companionsOpen,e.operationId]),g.useEffect(()=>{i!=="not-ready"||!e.onSetCompanionPanelVisible||(e.onSetCompanionPanelVisible(ru,!1),e.onSetCompanionPanelVisible(Na,!1))},[i,e.onSetCompanionPanelVisible]);const f=c.jsxs("div",{className:"session-analyst-handle-stack",children:[c.jsx(oJ,{context:e,live:l>0}),c.jsx(aJ,{context:e,ready:i==="ready",working:s.busy})]});return n.status==="dormant"?c.jsxs("div",{className:"agent-stream-host",children:[f,c.jsx(kJ,{context:e,session:n})]}):c.jsxs("div",{className:"agent-stream-host",children:[f,c.jsx(i1,{operationId:n.sessionId,ticketPath:qZ,wsPath:GZ,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,theme:e.theme,onExit:()=>SO(n.sessionId)}),c.jsx(cJ,{context:e,jobs:o})]})}function dJ({context:e}){const n=_O().sessions[e.operationId]??PO(e),i=S1(n),s=e.language??"en",o=Tt(s),[l,d]=g.useState([]),f=i.flatMap(m=>m.trackOrder.flatMap(y=>{const _=m.tracks[y];return _?[{job:m,track:_}]:[]})),p=DO(i);return c.jsxs("section",{className:"carrier-streams","aria-label":o("terminal.companion.carrierStreams"),children:[c.jsxs("header",{className:"session-analyst__panel-head carrier-streams__panel-head",children:[c.jsx("span",{className:"session-analyst__panel-mark","aria-hidden":"true",children:"✳"}),c.jsxs("span",{className:"session-analyst__panel-copy",children:[c.jsx("strong",{children:o("terminal.companion.carrierStreams")}),c.jsx("small",{children:o("terminal.streams.subtitle")})]}),c.jsxs("span",{className:`carrier-streams__state${p>0?" is-live":""}`,children:[c.jsx("i",{"aria-hidden":"true"}),p>0?`${p} ${o("terminal.streams.status.live")}`:o("terminal.streams.status.idle")]})]}),f.length===0?c.jsxs("div",{className:"carrier-streams__empty",children:[c.jsx("strong",{children:o("terminal.streams.emptyTitle")}),c.jsx("span",{children:o("terminal.streams.emptyBody")})]}):c.jsx("div",{className:"carrier-streams__board",children:f.map(({job:m,track:y})=>{const _=`${m.jobId}:${y.trackId}`,S=Im(y,m.status).tone!=="done"||l.includes(_);return c.jsx(hJ,{job:m,track:y,language:s,expanded:S,onToggleCompleted:()=>{d(x=>S?x.filter(k=>k!==_):eZ(x,[_]))}},_)})})]})}function hJ({job:e,track:t,language:n,expanded:i,onToggleCompleted:s}){const o=Tt(n),l=Im(t,e.status),d=pO(e.ownerCarrierId),f=iJ(t.startedAt??e.startedAt,t.finishedAt??e.finishedAt),p=fJ(e,t),m=`${t.lastEventId}:${t.text.length}:${t.tools.length}`,y=nJ(`${e.jobId}:${t.trackId}:${i}`,m),_=l.tone==="done",w=l.tone==="live"&&t.thought.length>0&&(t.text.length===0||pJ(e,t.trackId)==="track:thought"),S=t.error??(l.tone==="error"?e.error??e.summary:void 0),x=o(QZ[l.tone]),k=t.tools.length>0?t.tools[t.tools.length-1]:void 0;return _&&!i?c.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?c.jsx("span",{className:"carrier-stream-column__captain-dot","data-captain":d,"aria-hidden":"true"}):null,c.jsx("strong",{children:t.displayName}),c.jsx("span",{className:"carrier-stream-column__phase","data-tone":"done",children:o("terminal.streams.status.done")}),c.jsx("time",{children:f})]}):c.jsxs("article",{className:"carrier-stream-column","data-captain":d,"data-tone":l.tone,children:[l.tone==="live"?c.jsx("span",{className:"carrier-stream-column__scan","aria-hidden":"true"}):null,c.jsxs("header",{className:"carrier-stream-column__head",children:[d?c.jsx("span",{className:"carrier-stream-column__captain-dot","data-captain":d,"aria-hidden":"true"}):null,c.jsx("strong",{title:t.displayName,children:t.displayName}),c.jsx("span",{className:"carrier-stream-column__phase","data-tone":l.tone,children:x}),_?c.jsx("button",{type:"button","aria-label":`${o("terminal.streams.collapse")} · ${t.displayName}`,onClick:s,children:"‹"}):null]}),c.jsx("div",{ref:y.containerRef,className:"carrier-stream-column__body",tabIndex:0,children:c.jsxs("div",{ref:y.contentRef,className:"carrier-stream-column__content",children:[p?c.jsxs("div",{className:"carrier-stream-column__request","data-captain":d,children:[c.jsx("span",{className:"carrier-stream-column__request-kicker",children:o("terminal.streams.dispatchOrder")}),c.jsx("p",{children:p})]}):null,t.text?c.jsxs("div",{className:"carrier-stream-column__answer",children:[c.jsx("span",{"aria-hidden":"true",children:"✳"}),c.jsx(cO,{className:"carrier-stream-column__markdown markdown-body",text:t.text,streaming:l.tone==="live",language:n})]}):null,w?c.jsxs("div",{className:"carrier-stream-column__reasoning","aria-live":"polite",children:[c.jsx("i",{"aria-hidden":"true"}),c.jsx("span",{children:o("terminal.streams.reasoning")})]}):null,S?c.jsx("div",{className:"carrier-stream-column__error",role:"alert",children:S}):null,k?c.jsxs("div",{className:"carrier-stream-column__activity","data-tone":l.tone,"aria-label":`${o("terminal.streams.activity")} · ${t.displayName}`,children:[l.tone==="live"?c.jsx("span",{className:"carrier-stream-column__activity-scan","aria-hidden":"true"}):null,c.jsxs("div",{className:"carrier-stream-column__activity-main",children:[c.jsx("span",{className:"carrier-stream-column__activity-orbit","data-tone":_1(k.status),"aria-hidden":"true"}),c.jsxs("span",{className:"carrier-stream-column__activity-copy",children:[c.jsx("strong",{children:o("terminal.analyst.activity.usingTool",{title:k.name??k.id})}),c.jsx("small",{children:o("terminal.analyst.activity.toolStatus",{status:k.status})}),c.jsx("small",{children:o("terminal.analyst.lastConfirmedOnly")})]}),c.jsx("time",{children:f})]})]}):null]})})]})}function DO(e){return e.reduce((t,n)=>b1(n.status)?t:t+n.trackOrder.reduce((i,s)=>{const o=n.tracks[s];return o&&mO(o.status)?i+1:i},0),0)}function fJ(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 pJ(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 mJ(){const{renderer:e,font:t}=b3();return c.jsxs(c.Fragment,{children:[c.jsx(wJ,{}),c.jsx(yJ,{}),c.jsx(CJ,{terminalFont:t}),c.jsx(EJ,{terminalRenderer:e})]})}const gJ=[{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 yJ(){const e=E1(),t=e.state,n=e.savingField!==null;g.useEffect(()=>{const o=new AbortController;return A1(o.signal),()=>o.abort()},[]);const i=t?.agentIdleDormantMinutes===null?"off":t?.agentIdleDormantMinutes!==void 0?String(t.agentIdleDormantMinutes):"60",s=(()=>{const o=gJ.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 c.jsxs("section",{className:"global-settings-card","aria-label":"Idle agent sessions",children:[e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",id:"idle-agent-sessions-label",children:"Idle agent sessions"}),c.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."})]}),c.jsx(qi,{"aria-labelledby":"idle-agent-sessions-label",value:i,disabled:n,options:s,onChange:o=>{const l=o==="off"?null:Number(o);T1("agentIdleDormantMinutes",l)}})]}):c.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."})]})}function vJ(){const e=Tt(ra()),[t,n]=g.useState([]),[i,s]=g.useState(null);return g.useEffect(()=>{const o=new AbortController;return zX(o.signal).then(l=>n(l.clis)).catch(l=>{o.signal.aborted||s(l instanceof Error?l.message:String(l))}),()=>o.abort()},[]),c.jsxs(c.Fragment,{children:[c.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.settings.agentCliAvailable"),children:[c.jsx("div",{className:"agent-cli-head",children:c.jsx("p",{className:"global-settings-resp-title",children:e("terminal.settings.agentCliAvailable")})}),c.jsx("p",{className:"global-settings-help",children:e("terminal.settings.agentCliHelp")}),i?c.jsx("p",{className:"settings-error",children:i}):null,c.jsx("div",{className:"agent-cli-list",children:t.map(o=>c.jsx(xJ,{cli:o},o.id))}),c.jsx("p",{className:"global-settings-foot",children:e("terminal.settings.agentCliFoot")})]}),c.jsx(_J,{})]})}function _J(){const e=Tt(ra()),t=OZ(),n=E1(),[i,s]=g.useState(null);g.useEffect(()=>{const y=new AbortController;return jZ(y.signal),()=>y.abort()},[]),g.useEffect(()=>{const y=new AbortController;return uO(y.signal).then(_=>s(_.cliTypes.find(w=>w.id==="claude-kimi")??null)).catch(()=>{}),()=>y.abort()},[]),g.useEffect(()=>{const y=new AbortController;return A1(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,_)=>{T1("kimiModel",_?{model:y,effort:_}:{model:y})};return c.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.auth.modelSignInAria"),children:[c.jsxs("div",{className:"model-auth-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:e("terminal.auth.settingsForKimi")}),c.jsx("p",{className:"global-settings-help",children:e("terminal.auth.kimiHelp")})]}),t.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,t.loading&&!t.state?c.jsx("p",{className:"global-settings-help",children:e("terminal.auth.loadingSignIn")}):null,t.state?.providers.map(y=>c.jsx(bJ,{provider:y,busy:t.busyCli===y.cli},y.cli)),i&&l?c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"terminal-carriers-runtime-row",children:[c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-model-label",children:e("terminal.auth.defaultModel")}),c.jsx(qi,{"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 _=i.models.find(w=>w.modelId===y);_&&m(_.modelId,_.effort?o?.effort??_.effort.default:void 0)}})]}),d?.effort?c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:"kimi-default-effort-label",children:e("terminal.auth.defaultEffort")}),c.jsx(qi,{"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]}),c.jsx("p",{className:"global-settings-help",children:e("terminal.auth.kimiModelHelp")})]}):null,c.jsx("p",{className:"global-settings-foot",children:e("terminal.auth.signInFoot")})]})}function bJ({provider:e,busy:t}){const n=Tt(ra()),[i,s]=g.useState(""),o=async()=>{await DZ(e.cli,i)&&s("")};return c.jsxs("div",{className:"model-auth-row",children:[c.jsxs("div",{className:"model-auth-row-head",children:[c.jsx("span",{className:"model-auth-name",children:e.displayName}),c.jsx("span",{className:`model-auth-status ${e.signedIn?"is-on":""}`,children:e.signedIn?n("terminal.auth.signedIn"):n("terminal.auth.notSignedIn")})]}),e.signedIn?c.jsx("div",{className:"model-auth-actions",children:c.jsx("button",{type:"button",className:"model-auth-button",disabled:t,onClick:()=>{BZ(e.cli)},children:n(t?"terminal.auth.working":"terminal.auth.signOut")})}):c.jsxs("form",{className:"model-auth-form",onSubmit:l=>{l.preventDefault(),o()},children:[c.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)}),c.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 wJ(){const e=Tt(ra()),t=E1(),n=t.state,i=t.savingField!==null;return g.useEffect(()=>{const s=new AbortController;return A1(s.signal),()=>s.abort()},[]),c.jsxs("section",{className:"global-settings-card","aria-label":e("terminal.settings.systemPromptAria"),children:[t.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,n?c.jsx(c.Fragment,{children:c.jsx(SJ,{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:()=>{T1("enableMetaphor",!n.enableMetaphor)}})}):c.jsx("p",{className:"global-settings-help",children:t.loading?e("terminal.settings.loading"):e("terminal.settings.unavailable")}),c.jsx("p",{className:"global-settings-foot",children:e("terminal.settings.systemPromptFoot")})]})}function SJ({title:e,help:t,onLabel:n,offLabel:i,value:s,disabled:o,onToggle:l}){return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:e}),c.jsx("p",{className:"global-settings-help",children:t})]}),c.jsx("button",{type:"button",className:`global-settings-toggle ${s?"is-on":""}`,disabled:o,"aria-pressed":s,onClick:l,children:c.jsx("span",{children:s?n:i})})]})}function xJ({cli:e}){const t=Tt(ra());return c.jsxs("div",{className:"agent-cli-row",children:[c.jsx("span",{className:"agent-cli-name",children:e.displayName}),c.jsxs("span",{className:"agent-cli-meta",children:[e.available&&e.version?c.jsx("span",{className:"agent-cli-version",children:e.version}):null,c.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?t("terminal.settings.available"):t("terminal.settings.missing")})]})]})}async function BO(e,t){jm(await GX(e,t)),xO(e)}function kJ({context:e,session:t}){const n=Tt(e.language??"en"),[i,s]=g.useState("idle"),o=g.useCallback(async l=>{s("resuming");try{await BO(t.sessionId,{fresh:l}),e.notifications.dismiss(t.sessionId)}catch{s("error"),e.notifications.emit({kind:d0.id,operationId:t.sessionId,message:"Resume failed — the saved session has expired."})}},[e,t.sessionId]);return i==="error"?c.jsxs("div",{className:"canvas-operation-dormant canvas-operation-dormant--error",role:"alert",children:[c.jsx("span",{className:"canvas-operation-dormant-status",children:n("terminal.dormant.status")}),c.jsx("p",{className:"canvas-operation-dormant-error",children:n("terminal.dormant.resumeFailedBody",{name:t.label||t.cwdLabel})}),c.jsxs("div",{className:"canvas-operation-dormant-error-actions",children:[c.jsx("button",{type:"button",className:"canvas-operation-dormant-action",onClick:()=>{o(!1)},children:n("terminal.dormant.tryAgain")}),c.jsx("button",{type:"button",className:"canvas-operation-dormant-action canvas-operation-dormant-action--ghost",onClick:()=>{o(!0)},children:n("terminal.dormant.startFresh")})]})]}):c.jsxs("button",{type:"button",className:"canvas-operation-dormant",disabled:i==="resuming",onClick:()=>{o(!1)},children:[c.jsx("span",{className:"canvas-operation-dormant-status",children:n("terminal.dormant.status")}),c.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 PO(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:qd(e.operation.payload,"cliId")??void 0,cliLabel:qd(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:qd(e.operation.payload,"tenantId")??void 0,registrationId:qd(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function qd(e,t){const n=e[t];return typeof n=="string"?n:null}function CJ({terminalFont:e}){const t=Tt(ra()),[n,i]=g.useState([]),[s,o]=g.useState(!0),[l,d]=g.useState(!1),f=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??Hc.id:Hc.id}:{source:"system",familyName:e.customName};g.useEffect(()=>{const m=new AbortController;return o(!0),d(!1),WN({signal:m.signal}).then(y=>{m.signal.aborted||i(y.fonts.filter(_=>_.monospace).map(_=>({family:_.family,monospace:_.monospace})))}).catch(y=>{m.signal.aborted||AJ(y)||(i([]),d(!0))}).finally(()=>{m.signal.aborted||o(!1)}),()=>m.abort()},[]);const p=m=>{if(m.source==="system"){EG(m.familyName);return}const y=fh.find(_=>_.id===m.id);y&&CG(y.id)};return c.jsxs("section",{className:"global-settings-card","aria-label":t("terminal.settings.terminalFont"),children:[c.jsx("div",{className:"global-settings-row",children:c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:[t("terminal.settings.terminalFont")," ",c.jsx("span",{className:"new-badge",children:t("terminal.settings.terminalFontNew")})]}),c.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:t("terminal.settings.terminalFontHelp")})]})}),c.jsx("div",{"aria-describedby":"terminal-font-help",children:c.jsx(HN,{builtIns:fh.map(m=>({id:m.id,label:m.name,family:m.family,aliases:[m.familyName],description:t(YZ[m.id])})),installedFonts:n,selected:f,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:Hc.family,previewText:t("terminal.settings.terminalFontPreview"),size:e.size,sizeRange:VZ,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:AG})}),c.jsx("p",{className:"global-settings-foot",children:t("terminal.settings.terminalFontFoot")})]})}function EJ({terminalRenderer:e}){const t=Tt(ra()),n={webgl:t("terminal.settings.webgl"),dom:t("terminal.settings.dom")};return c.jsx("section",{className:"global-settings-card","aria-label":t("terminal.settings.terminalRenderer"),children:c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:t("terminal.settings.terminalRenderer")}),c.jsx("p",{className:"global-settings-help",children:t("terminal.settings.terminalRendererHelp")})]}),c.jsx("div",{className:"segmented",role:"group","aria-label":t("terminal.settings.terminalRendererAria"),children:WZ.map(i=>{const s=i===e;return c.jsx("button",{type:"button","aria-pressed":s,className:`segmented-option ${s?"is-active":""}`,onClick:()=>kG(i),children:n[i]},i)})})]})})}function AJ(e){return e instanceof DOMException&&e.name==="AbortError"}function TJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),c.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function RJ(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function MJ(){return c.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:c.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}function NJ(){return c.jsx("svg",{viewBox:"0 0 1024 1024","aria-hidden":"true",children:c.jsx("path",{fillRule:"evenodd",d:"M525.019429 157.257143c-201.984 0-365.714286 163.730286-365.714286 365.714286 0 70.326857 19.858286 136.118857 54.345143 191.926857L174.811429 807.570286A58.514286 58.514286 0 0 0 228.790857 888.685714h296.228572c201.947429 0 365.714286-163.730286 365.714285-365.714285s-163.766857-365.714286-365.714285-365.714286z m138.422857 180.114286a45.458286 45.458286 0 0 1 51.2 38.875428l12.361143 90.441143a45.458286 45.458286 0 0 1-90.075429 12.324571l-12.361143-90.441142a45.458286 45.458286 0 0 1 38.875429-51.2z m-195.876572 24.137142a45.458286 45.458286 0 0 1 51.2 38.838858l12.361143 90.441142a45.458286 45.458286 0 1 1-90.038857 12.324572l-12.361143-90.441143a45.458286 45.458286 0 0 1 38.838857-51.2",fill:"currentColor"})})}const h0=new Set;let Js={loading:!1,state:null,options:null,activeCarrierId:null,savingActionId:null,error:null};function LJ(){return g.useSyncExternalStore(OJ,su,su)}function su(){return Js}function OJ(e){return h0.add(e),()=>{h0.delete(e)}}async function Gp(e){Ro({loading:!0,error:null});try{const[t,n]=await Promise.all([MX(e),uO(e)]);$O(t,n)}catch(t){if(e?.aborted)return;Ro({loading:!1,error:zO(t)})}}function IJ(e){Ro({activeCarrierId:e,error:null})}async function gp(e){const t=M1();return!t||Js.savingActionId!==null?!1:R1("carrier-patch",()=>NX(t.carrierId,e))}async function jJ(e,t){const n=M1();return!n||Js.savingActionId!==null?!1:R1(`taskforce-save:${e}`,()=>LX(n.carrierId,e,t))}async function DJ(e){const t=M1();return!t||Js.savingActionId!==null?!1:R1(`taskforce-remove:${e}`,()=>OX(t.carrierId,e))}function $O(e,t){const n=BJ(e,Js.activeCarrierId);Ro({loading:!1,state:e,options:t,activeCarrierId:n,error:null})}async function R1(e,t){Ro({savingActionId:e,error:null});try{const n=await t();return $O(n.state,Js.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),Ro({savingActionId:null}),!0}catch(n){const i=zO(n);return Ro({error:i}),await Gp(),Ro({savingActionId:null,error:i}),!1}}function M1(){return Js.state?.carriers.find(e=>e.carrierId===Js.activeCarrierId)??null}function BJ(e,t){return t&&e.carriers.some(n=>n.carrierId===t)?t:e.carriers[0]?.carrierId??null}function Ro(e){Js={...Js,...e};for(const t of h0)t()}function zO(e){return e instanceof Error?e.message:String(e)}const PJ=50,FO=2400,$J={nimitz:"var(--captain-nimitz)",genesis:"var(--captain-genesis)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)"},zJ={id:"carriers",title:e=>Tt(e)("terminal.carriers.title"),render:()=>c.jsx(FJ,{})};function FJ(){const e=Tt(ra()),t=LJ(),n=t.state?.carriers.find(M=>M.carrierId===t.activeCarrierId)??null,[i,s]=g.useState(!1),[o,l]=g.useState(""),[d,f]=g.useState("idle"),[p,m]=g.useState({}),y=p.carrierId===n?.carrierId?p:{},_=y.cli??n?.cliType,w=t.options?.cliTypes.find(M=>M.id===_)??null,S=y.model??n?.model,x=w?.models.find(M=>M.modelId===S)??null,k=t.savingActionId!==null;g.useEffect(()=>{const M=new AbortController;return Gp(M.signal),()=>M.abort()},[]),g.useEffect(()=>{s(!1),l(n?.displayName??""),f("idle"),m({})},[n?.carrierId]),g.useEffect(()=>{if(d!=="saved")return;const M=window.setTimeout(()=>f("idle"),FO);return()=>window.clearTimeout(M)},[d]);async function C(M){const V=su().activeCarrierId;f("saving");const Y=await M();return su().activeCarrierId===V&&(m({}),f(Y?"saved":"idle")),Y}async function B(){!n||k||(s(!1),o!==n.displayName&&await C(()=>gp({displayName:o})))}function H(){l(n?.displayName??""),s(!1)}async function T(M){const V=t.options?.cliTypes.find(te=>te.id===M),Y=V?.models.find(te=>te.modelId===V.defaultModel)??V?.models[0]??null;!n||!V||!Y||(m({carrierId:n.carrierId,cli:M,model:Y.modelId,effort:Y.effort?.default??""}),await C(()=>gp({cli:M,model:{model:Y.modelId,...Y.effort?.default?{effort:Y.effort.default}:{}}})))}async function $(M){if(!n)return;const V=w?.models.find(Y=>Y.modelId===M)??null;m({carrierId:n.carrierId,model:M,effort:V?.effort?.default??""}),await C(()=>gp({model:{model:M,...V?.effort?.default?{effort:V.effort.default}:{}}}))}async function j(M){n&&(m({carrierId:n.carrierId,effort:M}),await C(()=>gp({model:{model:n.model,effort:M}})))}return c.jsxs(c.Fragment,{children:[t.error?c.jsx("p",{className:"terminal-carriers-error",role:"alert",children:t.error}):null,c.jsxs("div",{className:"terminal-carriers-strip",role:"group","aria-label":e("terminal.carriers.listAria"),children:[t.loading&&!t.state?c.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.loading")}):null,t.state&&t.state.carriers.length===0?c.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.empty")}):null,t.state?.carriers.map(M=>c.jsx(HJ,{carrier:M,active:M.carrierId===t.activeCarrierId,minBackends:t.options?.taskForceConstraints.minBackends??null,onSelect:()=>IJ(M.carrierId)},M.carrierId))]}),n&&t.options&&w?c.jsxs("section",{className:"global-settings-card terminal-carriers-card",style:WO(n.carrierId),children:[c.jsxs("div",{className:"terminal-carriers-detail-head",children:[c.jsxs("div",{className:"terminal-carriers-detail-title-block",children:[c.jsxs("div",{className:"terminal-carriers-captain-id",children:[c.jsx("span",{children:e("terminal.carriers.captain")})," · ",n.carrierId.toUpperCase()]}),c.jsx("div",{className:`terminal-carriers-name-line ${i?"is-editing":""}`,children:i?c.jsxs(c.Fragment,{children:[c.jsx("input",{id:"carrier-display-name",className:"terminal-carriers-input terminal-carriers-name-input","aria-label":e("terminal.carriers.displayName"),value:o,maxLength:PJ,disabled:k,onChange:M=>l(M.target.value),onBlur:M=>{const V=M.relatedTarget;V instanceof HTMLElement&&V.closest("[data-display-name-action]")||B()},onKeyDown:M=>{M.key==="Enter"?(M.preventDefault(),B()):M.key==="Escape"&&(M.preventDefault(),H())}}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":e("terminal.carriers.saveDisplayNameAria"),disabled:k,onClick:()=>{B()},children:c.jsx(qJ,{})}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","data-display-name-action":!0,"aria-label":e("terminal.carriers.cancelDisplayNameAria"),onClick:H,children:c.jsx(GJ,{})})]}):c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"terminal-carriers-captain-name",children:n.displayName}),c.jsx("button",{type:"button",className:"terminal-carriers-icon-button","aria-label":e("terminal.carriers.editDisplayNameAria"),disabled:k,onClick:()=>{l(n.displayName),s(!0)},children:c.jsx(WJ,{})})]})}),c.jsx("div",{className:"terminal-carriers-captain-role",children:n.role})]}),c.jsxs("div",{className:"terminal-carriers-detail-actions",children:[c.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"):""}),c.jsx("div",{className:"terminal-carriers-save-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-action-button terminal-carriers-detail-refresh",disabled:t.loading||k,onClick:()=>{Gp()},children:e("terminal.carriers.refresh")})})]})]}),c.jsxs("div",{className:"terminal-carriers-body",children:[c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:e("terminal.carriers.identity")}),c.jsx("div",{className:"terminal-carriers-mission",children:n.roleDescription})]}),c.jsxs("div",{className:"terminal-carriers-control-group",children:[c.jsx("div",{className:"terminal-carriers-resp-title",children:e("terminal.carriers.runtime")}),c.jsxs("div",{className:"terminal-carriers-runtime",children:[c.jsx("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--cli",children:c.jsxs("div",{className:"terminal-carriers-field terminal-carriers-field--wide",children:[c.jsx("span",{className:"terminal-carriers-label",id:"carrier-cli-label",children:e("terminal.carriers.cli")}),c.jsx(qi,{"aria-labelledby":"carrier-cli-label",value:y.cli??n.cliType,disabled:k,options:t.options.cliTypes.map(M=>({value:M.id,label:M.displayName})),onChange:M=>{T(M)}})]})}),c.jsxs("div",{className:"terminal-carriers-runtime-row terminal-carriers-runtime-row--model",children:[c.jsx(HO,{id:"carrier-model",label:e("terminal.carriers.model"),models:w.models,value:y.model??n.model,disabled:k,onChange:M=>{$(M)}}),c.jsx(UO,{id:"carrier-effort",model:x,value:y.effort??n.effort??"",disabled:k,onChange:M=>{j(M)}})]})]})]}),n.taskForceCapable?c.jsx(UJ,{carrier:n,cliOptions:t.options.cliTypes,minBackends:t.options.taskForceConstraints.minBackends,savingActionId:t.savingActionId,stateGeneration:t.state?.generation??0}):null]})]},n.carrierId):c.jsxs("section",{className:"global-settings-card terminal-carriers-card",children:[c.jsx("p",{className:"terminal-carriers-empty",children:e("terminal.carriers.select")}),c.jsx("button",{type:"button",className:"terminal-carriers-action-button",disabled:t.loading,onClick:()=>{Gp()},children:e("terminal.carriers.refresh")})]})]})}function HJ({carrier:e,active:t,minBackends:n,onSelect:i}){const s=e.taskForceCapable&&n!==null&&e.taskforce.backends.length>=n;return c.jsxs("button",{type:"button",className:`terminal-carriers-chip ${t?"is-active":""}`,"aria-pressed":t,style:WO(e.carrierId),onClick:i,children:[c.jsx("span",{className:"terminal-carriers-captain-dot","aria-hidden":"true"}),c.jsx("span",{className:"terminal-carriers-chip-name",children:e.displayName}),s?c.jsx("span",{className:"terminal-carriers-live-dot is-live","aria-hidden":"true"}):null]})}function HO({id:e,label:t,models:n,value:i,disabled:s=!1,onChange:o}){const l=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:l,children:t}),c.jsx(qi,{"aria-labelledby":l,value:i,disabled:s,options:n.map(d=>({value:d.modelId,label:d.name})),onChange:o})]})}function UO({id:e,model:t,value:n,disabled:i=!1,onChange:s}){const o=Tt(ra());if(!t?.effort)return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",children:o("terminal.carriers.effort")}),c.jsx("p",{className:"terminal-carriers-help",children:o("terminal.carriers.effortUnsupported")})]});const l=`${e}-label`;return c.jsxs("div",{className:"terminal-carriers-field",children:[c.jsx("span",{className:"terminal-carriers-label",id:l,children:o("terminal.carriers.effort")}),c.jsx(qi,{"aria-labelledby":l,value:n||t.effort.default,disabled:i,options:t.effort.levels.map(d=>({value:d,label:d})),onChange:s})]})}function UJ({carrier:e,cliOptions:t,minBackends:n,savingActionId:i,stateGeneration:s}){const o=Tt(ra()),l=e.taskforce.backends.length,[d,f]=g.useState(l>0),[p,m]=g.useState(!1),[y,_]=g.useState(""),[w,S]=g.useState(null),[x,k]=g.useState({}),[C,B]=g.useState({}),H=e.taskforce.backends.length>=n,T=t.filter(P=>!e.taskforce.backends.some(N=>N.cliType===P.id)),$=y||T[0]?.id||"",j=i!==null,M=l>0?H?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});g.useEffect(()=>{S(null)},[s]),g.useEffect(()=>{if(!w)return;const P=N=>{const I=N.target;(!(I instanceof Element)||!I.closest(`[data-remove-cli="${w}"]`))&&S(null)};return document.addEventListener("click",P,!0),()=>document.removeEventListener("click",P,!0)},[w]),g.useEffect(()=>{const P=Object.entries(x).filter(([,I])=>I==="saved").map(([I])=>I);if(P.length===0)return;const N=window.setTimeout(()=>{k(I=>{const D={...I};for(const E of P)D[E]="idle";return D})},FO);return()=>window.clearTimeout(N)},[x]);async function V(P,N,I,D={}){const E=e.carrierId;B(R=>({...R,...D})),k(R=>({...R,[P]:"saving"}));const L=await jJ(P,{model:N,...I?{effort:I}:{}});return su().activeCarrierId===E&&(B({}),k(R=>({...R,[P]:L?"saved":"idle"})),L&&S(null)),L}async function Y(P,N){if(!e.taskforce.backends.find(L=>L.cliType===P.id))return;const E=(P.models.find(L=>L.modelId===N)??null)?.effort?.default??"";await V(P.id,N,E,{[`tf:${P.id}:model`]:N,[`tf:${P.id}:effort`]:E})}async function te(P,N,I){await V(P,N,I,{[`tf:${P}:effort`]:I})}async function J(P){if(w!==P){S(P);return}const N=e.carrierId;k(D=>({...D,[P]:"saving"}));const I=await DJ(P);su().activeCarrierId===N&&(B({}),k(D=>({...D,[P]:I?"saved":"idle"})),I&&S(null))}return c.jsxs("div",{className:`terminal-carriers-control-group terminal-carriers-control-group--taskforce ${d?"is-expanded":""}`,children:[c.jsxs("div",{className:"terminal-carriers-section-head",children:[c.jsxs("div",{children:[c.jsx("p",{className:"terminal-carriers-resp-title",children:o("terminal.carriers.taskForce")}),c.jsx("p",{className:"terminal-carriers-help",children:M})]}),c.jsx("div",{className:"terminal-carriers-tf-head-actions",children:c.jsx("button",{type:"button",className:"terminal-carriers-tf-toggle","aria-expanded":d,onClick:()=>f(P=>!P),children:o(d?"terminal.carriers.tf.hide":"terminal.carriers.tf.configure")})})]}),d?c.jsxs("div",{className:"terminal-carriers-tf-list",children:[e.taskforce.backends.length===0?c.jsx("p",{className:"terminal-carriers-tf-empty",children:o("terminal.carriers.tf.empty")}):null,e.taskforce.backends.map(P=>{const N=t.find(U=>U.id===P.cliType);if(!N)return null;const I=C[`tf:${N.id}:model`]??P.model,D=C[`tf:${N.id}:effort`]??P.effort??"",E=N.models.find(U=>U.modelId===I)??N.models[0]??null,L=x[N.id]??"idle",R=w===N.id,q=e.taskforce.backends.length-1<n?o("terminal.carriers.tf.confirmDeactivate"):o("terminal.carriers.tf.confirmRemove");return c.jsxs("div",{className:"terminal-carriers-tf-item is-active",children:[c.jsxs("div",{className:"terminal-carriers-tf-title",children:[c.jsx("span",{className:`terminal-carriers-live-dot ${H?"is-live":""}`,"aria-hidden":"true"}),c.jsx("strong",{children:N.displayName}),c.jsx("span",{className:`terminal-carriers-tf-status ${L==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:L==="saving"?o("terminal.carriers.saving"):L==="saved"?o("terminal.carriers.saved"):""})]}),c.jsx(HO,{id:`tf-${N.id}-model`,label:o("terminal.carriers.model"),models:N.models,value:I,disabled:j,onChange:U=>{Y(N,U)}}),c.jsx(UO,{id:`tf-${N.id}-effort`,model:E,value:D,disabled:j,onChange:U=>{te(N.id,I,U)}}),c.jsx("div",{className:"terminal-carriers-tf-actions",children:c.jsx("button",{type:"button",className:`terminal-carriers-ghost-button terminal-carriers-tf-remove ${R?"is-armed":""}`,"data-remove-cli":N.id,"aria-label":R?o("terminal.carriers.tf.confirmRemovalAria",{name:N.displayName}):void 0,disabled:j,onClick:()=>{J(N.id)},children:R?q:o("terminal.carriers.tf.remove")})})]},N.id)}),c.jsxs("div",{className:"terminal-carriers-tf-add-row",children:[p&&T.length>0?c.jsx(qi,{className:"terminal-carriers-tf-add-select",label:o("terminal.carriers.tf.addCliLabel"),value:$,disabled:j,options:T.map(P=>({value:P.id,label:P.displayName})),onChange:P=>_(P)}):null,c.jsx("button",{type:"button",className:"terminal-carriers-ghost-button",disabled:T.length===0||j,onClick:()=>{if(!p){m(!0);return}const P=$,N=t.find(D=>D.id===P),I=N?.models.find(D=>D.modelId===N.defaultModel)??N?.models[0]??null;!N||!I||V(N.id,I.modelId,I.effort?.default??"").then(D=>{D&&(_(""),m(!1))})},children:o("terminal.carriers.tf.add")})]})]}):null]})}function WO(e){return{"--cap-color":$J[e]??"var(--brass)"}}function WJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),c.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function qJ(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:c.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function GJ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[c.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),c.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}const KJ="global-shell:theater:",VJ="/plugins/terminal/global/ticket",YJ="/plugins/terminal/ws",XJ=168,ZJ={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},JJ={id:"global-shell",title:e=>Tt(e)("terminal.kind.shell"),icon:QJ,preferredExtraWidth:XJ,render:e=>c.jsx("div",{style:ZJ,children:c.jsx(i1,{operationId:`${KJ}${encodeURIComponent(e.theaterId??"")}`,ticketPath:VJ,wsPath:YJ,theme:"instrument",active:!0})})};function QJ(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const eQ="/plugins/terminal/shell/ticket",tQ="/plugins/terminal/ws",qO={pluginId:"terminal",type:"shell",title:e=>Tt(e)("terminal.kind.shell"),subtitle:()=>"shell",render:e=>g.createElement(nQ,{context:e})},B_={id:"terminal",operationKinds:[qO],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:Tt("en")("terminal.kind.shell"),payload:{theaterId:e}})).id}),renderLaunchIcon:()=>c.jsx(iQ,{})};function nQ({context:e}){const t=Tt(e.language??"en"),[n,i]=g.useState(!1);return e.operation.payload.restoredDormant===!0&&!n?c.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:[c.jsx("span",{className:"canvas-operation-dormant-status",children:t("terminal.dormant.status")}),c.jsx("span",{className:"canvas-operation-dormant-action",children:t("terminal.shell.relaunch")})]}):c.jsx(i1,{operationId:e.operationId,active:e.active,keyboardFocusRequestId:e.keyboardFocusRequestId,zoom:e.zoom,ticketPath:eQ,wsPath:tQ,theme:e.theme,onExit:e.onClose})}function iQ(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),c.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const rQ=new Set(["agent"]),sQ={id:"terminal",operationKinds:[qO,NO],settingsSections:[LO,OO,zJ],notificationKinds:[IO],railPanels:[JJ],install:e=>(S3(),xG(e.settings),Td.install?.(e)),closeOperation:async e=>{const t=await i5(e);if(t?.type==="shell"){await B_.closeOperation?.(e);return}t&&rQ.has(t.type)&&await Td.closeOperation?.(e)},resumeOperation:async e=>{let t=null;try{t=await i5(e)}catch{t=null}t?.type!=="shell"&&await Td.resumeOperation?.(e)},launch:async e=>e.kind.type==="shell"?B_.launch?.(e)??{id:""}:Td.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?B_.renderLaunchIcon?.(e):Td.renderLaunchIcon?.(e)},aQ=[sQ];async function i5(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 oQ={"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"},lQ={"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가 선택되지 않았습니다"},r5={en:oQ,ko:lQ},cQ={en:qs(r5,"en"),ko:qs(r5,"ko")};function N1(e){return cQ[e??"en"]}function uQ(e){return{copyLabel:e("fileExplorer.markdown.copy"),copyAriaLabel:t=>e("fileExplorer.markdown.copyCodeAria",{language:t})}}function dQ(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 hQ={"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 $m(e,t){const n=hQ[e];return n===void 0?e:t(n)}const ce={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"},fQ={src:ce.ts,lib:ce.ts,app:ce.ts,test:ce.shell,tests:ce.shell,__tests__:ce.shell,spec:ce.shell,specs:ce.shell,node_modules:ce.binary,vendor:ce.binary,dist:ce.config,build:ce.config,out:ce.config,target:ce.config,docs:ce.md,doc:ce.md,public:ce.data,assets:ce.data,static:ce.data,components:ce.image,scripts:ce.js,styles:ce.css,".git":ce.html,".github":ce.config,".vscode":ce.css},s5={ts:{shape:"angle",tone:ce.ts},tsx:{shape:"angle",tone:ce.ts},mts:{shape:"angle",tone:ce.ts},cts:{shape:"angle",tone:ce.ts},"d.ts":{shape:"angle",tone:ce.ts},js:{shape:"angle",tone:ce.js},jsx:{shape:"angle",tone:ce.js},mjs:{shape:"angle",tone:ce.js},cjs:{shape:"angle",tone:ce.js},json:{shape:"braces",tone:ce.json},jsonc:{shape:"braces",tone:ce.json},json5:{shape:"braces",tone:ce.json},jsonl:{shape:"braces",tone:ce.json},graphql:{shape:"braces",tone:ce.image},gql:{shape:"braces",tone:ce.image},proto:{shape:"braces",tone:ce.go},css:{shape:"hash",tone:ce.css},scss:{shape:"hash",tone:ce.css},sass:{shape:"hash",tone:ce.css},less:{shape:"hash",tone:ce.css},styl:{shape:"hash",tone:ce.css},html:{shape:"markup",tone:ce.html},htm:{shape:"markup",tone:ce.html},xml:{shape:"markup",tone:ce.html},xhtml:{shape:"markup",tone:ce.html},vue:{shape:"markup",tone:ce.shell},svelte:{shape:"markup",tone:ce.rust},astro:{shape:"markup",tone:ce.image},md:{shape:"doc",tone:ce.md},mdx:{shape:"doc",tone:ce.md},markdown:{shape:"doc",tone:ce.md},rst:{shape:"doc",tone:ce.md},txt:{shape:"doc",tone:ce.default},text:{shape:"doc",tone:ce.default},log:{shape:"doc",tone:ce.default},adoc:{shape:"doc",tone:ce.md},pdf:{shape:"doc",tone:ce.ruby},py:{shape:"angle",tone:ce.py},pyi:{shape:"angle",tone:ce.py},pyw:{shape:"angle",tone:ce.py},go:{shape:"angle",tone:ce.go},rs:{shape:"angle",tone:ce.rust},rb:{shape:"angle",tone:ce.ruby},rake:{shape:"angle",tone:ce.ruby},gemspec:{shape:"angle",tone:ce.ruby},java:{shape:"angle",tone:ce.html},kt:{shape:"angle",tone:ce.config},kts:{shape:"angle",tone:ce.config},scala:{shape:"angle",tone:ce.ruby},c:{shape:"angle",tone:ce.ts},h:{shape:"angle",tone:ce.ts},cpp:{shape:"angle",tone:ce.css},cc:{shape:"angle",tone:ce.css},cxx:{shape:"angle",tone:ce.css},hpp:{shape:"angle",tone:ce.css},cs:{shape:"angle",tone:ce.config},php:{shape:"angle",tone:ce.config},swift:{shape:"angle",tone:ce.html},lua:{shape:"angle",tone:ce.ts},dart:{shape:"angle",tone:ce.go},sh:{shape:"terminal",tone:ce.shell},bash:{shape:"terminal",tone:ce.shell},zsh:{shape:"terminal",tone:ce.shell},fish:{shape:"terminal",tone:ce.shell},ps1:{shape:"terminal",tone:ce.css},bat:{shape:"terminal",tone:ce.shell},cmd:{shape:"terminal",tone:ce.shell},yaml:{shape:"gear",tone:ce.config},yml:{shape:"gear",tone:ce.config},toml:{shape:"gear",tone:ce.config},ini:{shape:"gear",tone:ce.config},conf:{shape:"gear",tone:ce.config},cfg:{shape:"gear",tone:ce.config},properties:{shape:"gear",tone:ce.config},env:{shape:"gear",tone:ce.config},editorconfig:{shape:"gear",tone:ce.config},png:{shape:"image",tone:ce.image},jpg:{shape:"image",tone:ce.image},jpeg:{shape:"image",tone:ce.image},gif:{shape:"image",tone:ce.image},webp:{shape:"image",tone:ce.image},svg:{shape:"image",tone:ce.image},ico:{shape:"image",tone:ce.image},bmp:{shape:"image",tone:ce.image},avif:{shape:"image",tone:ce.image},tiff:{shape:"image",tone:ce.image},heic:{shape:"image",tone:ce.image},mp4:{shape:"image",tone:ce.data},mov:{shape:"image",tone:ce.data},webm:{shape:"image",tone:ce.data},mkv:{shape:"image",tone:ce.data},mp3:{shape:"chip",tone:ce.shell},wav:{shape:"chip",tone:ce.shell},flac:{shape:"chip",tone:ce.shell},ogg:{shape:"chip",tone:ce.shell},sql:{shape:"database",tone:ce.data},csv:{shape:"database",tone:ce.data},tsv:{shape:"database",tone:ce.data},db:{shape:"database",tone:ce.data},sqlite:{shape:"database",tone:ce.data},sqlite3:{shape:"database",tone:ce.data},parquet:{shape:"database",tone:ce.data},zip:{shape:"archive",tone:ce.archive},tar:{shape:"archive",tone:ce.archive},gz:{shape:"archive",tone:ce.archive},tgz:{shape:"archive",tone:ce.archive},bz2:{shape:"archive",tone:ce.archive},xz:{shape:"archive",tone:ce.archive},rar:{shape:"archive",tone:ce.archive},"7z":{shape:"archive",tone:ce.archive},zst:{shape:"archive",tone:ce.archive},bin:{shape:"chip",tone:ce.binary},exe:{shape:"chip",tone:ce.binary},dll:{shape:"chip",tone:ce.binary},so:{shape:"chip",tone:ce.binary},dylib:{shape:"chip",tone:ce.binary},wasm:{shape:"chip",tone:ce.config},class:{shape:"chip",tone:ce.binary},lock:{shape:"chip",tone:ce.binary},woff:{shape:"chip",tone:ce.config},woff2:{shape:"chip",tone:ce.config},ttf:{shape:"chip",tone:ce.config},otf:{shape:"chip",tone:ce.config}},pQ={dockerfile:{shape:"chip",tone:ce.css},"docker-compose.yml":{shape:"gear",tone:ce.css},"docker-compose.yaml":{shape:"gear",tone:ce.css},makefile:{shape:"gear",tone:ce.html},"cmakelists.txt":{shape:"gear",tone:ce.html},".gitignore":{shape:"gear",tone:ce.html},".gitattributes":{shape:"gear",tone:ce.html},".dockerignore":{shape:"gear",tone:ce.html},".npmignore":{shape:"gear",tone:ce.html},".npmrc":{shape:"gear",tone:ce.ruby},"package.json":{shape:"braces",tone:ce.shell},"tsconfig.json":{shape:"braces",tone:ce.ts},license:{shape:"doc",tone:ce.json},"license.md":{shape:"doc",tone:ce.json},licence:{shape:"doc",tone:ce.json}},mQ={shape:"default",tone:ce.default},f0={angle:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),c.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),c.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:c.jsxs(c.Fragment,{children:[c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:c.jsxs(c.Fragment,{children:[c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),c.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:c.jsxs(c.Fragment,{children:[c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),c.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),c.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),c.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),c.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:c.jsxs(c.Fragment,{children:[c.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),c.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),c.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),c.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function gQ({name:e}){const t=vQ(e);return c.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:f0[t.shape]})}function yQ({name:e,open:t}){const n=fQ[e.toLowerCase()]??ce.folder;return c.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${n})`},children:t?f0.folderOpen:f0.folderClosed})}function vQ(e){const t=e.toLowerCase(),n=pQ[t];if(n)return n;if(t.startsWith(".env"))return{shape:"gear",tone:ce.config};if(t.startsWith("readme"))return{shape:"doc",tone:ce.md};if(t.endsWith(".d.ts"))return s5["d.ts"];const i=t.lastIndexOf(".");if(i>0&&i<t.length-1){const s=t.slice(i+1),o=s5[s];if(o)return o}return mQ}const _Q=200,wc=30,a5=5,L1="fleet-console.fileExplorer.showHidden",o5=500;function Jr(e,t){return e===t}async function bQ({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=_=>{for(const w of _)if(!(!xQ(w,i)||f.has(w.relativePath))){if(f.size>=o5)return;f.add(w.relativePath),l.push(w)}};for(y(e);l.length>0&&s();){const _=l.shift();if(!_)return;const w=d.get(_.relativePath);if(w){if(p.has(w.relativePath))continue;p.add(w.relativePath),y(w.entries);continue}if(m>=o5)return;m+=1;try{const S=await n.listFolder(_.relativePath);if(!s())return;if(d.set(_.relativePath,S),o(_.relativePath,S),p.has(S.relativePath))continue;p.add(S.relativePath),y(S.entries)}catch{}}}function GO(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 _=o.get(y.relativePath),w=_?.entries,S=_?.relativePath??y.relativePath,x=y.kind==="dir"&&f.has(S),k=y.kind==="dir"&&!x&&KO(w??[],o,l,d);if(l&&!y.name.toLowerCase().includes(l)&&!k)continue;const C=!p.has(y.relativePath)&&(i.has(y.relativePath)||!!(l&&k));if(m.push({entry:y,depth:t,isSelected:n===y.relativePath,isExpanded:C,isLoading:s.has(y.relativePath)}),y.kind==="dir"&&C&&!x&&w){const B=new Set(f);B.add(S),m.push(...GO(w,t+1,n,i,s,o,l,d,B,p))}}return m}function wQ(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 SQ({contextKey:e,files:t,theaterId:n,selectedPath:i,revealTarget:s,onSelect:o,t:l}){const[d,f]=g.useState(null),[p,m]=g.useState(null),[y,_]=g.useState(""),[w,S]=g.useState(new Set),[x,k]=g.useState(new Set),[C,B]=g.useState(new Map),[H,T]=g.useState(""),[$,j]=g.useState(new Set),[M,V]=g.useState(0),[Y,te]=g.useState(600),[J,P]=g.useState(()=>kQ()),[N,I]=g.useState(null),D=g.useRef(null),E=g.useRef(new Map),L=g.useRef(null),R=g.useRef(0),q=g.useRef(w);q.current=w;const U=g.useRef(y);U.current=y;const O=g.useRef(t);O.current=t;const W=g.useRef(e);W.current=e;const K=g.useRef(C);K.current=C;const z=g.useRef(0),G=!!H;g.useEffect(()=>{n&&(f(null),m(null),_(""),S(new Set),B(new Map),T(""),j(new Set),V(0),I(null))},[e,n]),g.useEffect(()=>{if(!n)return;const ke=e;t.listFolder(y||void 0).then(De=>{Jr(ke,W.current)&&(f(De),m(null))}).catch(De=>{if(!Jr(ke,W.current))return;const Xe=De instanceof Error?De.message:"Unable to load folder";m($m(Xe,l))})},[e,n,y,t,l]),g.useEffect(()=>{if(!s||s.theaterId!==n||s.requestId<=R.current)return;let ke=!0;const De=e;return(async()=>{const _t=await t.listFolder(),ht=new Map,nt=new Set,st=s.relativePath.split("/").filter(Boolean);let _e="";for(const Ne of st.slice(0,-1)){_e=_e?`${_e}/${Ne}`:Ne;const bt=await t.listFolder(_e);ht.set(_e,bt),nt.add(_e)}!ke||!Jr(De,W.current)||(T(""),j(new Set),st.some(Ne=>Ne.startsWith("."))&&(P(!0),CQ(!0)),_(""),f(_t),B(Ne=>{const bt=new Map(Ne);for(const[Nt,hn]of ht)bt.set(Nt,hn);return bt}),S(Ne=>new Set([...Ne,...nt])),I(s.relativePath))})().catch(()=>{}),()=>{ke=!1}},[e,t,s,n]),g.useEffect(()=>{const ke=++z.current;if(!G||!d)return;let De=!0;const Xe=e,_t=()=>De&&ke===z.current&&Jr(Xe,W.current);return bQ({entries:d.entries,cachedResults:K.current,files:t,showHidden:J,isCurrent:_t,onFolderResult:(ht,nt)=>{_t()&&B(st=>new Map(st).set(ht,nt))}}),()=>{De=!1}},[e,t,G,d,J]),g.useEffect(()=>{const ke=D.current;if(!ke)return;const De=new ResizeObserver(()=>te(ke.clientHeight));return De.observe(ke),te(ke.clientHeight),()=>De.disconnect()},[]),g.useEffect(()=>{if(!n)return;let ke=!0;const De=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(n)}`,Xe=new EventSource(De),_t=()=>{const nt=e;O.current.listFolder(U.current||void 0).then(st=>{Jr(nt,W.current)&&(f(st),m(null))}).catch(()=>{})},ht=()=>{_t();for(const nt of q.current){const st=e;O.current.listFolder(nt).then(_e=>{Jr(st,W.current)&&B(Ne=>new Map(Ne).set(nt,_e))}).catch(()=>{})}};return Xe.addEventListener("change",nt=>{let st;try{st=JSON.parse(nt.data)}catch{return}if(typeof st=="string"&&((st===""||st===U.current)&&_t(),st!==""&&q.current.has(st))){const _e=e;O.current.listFolder(st).then(Ne=>{Jr(_e,W.current)&&B(bt=>new Map(bt).set(st,Ne))}).catch(()=>{})}}),Xe.onopen=()=>{if(ke){ke=!1;return}ht()},()=>{Xe.close()}},[e,n,t]);const Z=g.useCallback(ke=>{const De=ke.relativePath,Xe=!w.has(De);if(S(_t=>{const ht=new Set(_t);return ht.has(De)?(ht.delete(De),ht):(ht.add(De),ht)}),Xe){const _t=e;k(ht=>new Set(ht).add(De)),t.listFolder(De).then(ht=>{Jr(_t,W.current)&&(B(nt=>new Map(nt).set(De,ht)),k(nt=>{const st=new Set(nt);return st.delete(De),st}))}).catch(()=>{Jr(_t,W.current)&&k(ht=>{const nt=new Set(ht);return nt.delete(De),nt})})}},[e,t,w]),se=g.useCallback(ke=>{V(ke.currentTarget.scrollTop)},[]),Se=g.useCallback(()=>{P(ke=>{const De=!ke;try{localStorage.setItem(L1,De?"1":"0")}catch{}return De})},[]),pe=g.useCallback(()=>{if(!n)return;const ke=e;t.listFolder(y||void 0).then(De=>{Jr(ke,W.current)&&(f(De),m(null))}).catch(De=>{if(!Jr(ke,W.current))return;const Xe=De instanceof Error?De.message:"Unable to load folder";m($m(Xe,l))});for(const De of w)t.listFolder(De).then(Xe=>{Jr(ke,W.current)&&B(_t=>new Map(_t).set(De,Xe))}).catch(()=>{})},[e,t,y,w,n,l]),$e=H.toLowerCase(),je=g.useMemo(()=>d?GO(d.entries,0,i,w,x,C,$e,J,new Set,$):[],[d,i,w,x,C,$e,J,$]),St=!J&&d!==null&&d.entries.length>0&&je.length===0&&!H,Re=je.length>_Q,ze=Re?Math.max(0,Math.floor(M/wc)-a5):0,lt=Re?Math.min(je.length,Math.ceil((M+Y)/wc)+a5):je.length,kt=je.slice(ze,lt),mt=je.length*wc,Ct=ze*wc,dt=i&&je.some(ke=>ke.entry.relativePath===i)?i:null,gt=N&&je.some(ke=>ke.entry.relativePath===N)?N:dt??je[0]?.entry.relativePath??null,at=kt.some(ke=>ke.entry.relativePath===gt)?gt:kt[0]?.entry.relativePath??null;g.useEffect(()=>{at!==N&&I(at)},[N,at]),g.useLayoutEffect(()=>{const ke=L.current;ke===null||ke!==at||(L.current=null,E.current.get(ke)?.focus())},[at,kt]),g.useLayoutEffect(()=>{if(!s||s.requestId<=R.current)return;const ke=je.findIndex(Xe=>Xe.entry.relativePath===s.relativePath);if(ke<0)return;if(I(s.relativePath),Re&&(ke<ze||ke>=lt)){const Xe=Math.max(0,ke*wc);D.current&&(D.current.scrollTop=Xe),V(Xe);return}const De=E.current.get(s.relativePath);De&&(De.scrollIntoView({block:"nearest"}),R.current=s.requestId)},[lt,je,s,Re,ze,kt]);const Pt=ke=>{const De=je[ke];if(!De)return;const Xe=De.entry.relativePath;if(Xe===at){L.current=null,E.current.get(Xe)?.focus();return}if(L.current=Xe,I(Xe),Re&&(ke<ze||ke>=lt)){const _t=Math.max(0,ke*wc);D.current&&(D.current.scrollTop=_t),V(_t)}},Ut=(ke,De)=>{const Xe=je.findIndex(ht=>ht.entry.relativePath===ke.entry.relativePath);if(Xe<0)return;const _t=wQ(je,Xe,De.key);if(_t.kind==="none"){(De.key==="ArrowRight"||De.key==="ArrowLeft")&&De.preventDefault();return}if(De.preventDefault(),_t.kind==="focus"){Pt(_t.index);return}if(_t.kind==="expand"){$e?j(ht=>{const nt=new Set(ht);return nt.delete(ke.entry.relativePath),nt}):Z(ke.entry);return}if(_t.kind==="collapse"){ke.entry.kind==="dir"&&($e?j(ht=>new Set(ht).add(ke.entry.relativePath)):S(ht=>{const nt=new Set(ht);return nt.delete(ke.entry.relativePath),nt}));return}tt(ke)},tt=ke=>{if(ke.entry.kind!=="dir"){o(ke.entry);return}if(!$e){Z(ke.entry);return}j(De=>{const Xe=new Set(De);return ke.isExpanded?Xe.add(ke.entry.relativePath):Xe.delete(ke.entry.relativePath),Xe})},cn=ke=>{I(ke.entry.relativePath),tt(ke)};return n?p&&!d?c.jsx("div",{className:"fexp-tree-error",children:p}):d?c.jsxs("div",{className:"fexp-tree-container",children:[c.jsxs("div",{className:"fexp-filter",children:[c.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:l("fileExplorer.filter.placeholder"),value:H,onChange:ke=>{T(ke.target.value),j(new Set)},"aria-label":l("fileExplorer.filter.aria")}),H&&c.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>{T(""),j(new Set)},"aria-label":l("fileExplorer.filter.clear"),children:"✕"}),c.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:pe,"aria-label":l("fileExplorer.tree.refresh"),title:l("fileExplorer.tree.refresh"),children:"↻"}),c.jsx("button",{type:"button",className:`fexp-hidden-toggle${J?" is-active":""}`,onClick:Se,"aria-pressed":J,"aria-label":l(J?"fileExplorer.tree.hideHidden":"fileExplorer.tree.showHidden"),title:l(J?"fileExplorer.tree.hideHidden":"fileExplorer.tree.showHidden"),children:J?c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[c.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),c.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),c.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),c.jsxs("div",{ref:D,className:"fexp-tree",role:"tree","aria-label":l("fileExplorer.tree.aria"),onScroll:Re?se:void 0,children:[!1,Re?c.jsx("div",{style:{height:mt,position:"relative"},children:c.jsx("div",{style:{transform:`translateY(${Ct}px)`},children:kt.map(ke=>c.jsx(l5,{row:ke,cursor:ke.entry.relativePath===at,rowRefs:E,onEntryClick:cn,onKeyDown:Ut},ke.entry.relativePath))})}):kt.map(ke=>c.jsx(l5,{row:ke,cursor:ke.entry.relativePath===at,rowRefs:E,onEntryClick:cn,onKeyDown:Ut},ke.entry.relativePath)),je.length===0&&H&&c.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.noMatchingItems")}),je.length===0&&!H&&d.entries.length===0&&c.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.emptyFolder")}),St&&c.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.onlyHiddenItems")})]})]}):c.jsx("div",{className:"fexp-tree-loading",children:l("fileExplorer.status.loading")}):c.jsx("div",{className:"fexp-tree-empty",children:l("fileExplorer.status.selectTheater")})}function KO(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),KO(l.entries,t,n,i,d))return!0}}}return!1}function xQ(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function l5({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,_=g.useCallback(()=>i(e),[i,e]);return c.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:_,onKeyDown:w=>s(e,w),children:[c.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:m?c.jsx(yQ,{name:o.name,open:f}):c.jsx(gQ,{name:o.name})}),c.jsx("span",{className:"fexp-tree-name",children:o.name}),p&&c.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function kQ(){try{return localStorage.getItem(L1)==="1"}catch{return!1}}function CQ(e){try{localStorage.setItem(L1,e?"1":"0")}catch{}}function EQ({name:e,sizeHint:t,t:n}){return c.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[c.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),c.jsx("p",{className:"fexp-bin-name",children:e}),t&&c.jsx("p",{className:"fexp-bin-meta",children:t}),c.jsx("p",{className:"fexp-bin-hint",children:n("fileExplorer.viewer.binaryHint")})]})}function AQ(e,t){switch(t){case"typescript":case"javascript":return RQ(e);case"json":return MQ(e);case"python":return LQ(e);case"css":case"scss":case"sass":case"less":return OQ(e);case"html":case"xml":return IQ(e);case"bash":case"shell":return jQ(e);case"yaml":return DQ(e);default:return[{kind:"text",value:e}]}}const TQ=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 RQ(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}=Po(e,n,"`","`");t.push({kind:"str",value:i}),n+=s;continue}if(e[n]==='"'||e[n]==="'"){const{slice:i,length:s}=Po(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*\(/);TQ.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 MQ(e){const t=[];let n=0;for(;n<e.length;){if(e[n]==='"'){const{slice:i,length:s}=Po(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 NQ=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 LQ(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}=Po(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*\(/);NQ.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 OQ(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}=Po(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 IQ(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}=Po(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 jQ(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}=Po(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 DQ(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}=Po(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 Po(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 BQ({content:e,lang:t,truncated:n,t:i}){const s=g.useMemo(()=>PQ(e,t),[e,t]);return c.jsxs("div",{className:"fexp-code-wrap",children:[n&&c.jsx("div",{className:"fexp-truncated-badge",children:i("fileExplorer.viewer.truncated")}),c.jsx("div",{className:"fexp-code-scroll",children:c.jsx("table",{className:"fexp-code-table","aria-label":i("fileExplorer.viewer.fileContentsAria"),children:c.jsx("tbody",{children:s.map((o,l)=>c.jsxs("tr",{className:"fexp-code-row",children:[c.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:l+1}),c.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:o}})]},l))})})})]})}function PQ(e,t){return e.split(`
229
+ `).map(i=>$Q(i,t))}function $Q(e,t){return t==="plaintext"||t==="markdown"?c5(e)||" ":AQ(e,t).map(i=>{const s=c5(i.value);return i.kind==="text"?s:`<span class="syn-${i.kind}">${s}</span>`}).join("")||" "}function c5(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function zQ({src:e,name:t}){return c.jsxs("div",{className:"fexp-img-wrap",children:[c.jsx("div",{className:"fexp-img-stage",children:c.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),c.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}const FQ=new Set([".png",".jpg",".jpeg",".webp",".gif"]),HQ=new Set(["img.shields.io"]),UQ=/^[a-z][a-z0-9+.-]*:/i;function u5(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||UQ.test(n))return null;const i=VO(n);if(!i)return null;const s=GQ(i);return s===null?null:KQ(s,t)}function WQ(e){const t=VO(e).toLowerCase();return[...FQ].some(n=>t.endsWith(n))}function d5(e,t){return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`}function qQ(e){try{const t=new URL(e);return t.protocol==="https:"&&HQ.has(t.hostname)}catch{return!1}}function VO(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function GQ(e){try{return decodeURI(e)}catch{return null}}function KQ(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 VQ({content:e,onOpenPath:t,relativePath:n,theaterId:i,truncated:s,language:o}){const l=N1(o),d=g.useMemo(()=>{const w=us(e,uQ(l)).html,S=new DOMParser().parseFromString(w,"text/html");return P_(S.body,{allowLocalImageMarkers:!1,currentRelativePath:n,theaterId:i,t:l}),S.body.innerHTML},[e,n,i,l]),f=g.useRef(null);g.useEffect(()=>{const w=f.current;if(!w)return;vh(w,dQ(l)),P_(w,{allowLocalImageMarkers:!0,currentRelativePath:n,theaterId:i,t:l});const S=new MutationObserver(()=>P_(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=g.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=g.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=g.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]),_=g.useCallback(w=>{p(w),m(w)},[p,m]);return c.jsxs("div",{className:"fexp-md-wrap",children:[s&&c.jsx("div",{className:"fexp-truncated-badge",children:l("fileExplorer.viewer.truncated")}),c.jsx("div",{ref:f,className:"markdown-body",onClick:_,onKeyDown:y,dangerouslySetInnerHTML:{__html:d}})]})}function P_(e,t){for(const n of e.querySelectorAll("a[href]")){const i=n.getAttribute("href")??"",s=u5(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===d5(t.theaterId,s)){n.removeAttribute("srcset");continue}if(n.removeAttribute("data-fexp-local-image-path"),n.tagName==="IMG"&&qQ(i)){n.removeAttribute("srcset"),n.removeAttribute("aria-hidden");continue}const o=u5(i,t.currentRelativePath);if(n.removeAttribute("srcset"),n.tagName==="IMG"&&t.theaterId&&o&&WQ(o)){n.setAttribute("src",d5(t.theaterId,o)),n.setAttribute("data-fexp-local-image-path",o),n.removeAttribute("aria-hidden");continue}n.removeAttribute("src"),n.tagName==="IMG"&&YQ(n,t.t)}}function YQ(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 XQ=360,O1=248,I1=200,zm=160,Fm=4;function ZQ(e){return e-I1-Fm>=zm}function JQ(e,t,n){const i=n-I1-Fm;return i<zm?e:Math.max(zm,Math.min(i,e-t))}function QQ(e){const t=I1+Fm;return`minmax(0, 1fr) ${Fm}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function eee(e){return e?XQ:null}const YO="fleet-console.file-explorer.treePaneWidth",j1={selectedPath:null,viewState:{kind:"none"}},tee={...j1,treePaneWidth:O1},XO=new Map,h5=new Map,p0=new Set;let Hm=aee();function nee(e){return g.useSyncExternalStore(see,()=>ree(e),()=>tee)}function f5(e,t){e&&QO(e,{selectedPath:t})}function yo(e,t){e&&QO(e,{viewState:t})}function iee(e){Hm=eI(e);try{localStorage.setItem(YO,String(Hm))}catch{}ZO()}function ZO(){for(const e of p0)e()}function JO(e){return XO.get(e)??j1}function ree(e){const t=e??"__none__",n=e!=null?JO(e):j1,i=h5.get(t);if(i&&i.selectedPath===n.selectedPath&&i.viewState===n.viewState&&i.treePaneWidth===Hm)return i;const s={...n,treePaneWidth:Hm};return h5.set(t,s),s}function QO(e,t){XO.set(e,{...JO(e),...t}),ZO()}function see(e){return p0.add(e),()=>{p0.delete(e)}}function aee(){try{return eI(Number(localStorage.getItem(YO)))}catch{return O1}}function eI(e){return!Number.isFinite(e)||e<=0?O1:Math.max(zm,Math.round(e))}const m0=new Set;let oee=0,Um=null;function lee(e,t){Um={theaterId:e,relativePath:t,requestId:++oee},tI()}function cee(e){Um?.requestId===e.requestId&&(Um=null,tI())}function uee(){return g.useSyncExternalStore(dee,p5,p5)}function dee(e){return m0.add(e),()=>{m0.delete(e)}}function p5(){return Um}function tI(){for(const e of m0)e()}const hee=new Set([".png",".jpg",".jpeg",".webp",".gif"]),fee={id:"file-explorer",title:e=>N1(e)("fileExplorer.panel.title"),defaultWidth:360,icon:gee,render:e=>c.jsx(mee,{...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:()=>lee(t,l.relativePath)}))}};function pee(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 mee(e){const{theaterId:t}=e,n=N1(e.language),i=t??"",{selectedPath:s,viewState:o,treePaneWidth:l}=nee(i),d=g.useRef(l);d.current=l;const f=g.useRef(null),[p,m]=g.useState(!1),[y,_]=g.useState(null),w=uee(),S=g.useMemo(()=>pee(t),[t]),x=g.useCallback(async(T,$)=>{if(!t){yo(t,{kind:"error",message:$m("no_theater",n)});return}f5(i,T);const j=$??T.split("/").filter(Boolean).at(-1)??T,M=j.slice(j.lastIndexOf(".")).toLowerCase();if(hee.has(M)){const V=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(T)}`:"";yo(i,{kind:"image",relativePath:T,name:j,src:V});return}yo(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 te=await V.json();throw new Error(te.error??"read_failed")}const Y=await V.json();if(Y.binary){yo(i,{kind:"binary",name:j});return}yo(i,{kind:"code",relativePath:Y.relativePath,content:Y.content,lang:Y.lang,truncated:Y.truncated})}catch(V){const Y=V instanceof Error?V.message:"Unable to load file";Y==="binary_file"?yo(i,{kind:"binary",name:j}):yo(i,{kind:"error",message:$m(Y,n)})}},[i,n,t]);g.useLayoutEffect(()=>{!w||w.theaterId!==t||(_(w),x(w.relativePath),cee(w))},[x,w,t]);const k=g.useCallback(async T=>{T.kind==="file"&&await x(T.relativePath,T.name)},[x]),C=g.useCallback(()=>{yo(i,{kind:"none"}),f5(i,null)},[i]),B=g.useCallback(T=>{T.preventDefault();const $=f.current;if(!$)return;const j=$.getBoundingClientRect().width;if(!ZQ(j))return;const M=T.clientX,V=d.current;m(!0);const Y=J=>{const P=J.clientX-M,N=JQ(V,P,j);d.current=N,iee(N)},te=()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",te),m(!1)};document.addEventListener("pointermove",Y),document.addEventListener("pointerup",te)},[]),H=o.kind!=="none";return g.useLayoutEffect(()=>{e.requestExtraWidth?.(eee(H))},[e,H]),c.jsxs("div",{ref:f,className:`fexp-root${H?" is-split":" is-tree-only"}${p?" is-dragging":""}`,style:H?{gridTemplateColumns:QQ(l)}:void 0,children:[H&&c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"fexp-viewer-pane",children:[c.jsxs("div",{className:"fexp-viewer-head",children:[c.jsx("span",{className:"fexp-viewer-filename",children:o.kind!=="loading"&&o.kind!=="error"?"relativePath"in o?o.relativePath:o.name:""}),c.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:C,"aria-label":n("fileExplorer.viewer.close"),children:"✕"})]}),c.jsxs("div",{className:"fexp-viewer-body",children:[o.kind==="loading"&&c.jsx("div",{className:"fexp-viewer-loading",children:n("fileExplorer.status.loading")}),o.kind==="error"&&c.jsx("div",{className:"fexp-viewer-error",children:o.message}),o.kind==="code"&&o.lang==="markdown"&&c.jsx(VQ,{content:o.content,onOpenPath:x,relativePath:o.relativePath,theaterId:t,truncated:o.truncated,language:e.language}),o.kind==="code"&&o.lang!=="markdown"&&c.jsx(BQ,{content:o.content,lang:o.lang,truncated:o.truncated,t:n}),o.kind==="image"&&c.jsx(zQ,{src:o.src,name:o.name}),o.kind==="binary"&&c.jsx(EQ,{name:o.name,t:n})]})]}),c.jsx("div",{className:"fexp-divider",onPointerDown:B,"aria-hidden":"true"})]}),c.jsx("div",{className:"fexp-tree-pane",children:c.jsx(SQ,{files:S,theaterId:t,contextKey:i,selectedPath:s,revealTarget:y,onSelect:k,t:n},i)})]})}function gee(){return c.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const yee={id:"file-explorer",railPanels:[fee]},vee=[yee],_ee={M:"M",A:"A",D:"D",R:"R",T:"T",U:"U"};function bee(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 nI({files:e,selectedPath:t,onSelect:n}){const i=bee(e);return c.jsx(iI,{node:i,depth:0,selectedPath:t,onSelect:n})}function iI({node:e,depth:t,selectedPath:n,onSelect:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([s,o])=>c.jsx(wee,{dirKey:s,node:o,depth:t,selectedPath:n,onSelect:i},s)),e.files.map(s=>c.jsx(See,{entry:s,depth:t,selectedPath:n,onSelect:i},s.path))]})}function wee({dirKey:e,node:t,depth:n,selectedPath:i,onSelect:s}){const[o,l]=g.useState(!1),d=g.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 c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`},onClick:d,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-folder-name",children:f})]}),!o&&c.jsx(iI,{node:p,depth:n+1,selectedPath:i,onSelect:s})]})}function See({entry:e,depth:t,selectedPath:n,onSelect:i}){const s=e.path===n,o=g.useCallback(()=>i(e),[e,i]),l=t*16+12,d=e.path.split("/").pop()??e.path;return c.jsxs("button",{type:"button",className:`repository-file-row${s?" is-cur":""}`,style:{paddingLeft:`${l}px`},title:e.path,onClick:o,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:_ee[e.status]??e.status}),c.jsx("span",{className:"repository-file-name",children:c.jsx("span",{className:"repository-file-fn",children:d})}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const m5="fleet-console.diff.changesCollapsed",xee={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 kee(e,t){const n=t.toLowerCase();return n?e.filter(i=>i.path.toLowerCase().includes(n)):e}function Cee(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function rI({state:e,onRetry:t,viewMode:n,selectedPath:i,onSelect:s,filterText:o,t:l}){const[d,f]=g.useState(()=>Cee(m5)),p=g.useCallback(()=>{f(_=>{const w=!_;try{localStorage.setItem(m5,w?"1":"0")}catch{}return w})},[]),m=g.useMemo(()=>e.kind==="ok"?kee(e.files,o):[],[o,e]);if(e.kind==="loading")return c.jsx("div",{className:"repository-sections-loading",children:l("repository.common.loading")});if(e.kind==="notice"){const _=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 c.jsxs("div",{className:"repository-sections-notice",children:[c.jsx("strong",{className:"repository-notice-title",children:_}),c.jsx("span",{className:"repository-notice-body",children:w}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:l("repository.common.retry")})]})}if(e.kind==="error")return c.jsxs("div",{className:"repository-sections-error",children:[c.jsx("span",{children:e.message}),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:t,children:l("repository.common.retry")})]});const y=o?`${m.length}/${e.files.length}`:String(e.files.length);return c.jsx("div",{className:"repository-sections",children:c.jsxs("div",{className:`repository-section${d?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-section-head",onClick:p,children:[c.jsx("svg",{className:"repository-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-section-name",children:l("repository.changes.section")}),c.jsx("span",{className:"repository-count-badge",children:y})]}),!d&&c.jsx("div",{className:"repository-section-rows",children:m.length===0?c.jsx("div",{className:"repository-empty-row",children:l(o?"repository.common.noMatchingItems":"repository.changes.empty")}):n==="tree"?c.jsx(nI,{files:m,selectedPath:i,onSelect:s}):m.map(_=>c.jsx(sI,{entry:_,isSelected:_.path===i,onSelect:s,t:l},_.path))})]})})}function sI({entry:e,isSelected:t,onSelect:n,t:i}){const s=g.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=xee[e.status];return c.jsxs("button",{type:"button",className:`repository-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[c.jsx("span",{className:`repository-status-glyph repository-status-${e.status.toLowerCase()}`,"aria-label":p?i(p):e.status,children:e.status}),c.jsxs("span",{className:"repository-file-name",children:[c.jsx("span",{className:"repository-file-fn",children:f}),d&&c.jsx("span",{className:"repository-file-dir",children:d})]}),c.jsxs("span",{className:"repository-nums",children:[e.additions>0&&c.jsxs("span",{className:"repository-additions",children:["+",e.additions]}),e.deletions>0&&c.jsxs("span",{className:"repository-deletions",children:["−",e.deletions]})]})]})}const Eee={"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"},Aee={"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가 잘림"},g5={en:Eee,ko:Aee},Tee={en:qs(g5,"en"),ko:qs(g5,"ko")};function $o(e){return Tee[e??"en"]}function Ree(e){return(e??"en")==="ko"?"ko-KR":"en-US"}const Mee=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 Nee(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+=Mee.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 Lee=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,Oee=/^diff --git a\/(.+) b\/(.+)$/;function Iee(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=Oee.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=Lee.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 yp(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wm({ctx:e,repoRel:t,file:n,mode:i,commit:s,compare:o}){const l=$o(e.language),[d,f]=g.useState({kind:"loading"});if(g.useEffect(()=>{if(!e.theaterId){f({kind:"error",message:"no_theater"});return}let _=!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();_||f({kind:"ok",result:S})}).catch(w=>{_||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();_||f({kind:"ok",result:S})}).catch(w=>{_||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();_||f({kind:"ok",result:S})}).catch(w=>{_||f({kind:"error",message:w instanceof Error?w.message:"unknown"})}),()=>{_=!0}},[e.api,e.theaterId,n.oldPath,n.path,i,s,o,t]),d.kind==="loading")return c.jsx("div",{className:"repository-hunk-loading",children:l("repository.common.loading")});if(d.kind==="error")return c.jsx("div",{className:"repository-hunk-error",children:d.message});const{result:p}=d,y=Iee(p.content).filter(_=>_.kind!=="file-label");return c.jsxs("div",{className:"repository-hunk-wrap",children:[p.truncated&&c.jsx("div",{className:"repository-truncated-badge",children:l("repository.hunk.diffTruncated")}),c.jsx("div",{className:"repository-hunk-scroll",children:c.jsx("table",{className:"repository-hunk-table",cellSpacing:0,cellPadding:0,children:c.jsx("tbody",{children:y.map((_,w)=>c.jsx("tr",{className:`repository-line repository-line-${_.kind}`,children:_.kind==="hunk-label"?c.jsx("td",{colSpan:4,className:"repository-line-label",dangerouslySetInnerHTML:{__html:yp(_.text)}}):_.kind==="meta"?c.jsx("td",{colSpan:4,className:"repository-line-meta",dangerouslySetInnerHTML:{__html:yp(_.text)}}):_.kind==="file-label"?c.jsx("td",{colSpan:4,className:"repository-line-file-label",dangerouslySetInnerHTML:{__html:yp(_.text)}}):c.jsxs(c.Fragment,{children:[c.jsx("td",{className:"repository-gutter repository-gutter-old",children:_.oldLine??""}),c.jsx("td",{className:"repository-gutter repository-gutter-new",children:_.newLine??""}),c.jsx("td",{className:"repository-marker",children:_.kind==="add"?"+":_.kind==="del"?"−":""}),c.jsx("td",{className:"repository-line-code",dangerouslySetInnerHTML:{__html:Nee(yp(_.text.length>0?_.text.slice(1):_.text))}})]})},w))})})})]})}const D1=140,aI=120,oI=160,Qs=4,lI=null;function cI({startWidth:e,dx:t,containerWidth:n,listPaneMinWidth:i,hunkPaneMinWidth:s,dividerWidth:o}){const l=n-s-o;return l<i?lI:Math.max(i,Math.min(l,e-t))}function uI(e){const t=D1+Qs;return`minmax(0, 1fr) ${Qs}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function jee(e){const t=oI+Qs;return`minmax(0, min(${e}px, calc(100% - ${t}px))) ${Qs}px minmax(0, 1fr)`}function dI(e,t,n,i,s,o=Qs){const l=n-s-o;return l<i?lI:Math.max(i,Math.min(l,e+t))}function Dee(e){return`minmax(120px, min(${e}px, calc(100% - 124px))) ${Qs}px minmax(120px, 1fr)`}function Bee(e){return`minmax(120px, min(${e}px, calc(100% - 144px))) ${Qs}px minmax(140px, 1fr)`}function B1({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 Pee="fleet-console.repository.compare.",$ee=248,zee=220;function hI(e,t){return`${Pee}${e}.${t}`}function Fee(e,t){try{const n=localStorage.getItem(hI(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 Hee(e,t,n,i){try{localStorage.setItem(hI(e,t),JSON.stringify({base:n,head:i}))}catch{}}function Uee({ctx:e,repoRel:t,refs:n,refsError:i=!1,onRetryRefs:s,onFileOpenChange:o}){const l=$o(e.language),[d,f]=g.useState(""),[p,m]=g.useState(""),[y,_]=g.useState({kind:"idle"}),[w,S]=g.useState(null),[x,k]=g.useState($ee),[C,B]=g.useState(!1),H=g.useRef(x),T=g.useRef(null),$=g.useRef(null),j=g.useRef(!1),M=g.useRef(0),V=g.useMemo(()=>n.remotes.filter(W=>!z1(W.ref)),[n.remotes]),Y=n.branches.find(W=>W.current)??null,te=Y===null,J=g.useCallback(W=>W==="HEAD"?te:n.branches.some(K=>K.ref===W)||V.some(K=>K.ref===W)||n.tags.some(K=>K.ref===W),[n.branches,n.tags,V,te]);g.useEffect(()=>{const W=n.branches.length>0||V.length>0||n.tags.length>0,K=Y?.ref??"HEAD";if(!j.current){if(!W||!e.theaterId)return;j.current=!0;const z=Fee(e.theaterId,t);f(z&&J(z.base)?z.base:""),m(z&&J(z.head)?z.head:K);return}f(z=>z&&!J(z)?"":z),m(z=>z&&!J(z)?K:z)},[e.theaterId,Y,J,n.branches.length,n.tags.length,V.length,t]),g.useEffect(()=>{o?.(w!==null)},[o,w]),g.useEffect(()=>()=>$.current?.(),[]);const P=g.useCallback((W,K)=>{const z=W==="base"?K:d,G=W==="head"?K:p;W==="base"?f(K):m(K),e.theaterId&&Hee(e.theaterId,t,z,G)},[d,e.theaterId,p,t]),N=g.useCallback(()=>{if(!e.theaterId||!d||!p||d===p)return;const W=++M.current;S(null),_({kind:"loading"}),fetch("/plugins/repository/compare",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:t,base:d,head:p})}).then(async K=>{if(W!==M.current)return;if(!K.ok){const G=await K.json();if(W!==M.current)return;const Z=G.error??"git_failed";_(Z==="no_git_repo"||Z==="git_unavailable"?{kind:"notice",reason:Z}:{kind:"error",message:Z});return}const z=await K.json();W===M.current&&_({kind:"ok",base:d,head:p,files:z.files,...z.mergeBase?{mergeBase:z.mergeBase}:{},...z.truncated?{truncated:!0}:{}})}).catch(K=>{W===M.current&&_({kind:"error",message:K instanceof Error?K.message:"unknown"})})},[d,e.theaterId,p,t]),I=g.useCallback(W=>{W.preventDefault();const K=T.current;if(!K)return;const z=K.getBoundingClientRect().width,G=W.clientX,Z=H.current;$.current?.(),B(!0),$.current=B1({documentTarget:document,windowTarget:window,onMove:se=>{const pe=cI({startWidth:Z,dx:se.clientX-G,containerWidth:z,listPaneMinWidth:zee,hunkPaneMinWidth:D1,dividerWidth:Qs});pe!==null&&(H.current=pe,k(pe))},onFinish:()=>{B(!1),$.current=null}})},[]),D=g.useMemo(()=>{const W=[];te&&W.push({value:"HEAD",label:"HEAD"});for(const K of n.branches)W.push({value:K.ref,label:l("repository.compare.optionLocal",{label:K.label})});for(const K of V)W.push({value:K.ref,label:l("repository.compare.optionRemotes",{label:K.label})});for(const K of n.tags)W.push({value:K.ref,label:l("repository.compare.optionTags",{label:K.label})});return W},[n.branches,n.tags,V,te,l]),E=g.useMemo(()=>[{value:"",label:l("repository.compare.selectBase"),disabled:!0},...D],[D,l]),L=(W,K)=>c.jsx(qi,{label:l(W==="base"?"repository.compare.baseRef":"repository.compare.headRef"),value:K,options:W==="base"?E:D,onChange:z=>P(W,z)}),R=d!==""&&p!==""&&d!==p,q=y.kind==="ok"?y.base:null,U=y.kind==="ok"?y.head:null,O=g.useMemo(()=>q&&U&&e.theaterId?{base:q,head:U,theaterId:e.theaterId,repoRel:t}:null,[q,U,e.theaterId,t]);return c.jsxs("div",{className:"repository-compare",children:[i?c.jsxs("div",{className:"history-error",children:[l("repository.discovery.loadRefsFailed"),c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:s,children:l("repository.common.retry")})]}):c.jsxs("div",{className:"repository-compare-controls",children:[L("base",d),c.jsx("span",{className:"repository-compare-arrow","aria-hidden":"true",children:"…"}),L("head",p),c.jsx("button",{type:"button",className:"repository-refresh-btn repository-compare-run",disabled:!R,onClick:N,children:l("repository.compare.run")})]}),c.jsxs("div",{ref:T,className:`repository-root${w?" has-hunk":""}${C?" is-dragging":""}`,style:w?{gridTemplateColumns:uI(x)}:void 0,children:[w&&O?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:w.path}),c.jsx("button",{type:"button",onClick:()=>S(null),children:"✕"})]}),c.jsx(Wm,{ctx:e,repoRel:t,file:w,mode:"unified",compare:O})]}):null,w?c.jsx("div",{className:"repository-divider",onPointerDown:I,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane repository-compare-results",children:[y.kind==="idle"&&c.jsx("div",{className:"history-empty",children:l("repository.compare.idle")}),y.kind==="loading"&&c.jsx("div",{className:"history-empty",children:l("repository.compare.comparing")}),y.kind==="ok"&&y.files.length===0&&c.jsx("div",{className:"history-empty",children:l("repository.compare.noDifferences")}),y.kind==="error"&&y.message==="no_merge_base"&&c.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)&&c.jsxs(c.Fragment,{children:[y.kind==="ok"&&y.mergeBase&&c.jsxs("div",{className:"repository-compare-meta",children:[l("repository.compare.mergeBase")," ",c.jsx("span",{children:y.mergeBase})]}),c.jsx(rI,{state:y.kind==="ok"?{kind:"ok",files:y.files}:y,onRetry:N,viewMode:"list",selectedPath:w?.path??null,onSelect:S,filterText:"",t:l}),y.kind==="ok"&&y.truncated&&c.jsx("div",{className:"history-truncated",children:l("repository.compare.capped")})]})]})]})]})}function y5(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 fI(){return Object.create(null)}function v5(){return{dirs:fI(),repos:[]}}function Wee(e){const t=v5();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]=v5()),s=s.dirs[o];s.repos.push(n)}return pI(t),t}function pI(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=fI();for(const[n,i]of t)pI(i),e.dirs[n]=i}function qee(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 mI(e){let t=e.repos.length;for(const n of Object.values(e.dirs))t+=mI(n);return t}const g0=new Set;let P1={file:null};function gI(){for(const e of g0)e()}function Gee(e){return g0.add(e),()=>{g0.delete(e)}}function _5(){return P1}function Kee(e,t){const n=g.useSyncExternalStore(Gee,_5,_5);return!n.file||n.file.theaterId!==e||n.file.repoRel!==t?null:n.file}function Vee(e,t,n){P1={file:{entry:e,theaterId:t,repoRel:n}},gI()}function $_(){P1={file:null},gI()}const y0=12,Sc=28,z_=3,Yee=5,b5=["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 Rd(e){return e*y0+6}function dl(e){return b5[e%b5.length]??"var(--ink-fog)"}function Xee({node:e}){const t=Math.max(e.activeLaneCount,1),n=e.collapsed?10:0,i=t*y0+n,s=Rd(e.lane),o=Sc/2;return c.jsxs("svg",{width:i,height:Sc,viewBox:`0 0 ${i} ${Sc}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(l=>c.jsx("line",{x1:Rd(l),y1:0,x2:Rd(l),y2:Sc,stroke:dl(l),strokeWidth:1.5},`pt-${l}`)),e.connectAbove&&c.jsx("line",{x1:s,y1:0,x2:s,y2:o-z_,stroke:dl(e.lane),strokeWidth:1.5}),e.connectBelow&&c.jsx("line",{x1:s,y1:o+z_,x2:s,y2:Sc,stroke:dl(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(l=>c.jsx("line",{x1:Rd(l),y1:0,x2:s,y2:o,stroke:dl(l),strokeWidth:1.5,strokeLinecap:"round"},`mf-${l}`)),e.branchToLanes.map(l=>c.jsx("line",{x1:s,y1:o,x2:Rd(l),y2:Sc,stroke:dl(l),strokeWidth:1.5,strokeLinecap:"round"},`bt-${l}`)),e.isHead&&c.jsx("circle",{cx:s,cy:o,r:Yee,fill:"none",stroke:dl(e.lane),strokeWidth:1.5}),c.jsx("circle",{cx:s,cy:o,r:z_,fill:dl(e.lane)}),e.collapsed&&c.jsx("text",{x:t*y0+2,y:o+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const F_=8;function Zee(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=new Set(e.map(l=>l.fullHash)),n=[],i=[];let s=!1,o=0;for(let l=0;l<e.length;l++){const d=e[l],f=d.fullHash,p=[...d.parents],m=[];for(let C=0;C<n.length;C++)n[C]===f&&m.push(C);let y,_=!1;const w=[];if(m.length===0){const C=n.findIndex(B=>B!==null&&!t.has(B));if(C>=0)y=C;else{const B=n.indexOf(null);B>=0?y=B:n.length<F_?(y=n.length,n.push(null)):(s=!0,y=F_-1,n[y]=null,_=!0)}}else{y=Math.min(...m);for(const C of m)C!==y&&(w.push(C),n[C]=null)}const S=[];if(p.length===0)n[y]=null;else{n[y]=_?null:p[0]??null;for(const C of p.slice(1))if(!(n.indexOf(C)>=0)){const H=n.indexOf(null);if(H>=0)n[H]=C,S.push(H);else if(n.length<F_){const T=n.length;n.push(C),S.push(T)}else s=!0}}const x=n.map((C,B)=>({h:C,i:B})).filter(({h:C,i:B})=>C!==null&&t.has(C)&&B!==y).map(({i:C})=>C),k=Math.max(y,...x,...w,...S);o=Math.max(o,k),i.push({lane:y,activeLaneCount:k+1,collapsed:s,isHead:d.refs.some(C=>C==="HEAD"||C.startsWith("HEAD ->")),connectAbove:m.length>0,connectBelow:p.length>0&&n[y]===p[0]&&t.has(p[0]),passThroughLanes:x,mergeFromLanes:w,branchToLanes:S})}return{nodes:i,activeLaneCount:o+1,collapsed:s}}function yI(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=$o(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 $1(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 Jee=230,wh=160,Qee=222,v0=148,ete=4,tte=180,vI="fleet-console.repository.workspace.dockHeight",_I="fleet-console.repository.workspace.treeWidth",xc={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 nte(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(_I)??"");if(Number.isFinite(t)&&t>=v0)return t}catch{}return Qee}function ite(e,t){try{(t??globalThis.localStorage).setItem(_I,String(e))}catch{}}function rte(e,t,n){const i=n-tte-ete;return i<v0?null:Math.max(v0,Math.min(i,e+t))}function ste(e){try{const t=Number.parseFloat((e??globalThis.localStorage).getItem(vI)??"");if(Number.isFinite(t)&&t>=wh)return t}catch{}return Jee}function ate(e,t){try{(t??globalThis.localStorage).setItem(vI,String(e))}catch{}}function ote(e,t){const n=t-180-4;return n<=wh?Math.max(0,n):Math.max(wh,Math.min(n,e))}function lte(e,t,n){const i=n-180-4;return i<wh?null:Math.max(wh,Math.min(i,e-t))}function cte(e){return`minmax(180px, 1fr) 4px ${e}px`}function ute(e,t){return[{id:"context",label:t(xc.context),count:e.context},{id:"working",label:t(xc.working),count:e.changes},{id:"worktrees",label:t(xc.worktrees),count:e.worktrees},{id:"branches",label:t(xc.branches),count:e.branches},{id:"tags",label:t(xc.tags),count:e.tags},{id:"stashes",label:t(xc.stashes),count:e.stashes}]}const _0=new Set;let dte=0,qm=null;function hte(e,t,n){qm={theaterId:e,repoRel:t,fullHash:n,requestId:++dte},wI()}function fte(e){qm?.requestId===e.requestId&&(qm=null,wI())}function bI(){return g.useSyncExternalStore(pte,w5,w5)}function pte(e){return _0.add(e),()=>{_0.delete(e)}}function w5(){return qm}function wI(){for(const e of _0)e()}const SI="fleet-console.history.logHeight",S5="fleet-console.history.headerHeight",x5="fleet-console.history.fileListWidth",xI="fleet-console.history.filesView",mte=240,gte=214,yte=180;function vte(e,t){return t.find(n=>n.branch===null&&n.sha===e.fullHash)??null}function _te(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))||$1(i).some(s=>s.label.toLowerCase().includes(n))):e}function bte(e){return e==="Escape"}function wte(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 Ste(e,t,n){return e.files>0&&!t&&!n}function k5({current:e}){return e?c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5"})}):c.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none",children:c.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2"})})}function xte({entry:e,checkouts:t,selected:n,graphNode:i,onSelect:s,rowRef:o,locale:l}){const d=$o(l),f=$1(e),p=vte(e,t);return c.jsxs("button",{ref:o,type:"button",className:`history-commit-row${n?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>s(e),children:[c.jsxs("span",{className:"history-commit-badges",children:[f.map(m=>{const y=m.kind==="branch"?t.find(_=>_.branch===m.label):null;return c.jsxs("span",{className:`history-badge history-badge--${m.kind}`,children:[y&&c.jsx(k5,{current:y.isCurrent}),m.label]},`${m.kind}:${m.label}`)}),p&&c.jsxs("span",{className:"history-badge history-badge--worktree",children:[c.jsx(k5,{current:p.isCurrent}),d("repository.history.detached")]})]}),c.jsx("span",{className:"history-commit-subject",title:e.subject,children:e.subject}),c.jsx("span",{className:"history-commit-sha",children:e.shortHash}),c.jsx("span",{className:"history-commit-time",children:yI(e.authorAt,new Date,l)}),c.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:c.jsx(Xee,{node:i})})]})}function kte({ctx:e,repoRel:t,target:n,workspace:i,onSelectCommit:s,onClose:o}){const l=$o(e.language),[d,f]=g.useState({kind:"loading"}),[p,m]=g.useState("details"),[y,_]=g.useState(null),[w,S]=g.useState(!1),[x,k]=g.useState(()=>b0(S5,gte)),[C,B]=g.useState(()=>b0(x5,yte)),[H,T]=g.useState(Tte),$=g.useRef(null),j=g.useRef(null),M=g.useRef(null),V=g.useRef(x),Y=g.useRef(C),te=g.useMemo(()=>({fullHash:n.fullHash,theaterId:e.theaterId??"",repoRel:t}),[n.fullHash,e.theaterId,t]);g.useEffect(()=>{let N=!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 I=>{if(!I.ok)throw new Error((await I.json()).error??"git_failed");return I.json()}).then(I=>{N||(f({kind:"ok",result:I}),_(I.files[0]?.path??null))}).catch(I=>{N||f({kind:"error",message:I instanceof Error?I.message:"unknown"})}),()=>{N=!0}},[e.api,e.theaterId,t,n.fullHash]),g.useEffect(()=>()=>M.current?.(),[]);const J=g.useCallback((N,I)=>{N.preventDefault();const D=I==="y"?$.current:j.current;if(!D)return;const E=I==="y"?V.current:Y.current,L=I==="y"?N.clientY:N.clientX,R=I==="y"?D.getBoundingClientRect().height:D.getBoundingClientRect().width;M.current?.(),M.current=B1({documentTarget:document,windowTarget:window,onMove:q=>{const U=q,O=dI(E,(I==="y"?U.clientY:U.clientX)-L,R,120,120);O!==null&&(I==="y"?(V.current=O,k(O)):(Y.current=O,B(O)))},onFinish:()=>{const q=I==="y"?V.current:Y.current;try{localStorage.setItem(I==="y"?S5:x5,String(q))}catch{}M.current=null}})},[]),P=d.kind==="loading"?c.jsx("div",{className:"history-inspector-empty",children:l("repository.history.loadingCommit")}):d.kind==="error"?c.jsx("div",{className:"history-inspector-empty history-inspector-error",children:d.message}):(()=>{const{meta:N,files:I}=d.result,D=I.find(W=>W.path===y)??I[0]??null,E=I.reduce((W,K)=>W+K.additions,0),L=I.reduce((W,K)=>W+K.deletions,0),R=n.entry,q=(W,K)=>{_(W.path),K&&m("changes")},U=W=>{T(W);try{localStorage.setItem(xI,W)}catch{}},O=()=>{const W=navigator.clipboard?.writeText(n.fullHash);W&&W.then(()=>{S(!0),window.setTimeout(()=>S(!1),1200)}).catch(()=>{})};return i?c.jsxs("div",{className:"repository-ws-dock",children:[c.jsx(H_,{files:I,selectedPath:y,additions:E,deletions:L,viewMode:H,onViewMode:U,onSelect:W=>q(W,!1),t:l}),c.jsxs("div",{className:"repository-ws-dock-main",children:[c.jsxs("div",{className:"repository-ws-dock-meta",children:[c.jsx(C5,{meta:N,entry:R,fullHash:n.fullHash,copied:w,onCopy:O,onParent:W=>s({fullHash:W}),locale:e.language,t:l}),c.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:"✕"})]}),D?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:D.path,children:D.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":l("repository.history.previousFile"),disabled:I.indexOf(D)===0,onClick:()=>q(I[I.indexOf(D)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":l("repository.history.nextFile"),disabled:I.indexOf(D)===I.length-1,onClick:()=>q(I[I.indexOf(D)+1],!1),children:"›"})]})]}),c.jsx(Wm,{ctx:e,repoRel:t,file:D,mode:"unified",commit:te})]}):c.jsx("div",{className:"history-inspector-empty",children:l("repository.history.noChangedFiles")})]})]}):p==="details"?c.jsxs("div",{ref:$,className:"history-details-tab",style:{gridTemplateRows:Dee(x)},children:[c.jsx(C5,{meta:N,entry:R,fullHash:n.fullHash,copied:w,onCopy:O,onParent:W=>s({fullHash:W}),locale:e.language,t:l}),c.jsx("div",{className:"history-divider history-divider--horizontal",onPointerDown:W=>J(W,"y")}),c.jsx(H_,{files:I,selectedPath:y,additions:E,deletions:L,viewMode:H,onViewMode:U,onSelect:W=>q(W,!0),t:l})]}):c.jsx("div",{className:"history-changes-tab",children:c.jsxs("div",{ref:j,className:"history-changes-columns",style:{gridTemplateColumns:Bee(C)},children:[c.jsx(H_,{files:I,selectedPath:y,additions:E,deletions:L,viewMode:H,onViewMode:U,onSelect:W=>q(W,!1),t:l}),c.jsx("div",{className:"history-divider",onPointerDown:W=>J(W,"x")}),D?c.jsxs("div",{className:"history-file-diff",children:[c.jsxs("div",{className:"history-file-repository-head",children:[c.jsx("span",{title:D.path,children:D.path}),c.jsxs("div",{children:[c.jsx("button",{type:"button","aria-label":l("repository.history.previousFile"),disabled:I.indexOf(D)===0,onClick:()=>q(I[I.indexOf(D)-1],!1),children:"‹"}),c.jsx("button",{type:"button","aria-label":l("repository.history.nextFile"),disabled:I.indexOf(D)===I.length-1,onClick:()=>q(I[I.indexOf(D)+1],!1),children:"›"})]})]}),c.jsx(Wm,{ctx:e,repoRel:t,file:D,mode:"unified",commit:te})]}):c.jsx("div",{className:"history-inspector-empty",children:l("repository.history.noChangedFiles")})]})})})();return c.jsx("div",{className:`history-inspector${i?" repository-ws-inspector":""}`,onKeyDown:N=>{bte(N.key)&&(N.preventDefault(),o())},children:i?P:c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"history-segmented",children:[c.jsx("button",{type:"button","aria-pressed":p==="details",onClick:()=>m("details"),children:l("repository.history.details")}),c.jsxs("button",{type:"button","aria-pressed":p==="changes",onClick:()=>m("changes"),children:[l("repository.source.changes")," ",d.kind==="ok"&&c.jsx("span",{children:d.result.files.length})]}),c.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:"✕"})]}),P]})})}function C5({meta:e,entry:t,fullHash:n,copied:i,onCopy:s,onParent:o,locale:l,t:d}){return c.jsxs("div",{className:"history-inspector-head",children:[c.jsx("div",{className:"history-inspector-subject",children:e.subject}),e.body&&c.jsx("pre",{className:"history-inspector-message",children:e.body}),c.jsxs("div",{className:"history-author",children:[c.jsx("span",{className:"history-avatar",children:Rte(e.authorName)}),c.jsxs("span",{children:[c.jsx("b",{children:e.authorName}),c.jsx("small",{children:e.authorEmail})]}),c.jsx("time",{title:new Date(e.authorAt*1e3).toLocaleString(Ree(l)),children:yI(e.authorAt,new Date,l)})]}),c.jsxs("div",{className:"history-inspector-ids",children:[c.jsxs("button",{type:"button",className:`history-sha-copy${i?" is-copied":""}`,onClick:s,children:[n,c.jsx("span",{children:d(i?"repository.history.copied":"repository.history.copy")})]}),e.parents.map(f=>c.jsx("button",{type:"button",className:"history-parent",onClick:()=>o(f.full),children:d("repository.history.parent",{short:f.short})},f.full))]}),t&&c.jsx("div",{className:"history-ref-chips",children:$1(t).map(f=>c.jsx("span",{className:`history-badge history-badge--${f.kind}`,children:f.label},`${f.kind}:${f.label}`))})]})}function H_({files:e,selectedPath:t,additions:n,deletions:i,viewMode:s,onViewMode:o,onSelect:l,t:d}){return c.jsxs("section",{className:"history-commit-files",children:[c.jsxs("div",{className:"history-files-title",children:[c.jsx("span",{className:"history-files-label",children:d("repository.history.changedFiles")}),c.jsxs("span",{className:"history-files-stats",children:[e.length," ",c.jsxs("i",{children:["+",n]})," ",c.jsxs("em",{children:["−",i]})]}),c.jsxs("div",{className:"repository-view-toggle history-files-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${s==="list"?" is-active":""}`,title:d("repository.common.listView"),"aria-label":d("repository.common.listView"),"aria-pressed":s==="list",onClick:()=>o("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${s==="tree"?" is-active":""}`,title:d("repository.common.treeView"),"aria-label":d("repository.common.treeView"),"aria-pressed":s==="tree",onClick:()=>o("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx("div",{className:"history-files-scroll",children:s==="tree"?c.jsx(nI,{files:e,selectedPath:t,onSelect:l}):e.map(f=>c.jsx(sI,{entry:f,isSelected:f.path===t,onSelect:l,t:d},f.path))})]})}function Cte({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 c.jsx(Ete,{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 Ete({ctx:e,repoRel:t,active:n,refFilter:i,wipFiles:s,workspace:o,workspaceMain:l,workspaceMainVisible:d,onInspectorOpenChange:f,onClearRef:p,onWip:m}){const y=$o(e.language),[_,w]=g.useState({kind:"loading"}),[S,x]=g.useState(null),[k,C]=g.useState(""),[B,H]=g.useState(0),[T,$]=g.useState(Ate),[j,M]=g.useState(ste),[V,Y]=g.useState(!1),te=g.useRef(null),J=g.useRef(new Map),P=bI(),N=g.useRef(null),I=g.useRef(T),D=g.useRef(j);g.useEffect(()=>{x(null)},[i]),g.useEffect(()=>{if(!P||P.theaterId!==e.theaterId||P.repoRel!==t||_.kind!=="ok")return;const z=_.commits.find(G=>G.fullHash===P.fullHash);z&&(C(""),x({fullHash:z.fullHash,entry:z}),fte(P))},[e.theaterId,t,P,_]),g.useLayoutEffect(()=>{S&&J.current.get(S.fullHash)?.scrollIntoView({block:"nearest"})},[S]);const[E,L]=g.useState(n);g.useEffect(()=>{n&&L(!0)},[n]),g.useEffect(()=>{if(!E)return;if(!e.theaterId){w({kind:"ok",commits:[],checkouts:[],truncated:!1});return}let z=!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 G=>{if(!G.ok)throw new Error((await G.json()).error??"git_failed");return G.json()}).then(G=>{z||w({kind:"ok",commits:G.commits,checkouts:G.checkouts,truncated:G.truncated??!1})}).catch(G=>{z||w({kind:"error",message:G instanceof Error?G.message:"unknown"})}),()=>{z=!0}},[e.api,e.theaterId,E,B,i,t]),g.useEffect(()=>{f?.(n&&S!==null)},[n,f,S]),g.useEffect(()=>()=>N.current?.(),[]),g.useLayoutEffect(()=>{if(!o||S===null)return;const z=te.current;if(!z)return;const G=()=>{const se=ote(D.current,z.getBoundingClientRect().height);se!==D.current&&(D.current=se,M(se))};G();const Z=new ResizeObserver(G);return Z.observe(z),()=>Z.disconnect()},[o,S]);const R=g.useCallback(z=>{z.preventDefault();const G=te.current;if(!G)return;const Z=o?D.current:I.current,se=z.clientY,Se=G.getBoundingClientRect().height;N.current?.(),Y(!0),N.current=B1({documentTarget:document,windowTarget:window,onMove:pe=>{const $e=pe.clientY-se,je=o?lte(Z,$e,Se):dI(Z,$e,Se,aI,oI,Qs);je!==null&&(o?(D.current=je,M(je)):(I.current=je,$(je)))},onFinish:()=>{if(o)ate(D.current);else try{localStorage.setItem(SI,String(I.current))}catch{}Y(!1),N.current=null}})},[o]),q=g.useMemo(()=>_.kind==="ok"?_te(_.commits,k):[],[k,_]),U=_.kind==="ok"?Zee(q):null,O=g.useMemo(()=>wte(s),[s]),W=Ste(O,k,i),K=S?o?cte(j):jee(T):void 0;return c.jsxs("div",{ref:te,className:`history-root${o?" repository-ws-history":""}${V?" is-dragging":""}`,style:K?{gridTemplateRows:K}:void 0,children:[c.jsxs("div",{className:"history-list-pane",hidden:o&&d,children:[c.jsxs("div",{className:"history-toolbar",children:[c.jsxs("div",{className:"history-filter",children:[c.jsx("input",{className:"history-filter-input",placeholder:y("repository.common.filterPlaceholder"),value:k,onChange:z=>C(z.target.value)}),k&&c.jsx("button",{type:"button",className:"history-filter-clear",onClick:()=>C(""),children:"✕"})]}),i&&c.jsxs("button",{type:"button",className:"repository-ref-chip",onClick:p,children:[i," ✕"]}),_.kind==="ok"&&c.jsx("span",{className:"history-count",children:k?`${q.length}/${_.commits.length}`:_.commits.length})]}),c.jsxs("div",{className:"history-list",children:[W&&c.jsxs("button",{type:"button",className:"repository-wip-row",onClick:m,children:[y("repository.history.uncommitted")," ",c.jsx("span",{children:y(O.files===1?"repository.history.wipStats_one":"repository.history.wipStats_other",{count:O.files,additions:O.additions,deletions:O.deletions})})]}),_.kind==="loading"&&c.jsx("div",{className:"history-empty",children:y("repository.common.loading")}),_.kind==="error"&&c.jsxs("div",{className:"history-error",children:[_.message,c.jsx("button",{type:"button",className:"repository-refresh-btn",onClick:()=>H(z=>z+1),children:y("repository.common.retry")})]}),_.kind==="ok"&&_.commits.length===0&&c.jsx("div",{className:"history-empty",children:y("repository.history.empty")}),_.kind==="ok"&&_.commits.length>0&&q.length===0&&c.jsx("div",{className:"history-empty",children:y("repository.common.noMatchingItems")}),_.kind==="ok"&&U&&q.map((z,G)=>c.jsx(xte,{rowRef:Z=>{Z?J.current.set(z.fullHash,Z):J.current.delete(z.fullHash)},entry:z,checkouts:_.checkouts,selected:S?.fullHash===z.fullHash,graphNode:U.nodes[G],onSelect:Z=>x({fullHash:Z.fullHash,entry:Z}),locale:e.language},z.fullHash)),_.kind==="ok"&&(_.truncated||_.commits.length>=200)&&c.jsx("div",{className:"history-truncated",children:y("repository.history.capped")})]})]}),l!==void 0&&c.jsx("div",{className:"repository-ws-main",hidden:!d,children:l}),S&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"history-divider history-divider--horizontal",role:"separator","aria-orientation":"horizontal","aria-label":y(o?"repository.history.resizeDock":"repository.history.resizeLog"),onPointerDown:R}),c.jsx("div",{className:"history-detail-pane",children:c.jsx(kte,{ctx:e,repoRel:t,target:S,workspace:o,onSelectCommit:x,onClose:()=>x(null)})})]})]})}function Ate(){return b0(SI,mte,aI)}function Tte(){try{const e=localStorage.getItem(xI);if(e==="list"||e==="tree")return e}catch{}return"list"}function b0(e,t,n=0){try{const i=Number.parseFloat(localStorage.getItem(e)??"");if(Number.isFinite(i)&&i>=n)return i}catch{}return t}function Rte(e){return e.split(/[\s@._-]+/).filter(Boolean).slice(0,2).map(t=>t[0].toUpperCase()).join("")||"?"}const kI="fleet-console.diff.viewMode",CI="fleet-console.diff.listPaneWidth",EI="fleet-console.repository.source",Eg="fleet-console.repository.repo.",AI="fleet-console.repository.scanDepth",TI=1,RI=8,Mte=3,Nte=248,MI=220;function Lte(){try{const e=localStorage.getItem(kI);if(e==="list"||e==="tree")return e}catch{}return"list"}function Ote(){try{const e=localStorage.getItem(EI);if(e==="changes"||e==="history"||e==="compare")return e}catch{}return"history"}function NI(e){try{return localStorage.getItem(`${Eg}${e}`)??""}catch{return""}}function Ite(e,t,n){try{const i=`${Eg}${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 jte(){try{const e=Number.parseInt(localStorage.getItem(AI)??"",10);if(Number.isInteger(e)&&e>=TI&&e<=RI)return e}catch{}return Mte}function Dte(e){try{localStorage.setItem(AI,String(e))}catch{}}function Bte(e,t){try{localStorage.setItem(`${Eg}${e}`,t)}catch{}}function Pte(e){try{localStorage.removeItem(`${Eg}${e}`)}catch{}}function $te(e){try{localStorage.setItem(EI,e)}catch{}}function zte(){try{const e=localStorage.getItem(CI),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(MI,t)}catch{}return Nte}function Fte(e){return e.entry.status==="U"?"untracked":"unified"}function Hte({ctx:e}){return c.jsx(qte,{ctx:e},e.theaterId)}function Ute(e,t,n){return!e||n===t?{transition:!1,landing:"history"}:{transition:!0,landing:"history"}}function z1(e){return/^refs\/remotes\/[^/]+\/HEAD$/.test(e)}function Wte(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=>!z1(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 qte({ctx:e}){const t=$o(e.language),[n,i]=g.useState([]),[s,o]=g.useState(!1),[l,d]=g.useState(0),[f,p]=g.useState(!1),[m,y]=g.useState(jte),_=g.useCallback(re=>{y(re),Dte(re)},[]),[w,S]=g.useState(!1),[x,k]=g.useState([]),[C,B]=g.useState(!1),[H,T]=g.useState(0),[$,j]=g.useState(null),[M,V]=g.useState(()=>e.theaterId?NI(e.theaterId):""),Y=g.useRef(M),[te,J]=g.useState(Ote),[P,N]=g.useState(nte),I=g.useRef(P),[D,E]=g.useState(!1),L=g.useRef(null),[R,q]=g.useState(null),[U,O]=g.useState({branches:[],remotes:[],tags:[],stashes:[]}),[W,K]=g.useState(!1),[z,G]=g.useState(0),[Z,se]=g.useState({kind:"loading"}),[Se,pe]=g.useState(0),[$e,je]=g.useState(Lte),[St,Re]=g.useState(""),[ze,lt]=g.useState(0),kt=bI(),mt=Kee(e.theaterId??null,M),[Ct,dt]=g.useState(zte),gt=g.useRef(Ct),at=g.useRef(null),[Pt,Ut]=g.useState(!1),tt=g.useCallback(re=>{J(re),$te(re)},[]),cn=g.useCallback(re=>{re.preventDefault();const ge=L.current;if(!ge)return;const Te=ge.getBoundingClientRect().width,We=re.clientX,ee=I.current;E(!0);const he=Ve=>{const Rt=rte(ee,Ve.clientX-We,Te);Rt!==null&&(I.current=Rt,N(Rt))},Ee=()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",Ee),E(!1),ite(I.current)};document.addEventListener("pointermove",he),document.addEventListener("pointerup",Ee)},[]),ke=g.useCallback((re,ge,Te="changes")=>{e.theaterId&&(ge&&Bte(e.theaterId,re),$_(),q(null),Re(""),se({kind:"loading"}),O({branches:[],remotes:[],tags:[],stashes:[]}),Y.current=re,V(re),tt(Te))},[e.theaterId,tt]);g.useEffect(()=>{if(!(!kt||kt.theaterId!==e.theaterId)){if(q(null),Y.current!==kt.repoRel){ke(kt.repoRel,!0,"history");return}tt("history")}},[e.theaterId,kt,tt,ke]),g.useEffect(()=>{if(!e.theaterId)return;let re=!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(ge=>ge.json()).then(ge=>{re||(i(ge.repos),p(ge.truncated===!0),S(!0))}).catch(()=>{re||o(!0)}),()=>{re=!0}},[e.api,e.theaterId,l,m]),g.useEffect(()=>{if(!e.theaterId)return;let re=!1;const ge=M;return k([]),B(!1),j(null),e.api.fetch("repository","worktrees",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:ge})}).then(Te=>Te.json()).then(Te=>{re||(k(Te.worktrees),j(ge))}).catch(Te=>{if(re)return;if((typeof Te=="object"&&Te!==null&&"status"in Te?Te.status:null)===400&&ge!==""){Pte(e.theaterId),ke("",!1);return}B(!0)}),()=>{re=!0}},[e.api,e.theaterId,M,ke,H]),g.useEffect(()=>{if(!e.theaterId||!w||$!==M)return;const re=Ite(e.theaterId,n,x);re!==Y.current&&ke(re,!1)},[e.theaterId,M,n,w,ke,x,$]),g.useEffect(()=>{if(!e.theaterId)return;let re=!1;return O({branches:[],remotes:[],tags:[],stashes:[]}),K(!1),e.api.fetch("repository","refs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:M})}).then(ge=>ge.ok?ge.json():Promise.reject()).then(ge=>{re||O(ge)}).catch(()=>{re||K(!0)}),()=>{re=!0}},[e.api,e.theaterId,M,z]),g.useEffect(()=>{if(!e.theaterId){se({kind:"error",message:"no_theater"});return}let re=!1;return se({kind:"loading"}),fetch("/plugins/repository/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,repoRel:M})}).then(async ge=>{if(!ge.ok){const ee=(await ge.json()).error??"git_failed";re||se(ee==="no_git_repo"||ee==="git_unavailable"?{kind:"notice",reason:ee}:{kind:"error",message:ee});return}const Te=await ge.json();re||se({kind:"ok",files:Te.files})}).catch(ge=>{re||se({kind:"error",message:ge instanceof Error?ge.message:"unknown"})}),()=>{re=!0}},[Se,e.theaterId,M]),g.useLayoutEffect(()=>()=>$_(),[]);const De=g.useCallback(re=>{e.theaterId&&Vee(re,e.theaterId,M)},[e.theaterId,M]),Xe=g.useCallback(re=>{const ge=Ute(e.theaterId,M,re.relPath);if(!ge.transition){q(null),lt(Te=>Te+1),tt(ge.landing);return}ke(re.relPath,!0,ge.landing)},[e.theaterId,M,tt,ke]),_t=g.useCallback(()=>$_(),[]),ht=g.useCallback(re=>{je(re);try{localStorage.setItem(kI,re)}catch{}},[]),nt=g.useCallback(re=>{re.preventDefault();const ge=at.current;if(!ge)return;const Te=ge.getBoundingClientRect().width,We=re.clientX,ee=gt.current;Ut(!0);const he=Ve=>{const Rt=cI({startWidth:ee,dx:Ve.clientX-We,containerWidth:Te,listPaneMinWidth:MI,hunkPaneMinWidth:D1,dividerWidth:Qs});Rt!==null&&(gt.current=Rt,dt(Rt))},Ee=()=>{document.removeEventListener("pointermove",he),document.removeEventListener("pointerup",Ee),Ut(!1);try{localStorage.setItem(CI,String(gt.current))}catch{}};document.addEventListener("pointermove",he),document.addEventListener("pointerup",Ee)},[]),st=mt?Fte(mt):null,_e=g.useCallback(()=>pe(re=>re+1),[]),Ne=Z.kind==="ok"?Z.files:[],bt=n.find(re=>re.relPath===M)??x.find(re=>re.relPath===M),Nt=c.jsxs("div",{ref:at,className:`repository-root${mt?" has-hunk":""}${Pt?" is-dragging":""}`,style:mt?{gridTemplateColumns:uI(Ct)}:void 0,children:[mt&&st?c.jsxs("div",{className:"repository-hunk-pane",children:[c.jsxs("div",{className:"repository-hunk-head",children:[c.jsx("span",{children:mt.entry.path}),c.jsx("button",{type:"button",onClick:_t,children:"✕"})]}),c.jsx(Wm,{ctx:e,repoRel:M,file:mt.entry,mode:st})]}):null,mt?c.jsx("div",{className:"repository-divider",onPointerDown:nt,"aria-hidden":"true"}):null,c.jsxs("div",{className:"repository-list-pane",children:[c.jsxs("div",{className:"repository-toolbar",children:[c.jsxs("div",{className:"repository-filter",children:[c.jsx("input",{type:"text",className:"repository-filter-input",placeholder:t("repository.common.filterPlaceholder"),"aria-label":t("repository.common.filterChangedFiles"),value:St,onChange:re=>Re(re.target.value)}),St?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":t("repository.common.clearFilter"),onClick:()=>Re(""),children:"✕"}):null]}),c.jsxs("div",{className:"repository-view-toggle",children:[c.jsx("button",{type:"button",className:`repository-toggle-btn${$e==="list"?" is-active":""}`,title:t("repository.common.listView"),"aria-pressed":$e==="list",onClick:()=>ht("list"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),c.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),c.jsx("button",{type:"button",className:`repository-toggle-btn${$e==="tree"?" is-active":""}`,title:t("repository.common.treeView"),"aria-pressed":$e==="tree",onClick:()=>ht("tree"),children:c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),c.jsx(rI,{state:Z,onRetry:_e,viewMode:$e,selectedPath:mt?.entry.path??null,onSelect:De,filterText:St,t})]})]}),hn=c.jsx(Uee,{ctx:e,repoRel:M,refs:U,refsError:W,onRetryRefs:()=>G(re=>re+1)},`${e.theaterId??""}:${M}`),le=te==="changes"||te==="compare",me=c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"repository-source-fill",hidden:te!=="changes",children:Nt}),c.jsx("div",{className:"repository-source-fill",hidden:te!=="compare",children:hn})]});return c.jsxs("div",{className:"repository-unified is-workspace",children:[c.jsxs("div",{className:`repository-identity${M?" is-subcontext":""}`,children:[c.jsx(OI,{}),c.jsx("strong",{children:bt?.name??t("repository.panel.title")}),bt?.branch&&c.jsx("span",{children:bt.branch})]}),c.jsxs("div",{ref:L,className:`repository-ws-layout${D?" is-dragging":""}`,style:{"--ws-tree-width":`${P}px`},children:[c.jsx(Gte,{t,repos:n,reposError:s,reposTruncated:f,scanDepth:m,worktrees:x,worktreesError:C,refs:U,refsError:W,changedFiles:Z,selectedRel:M,source:te,refFilter:R,onRepository:Xe,onScanDepth:_,onRetryRepos:()=>d(re=>re+1),onRetryWorktrees:()=>T(re=>re+1),onRetryRefs:()=>G(re=>re+1),onSource:tt,onRef:re=>{q(re),tt("history")}}),c.jsx("div",{className:"repository-divider repository-ws-tree-divider",onPointerDown:cn,role:"separator","aria-orientation":"vertical","aria-label":t("repository.common.resizeSourceTree")}),c.jsx(Cte,{ctx:e,repoRel:M,active:!0,refFilter:R,wipFiles:Ne,workspace:!0,workspaceMain:me,workspaceMainVisible:le,onClearRef:()=>q(null),onWip:()=>tt("changes")},`${e.theaterId??""}:${M}:${ze}`)]})]})}function Gte({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:_,onRepository:w,onScanDepth:S,onRetryRepos:x,onRetryWorktrees:k,onRetryRefs:C,onSource:B,onRef:H}){const[T,$]=g.useState(""),[j,M]=g.useState(()=>new Set(["tags","stashes"])),V=t.filter(U=>U.kind==="root").sort((U,O)=>U.name.localeCompare(O.name)),Y=t.filter(U=>U.kind==="nested"),te=Wee(Y),J=U=>y5(T,U.name)??y5(T,U.relPath),P=T?V.filter(U=>J(U)!==null):V,N=T?Y.filter(U=>J(U)!==null):Y,I=P.length+N.length,D=d.branches.length+d.remotes.filter(U=>!z1(U.ref)).length,E=p.kind==="ok"?p.files.length:0,L=ute({context:t.length,changes:E,worktrees:o.length,branches:D,tags:d.tags.length,stashes:d.stashes.length},e),R=U=>{const O=L.find(K=>K.id===U),W=j.has(U);return c.jsxs("button",{type:"button",className:"repository-ws-section-head","aria-expanded":!W,onClick:()=>{M(K=>{const z=new Set(K);return z.has(U)?z.delete(U):z.add(U),z})},children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("span",{children:O.label}),c.jsx("i",{children:O.count})]})},q=U=>Wte(U,d).map(O=>c.jsxs("div",{className:"repository-ws-ref-group",children:[O.label&&c.jsx("span",{className:"repository-ws-ref-subhead",children:e(O.label==="LOCAL"?"repository.refs.local":"repository.refs.remotes")}),O.rows.map(W=>c.jsxs("button",{type:"button",className:`repository-ws-tree-row${W.current?" is-current":""}${y==="history"&&W.ref===_?" is-active":""}`,disabled:W.ref===null,onClick:()=>W.ref&&H(W.ref),children:[c.jsx(Nc,{source:W.source}),c.jsx("span",{children:W.primary}),W.current&&c.jsx("i",{children:"HEAD"}),W.sub&&c.jsx("i",{children:W.sub})]},W.key))]},O.label??U));return c.jsxs("aside",{className:"repository-ws-tree",children:[c.jsx(Kte,{t:e,query:T,onQuery:$,totalCount:t.length,matchedCount:I,scanDepth:s,onScanDepth:S,truncated:i,onEnter:()=>{const U=P[0]??N[0];U&&w(U)}}),c.jsxs("div",{className:"repository-ws-tree-scroll",children:[c.jsxs("section",{className:`repository-ws-section${j.has("context")?" is-collapsed":""}`,children:[R("context"),!j.has("context")&&(n?c.jsx(U_,{t:e,label:e("repository.discovery.loadReposFailed"),onRetry:x}):c.jsxs(c.Fragment,{children:[P.map(U=>c.jsx(w0,{repo:U,depth:0,selectedRel:m,onRepository:w},U.relPath)),T?N.map(U=>c.jsx(w0,{repo:U,depth:0,selectedRel:m,onRepository:w},U.relPath)):c.jsx(LI,{node:te,depth:0,selectedRel:m,onRepository:w}),T&&I===0&&c.jsx("div",{className:"repository-empty-row",children:e("repository.discovery.noMatching")})]}))]}),c.jsxs("section",{className:`repository-ws-section${j.has("working")?" is-collapsed":""}`,children:[R("working"),!j.has("working")&&c.jsxs(c.Fragment,{children:[c.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="history"?" is-active":""}`,onClick:()=>B("history"),children:[c.jsx(Nc,{source:"history"}),c.jsx("span",{children:e("repository.source.history")})]}),c.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="changes"?" is-active":""}`,onClick:()=>B("changes"),children:[c.jsx(Nc,{source:"changes"}),c.jsx("span",{children:e("repository.source.changes")}),c.jsx("i",{children:E})]}),c.jsxs("button",{type:"button",className:`repository-ws-tree-row${y==="compare"?" is-active":""}`,onClick:()=>B("compare"),children:[c.jsx(Nc,{source:"compare"}),c.jsx("span",{children:e("repository.source.compare")})]})]})]}),c.jsxs("section",{className:`repository-ws-section${j.has("worktrees")?" is-collapsed":""}`,children:[R("worktrees"),!j.has("worktrees")&&(l?c.jsx(U_,{t:e,label:e("repository.discovery.loadWorktreesFailed"),onRetry:k}):o.map(U=>c.jsxs("button",{type:"button",className:`repository-ws-tree-row${U.relPath===m?" is-current":""}`,title:U.relPath,onClick:()=>w(U),children:[c.jsx(Nc,{source:"worktrees"}),c.jsx("span",{children:U.name}),U.current&&c.jsx("i",{children:"HEAD"})]},U.relPath)))]}),c.jsxs("section",{className:`repository-ws-section${j.has("branches")?" is-collapsed":""}`,children:[R("branches"),!j.has("branches")&&(f?c.jsx(U_,{t:e,label:e("repository.discovery.loadRefsFailed"),onRetry:C}):q("branches"))]}),c.jsxs("section",{className:`repository-ws-section${j.has("tags")?" is-collapsed":""}`,children:[R("tags"),!j.has("tags")&&!f&&q("tags")]}),c.jsxs("section",{className:`repository-ws-section${j.has("stashes")?" is-collapsed":""}`,children:[R("stashes"),!j.has("stashes")&&!f&&q("stashes")]})]})]})}function U_({t:e,label:t,onRetry:n}){return c.jsxs("div",{className:"repository-ws-tree-error",children:[c.jsx("span",{children:t}),c.jsx("button",{type:"button",onClick:n,children:e("repository.common.retry")})]})}function Nc({source:e}){const t=e==="repositories"?"M3 5h12v9H3zM5 3h8v2":e==="worktrees"?"M5 3v12M5 6h7M5 12h7":e==="changes"?"M3 4h12M3 9h12M3 14h12":e==="history"?"M4 4v10h10M7 7h6v5":e==="compare"?"M5.5 3v9M3 9.5l2.5 2.5L8 9.5M12.5 15V6M10 8.5L12.5 6L15 8.5":e==="branches"?"M5 3v12M5 6h7M5 12h7":e==="tags"?"M3 4h8l4 4-7 7-5-5z":"M4 5h10v9H4zM6 3h6";return c.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:c.jsx("path",{d:t,fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function Kte({t:e,query:t,onQuery:n,totalCount:i,matchedCount:s,scanDepth:o,onScanDepth:l,truncated:d,onEnter:f}){return c.jsxs("div",{className:"repository-discovery",children:[c.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?c.jsx("button",{type:"button",className:"repository-filter-clear","aria-label":e("repository.discovery.clearSearch"),onClick:()=>n(""),children:"✕"}):null,c.jsxs("span",{className:"repository-discovery-depth",children:[e("repository.discovery.depth"),c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":e("repository.discovery.scanShallower"),disabled:o<=TI,onClick:()=>l(o-1),children:"−"}),c.jsx("output",{className:"repository-depth-value",children:o}),c.jsx("button",{type:"button",className:"repository-depth-step","aria-label":e("repository.discovery.scanDeeper"),disabled:o>=RI,onClick:()=>l(o+1),children:"+"})]}),c.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 LI({node:e,depth:t,selectedRel:n,onRepository:i}){return c.jsxs(c.Fragment,{children:[Object.entries(e.dirs).map(([s,o])=>c.jsx(Vte,{dirKey:s,node:o,depth:t,selectedRel:n,onRepository:i},s)),e.repos.map(s=>c.jsx(w0,{repo:s,depth:t,selectedRel:n,onRepository:i},s.relPath))]})}function Vte({dirKey:e,node:t,depth:n,selectedRel:i,onRepository:s}){const[o,l]=g.useState(!1),d=g.useCallback(()=>l(_=>!_),[]),{label:f,node:p}=qee(e,t),m=n*16+12,y=mI(p);return c.jsxs("div",{className:`repository-folder${o?" is-collapsed":""}`,children:[c.jsxs("button",{type:"button",className:"repository-folder-row",style:{paddingLeft:`${m}px`,gridTemplateColumns:"12px 15px 1fr auto"},onClick:d,"aria-expanded":!o,children:[c.jsx("svg",{className:"repository-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),c.jsx("svg",{className:"repository-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),c.jsx("span",{className:"repository-folder-name",children:f}),c.jsx("span",{className:"repository-folder-count",children:y})]}),!o&&c.jsx(LI,{node:p,depth:n+1,selectedRel:i,onRepository:s})]})}function w0({repo:e,depth:t,selectedRel:n,onRepository:i,nameMatch:s}){const o=t*16+30;return c.jsxs("button",{type:"button",title:e.relPath,className:`repository-ref-row${e.relPath===n?" is-current":""}`,style:{paddingLeft:`${o}px`},onClick:()=>i(e),children:[c.jsx(Nc,{source:"repositories"}),c.jsx("span",{className:"repository-ref-name",children:s?Array.from(e.name).map((l,d)=>s.includes(d)?c.jsx("b",{className:"repository-ref-hl",children:l},d):l):e.name}),e.relPath===n&&c.jsx("span",{className:"repository-ref-mark",children:"✓"}),e.branch&&c.jsx("span",{className:"repository-ref-sub",children:e.branch})]})}function OI(){return c.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),c.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),c.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const Yte={id:"repository",title:e=>$o(e)("repository.panel.title"),defaultWidth:420,icon:()=>c.jsx(OI,{}),render:e=>c.jsx(Hte,{ctx:e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>{const s=NI(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:()=>hte(t,l.repoRel,d.fullHash)}))}},Xte={id:"repository",railPanels:[Yte]},Zte=[Xte],vp=["claude-code","codex","cursor","opencode"],Jte={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"};function Qte({source:e,skill:t,theaterId:n,onCancel:i,onStarted:s,jobLog:o,t:l}){const[d,f]=g.useState(n?"project":"global"),[p,m]=g.useState(!0),[y,_]=g.useState(new Set(vp)),{status:w,start:S}=o,x=w==="running",k=w==="done",C=w==="error",B=g.useCallback(()=>{m(!0),_(new Set(vp))},[]),H=g.useCallback($=>{m(!1),_(j=>{const M=new Set(j);return M.has($)?M.delete($):M.add($),M})},[]),T=g.useCallback(()=>{const $=p?vp:Array.from(y);if($.length===0)return;const j={source:e,skill:t,scope:d,agents:$};d==="project"&&n&&(j.theaterId=n),S("/plugins/skills/install",j),s(d)},[p,y,e,t,d,n,S,s]);return c.jsxs("div",{className:"skills-install-flow",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${d==="project"?" is-active":""}`,onClick:()=>f("project"),disabled:!n||x||k,title:n?void 0:l("skills.install.selectTheater"),children:l("skills.scope.project")}),c.jsx("button",{type:"button",className:`skills-scope-btn${d==="global"?" is-active":""}`,onClick:()=>f("global"),disabled:x||k,children:l("skills.scope.global")})]}),c.jsxs("div",{className:"skills-agents-row",children:[c.jsx("button",{type:"button",className:`skills-agent-chip${p?" is-active":""}`,onClick:B,disabled:x||k,children:l("skills.install.allAgents")}),vp.map($=>c.jsx("button",{type:"button",className:`skills-agent-chip${!p&&y.has($)?" is-active":""}`,onClick:()=>H($),disabled:x||k,children:Jte[$]},$))]}),c.jsx("p",{className:"skills-permission-warning",children:l("skills.install.permissionWarning")}),!x&&!k&&!C&&c.jsxs("div",{className:"skills-card-actions",children:[c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:i,children:l("skills.action.cancel")}),c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:T,disabled:!p&&y.size===0,children:l("skills.install.installNow")})]})]})}const ene=4e3;function II({status:e,lines:t,runningLabel:n,doneLabel:i,errorLabel:s,onDismiss:o,onRetry:l,t:d}){const[f,p]=g.useState(!1),m=g.useRef(null),y=g.useRef(null);g.useEffect(()=>{e==="running"&&p(!1)},[e]),g.useEffect(()=>{const C=m.current;C&&(C.scrollTop=C.scrollHeight)},[t]),g.useEffect(()=>{if(e==="done")return y.current=setTimeout(()=>{p(!1),o()},ene),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[e,o]);const _=g.useCallback(()=>{y.current&&(clearTimeout(y.current),y.current=null),p(!1),o()},[o]),w=g.useCallback(()=>p(C=>!C),[]);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 c.jsxs("div",{className:"skills-dock",children:[f&&c.jsxs("div",{ref:m,className:"skills-dock-log",children:[t.map((C,B)=>c.jsx("div",{className:"skills-dock-log-line",children:C},B)),e==="done"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",i]}),e==="error"&&c.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",s]})]}),c.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${f?" is-open":""}`,"aria-expanded":f,onClick:w,onKeyDown:C=>{C.target===C.currentTarget&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),w())},children:[c.jsx("span",{className:S,"aria-hidden":"true"}),c.jsx("span",{className:x,"aria-live":"polite",children:k}),e==="running"&&t.length>0&&c.jsx("span",{className:"skills-dock-count",children:d(t.length===1?"skills.status.lines_one":"skills.status.lines_other",{count:t.length})}),e==="done"&&c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":d("skills.action.dismiss"),onClick:C=>{C.stopPropagation(),_()},children:"✕"}),e==="error"&&c.jsxs(c.Fragment,{children:[l!=null&&c.jsx("button",{type:"button",className:"skills-dock-retry",onClick:C=>{C.stopPropagation(),l()},children:d("skills.action.retry")}),c.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":d("skills.action.dismiss"),onClick:C=>{C.stopPropagation(),_()},children:"✕"})]}),c.jsx("span",{className:`skills-dock-chevron${f?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const tne={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},S0=new Set;let Oi=tne;function zo(){for(const e of S0)e()}function nne(e){return S0.add(e),()=>{S0.delete(e)}}function E5(){return Oi}function F1(){return g.useSyncExternalStore(nne,E5,E5)}function Md(e){Oi={...Oi,activeTab:e},zo()}function x0(e){Oi={...Oi,scope:e},zo()}function jI(e){Oi={...Oi,filterText:e},zo()}function ine(e){Oi={...Oi,searchQuery:e},zo()}function Lc(e,t){Oi={...Oi,searchResults:e,searchLoading:t},zo()}function Gm(e){return e??""}function Km(e,t){return e.installedContextKey===t}function W_(e,t,n){Oi.installedContextKey===e&&(Oi={...Oi,installedList:t,installedLoading:n},zo())}function k0(e){Oi={...Oi,installFormOpenId:e},zo()}function rne(e){Oi={...Oi,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},zo()}const A5=750;function DI(){const[e,t]=g.useState({status:"idle",lines:[]}),n=g.useRef(null),i=g.useCallback(()=>{n.current&&(clearTimeout(n.current),n.current=null)},[]);g.useEffect(()=>()=>i(),[i]);const s=g.useCallback(()=>{i(),t({status:"idle",lines:[]})},[i]),o=g.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 _=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(p)}&cursor=${m}`).catch(()=>null);if(!_?.ok){t(S=>({...S,status:"error"}));return}const w=await _.json();m=w.nextCursor,t(S=>({...S,lines:[...S.lines,...w.lines]})),w.status==="running"?n.current=setTimeout(()=>{y()},A5):t(S=>({...S,status:w.status}))};n.current=setTimeout(()=>{y()},A5)})()},[i]);return{...e,start:o,reset:s}}const sne=300,Kp=2;function ane(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function one(e){if(e.length<Kp){Lc([],!1);return}Lc([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){Lc([],!1);return}const n=await t.json();Lc(n.skills??[],!1)}catch{Lc([],!1)}}function lne({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 c.jsxs("div",{className:`skills-card${n?" is-expanded":""}`,children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>s(f,e.id),title:d("skills.action.readSkillMdPreview"),children:e.name}),e.installs>0&&c.jsx("span",{className:"skills-card-installs",children:ane(e.installs)})]}),c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("div",{className:"skills-card-actions",children:c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:i,children:d(n?"skills.action.cancel":"skills.action.install")})}),n&&c.jsx(Qte,{source:e.source,skill:e.name,theaterId:t,onCancel:i,onStarted:p=>o(e.name,p),jobLog:l,t:d})]})}function cne({theaterId:e,onReadMore:t,onInstallSuccess:n,t:i}){const{searchQuery:s,searchResults:o,searchLoading:l,installFormOpenId:d}=F1(),f=g.useRef(null),p=DI(),[m,y]=g.useState(null),_=g.useCallback(S=>{if(ine(S),f.current&&clearTimeout(f.current),S.length<Kp){Lc([],!1);return}f.current=setTimeout(()=>{one(S)},sne)},[]);g.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),g.useEffect(()=>{p.status!=="done"||!m||(n(m.name,m.scope),k0(null),y(null))},[p.status,m,n]);const w=m?i("skills.status.installingNamed",{name:m.name}):i("skills.status.installing");return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:i("skills.filter.searchPlaceholder"),value:s,onChange:S=>_(S.target.value),"aria-label":i("skills.filter.searchAria")}),l&&c.jsx("div",{className:"skills-empty-state",children:i("skills.empty.searching")}),!l&&s.length>=Kp&&o.length===0&&c.jsx("div",{className:"skills-empty-state",children:i("skills.empty.noResults",{query:s})}),!l&&s.length>0&&s.length<Kp&&c.jsx("div",{className:"skills-empty-state",children:i("skills.empty.minQuery")}),c.jsx("div",{className:"skills-card-list",children:o.map(S=>c.jsx(lne,{result:S,theaterId:e,isFormOpen:d===S.id,onInstallClick:()=>k0(d===S.id?null:S.id),onReadMore:t,onInstallStarted:(x,k)=>y({name:x,scope:k}),jobLog:p,t:i},S.id))})]}),c.jsx(II,{status:p.status,lines:p.lines,runningLabel:w,doneLabel:i("skills.status.installed"),errorLabel:i("skills.status.installFailed"),onDismiss:p.reset,t:i})]})}const une={"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"},dne={"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":"복사됨"},T5={en:une,ko:dne},hne={en:qs(T5,"en"),ko:qs(T5,"ko")};function H1(e){return hne[e??"en"]}function fne(e){return{copyLabel:e("skills.markdown.copy"),copyAriaLabel:t=>e("skills.markdown.copyCodeAria",{language:t})}}const pne=2600;function mne({skill:e,onReadMore:t,onUpdate:n,onRemove:i,isUpdating:s,t:o}){const[l,d]=g.useState(!1),f=g.useRef(null),p=g.useCallback(()=>{f.current&&(clearTimeout(f.current),f.current=null)},[]),m=g.useCallback(()=>{l?(p(),d(!1),i?.(e.name,e.scope)):(d(!0),f.current=setTimeout(()=>d(!1),pne))},[l,p,i,e.name,e.scope]);return g.useEffect(()=>()=>p(),[p]),c.jsxs("div",{className:"skills-card",children:[c.jsxs("div",{className:"skills-card-header",children:[c.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:o("skills.action.readSkillMd"),children:e.name}),c.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&c.jsx("span",{className:"skills-card-meta",children:e.source}),c.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),c.jsxs("div",{className:"skills-card-actions",children:[n&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title: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&&c.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 gne(e){const t=e?`?theaterId=${encodeURIComponent(e)}`:"",n=await fetch(`/plugins/skills/list${t}`);return n.ok?(await n.json()).skills??[]:[]}function yne({theaterId:e,onReadMore:t,refreshKey:n,t:i,language:s}){const o=F1(),{scope:l,filterText:d}=o,f=Gm(e),p=Km(o,f)?o.installedList:[],m=Km(o,f)&&o.installedLoading,y=DI(),_=g.useRef(null),w=g.useCallback($=>{const j=Gm($);W_(j,[],!0),gne($).then(M=>W_(j,M,!1)).catch(()=>W_(j,[],!1))},[]);g.useEffect(()=>{w(e)},[e,w,n]),g.useEffect(()=>{(y.status==="done"||y.status==="error")&&w(e)},[y.status,e,w]);const S=g.useCallback($=>{const j=$;_.current=j;const M={scope:j};j==="project"&&e&&(M.theaterId=e),y.start("/plugins/skills/update",M)},[e,y]),x=g.useCallback(($,j)=>{const M={scope:j,skill:$};j==="project"&&e&&(M.theaterId=e),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}).then(()=>w(e)).catch(()=>null)},[e,w]),k=g.useCallback(()=>{_.current&&S(_.current)},[S]),C=l==="project"&&!e?"global":l,B=p.filter($=>$.scope!==C?!1:d?$.name.toLowerCase().includes(d.toLowerCase()):!0),H=y.status==="running"&&_.current===C,T=(s??"en")==="en"?C:i(C==="project"?"skills.scope.project":"skills.scope.global");return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"skills-tab-body",children:[c.jsxs("div",{className:"skills-scope-toggle",children:[c.jsx("button",{type:"button",className:`skills-scope-btn${C==="project"?" is-active":""}`,onClick:()=>x0("project"),disabled:!e,title:e?void 0:i("skills.scope.viewProjectTitle"),children:i("skills.scope.project")}),c.jsx("button",{type:"button",className:`skills-scope-btn${C==="global"?" is-active":""}`,onClick:()=>x0("global"),children:i("skills.scope.global")})]}),c.jsx("input",{type:"search",className:"skills-filter-input",placeholder:i("skills.filter.installedPlaceholder"),value:d,onChange:$=>jI($.target.value),"aria-label":i("skills.filter.installedAria")}),m&&c.jsx("div",{className:"skills-empty-state",children:i("skills.empty.loading")}),!m&&B.length===0&&c.jsx("div",{className:"skills-empty-state",children:d?i("skills.empty.noMatch"):i("skills.empty.noneInstalled",{scope:T})}),c.jsx("div",{className:"skills-card-list",children:B.map($=>c.jsx(mne,{skill:$,onReadMore:t,onUpdate:S,onRemove:x,isUpdating:H,t:i},`${$.scope}:${$.name}`))})]}),c.jsx(II,{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 q_(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 vne({content:e,language:t}){const n=H1(t),i=g.useMemo(()=>{const l=us(e,fne(n)).html,d=new DOMParser().parseFromString(l,"text/html");return q_(d.body),d.body.innerHTML},[e,n]),s=g.useRef(null);g.useEffect(()=>{const l=s.current;if(!l)return;q_(l);const d=new MutationObserver(()=>q_(l));return d.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>d.disconnect()},[i]);const o=g.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 c.jsx("div",{ref:s,className:"markdown-body",onClick:o,dangerouslySetInnerHTML:{__html:i}})}const _ne=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function bne(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(_ne)),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 wne({skill:e,isInstalled:t,theaterId:n,onClose:i,onInstall:s,t:o,language:l}){const[d,f]=g.useState(null),[p,m]=g.useState(!1),y=g.useRef(null),_=g.useRef(null),w=g.useRef(null);if(g.useEffect(()=>{e&&y.current===null&&(y.current=document.activeElement)},[e]),g.useEffect(()=>{if(!e){f(null);return}m(!0),f(null);let x=!1;return(async()=>{try{let C;if(t){const H={scope:e.scope,skill:e.name};e.scope==="project"&&n&&(H.theaterId=n),C=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)})}else C=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(!C.ok){m(!1);return}const B=await C.json();x||(f(B.markdown??""),m(!1))}catch{x||m(!1)}})(),()=>{x=!0}},[e,t,n]),g.useEffect(()=>{if(!e)return;const x=k=>{k.key==="Escape"?(k.preventDefault(),i()):k.key==="Tab"&&bne(k,w.current),k.stopImmediatePropagation()};return _.current?.focus(),window.addEventListener("keydown",x,!0),()=>{window.removeEventListener("keydown",x,!0);const k=y.current;y.current=null,k?.focus?.()}},[e,i]),g.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 ea.createPortal(c.jsx("div",{className:"skills-overlay-backdrop",onClick:i,"aria-hidden":"true",children:c.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:[c.jsxs("div",{className:"skills-overlay-header",children:[c.jsx("span",{className:"skills-overlay-title",children:e.name}),S&&c.jsx("span",{className:"skills-overlay-meta",children:S}),c.jsx("button",{ref:_,type:"button",className:"skills-overlay-close",onClick:i,"aria-label":o("skills.overlay.close"),children:"✕"})]}),c.jsxs("div",{className:"skills-overlay-body",children:[p&&c.jsx("div",{className:"skills-empty-state",children:o("skills.overlay.loading")}),!p&&d===null&&c.jsx("div",{className:"skills-empty-state",children:o("skills.overlay.loadFailed")}),d!==null&&c.jsx(vne,{content:d,language:l})]}),c.jsxs("div",{className:"skills-overlay-footer",children:[c.jsx("p",{className:"skills-permission-warning",children:o("skills.overlay.permissionWarning")}),!t&&c.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{i(),s()},children:o("skills.action.install")})]})]})}),document.body)}const C0=new Set;let Sne=0,Vm=null;function xne(e,t,n){Vm={theaterId:e,name:t,scope:n,requestId:++Sne},BI()}function kne(e){Vm?.requestId===e.requestId&&(Vm=null,BI())}function Cne(){return g.useSyncExternalStore(Ene,R5,R5)}function Ene(e){return C0.add(e),()=>{C0.delete(e)}}function R5(){return Vm}function BI(){for(const e of C0)e()}const Ane=3200;function Tne({message:e,onDismiss:t}){return g.useEffect(()=>{if(!e)return;const n=setTimeout(t,Ane);return()=>clearTimeout(n)},[e,t]),e?c.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function Rne({ctx:e}){const t=Gm(e.theaterId);return c.jsx(Mne,{ctx:e},t)}function Mne({ctx:e}){const{theaterId:t}=e,n=H1(e.language),i=F1(),{activeTab:s}=i,o=Gm(e.theaterId),[l,d]=g.useState(null),[f,p]=g.useState(null),[m,y]=g.useState(0),_=Cne(),w=Km(i,o)?i.installedList.length:0;g.useLayoutEffect(()=>{rne(o)},[o]),g.useLayoutEffect(()=>{!_||_.theaterId!==t||(Md("installed"),x0(_.scope),jI(""))},[_,t]),g.useLayoutEffect(()=>{if(!_||_.theaterId!==t||!Km(i,o)||i.installedLoading)return;const B=i.installedList.find(H=>H.name===_.name&&H.scope===_.scope);B&&(d({skill:B,isInstalled:!0}),kne(_))},[o,_,i,t]);const S=g.useCallback(B=>{d({skill:B,isInstalled:!0})},[]),x=g.useCallback((B,H)=>{d({skill:B,isInstalled:!1,registryId:H})},[]),k=g.useCallback((B,H)=>{const T=(e.language??"en")==="en"?H:n(H==="project"?"skills.scope.project":"skills.scope.global");p(n("skills.toast.installed",{name:B,scope:T})),y($=>$+1),Md("installed")},[e.language,n]),C=g.useCallback(()=>{l?.registryId&&(k0(l.registryId),Md("find")),d(null)},[l]);return c.jsxs("div",{className:"skills-root",children:[c.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":n("skills.tab.panelsAria"),children:[c.jsxs("button",{type:"button",role:"tab","aria-selected":s==="installed",className:`skills-tab-btn${s==="installed"?" is-active":""}`,onClick:()=>Md("installed"),children:[n("skills.tab.installed"),w>0?` ${w}`:""]}),c.jsx("button",{type:"button",role:"tab","aria-selected":s==="find",className:`skills-tab-btn${s==="find"?" is-active":""}`,onClick:()=>Md("find"),children:n("skills.tab.find")})]}),s==="installed"?c.jsx(yne,{theaterId:t,onReadMore:S,refreshKey:m,t:n,language:e.language}):c.jsx(cne,{theaterId:t,onReadMore:x,onInstallSuccess:k,t:n}),c.jsx(Tne,{message:f,onDismiss:()=>p(null)}),c.jsx(wne,{skill:l?.skill??null,isInstalled:l?.isInstalled??!1,theaterId:t,onClose:()=>d(null),onInstall:C,t:n,language:e.language})]})}function Nne(){return c.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:c.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const Lne={id:"skills",title:e=>H1(e)("skills.panel.title"),defaultWidth:360,icon:Nne,render:e=>c.jsx(Rne,{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:()=>xne(t,l.name,l.scope)}))}},One={id:"skills",railPanels:[Lne]},Ine=[One],PI=[...aQ,...vee,...Zte,...Ine],jne=zI(PI),$I=g.createContext(jne),Dne=$I.Provider;async function Bne(){const e=[...PI],t=new Set(e.map(i=>i.id)),n=await Pne();for(const i of n){if(t.has(i.id)){console.warn(`Skipping external plugin with duplicate id: ${i.id}`);continue}const s=await $ne(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 zI(e)}function gu(){return g.useContext($I)}async function Pne(){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(Fne):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function $ne(e){try{const t=await import(e.clientUrl),n=t.default??t.plugin;return zne(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 zI(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 zne(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function Fne(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.clientUrl=="string"&&Number.isInteger(t.apiVersion)}const FI="fleet-console.view-mode.preference",E0=new Set;let A0=null,T0=null,Ba=U1(Kne(),!1);Gne();function Hne(){return Ba}function Une(e){return E0.add(e),()=>{E0.delete(e)}}function HI(){return g.useSyncExternalStore(Une,Hne)}function Wne(e){Ba.preference!==e&&(UI(U1(e,Ba.viewportNarrow)),Vne(e))}function qne(){const e=Ba.preference==="auto"?"mobile":Ba.preference==="mobile"?"desktop":"auto";Wne(e)}function Gne(){typeof window>"u"||typeof window.matchMedia!="function"||(A0=window.matchMedia("(max-width: 767px)"),T0=window.matchMedia("(min-width: 832px)"),G_(),A0.addEventListener("change",G_),T0.addEventListener("change",G_))}function G_(){let e=Ba.viewportNarrow;A0?.matches?e=!0:T0?.matches&&(e=!1),e!==Ba.viewportNarrow&&UI(U1(Ba.preference,e))}function U1(e,t){return{preference:e,viewportNarrow:t,effective:e==="auto"?t?"mobile":"desktop":e}}function Kne(){try{const e=localStorage.getItem(FI);return e==="mobile"||e==="desktop"?e:"auto"}catch{return"auto"}}function Vne(e){try{localStorage.setItem(FI,e)}catch{}}function UI(e){Ba=e;for(const t of E0)t()}let WI=!1;const R0=new Set;function Yne(){return g.useSyncExternalStore(Xne,M5,M5)}function M5(){return WI}function qI(e){WI=Zne(e)?e.fullscreen:!1;for(const t of R0)t()}function N5(){qI({fullscreen:!1})}function Xne(e){return R0.add(e),()=>R0.delete(e)}function Zne(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 GI="(display-mode: fullscreen)",Jne=480,Qne=480,eie=()=>!0;function tie(){return typeof window<"u"&&window.matchMedia(GI).matches}function nie(e=eie){const t=Yne(),[n,i]=g.useState(tie),s=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",o=n||s&&t,l=g.useRef(o);l.current=o;const d=g.useRef(!1),f=g.useRef(null),[p,m]=g.useState(o),[y,_]=g.useState(!0),[w,S]=g.useState(!1),x=g.useCallback(()=>{f.current!==null&&(clearTimeout(f.current),f.current=null)},[]),k=g.useCallback(T=>{x(),!(!l.current||d.current)&&(f.current=setTimeout(()=>{f.current=null,l.current&&!d.current&&e()&&_(!1)},T))},[e,x]),C=g.useCallback(()=>{x(),l.current&&_(!0)},[x]),B=g.useCallback(()=>k(Qne),[k]),H=g.useCallback(()=>{const T=!d.current;d.current=T,S(T),T&&(x(),_(!0))},[x]);return g.useEffect(()=>{const T=window.matchMedia(GI),$=()=>i(T.matches);return $(),T.addEventListener("change",$),()=>T.removeEventListener("change",$)},[]),g.useLayoutEffect(()=>(x(),m(o),_(!0),o&&!d.current&&k(Jne),x),[x,o,k]),{isFullscreen:p,isVisible:y,isPinned:w,reveal:C,hideAfterLeave:B,togglePin:H}}function iie({operationsViewVisible:e}){const t=Ze(),n=Cs(),i=gu(),s=sN(),o=FN(),l=HI(),d=e&&l.effective!=="mobile",f=t(l.preference==="auto"?"chrome.commandBand.viewModeAuto":l.preference==="mobile"?"chrome.commandBand.viewModeMobile":"chrome.commandBand.viewModeDesktop"),p=aie(),m=`${p}${p==="⌘"?"":"+"}B`,y=`${p}${p==="⌘"?"⌥":"+Alt+"}B`,_=cS(),w=pM(),S=ag(),x=fN(n.activeTheaterId),k=n.theaters.find(re=>re.id===n.activeTheaterId)??null,C=x$(n.operations,n.activeOperationId,n.activeTheaterId),B=C?i.plugins.find(re=>re.id===C.pluginId):null,H=typeof C?.payload.cliId=="string"?C.payload.cliId:null,T=typeof C?.payload.cliLabel=="string"?C.payload.cliLabel:H,$=C?B?.operationKinds?.find(re=>re.type===C.type)??null:null,j=na(),M=sr(j.state?.language??"auto"),V=$?jl($.title,M):null,Y=C&&B?.renderLaunchIcon?B.renderLaunchIcon({id:H??C.type,type:C.type,title:V??C.type}):null,te=g.useRef(null),J=g.useRef(null),P=g.useRef(null),N=g.useRef(null),I=g.useRef({edge:!1,band:!1}),D=g.useRef(null),E=g.useRef(null),L=g.useRef(null),R=g.useRef(null),q=g.useRef(null),[U,O]=g.useState(null),[W,K]=g.useState(0),[z,G]=g.useState(!1),[Z,se]=g.useState(null),[Se,pe]=g.useState(null),[$e,je]=g.useState(!1),[St,Re]=g.useState(null),[ze,lt]=g.useState(null),kt=()=>{se(null),pe(null),je(!1),Re(null),lt(null)},mt=typeof document<"u"&&document.documentElement.dataset.desktopShell==="true",Ct=typeof document<"u"&&document.documentElement.dataset.desktopPlatform==="darwin"?t("chrome.commandBand.local"):t("chrome.commandBand.localDesktop"),dt=g.useCallback(()=>{const re=document.activeElement;return!(re instanceof Node&&(P.current?.contains(re)||N.current?.contains(re)))&&!I.current.edge&&!I.current.band},[]),gt=nie(dt),at=C?.id??null,Pt=g.useRef(null);Pt.current=at;const Ut=LS({currentTitle:C?.title??"",onCommit:re=>{const ge=g2(D.current,Pt.current);D.current=null,ge&&eM(ge,re).then(()=>Yi(null)).then(tr).catch(()=>{})}});g.useEffect(()=>{!Ut.renaming||g2(D.current,at)||(D.current=null,Ut.cancel())},[Ut,at]),g.useEffect(()=>{if(!z)return;const re=new AbortController;return se(null),pe(null),je(!0),h8(re.signal).then(se).catch(ge=>{re.signal.aborted||pe(ge instanceof Error?ge.message:t("chrome.commandBand.unableToLoadEnvironment"))}).finally(()=>{re.signal.aborted||je(!1)}),()=>re.abort()},[z,t]),g.useEffect(()=>{if(!z)return;const re=Te=>{const We=Te.target;!(We instanceof Node)||te.current?.contains(We)||J.current?.contains(We)||(G(!1),kt())},ge=Te=>{Te.key==="Escape"&&(G(!1),kt(),te.current?.focus())};return document.addEventListener("pointerdown",re),document.addEventListener("keydown",ge),()=>{document.removeEventListener("pointerdown",re),document.removeEventListener("keydown",ge)}},[z]),g.useEffect(()=>{if(U===null)return;const re=U==="theater"?E:L,ge=We=>{const ee=We.target;!(ee instanceof Node)||re.current?.contains(ee)||q.current?.contains(ee)||O(null)},Te=We=>{We.key==="Escape"&&(O(null),re.current?.focus())};return document.addEventListener("pointerdown",ge),document.addEventListener("keydown",Te),()=>{document.removeEventListener("pointerdown",ge),document.removeEventListener("keydown",Te)}},[U]),g.useEffect(()=>{O(null)},[n.activeTheaterId,n.activeOperationId]),g.useLayoutEffect(()=>{if(U===null)return;const re=()=>{const ge=R.current,Te=q.current;if(!ge||!Te)return;const We=U==="operation"?L.current?.offsetLeft??0:0;K(C$(We,ge.getBoundingClientRect().left,Te.getBoundingClientRect().width,window.innerWidth))};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[U]),g.useEffect(()=>{n.channel!=="local"&&(G(!1),se(null),pe(null),je(!1),Re(null),lt(null))},[n.channel]);const tt=re=>{navigator.clipboard.writeText(re).then(()=>{Re(re),lt(null)}).catch(()=>{lt(re),Re(null)})},cn=()=>{C&&(O(null),D.current=C.id,Ut.begin())},ke=re=>{G(!1),kt(),O(ge=>ge===re?null:re)},De=re=>{U===null||!k$(re.currentTarget,re.relatedTarget)||O(null)},Xe=re=>{O(null),E.current?.focus(),re!==n.activeTheaterId&&xS(re)},_t=re=>{O(null),L.current?.focus(),Ml(re)},ht=()=>{O(null),E.current?.focus(),k7()},nt=()=>{k&&(O(null),L.current?.focus(),E7(k.id))},st=S$(n.operations,n.groups,n.activeTheaterId,_.operationOrder),_e=()=>{dt()&&gt.hideAfterLeave()},Ne=re=>{const ge=re.relatedTarget;(!(ge instanceof Node)||!P.current?.contains(ge)&&!N.current?.contains(ge))&&!I.current.edge&&!I.current.band&&gt.hideAfterLeave()},bt=()=>{I.current.edge=!0,gt.reveal()},Nt=()=>{I.current.edge=!1,_e()},hn=()=>{I.current.band=!0,gt.reveal()},le=()=>{I.current.band=!1,_e()},me=gt.isFullscreen&&!gt.isVisible;return c.jsxs(c.Fragment,{children:[c.jsx("button",{ref:N,type:"button",className:`command-band-edge-reveal${gt.isFullscreen?" is-fullscreen":""}`,"aria-label":t("chrome.commandBand.showCommandBand"),onPointerEnter:bt,onPointerLeave:Nt,onFocus:gt.reveal,onBlur:Ne,onKeyDown:re=>{re.key==="Tab"&&gt.reveal()}}),c.jsxs("header",{ref:P,className:`command-band${e?" is-operations":" is-utility"}${gt.isFullscreen?" is-fullscreen":""}${gt.isVisible?" is-revealed":""}`,style:{"--command-band-left-width":l.effective==="mobile"?"min-content":`${s.width}px`},"aria-hidden":me||void 0,inert:me||void 0,onPointerEnter:hn,onPointerLeave:le,onFocus:gt.reveal,onBlur:Ne,children:[c.jsxs("div",{className:`command-band-left${e&&s.collapsed?" is-collapsed":""}`,children:[c.jsx(nz,{className:"command-band-brand"}),n.channel==="local"?c.jsxs("div",{className:"command-band-environment",children:[c.jsxs("button",{ref:te,type:"button",className:"command-band-local-chip","aria-haspopup":"dialog","aria-expanded":z,onClick:()=>{O(null),kt(),G(re=>!re)},children:[c.jsx("span",{className:"command-band-local-dot","aria-hidden":"true"}),c.jsx("span",{className:"command-band-local-chip-label",children:mt?Ct:t("chrome.commandBand.local")})]}),z?c.jsx("div",{ref:J,children:c.jsx(rie,{environment:Z,error:Se,loading:$e,copiedValue:St,copyFailedValue:ze,desktopShell:mt,onCopy:tt})}):null]}):null,d?c.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>Ao(!s.collapsed),"aria-label":t(s.collapsed?"chrome.commandBand.expandSidebar":"chrome.commandBand.collapseSidebar",{shortcut:m}),title:t(s.collapsed?"chrome.commandBand.expandSidebar":"chrome.commandBand.collapseSidebar",{shortcut:m}),children:c.jsx(L5,{side:"left"})}):null,c.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:KM,"aria-label":t("chrome.commandBand.searchSessions"),title:t("chrome.commandBand.searchSessionsTitle"),children:c.jsx(oie,{})})]}),d?c.jsxs("div",{className:"command-band-formation-group",role:"group","aria-label":t("chrome.commandBand.formationView"),children:[c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>gM({x:0,y:0,zoom:1}),disabled:n.activeTheaterId===null,"aria-label":t("chrome.commandBand.resetCanvasView"),title:t("chrome.commandBand.resetCanvasView"),children:c.jsx(hie,{})}),c.jsx("span",{className:"command-band-formation-divider","aria-hidden":"true"}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>Fv("grid"),disabled:n.activeTheaterId===null,"aria-pressed":S&&w==="grid","aria-label":t("chrome.commandBand.formationGrid"),title:t("chrome.commandBand.formationGrid"),children:c.jsx(die,{})}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>Fv("columns"),disabled:n.activeTheaterId===null,"aria-pressed":S&&w==="columns","aria-label":t("chrome.commandBand.formationColumns"),title:t("chrome.commandBand.formationColumns"),children:c.jsx(fie,{})}),c.jsx("button",{type:"button",className:"command-band-formation-toggle command-band-formation-seg",onClick:()=>Fv("rows"),disabled:n.activeTheaterId===null,"aria-pressed":S&&w==="rows","aria-label":t("chrome.commandBand.formationRows"),title:t("chrome.commandBand.formationRows"),children:c.jsx(pie,{})})]}):null,d?c.jsxs("button",{type:"button",className:"command-band-triage-toggle",disabled:n.activeTheaterId===null,"aria-pressed":x,"aria-label":t("chrome.commandBand.triageToggle"),title:t("chrome.commandBand.triageToggle"),onMouseDown:re=>re.preventDefault(),onClick:()=>{if(n.activeTheaterId){const re=!x;if(re){const ge=yN(document.activeElement);ge&&eu(n.activeTheaterId,ge)}Qc(n.activeTheaterId,re)}},children:[c.jsx(mie,{}),x?c.jsx("span",{children:t("chrome.commandBand.triage")}):null]}):null,l.effective!=="mobile"?c.jsx("div",{className:"command-band-center",children:d&&k?c.jsxs("div",{ref:R,className:"command-band-switcher",onBlur:De,children:[c.jsxs("div",{className:"command-band-theater-cluster","aria-label":t("chrome.commandBand.activeTheater",{label:k.label}),children:[c.jsxs("button",{ref:E,type:"button",className:`command-band-theater-segment command-band-segment-trigger${U==="theater"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":U==="theater",title:t("chrome.commandBand.switchTheater"),onClick:()=>ke("theater"),children:[c.jsx("span",{className:"command-band-theater-mark",children:jS(k.label)}),c.jsx("span",{className:"command-band-segment-label",children:k.label}),c.jsx(qv,{})]}),c.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),C?c.jsxs(c.Fragment,{children:[Ut.renaming?c.jsx("input",{ref:Ut.inputRef,className:"command-band-rename-input",value:Ut.draftTitle,"aria-label":t("chrome.commandBand.renameOperationAria",{title:C.title}),onChange:re=>Ut.setDraftTitle(re.target.value),onKeyDown:Ut.handleKeyDown,onBlur:Ut.handleBlur}):c.jsxs("button",{ref:L,type:"button",className:`command-band-operation-name command-band-segment-trigger${U==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":U==="operation",title:t("chrome.commandBand.switchOperationRename"),onClick:()=>ke("operation"),onDoubleClick:cn,children:[c.jsx("span",{className:"command-band-segment-label",children:C.title}),c.jsx(qv,{})]}),T?c.jsxs("span",{className:"command-band-operation-attribute",title:V??T,children:[Y?c.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:Y}):null,T]}):null]}):c.jsxs("button",{ref:L,type:"button",className:`command-band-operation-placeholder command-band-segment-trigger${U==="operation"?" is-open":""}`,"aria-haspopup":"menu","aria-expanded":U==="operation",title:t("chrome.commandBand.selectOperation"),onClick:()=>ke("operation"),children:[c.jsx("span",{className:"command-band-segment-label",children:t("chrome.commandBand.selectOperationEllipsis")}),c.jsx(qv,{})]})]}),U==="theater"?c.jsx(rF,{theaters:n.theaters,operations:n.operations,activeTheaterId:n.activeTheaterId,addingTheater:n.addingTheater,onSelectTheater:Xe,onAddTheater:ht,style:{left:W},containerRef:q}):null,U==="operation"?c.jsx(sF,{operations:st,activeOperationId:C?.id??null,theaterLabel:k.label,onSelectOperation:_t,onRenameOperation:C?cn:null,onNewOperation:nt,style:{left:W},containerRef:q}):null]}):null}):null,c.jsxs("div",{className:"command-band-right",children:[gt.isFullscreen?c.jsx("button",{type:"button",className:"command-band-button command-band-pin",onClick:gt.togglePin,"aria-label":t("chrome.commandBand.pinCommandBand"),"aria-pressed":gt.isPinned,title:gt.isPinned?t("chrome.commandBand.unpinCommandBand"):t("chrome.commandBand.pinCommandBand"),children:c.jsx(gie,{})}):null,c.jsx("button",{type:"button",className:"command-band-button command-band-viewmode",onClick:qne,"aria-label":f,"aria-pressed":l.preference!=="auto",title:f,children:l.preference==="auto"?c.jsx(lie,{}):l.preference==="mobile"?c.jsx(cie,{}):c.jsx(uie,{})}),d?c.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:DS,"aria-label":t(o?"chrome.commandBand.collapseActivityRail":"chrome.commandBand.expandActivityRail",{shortcut:y}),title:t(o?"chrome.commandBand.collapseActivityRail":"chrome.commandBand.expandActivityRail",{shortcut:y}),children:c.jsx(L5,{side:"right"})}):null]})]})]})}function rie({environment:e,error:t,loading:n,copiedValue:i,copyFailedValue:s,desktopShell:o,onCopy:l}){const d=Ze();if(n)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:d("chrome.commandBand.loadingEnvironment")});if(t)return c.jsx("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:t});if(!e)return null;const f=sie(d,e,o);return c.jsxs("div",{className:"command-band-environment-popover",role:"dialog","aria-label":d("chrome.commandBand.environment"),children:[c.jsx("div",{className:"command-band-environment-title",children:d("chrome.commandBand.environment")}),f.map(([p,m])=>c.jsxs("div",{className:"command-band-environment-row",children:[c.jsx("span",{children:p}),c.jsx("code",{children:m}),c.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)),c.jsx("div",{className:"command-band-environment-footer",children:d("chrome.commandBand.env.footer")})]})}function sie(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 aie(){const t=navigator.userAgentData?.platform??navigator.platform;return/mac|iphone|ipad|ipod/i.test(t)?"⌘":"Ctrl"}function oie(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function lie(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"2.5",width:"10",height:"7.5",rx:"1.4",strokeWidth:"1.2"}),c.jsx("path",{d:"M4.5 12.5h4M6.5 10v2.5",strokeWidth:"1.2",strokeLinecap:"round"}),c.jsx("rect",{x:"9.5",y:"6.5",width:"4.5",height:"7",rx:"1",strokeWidth:"1.2"})]})}function cie(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("rect",{x:"4.25",y:"1.5",width:"7.5",height:"13",rx:"1.6",strokeWidth:"1.3"}),c.jsx("path",{d:"M6.7 3.3h2.6M7.4 12.7h1.2",strokeWidth:"1.2",strokeLinecap:"round"})]})}function uie(){return c.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("rect",{x:"1.5",y:"2.25",width:"13",height:"9",rx:"1.5",strokeWidth:"1.3"}),c.jsx("path",{d:"M5 14h6M8 11.25V14",strokeWidth:"1.3",strokeLinecap:"round"})]})}function die(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function hie(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function fie(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h3v11h-3zM6.5 2.5h3v11h-3zM10.5 2.5h3v11h-3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function pie(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M2.5 2.5h11v3h-11zM2.5 6.5h11v3h-11zM2.5 10.5h11v3h-11z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function mie(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3 3h10v3H3zM5 8h6v2H5zM7 12h2v2H7z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function L5({side:e}){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),c.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function gie(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5 2.5h6M6.2 2.5v3l2.1 2.1v1H7.1V13.5l.9 1M9.8 2.5v3L7.7 7.6v1h1.2V13.5L8 14.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const yie=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function vie({state:e}){const t=Ze(),n=na(),[i,s]=g.useState(!1),o=g.useRef(null),l=g.useRef(null),d=g.useRef(null),f=e.theaters.length>0;if(g.useEffect(()=>{if(e.onboardingOpen)return o.current=document.activeElement,l.current?.focus(),()=>{const _=o.current;o.current=null,_?.focus?.()}},[e.onboardingOpen]),g.useEffect(()=>{if(!e.onboardingOpen)return;const _=w=>{i||(w.key==="Escape"?(w.preventDefault(),cd()):w.key==="Tab"&&_ie(w,d.current),w.stopImmediatePropagation())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[i,e.onboardingOpen]),n.loadStatus!=="ready"||!e.onboardingOpen)return null;const p=()=>{s(!0)},m=()=>{s(!1)},y=async _=>{s(!1),WM();try{const w=await QR(_),S=await JR(w);qM(S)}catch(w){Bb(w instanceof Error?w.message:String(w))}};return c.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[c.jsx("button",{type:"button",className:"commissioning-scrim",onClick:cd,"aria-label":t("chrome.commissioning.closeAria")}),c.jsxs("section",{className:"commissioning-card",ref:d,children:[c.jsxs("header",{className:"commissioning-header",children:[c.jsx("span",{className:"commissioning-eyebrow",children:t("chrome.commissioning.eyebrow")}),c.jsx("h2",{id:"commissioning-title",children:t("chrome.commissioning.title")}),c.jsx("p",{children:t("chrome.commissioning.lead")})]}),c.jsxs("ol",{className:"commissioning-steps",children:[c.jsxs("li",{className:`commissioning-step commissioning-step--primary ${f?"is-complete":"is-current"}`,children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:f?"✓":"01"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:t("chrome.commissioning.step1Title")}),c.jsx("p",{children:t("chrome.commissioning.step1Body")}),f?c.jsx(rh,{ref:_=>{l.current=_},className:"commissioning-primary-action",to:"/operations",onClick:cd,children:t("chrome.commissioning.goToOperationsArrow")}):c.jsx("button",{ref:_=>{l.current=_},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:p,children:e.addingTheater?t("chrome.commissioning.addingTheater"):t("chrome.commissioning.chooseFolder")}),e.theaterError?c.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:t("chrome.commissioning.step2Title")}),c.jsx("p",{children:t("chrome.commissioning.step2Body")}),c.jsx(rh,{className:"commissioning-secondary-link",to:"/operations",onClick:cd,children:t("chrome.commissioning.goToOperations")})]})]}),c.jsxs("li",{className:"commissioning-step",children:[c.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),c.jsxs("div",{className:"commissioning-step-body",children:[c.jsx("h3",{children:t("chrome.commissioning.step3Title")}),c.jsx("p",{children:t("chrome.commissioning.step3Body")})]})]})]}),c.jsxs("footer",{className:"commissioning-footer",children:[c.jsx("p",{children:t("chrome.commissioning.footer")}),c.jsx("button",{type:"button",className:"commissioning-skip",onClick:cd,children:t("chrome.commissioning.skip")})]})]}),c.jsx(SN,{open:i,onCancel:m,onConfirm:y})]})}function _ie(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(yie)),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()))}const O5=[{id:"triage",spotlight:{anchor:".command-band-triage-toggle",titleKey:"featureTour.triage.spotlightTitle",bodyKey:"featureTour.triage.spotlightBody"},walkthrough:[{anchor:".canvas-operation.is-triage-stage",titleKey:"featureTour.triage.step1Title",bodyKey:"featureTour.triage.step1Body"},{anchor:".canvas-triage-rail",titleKey:"featureTour.triage.step2Title",bodyKey:"featureTour.triage.step2Body"},{anchor:".command-band-triage-toggle",titleKey:"featureTour.triage.step3Title",bodyKey:"featureTour.triage.step3Body"}]}];function bie(){const e=na(),t=Ze(),[n,i]=g.useState(null),[s,o]=g.useState(0),[l,d]=g.useState(0),[f,p]=g.useState({left:0,top:0,centered:!0}),m=g.useRef(null),y=e.state?.seenFeatureTours??[];g.useEffect(()=>{const B=()=>d(T=>T+1),H=new MutationObserver(B);return H.observe(document.body,{attributeFilter:["aria-hidden","aria-modal","hidden","style"],attributes:!0,childList:!0,subtree:!0}),B(),window.addEventListener("resize",B),window.addEventListener("scroll",B,!0),()=>{H.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("scroll",B,!0)}},[]);const _=g.useMemo(()=>{if(l===0||!e.state||YI(document))return null;if(n){const B=O5.find(T=>T.id===n.tourId);if(!B||y.includes(th(B.id,n.phase)))return null;const H=n.phase==="spotlight"?B.spotlight&&M0(B.spotlight,document)?[B.spotlight]:[]:VI(B.walkthrough,document);return H.length>0?{tour:B,phase:n.phase,steps:H}:null}return Sie(O5,y,document)},[l,n,y,e.state]);g.useEffect(()=>{n||!_||(i({tourId:_.tour.id,phase:_.phase}),o(0))},[n,_]);const w=_?.steps[Math.min(s,Math.max(0,_.steps.length-1))]??null,S=w?M0(w,document):null;g.useLayoutEffect(()=>{if(!w)return;if(!S){p({left:window.innerWidth/2,top:window.innerHeight/2,centered:!0});return}return S.classList.add("is-feature-tour-anchor"),(()=>{const H=S.getBoundingClientRect(),T=m.current?.getBoundingClientRect(),$=T?.width??320,j=T?.height??180,M=12,V=12,Y=H.bottom+M,te=Y+j<=window.innerHeight-V?Y:Math.max(V,H.top-j-M),J=Math.min(window.innerWidth-$-V,Math.max(V,H.left+H.width/2-$/2));p({left:J,top:te,centered:!1})})(),()=>S.classList.remove("is-feature-tour-anchor")},[S,w,l]);const x=g.useCallback(async()=>{if(!_)return;const B=th(_.tour.id,_.phase),H=_.phase==="walkthrough"?KI(y,th(_.tour.id,"spotlight")):y;i(null),o(0),await wie(H,B,T=>Ss("seenFeatureTours",T))},[_,y]);if(!_||!w)return null;const k=s>=_.steps.length-1,C=f.centered?void 0:{left:f.left,top:f.top};return c.jsx("div",{className:`feature-tour-layer is-${_.phase} ${f.centered?"is-centered":""}`,"data-feature-tour-id":_.tour.id,"data-feature-tour-phase":_.phase,children:c.jsxs("section",{"aria-labelledby":"feature-tour-title",className:"feature-tour-card",ref:m,role:"dialog",style:C,children:[_.phase==="walkthrough"?c.jsx("span",{className:"feature-tour-progress",children:t("featureTour.progress",{current:s+1,total:_.steps.length})}):null,c.jsx("h2",{id:"feature-tour-title",children:t(w.titleKey)}),c.jsx("p",{children:t(w.bodyKey)}),c.jsxs("div",{className:"feature-tour-actions",children:[c.jsx("button",{className:"feature-tour-skip",onClick:()=>{x()},type:"button",children:t("featureTour.skip")}),_.phase==="spotlight"?c.jsx("button",{className:"feature-tour-primary",onClick:()=>{x()},type:"button",children:t("featureTour.gotIt")}):c.jsx("button",{className:"feature-tour-primary",onClick:()=>{k?x():o(B=>B+1)},type:"button",children:t(k?"featureTour.done":"featureTour.next")})]})]})})}function th(e,t){return`${e}.${t}`}function KI(e,t){return e.includes(t)?e:[...e,t].slice(-64)}async function wie(e,t,n){const i=KI(e,t);return i===e?e:(await n(i),i)}function VI(e,t){return e.filter(n=>n.anchor===null||t.querySelector(n.anchor)!==null)}function Sie(e,t,n){if(YI(n))return null;for(const i of e){if(t.includes(th(i.id,"walkthrough")))continue;const s=i.walkthrough.find(l=>l.anchor!==null);if(!s?.anchor||n.querySelector(s.anchor)===null)continue;const o=VI(i.walkthrough,n);if(o.length>0)return{tour:i,phase:"walkthrough",steps:o}}for(const i of e)if(!(!i.spotlight||t.includes(th(i.id,"spotlight")))&&M0(i.spotlight,n))return{tour:i,phase:"spotlight",steps:[i.spotlight]};return null}function M0(e,t){return e.anchor===null?null:t.querySelector(e.anchor)}function YI(e){return[...e.querySelectorAll('[aria-modal="true"]')].some(t=>{if(t.hidden||t.getAttribute("aria-hidden")==="true")return!1;const n=getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"})}let N0=null;function xie(e){N0=e}function kie(){const e=N0;return N0=null,e}function Cie(e){return[{id:"instrument",label:e("palette.theme.instrument")},{id:"maritime",label:e("palette.theme.maritime")},{id:"carbon",label:e("palette.theme.carbon")}]}function Eie(e){return e.startsWith(">")}function I5(e){return e.slice(1)}function Aie(e,t,n){const i=[],s=Rie(),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)Li(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-triage-mode",label:n("palette.toggleTriage"),current:!1,action:{kind:"toggle-triage-mode"}}),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:jl(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 Cie(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 Tie(e,t){const n=wS(t);return n.length===0?e:e.filter(i=>{const s=i.label.toLocaleLowerCase();return n.every(o=>s.includes(o))})}function Rie(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}async function XI(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}let n=null;try{n=(await w8(e)).deletion}catch{}return await Yi(null).then(tr).catch(()=>{}),n}const Mie="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",j5="operation-search-listbox",ZI="__unassigned__",D5="operation-search-heading-commands";function Nie({state:e,railPanels:t,plugins:n,onDeferredDeletion:i}){const s=Ze(),o=uu(),l=$r(),[d,f]=g.useState(""),[p,m]=g.useState(0),[y,_]=g.useState([]),w=g.useRef(null),S=g.useRef(null),x=g.useRef(null),k=g.useRef(new Map),C=g.useRef(0),B=Eie(d),H=g.useMemo(()=>$7(e),[e]),T=g.useMemo(()=>r7(H,d),[H,d]),$=g.useMemo(()=>s7(T),[T]),j=g.useMemo(()=>Aie(e,t,s),[e,t,s]),M=g.useMemo(()=>B?Tie(j,I5(d)):j,[B,j,d]),V=g.useMemo(()=>wS(B?I5(d):d),[B,d]),Y=g.useMemo(()=>y.flatMap(R=>R.results.map(q=>({group:R,result:q}))),[y]),te=B?M.length:T.length+Y.length,J=B5(p,te),P=B?M[J]?L0(M[J].commandId):void 0:T[J]?P5(T[J].operationId):Y[J-T.length]?$5(Y[J-T.length].group.panelId,Y[J-T.length].result.id):void 0,N=P===void 0?void 0:Vp(P);if(g.useEffect(()=>{const R=++C.current;_([]);const q=e.activeTheaterId;if(!e.operationSearchOpen||B||d.trim()===""||!q)return;const U=new AbortController,O=window.setTimeout(()=>{t7(t,d,q,U.signal).then(W=>{U.signal.aborted||R!==C.current||_(W)})},JP);return()=>{window.clearTimeout(O),U.abort()}},[B,d,t,e.activeTheaterId,e.operationSearchOpen,s]),g.useEffect(()=>{if(!e.operationSearchOpen)return;x.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const R=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>w.current?.focus(),0),()=>{document.body.style.overflow=R,x.current?.focus()}},[e.operationSearchOpen]),g.useEffect(()=>{if(!e.operationSearchOpen){f(""),m(0);return}m(0)},[e.operationSearchOpen,d]),g.useEffect(()=>{!e.operationSearchOpen||P===void 0||k.current.get(P)?.scrollIntoView({block:"nearest"})},[P,e.operationSearchOpen]),!e.operationSearchOpen)return null;const I=R=>{x.current=null,Ml(R),o("/operations"),ld()},D=async(R,q)=>{x.current=null;try{await q.activate()}catch{return}o("/operations"),A2(R),Yb(!0),ld()},E=R=>{const q=R.action;switch(q.kind){case"switch-theater":{if(R.current)break;x.current=null,xS(q.theaterId),o("/operations");break}case"new-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),GM();break}case"resume-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations");const U=e.operations.find(W=>W.id===q.operationId),O=U?n.find(W=>W.id===U.pluginId):void 0;O?.resumeOperation?Promise.resolve(O.resumeOperation(q.operationId)).catch(()=>{}):Ml(q.operationId);break}case"close-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),Br()===q.operationId&&Sr();const U=e.operations.find(W=>W.id===q.operationId),O=(U?n.find(W=>W.id===U.pluginId):null)??null;XI(q.operationId,O).then(W=>{mN(q.operationId),i?.(W)});break}case"minimize-all-operations":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),K_(e);const U=e.operations.filter(O=>O.theaterId===e.activeTheaterId);for(const O of U)_M(O.id);vM(U.map(O=>O.id));break}case"toggle-triage-mode":{l.pathname.startsWith("/operations")||o("/operations"),K_(e),e.activeTheaterId&&Qc(e.activeTheaterId,!_s(e.activeTheaterId));break}case"toggle-formation":{l.pathname.startsWith("/operations")||o("/operations"),K_(e),xM();break}case"toggle-status-axis":{l.pathname.startsWith("/operations")||o("/operations"),hm();break}case"open-rail-panel":{l.pathname.startsWith("/operations")||o("/operations"),A2(q.panelId),Yb(!0);break}case"toggle-rail":{l.pathname.startsWith("/operations")||o("/operations"),x.current=document.querySelector(".command-band-rail-toggle"),DS();break}case"toggle-sidebar":{l.pathname.startsWith("/operations")||o("/operations"),x.current=document.querySelector(".command-band-sidebar-toggle"),Ao(!lh().collapsed);break}case"switch-theme":{if(R.current)break;const U=e.activeTheme;Zc(q.theme),Ss("theme",q.theme).then(O=>{O||Zc(U)});break}case"open-settings":{x.current=null,o("/settings");break}case"open-keyboard-shortcuts":{xie(x.current),x.current=null,T7();break}case"rename-operation":case"assign-operation-group":case"set-operation-accent":case"minimize-operation":{x.current=null,l.pathname.startsWith("/operations")||o("/operations"),lh().collapsed&&Ao(!1),Oz(q.operationId,Lie(q.kind));break}case"whats-new":{VM();break}}ld()},L=R=>{if(R.key==="Escape"){R.preventDefault(),ld();return}if(R.key==="ArrowDown"||R.key==="ArrowUp"){R.preventDefault(),m(q=>B5(q+(R.key==="ArrowDown"?1:-1),te));return}if(R.key==="Enter"){if(B){const O=M[J];if(!O)return;R.preventDefault(),E(O);return}const q=T[J];if(q){R.preventDefault(),I(q.operationId);return}const U=Y[J-T.length];if(!U)return;R.preventDefault(),D(U.group.panelId,U.result);return}R.key==="Tab"&&Pie(R,S.current)};return c.jsx("div",{className:"operation-search-overlay",onMouseDown:R=>{R.target===R.currentTarget&&ld()},children:c.jsxs("section",{ref:S,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":s(B?"chrome.operationSearch.commandsDialog":"chrome.operationSearch.quickSearchDialog"),tabIndex:-1,onKeyDown:L,children:[c.jsxs("div",{className:"operation-search-field",children:[c.jsx($ie,{}),c.jsx("input",{ref:w,id:"operation-search-input",type:"search",value:d,onChange:R=>f(R.target.value),placeholder:s("chrome.operationSearch.placeholder"),autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":j5,"aria-activedescendant":N,"aria-autocomplete":"list",spellCheck:!1}),c.jsx("kbd",{children:"esc"})]}),c.jsx("div",{id:j5,className:"operation-search-results",role:"listbox","aria-label":s(B?"chrome.operationSearch.commandResults":"chrome.operationSearch.operationResults"),children:B?M.length>0?c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":D5,children:[c.jsx("h2",{id:D5,className:"operation-search-section-heading",children:s("chrome.operationSearch.commands")}),M.map((R,q)=>{const U=q===J,O=L0(R.commandId);return c.jsxs("button",{id:jie(R.commandId),ref:W=>{W?k.current.set(O,W):k.current.delete(O)},type:"button",className:`operation-search-result ${U?"is-active":""}`,role:"option","aria-selected":U,onMouseEnter:()=>m(q),onClick:()=>E(R),children:[c.jsx("span",{className:"operation-search-command-glyph","aria-hidden":"true",children:"›"}),c.jsx("span",{className:"operation-search-result-text",children:c.jsx("strong",{children:kc(R.label,V)})}),R.current?c.jsx("span",{className:"operation-search-theater",children:s("chrome.operationSearch.current")}):null]},R.commandId)})]}):c.jsx("p",{className:"operation-search-empty",children:s("chrome.operationSearch.noMatchingCommands")}):$.length>0||y.length>0?c.jsxs(c.Fragment,{children:[$.map(R=>{const q=Iie(R.theaterId);return c.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":q,children:[c.jsx("h2",{id:q,className:"operation-search-section-heading",children:kc(R.theaterLabel,V)}),R.entries.map(U=>{const O=T.indexOf(U),W=O===J,K=P5(U.operationId);return c.jsxs("button",{id:Vp(K),ref:z=>{z?k.current.set(K,z):k.current.delete(K)},type:"button",className:`operation-search-result ${W?"is-active":""}`,role:"option","aria-selected":W,onMouseEnter:()=>m(O),onClick:()=>I(U.operationId),children:[c.jsxs("span",{className:"operation-search-result-text",children:[c.jsx("strong",{children:kc(U.operationName,V)}),c.jsx("small",{children:Oie(U)})]}),U.activity!=="idle"?c.jsx("span",{className:`operation-search-status operation-search-status--${U.activity}`,children:U.activity}):null,c.jsx("span",{className:"operation-search-theater",children:kc(U.theaterLabel,V)})]},U.operationId)})]},R.theaterId??ZI)}),y.map(R=>{const q=Die(R.panelId);return c.jsxs("section",{className:"operation-search-section operation-search-panel-section",role:"group","aria-labelledby":q,children:[c.jsx("h2",{id:q,className:"operation-search-section-heading",children:R.panelTitle}),R.results.map(U=>{const O=T.length+Y.findIndex(z=>z.group.panelId===R.panelId&&z.result===U),W=O===J,K=$5(R.panelId,U.id);return c.jsxs("button",{id:Vp(K),ref:z=>{z?k.current.set(K,z):k.current.delete(K)},type:"button",className:`operation-search-result operation-search-panel-result ${W?"is-active":""}`,role:"option","aria-selected":W,onMouseEnter:()=>m(O),onClick:()=>{D(R.panelId,U)},children:[c.jsxs("span",{className:"operation-search-result-text",children:[c.jsx("strong",{children:kc(U.title,V)}),U.subtitle?c.jsx("small",{children:kc(U.subtitle,V)}):null]}),c.jsx("span",{className:"operation-search-panel-open",children:s("chrome.operationSearch.open")})]},U.id)})]},R.panelId)})]}):c.jsx("p",{className:"operation-search-empty",children:s("chrome.operationSearch.noMatching")})})]})})}function Lie(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 B5(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function K_(e){e.activeTheaterId&&sg()!==e.activeTheaterId&&bM(e.activeTheaterId)}function Oie(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function Iie(e){return`operation-search-heading-${W1(e??ZI)}`}function jie(e){return Vp(L0(e))}function Vp(e){return`operation-search-option-${W1(e)}`}function P5(e){return`operation:${e}`}function L0(e){return`command:${e}`}function $5(e,t){return`panel:${e}:${t}`}function Die(e){return`operation-search-heading-panel-${W1(e)}`}function W1(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function kc(e,t){if(t.length===0)return e;const n=[];let i=0;for(;i<e.length;){const s=Bie(e,t,i);if(!s){n.push(e.slice(i));break}s.start>i&&n.push(e.slice(i,s.start)),n.push(c.jsx("mark",{children:e.slice(s.start,s.end)},`${s.start}-${s.end}`)),i=s.end}return n}function Bie(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 Pie(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(Mie)).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 $ie(){return c.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:c.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function z5({open:e,title:t,message:n,tone:i="info",onDismiss:s,actionLabel:o,onAction:l,progress:d}){const f=Ze();return e?c.jsx("div",{className:"app-toast-host",children:c.jsxs("div",{className:`app-toast app-toast--${i}`,role:"status","aria-live":"polite",children:[c.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),c.jsxs("div",{className:"app-toast-body",children:[c.jsx("p",{className:"app-toast-title",children:t}),n?c.jsx("p",{className:"app-toast-message",children:n}):null,typeof d=="number"?c.jsx("span",{className:"app-toast-progress","aria-hidden":"true",children:c.jsx("span",{style:{transform:`scaleX(${Math.max(0,Math.min(1,d))})`}})}):null]}),o&&l?c.jsx("button",{type:"button",className:"app-toast-action",onClick:l,children:o}):null,s?c.jsx("button",{type:"button",className:"app-toast-close",onClick:s,"aria-label":f("chrome.toast.dismissNotification"),children:"×"}):null]})}):null}function zie(e,t){return[...e.filter(n=>n.deletionId!==t.deletionId),t]}function F5(e,t){return[...e].reverse().find(n=>n.expiresAt>t)??null}function Fie(e,t){return Math.max(1,Math.ceil((e.expiresAt-t)/1e3))}let Gc=null,Gd=0;function JI(e){Gc?.abort();const t=new AbortController,n=++Gd;return Gc=t,d7(),f8({...e,signal:t.signal}).then(i=>{n===Gd&&h7(i)}).catch(i=>{t.signal.aborted||n!==Gd||f7(i instanceof Error?i.message:String(i))}).finally(()=>{n===Gd&&(Gc=null)})}function Hie(){Gc!==null&&(Gc.abort(),Gc=null,Gd+=1)}function QI(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 Uie(e){return{id:"all-updates",label:e("whatsnew.tab.allUpdates")}}function Wie(e){return{id:"other-updates",label:e("whatsnew.tab.otherUpdates")}}function ej(e){const t=tj(),n=e.sections.some(s=>s.items.some(o=>o.product===void 0)),i=QI(t).filter(s=>e.sections.some(o=>o.items.some(l=>l.product===s.id)));return i.length===0?[V_(t),Uie(t)]:n?[V_(t),...i,Wie(t)]:[V_(t),...i]}function qie(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 Gie(e){const t=tj(),n=QI(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 Kie(e,t){return ej(e).some(n=>n.id===t)}function Vie(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function tj(){return xr(Vie())}const Yie=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Nd=10;function Xie({state:e}){const t=Ze(),n=g.useRef(null),i=g.useRef([]),s=g.useRef(null),o=g.useRef(null),l=g.useRef(new Map),[d,f]=g.useState("overview"),p=na(),m=jM(p.state?.language??"auto"),y=e.selectedReleaseNoteKey??Ld(e.releaseNotes[0]?.version??"",0),_=e.releaseNotes.findIndex((Y,te)=>Ld(Y.version,te)===y),w=e.releaseNotes[_]??e.releaseNotes[0],S=w?Ld(w.version,_>=0?_:0):"",x=w?ej(w):[];g.useEffect(()=>{f("overview")},[S]),g.useEffect(()=>{w&&!Kie(w,d)&&f("overview")},[d,w]),g.useEffect(()=>{const Y=te=>{const J=te.target instanceof HTMLElement?te.target:null;if(!J||J.closest(".whatsnew-card"))return;const P=i.current.filter(N=>N!==J&&N.isConnected);i.current=[...P.slice(-4),J]};return document.addEventListener("focusin",Y,!0),()=>document.removeEventListener("focusin",Y,!0)},[]);const k=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen||e.keyboardShortcutsOpen;if(e.whatsNewOpen&&!k&&n.current===null&&(n.current=document.activeElement),g.useEffect(()=>{if(!e.whatsNewOpen||k)return;const Y=te=>{tre(te)||(te.key==="Escape"?(te.preventDefault(),Vf()):ire(te,o.current,f)?te.preventDefault():te.key==="Tab"&&nre(te,o.current),te.stopImmediatePropagation())};return s.current?.focus(),window.addEventListener("keydown",Y,!0),()=>{window.removeEventListener("keydown",Y,!0);const te=n.current?.isConnected?n.current:[...i.current].reverse().find(J=>J.isConnected);n.current=null,te?.focus?.()}},[e.whatsNewOpen,k]),!e.whatsNewOpen||k||w===void 0)return null;const C=()=>{JI({force:!0,locale:m})},B=async Y=>{await Ss("language",Y)},H=Math.max(1,Math.ceil(e.releaseNotes.length/Nd)),T=Math.min(H-1,Math.floor((_>=0?_:0)/Nd)),$=T*Nd,j=e.releaseNotes.slice($,$+Nd),M=Y=>{const te=T+Y;if(te<0||te>=H)return;const J=te*Nd,P=e.releaseNotes[J];P&&a2(Ld(P.version,J))},V=Y=>{f(Y),requestAnimationFrame(()=>l.current.get(Y)?.focus())};return c.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[c.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Vf,"aria-label":t("chrome.whatsnew.closeAria")}),c.jsxs("section",{className:"whatsnew-card",ref:o,children:[c.jsxs("header",{className:"whatsnew-header",children:[c.jsxs("div",{className:"whatsnew-heading-row",children:[c.jsx("h2",{id:"whatsnew-title",children:t("chrome.whatsnew.title")}),c.jsxs("span",{className:"whatsnew-version-badge",children:["v",w.version]})]}),c.jsxs("div",{className:"whatsnew-meta-row",children:[w.date?c.jsx("time",{className:"whatsnew-date",dateTime:w.date,children:t("chrome.whatsnew.released",{date:w.date})}):c.jsx("span",{className:"whatsnew-date",children:t("chrome.whatsnew.unreleased")}),e.releaseNotesStale?c.jsx("span",{className:"whatsnew-stale",children:t("chrome.whatsnew.stale")}):null]})]}),c.jsx("button",{ref:s,type:"button",className:"whatsnew-close",onClick:Vf,"aria-label":t("chrome.whatsnew.closeAria"),children:"x"}),c.jsxs("div",{className:"whatsnew-body",children:[c.jsxs("div",{className:"whatsnew-version-selector",children:[c.jsx(qi,{label:t("chrome.whatsnew.releaseVersion"),className:"whatsnew-version-select",value:S,onChange:a2,options:j.map((Y,te)=>{const J=$+te,P=Y.version==="Unreleased"?t("chrome.whatsnew.versionUnreleased"):t("chrome.whatsnew.versionTagged",{version:Y.version});return{value:Ld(Y.version,J),label:`${P}${Y.date?` · ${Y.date}`:""}`}})}),H>1?c.jsxs("div",{className:"whatsnew-pagination",children:[c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(-1),disabled:T===0,"aria-label":t("chrome.whatsnew.newerVersions"),children:"‹"}),c.jsxs("span",{className:"whatsnew-page-status",children:[T+1," / ",H]}),c.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>M(1),disabled:T>=H-1,"aria-label":t("chrome.whatsnew.olderVersions"),children:"›"})]}):null,c.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":t("chrome.whatsnew.displayLanguage"),children:["en","ko"].map(Y=>c.jsx("button",{type:"button",className:m===Y?"is-active":"","aria-pressed":m===Y,disabled:p.savingField==="language",onClick:()=>{B(Y)},children:t(Y==="en"?"chrome.whatsnew.langEn":"chrome.whatsnew.langKo")},Y))}),c.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:C,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?t("chrome.whatsnew.refreshing"):t("common.refresh")})]}),c.jsx("div",{className:"whatsnew-tabs",role:"tablist","aria-label":t("chrome.whatsnew.releaseCategories"),children:x.map(Y=>c.jsx("button",{ref:te=>{te?l.current.set(Y.id,te):l.current.delete(Y.id)},id:`whatsnew-tab-${Y.id}`,type:"button",role:"tab",className:"whatsnew-tab","data-tab-id":Y.id,"aria-selected":d===Y.id,"aria-controls":"whatsnew-tab-panel",tabIndex:d===Y.id?0:-1,onClick:()=>f(Y.id),children:Y.label},Y.id))}),e.releaseNotesError?c.jsx("p",{className:"whatsnew-error",children:t("chrome.whatsnew.refreshError")}):null,c.jsx("div",{id:"whatsnew-tab-panel",role:"tabpanel","aria-labelledby":`whatsnew-tab-${d}`,children:d==="overview"?c.jsx("div",{className:"whatsnew-overview","aria-label":t("chrome.whatsnew.overviewAria"),children:Gie(w).map(Y=>c.jsxs("button",{type:"button",className:"whatsnew-overview-card",onClick:()=>V(Y.id),children:[c.jsx("span",{className:"whatsnew-overview-label",children:Y.label}),c.jsx("span",{className:"whatsnew-overview-count",children:t(Y.count===1?"chrome.whatsnew.updateCount_one":"chrome.whatsnew.updateCount_other",{count:Y.count})}),c.jsx("span",{className:"whatsnew-overview-summary",children:Y.summary})]},Y.id))}):qie(w,d).map((Y,te)=>c.jsx(Zie,{section:Y,index:te},Y.heading))})]}),c.jsx("footer",{className:"whatsnew-footer",children:c.jsx("button",{type:"button",className:"whatsnew-done",onClick:Vf,children:t("common.close")})})]})]})}function Zie({section:e,index:t}){const n=e.heading.toLowerCase().replaceAll(" ","-"),i={"--whatsnew-delay":`${t*55}ms`};return c.jsxs("section",{className:`whatsnew-section whatsnew-section--${n}`,style:i,children:[c.jsx("h3",{children:c.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),c.jsx("ul",{children:e.items.map((s,o)=>c.jsx("li",{children:c.jsx(Jie,{item:s})},`${s.text}:${o}`))})]})}function Jie({item:e}){return c.jsxs(c.Fragment,{children:[e.packageTags.map((t,n)=>c.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${n}`)),c.jsx("span",{children:e.text})]})}function Ld(e,t){return`${e}:${t}`}const Qie=new Set(["ArrowDown","ArrowUp","Enter"," "]);function ere(e){return e instanceof HTMLElement&&e.dataset.open==="true"}function tre(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&&ere(document.getElementById(i))?!0:Qie.has(e.key)}return!1}function nre(e,t){if(!t)return;const n=Array.from(t.querySelectorAll(Yie)),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 ire(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 nj(e=document){return e.querySelector('[aria-modal="true"]:not([hidden])')!==null}function rre(e,t=window){const n=i=>{if(!(kN()||nj(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 jh(e=()=>{}){return{...TR(e),notifications:{emit:n=>S7(n),dismiss:n=>j7(n)},status:{set:(n,i)=>b7(n,i),clear:n=>w7(n)}}}async function sre(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await are(t),ore(await t.json(),t.status).routes}async function are(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 Sn(e.status,t)}function ore(e,t){const n=e;if(!n||typeof n!="object"||!("version"in n)||!Array.isArray(n.routes))throw new Sn(t,"Invalid backend API catalog response");return{routes:n.routes.map(i=>lre(i,t))}}function lre(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 Sn(t,"Invalid backend API catalog entry");return{method:n.method,path:n.path,summary:n.summary,category:n.category,gate:n.gate}}const O0=new Set;let I0={loading:!1,state:null,error:null};function cre(){return g.useSyncExternalStore(ure,H5,H5)}function H5(){return I0}function ure(e){return O0.add(e),()=>{O0.delete(e)}}async function dre(e){Y_({loading:!0,error:null});try{const t=await sre(e);Y_({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;Y_({loading:!1,error:hre(t)})}}function Y_(e){I0={...I0,...e};for(const t of O0)t()}function hre(e){return e instanceof Error?e.message:String(e)}function fre(){const e=Ze(),t=cre(),[n,i]=g.useState(!0),s=g.useMemo(()=>yre(t.state??[],e("chrome.backendApi.uncategorized")),[t.state,e]),o=t.state?.length??0,l=s.length;return g.useEffect(()=>{const d=new AbortController;return dre(d.signal),()=>d.abort()},[]),c.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":e("chrome.backendApi.sectionAria"),children:[c.jsx("div",{className:`backend-api-control settings-disclosure-control ${n?"is-expanded":""}`,children:c.jsxs("div",{className:"settings-disclosure-head",children:[c.jsxs("div",{className:"backend-api-head",children:[c.jsx("p",{className:"global-settings-resp-title",children:e("chrome.backendApi.title")}),c.jsx("p",{className:"global-settings-help",children:o>0?e(pre(o,l),{count:o,categoryCount:l}):e("chrome.backendApi.emptyHelp")})]}),c.jsx("div",{className:"settings-disclosure-actions",children:c.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?c.jsx("p",{className:"global-settings-error",role:"alert",children:t.error}):null,t.loading&&!t.state?c.jsx("p",{className:"global-settings-help",children:e("chrome.backendApi.loading")}):null,n?c.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(d=>c.jsx(mre,{group:d},d.category)):null,t.state&&s.length===0?c.jsx("p",{className:"global-settings-help",children:e("chrome.backendApi.noRoutes")}):null]}):null,c.jsx("p",{className:"global-settings-foot",children:e("chrome.backendApi.foot")})]})}function pre(e,t){return`chrome.backendApi.routeSummary_${e===1?"one":"other"}_${t===1?"one":"other"}`}function mre({group:e}){return c.jsxs("div",{className:"backend-api-group",children:[c.jsxs("div",{className:"backend-api-group-head",children:[c.jsx("span",{children:e.category}),c.jsx("span",{children:e.entries.length})]}),c.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>c.jsx(gre,{entry:t},`${t.method}:${t.path}`))})]})}function gre({entry:e}){return c.jsxs("div",{className:"backend-api-row",children:[c.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),c.jsx("code",{className:"backend-api-path",children:e.path}),c.jsx("span",{className:"backend-api-summary",children:e.summary}),c.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function yre(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 vre(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 _re(e){return[{id:"dynamic",label:e("settings.port.dynamic")},{id:"static",label:e("settings.port.static")}]}function bre(e){return[{id:"auto",label:e("settings.language.auto")},{id:"en",label:e("settings.language.en")},{id:"ko",label:e("settings.language.ko")}]}function wre(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 Sre=1024,xre=65535;function kre(){const e=na(),t=e.state,n=e.savingField!==null,[i,s]=g.useState("general"),o=$r(),l=uu(),d=gu(),f=lg(),p=Ze(),m=wre(p),y=Are(d.plugins,f,p),_=Tre(y),w=S=>{s(S),l({pathname:"/settings",search:S==="general"?"":`?section=${encodeURIComponent(S)}`})};return g.useEffect(()=>{const S=new AbortController;return Q8(S.signal),()=>S.abort()},[]),g.useEffect(()=>{const S=new URLSearchParams(o.search).get("section"),x=new Set([...m.map(C=>C.id),...y.map(C=>C.id)]),k=S&&x.has(S)?S:"general";s(k),S&&S!==k&&l({pathname:"/settings",search:""},{replace:!0})},[o.search,l,m,y]),c.jsxs("main",{className:"global-settings-page",children:[c.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[c.jsxs("div",{children:[c.jsx("p",{className:"bridge-kicker",children:p("settings.kicker")}),c.jsx("h2",{id:"global-settings-title",children:p("settings.title")})]}),c.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:n?p("settings.saving"):""})]}),e.error?c.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,c.jsxs("section",{className:"global-settings-grid",children:[c.jsxs("div",{className:"global-settings-list","aria-label":p("settings.sectionsAria"),children:[c.jsx("p",{className:"global-settings-nav-group",children:p("settings.nav.console")}),m.map(S=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${S.id===i?"is-active":""}`,"aria-pressed":S.id===i,onClick:()=>w(S.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:S.label}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:S.eyebrow})]},S.id)),y.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"global-settings-nav-group",children:p("settings.nav.plugins")}),_.map(S=>c.jsxs("div",{className:"global-settings-plugin-group",children:[c.jsx("p",{className:"global-settings-plugin-heading",children:S.pluginLabel}),S.sections.map(x=>c.jsxs("button",{type:"button",className:`global-settings-nav-item ${x.id===i?"is-active":""}`,"aria-pressed":x.id===i,onClick:()=>w(x.id),children:[c.jsx("span",{className:"global-settings-nav-label",children:x.sectionTitle}),c.jsx("span",{className:"global-settings-nav-eyebrow",children:x.pluginLabel})]},x.id))]},S.pluginId))]}):null]}),c.jsx("div",{className:"global-settings-detail",children:Ere(i,t,n,y,p)},i)]})]})}function Cre({render:e}){return c.jsx(c.Fragment,{children:e()})}function Ere(e,t,n,i,s){if(e.includes(":")){const o=i.find(l=>l.id===e);return o?.render?c.jsx(nh,{fallback:c.jsx("div",{className:"fc-plugin-error",children:s("settings.pluginFailed")}),children:c.jsx(Cre,{render:o.render})}):c.jsx("p",{className:"global-settings-help",children:s("settings.pluginUnavailable")})}switch(e){case"general":return c.jsxs(c.Fragment,{children:[c.jsx(Mre,{state:t,saving:n}),c.jsx(Nre,{state:t,saving:n}),c.jsx(Lre,{state:t,saving:n})]});case"backend-api":return c.jsx(fre,{})}}function Are(e,t,n){return e.flatMap(i=>(i.settingsSections??[]).map(s=>({id:`${i.id}:${s.id}`,pluginId:i.id,pluginLabel:Rre(i.id,n),sectionTitle:jl(s.title,t),render:s.render})))}function Tre(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 Rre(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 Mre({state:e,saving:t}){const n=Ze(),i=vre(n),s=e?.theme??"instrument",o=l=>{if(Ii().savingField!==null)return;const d=s;Zc(l),Ss("theme",l).then(f=>{f||Zc(d)})};return c.jsxs("section",{className:"global-settings-card","aria-label":n("settings.theme.aria"),children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:n("settings.theme.title")}),c.jsx("p",{className:"global-settings-help",children:n("settings.theme.help")})]}),c.jsx("div",{className:"theme-picker",role:"group","aria-label":n("settings.theme.aria"),children:i.map(l=>{const d=l.id===s;return c.jsxs("button",{type:"button","aria-pressed":d,className:`theme-card ${d?"is-active":""}`,disabled:t,onClick:()=>o(l.id),children:[c.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:l.swatch.map(f=>c.jsx("i",{style:{background:f}},f))}),c.jsx("span",{className:"theme-card-label",children:l.label}),c.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:d?c.jsx(Dre,{}):null})]},l.id)})})]}),c.jsx("p",{className:"global-settings-foot",children:n("settings.theme.foot")})]})}function Nre({state:e,saving:t}){const n=Ze(),i=e?.uiFont??Kd,[s,o]=g.useState([]),[l,d]=g.useState(!0),[f,p]=g.useState(null);g.useEffect(()=>{const _=new AbortController;return WN({signal:_.signal}).then(w=>{o(w.fonts.filter(S=>S.uiSuitable).map(({family:S,monospace:x})=>({family:S,monospace:x}))),p(null)}).catch(w=>{if(!_.signal.aborted){o([]);const S=w instanceof ml;p(!S&&w instanceof Error?w.message:n("settings.typography.fontsLoadError"))}}).finally(()=>{_.signal.aborted||d(!1)}),()=>_.abort()},[n]);const m=_=>{if(Ii().savingField!==null)return;const w=i;Db(_),Ss("uiFont",_).then(S=>{S||Db(w)})},y=_=>{const w=_.source==="builtin"?{source:"builtin",id:_.id,size:i.size}:{source:"system",familyName:_.familyName,size:i.size};m(w)};return c.jsxs("section",{className:"global-settings-card","aria-label":n("settings.typography.aria"),children:[c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:n("settings.typography.title")}),c.jsx("p",{className:"global-settings-help",children:n("settings.typography.help")})]}),c.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||i.source==="builtin"&&i.id==="manrope"&&i.size===Pc.defaultValue,onClick:()=>m(Kd),children:n("settings.typography.reset")})]}),c.jsx(HN,{builtIns:am.map(({id:_,label:w,family:S,aliases:x})=>({id:_,label:w,family:S,aliases:x,description:n(H8[_])})),installedFonts:s,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:rM(Kd),previewText:n("settings.typography.preview"),size:i.size,sizeRange:Pc,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:_=>m({...i,size:_})}),c.jsx("p",{className:"global-settings-foot",children:n("settings.typography.foot")})]})}function Lre({state:e,saving:t}){const n=Ze(),i=Cs();return c.jsxs("section",{className:"global-settings-card","aria-label":n("settings.general.aria"),children:[e?c.jsxs(c.Fragment,{children:[c.jsx(jre,{state:e,saving:t,consoleState:i}),c.jsx(Ore,{state:e,saving:t}),c.jsx(Ire,{state:e,saving:t})]}):c.jsx("p",{className:"global-settings-help",children:n("settings.general.loading")}),c.jsx("p",{className:"global-settings-foot",children:n("settings.general.foot")})]})}function Ore({state:e,saving:t}){const n=Ze();return c.jsxs("div",{className:"global-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:n("settings.panelMotion.title")}),c.jsx("p",{className:"global-settings-help",children:n("settings.panelMotion.help")})]}),c.jsx("button",{type:"button","aria-pressed":e.reducePanelMotion,className:`global-settings-toggle ${e.reducePanelMotion?"is-on":""}`,disabled:t,onClick:()=>{Ss("reducePanelMotion",!e.reducePanelMotion)},children:n("settings.panelMotion.toggle")})]})}function Ire({state:e,saving:t}){const n=Ze(),i=bre(n);return c.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsx("p",{className:"global-settings-resp-title",children:n("settings.language.title")}),c.jsx("p",{className:"global-settings-help",children:n("settings.language.help")})]}),c.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 c.jsx("button",{type:"button","aria-pressed":o,className:`segmented-option ${o?"is-active":""}`,disabled:t,onClick:()=>{Ss("language",s.id)},children:s.label},s.id)})}),c.jsx("p",{className:"console-port-note",children:n("settings.language.note")})]})}function jre({state:e,saving:t,consoleState:n}){const i=Ze(),s=_re(i),[o,l]=g.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(),_=Number(y),w=y.length>0,S=w&&U5(_),x=e.consolePortMode==="static"&&w&&!S;return g.useEffect(()=>{l(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),c.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[c.jsxs("div",{className:"global-settings-row-text",children:[c.jsxs("p",{className:"global-settings-resp-title",children:[i("settings.port.title")," ",c.jsx("span",{className:"new-badge",children:i("settings.port.newBadge")})]}),c.jsx("p",{className:"global-settings-help",children:i("settings.port.help")})]}),c.jsxs("div",{className:"console-port-control",children:[c.jsx("div",{className:"segmented",role:"group","aria-label":i("settings.port.modeAria"),children:s.map(k=>{const C=e.consolePortMode===k.id;return c.jsx("button",{type:"button","aria-pressed":C,className:`segmented-option ${C?"is-active":""}`,disabled:t,onClick:()=>{Ss("consolePortMode",k.id)},children:k.label},k.id)})}),c.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:c.jsxs("div",{className:"console-port-reveal-inner",children:[c.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:i("settings.port.staticPort")}),c.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 C=k.target.value;l(C);const B=Number(C.trim());U5(B)&&Ss("consoleStaticPort",B)}}),c.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${x?"is-invalid":""}`,children:i("settings.port.hint")})]})}),c.jsxs("div",{className:`console-port-effective ${f?"is-fallback":""}`,"aria-live":"polite",children:[c.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),c.jsxs("div",{children:[c.jsx("p",{className:"console-port-effective-label",children:i("settings.port.currentlyReachable")}),c.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",c.jsx("span",{children:d||"..."}),f?i("settings.port.dynamicSuffix"):""]})]})]}),f&&p?c.jsxs("div",{className:"console-port-warning",role:"status",children:[t2(i("settings.port.fallback"),{port:c.jsx("strong",{children:p}),mode:c.jsx("strong",{children:i("settings.port.dynamic")}),host:c.jsx("strong",{children:`127.0.0.1:${d||"..."}`})})," ",m?t2(i("settings.port.nextRestartStatic"),{port:c.jsx("strong",{children:e.consoleStaticPort})}):i("settings.port.nextRestartDynamic")]}):null,c.jsx("p",{className:"console-port-note",children:i("settings.port.note")})]})]})}function U5(e){return Number.isInteger(e)&&e>=Sre&&e<=xre}function Dre(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Bre(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function Sh(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function Pre(e,t){return{...Bre(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const $re=600,W5=360,q5="cubic-bezier(0.4, 0.14, 0.2, 1)";function ij(e){if(typeof document>"u"||mS())return;const t=rj(e);if(!Ym(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=sj(e);Ym(i)&&aj(n,i.getBoundingClientRect(),()=>zre(i))})}function j0(e){if(typeof document>"u"||mS())return;const t=sj(e);if(!Ym(t))return;const n=t.getBoundingClientRect();window.requestAnimationFrame(()=>{const i=rj(e);Ym(i)&&aj(n,i.getBoundingClientRect())})}function rj(e){return document.querySelector(`.canvas-operation[data-operation-id="${Xm(e)}"]`)}function sj(e){return document.querySelector(`[data-side-bar-chip-id="${Xm(e)}"]`)}function Ym(e){if(!e)return!1;const t=e.getBoundingClientRect();return t.width<=0||t.height<=0?!1:getComputedStyle(e).visibility!=="hidden"}function Xm(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/["\\]/g,"\\$&")}function aj(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}=Fre();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 zre(e){e.classList.add("is-arrival-pulse"),window.setTimeout(()=>e.classList.remove("is-arrival-pulse"),$re)}function Fre(){try{const e=getComputedStyle(document.documentElement);return{duration:Hre(e.getPropertyValue("--duration-slow"))??W5,easing:e.getPropertyValue("--ease-glide").trim()||q5}}catch{return{duration:W5,easing:q5}}}function Hre(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 q1=g.createContext(null);function Ure(){return g.useContext(q1)!==null}function oj({operationId:e,config:t,className:n=""}){const i=g.useContext(q1);if(!i)throw new Error("OperationBodySlot must be rendered inside OperationBodyPool");const s=g.useRef(null),o=g.useRef(t);o.current=t,g.useLayoutEffect(()=>{i.publish(e,t)},[t,e,i]);const l=g.useCallback(d=>{if(d){s.current=d,i.attach(e,d);return}const f=s.current;s.current=null;const p=f?.clientWidth??0,m=f?.clientHeight??0;i.attach(e,null,p>0&&m>0?{width:p,height:m}:void 0,o.current.zoom)},[e,i]);return c.jsx("div",{className:n,ref:l,"data-operation-body-slot":e})}function Wre({operations:e,operationKinds:t,capabilities:n,defaultConfig:i,children:s}){const o=g.useRef(new Map),l=g.useRef(new Map),d=g.useRef(new Map),f=g.useRef(new Map),[p,m]=g.useState(0),y=g.useRef(null),_=g.useCallback(S=>{y.current!==S&&(y.current=S,m(x=>x+1))},[]),w=g.useMemo(()=>({publish(S,x){qre(o.current.get(S),x)||(o.current.set(S,x),m(k=>k+1))},attach(S,x,k,C){(l.current.get(S)??null)!==x&&(x?l.current.set(S,x):(l.current.delete(S),o.current.delete(S),k&&d.current.set(S,k),C!==void 0&&f.current.set(S,C)),m(H=>H+1))}}),[]);return c.jsxs(q1.Provider,{value:w,children:[s,c.jsx("div",{className:"operation-body-parking",ref:_,"aria-hidden":"true",inert:!0,children:e.map(S=>{const x=t.find($=>$.pluginId===S.pluginId&&$.type===S.type);if(!x?.render)return null;const k=o.current.get(S.id)??i(S),C=!l.current.has(S.id),B=f.current.get(S.id),H=C&&B!==void 0?{...k,zoom:B}:k,T=d.current.get(S.id)??{width:k.geometry.width,height:k.geometry.height};return c.jsx(Gre,{operation:S,descriptor:x,config:H,capabilities:n,slot:l.current.get(S.id)??y.current,parked:C,parkingSize:T,slotRevision:p},S.id)})})]})}function qre(e,t){return e?e.active===t.active&&e.keyboardFocusRequestId===t.keyboardFocusRequestId&&e.operation===t.operation&&e.geometry.x===t.geometry.x&&e.geometry.y===t.geometry.y&&e.geometry.width===t.geometry.width&&e.geometry.height===t.geometry.height&&e.geometry.zIndex===t.geometry.zIndex&&e.theme===t.theme&&e.language===t.language&&e.zoom===t.zoom&&e.onActivate===t.onActivate&&e.onClose===t.onClose&&e.onGeometryChange===t.onGeometryChange&&e.onRequestCompanions===t.onRequestCompanions&&e.companionsOpen===t.companionsOpen&&e.hiddenCompanionPanelIds===t.hiddenCompanionPanelIds&&e.onSetCompanionPanelVisible===t.onSetCompanionPanelVisible:!1}function Gre({operation:e,descriptor:t,config:n,capabilities:i,slot:s,parked:o,parkingSize:l}){const d=g.useMemo(()=>{const _=document.createElement("div");return _.className="operation-body-mount",_.dataset.operationBodyMount=e.id,_},[e.id]),f=g.useRef(n);f.current=n,g.useLayoutEffect(()=>{!s||d.parentElement===s||(o?(d.style.width=`${l.width}px`,d.style.height=`${l.height}px`):(d.style.removeProperty("width"),d.style.removeProperty("height")),s.appendChild(d))},[d,o,l.height,l.width,s]),g.useLayoutEffect(()=>()=>{d.remove()},[d]);const p=n,m=Ze(),y={operationId:e.id,theaterId:e.theaterId,pluginId:e.pluginId,type:e.type,operation:e,geometry:p.geometry,active:p.active,...p.keyboardFocusRequestId===void 0?{}:{keyboardFocusRequestId:p.keyboardFocusRequestId},zoom:p.zoom,theme:p.theme,language:p.language,api:i.api,lifecycle:i.lifecycle,terminal:i.terminal,notifications:i.notifications,operations:i.operations,preferences:i.preferences,settings:i.settings,status:i.status,onActivate:()=>f.current?.onActivate(),onClose:()=>f.current?.onClose(),onGeometryChange:_=>f.current?.onGeometryChange(_),onRequestCompanions:_=>f.current?.onRequestCompanions(_),companionsOpen:p.companionsOpen,hiddenCompanionPanelIds:p.hiddenCompanionPanelIds,onSetCompanionPanelVisible:(_,w)=>f.current?.onSetCompanionPanelVisible(_,w)};return ea.createPortal(c.jsx(nh,{fallback:c.jsx("div",{className:"fc-plugin-error",children:m("canvas.plugin.operationFailed")}),children:c.jsx(Kre,{render:t.render,context:y})}),d)}function Kre({render:e,context:t}){return c.jsx(c.Fragment,{children:e(t)})}const G5=256,K5=176,X_=12,_p=220,lj="fleet-console.map.radarCollapsed";function Vre({operations:e,pluginOperations:t,accents:n,viewport:i,canvasSize:s,onJump:o}){const l=Ze(),d=g.useRef(null),f=g.useRef(!1),p=g.useRef(null),[m,y]=g.useState(Yre),_=ag();if(g.useEffect(()=>{if(_){p.current===null&&(p.current=m,y(!0));return}p.current!==null&&(y(p.current),p.current=null)},[m,_]),s.width<=0||s.height<=0||i.zoom<=0)return null;const w=[...Object.entries(e).map(([L,R])=>({id:L,x:R.x,y:R.y,width:R.width,height:R.height})),...Object.entries(t).map(([L,R])=>({id:L,x:R.geometry.x,y:R.geometry.y,width:R.geometry.width,height:R.geometry.height}))];if(w.length===0)return null;const S=()=>{y(L=>{const R=!L;return _||Xre(R),R})};if(m)return c.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:c.jsx(Jre,{})});const x=G5-X_*2,k=K5-X_*2,C={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let B=Math.min(C.x,...w.map(L=>L.x)),H=Math.min(C.y,...w.map(L=>L.y)),T=Math.max(C.x+C.width,...w.map(L=>L.x+L.width)),$=Math.max(C.y+C.height,...w.map(L=>L.y+L.height));B-=_p,H-=_p,T+=_p,$+=_p;const j=T-B,M=$-H,V=Math.min(x/j,k/M),Y=(x-j*V)/2,te=(k-M*V)/2,J=L=>Y+(L-B)*V,P=L=>te+(L-H)*V,N=L=>{const R=d.current?.getBoundingClientRect();if(!R)return;const q=L.clientX-R.left,U=L.clientY-R.top;o({x:B+(q-Y)/V,y:H+(U-te)/V})},I=L=>{L.stopPropagation(),f.current=!0,L.currentTarget.setPointerCapture(L.pointerId),N(L)},D=L=>{f.current&&(L.stopPropagation(),N(L))},E=L=>{f.current=!1;try{L.currentTarget.releasePointerCapture(L.pointerId)}catch{}};return c.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:G5,height:K5},children:[c.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:l("canvas.minimap.label")}),c.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":l("canvas.minimap.collapse"),title:l("canvas.minimap.collapse"),children:c.jsx(Zre,{})}),c.jsxs("div",{ref:d,className:"canvas-minimap-inner",style:{inset:X_},onPointerDown:I,onPointerMove:D,onPointerUp:E,onPointerCancel:E,role:"presentation","aria-label":l("canvas.minimap.navigateAria"),children:[w.map(L=>c.jsx("div",{className:"canvas-minimap-operation",style:{left:J(L.x),top:P(L.y),width:Math.max(2,L.width*V),height:Math.max(2,L.height*V),...n?.[L.id]?{"--user-accent":n[L.id]}:{}}},L.id)),c.jsx("div",{className:"canvas-minimap-view",style:{left:J(C.x),top:P(C.y),width:C.width*V,height:C.height*V}})]})]})}function Yre(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(lj)==="true"}catch{return!1}}function Xre(e){if(!(typeof window>"u"))try{window.localStorage.setItem(lj,String(e))}catch{}}function Zre(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function Jre(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[c.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),c.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),c.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function Qre({viewport:e}){return c.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[c.jsx("div",{className:"operations-canvas-sea"}),c.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}function ese({active:e,entering:t,hasContent:n,idleCount:i}){const s=Ze();return!e||t||n?null:c.jsxs("div",{className:"canvas-triage-clear","data-canvas-blocker":!0,children:[c.jsx("span",{children:s("canvas.triage.clearMark")}),c.jsx("strong",{children:s("canvas.triage.clearTitle")}),c.jsx("p",{children:i>0?s("canvas.triage.clearBodyIdle",{count:i}):s("canvas.triage.clearBody")})]})}const tse=["n","ne","e","se","s","sw","w","nw"],Z_=320,J_=200,nse=1500;function ise({operation:e,active:t,unseen:n,geometry:i,zoom:s,status:o,minimized:l=!1,maximized:d=!1,renderHidden:f=!1,focusLayerTarget:p=!1,topEdge:m=!1,interactionDisabled:y=!1,triageStage:_=!1,triagePicked:w=!1,formationSlotIndex:S,accentKey:x=null,children:k,onActivate:C,onClose:B,onMinimize:H,onMaximize:T,onRename:$,onSetAccent:j,onGeometryChange:M,onGeometryCommit:V,onRenderHiddenFocus:Y}){const te=Ze(),J=g.useRef(null),P=g.useRef(null),N=g.useRef(null),I=g.useRef(null),D=g.useRef(null),E=g.useRef(null),L=g.useRef(i),R=g.useRef(!1),[q,U]=g.useState(null),[O,W]=g.useState(!1),[K,z]=g.useState(!1),G=e.title,Z=LS({currentTitle:e.title,onBegin:()=>{$e()},onCommit:_e=>{$(_e),R.current=!0}}),se=x?os(x):null,Se=["canvas-operation",n?"is-unseen":"",t?"is-active":"",l?"is-minimized":"",d?"is-maximized":"",_?"is-triage-stage":"",m?"is-top-edge":"",K?"is-dragging":"",sse(o)].filter(Boolean).join(" ");g.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]),g.useEffect(()=>{if(Z.renaming||!R.current)return;R.current=!1;const _e=window.requestAnimationFrame(()=>N.current?.focus());return()=>window.cancelAnimationFrame(_e)},[Z.renaming]),g.useEffect(()=>{const _e=P.current;if(!_e)return;const Ne=()=>{C()};return _e.addEventListener("pointerdown",Ne),()=>_e.removeEventListener("pointerdown",Ne)},[C]),g.useLayoutEffect(()=>{if(!f||typeof document>"u")return;const _e=q!==null;_e&&U(null),(_e||J.current?.contains(document.activeElement))&&Y?.()},[q,f,Y]);const pe=()=>{E.current!==null&&(window.clearTimeout(E.current),E.current=null)},$e=()=>{pe(),W(!1)},je=()=>{pe(),W(!0),E.current=window.setTimeout(()=>{E.current=null,W(!1)},nse)};g.useEffect(()=>{!d&&!y&&!l||(I.current=null,D.current=null,z(!1))},[d,y,l]);const St=()=>{!I.current&&!D.current||(I.current=null,D.current=null,z(!1))},Re=_e=>{$e(),!(d||y)&&_e.button===0&&(_e.preventDefault(),_e.stopPropagation(),C(),I.current={pointerId:_e.pointerId,startX:_e.clientX,startY:_e.clientY,geometry:i,latest:i},z(!0),_e.currentTarget.setPointerCapture(_e.pointerId))},ze=_e=>{if(d||y)return;const Ne=I.current;if(!Ne||Ne.pointerId!==_e.pointerId)return;_e.preventDefault(),_e.stopPropagation();const bt={...Ne.geometry,x:Ne.geometry.x+(_e.clientX-Ne.startX)/s,y:Ne.geometry.y+(_e.clientY-Ne.startY)/s};Ne.latest=bt,M(bt)},lt=_e=>{if(d||y){I.current=null,z(!1);return}const Ne=I.current;!Ne||Ne.pointerId!==_e.pointerId||(_e.preventDefault(),_e.stopPropagation(),I.current=null,z(!1),_e.currentTarget.releasePointerCapture(_e.pointerId),V(Ne.latest))},kt=(_e,Ne)=>{d||y||(Ne.preventDefault(),Ne.stopPropagation(),C(),D.current={direction:_e,pointerId:Ne.pointerId,startX:Ne.clientX,startY:Ne.clientY,geometry:i,latest:i},z(!0),Ne.currentTarget.setPointerCapture(Ne.pointerId))},mt=_e=>{if(d||y)return;const Ne=D.current;if(!Ne||Ne.pointerId!==_e.pointerId)return;_e.preventDefault(),_e.stopPropagation();const bt=rse(Ne.geometry,Ne.direction,(_e.clientX-Ne.startX)/s,(_e.clientY-Ne.startY)/s);Ne.latest=bt,M(bt)},Ct=_e=>{if(d||y){D.current=null,z(!1);return}const Ne=D.current;!Ne||Ne.pointerId!==_e.pointerId||(_e.preventDefault(),_e.stopPropagation(),D.current=null,z(!1),_e.currentTarget.releasePointerCapture(_e.pointerId),V(Ne.latest))},dt=_e=>{_e.stopPropagation()},gt=_e=>{_e.stopPropagation(),$e()},at=_e=>{_e.stopPropagation(),C()},Pt=_e=>{_e.stopPropagation()},Ut=()=>{$e();const _e=typeof document<"u"?document.activeElement:null;_e instanceof HTMLElement&&J.current?.contains(_e)&&_e.blur(),H()},tt=()=>{$e(),T?.()},cn=_e=>{$e(),C(),U(_e)},ke=_e=>{_e.stopPropagation(),$e(),C()},De=()=>{if(!O){je();return}$e(),B()},Xe=_e=>{_e.stopPropagation(),Z.begin()},_t=_e=>{_e.key!=="Enter"&&_e.key!=="F2"||(_e.preventDefault(),_e.stopPropagation(),Z.begin())},ht=_e=>{_e.key==="Escape"&&(R.current=!0),Z.handleKeyDown(_e)};l||(L.current=i);const nt=l?L.current:i,st={left:Math.round(nt.x),top:Math.round(nt.y),width:Math.round(nt.width),height:Math.round(nt.height),zIndex:nt.zIndex,...f?{visibility:"hidden",pointerEvents:"none"}:{},...se?{"--user-accent":se}:{}};return c.jsxs("article",{ref:J,className:Se,style:st,onPointerDown:C,"data-canvas-operation":!0,"data-operation-id":e.id,"data-focus-layer-target":p?"true":void 0,"aria-label":te("canvas.frame.operationAria",{title:G}),"aria-hidden":f||void 0,tabIndex:p?-1:void 0,inert:l||f?!0:void 0,children:[se?c.jsx("span",{className:"canvas-operation-spine","aria-hidden":"true"}):null,!d&&!y?c.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:Re,onPointerMove:ze,onPointerUp:lt,onPointerCancel:lt,onLostPointerCapture:St,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,c.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:Re,onPointerMove:ze,onPointerUp:lt,onPointerCancel:lt,onLostPointerCapture:St,"data-canvas-blocker":!0,children:[se?c.jsx("span",{className:"canvas-operation-id-mark","aria-hidden":"true"}):null,Z.renaming?c.jsx("input",{ref:Z.inputRef,className:"canvas-operation-identity-input",value:Z.draftTitle,"aria-label":te("canvas.frame.renameAria",{title:G}),onChange:_e=>Z.setDraftTitle(_e.target.value),onKeyDown:ht,onBlur:Z.handleBlur,onPointerDown:gt}):c.jsx("button",{ref:N,type:"button",className:"canvas-operation-identity-name",onPointerDown:gt,onDoubleClick:Xe,onKeyDown:_t,"aria-label":te("canvas.frame.renameAria",{title:G}),title:te("canvas.frame.renameTitle",{title:G}),children:G}),w?c.jsx("span",{className:"canvas-operation-triage-picked",children:te("canvas.triage.picked")}):null,S!==void 0?c.jsx("span",{className:"canvas-operation-formation-slot","aria-label":te("canvas.formation.slotAria",{index:S}),children:String(S).padStart(2,"0")}):null,j?c.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:dt,onClick:_e=>cn(_e.currentTarget.getBoundingClientRect()),"aria-label":te("canvas.frame.setAccentAria",{title:G}),"aria-haspopup":"menu",title:te("canvas.frame.setAccentTitle"),children:c.jsx("span",{className:V5(o),"aria-hidden":"true"})}):c.jsx("span",{className:V5(o),onPointerDown:ke,"aria-hidden":"true"}),c.jsxs("div",{className:"canvas-operation-window-controls",children:[c.jsx("span",{className:"canvas-operation-controls-divider","aria-hidden":"true"}),_?null:c.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:dt,onClick:Ut,"aria-label":te("canvas.frame.minimizeAria",{title:G}),title:te("canvas.frame.minimizeTitle"),children:c.jsx(ase,{})}),!_&&T?c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${d?"is-active":""}`,onPointerDown:dt,onClick:tt,"aria-label":d?te("canvas.frame.restoreAria",{title:G}):te("canvas.frame.maximizeAria",{title:G}),"aria-pressed":d,title:te(d?"canvas.frame.restoreTitle":"canvas.frame.maximizeTitle"),children:d?c.jsx(lse,{}):c.jsx(ose,{})}):null,c.jsx("button",{type:"button",className:`canvas-operation-icon-button ${O?"is-armed-close":""}`,onPointerDown:dt,onClick:De,"aria-label":O?te("canvas.frame.confirmCloseAria",{title:G}):te("canvas.frame.closeAria",{title:G}),title:te(O?"canvas.frame.confirmCloseTitle":"canvas.frame.closeTitle"),children:O?te("canvas.frame.closeArmed"):c.jsx(cse,{})})]})]}),c.jsx("div",{className:"canvas-operation-glance-hud","aria-hidden":"true",children:G}),c.jsx("div",{ref:P,className:"canvas-operation-terminal",onPointerDown:at,onWheel:Pt,"data-canvas-blocker":!0,children:k}),!d&&!y&&tse.map(_e=>c.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${_e}`,onPointerDown:Ne=>kt(_e,Ne),onPointerMove:mt,onPointerUp:Ct,onPointerCancel:Ct,onLostPointerCapture:St,"data-canvas-blocker":!0,"aria-hidden":"true"},_e)),q&&j?c.jsx(H$,{anchor:q,accentKey:x,onSelect:j,onClose:()=>U(null)}):null]})}function rse(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<Z_&&(t.includes("w")&&(s-=Z_-l),l=Z_),d<J_&&(t.includes("n")&&(o-=J_-d),d=J_),{...e,x:s,y:o,width:l,height:d}}function sse(e){const t=Eh(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function V5(e){const t=Eh(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 ase(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function ose(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function lse(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function cse(){return c.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:c.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function use(e,t){return e.some(n=>!t.has(n.id))}function dse({activeTheaterId:e,theaterLabel:t,operations:n,canLaunch:i,onOpenOperation:s,onNewOperation:o}){const l=Ze();if(!e)return c.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[c.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),c.jsx("p",{children:l("canvas.empty.noTheater")})]});const d=[...n].sort((p,m)=>m.ts.updatedAt-p.ts.updatedAt).slice(0,2),f=n.length;return c.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[f>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"operations-canvas-empty-ghost",children:l(f===1?"canvas.empty.standingBy_one":"canvas.empty.standingBy_other",{count:f})}),c.jsx("div",{className:"operations-canvas-empty-standby",children:d.map(p=>c.jsxs("button",{type:"button",className:"operations-canvas-empty-standby-chip","aria-label":l("canvas.empty.openOperation",{title:p.title}),onClick:()=>s(p.id),children:[c.jsx("span",{className:"operations-canvas-empty-standby-title",children:p.title}),c.jsx("span",{className:"operations-canvas-empty-standby-open","aria-hidden":"true",children:l("canvas.empty.open")})]},p.id))})]}):c.jsx("p",{className:"operations-canvas-empty-headline",children:l("canvas.empty.headline")}),c.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")}),c.jsxs("p",{className:"operations-canvas-empty-hints",children:[c.jsx("kbd",{children:"⌘K"})," ",l("canvas.empty.hintSearch")," ",c.jsx("span",{"aria-hidden":"true",children:"·"})," ",c.jsx("kbd",{children:"Alt+F"})," ",l("canvas.empty.hintFormation")," ",c.jsx("span",{"aria-hidden":"true",children:"·"})," ",c.jsx("kbd",{children:"Alt+S"})," ",l("canvas.empty.hintStatusBoard")," ",c.jsx("span",{"aria-hidden":"true",children:"·"})," ",c.jsx("kbd",{children:"Alt+T"})," ",l("canvas.empty.hintTriage")]}),c.jsx("p",{className:"operations-canvas-empty-guide",children:l("canvas.empty.guide")})]})}function hse({rect:e,viewport:t}){const n=Pre(e,t);return c.jsx("div",{className:"canvas-rubber-band",style:{left:n.x,top:n.y,width:n.width,height:n.height},"aria-hidden":"true"})}const fse=.25,pse=2,mse=200,gse=150,Y5=5,yse=.0018;function vse({viewport:e,disabled:t=!1,consumePointerDown:n=!1,onViewportChange:i,onZoom:s,onCreate:o,onConsumePointerDown:l,onClick:d}){const f=g.useRef(null),p=g.useRef(e),[m,y]=g.useState(null),[_,w]=g.useState(!1),[S,x]=g.useState(!1);g.useEffect(()=>{p.current=e},[e]),g.useEffect(()=>{const j=V=>{V.key==="Shift"&&x(!0),!_se(V.target)&&V.code==="Space"&&(V.preventDefault(),w(!0))},M=V=>{V.key==="Shift"&&x(!1),V.code==="Space"&&w(!1)};return window.addEventListener("keydown",j),window.addEventListener("keyup",M),()=>{window.removeEventListener("keydown",j),window.removeEventListener("keyup",M)}},[]);const k=j=>{if(t||X5(j.target)||j.button!==0&&j.button!==1)return;if(j.preventDefault(),n){l?.();return}const M=eb(j),V=j.shiftKey&&j.button===0&&!_?"create":"pan";f.current={pointerId:j.pointerId,mode:V,startScreen:M,currentScreen:M,startViewport:p.current},j.currentTarget.setPointerCapture(j.pointerId),V==="create"&&y(Q_(M,M,p.current))},C=j=>{const M=f.current;if(!M||M.pointerId!==j.pointerId)return;j.preventDefault();const V=eb(j);if(f.current={...M,currentScreen:V},M.mode==="pan"){i({...M.startViewport,x:M.startViewport.x+V.x-M.startScreen.x,y:M.startViewport.y+V.y-M.startScreen.y});return}y(Q_(M.startScreen,V,p.current))},B=j=>{$(j,!0)},H=j=>{$(j,!1)},T=j=>{if(t||X5(j.target))return;j.preventDefault();const M=eb(j),V=p.current,Y=bse(V.zoom*Math.exp(-j.deltaY*yse),fse,pse),te=Sh(M,V);s({x:M.x-te.x*Y,y:M.y-te.y*Y,zoom:Y})},$=(j,M)=>{const V=f.current;if(!V||V.pointerId!==j.pointerId||(f.current=null,j.currentTarget.releasePointerCapture(j.pointerId),y(null),!M))return;const Y=Math.abs(V.currentScreen.x-V.startScreen.x),te=Math.abs(V.currentScreen.y-V.startScreen.y);if(Y<Y5&&te<Y5){d?.();return}if(V.mode!=="create")return;const J=Q_(V.startScreen,V.currentScreen,p.current),P={x:J.x,y:J.y,width:Math.max(J.width,mse),height:Math.max(J.height,gse)};o(P,V.currentScreen)};return{rubberBand:m,spaceActive:_,shiftActive:S,onPointerDown:k,onPointerMove:C,onPointerUp:B,onPointerCancel:H,onWheel:T}}function Q_(e,t,n){const i=Sh(e,n),s=Sh(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 eb(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function X5(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function _se(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function bse(e,t,n){return Math.min(n,Math.max(t,e))}function D0(e,t,n,i,s){const o=Math.max(1,n),l=Math.max(0,(e.width-i*(o-1))/o);return{x:e.x+t*(l+i),y:e.y,width:l,height:Math.max(0,e.height),zIndex:s}}function Z5(e,t,n=0,i=1){return D0({x:18,y:18,width:Math.max(320,e.width-36),height:Math.max(240,e.height-84)},n,i,8,t)}const wse=560,Sse=360,xse=12;function kse({state:e,catalog:t,canLaunch:n,renderKindIcon:i,onLaunchKind:s,onLaunchAtGeometry:o,onClose:l,onFocus:d,onRename:f,onSetAccent:p}){const m=g.useRef(null),y=Ze(),_=cS(),w=pM(),S=ag(),x=hM(),k=fM(),C=uP(k),B=g.useRef(null),H=mM(),T=g.useSyncExternalStore(IM,Bo,Bo),$=e.activeOperationId,[j,M]=g.useState(null),V=gu(),Y=na(),te=sr(Y.state?.language??"auto"),[J,P]=g.useState({width:0,height:0}),N=Mse(),I=!e.activeTheaterId||e.addingTheater,D=Ure(),E=fN(e.activeTheaterId);g.useSyncExternalStore(gN,p2,p2);const[L,R]=g.useState(!1),[q,U]=g.useState(!1),[,O]=g.useState(0),W=g.useRef(null),K=g.useRef(null),z=g.useRef(null),G=g.useRef(null),Z=g.useRef(null),se=g.useRef({theaterId:null,operations:[],operationStatus:{}});g.useEffect(()=>{const oe=m.current;if(!oe||typeof ResizeObserver>"u")return;const qe=()=>P({width:oe.clientWidth,height:oe.clientHeight});qe();const ot=new ResizeObserver(qe);return ot.observe(oe),()=>ot.disconnect()},[]),g.useEffect(()=>{if(!E||!e.activeTheaterId){R(!1);return}const oe=g$(e.activeTheaterId)??Date.now(),qe=Math.max(0,1900-(Date.now()-oe));if(R(qe>0),qe===0)return;const ot=window.setTimeout(()=>R(!1),qe);return()=>window.clearTimeout(ot)},[e.activeTheaterId,E]),g.useEffect(()=>{if(!E)return;const oe=()=>O(qe=>qe+1);return document.addEventListener("focusin",oe),document.addEventListener("focusout",oe),()=>{document.removeEventListener("focusin",oe),document.removeEventListener("focusout",oe)}},[E]),g.useEffect(()=>{if(!S||!e.activeTheaterId){U(!1);return}U(!0);const oe=window.setTimeout(()=>{U(!1)},1950);return()=>window.clearTimeout(oe)},[S,e.activeTheaterId]);const Se=vse({viewport:_.viewport,disabled:I||S||k!==null||E,onViewportChange:Tb,onZoom:gM,onCreate:oe=>{if(M(null),e.activeTheaterId&&n){const qe=Nse(t);if(!qe)return;const ot={...Ase(oe),zIndex:Rl()};o(qe.pluginId,qe.kind,ot)}},consumePointerDown:j!==null,onConsumePointerDown:()=>{M(null)},onClick:Ese}),pe=(oe,qe)=>{const ot=j?.canvasPoint;M(null),ot&&s(oe,qe,ot)},$e=oe=>{if(oe.target instanceof Element&&oe.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;oe.preventDefault();const qe=m.current?.getBoundingClientRect();if(!qe)return;const ot={x:oe.clientX-qe.left,y:oe.clientY-qe.top};M({anchor:ot,canvasPoint:Sh(ot,_.viewport)})},je=new Set(H),St=Object.fromEntries(Object.entries(_.operations).filter(([oe])=>!je.has(oe))),Re=(e.operations??[]).filter(oe=>oe.theaterId===e.activeTheaterId);se.current={theaterId:e.activeTheaterId,operations:Re,operationStatus:e.operationStatus};const ze=e.activeTheaterId?vN(e.activeTheaterId,Re,e.operationStatus):[],lt=new Set(ze.map(oe=>oe.operation.id)),kt=Re.filter(oe=>Li(oe,e.operationStatus)==="idle"&&!lt.has(oe.id)).length,mt=ze[0]??null,Ct=W.current,dt=Ct?Re.find(oe=>oe.id===Ct)??null:null,gt=Ct?m.current?.querySelector(`.canvas-operation[data-operation-id="${Xm(Ct)}"]`)??null:null,at=gt!==null&&typeof document<"u"&&document.activeElement instanceof Node&&gt.contains(document.activeElement)&&!Wv(Ct),Pt=dt?Li(dt,e.operationStatus):null,Ut=dt!==null&&Np(dt,e.operationStatus),tt=dt!==null&&K.current?.theaterId===e.activeTheaterId&&K.current.operationId===dt.id&&Pt!==null&&m2(K.current.activity,Pt),cn=z.current?.theaterId===e.activeTheaterId?z.current.operationId:null,ke=tt?dt:cn?Re.find(oe=>oe.id===cn)??null:null,De=ke?{operation:ke,activity:Li(ke,e.operationStatus),picked:Uv(e.activeTheaterId??"")===ke.id}:null,Xe=at&&dt&&Ut&&!v$(dt.id)?{operation:dt,activity:Pt,picked:!1}:null,_t=De??Xe,ht=mt?.picked===!0&&mt.operation.id!==_t?.operation.id,nt=_t&&!ht&&mt?.operation.id!==_t.operation.id?[_t,...ze.filter(oe=>oe.operation.id!==_t.operation.id)]:ze,st=E?nt[0]??null:null,_e=st?.operation.id??null;g.useEffect(()=>{e.activeOperationId&&je.has(e.activeOperationId)&&(!E||e.activeOperationId!==_e)&&_i(null)},[H,e.activeOperationId,E,_e]),g.useEffect(()=>{if(!E||!e.activeTheaterId||!_e){G.current=null;return}const oe={theaterId:e.activeTheaterId,operationId:_e};if(G.current?.theaterId===oe.theaterId&&G.current.operationId===oe.operationId)return;G.current=oe;const qe=window.requestAnimationFrame(()=>{if(document.querySelector(".feature-tour-layer")||jse(document))return;const ot=document.activeElement;ot instanceof HTMLElement&&ot.closest(".canvas-operation")&&ot.matches("input, textarea, [contenteditable='true']")&&!ot.closest(".xterm")||(_i(_e,{acknowledged:!1}),Ea(_e))});return()=>window.cancelAnimationFrame(qe)},[e.activeTheaterId,E,_e]),g.useLayoutEffect(()=>{if(!E||!e.activeTheaterId){Z.current=null;return}Z.current=w$(Z.current,{theaterId:e.activeTheaterId,operationId:_e})},[e.activeTheaterId,E,_e]),g.useEffect(()=>{if(!E||!e.activeTheaterId){z.current?.cancel(),z.current=null,W.current=null,K.current=null;return}const oe=z.current;if(oe?.theaterId===e.activeTheaterId){const ot=Re.find(On=>On.id===oe.operationId),an=Uv(e.activeTheaterId),$t=an!==null&&an!==oe.operationId;if(!ot||Np(ot,e.operationStatus)||$t){if(oe.cancel(),z.current=null,$t){W.current=_e,K.current=st?{theaterId:e.activeTheaterId,operationId:st.operation.id,activity:Li(st.operation,e.operationStatus)}:null;return}}else{W.current=oe.operationId;return}}const qe=K.current;if(qe?.theaterId===e.activeTheaterId){const ot=Re.find(an=>an.id===qe.operationId);if(ot&&!Wv(qe.operationId)){const an=Li(ot,e.operationStatus);if(m2(qe.activity,an)){const $t=e.activeTheaterId,On=qe.operationId,Si=b$($t,On,()=>{const Ge=se.current,Q=Ge.operations.find(Be=>Be.id===On),ve=Uv($t);return Ge.theaterId===$t&&_s($t)&&Q!==void 0&&!Wv(On)&&!Np(Q,Ge.operationStatus)&&(ve===null||ve===On)},()=>{z.current=null,W.current=null,K.current=null});z.current={theaterId:$t,operationId:On,cancel:Si},W.current=On;return}}}W.current=_e,K.current=st?{theaterId:e.activeTheaterId,operationId:st.operation.id,activity:Li(st.operation,e.operationStatus)}:null},[e.activeTheaterId,e.operationStatus,Re,E,st]),g.useEffect(()=>()=>{z.current?.cancel(),z.current=null},[]);const Ne=V.operationKinds,Nt=x!==null&&Re.some(oe=>oe.id===x&&!je.has(oe.id))?x:null,hn=k===null?void 0:Re.find(oe=>oe.id===k&&!je.has(oe.id)),le=hn?Ne.find(oe=>oe.pluginId===hn.pluginId&&oe.type===hn.type):void 0;k===null&&(B.current=null),hn&&le?.companions?.length&&(B.current={operation:hn,descriptor:le});const me=!hn&&B.current?.operation.id===k?B.current:null,re=hn??me?.operation,Te=(le??me?.descriptor)?.companions??[],We=Te.filter(oe=>C[oe.id]??!oe.defaultHidden),ee=Te.filter(oe=>!We.includes(oe)).map(oe=>oe.id),he=re&&Te.length>0?re.id:null,Ee=hn&&le?.companions?.length?hn.id:null,Ve=re&&!Re.some(oe=>oe.id===re.id)?[...Re,re]:Re,Rt=E?st!==null:use(Ve,je);g.useEffect(()=>{if(k===null||Ee!==null)return;const oe=setTimeout(()=>{B.current=null,Sr()},1500);return()=>clearTimeout(oe)},[k,Ee]);const ct=CS(Re,e.groups.filter(oe=>oe.theaterId===e.activeTheaterId),_.operationOrder,[]).filter(oe=>!je.has(oe.id)).map(oe=>oe.id),Pe=w==="grid"?Dse(ct.length):ct.length,Ie={x:18,y:18,width:Math.max(0,J.width-36),height:Math.max(0,J.height-36)},it=S?pP({x:0,y:0,width:J.width,height:J.height},Pe,void 0,void 0,void 0,18,w):[],Zt=it.slice(0,ct.length),xt=w==="grid"?it.slice(ct.length):[],Fn=new Map(ct.map((oe,qe)=>[oe,Zt[qe]])),Xn=new Map(ct.map((oe,qe)=>[oe,qe+1]));g.useEffect(()=>{if(!S||mS())return;const oe=m.current;if(!oe)return;const qe=ct.map($t=>oe.querySelector(`.canvas-operation[data-operation-id="${Xm($t)}"]`)).filter($t=>$t!==null);qe.forEach(($t,On)=>{$t.style.setProperty("--panel-stagger-delay",`${On*40}ms`),$t.style.setProperty("--li",String(On))});const ot=()=>{for(const $t of qe)$t.style.removeProperty("--panel-stagger-delay"),$t.style.removeProperty("--li")},an=window.setTimeout(ot,1950);return()=>{window.clearTimeout(an),ot()}},[S,w]);const pi=Nt||he||S||E?1:_.viewport.zoom,fn=Rse(_.operations)+1,Kt=We.length+1;return c.jsxs("main",{className:`operations-canvas ${Se.spaceActive?"is-panning":""} ${Se.shiftActive?"is-creating":""} ${N?"is-glance":""} ${Nt?"is-panel-maximized":""} ${he?"is-companion-layout":""} ${S?"is-formation-view":""} ${q?"is-formation-entering":""} ${E?"is-triage":""} ${L?"is-triage-entering":""}`,onPointerDown:Se.onPointerDown,onPointerMove:Se.onPointerMove,onPointerUp:Se.onPointerUp,onPointerCancel:Se.onPointerCancel,onWheel:Se.onWheel,onContextMenu:$e,ref:m,tabIndex:-1,children:[c.jsx(Qre,{viewport:_.viewport}),E?c.jsx("div",{className:"canvas-triage-scan","aria-hidden":"true"}):null,c.jsxs("div",{style:{transform:Nt||he||S||E?"none":`translate(${Math.round(_.viewport.x)}px, ${Math.round(_.viewport.y)}px) scale(${_.viewport.zoom})`},className:"operations-canvas-world",children:[S?xt.map((oe,qe)=>c.jsx("div",{className:"canvas-formation-guide",style:{left:Math.round(oe.x),top:Math.round(oe.y),width:Math.round(oe.width),height:Math.round(oe.height),"--gi":qe},"aria-label":y("canvas.formation.slotAria",{index:ct.length+qe+1}),children:c.jsx("span",{className:"canvas-formation-guide-index",children:String(ct.length+qe+1).padStart(2,"0")})},`formation-guide-${ct.length+qe+1}`)):null,Ve.map(oe=>{const qe=_.operations[oe.id]??oe.geometry??tb(oe),ot=Nt===oe.id,an=he===oe.id,$t=_e===oe.id,On=E?!$t:(Nt!==null||he!==null)&&!ot&&!an,Si=Fn.get(oe.id),Ge=$t?Z5(J,fn,0,E&&an?Kt:1):ot?Tse(J,fn):an?S?D0(Ie,0,Kt,8,fn):J5(J,0,Kt,fn):Si?{...qe,...Si}:qe,Q=!$t&&!ot&&!an&&!Si&&_.viewport.y+Ge.y*pi<xse*pi;return Lse(oe,{active:$===oe.id,unseen:T.has(oe.id),keyboardFocusRequestId:e.keyboardFocusRequest?.operationId===oe.id?e.keyboardFocusRequest.requestId:0,geometry:Ge,topEdge:Q,operationKindRegistry:Ne,status:e.operationStatus[oe.id],theme:e.activeTheme,language:te,viewportZoom:pi,minimized:E?!$t:je.has(oe.id),maximized:ot,triageStage:$t,triagePicked:$t&&st?.picked===!0,formationSlotIndex:S?Xn.get(oe.id):void 0,companion:an,companions:an?We:[],companionGeometries:an?We.map((ve,Be)=>E?Z5(J,fn,Be+1,Kt):S?D0(Ie,Be+1,Kt,8,fn):J5(J,Be+1,Kt,fn)):[],hiddenCompanionPanelIds:an?ee:[],formation:S||E,focusLayerHidden:On,operationBodyPoolAvailable:D,onRenderHiddenFocus:()=>{const ve=m.current?.querySelector("[data-focus-layer-target='true']");if(ve){ve.focus();return}m.current?.focus()},accentKey:_.operationAccent[oe.id]??eR(oe),onActivate:()=>{_i(oe.id),!ot&&!an&&!S&&Rb(oe.id,_.operations[oe.id]??oe.geometry??tb(oe))},onClose:()=>{E&&e.activeTheaterId&&pN(e.activeTheaterId,oe.id),e.activeOperationId===oe.id&&_i(null),Nt===oe.id&&Do(),he===oe.id&&Sr(),l(oe.id)},onMinimize:()=>{e.activeOperationId===oe.id&&_i(null),ij(oe.id),yM(oe.id)},onMaximize:()=>{ot?Do():(_i(oe.id),uS(oe.id))},onRename:ve=>{f(oe.id,ve)},onSetAccent:ve=>{p(oe.id,ve)},onGeometryChange:ve=>{!ot&&!an&&!S&&Rb(oe.id,ve)},onGeometryCommit:ve=>{!ot&&!an&&!S&&Ise(oe.id,Fs().operations[oe.id]??ve)}})})]}),S?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"canvas-mode-frame","aria-hidden":"true",children:[c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--nw"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--ne"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--sw"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--se"})]}),q?c.jsxs("div",{className:"canvas-mode-curtain canvas-formation-curtain","aria-hidden":"true",children:[c.jsx("span",{className:"canvas-mode-curtain-kicker",children:y("canvas.formation.curtainKicker")}),c.jsx("span",{className:"canvas-mode-curtain-ruler"}),c.jsx("strong",{children:y("canvas.formation.curtainTitle")}),c.jsx("span",{children:y("canvas.formation.curtainBody",{count:ct.length})})]}):null]}):null,E?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"canvas-mode-frame","aria-hidden":"true",children:[c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--nw"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--ne"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--sw"}),c.jsx("span",{className:"canvas-mode-bracket canvas-mode-bracket--se"})]}),c.jsxs("div",{className:"canvas-triage-rail","data-canvas-blocker":!0,children:[st?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"canvas-triage-rail-current",children:[c.jsx("span",{className:"canvas-triage-rail-current-label",children:y("canvas.triage.railCurrent")}),c.jsx("span",{"aria-hidden":"true",children:"▸"}),c.jsx("span",{className:"canvas-triage-rail-current-name",title:st.operation.title,children:st.operation.title})]}),c.jsx("span",{className:"canvas-triage-rail-divider","aria-hidden":"true"})]}):null,c.jsxs("div",{className:"canvas-triage-rail-next",children:[c.jsx("span",{className:"canvas-triage-rail-lead",children:y("canvas.triage.railLead")}),c.jsx("span",{"aria-hidden":"true",children:"▸"}),c.jsx("div",{className:"canvas-triage-rail-track",children:nt.slice(1).length>0?nt.slice(1).map(oe=>c.jsx("button",{type:"button",onClick:()=>e.activeTheaterId&&eu(e.activeTheaterId,oe.operation.id),children:oe.operation.title},oe.operation.id)):c.jsx("span",{className:"canvas-triage-rail-empty",children:y("canvas.triage.railEmpty")})})]}),c.jsx("span",{className:"canvas-triage-rail-cleared",children:y("canvas.triage.railCleared",{count:e.activeTheaterId?p$(e.activeTheaterId):0})})]}),L?c.jsx("div",{className:"canvas-triage-sweep","aria-hidden":"true"}):null,L?c.jsxs("div",{className:"canvas-mode-curtain canvas-triage-curtain","aria-hidden":"true",children:[c.jsx("span",{className:"canvas-mode-curtain-kicker",children:y("canvas.triage.curtainKicker")}),c.jsx("span",{className:"canvas-mode-curtain-ruler"}),c.jsx("strong",{children:y("canvas.triage.curtainTitle")}),c.jsx("span",{children:ze.length>0?y("canvas.triage.curtainBody",{waiting:ze.length,stowed:Math.max(0,Re.length-1)}):y("canvas.triage.curtainBodyEmpty",{stowed:Re.length})})]}):null]}):null,c.jsx(ese,{active:E,entering:L,hasContent:Rt,idleCount:kt}),!E&&!Rt&&!q?c.jsx(dse,{activeTheaterId:e.activeTheaterId,theaterLabel:e.theaters.find(oe=>oe.id===e.activeTheaterId)?.label??e.activeTheaterId??"",operations:Re,canLaunch:n,onOpenOperation:d,onNewOperation:GM}):null,Se.rubberBand?c.jsx(hse,{rect:Se.rubberBand,viewport:_.viewport}):null,j?c.jsx(bN,{anchor:j.anchor,viewportBounds:Cse(m.current),placement:"cursor",catalog:t,canLaunch:n&&!S&&!E,renderKindIcon:i,onLaunchKind:pe,onClose:()=>M(null)},`${j.anchor.x}:${j.anchor.y}`):null,c.jsx(Vre,{operations:St,pluginOperations:Object.fromEntries(Re.filter(oe=>!je.has(oe.id)).map(oe=>[oe.id,{theaterId:oe.theaterId,geometry:_.operations[oe.id]??oe.geometry??tb(oe)}])),accents:Object.fromEntries(Re.flatMap(oe=>{const qe=_.operationAccent[oe.id]??eR(oe),ot=qe?os(qe):null;return ot?[[oe.id,ot]]:[]})),viewport:_.viewport,canvasSize:J,onJump:oe=>Tb({x:J.width/2-oe.x*_.viewport.zoom,y:J.height/2-oe.y*_.viewport.zoom,zoom:_.viewport.zoom})})]})}function Cse(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Ese(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}_i(null)}function Ase(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function tb(e){return e.geometry??{x:0,y:0,width:wse,height:Sse,zIndex:0}}function Tse(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function J5(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 Rse(e){return Object.values(e).reduce((t,n)=>Math.max(t,n.zIndex),0)}function Mse(){const[e,t]=g.useState(!1),n=g.useRef(new Set);return g.useEffect(()=>{const i=()=>{n.current.clear(),t(!1)},s=d=>{!Q5(d)||d.repeat||d.ctrlKey||d.metaKey||nj()||(n.current.add(d.code),t(!0))},o=d=>{Q5(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 Q5(e){return e.code==="AltLeft"||e.code==="AltRight"}function Nse(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 eR(e){return typeof e.accent=="string"?e.accent:null}function Lse(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=jh(()=>{Yi(null).then(tr).catch(()=>{})}),o=d=>{d?(_i(e.id),wM(e.id)):yP()},l=(d,f)=>{dP(e.id,d,f)};return c.jsxs(g.Fragment,{children:[c.jsx(ise,{operation:e,active:t.active,unseen:t.unseen,geometry:i,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,triageStage:t.triageStage,triagePicked:t.triagePicked,formationSlotIndex:t.formationSlotIndex,topEdge:t.topEdge,renderHidden:t.focusLayerHidden,focusLayerTarget:t.maximized||t.companion,interactionDisabled:t.formation||t.companion||t.focusLayerHidden||t.triageStage,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:t.operationBodyPoolAvailable?c.jsx(oj,{operationId:e.id,className:"canvas-operation-body-slot",config:{active:t.active,keyboardFocusRequestId:t.keyboardFocusRequestId,geometry:i,operation:e,theme:t.theme,language:t.language,zoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange,onRequestCompanions:o,companionsOpen:t.companion,hiddenCompanionPanelIds:t.hiddenCompanionPanelIds,onSetCompanionPanelVisible:l}}):c.jsx(nh,{fallback:c.jsx(nR,{messageKey:"canvas.plugin.operationFailed"}),children:c.jsx(tR,{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)=>c.jsx(Ose,{descriptor:d,geometry:t.companionGeometries[f],language:t.language,children:c.jsx(nh,{fallback:c.jsx(nR,{messageKey:"canvas.plugin.companionFailed"}),children:c.jsx(tR,{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 tR({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:_,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:_,hiddenCompanionPanelIds:w,onSetCompanionPanelVisible:S})}function nR({messageKey:e}){const t=Ze();return c.jsx("div",{className:"fc-plugin-error",children:t(e)})}function Ose({descriptor:e,geometry:t,language:n,children:i}){const s=Ze(),o=jl(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 c.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:c.jsxs("header",{className:"canvas-companion-caption","data-canvas-blocker":!0,children:[c.jsx("span",{className:"canvas-companion-caption-dot","aria-hidden":"true"}),c.jsx("span",{className:"canvas-companion-caption-title",children:o})]}),c.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 Ise(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function jse(e){return[...e.querySelectorAll('[aria-modal="true"]')].some(t=>{if(t.hidden||t.getAttribute("aria-hidden")==="true")return!1;const n=getComputedStyle(t);return n.display!=="none"&&n.visibility!=="hidden"})}function Dse(e){if(e<=0)return 0;const t=Math.ceil(Math.sqrt(e));return t*Math.ceil(e/t)}function cj(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 uj(e,t){const n=new Set(t.map(i=>i.id));return e.filter(i=>n.has(i.operationId))}function dj(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 B0(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 hj(e,t){return t.globalMute||t.dnd?[]:e.filter(n=>!n.theaterId||t.mutedTheaterIds[n.theaterId]!==!0)}function Bse(e){return{ended:e("rail.alerts.kindEnded"),"input-waiting":e("rail.alerts.kindWaiting")}}const Pse={id:"alerts",title:e=>xr(e)("rail.alerts.title"),icon:()=>c.jsx(zse,{}),render:()=>c.jsx($se,{})};function $se(){const e=Ze(),t=Bse(e),n=Cs(),i=uu(),[s,o]=g.useState(!1),l=g.useMemo(()=>uj(Object.values(n.operationNotifications),n.operations),[n.operationNotifications,n.operations]),d=cj(n),f=dj(l,d).hidden,p=hj(f,n.notificationPreferences),m=B0(p),y=B0(f),_=P0(m,"input-waiting"),w=P0(m,"ended"),S=m.length===0,x=g.useCallback(k=>{Ml(k.operationId),i("/operations")},[i]);return c.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":e("rail.alerts.panelAria"),children:[c.jsxs("div",{className:"alerts-panel-toolbar",children:[c.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[_>0?c.jsx("span",{className:"notification-tally is-input-waiting",children:_}):null,w>0?c.jsx("span",{className:"notification-tally is-ended",children:w}):null,S?c.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),c.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:c.jsx(Wse,{})})]}),s?c.jsx(Fse,{groups:y}):null,S?c.jsx("p",{className:"notification-dock-empty",children:e("rail.alerts.empty")}):c.jsx("div",{className:"notification-dock-deck",children:m.map(k=>c.jsxs("section",{className:"notification-cluster-group",children:[c.jsxs("header",{className:"notification-cluster-group-head",children:[c.jsx("span",{className:"notification-cluster-theater",children:k.theaterLabel}),c.jsx("span",{className:"notification-cluster-group-count",children:k.notifications.length})]}),c.jsx("ul",{className:"notification-cluster-roster",children:k.notifications.map(C=>c.jsxs("li",{className:`notification-row is-${C.kind}`,children:[c.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),c.jsxs("span",{className:"notification-row-body",children:[c.jsx("span",{className:"notification-row-op",children:C.operationLabel}),c.jsx("span",{className:"notification-row-state",children:t[C.kind]})]}),c.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>x(C),"aria-label":e("rail.alerts.openAria",{theater:k.theaterLabel,operation:C.operationLabel}),children:e("rail.alerts.open")})]},C.operationId))})]},k.theaterId??"__unknown__"))})]})}function zse(){const e=Cs();zN();const t=g.useMemo(()=>uj(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),n=cj(e),i=dj(t,n).hidden,s=hj(i,e.notificationPreferences),o=B0(s),l=o.reduce((p,m)=>p+m.notifications.length,0),d=P0(o,"input-waiting"),f=l===0?"muted":d>0?"awaiting":"ended";return c.jsxs("span",{className:`alerts-icon is-${f}`,"aria-hidden":"true",children:[c.jsx(Use,{}),l>0?c.jsx("span",{className:"alerts-icon-badge",children:l}):null]})}function Fse({groups:e}){const t=Ze(),n=Cs(),i=Hse(e,n.notificationPreferences.mutedTheaterIds,n.theaters);return c.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":t("rail.alerts.settingsAria"),children:[c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:t("rail.alerts.settingsDisplay")}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:n.notificationPreferences.globalMute,onChange:s=>D7(s.currentTarget.checked)}),c.jsx("span",{children:t("rail.alerts.muteAll")})]}),c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:n.notificationPreferences.dnd,onChange:s=>B7(s.currentTarget.checked)}),c.jsx("span",{children:t("rail.alerts.dnd")})]}),i.length>0?c.jsx("p",{className:"notification-cluster-settings-eyebrow",children:t("rail.alerts.byTheater")}):null,i.map(s=>c.jsxs("label",{className:"notification-cluster-setting",children:[c.jsx("input",{type:"checkbox",checked:s.theaterId?n.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&P7(s.theaterId)}}),c.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function Hse(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 P0(e,t){let n=0;for(const i of e)for(const s of i.notifications)s.kind===t&&(n+=1);return n}function Use(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[c.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Wse(){return c.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[c.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),c.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}class G1 extends Error{constructor(t,n){super(n),this.status=t,this.code=n,this.name="CoworkRequestError"}status;code}async function qse(e,t){const i=new URLSearchParams().toString();return Fo(fi(e,`/search${i?`?${i}`:""}`))}async function Gse(e,t,n){return Fo(fi(e,`/entry/${encodeURIComponent(t)}`))}async function fj(e,t="pending"){return Fo(fi(e,`/drydock?status=${encodeURIComponent(t)}`))}async function Kse(e,t){return Fo(fi(e,`/drydock/${encodeURIComponent(t)}`))}async function Vse(e){return Fo(fi(e,"/schema"))}async function Yse(e,t){const n=t?`/schema/templates/${encodeURIComponent(t)}`:"/schema/wiki-schema";return Fo(fi(e,n))}async function Xse(e,t,n,i){const s={action:n};return i!==void 0&&(s.reason=i),oae(fi(e,`/drydock/${encodeURIComponent(t)}/decision`),s)}async function Zse(e){return Fo(fi(e,"/conflicts"))}async function Jse(e,t){return Fo(fi(e,`/conflicts/${encodeURIComponent(t)}`))}async function Qse(e,t="claude",n){const i=new URLSearchParams({cli:t});return n&&i.set("model",n),pj(fi(e,`/cowork/options?${i}`))}async function iR(e,t,n){return Ho(fi(e,"/cowork/sessions"),{entryId:t,...n})}async function eae(e,t){try{return await pj(fi(e,`/cowork/entries/${encodeURIComponent(t)}/session`))}catch(n){if(n instanceof G1&&n.status===404)return null;throw n}}async function nb(e,t,n){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/settings`),{...n})}async function tae(e,t,n){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/selection`),{selection:n})}async function rR(e,t,n){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/annotations`),{annotations:n})}async function nae(e,t,n){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/prompt`),{prompt:n})}async function iae(e,t){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/cancel`),{})}async function rae(e,t,n){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/apply`),n===void 0?{}:{expectedRevision:n})}async function sae(e,t){return Ho(fi(e,`/cowork/sessions/${encodeURIComponent(t)}/close`),{})}function aae(e,t,n,i){const s=new EventSource(`${fi(e,`/cowork/sessions/${encodeURIComponent(t)}/events`)}?after=${encodeURIComponent(String(n))}`),o=l=>{try{const d=JSON.parse(l.data);if(!lae(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 fi(e,t){const n=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${n}`:`/console/codex/api${n}`}async function Fo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await gj(e,t));return t.json()}async function oae(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 gj(e,n));return n.json()}async function pj(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw await mj(t);return t.json()}async function Ho(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 mj(n);return n.json()}async function mj(e){const t=await e.json().catch(()=>null);return new G1(e.status,typeof t?.error=="string"?t.error:`cowork_request_failed:${e.status}`)}function lae(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 gj(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const $0=new Set;let Yp=0;const Kc={index:[],conflicts:[],pendingPatchCount:0,schemaCatalog:null,currentWorkspaceId:null,loading:!1,error:null};function pl(){return Kc}function yj(e){return $0.add(e),()=>$0.delete(e)}function sR(e){Yp+=1,Xp({currentWorkspaceId:e,schemaCatalog:null})}async function Zm(){const e=Kc.currentWorkspaceId,t=Yp;Xp({loading:!0,error:null});try{const[n,i,s]=await Promise.all([qse(e),fj(e,"pending").catch(()=>null),Vse(e).catch(()=>null)]);if(Kc.currentWorkspaceId!==e||Yp!==t)return;Xp({index:n.entries,pendingPatchCount:i?.pendingCount??0,schemaCatalog:s,loading:!1})}catch(n){if(Kc.currentWorkspaceId!==e||Yp!==t)return;Xp({loading:!1,error:cae(n)})}}function Xp(e){Object.assign(Kc,e);for(const t of $0)t(Kc)}function cae(e){return e instanceof Error?e.message:String(e)}const uae=120;function dae(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function ib(){return xr(dae())}function bn(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function hae(e,t){if(!t)return bn(e);const n=e.toLowerCase().indexOf(t.toLowerCase());return n===-1?bn(e):bn(e.slice(0,n))+`<mark>${bn(e.slice(n,n+t.length))}</mark>`+bn(e.slice(n+t.length))}function fae(e){return`<span class="codex-nav-tag">${bn(e)}</span>`}function pae(e,t,n){const i=t?e.tags.some(d=>d.toLowerCase().includes(t.toLowerCase())):!1,s=e.tags.slice(0,3).map(fae).join(""),o=bn(e.status??"current"),l=bn(e.updated??"");return`<button
231
+ class="codex-nav-entry${n?" is-current":""}"
232
+ data-entry-id="${bn(e.id)}"
233
+ type="button"
234
+ ${n?'aria-current="page"':""}
235
+ title="${bn(e.title)}"
236
+ >
237
+ <span class="t">${hae(e.title,i?"":t)}</span>
238
+ ${s?`<span class="tg">${s}</span>`:""}
239
+ <span class="meta">${o} · ${l}</span>
240
+ </button>`}function mae(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 gae(e,t){let n="",i=null,s="entries",o=null;function l(){const x=ib();e.innerHTML=`
241
+ <div class="codex-navigator">
242
+ <div class="codex-nav-modes" role="tablist" aria-label="${bn(x("codex.nav.catalogAria"))}">
243
+ <button type="button" role="tab" data-mode="entries" aria-selected="true">${bn(x("codex.nav.entries"))}</button>
244
+ <button type="button" role="tab" data-mode="schema" aria-selected="false">${bn(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="${bn(x("codex.nav.searchPlaceholder"))}"
252
+ autocomplete="off"
253
+ spellcheck="false"
254
+ aria-label="${bn(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
+ ${bn(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">${bn(x("codex.nav.conflicts"))}</button>
262
+ </div>
263
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">${bn(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=ib();if(e.querySelectorAll("[data-mode]").forEach(B=>B.setAttribute("aria-selected",String(B.dataset.mode===s))),d.hidden=s==="schema",s==="schema"){const B=x.schemaCatalog;p.textContent=k("codex.nav.schemaCount",{count:B?.templates.length??0}),f.innerHTML=B?`
269
+ <button class="codex-nav-entry" type="button" ${B.schema.exists?'data-schema-resource="workspace"':'disabled aria-disabled="true"'}><span class="t">${bn(k("codex.nav.workspaceSchema"))}</span><span class="meta">${B.schema.exists?bn(B.schema.ref):bn(k("codex.nav.unavailable"))}</span></button>
270
+ ${B.templates.map(H=>`<button class="codex-nav-entry" type="button" data-template-id="${bn(H.id)}"><span class="t">${bn(H.id)}</span><span class="meta">${bn(H.ref)}</span></button>`).join("")}`:`<div class="codex-nav-empty">${bn(k("codex.nav.schemaUnavailable"))}</div>`,m.textContent=String(x.pendingPatchCount);return}const C=mae(x.index,n);if(p.textContent=k("codex.nav.entriesCount",{count:C.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">${bn(k("common.loading"))}</div>`;return}if(x.error){f.innerHTML=`<div class="codex-nav-error" role="alert">${bn(x.error)}</div>`;return}if(C.length===0){f.innerHTML=`<div class="codex-nav-empty">${bn(k(n?"codex.nav.noMatch":"codex.nav.noEntries"))}</div>`;return}f.innerHTML=C.map(B=>pae(B,n,B.id===i)).join("")}function _(x){const k=x.target;if(!(k instanceof Element))return;const C=k.closest("[data-mode]");if(C?.dataset.mode==="entries"||C?.dataset.mode==="schema"){s=C.dataset.mode,y(pl());return}if(k.closest("[data-schema-resource]")){t.onRequest({kind:"schema"});return}const H=k.closest("[data-template-id]");if(H?.dataset.templateId){t.onRequest({kind:"schema",templateId:H.dataset.templateId});return}const T=k.closest("[data-entry-id]");if(T?.dataset.entryId){i=T.dataset.entryId,y(pl()),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(pl())},uae)}e.addEventListener("click",_),d.addEventListener("input",w);const S=yj(x=>y(x));return y(pl()),{destroy(){S(),e.removeEventListener("click",_),d.removeEventListener("input",w),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(x){n="",i=null,d&&(d.value=""),y(pl())},refreshLocale(){const x=ib();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 C=e.querySelector('[data-mode="schema"]');C&&(C.textContent=x("codex.nav.schema")),d.placeholder=x("codex.nav.searchPlaceholder"),d.setAttribute("aria-label",x("codex.nav.searchAria"));const B=e.querySelector('[data-action="drydock"]');B&&B.replaceChildren(document.createTextNode(`${x("codex.nav.reviewQueue")} `),m);const H=e.querySelector('[data-action="conflicts"]');H&&(H.textContent=x("codex.nav.conflicts")),y(pl())}}}function yae(e,t){t.initialTheaterId&&sR(t.initialTheaterId);const n=gae(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),i=yj(()=>{});Zm();const s=n.destroy.bind(n);return{destroy(){i(),s()},setTheater(o){sR(o),Zm(),n.setTheater(o)},refreshLocale(){n.refreshLocale()}}}function Fe(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function en(e){return Fe(e).replace(/"/g,"&quot;")}function vj(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function vae(e){const t=vj(),n=xr(t),i=e.tags.map(o=>`<span class="chip chip-tag">${Fe(o)}</span>`).join(""),s=_ae(e);return`
271
+ <div class="meta-chips">
272
+ ${i}
273
+ ${s}
274
+ <span class="chip">${Fe(n("codex.meta.updated",{date:qP(e.updated,t)}))}</span>
275
+ </div>
276
+ `}function _j(e){return e.map(t=>`<span class="chip chip-muted">${Fe(t)}</span>`).join("")}function _ae(e){const t=bae(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${en(t.title)}">${Fe(t.label)}</span>`:""}function bae(e,t=new Date){const n=xr(vj()),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 wae(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}const Sae="active";function rb(e){if(e.length===0){const t=xr(wae());return`<p class="toc-empty">${Fe(t("codex.toc.noSections"))}</p>`}return e.map(t=>`<a class="ti toc-level-${t.level}" href="#${en(t.id)}" data-toc-id="${en(t.id)}">${Fe(t.text)}</a>`).join("")}function aR(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 _=y.target instanceof HTMLElement?y.target.id:"";_&&(y.isIntersecting?d.add(_):d.delete(_))}const m=xae(o,d)??kae(o,l)??o[0]?.id??null;oR(i,m)},{root:l,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const p of o)f.observe(p);return oR(i,o[0]?.id??null),()=>f.disconnect()}function xae(e,t){for(const n of e)if(t.has(n.id))return n.id;return null}function kae(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 oR(e,t){for(const n of e){const i=!!(t&&n.dataset.tocId===t);n.classList.toggle(Sae,i),i?n.setAttribute("aria-current","location"):n.removeAttribute("aria-current")}}const bj=1<<20;function Cae(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>bj)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 Eae(e,t){const n=lR(e),i=lR(t),s=n.length+1,o=i.length+1,l=[];if(s*o>bj){const m=Math.max(n.length,i.length);for(let y=0;y<m;y+=1){const _=n[y],w=i[y];w!==void 0&&w===_?l.push({markdown:w,kind:"same"}):(_!==void 0&&l.push({markdown:_,kind:"removed"}),w!==void 0&&l.push({markdown:w,kind:"added"}))}return cR(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 cR(l)}function lR(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 cR(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 sb(e){return e.map(t=>({value:t,label:t}))}function Aae({clis:e,models:t,efforts:n,cli:i,model:s,effort:o,onCliChange:l,onModelChange:d,onEffortChange:f}){const p=Ze();return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:p("codex.cowork.cli")}),c.jsx(qi,{label:p("codex.cowork.cli"),value:i,options:sb(e),onChange:l,disabled:!e.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:p("codex.cowork.model")}),c.jsx(qi,{label:p("codex.cowork.model"),value:s,options:sb(t),onChange:d,disabled:!t.length,compact:!0})]}),c.jsxs("div",{className:"cowork-selector",children:[c.jsx("span",{children:p("codex.cowork.effort")}),c.jsx(qi,{label:p("codex.cowork.effort"),value:o,options:sb(n),onChange:f,disabled:!n.length,compact:!0})]})]})}function Jm(e){return`/entry/${encodeURIComponent(e)}`}function Tae(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function Hi(){return xr(Tae())}const wj="fleet.codex.cowork.settings",Rae="Revise the draft to address every saved annotation. Preserve unrelated content and summarize the changes.",Mae=32;function Nae(e){let t=!1,n=null,i=null,s=0,o={clis:[],models:[],efforts:[]},l=Dae(),d=[],f="",p="",m="",y=null,_="",w="idle",S=!1,x=null,k=!1,C=!1,B=!1,H=null,T=!1,$=!1,j=!1,M=null,V="",Y="",te="published",J=null,P=null,N=null;const I=()=>n?((!P||P.base!==n.baseDraft||P.draft!==n.draft)&&(P={base:n.baseDraft,draft:n.draft,lines:Cae(n.baseDraft,n.draft)}),P.lines):[],D=e.body.innerHTML,E=document.createElement("div");E.className="cowork-anchor";const L=document.createElement("div");L.className="cowork-dock-zone";const R=document.createElement("div");R.className="cowork-tip",R.hidden=!0,e.article.classList.add("cowork-host"),e.article.append(E,L,R);const q=()=>{N?.unmount(),N=null},U=()=>{if(!B||t)return;const le=L.querySelector("[data-cowork-settings-host]");le&&(N||(N=LR.createRoot(le)),N.render(g.createElement(Aae,{clis:o.clis,models:o.models,efforts:o.efforts,cli:l.cli,model:l.model,effort:l.effort,onCliChange:me=>O("cli",me),onModelChange:me=>O("model",me),onEffortChange:me=>O("effort",me)})))},O=(le,me)=>{if(l=le==="cli"?{cli:me,model:"",effort:""}:{...l,[le]:me},ob(l),!n){le!=="effort"?dt().then(()=>{z()}).catch(()=>{}):U();return}le!=="effort"?dt().then(()=>Xe(()=>nb(e.theaterId,n.id,l))).then(z).catch(re=>{Y=re instanceof Error?re.message:Hi()("codex.cowork.requestFailed"),z()}):Xe(()=>nb(e.theaterId,n.id,l)).then(z).catch(()=>{})},W=()=>{if(t)return;const le=Hi(),me=!!n&&n.state!=="closed",re=me?T?`diff:${n.draft}`:`draft:${n.draft}`:"published";if(re!==te){if(te=re,!me){e.body.innerHTML=D;return}e.body.innerHTML=T?`<div class="cowork-rendered-diff" aria-label="${en(le("codex.cowork.draftChangesAria"))}">${Oae(ab(n.baseDraft),ab(n.draft))}</div>`:us(ab(n.draft),{omitDuplicateTitle:e.title,resolveWikiLink:ge=>Jm(ge),...Sl(le)}).html}},K=()=>{if(t)return;if(!x){E.innerHTML="";return}const le=Hi(),me=e.article.getBoundingClientRect().width||0,re=k?Math.min(340,me*.86)/2+8:56,ge=Math.min(Math.max(x.left,re),Math.max(me-re,re)),Te=`style="top:${x.top}px;left:${ge}px"`;E.innerHTML=k?`<div class="cowork-composer" ${Te} role="dialog" aria-label="${en(le("codex.cowork.addCommentAria"))}">
287
+ <blockquote>${Fe(dR(x.quote,140))}</blockquote>
288
+ <textarea class="cowork-composer-input" rows="2" placeholder="${en(le("codex.cowork.commentPlaceholder"))}" aria-label="${en(le("codex.cowork.commentAria"))}"></textarea>
289
+ <div class="cowork-composer-actions">
290
+ <button type="button" class="cowork-ghost" data-cowork-action="cancel-comment">${Fe(le("common.cancel"))}</button>
291
+ <button type="button" class="cowork-solid" data-cowork-action="add-comment">${Fe(le("codex.cowork.add"))}</button>
292
+ </div>
293
+ </div>`:`<button type="button" class="cowork-pill" data-cowork-action="comment" ${Te}><span aria-hidden="true">✦</span>${Fe(le("codex.cowork.comment"))}</button>`,k&&E.querySelector(".cowork-composer-input")?.focus()},z=()=>{if(t)return;const le=Hi(),me=!!n&&n.state!=="closed"&&n.state!=="applied";L.classList.add("is-open");const re=j||me&&n.state==="running"&&w!=="complete"&&w!=="stopped";e.body.classList.toggle("is-cowork-running",re);const ge=me&&n.baseDraft!==n.draft,Te=ge?I().filter(We=>We.changed).length:0;je(`
294
+ ${G(re)}
295
+ ${C?St():""}
296
+ ${B?Re():""}
297
+ ${ge&&!re?ze(Te):""}
298
+ <div class="cowork-bar${re?" is-running":""}" data-cowork-form>
299
+ ${re?'<span class="cowork-glow" aria-hidden="true"></span>':""}
300
+ <button type="button" class="cowork-chip${C?" is-active":""}" data-cowork-action="toggle-panel" aria-expanded="${C}" aria-label="${en(le("codex.cowork.annotationsAria"))}" ${re?"disabled":""}><span aria-hidden="true">✦</span>${d.length}</button>
301
+ <input class="cowork-dock-input" name="prompt" value="${en(V)}" placeholder="${en(d.length?le("codex.cowork.instructionOptional"):le("codex.cowork.askAi"))}" aria-label="${en(le("codex.cowork.instructionAria"))}" ${re?"disabled":""}>
302
+ <button type="button" class="cowork-chip cowork-chip--config${B?" is-active":""}" data-cowork-action="toggle-config" aria-expanded="${B}" aria-label="${en(le("codex.cowork.agentSettingsAria"))}" ${re?"disabled":""}>${Fe(l.cli||"agent")}</button>
303
+ ${re?`<button type="button" class="cowork-send cowork-stop" data-cowork-action="cancel-run" aria-label="${en(le("codex.cowork.stopAria"))}"><span aria-hidden="true"></span></button>`:`<button type="button" class="cowork-send" data-cowork-action="send" aria-label="${en(le("codex.cowork.sendToAi"))}">↑</button>`}
304
+ </div>
305
+ ${Y?`<p class="cowork-error" role="alert">${Fe(Y)}</p>`:""}`),U()},G=le=>{const me=Hi();if(!(le||w!=="idle"))return"";const ge=le?"running":w,Te=me(le?"codex.cowork.editingEntry":w==="complete"?"codex.cowork.revisionComplete":"codex.cowork.revisionStopped"),We=me(S?"codex.cowork.expandStream":"codex.cowork.collapseStream"),ee=!!(_||f||le);return`<section class="cowork-revision-stream is-${ge}${S?" is-collapsed":""}" aria-label="${en(me("codex.cowork.revisionStreamAria"))}">
306
+ ${le?'<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>${Fe(Te)}</small></span>${ee?`<button type="button" class="cowork-revision-toggle" data-cowork-action="toggle-revision" aria-expanded="${!S}" aria-label="${en(We)}"><span aria-hidden="true"></span></button>`:""}</header>
308
+ ${ee?`<div class="cowork-revision-content" aria-hidden="${S}"><div class="cowork-revision-content-inner">
309
+ ${_||f?`<div class="cowork-revision-body">
310
+ ${_?`<p class="cowork-revision-instruction">${Fe(_)}</p>`:""}
311
+ ${f?`<div class="cowork-revision-output-scroll"><div class="cowork-revision-output markdown-body">${m}</div></div>`:""}
312
+ </div>`:""}
313
+ ${le?`<footer class="cowork-revision-status" role="status" aria-live="polite"><i aria-hidden="true"></i><span><strong>${Fe(me("codex.cowork.writingRevision"))}</strong></span></footer>`:""}
314
+ </div></div>`:""}
315
+ </section>`},Z=()=>{y!==null&&window.clearTimeout(y),y=null},se=()=>{p!==f&&(p=f,m=f?us(f,Sl(Hi())).html:"")},Se=()=>{se();const le=L.querySelector(".cowork-revision-output");if(!le){z();return}le.innerHTML=m;const me=le.closest(".cowork-revision-output-scroll");me&&(me.scrollTop=me.scrollHeight)},pe=()=>{y===null&&(y=window.setTimeout(()=>{y=null,t||Se()},Mae))},$e=()=>{Z(),se()},je=le=>{if(le===J)return;q(),J=le;const me=document.activeElement,re=me instanceof HTMLInputElement&&me.name==="prompt"&&L.contains(me)?"prompt":me instanceof HTMLTextAreaElement&&me.dataset.coworkComment&&L.contains(me)?`comment:${me.dataset.coworkComment}`:null;if(L.innerHTML=le,re==="prompt"){const ge=L.querySelector(".cowork-dock-input");ge?.focus(),ge?.setSelectionRange(ge.value.length,ge.value.length)}else if(re?.startsWith("comment:")){const ge=L.querySelector(`[data-cowork-comment="${CSS.escape(re.slice(8))}"]`);ge?.focus(),ge?.setSelectionRange(ge.value.length,ge.value.length)}},St=()=>{const le=Hi();return`
316
+ <div class="cowork-popover cowork-panel" role="region" aria-label="${en(le("codex.cowork.annotationsAria"))}">
317
+ ${d.length===0?`<p class="cowork-empty">${Fe(le("codex.cowork.emptyAnnotations"))}</p>`:d.map(me=>`
318
+ <article class="cowork-card is-${me.status}">
319
+ <blockquote>${Fe(dR(me.quote,160))}</blockquote>
320
+ <textarea data-cowork-comment="${en(me.id)}" aria-label="${en(le("codex.cowork.commentAria"))}" placeholder="${en(le("codex.cowork.addCommentPlaceholder"))}" ${me.status==="sent"?"disabled":""}>${Fe(me.comment)}</textarea>
321
+ <footer><span class="cowork-card-status">${Fe(me.status==="sent"?le("codex.cowork.statusSent"):me.status==="done"?le("codex.cowork.statusDone"):le("codex.cowork.statusReady"))}</span><button type="button" class="cowork-x" data-cowork-action="delete-annotation" data-annotation-id="${en(me.id)}" aria-label="${en(le("codex.cowork.deleteAnnotation"))}">×</button></footer>
322
+ </article>`).join("")}
323
+ </div>`},Re=()=>{const le=Hi();return`
324
+ <div class="cowork-popover cowork-config" role="region" aria-label="${en(le("codex.cowork.agentSettingsAria"))}">
325
+ <div data-cowork-settings-host></div>
326
+ </div>`},ze=le=>{const me=Hi();if(H){const ge=me(H==="apply"?"codex.cowork.applyConfirm":"codex.cowork.discardConfirm"),Te=H==="apply"?"apply-confirm":"discard-confirm";return`<div class="cowork-review is-confirm"><span>${Fe(ge)}</span><button type="button" class="cowork-solid${H==="discard"?" cowork-solid--danger":""}" data-cowork-action="${Te}">${Fe(me(H==="apply"?"codex.cowork.apply":"codex.cowork.discard"))}</button><button type="button" class="cowork-ghost" data-cowork-action="confirm-back">${Fe(me("codex.cowork.back"))}</button></div>`}const re=le>0?me(le===1?"codex.cowork.changedLines_one":"codex.cowork.changedLines_other",{count:le}):me("codex.cowork.removedContent");return`<div class="cowork-review"><span class="cowork-review-count"><i aria-hidden="true"></i>${Fe(re)}</span><button type="button" class="cowork-ghost" data-cowork-action="toggle-diff">${Fe(me(T?"codex.cowork.viewDraft":"codex.cowork.viewDiff"))}</button><button type="button" class="cowork-solid" data-cowork-action="apply-arm">${Fe(me("codex.cowork.apply"))}</button><button type="button" class="cowork-ghost" data-cowork-action="discard-arm">${Fe(me("codex.cowork.discard"))}</button></div>`},lt=()=>{if(!t){for(const le of[...e.body.querySelectorAll("mark.cowork-mark")]){const me=le.parentNode;if(me){for(;le.firstChild;)me.insertBefore(le.firstChild,le);me.removeChild(le)}}if(e.body.normalize(),!T)for(const le of d)le.quote&&kt(le)}},kt=le=>{const me=[],re=document.createTreeWalker(e.body,NodeFilter.SHOW_TEXT);for(let he=re.nextNode();he;he=re.nextNode())me.push(he);let ge="";const Te=[];for(const he of me)Te.push(ge.length),ge+=he.data;const We=ge.indexOf(le.quote);if(We<0)return;const ee=We+le.quote.length;for(let he=0;he<me.length;he+=1){const Ee=Te[he],Ve=Ee+me[he].data.length,Rt=Math.max(We,Ee),ct=Math.min(ee,Ve);if(Rt>=ct)continue;const Pe=document.createRange();Pe.setStart(me[he],Rt-Ee),Pe.setEnd(me[he],ct-Ee);const Ie=document.createElement("mark");Ie.className="cowork-mark",Ie.dataset.annotationId=le.id;try{Pe.surroundContents(Ie)}catch{}}},mt=le=>{const me=d.find(We=>We.id===le.dataset.annotationId);if(!me){R.hidden=!0;return}R.textContent=me.comment.trim()||Hi()("codex.cowork.noCommentYet"),R.hidden=!1;const re=le.getBoundingClientRect(),ge=e.article.getBoundingClientRect(),Te=R.offsetWidth/2+8;R.style.top=`${Math.max(re.top-ge.top-6,0)}px`,R.style.left=`${Math.min(Math.max(re.left+re.width/2-ge.left,Te),Math.max(ge.width-Te,Te))}px`},Ct=()=>{W(),z(),lt()},dt=async()=>{o=await Qse(e.theaterId,l.cli,l.model||void 0);const le=o.defaultModel&&o.models.includes(o.defaultModel)?o.defaultModel:o.models[0]??"",me=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:le,effort:o.efforts.includes(l.effort)?l.effort:me},ob(l)},gt=async le=>{n=le;const me=le.annotations.map(Iae),re=new Set(me.map(ge=>ge.id));d=[...me,...d.filter(ge=>!re.has(ge.id))],(le.cli||le.model||le.effort)&&(l={cli:le.cli??l.cli,model:le.model??l.model,effort:le.effort??l.effort},ob(l));try{await dt()}catch{}if(!t){if(n&&(n.cli!==l.cli||n.model!==l.model||n.effort!==l.effort))try{n=await nb(e.theaterId,n.id,l)}catch{}t||(Pt(),Ct())}},at=async()=>{if(n&&n.state!=="closed"&&n.state!=="applied")return n;const le=await iR(e.theaterId,e.entryId,l);return await gt(le),le};z(),dt().then(z).catch(()=>{}),(async()=>{try{const le=await eae(e.theaterId,e.entryId);!t&&le&&await gt(le)}catch{}})();function Pt(){n&&(i?.(),i=aae(e.theaterId,n.id,s,(le,me)=>{if(me&&me<=s)return;s=Math.max(s,me);const re=n?.state==="running";if(le.session&&(n=le.session),le.type==="transcript"&&le.text&&n?.state==="running"){f=w==="running"?f+le.text:le.text,w="running",pe();return}le.type==="done"&&($e(),(!M?.cancelled||M.submitted)&&(w=re||$||w==="stopped"||!!f||!!_?"complete":"idle",d=d.map(Te=>Te.status==="sent"?{...Te,status:"done"}:Te),$&&($=!1,n&&n.baseDraft!==n.draft&&(T=!0)))),(le.type==="error"||le.type==="session"&&re&&n?.state!=="running")&&($e(),w="stopped",$=!1,d=d.map(ge=>ge.status==="sent"?{...ge,status:"pending"}:ge)),le.type==="error"&&le.text&&(Y=le.text),Ct()}))}async function Ut(le,me){d=[...d,{id:jae(),quote:le,comment:me,status:"pending"}],x=null,k=!1,K(),z(),lt();try{await at(),await Xe(()=>tae(e.theaterId,n.id,le)),await cn()}catch{}}async function tt(le){d=d.filter(me=>me.id!==le),z(),lt(),R.hidden=!0;try{await cn()}catch{}}async function cn(){n&&await Xe(()=>rR(e.theaterId,n.id,d.map(uR)))}async function ke(){if(j||n?.state==="running")return;const le=d.filter(Te=>Te.status!=="done"),me=V.trim(),re=me||(le.length?Rae:"");if(!re)return;const ge={cancelled:!1,submitted:!1};M=ge,j=!0,d=le.map(Te=>({...Te,status:"sent"})),Z(),f="",p="",m="",_=me,w="running",S=!1,V="",C=!1,B=!1,z(),lt();try{if(await at(),ge.cancelled||M!==ge||(await Xe(()=>rR(e.theaterId,n.id,d.map(uR))),ge.cancelled||M!==ge))return;ge.submitted=!0,await Xe(()=>nae(e.theaterId,n.id,re)),$=!0}catch{!ge.cancelled&&M===ge&&($=!1,w="idle",d=d.map(Te=>Te.status==="sent"?{...Te,status:"pending"}:Te))}finally{!ge.cancelled&&M===ge&&(j=!1,M=null,z())}}async function De(){if(!n)return;const le=n.id;try{Y="",await sae(e.theaterId,le)}catch(me){Y=me instanceof Error?me.message:Hi()("codex.cowork.requestFailed"),z();return}i?.(),i=null,s=0,d=[],Z(),f="",p="",m="",_="",w="idle",S=!1,H=null,T=!1;try{await gt(await iR(e.theaterId,e.entryId,l))}catch{n=null,Ct()}}async function Xe(le){try{Y="",n=await le(),Ct()}catch(me){const re=Hi();throw Y=me instanceof G1&&["cowork_apply_stale","cowork_apply_stale_revision","cowork_apply_busy"].includes(me.code)?re("codex.cowork.applyStale"):me instanceof Error?me.message:re("codex.cowork.requestFailed"),Ct(),me}}const _t=le=>{if(k||n?.state==="running"||le.target instanceof Node&&E.contains(le.target))return;const me=window.getSelection(),re=me?.toString().trim()??"";if(!re||!me||me.rangeCount===0||!e.body.contains(me.anchorNode))return;const ge=me.getRangeAt(0).getBoundingClientRect(),Te=e.article.getBoundingClientRect();x={quote:re,top:ge.bottom-Te.top+8,left:Math.min(Math.max(ge.left+ge.width/2-Te.left,0),Math.max(Te.width,0))},K()},ht=le=>{if(le.target instanceof Element){if(le.target.closest(".cowork-pill")){le.preventDefault();return}!E.contains(le.target)&&x&&(x=null,k=!1,K())}},nt=le=>{if(le.target instanceof Element&&le.target.closest(".cowork-revision-output")){le.stopPropagation();return}if(le.key==="Escape"){x||k?(x=null,k=!1,K()):(C||B||H)&&(C=!1,B=!1,H=null,z());return}const me=le.target;le.key==="Enter"&&!le.shiftKey&&me instanceof HTMLTextAreaElement&&me.classList.contains("cowork-composer-input")&&(le.preventDefault(),st()),le.key==="Enter"&&me instanceof HTMLInputElement&&me.name==="prompt"&&(le.preventDefault(),ke())},st=()=>{const le=E.querySelector(".cowork-composer-input")?.value.trim()??"";x&&Ut(x.quote,le)},_e=le=>{if(!(le.target instanceof Element))return;const me=le.target.closest(".cowork-revision-output");me&&le.stopPropagation();const re=le.target.closest('[data-action="copy-code"]');if(re){const We=re.closest("pre")?.getAttribute("data-code");if(!We)return;Lae(re,We);return}if(me)return;const ge=le.target.closest("[data-cowork-action]");if(!ge)return;const Te=ge.dataset.coworkAction;if(Te==="comment"&&(k=!0,K()),Te==="cancel-comment"&&(x=null,k=!1,K()),Te==="add-comment"&&st(),Te==="toggle-panel"&&(C=!C,B=!1,z()),Te==="toggle-config"&&(B=!B,C=!1,z()),Te==="toggle-revision"){S=!S;const We=ge.closest(".cowork-revision-stream");We?.classList.toggle("is-collapsed",S),ge.setAttribute("aria-expanded",String(!S)),ge.setAttribute("aria-label",S?Hi()("codex.cowork.expandStream"):Hi()("codex.cowork.collapseStream")),We?.querySelector(".cowork-revision-content")?.setAttribute("aria-hidden",String(S))}if(Te==="send"&&ke(),Te==="cancel-run"&&j&&M&&!M.submitted){M.cancelled=!0,j=!1,$=!1,w="stopped",d=d.map(We=>We.status==="sent"?{...We,status:"pending"}:We),z(),lt();return}Te==="toggle-diff"&&(T=!T,Ct()),Te==="delete-annotation"&&ge.dataset.annotationId&&tt(ge.dataset.annotationId),Te==="apply-arm"&&(H="apply",z()),Te==="discard-arm"&&(H="discard",z()),Te==="confirm-back"&&(H=null,z()),Te==="apply-confirm"&&n&&(H=null,Xe(()=>rae(e.theaterId,n.id,n.revision)).then(()=>e.onApplied()).catch(()=>{})),Te==="discard-confirm"&&De(),Te==="cancel-run"&&n&&Xe(()=>iae(e.theaterId,n.id)).then(()=>{w="stopped",d=d.map(We=>We.status==="sent"?{...We,status:"pending"}:We),z()}).catch(()=>{})},Ne=le=>{const me=le.target instanceof Element?le.target.closest("mark.cowork-mark"):null;me?mt(me):R.hidden||(R.hidden=!0)},bt=()=>{R.hidden=!0},Nt=le=>{const me=le.target;if(me instanceof Element&&me.closest(".cowork-revision-output")){le.stopPropagation();return}if(me instanceof HTMLInputElement&&me.name==="prompt"){V=me.value;return}if(me instanceof HTMLTextAreaElement&&me.dataset.coworkComment){const re=me.dataset.coworkComment;d=d.map(ge=>ge.id===re?{...ge,comment:me.value,status:"pending"}:ge)}},hn=le=>{const me=le.target;if(me instanceof Element&&me.closest(".cowork-revision-output")){le.stopPropagation();return}me instanceof HTMLTextAreaElement&&me.dataset.coworkComment&&cn().catch(()=>{})};return e.article.addEventListener("mouseup",_t),e.article.addEventListener("mousedown",ht),e.article.addEventListener("keydown",nt),e.article.addEventListener("click",_e),e.article.addEventListener("input",Nt),e.article.addEventListener("change",hn),e.article.addEventListener("mouseover",Ne),e.article.addEventListener("mouseleave",bt),{destroy(){t=!0,Z(),q(),i?.(),e.article.removeEventListener("mouseup",_t),e.article.removeEventListener("mousedown",ht),e.article.removeEventListener("keydown",nt),e.article.removeEventListener("click",_e),e.article.removeEventListener("input",Nt),e.article.removeEventListener("change",hn),e.article.removeEventListener("mouseover",Ne),e.article.removeEventListener("mouseleave",bt),E.remove(),L.remove(),R.remove(),e.body.classList.remove("is-cowork-running"),e.article.classList.remove("cowork-host")}}}function Lae(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=Hi()("codex.cowork.copied"),window.setTimeout(()=>{e.isConnected&&(e.textContent=s)},1200))}).catch(()=>{})}function Oae(e,t){return Eae(e,t).map(n=>{const i=us(n.markdown,{resolveWikiLink:s=>Jm(s),...Sl(Hi())}).html;return n.kind==="same"?i:`<div class="cowork-block cowork-block--${n.kind}">${i}</div>`}).join("")}function uR(e){return{id:e.id,quote:e.quote,comment:e.comment.trim()||Hi()("codex.cowork.defaultComment")}}function Iae(e){return{id:e.id,quote:e.quote,comment:e.comment,status:"pending"}}function ab(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function dR(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}function jae(){return typeof crypto?.randomUUID=="function"?crypto.randomUUID():`annotation-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Dae(){try{const e=JSON.parse(localStorage.getItem(wj)??"{}");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 ob(e){try{localStorage.setItem(wj,JSON.stringify(e))}catch{}}function Sj(){const e=Ii().state?.language??"auto",t=typeof navigator<"u"&&typeof navigator.language=="string"?navigator.language.toLowerCase():"";return sr(e,t)}function Ui(){return xr(Sj())}function Bae(){return Sj()}const xj={create_wiki:"+",update_wiki:"↻"};function kj(e,t){return t(e==="create_wiki"?"codex.reading.opCreate":e==="update_wiki"?"codex.reading.opUpdate":"codex.reading.opPatch")}function Pae(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,_=null;vh(e,Lb(Ui()));function w(j){const M=j.target;if(!(M instanceof Element))return;const V=M.closest("[data-patch-id]");if(V){j.preventDefault();const J=V.dataset.patchId||void 0;l.onPatchOpen?.(J);return}const Y=M.closest("[data-entry-id]");if(Y?.dataset.entryId){j.preventDefault(),l.onRelatedClick(Y.dataset.entryId);return}const te=M.closest("[data-drydock-action]");if(te){j.preventDefault(),S(te.dataset.drydockAction);return}}function S(j){if(j){if(j==="back"){l.onPatchOpen?.(void 0);return}if(j==="approve"){p="approving",m=null,k();return}if(j==="approve-confirm"){x("approve",void 0);return}if(j==="reject"){p="rejecting",m=null,k();return}if(j==="reject-submit"){const M=e.querySelector("#queue-reject-reason")?.value.trim();if(!M){m=Ui()("codex.reading.rejectReasonRequired"),k();return}x("reject",M);return}if(j==="cancel"){p="idle",m=null,k();return}}}async function x(j,M){if(_){p="submitting",m=null,k();try{await Xse(l.theaterId,_,j,M),l.onDecided?.()}catch(V){p=j==="approve"?"approving":"rejecting",m=V instanceof Error?V.message:String(V),k()}}}function k(){const j=e.querySelector("[data-decision-bar-wrap]");j&&(j.innerHTML=Cj(p,m))}e.addEventListener("click",w);function C(){o?.destroy(),o=null,s?.(),s=null}async function B(j){if(!n){bp(e,t.tocContainer),C();try{const M=await Gse(l.theaterId,j);if(n)return;const{index:V}=pl(),Y=Ui(),{html:te,toc:J}=us(M.body,{omitDuplicateTitle:M.frontmatter.title,resolveWikiLink:I=>Jm(I),...Sl(Y)});e.innerHTML=`
327
+ <article class="document">
328
+ <header class="document-header">
329
+ ${$ae(M.frontmatter.title)}
330
+ <h1>${Fe(M.frontmatter.title)}</h1>
331
+ ${vae(M.frontmatter)}
332
+ </header>
333
+ <div class="markdown-body" id="codex-reader-body">
334
+ ${te}
335
+ </div>
336
+ ${zae(M.frontmatter.id,M.frontmatter.tags,V)}
337
+ </article>
338
+ `,t.tocContainer.innerHTML=rb(J);const P=e.querySelector("article");P&&J.length>0&&(s=aR(P,J,t.tocContainer));const N=e.querySelector("#codex-reader-body");P&&N&&(o=Nae({theaterId:l.theaterId,entryId:j,title:M.frontmatter.title,article:P,body:N,onApplied:()=>{B(j)}}))}catch(M){n||wp(e,t.tocContainer,M)}}}async function H(j){if(!n){bp(e,t.tocContainer),C(),y=null,_=null,p="idle",m=null;try{if(j){const M=await Kse(l.theaterId,j);if(n)return;y=M.meta,_=j;const V=Ui(),{html:Y,toc:te}=us(M.wikiEntry.body,{omitDuplicateTitle:M.wikiEntry.title,resolveWikiLink:P=>Jm(P),...Sl(V)});e.innerHTML=Uae(M,Y),t.tocContainer.innerHTML=rb(te);const J=e.querySelector("article");J&&te.length>0&&(s=aR(J,te,t.tocContainer))}else{const M=await fj(l.theaterId,"pending");if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Fae(M.items,Ui()("codex.reading.reviewQueuePending"))}}catch(M){n||wp(e,t.tocContainer,M)}}}async function T(j){if(!n){bp(e,t.tocContainer),C();try{if(j){const M=await Jse(l.theaterId,j);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Gae(M)}else{const M=await Zse(l.theaterId);if(n)return;t.tocContainer.innerHTML="",e.innerHTML=Kae(M)}}catch(M){n||wp(e,t.tocContainer,M)}}}async function $(j){const M=++i,V=l.theaterId;bp(e,t.tocContainer),C();try{const Y=await Yse(V,j);if(n||M!==i||V!==l.theaterId)return;const te=Ui(),{html:J,toc:P}=us(Y.content,Sl(te)),N=j??te("codex.reading.workspaceSchema");e.innerHTML=`<article class="document"><header class="document-header"><nav class="breadcrumb"><ol><li><span>Codex</span></li><li><span>${Fe(te("codex.reading.schema"))}</span></li><li><span aria-current="page">${Fe(N)}</span></li></ol></nav><h1>${Fe(N)}</h1><span class="queue-dl-mono">${Fe(Y.ref)}</span></header><div class="markdown-body" id="codex-reader-body">${J}</div></article>`,t.tocContainer.innerHTML=rb(P)}catch(Y){!n&&M===i&&V===l.theaterId&&wp(e,t.tocContainer,Y)}}return t.kind==="entry"&&t.initialEntryId?B(t.initialEntryId):t.kind==="drydock"?H(t.subId):t.kind==="conflicts"?T(t.subId):t.kind==="schema"&&$(t.subId),{destroy(){n=!0,i+=1,e.removeEventListener("click",w),C(),o?.destroy()},async setEntry(j){d=j,await B(j)},async navigateSub(j){f=j,t.kind==="drydock"?await H(j):t.kind==="conflicts"?await T(j):t.kind==="schema"&&await $(j)},refreshCallbacks(j){l={...l,...j}},async refreshLocale(){if(n)return;const j=e.parentElement,M=j?.scrollTop??0;vh(e,Lb(Ui())),t.kind==="entry"&&d?await B(d):t.kind==="drydock"?await H(f):t.kind==="conflicts"?await T(f):t.kind==="schema"&&await $(f),j&&requestAnimationFrame(()=>{j.scrollTop=M})}}}function bp(e,t){e.innerHTML=`<div class="codex-reader-loading" aria-live="polite" aria-busy="true">${Fe(Ui()("common.loading"))}</div>`,t.innerHTML=""}function wp(e,t,n){const i=n instanceof Error?n.message:String(n);e.innerHTML=`<div class="codex-reader-error" role="alert">${Fe(i)}</div>`,t.innerHTML=""}function $ae(e){const t=Ui();return`
339
+ <nav class="breadcrumb" aria-label="${en(t("codex.reading.entryLocationAria"))}">
340
+ <ol>
341
+ <li><span>Codex</span></li>
342
+ <li><span aria-current="page">${Fe(e)}</span></li>
343
+ </ol>
344
+ </nav>
345
+ `}function zae(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=Ui();return`
346
+ <section class="related-list">
347
+ <h2>${Fe(o("codex.reading.relatedEntries"))}</h2>
348
+ <div class="related-items">
349
+ ${s.map(l=>`<button class="related-card" type="button" data-entry-id="${en(l.entry.id)}">
350
+ <strong>${Fe(l.entry.title)}</strong>
351
+ <span>${_j(l.matchingTags)}</span>
352
+ </button>`).join("")}
353
+ </div>
354
+ </section>
355
+ `}function Fae(e,t){const n=Ui();return e.length===0?`<div class="codex-reader-empty"><p class="queue-empty">${Fe(n("codex.reading.noPendingPatches"))}</p></div>`:`
356
+ <article class="document">
357
+ <header class="document-header">
358
+ <nav class="breadcrumb" aria-label="${en(n("codex.reading.entryLocationAria"))}">
359
+ <ol>
360
+ <li><span>Codex</span></li>
361
+ <li><span aria-current="page">${Fe(n("codex.reading.reviewQueue"))}</span></li>
362
+ </ol>
363
+ </nav>
364
+ <h1>${Fe(t)}</h1>
365
+ </header>
366
+ <div class="queue-row-list">
367
+ ${e.map(Hae).join("")}
368
+ </div>
369
+ </article>
370
+ `}function Hae(e){const t=Ui(),n=e.op??"create_wiki",i=xj[n]??"?",s=kj(n,t),o=e.target??e.id,l=new Date(e.meta.createdAt).getTime(),f=[Number.isNaN(l)?"":PM(l,Bae())].filter(Boolean);return`
371
+ <button class="queue-row" type="button" data-patch-id="${en(e.id)}" aria-label="${en(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">${Fe(o)}</span>
377
+ ${e.summary?`<span class="queue-row-summary">${Fe(e.summary)}</span>`:""}
378
+ ${f.length>0?`<span class="queue-row-meta">${f.map(Fe).join(" · ")}</span>`:""}
379
+ </span>
380
+ </button>
381
+ `}function Uae(e,t){const n=Ui(),{patch:i,meta:s,wikiEntry:o,targetExists:l}=e,d=i.frontmatter.op,f=xj[d]??"?",p=kj(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="${en(n("codex.reading.entryLocationAria"))}">
385
+ <ol>
386
+ <li><span>Codex</span></li>
387
+ <li><span>${Fe(n("codex.reading.reviewQueue"))}</span></li>
388
+ <li><span aria-current="page">${Fe(p)}</span></li>
389
+ </ol>
390
+ </nav>
391
+ <button type="button" class="queue-back-btn" data-drydock-action="back">${Fe(n("codex.reading.backQueue"))}</button>
392
+ <h1><span class="op-badge">${f}</span> ${Fe(o.title)}</h1>
393
+ <p class="eyebrow">${Fe(i.frontmatter.target)} · v${o.version} · ${Fe(m)}</p>
394
+ ${Wae(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?Cj("idle",null):qae(s)}
401
+ </div>
402
+ </article>
403
+ `}function Wae(e,t){const n=[];return e&&n.push(`<span class="meta-chip">${Fe(e)}</span>`),t.length>0&&n.push(_j(t)),n.length===0?"":`<div class="meta-chips">${n.join("")}</div>`}function Cj(e,t){const n=Ui();return e==="submitting"?`<span class="queue-action-spinner" role="status" aria-label="${en(n("codex.reading.processingAria"))}"></span>`:e==="approving"?`
404
+ <p class="queue-decision-confirm">${Fe(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">${Fe(n("codex.reading.yesApprove"))}</button>
407
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">${Fe(n("common.cancel"))}</button>
408
+ </div>
409
+ ${t?`<p class="queue-action-error">${Fe(t)}</p>`:""}
410
+ `:e==="rejecting"?`
411
+ <div class="queue-reject-form">
412
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="${en(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">${Fe(n("codex.reading.submitRejection"))}</button>
415
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">${Fe(n("common.cancel"))}</button>
416
+ </div>
417
+ ${t?`<p class="queue-action-error">${Fe(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">${Fe(n("codex.reading.approve"))}</button>
422
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">${Fe(n("codex.reading.reject"))}</button>
423
+ </div>
424
+ `}function qae(e){const t=Ui(),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?` · ${Fe(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${Fe(i)}${o}</p>`}function Gae(e){const t=Ui(),n=e.meta?.status??t("codex.reading.conflictOpen");return`
425
+ <article class="document">
426
+ <header class="document-header">
427
+ <nav class="breadcrumb" aria-label="${en(t("codex.reading.entryLocationAria"))}">
428
+ <ol><li><span>Codex</span></li><li><span>${Fe(t("codex.reading.conflicts"))}</span></li></ol>
429
+ </nav>
430
+ <h1>${Fe(e.id)}</h1>
431
+ <p class="eyebrow">${Fe(t("codex.reading.conflictEyebrow",{status:n}))}</p>
432
+ </header>
433
+ <div class="markdown-body">
434
+ ${e.current?`<h2>${Fe(t("codex.reading.current"))}</h2><pre><code>${Fe(e.current)}</code></pre>`:""}
435
+ ${e.proposed?`<h2>${Fe(t("codex.reading.proposed"))}</h2><pre><code>${Fe(e.proposed)}</code></pre>`:""}
436
+ </div>
437
+ </article>
438
+ `}function Kae(e){const t=Ui();return e.length===0?`<div class="codex-reader-empty"><p>${Fe(t("codex.reading.noConflicts"))}</p></div>`:`
439
+ <article class="document">
440
+ <header class="document-header">
441
+ <h1>${Fe(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>${Fe(n.title||n.id)}</strong>
447
+ <span class="eyebrow">${Fe(n.status)}</span>
448
+ </li>`).join("")}
449
+ </ul>
450
+ </div>
451
+ </article>
452
+ `}let vl=null,au=null,Ej=null,Mo=null,_l=null,Ma=null,Zp=null,lb=null,Jp,z0=0;function hR(e){Ej=e}function Vae(e,t){const n=Jae();n.parentElement!==e&&e.appendChild(n),au||(au=yae(n,{initialTheaterId:t,onRequest:i=>Ej?.(i)}))}function Yae(e){au?.setTheater(e)}function Xae(){au?.refreshLocale(),Ma?.refreshLocale()}function Aj(e,t,n){const i=Qae(),s=eoe(),o=i.parentElement,l=n.kind==="entry"&&Zp==="entry"&&n.initialEntryId===lb;o&&o!==e&&(z0=o.scrollTop),i.parentElement!==e&&e.appendChild(i),s.parentElement!==t&&t.appendChild(s),!Ma||Zp!==n.kind?(Ma?.destroy(),Ma=Pae(i,{...n,tocContainer:s}),Zp=n.kind,Jp=n.subId):n.kind==="entry"&&n.initialEntryId&&n.initialEntryId!==lb?Ma.setEntry(n.initialEntryId):(n.kind==="drydock"||n.kind==="conflicts"||n.kind==="schema")&&n.subId!==Jp&&(Jp=n.subId,Ma.navigateSub(n.subId)),lb=n.kind==="entry"?n.initialEntryId??null:null,Ma.refreshCallbacks({onPatchOpen:n.onPatchOpen,onDecided:n.onDecided,onRelatedClick:n.onRelatedClick,onClose:n.onClose,theaterId:n.theaterId});const d=l?z0:0;requestAnimationFrame(()=>{e.scrollTop=d})}function Zae(){const e=Mo?.parentElement;e&&(z0=e.scrollTop)}function Tj(){Ma?.destroy(),Ma=null,Zp=null,Jp=void 0,Mo?.parentElement&&Mo.parentElement.removeChild(Mo),_l?.parentElement&&_l.parentElement.removeChild(_l)}function fR(){Tj(),au?.destroy(),au=null,vl?.parentElement&&vl.parentElement.removeChild(vl)}function Jae(){return vl||(vl=document.createElement("div"),vl.className="codex-host"),vl}function Qae(){return Mo||(Mo=document.createElement("div"),Mo.className="codex-reader-host"),Mo}function eoe(){return _l||(_l=document.createElement("div"),_l.className="codex-toc-host"),_l}const toe={id:"codex",title:e=>xr(e)("rail.codex.title"),defaultWidth:420,icon:()=>c.jsx(aoe,{}),render:e=>c.jsx(noe,{theaterId:e.theaterId})};function noe({theaterId:e}){const t=Ze(),n=lg(),i=Cs(),s=g.useRef(null),o=g.useRef(null),l=g.useRef(null),d=g.useRef(""),f=g.useRef(n),[p,m]=g.useState(null),y=i.codexReader,_=y!==null,w=i.codexReaderExpanded,S=i.theaters.find(T=>T.id===i.activeTheaterId)??null,x=i.theaters.length>0,k=e??"",C=p?.contextKey===k&&p.hasWiki?p.id:null,B=C!==null,H=y?`${y.kind}:${y.kind==="entry"?y.entryId:y.kind==="drydock"?y.patchId??"":y.kind==="conflicts"?y.id??"":y.templateId??""}`:null;return g.useEffect(()=>{if(d.current=k,Hv(),!e){m({contextKey:k,hasWiki:!1,id:null});return}roe(e).then(T=>{d.current===k&&m({contextKey:k,...T})}).catch(()=>{d.current===k&&m({contextKey:k,hasWiki:!1,id:null})})},[k,e]),g.useEffect(()=>{p?.contextKey===k&&!p.hasWiki&&fR()},[k,p]),g.useEffect(()=>()=>fR(),[]),g.useEffect(()=>{if(!B||!C)return;const T=s.current;if(T)return Vae(T,C),hR($=>{$.kind==="entry"?zs({kind:"entry",entryId:$.id}):$.kind==="drydock"?zs({kind:"drydock",patchId:$.patchId}):$.kind==="conflicts"?zs({kind:"conflicts",id:$.id}):$.kind==="schema"&&zs({kind:"schema",templateId:$.templateId})}),()=>{hR(null)}},[B,C,_,n]),g.useEffect(()=>{B&&C&&Yae(C)},[B,C]),g.useEffect(()=>{if(!B||!C||!_||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;Aj(o.current,l.current,{initialEntryId:T==="entry"?y.entryId:"",kind:T,subId:$,theaterId:C,onRelatedClick:j=>zs({kind:"entry",entryId:j}),onClose:()=>Hv(),onPatchOpen:j=>zs({kind:"drydock",patchId:j}),onDecided:()=>{Zm(),zs({kind:"drydock",patchId:void 0})}})},[B,C,_,w,H,n]),g.useEffect(()=>{f.current!==n&&(f.current=n,Xae())},[n]),g.useEffect(()=>{_||Tj()},[_]),B?_?c.jsxs("div",{className:"codex-rail-host is-split",children:[c.jsxs("div",{className:"codex-doc-pane",children:[c.jsxs("div",{className:"codex-doc-pane-head",children:[c.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":t("rail.codex.expandAria"),"data-codex-expand":"true",onClick:Rp,children:t("rail.codex.expand")}),c.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":t("rail.codex.closePaneAria"),onClick:Hv,children:"✕"})]}),c.jsx("div",{ref:o,className:"codex-doc-scroll"}),c.jsx("div",{ref:l,className:"codex-doc-toc-inline"})]}),c.jsx("div",{ref:s,className:"codex-nav-pane"})]}):c.jsx("div",{ref:s,className:"codex-rail-host"}):c.jsx(ioe,{activeTheater:S,hasTheaters:x})}function ioe({activeTheater:e,hasTheaters:t}){const n=Ze();return t?c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:n("rail.codex.unavailable")}),c.jsx("h1",{children:e?.label||n("rail.codex.thisTheater")}),c.jsx("p",{children:n("rail.codex.wikiUnavailable")})]}):c.jsxs("section",{className:"codex-empty-state",children:[c.jsx("p",{className:"codex-empty-eyebrow",children:n("rail.codex.emptyEyebrow")}),c.jsx("h1",{children:n("rail.codex.addTheater")}),c.jsx("p",{children:n("rail.codex.addTheaterHint")})]})}async function roe(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 soe(await t.json())}function soe(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 aoe(){return c.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[c.jsx("circle",{cx:"12",cy:"12",r:"9"}),c.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),c.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),c.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function ooe(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 loe(e){return[e.name,e.title,e.executionMode??"",e.waveCount,e.tasksDone,e.tasksTotal,e.updatedAt,e.sizeBytes].join("\0")}function F0(e){return e.replace(/\s+/g," ").trim()}function coe(e,t){const n=i=>F0(i).replace(/^lane\s+/i,"");return n(e)===n(t)}function Rj(e,t,n=Date.now()){const i=Date.parse(e);return Number.isFinite(i)?PM(i,t,n):xr(t)("common.unknown")}function uoe(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 doe(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function hoe(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function foe(e,t,n){return n.tasksTotal<=0?"none":n.tasksDone>=n.tasksTotal?"complete":e.slice(0,t).every(hoe)?"ready":"blocked"}const poe="plans-changed",moe=3e4;function goe(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(poe,()=>{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()},moe))}};return l(),()=>{s=!0,i!==null&&clearTimeout(i),n?.close()}}const H0=new Set;let yoe=0,Qm=null;function voe(e,t){Qm={theaterId:e,name:t,requestId:++yoe},Mj()}function _oe(e){Qm?.requestId===e.requestId&&(Qm=null,Mj())}function boe(){return g.useSyncExternalStore(woe,pR,pR)}function woe(e){return H0.add(e),()=>{H0.delete(e)}}function pR(){return Qm}function Mj(){for(const e of H0)e()}const Soe=360,xoe={id:"plans",title:e=>xr(e)("rail.plans.title"),defaultWidth:360,icon:Roe,render:e=>c.jsx(koe,{...e}),search:async({query:e,theaterId:t,limit:n,signal:i})=>(await _8(t,e,n,i)).plans.map(o=>({id:o.name,title:o.title,subtitle:o.name,activate:()=>voe(t,o.name)}))};function koe(e){const t=e.theaterId;return c.jsx(Coe,{...e},t)}function Coe(e){const{requestExtraWidth:t,theaterId:n}=e,i=e.language??"en",[s,o]=g.useState({kind:"no-theater"}),[l,d]=g.useState({kind:"loading"}),[f,p]=g.useState(null),[m,y]=g.useState(0),[_,w]=g.useState(0),[S,x]=g.useState(()=>new Set),[k,C]=g.useState(null),B=boe(),H=g.useRef(0),T=g.useRef(0),$=g.useRef(null),j=g.useRef(l),M=g.useRef(null),V=g.useRef(!1),Y=g.useRef(!1),te=g.useRef(!1),J=g.useRef(null),P=g.useRef(null),N=f?.theaterId===n?f.name:null;g.useEffect(()=>{!B||B.theaterId!==n||!n||(p({theaterId:n,name:B.name}),C(B))},[B,n]),g.useEffect(()=>{J.current=N},[N]),g.useEffect(()=>{const U=++H.current;if(!n){o({kind:"no-theater"});return}const O=$.current!==null,W=te.current;te.current=!1,O||o({kind:"loading"}),y8(n).then(K=>{if(U!==H.current)return;const z=new Map(K.plans.map(se=>[se.name,loe(se)])),G=$.current;if(G){const se=new Set(K.plans.filter(Se=>G.get(Se.name)!==z.get(Se.name)).map(Se=>Se.name));se.size>0&&(P.current&&clearTimeout(P.current),x(se),P.current=setTimeout(()=>x(new Set),1200))}$.current=z,o({kind:"ready",plans:K.plans});const Z=J.current;Z&&(z.has(Z)?z.get(Z)!==M.current&&w(se=>se+1):(M.current!==null||!V.current)&&(M.current=null,Y.current=!0,w(se=>se+1)))}).catch(()=>{U===H.current&&(!O||W)&&o({kind:"error"})})},[n,m]),g.useEffect(()=>{const U=++T.current;if(!n||!N)return;V.current=!0,M.current=$.current?.get(N)??null;const O=Y.current;Y.current=!1,!O&&j.current.kind==="ready"&&j.current.plan.name===N||(j.current={kind:"loading"},d({kind:"loading"})),v8(n,N).then(K=>{if(U===T.current){V.current=!1,M.current=$.current?.get(K.name)??null;const z={kind:"ready",plan:K};j.current=z,d(z)}}).catch(()=>{U===T.current&&(V.current=!1,M.current=null,j.current={kind:"error"},d({kind:"error"}))})},[_,N,n]),g.useEffect(()=>{if(n)return goe(n,()=>{y(U=>U+1)})},[n]),g.useEffect(()=>()=>{P.current&&clearTimeout(P.current)},[]),g.useLayoutEffect(()=>(t?.(N?Soe:null),()=>t?.(null)),[t,N]);const I=g.useCallback(U=>{n&&p({theaterId:n,name:U})},[n]),D=g.useCallback(U=>{_oe(U),C(O=>O?.requestId===U.requestId?null:O)},[]),E=g.useCallback(()=>{p(null),V.current=!1,M.current=null,j.current={kind:"loading"},d({kind:"loading"})},[]),R=g.useCallback(()=>{te.current=!0,y(U=>U+1)},[]),q=g.useCallback(()=>w(U=>U+1),[]);return c.jsx("div",{className:"plans-panel-shell",children:c.jsxs("div",{className:`plans-root${N?" is-reader-open":""}`,onKeyDown:U=>{U.key==="Escape"&&N&&E()},children:[N&&c.jsx(Aoe,{state:l,language:i,onClose:E,onRetry:q}),N&&c.jsx("div",{className:"plans-divider","aria-hidden":"true"}),c.jsx(Eoe,{revealTarget:k,selectedName:N,state:s,language:i,onRetry:R,onRevealHandled:D,onSelect:I,pulsedNames:S})]})})}function Eoe({revealTarget:e,selectedName:t,state:n,language:i,onRetry:s,onRevealHandled:o,onSelect:l,pulsedNames:d}){const f=Ze(),[p,m]=g.useState(""),[y,_]=g.useState("all"),[w,S]=g.useState(null),x=g.useRef(new Map);if(g.useLayoutEffect(()=>{if(!(!e||n.kind==="loading")){if(n.kind!=="ready"){o(e);return}if(p!==""||y!=="all"){m(""),_("all");return}x.current.get(e.name)?.scrollIntoView({block:"nearest"}),o(e)}},[o,p,e,n,y]),n.kind==="no-theater")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(cb,{children:f("rail.plans.selectTheater")})});if(n.kind==="loading")return c.jsx("div",{className:"plans-list-pane",children:c.jsx("div",{className:"plans-loading",children:f("rail.plans.loadingList")})});if(n.kind==="error")return c.jsx("div",{className:"plans-list-pane",children:c.jsx(Nj,{message:f("rail.plans.loadListError"),onRetry:s})});if(n.plans.length===0)return c.jsx("div",{className:"plans-list-pane",children:c.jsx(cb,{detail:f("rail.plans.emptyDetail"),children:f("rail.plans.empty")})});const k=ooe(n.plans,p,y),C=(T,$)=>{const j=(T+$+k.length)%k.length;x.current.get(k[j]?.name??"")?.focus()},B=(T,$)=>{(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),C($,T.key==="ArrowDown"?1:-1))},H=(T,$)=>{T.stopPropagation(),navigator.clipboard&&navigator.clipboard.writeText(`plans/${$}`).then(()=>{S($),window.setTimeout(()=>S(j=>j===$?null:j),1200)}).catch(()=>{})};return c.jsxs("div",{className:"plans-list-pane",children:[c.jsxs("div",{className:"plans-toolbar",children:[c.jsxs("label",{className:"plans-search-label",children:[c.jsx("span",{children:f("rail.plans.search")}),c.jsx("input",{className:"plans-search",value:p,onChange:T=>m(T.target.value)})]}),c.jsx("div",{className:"plans-filter-group","aria-label":f("rail.plans.statusAria"),children:["all","in-progress","complete"].map(T=>c.jsx("button",{type:"button",className:`plans-filter${y===T?" is-active":""}`,"aria-pressed":y===T,onClick:()=>_(T),children:f(T==="all"?"rail.plans.filterAll":T==="in-progress"?"rail.plans.filterInProgress":"rail.plans.filterComplete")},T))}),c.jsx("button",{type:"button",className:"plans-refresh",onClick:s,children:f("rail.plans.refresh")})]}),c.jsxs("div",{className:"plans-list","aria-label":f("rail.plans.listAria"),children:[k.length===0&&c.jsx(cb,{children:f("rail.plans.noMatch")}),k.map((T,$)=>{const j=uoe(T.tasksDone,T.tasksTotal),M=j===100;return c.jsxs("div",{className:`plans-row${t===T.name?" is-selected":""}${d.has(T.name)?" is-pulsing":""}`,children:[c.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=>B(V,$),children:[c.jsx("span",{className:"plans-row-name",children:T.name}),c.jsxs("span",{className:"plans-row-meta",children:[f("rail.plans.rowMeta",{waves:T.waveCount,done:T.tasksDone,total:T.tasksTotal,relative:Rj(T.updatedAt,i)}),T.executionMode==="parallel"?f("rail.plans.rowMetaParallel"):""]}),j!==null&&c.jsx("span",{className:"plans-progress-track","aria-label":f("rail.plans.progressAria",{progress:j}),children:c.jsx("span",{className:`plans-progress-fill${M?" is-complete":""}`,style:{width:`${j}%`}})})]}),c.jsx("button",{type:"button",className:"plans-copy",onClick:V=>H(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 Aoe({state:e,language:t,onClose:n,onRetry:i}){const s=Ze();return e.kind==="loading"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:s("rail.plans.readerTitle")}),c.jsx(U0,{onClose:n})]}),c.jsx("div",{className:"plans-loading",children:s("rail.plans.loadingPlan")})]}):e.kind==="error"?c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsx("span",{className:"plans-reader-title",children:s("rail.plans.readerTitle")}),c.jsx(U0,{onClose:n})]}),c.jsx(Nj,{message:s("rail.plans.loadPlanError"),onRetry:i})]}):c.jsx(Toe,{plan:e.plan,language:t,onClose:n})}function Toe({plan:e,language:t,onClose:n}){const i=Ze(),s=g.useMemo(()=>{const p=new DOMParser().parseFromString(us(e.content,Sl(i)).html,"text/html");return ub(p.body,i),p.body.innerHTML},[e.content,i]),o=g.useRef(null),l=g.useRef(null),d=g.useCallback((p,m)=>{const y=o.current;if(!y)return;const _=[...y.querySelectorAll(p)].find(S=>p==="h3"?coe(S.textContent??"",m):F0(S.textContent??"")===F0(m));if(!_)return;const w=window.matchMedia("(prefers-reduced-motion: reduce)").matches;_.scrollIntoView({behavior:w?"auto":"smooth",block:"start"}),_.classList.remove("plans-heading-flash"),_.getBoundingClientRect(),_.classList.add("plans-heading-flash"),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>_.classList.remove("plans-heading-flash"),1200)},[]),f=g.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 _=m.textContent;m.textContent=i("rail.plans.codeCopied"),window.setTimeout(()=>{m.textContent=_},1200)},[i]);return g.useEffect(()=>{const p=o.current;if(!p)return;vh(p,Lb(i)),ub(p,i);const m=new MutationObserver(()=>ub(p,i));return m.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>m.disconnect()},[s,i]),g.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),c.jsxs("div",{className:"plans-reader-pane",children:[c.jsxs("div",{className:"plans-reader-head",children:[c.jsxs("div",{className:"plans-reader-heading",children:[c.jsx("h2",{className:"plans-reader-title",children:e.title}),c.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&c.jsx("span",{className:"plans-mode-badge",children:i("rail.plans.parallelBadge")}),i("rail.plans.readerMeta",{waves:e.waves.length,done:e.tasksDone,total:e.tasksTotal,relative:Rj(e.updatedAt,t)})]})]}),c.jsx(U0,{onClose:n})]}),c.jsxs("div",{className:"plans-reader-body",children:[c.jsx("div",{className:"plans-wave-strip","aria-label":i("rail.plans.waveProgressAria"),children:e.waves.map((p,m)=>{const y=doe(p.tasksDone,p.tasksTotal);return c.jsxs("div",{className:`plans-wave is-${y}`,children:[c.jsx("button",{type:"button",className:"plans-wave-heading",onClick:()=>d("h2",p.heading),children:p.heading}),p.tasksTotal>0&&c.jsxs("span",{className:"plans-wave-count",children:[p.tasksDone,"/",p.tasksTotal]}),p.lanes.length>0&&c.jsx("div",{className:"plans-lane-list",children:p.lanes.map((_,w)=>{const S=foe(e.waves,m,_);return c.jsxs("div",{className:`plans-lane is-${S}`,children:[c.jsx("button",{type:"button",className:"plans-lane-id",onClick:()=>d("h3",_.heading),children:_.id??_.heading}),_.tasksTotal>0&&c.jsxs("span",{className:"plans-lane-count",children:[_.tasksDone,"/",_.tasksTotal]}),S==="ready"&&c.jsx("span",{className:"plans-lane-ready",children:i("rail.plans.laneReady")})]},_.id??`${p.index}-${w}`)})})]},p.index)})}),c.jsx("div",{ref:o,className:"plans-markdown markdown-body",onClick:f,dangerouslySetInnerHTML:{__html:s}})]})]})}function U0({onClose:e}){const t=Ze();return c.jsx("button",{className:"plans-close",type:"button","aria-label":t("rail.plans.closePlanAria"),onClick:e,children:"✕"})}function cb({children:e,detail:t}){return c.jsxs("div",{className:"plans-empty",children:[c.jsx("span",{children:e}),t&&c.jsx("span",{className:"plans-empty-detail",children:t})]})}function Nj({message:e,onRetry:t}){const n=Ze();return c.jsxs("div",{className:"plans-error-state",children:[c.jsx("span",{children:e}),c.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:n("common.retry")})]})}function ub(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 Roe(){return c.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[c.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),c.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Lj=[Pse,toe,xoe];function Moe(e="right"){const{railPanels:t}=gu();return e==="right"?t.filter(n=>(n.side??"right")==="right"):t}const Noe=360;function Loe(e){const{codexReader:t}=Cs();return e==="codex"&&t!==null?Noe:0}const rs=240,Ooe=312,K1="fleet-console.rail.panelWidths",mR="fleet-console.rail.panelWidth";function Ioe(e){return[{label:e("rail.chrome.opacitySolid"),value:100},{label:"90",value:90},{label:"75",value:75},{label:"60",value:60}]}function eg(){try{const e=localStorage.getItem(K1);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>=rs&&(n[i]=Math.round(s));return n}catch{}return Object.create(null)}function gR(e){const t=eg();if(e===null)return t;try{const n=localStorage.getItem(mR);if(n===null)return t;const i=Number(n);Number.isFinite(i)&&i>=rs&&(t[e]=Math.round(i),localStorage.setItem(K1,JSON.stringify(t))),localStorage.removeItem(mR)}catch{}return t}function yR(e,t,n,i){const s=e===null?void 0:i[e];return s!==void 0&&s>=rs&&s<=n?s:Math.max(rs,Math.min(n,Math.round(t??Ooe)))}function vR(e,t){if(e!==null)try{const n=eg();n[e]=Math.round(t),localStorage.setItem(K1,JSON.stringify(n))}catch{}}function joe({theaterId:e,api:t}){const n=Ze(),i=n("rail.theater.fallback"),s=g.useSyncExternalStore(SS,()=>Us().theaters.find(K=>K.id===e)?.label??i,()=>i),o=na(),l=sr(o.state?.language??"auto"),d=g.useRef(null),f=zN(),p=FN(),m=yF(),y=vF(),_=g.useRef(p),w=g.useRef(m),S=Moe(),x=Lj,C=[...x,...S].find(K=>K.id===f)??null,B=C?jl(C.title,l):"",H=C!==null,T=Loe(f)+(C?.preferredExtraWidth??0)+gF(),[$,j]=g.useState(()=>window.innerWidth),M=Math.max(rs,Math.floor($-148-T)),V=g.useRef(T);V.current=T;const Y=g.useRef(f);Y.current=f;const te=g.useRef(C===null),J=g.useRef(C?.id??null),[P,N]=g.useState(()=>{const K=gR(C?.id??null);return yR(f,C?.defaultWidth,M,K)}),I=g.useRef(P),D=g.useRef(P),[E,L]=g.useState(!1),[R,q]=g.useState(!1);g.useLayoutEffect(()=>{const K=()=>{const z=window.innerWidth;j(G=>G===z?G:z)};return window.addEventListener("resize",K),()=>window.removeEventListener("resize",K)},[]),g.useLayoutEffect(()=>{const K=C?.id??null;if(J.current===K){if(E||C===null||f===null)return;const se=eg()[f];if(se===void 0||se>M||se===I.current)return;I.current=se,D.current=se,N(se);return}J.current=K;const z=C!==null,G=te.current&&z?gR(f):eg();z&&(te.current=!1);const Z=yR(f,C?.defaultWidth,M,G);I.current=Z,D.current=Z,N(Z)},[f,C?.id,C?.defaultWidth,E,M]),g.useLayoutEffect(()=>{const K=E?D.current:I.current,z=Math.max(rs,Math.min(M,K));z!==D.current&&(D.current=z,N(z))},[E,M]),g.useLayoutEffect(()=>{_.current&&!p&&wN(d.current,".command-band-rail-toggle"),_.current=p},[p]),g.useLayoutEffect(()=>{if(w.current===m)return;w.current=m,q(!0);let K=null;const z=window.requestAnimationFrame(()=>{K=window.requestAnimationFrame(()=>q(!1))});return()=>{window.cancelAnimationFrame(z),K!==null&&window.cancelAnimationFrame(K)}},[m]);const U=g.useCallback(K=>{K.preventDefault();const z=K.clientX,G=D.current;L(!0);const Z=Se=>{const pe=z-Se.clientX,$e=Math.max(rs,Math.floor(window.innerWidth-148-V.current)),je=Math.max(rs,Math.min($e,Math.round(G+pe)));D.current=je,N(je)},se=()=>{document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",se),I.current=D.current,L(!1),vR(Y.current,I.current)};document.addEventListener("pointermove",Z),document.addEventListener("pointerup",se)},[]),O=g.useCallback(K=>{let z;const G=K.shiftKey?64:16,Z=Math.max(rs,Math.floor(window.innerWidth-148-V.current));switch(K.key){case"ArrowLeft":z=D.current+G;break;case"ArrowRight":z=D.current-G;break;case"Home":z=rs;break;case"End":z=Z;break;default:return}K.preventDefault(),z=Math.max(rs,Math.min(Z,Math.round(z))),I.current=z,D.current=z,N(z),vR(Y.current,I.current)},[]),W=g.useMemo(()=>({theaterId:e,pathContext:{kind:"root",relPath:null,label:s},api:t,language:l,requestExtraWidth:K=>{f!==null&&mF(f,K)}}),[e,s,t,l,f]);return c.jsxs("div",{ref:d,className:`right-rail${H?" is-open":""}${p?" is-expanded":" is-closed"}${E?" is-dragging":""}${R?" 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":`${H?P+T:0}px`},children:[c.jsxs("div",{className:"right-rail-panel-slot",style:m==="overlay"?{"--right-rail-overlay-alpha":y/100}:void 0,children:[C&&c.jsx("div",{className:"right-rail-resize-handle",onPointerDown:U,onKeyDown:O,role:"separator","aria-orientation":"vertical",tabIndex:0,"aria-label":n("rail.chrome.resizePanel",{title:B}),"aria-controls":`rail-panel-${C.id}`,"aria-valuenow":Math.round(P),"aria-valuemin":rs,"aria-valuemax":M}),C&&c.jsx(Doe,{activePanel:C,activePanelTitle:B,activeId:f,ctx:W,panelBehavior:m,overlayAlpha:y})]}),c.jsx("nav",{className:"right-rail-icons","aria-label":n("rail.chrome.toolsAria"),children:c.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":n("rail.chrome.panelsAria"),children:[x.map(K=>c.jsx(_R,{panel:K,language:l,isActive:f===K.id},K.id)),x.length>0&&S.length>0?c.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,S.map(K=>c.jsx(_R,{panel:K,language:l,isActive:f===K.id},K.id))]})})]})}const Doe=g.memo(function({activePanel:t,activePanelTitle:n,activeId:i,ctx:s,panelBehavior:o,overlayAlpha:l}){const d=Ze(),f=Ioe(d);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"right-rail-panel-head",children:[c.jsx("span",{className:"right-rail-panel-title",children:n}),c.jsx("button",{className:`right-rail-float-toggle${o==="overlay"?" is-active":""}`,type:"button","aria-pressed":o==="overlay","aria-label":d("rail.chrome.floatToggle"),onClick:fF,children:d("rail.chrome.floatLabel")}),o==="overlay"?c.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 c.jsx("button",{className:`right-rail-opacity-segment${m?" is-active":""}`,type:"button","aria-pressed":m,onClick:()=>pF(p.value),children:p.label},p.value)})}):null,c.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":d("rail.chrome.closePanel",{title:n}),onClick:dF,children:"✕"})]}),c.jsx("div",{id:`rail-panel-${t.id}`,className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:t.render(s)})]})});function _R({panel:e,language:t,isActive:n}){const i=g.useCallback(()=>uF(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon,o=jl(e.title,t);return c.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 Boe='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Poe(){const e=Ze(),{codexReader:t,codexReaderExpanded:n,activeTheaterId:i}=Cs(),s=g.useRef(null),o=g.useRef(null),l=g.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=g.useCallback(()=>{Zae(),L7()},[]);return g.useEffect(()=>{if(!f)return;const m=t;document.body.setAttribute("data-codex-reading","true");const y=document.querySelector(".operations-canvas"),_=document.querySelector(".operations-side-bar");y?.setAttribute("inert",""),_?.setAttribute("inert","");const w=S=>{if(S.key==="Escape"){S.preventDefault(),S.stopPropagation(),p();return}S.key==="Tab"&&$oe(s.current,S)};return window.addEventListener("keydown",w,!0),()=>{window.removeEventListener("keydown",w,!0),document.body.removeAttribute("data-codex-reading"),y?.removeAttribute("inert"),_?.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]),g.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;Aj(o.current,l.current,{initialEntryId:m==="entry"?t.entryId:"",kind:m,subId:y,theaterId:i,onRelatedClick:_=>{zs({kind:"entry",entryId:_}),Rp()},onClose:p,onPatchOpen:_=>{zs({kind:"drydock",patchId:_}),Rp()},onDecided:()=>{Zm(),zs({kind:"drydock",patchId:void 0}),Rp()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[f,d]),f?ea.createPortal(c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"codex-reading-scrim",onClick:p,"aria-hidden":"true"}),c.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":e("chrome.codexReading.dialogAria"),children:[c.jsxs("div",{className:"codex-reading-sheet-head",children:[c.jsx("span",{className:"codex-reading-sheet-eyebrow",children:e("chrome.codexReading.eyebrow")}),c.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":e("chrome.codexReading.closeAria"),onClick:p,children:"✕"})]}),c.jsxs("div",{className:"codex-reading-sheet-body",children:[c.jsx("div",{ref:o,className:"codex-reading-sheet-read"}),c.jsx("aside",{ref:l,className:"codex-reading-sheet-toc","aria-label":e("chrome.codexReading.onThisPage")})]})]})]}),document.body):null}function $oe(e,t){if(!e)return;const n=[...e.querySelectorAll(Boe)].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())}function zoe(e,t){return t!=="ArrowLeft"&&t!=="ArrowRight"?null:e?t==="ArrowRight"?"triage-defer":"triage-noop":t==="ArrowRight"?"focus-next":"focus-previous"}const Foe=["awaiting","running","idle","dormant"];function Hoe({operations:e,operationStatus:t,notificationIds:n,onOpen:i}){const s=Ze(),o=Foe.map(l=>({status:l,entries:e.filter(d=>Li(d,t)===l)})).filter(({entries:l})=>l.length>0);return c.jsxs("section",{className:"mobile-operation-list","aria-labelledby":"mobile-operation-list-title",children:[c.jsxs("header",{className:"mobile-list-header",children:[c.jsxs("div",{children:[c.jsx("span",{className:"mobile-kicker",children:s("mobile.operations.kicker")}),c.jsx("h1",{id:"mobile-operation-list-title",children:s("mobile.operations.title")})]}),c.jsx("span",{className:"mobile-total-count",children:e.length})]}),c.jsx("div",{className:"mobile-status-sections",children:o.length===0?c.jsx("p",{className:"mobile-operation-empty",children:s("mobile.operations.empty")}):o.map(({status:l,entries:d})=>c.jsxs("section",{className:"mobile-status-section","aria-labelledby":`mobile-status-${l}`,children:[c.jsxs("header",{children:[c.jsx("h2",{id:`mobile-status-${l}`,children:s(`mobile.status.${l}`)}),c.jsx("span",{children:d.length})]}),c.jsx("div",{className:"mobile-operation-cards",children:d.map(f=>{const p=typeof f.payload.cliLabel=="string"&&f.payload.cliLabel.trim()?f.payload.cliLabel.trim():null;return c.jsxs("button",{type:"button",className:"mobile-operation-card",onClick:()=>i(f.id),children:[c.jsx("span",{className:Uoe(l),"aria-hidden":"true"}),c.jsxs("span",{className:"mobile-operation-card-copy",children:[c.jsx("strong",{children:f.title}),p?c.jsx("span",{children:p}):null]}),n.has(f.id)?c.jsx("span",{className:"mobile-operation-alert-mark","aria-label":s("mobile.operations.hasAlert"),children:"!"}):null,c.jsx("span",{className:"mobile-operation-chevron","aria-hidden":"true",children:"›"})]},f.id)})})]},l))})]})}function Uoe(e){const t=Eh(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"}const Woe=1500;function qoe({operation:e,theme:t,language:n,active:i,onBack:s,onActivate:o,onClose:l}){const d=Ze(),f=g.useRef(null),[p,m]=g.useState(!1),[y,_]=g.useState({x:0,y:0,width:390,height:640,zIndex:0}),w=g.useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},[]),S=g.useCallback(()=>{w(),m(!1)},[w]),x=g.useCallback(()=>{if(p){S(),l();return}m(!0),f.current=window.setTimeout(()=>{f.current=null,m(!1)},Woe)},[S,p,l]);g.useEffect(()=>(S(),w),[w,S,e.id]);const k=g.useCallback(T=>{if(!T)return;const $=()=>_(M=>({...M,width:Math.max(1,T.clientWidth),height:Math.max(1,T.clientHeight)}));if($(),typeof ResizeObserver>"u")return;const j=new ResizeObserver($);return j.observe(T),()=>j.disconnect()},[]),[C,B]=g.useState(null);g.useEffect(()=>k(C),[k,C]);const H={active:i,geometry:y,operation:e,theme:t,language:n,zoom:1,onActivate:o,onClose:l,onGeometryChange:_,onRequestCompanions:()=>{},companionsOpen:!1,hiddenCompanionPanelIds:[],onSetCompanionPanelVisible:()=>{}};return c.jsxs("section",{className:"mobile-session-view",children:[c.jsxs("header",{className:"mobile-session-header",children:[c.jsx("button",{type:"button",className:"mobile-header-button",onClick:()=>{S(),s()},"aria-label":d("mobile.session.backAria"),children:c.jsx("span",{"aria-hidden":"true",children:"‹"})}),c.jsx("h1",{children:e.title}),c.jsx("button",{type:"button",className:"mobile-header-action",onClick:x,children:d(p?"mobile.session.closeArmed":"mobile.session.close")})]}),c.jsx("div",{className:"mobile-session-body",ref:B,children:c.jsx(oj,{operationId:e.id,config:H,className:"mobile-operation-body-slot"})})]})}const Oj="fleet-console.mobile.activeTab",W0=new Set;let q0=Voe();function Ij(){return g.useSyncExternalStore(Koe,()=>q0)}function Goe(e){if(q0!==e){q0=e;try{localStorage.setItem(Oj,e)}catch{}for(const t of W0)t()}}function Koe(e){return W0.add(e),()=>W0.delete(e)}function Voe(){try{const e=localStorage.getItem(Oj);if(e==="alerts"||e==="tools")return e}catch{}return"operations"}const Yoe=["operations","alerts","tools"];function Xoe({onSelect:e}){const t=Ze(),n=Ij();return c.jsx("nav",{className:"mobile-tab-bar","aria-label":t("mobile.tabs.aria"),children:Yoe.map(i=>c.jsxs("button",{type:"button",className:`mobile-tab ${n===i?"is-active":""}`,"aria-current":n===i?"page":void 0,onClick:()=>{Goe(i),e?.(i)},children:[c.jsx(Zoe,{tab:i}),c.jsx("span",{children:t(`mobile.tabs.${i}`)})]},i))})}function Zoe({tab:e}){return e==="operations"?c.jsxs("svg",{className:"mobile-tab-icon",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("path",{d:"M7 5h9M7 10h9M7 15h9"}),c.jsx("path",{d:"M4 5h.01M4 10h.01M4 15h.01",strokeWidth:"2.5"})]}):e==="alerts"?c.jsxs("svg",{className:"mobile-tab-icon",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("path",{d:"M5.5 8a4.5 4.5 0 0 1 9 0c0 5 2 5 2 6H3.5c0-1 2-1 2-6Z"}),c.jsx("path",{d:"M8.5 16a1.75 1.75 0 0 0 3 0"})]}):c.jsxs("svg",{className:"mobile-tab-icon",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor","aria-hidden":"true",children:[c.jsx("rect",{x:"3",y:"3",width:"5",height:"5",rx:"1"}),c.jsx("rect",{x:"12",y:"3",width:"5",height:"5",rx:"1"}),c.jsx("rect",{x:"3",y:"12",width:"5",height:"5",rx:"1"}),c.jsx("rect",{x:"12",y:"12",width:"5",height:"5",rx:"1"})]})}function Joe({operations:e,activeOperationId:t,operationStatus:n,operationNotifications:i,theme:s,language:o,onSelectOperation:l,onCloseOperation:d}){const f=Ze(),p=Ij(),[m,y]=g.useState(()=>bR()),_=e.find(C=>C.id===m)??null,w=g.useMemo(()=>new Set(Object.keys(i)),[i]);g.useEffect(()=>{const C=()=>{const B=bR();y(B),l(B)};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[l]),g.useEffect(()=>{m===null||_||(Sp(),y(null),l(null))},[l,_,m]),g.useEffect(()=>{_&&l(_.id)},[l,_]);const S=C=>{const B=new URL(window.location.href);B.searchParams.set("op",C),window.history.pushState({...window.history.state,fleetMobileOperation:!0},"",B),y(C),l(C)},x=()=>{window.history.state?.fleetMobileOperation===!0?window.history.back():(Sp(),y(null),l(null))};let k;return _?k=c.jsx(qoe,{operation:_,theme:s,language:o,active:t===_.id,onActivate:()=>l(_.id),onBack:x,onClose:()=>{d(_.id),Sp(),y(null)}}):p==="operations"?k=c.jsx(Hoe,{operations:e,operationStatus:n,notificationIds:w,onOpen:S}):p==="alerts"?k=c.jsxs("section",{className:"mobile-simple-panel",children:[c.jsx("h1",{children:f("mobile.alerts.title")}),w.size===0?c.jsx("p",{children:f("mobile.alerts.empty")}):e.filter(C=>w.has(C.id)).map(C=>c.jsx("button",{type:"button",onClick:()=>S(C.id),children:C.title},C.id))]}):k=c.jsxs("section",{className:"mobile-simple-panel",children:[c.jsx("h1",{children:f("mobile.tools.title")}),c.jsx("p",{children:f("mobile.tools.empty")})]}),c.jsxs("main",{className:"mobile-shell",children:[c.jsx("div",{className:"mobile-shell-content",children:k}),c.jsx(Xoe,{onSelect:()=>{m!==null&&(Sp(),y(null),l(null))}})]})}function bR(){return new URL(window.location.href).searchParams.get("op")}function Sp(e){const t=new URL(window.location.href);t.searchParams.delete("op"),window.history.replaceState({...window.history.state,fleetMobileOperation:!1},"",t)}const xp=jh().api,G0=560,K0=360,Qp=new Set;function Qoe({state:e,claimBootPanelMinimization:t,onDeferredDeletion:n}){const i=g.useRef(null),s=hM(),o=fM(),l=ag(),d=mM(),f=gu(),p=HI(),m=na(),y=sr(m.state?.language??"auto"),[_,w]=g.useState([]),S=g.useMemo(()=>ele(e).map(G=>G.id),[e.operations,e.activeTheaterId]),x=g.useRef(e),k=g.useRef(0);x.current=e,g.useEffect(()=>{bM(e.activeTheaterId),e.activeTheaterId&&_s(e.activeTheaterId)&&Qc(e.activeTheaterId,!0)},[e.activeTheaterId]),g.useEffect(()=>{for(const G of e.theaters)_$(G.id,e.operations,e.operationStatus)},[e.operationStatus,e.operations,e.theaters]),g.useEffect(()=>{if(!e.activeTheaterId){w([]);return}CR().then(w).catch(()=>{})},[e.activeTheaterId]),g.useEffect(()=>{const G=Z=>{if(p.effective==="mobile"||!Y$()||!Z.altKey||Z.metaKey||Z.ctrlKey)return;const se=document.activeElement;if(se instanceof HTMLElement&&se.matches("input, textarea, [contenteditable='true']")&&!se.closest(".xterm"))return;if(Z.code==="KeyS"&&!Z.shiftKey){Z.preventDefault(),Z.stopImmediatePropagation(),hm();return}if(Z.code==="KeyF"&&!Z.shiftKey){Z.preventDefault(),Z.stopImmediatePropagation(),xM();return}if(Z.code==="KeyT"&&!Z.shiftKey){Z.preventDefault(),Z.stopImmediatePropagation();const mt=x.current.activeTheaterId;if(mt){const Ct=!_s(mt);if(Ct){const dt=yN(document.activeElement);dt&&eu(mt,dt)}Qc(mt,Ct)}return}if(Z.shiftKey)return;const Se=x.current,pe=Se.activeTheaterId,$e=pe!==null&&_s(pe),je=zoe($e,Z.key);if(je===null)return;if($e){if(Z.preventDefault(),Z.stopImmediatePropagation(),je==="triage-noop")return;const mt=document.querySelector(".canvas-operation.is-triage-stage[data-operation-id]")?.dataset.operationId;if(!mt)return;vN(pe,Se.operations.filter(dt=>dt.theaterId===pe),Se.operationStatus).some(dt=>dt.operation.id===mt)&&y$(pe,mt);return}const St=Fs(),Re=Se.operations.filter(mt=>mt.theaterId===Se.activeTheaterId),ze=N7(Re,Se.groups.filter(mt=>mt.theaterId===Se.activeTheaterId),St.operationOrder,St.collapsedGroups,St.minimized);if(Z.preventDefault(),Z.stopImmediatePropagation(),ze.length===0)return;const lt=Br()??Gs()??x.current.activeOperationId,kt=M7(ze,lt,je==="focus-next"?1:-1);kt&&db(kt,f.operationKinds,xp,k,()=>Ml(kt))};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[o,l,s,f.operationKinds,p.effective]),g.useEffect(()=>{if(p.effective==="mobile")return;for(const se of S)_M(se);if(!e.operationsHydrated||(mP(S),!e.activeTheaterId))return;const G=t(e.activeTheaterId);if(G===null)return;const Z=new Set([x.current.pendingOperationFocus,Br(),Gs()].filter(se=>se!==null));vM(G.filter(se=>!Z.has(se)))},[t,S,e.activeTheaterId,e.operationsHydrated,p.effective]);const C=g.useCallback(G=>{const Z=x.current.operations.find(je=>je.id===G);if(!Z)return;if(_s(Z.theaterId)){eu(Z.theaterId,G);return}const se=Fs(),Se=se.operations[G]??Z.geometry??wR(Z);se.operations[G]||Rb(G,Se),se.minimized.includes(G)&&j0(G),Mb(G),_i(G);const $e=tle(i.current);$e&&gP(G,$e)},[]);g.useEffect(()=>{const G=e.pendingOperationFocus;if(G!==null){if(p.effective==="mobile"){if(e.operations.find(se=>se.id===G&&se.theaterId===e.activeTheaterId)){const se=new URL(window.location.href);se.searchParams.set("op",G),new URL(window.location.href).searchParams.get("op")!==G&&window.history.pushState({...window.history.state,fleetMobileOperation:!0},"",se),window.dispatchEvent(new Event("popstate"))}r2();return}db(G,f.operationKinds,xp,k,()=>C(G)),r2()}},[C,f.operationKinds,e.activeTheaterId,e.operations,e.pendingOperationFocus,p.effective]);const B=!!e.activeTheaterId&&!e.addingTheater,H=(e.operations??[]).filter(G=>G.theaterId===e.activeTheaterId),T=g.useCallback((G,Z)=>f.plugins.find(Se=>Se.id===G)?.renderLaunchIcon?.(Z)??null,[f.plugins]),$=g.useCallback((G,Z,se)=>{if(!x.current.activeTheaterId)return;const Se={...SR(se),zIndex:Rl()};hb(G,Z,Se,x.current.activeTheaterId,f.plugins)},[f.plugins]),j=g.useCallback((G,Z)=>{if(!x.current.activeTheaterId)return;const se=nle(i.current),Se={...SR(se),zIndex:Rl()};hb(G,Z,Se,x.current.activeTheaterId,f.plugins)},[f.plugins]),M=g.useCallback((G,Z,se)=>{x.current.activeTheaterId&&hb(G,Z,se,x.current.activeTheaterId,f.plugins)},[f.plugins]),V=g.useCallback(G=>{const Z=x.current.operations.find(se=>se.id===G);if(Z){if(Z.theaterId!==x.current.activeTheaterId){k.current+=1,Ml(G);return}db(G,f.operationKinds,xp,k,()=>C(G))}},[C,f.operationKinds]),Y=g.useCallback(G=>{x.current.activeOperationId===G&&_i(null),ij(G),yM(G)},[]),te=g.useCallback((G,Z)=>{Ap(G,{accent:Z}).then(()=>Yi(null)).then(tr).catch(()=>{})},[]),J=g.useCallback((G,Z)=>{eM(G,Z).then(()=>Yi(null)).then(tr).catch(()=>{})},[]),P=g.useCallback((G,Z)=>{Ap(G,{groupId:Z}).then(()=>Yi(null)).then(tr).catch(()=>{})},[]),N=g.useCallback((G,Z,se)=>{x8({theaterId:G,name:Z,color:"blue"}).then(Se=>se?Ap(se,{groupId:Se.id}).then(()=>{}):void 0).then(()=>Promise.all([Yi(null).then(tr),So().then(xo)])).catch(()=>{})},[]),I=g.useCallback((G,Z)=>{Z&&Pv(G,{color:Z}).then(()=>So()).then(xo).catch(()=>{})},[]),D=g.useCallback((G,Z)=>{Pv(G,{name:Z}).then(()=>So()).then(xo).catch(()=>{})},[]),E=g.useCallback(G=>{const Z=new Map(x.current.groups.map(Se=>[Se.id,Se])),se=G.flatMap((Se,pe)=>{const $e=Z.get(Se);return!$e||$e.order===pe?[]:[Pv(Se,{order:pe})]});se.length!==0&&Promise.allSettled(se).then(()=>So()).then(xo).catch(()=>{})},[]),L=g.useCallback(G=>{const Z=new Map(x.current.theaters.map(Se=>[Se.id,Se])),se=G.flatMap((Se,pe)=>{const $e=Z.get(Se);return!$e||$e.order===pe?[]:[m8(Se,pe)]});se.length!==0&&Promise.allSettled(se).then(()=>vb(null)).then(um).catch(()=>{})},[]),R=g.useCallback(G=>{k8(G).then(()=>Promise.all([Yi(null).then(tr),So().then(xo)])).catch(()=>{})},[]),q=g.useCallback(G=>{if(Qp.has(G))return;Br()===G&&Sr();const Z=x.current.operations.find(pe=>pe.id===G)?.theaterId;Z&&_s(Z)&&pN(Z,G),Qp.add(G);const se=x.current.operations.find(pe=>pe.id===G)?.pluginId,Se=(se?f.plugins.find(pe=>pe.id===se):null)??null;XI(G,Se).then(pe=>{mN(G),n(pe)}).finally(()=>Qp.delete(G))},[n,f.plugins]),U=g.useMemo(()=>jh(()=>{Yi(null).then(tr).catch(()=>{})}),[]),O=g.useCallback(G=>({active:e.activeOperationId===G.id,geometry:G.geometry??wR(G),operation:G,theme:e.activeTheme,language:y,zoom:1,onActivate:()=>_i(G.id),onClose:()=>q(G.id),onGeometryChange:()=>{},onRequestCompanions:()=>{},companionsOpen:!1,hiddenCompanionPanelIds:[],onSetCompanionPanelVisible:()=>{}}),[q,y,e.activeOperationId,e.activeTheme]),W=g.useCallback(async G=>{WM();try{const Z=await QR(G),se=await JR(Z);qM(se),vb(null).then(um).catch(()=>{})}catch(Z){Bb(Z instanceof Error?Z.message:String(Z))}},[]),K=g.useCallback(async G=>{const Z=()=>Promise.all([Yi(null).then(tr),So().then(xo)]).then(()=>{}).catch(()=>{});try{const se=await b8(G);m$(G),I7(G),await Z(),n(se.deletion)}catch(se){Bb(se instanceof Error?se.message:String(se))}},[n]),z=p.effective==="mobile"?c.jsx(Joe,{operations:H,activeOperationId:e.activeOperationId,operationStatus:e.operationStatus,operationNotifications:e.operationNotifications,theme:e.activeTheme,language:y,onSelectOperation:_i,onCloseOperation:q}):c.jsxs("div",{className:"console-body is-canvas",children:[c.jsx(Gz,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:d,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:_,canLaunch:B,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:T,onLaunchKind:j,onClose:q,onMinimize:Y,onFocus:V,onSetAccent:te,onRename:J,onSetGroupId:P,onCreateGroup:N,onSetGroupColor:I,onRenameGroup:D,onReorderGroups:E,onReorderTheaters:L,onUngroupAll:R,onSelectTheater:xS,onAddTheater:W,onCancelAddTheater:x7,onForgetTheater:K}),c.jsx("div",{className:"operations-center-stage",ref:i,children:c.jsx(kse,{state:e,catalog:_,canLaunch:B,renderKindIcon:T,onLaunchKind:$,onLaunchAtGeometry:M,onClose:q,onFocus:V,onRename:J,onSetAccent:te})}),c.jsx(joe,{theaterId:e.activeTheaterId,api:xp}),c.jsx(Poe,{})]});return c.jsx(Wre,{operations:H,operationKinds:f.operationKinds,capabilities:U,defaultConfig:O,children:z})}async function db(e,t,n,i,s){const o=++i.current,l=Us().operations.find(p=>p.id===e);if(l&&_s(l.theaterId)){eu(l.theaterId,e),Ea(e);return}const d=GE(),f=Br();if(f!==null){if(f===e){_i(e),Ea(e);return}const p=Us().operations.find(w=>w.id===e),m=Fs().minimized.includes(e),y=p&&t.find(w=>w.pluginId===p.pluginId&&w.type===p.type);let _=!0;if(p&&y?.companions?.length&&y.canOpenCompanions){try{_=await y.canOpenCompanions({api:n,operation:p})}catch{_=!1}const w=Us(),S=w.operations.find(k=>k.id===e),x=!m&&Fs().minimized.includes(e);if(i.current!==o||GE()!==d||Br()!==f||w.activeTheaterId!==p.theaterId||sg()!==p.theaterId||x||Qp.has(e)||!S||S.pluginId!==p.pluginId||S.type!==p.type||S.theaterId!==p.theaterId)return}if(p&&(!y||!y.companions?.length||!_)){if(Sr(),lm()){Fs().minimized.includes(e)&&j0(e),Mb(e),_i(e),Ea(e);return}s(),Ea(e);return}_i(e),wM(e),Ea(e);return}if(Gs()!==null){_i(e),uS(e),Ea(e);return}if(lm()){Fs().minimized.includes(e)&&j0(e),Mb(e),_i(e),Ea(e);return}s(),Ea(e)}function ele(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(Pb)}function tle(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function wR(e){return e.geometry??{x:0,y:0,width:G0,height:K0,zIndex:0}}function nle(e){const t=Fs(),n=e?.clientWidth??800,i=e?.clientHeight??600;return Sh({x:n/2,y:i/2},t.viewport)}function SR(e){return{x:e.x-G0/2,y:e.y-K0/2,width:G0,height:K0}}async function hb(e,t,n,i,s){const o=s.find(y=>y.id===e),d=jh(()=>{Yi(null).then(tr).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 Yi(null).then(tr).catch(()=>{}),!f)return;const p=sg()===i,m=Us().operations.some(y=>y.id===f);if(_s(i)){eu(i,f);return}cP(i)===null&&(p&&m&&Gs()!==null?(_i(f),uS(f)):Ml(f))}const ile=3e4;let kp=1e3,Od=null,fb=null,pb=!1;function jj(){Od!==null&&(clearTimeout(Od),Od=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const n=t;try{const i=JSON.parse(n.data);rle(i.operation)&&_7(i.operation)}catch{}}),e.addEventListener("update:available",()=>{xh()}),e.addEventListener("desktop:fullscreen",t=>{const n=t;try{qI(JSON.parse(n.data))}catch{N5()}}),e.onopen=()=>{kp=1e3,xh()},e.onerror=()=>{e.close(),N5(),Od=setTimeout(()=>{Od=null,kp=Math.min(kp*2,ile),Yi().then(tr).catch(()=>{}).finally(jj)},kp)}}function xh(){if(fb){pb=!0;return}fb=d8(Us().activeTheaterId).then(u7).catch(()=>{}).finally(()=>{fb=null,pb&&(pb=!1,xh())})}function rle(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const sle=6e3,ale=8e3;function ole(){const e=Cs(),t=g.useRef(new Set),n=g.useRef(null),i=$r(),s=gu(),o=na(),[l,d]=g.useState([]),[f,p]=g.useState(Date.now()),m=g.useRef(l),y=g.useRef(!1);m.current=l;const _=F5(l,f),w=Ze(),S=lg(),x=jM(o.state?.language??"auto");g.useEffect(()=>{document.documentElement.lang=S},[S]);const C=i.pathname.startsWith("/operations"),B=g.useMemo(()=>[...Lj,...s.railPanels.filter(M=>(M.side??"right")==="right")],[s.railPanels]),H=g.useCallback(M=>n.current===null||t.current.has(M)?null:(t.current.add(M),n.current),[]);g.useEffect(()=>{const M=jh(()=>{Yi().then(tr).catch(()=>{})}),V=s.plugins.map(Y=>Y.install?.(M)).filter(Y=>typeof Y=="function");return()=>{for(const Y of V)Y()}},[s.plugins]),g.useEffect(()=>{c7(C)},[C]),g.useEffect(()=>r$(),[]),g.useEffect(()=>{const M=new AbortController;ZR(M.signal).then(te=>{y7(te),o2()}).catch(te=>{M.signal.aborted||(vt({theaterError:te instanceof Error?te.message:String(te)}),o2())});const V=Date.now();Yi(null,M.signal).then(te=>{n.current=te.filter(J=>J.ts.createdAt<V).map(J=>J.id),v7(te)}).catch(()=>{}),So(null,M.signal).then(xo).catch(()=>{}),xh();const Y=window.setTimeout(xh,sle);return()=>{window.clearTimeout(Y),M.abort()}},[]),g.useEffect(()=>(JI({locale:x}),Hie),[x]);const T=g.useRef(null);g.useLayoutEffect(()=>{e.keyboardShortcutsOpen&&(T.current=kie()??(document.activeElement instanceof HTMLElement?document.activeElement:null))},[e.keyboardShortcutsOpen]),g.useEffect(()=>{if(e.keyboardShortcutsOpen)return;const M=T.current;T.current=null,M?.isConnected&&M.focus()},[e.keyboardShortcutsOpen]),g.useEffect(()=>{if(l.length===0)return;const M=()=>{const Y=Date.now();p(Y),d(te=>{const J=te.filter(P=>P.expiresAt>Y);return m.current=J,J})};M();const V=window.setInterval(M,100);return()=>window.clearInterval(V)},[l.length]);const $=g.useCallback(M=>{!M||M.expiresAt<=Date.now()||(p(Date.now()),d(V=>{const Y=zie(V,M);return m.current=Y,Y}))},[]),j=g.useCallback(()=>{if(y.current)return;const M=Date.now(),V=F5(m.current,M);V&&(y.current=!0,S8(V.deletionId).then(()=>(d(Y=>{const te=Y.filter(J=>J.deletionId!==V.deletionId);return m.current=te,te}),Promise.allSettled([vb(null).then(um),Yi(null).then(tr),So().then(xo)]))).catch(()=>{V.expiresAt<=Date.now()&&d(Y=>{const te=Y.filter(J=>J.deletionId!==V.deletionId);return m.current=te,te})}).finally(()=>{y.current=!1}))},[]);return g.useEffect(()=>rre({getSideBarCollapsed:()=>lh().collapsed,setSideBarCollapsed:Ao,toggleOperationSearch:KM,toggleRailChrome:DS,canUndoLastClose:()=>m.current.some(M=>M.expiresAt>Date.now()),undoLastClose:j}),[j]),c.jsxs("div",{className:"console-shell",children:[c.jsx(iie,{operationsViewVisible:C}),c.jsx("main",{className:"console-route-content",children:c.jsxs(MB,{children:[c.jsx(Cc,{path:"/",element:c.jsx(Dv,{to:"/operations",replace:!0})}),c.jsx(Cc,{path:"/operations",element:c.jsx(Qoe,{state:e,claimBootPanelMinimization:H,onDeferredDeletion:$})}),c.jsx(Cc,{path:"/carrier-settings",element:c.jsx(Dv,{to:"/settings?section=terminal%3Acarriers",replace:!0})}),c.jsx(Cc,{path:"/settings",element:c.jsx(kre,{})}),c.jsx(Cc,{path:"*",element:c.jsx(Dv,{to:"/operations",replace:!0})})]})}),c.jsx(Nie,{state:e,railPanels:B,plugins:s.plugins,onDeferredDeletion:$}),e.keyboardShortcutsOpen?c.jsx(CN,{onClose:R7}):null,c.jsx(Xie,{state:e}),c.jsx(vie,{state:e}),c.jsx(bie,{}),c.jsx(z5,{open:e.connectionError!==null,tone:"error",title:w("chrome.toast.consoleLinkInterrupted"),message:e.connectionError??void 0}),c.jsx(z5,{open:_!==null,tone:"undo",title:_?.kind==="theater"?w("chrome.toast.theaterForgotten"):w("chrome.toast.operationClosed"),message:_?w("chrome.toast.secondsRemaining",{count:Fie(_,f)}):void 0,actionLabel:w("chrome.toast.undo"),onAction:j,progress:_?(_.expiresAt-f)/ale:void 0})]})}globalThis.__fleetConsoleRuntime__={react:em,"react/jsx-runtime":HD,"@fleet-console/sdk/plugin/browser":l4,"@fleet-console/sdk/settings/browser":k4,"@fleet-console/sdk/operations/browser":XD,"@fleet-console/sdk/notifications/browser":E4,"@fleet-console/sdk/react/browser":T4};Zc("instrument");m7();const Dj=()=>{document.documentElement.classList.toggle("reduce-panel-motion",Ii().state?.reducePanelMotion===!0)};lM(Dj);Dj();try{const e=await sM();Zc(e.theme),Db(e.uiFont),Z8(e),await O7()}catch(e){J8(e)}const lle=await Bne();jj();const xR=document.querySelector("#app");xR&&LR.createRoot(xR).render(c.jsx(g.StrictMode,{children:c.jsx(e8,{basename:"/console",children:c.jsx(Dne,{value:lle,children:c.jsx(ole,{})})})}));export{QK as _,cle as a,V0 as g,wn as k,Jd as p};