agent-workbench 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist/server.js +3429 -869
- package/dist/web/assets/de-C678otZQ.js +5 -0
- package/dist/web/assets/es-CPhm39HJ.js +5 -0
- package/dist/web/assets/fr-CXsDqneg.js +5 -0
- package/dist/web/assets/{highlight-BsYn5BK8.js → highlight-BdYEMg2B.js} +1 -1
- package/dist/web/assets/index-BYaXyFep.css +32 -0
- package/dist/web/assets/index-DjQtvUDg.js +163 -0
- package/dist/web/assets/ja-DVeeRhCP.js +5 -0
- package/dist/web/assets/ko-DozzP6h6.js +5 -0
- package/dist/web/assets/pt-BR-DrTp_uEs.js +5 -0
- package/dist/web/assets/ru-CyrqdjsW.js +5 -0
- package/dist/web/assets/zh-CN-EUpCRWqV.js +5 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/de-5zSaN2t-.js +0 -5
- package/dist/web/assets/es-CFiCJcc8.js +0 -5
- package/dist/web/assets/fr-C7R68L38.js +0 -5
- package/dist/web/assets/index-fLdlIaV_.js +0 -163
- package/dist/web/assets/index-vwOssvpV.css +0 -32
- package/dist/web/assets/ja-CsWmKRl-.js +0 -5
- package/dist/web/assets/ko-DakWHUDB.js +0 -5
- package/dist/web/assets/pt-BR-CULiM_-O.js +0 -5
- package/dist/web/assets/ru-D8gI2TvJ.js +0 -5
- package/dist/web/assets/zh-CN-BYr9GmHu.js +0 -5
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
var mw=Object.defineProperty;var gw=(t,e,s)=>e in t?mw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Wt=(t,e,s)=>gw(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const y of u)if(y.type==="childList")for(const b of y.addedNodes)b.tagName==="LINK"&&b.rel==="modulepreload"&&l(b)}).observe(document,{childList:!0,subtree:!0});function s(u){const y={};return u.integrity&&(y.integrity=u.integrity),u.referrerPolicy&&(y.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?y.credentials="include":u.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function l(u){if(u.ep)return;u.ep=!0;const y=s(u);fetch(u.href,y)}})();function vw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uu={exports:{}},Lo={},du={exports:{}},gt={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Hf;function _w(){if(Hf)return gt;Hf=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),b=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),h=Symbol.iterator;function k(H){return H===null||typeof H!="object"?null:(H=h&&H[h]||H["@@iterator"],typeof H=="function"?H:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,w={};function d(H,z,Z){this.props=H,this.context=z,this.refs=w,this.updater=Z||T}d.prototype.isReactComponent={},d.prototype.setState=function(H,z){if(typeof H!="object"&&typeof H!="function"&&H!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,H,z,"setState")},d.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function m(){}m.prototype=d.prototype;function p(H,z,Z){this.props=H,this.context=z,this.refs=w,this.updater=Z||T}var f=p.prototype=new m;f.constructor=p,M(f,d.prototype),f.isPureReactComponent=!0;var x=Array.isArray,j=Object.prototype.hasOwnProperty,E={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function S(H,z,Z){var ie,_e={},ge=null,Q=null;if(z!=null)for(ie in z.ref!==void 0&&(Q=z.ref),z.key!==void 0&&(ge=""+z.key),z)j.call(z,ie)&&!R.hasOwnProperty(ie)&&(_e[ie]=z[ie]);var K=arguments.length-2;if(K===1)_e.children=Z;else if(1<K){for(var te=Array(K),ee=0;ee<K;ee++)te[ee]=arguments[ee+2];_e.children=te}if(H&&H.defaultProps)for(ie in K=H.defaultProps,K)_e[ie]===void 0&&(_e[ie]=K[ie]);return{$$typeof:t,type:H,key:ge,ref:Q,props:_e,_owner:E.current}}function L(H,z){return{$$typeof:t,type:H.type,key:z,ref:H.ref,props:H.props,_owner:H._owner}}function I(H){return typeof H=="object"&&H!==null&&H.$$typeof===t}function P(H){var z={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(Z){return z[Z]})}var D=/\/+/g;function F(H,z){return typeof H=="object"&&H!==null&&H.key!=null?P(""+H.key):z.toString(36)}function W(H,z,Z,ie,_e){var ge=typeof H;(ge==="undefined"||ge==="boolean")&&(H=null);var Q=!1;if(H===null)Q=!0;else switch(ge){case"string":case"number":Q=!0;break;case"object":switch(H.$$typeof){case t:case e:Q=!0}}if(Q)return Q=H,_e=_e(Q),H=ie===""?"."+F(Q,0):ie,x(_e)?(Z="",H!=null&&(Z=H.replace(D,"$&/")+"/"),W(_e,z,Z,"",function(ee){return ee})):_e!=null&&(I(_e)&&(_e=L(_e,Z+(!_e.key||Q&&Q.key===_e.key?"":(""+_e.key).replace(D,"$&/")+"/")+H)),z.push(_e)),1;if(Q=0,ie=ie===""?".":ie+":",x(H))for(var K=0;K<H.length;K++){ge=H[K];var te=ie+F(ge,K);Q+=W(ge,z,Z,te,_e)}else if(te=k(H),typeof te=="function")for(H=te.call(H),K=0;!(ge=H.next()).done;)ge=ge.value,te=ie+F(ge,K++),Q+=W(ge,z,Z,te,_e);else if(ge==="object")throw z=String(H),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(H).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.");return Q}function $(H,z,Z){if(H==null)return H;var ie=[],_e=0;return W(H,ie,"","",function(ge){return z.call(Z,ge,_e++)}),ie}function Y(H){if(H._status===-1){var z=H._result;z=z(),z.then(function(Z){(H._status===0||H._status===-1)&&(H._status=1,H._result=Z)},function(Z){(H._status===0||H._status===-1)&&(H._status=2,H._result=Z)}),H._status===-1&&(H._status=0,H._result=z)}if(H._status===1)return H._result.default;throw H._result}var G={current:null},V={transition:null},B={ReactCurrentDispatcher:G,ReactCurrentBatchConfig:V,ReactCurrentOwner:E};function U(){throw Error("act(...) is not supported in production builds of React.")}return gt.Children={map:$,forEach:function(H,z,Z){$(H,function(){z.apply(this,arguments)},Z)},count:function(H){var z=0;return $(H,function(){z++}),z},toArray:function(H){return $(H,function(z){return z})||[]},only:function(H){if(!I(H))throw Error("React.Children.only expected to receive a single React element child.");return H}},gt.Component=d,gt.Fragment=s,gt.Profiler=u,gt.PureComponent=p,gt.StrictMode=l,gt.Suspense=a,gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,gt.act=U,gt.cloneElement=function(H,z,Z){if(H==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+H+".");var ie=M({},H.props),_e=H.key,ge=H.ref,Q=H._owner;if(z!=null){if(z.ref!==void 0&&(ge=z.ref,Q=E.current),z.key!==void 0&&(_e=""+z.key),H.type&&H.type.defaultProps)var K=H.type.defaultProps;for(te in z)j.call(z,te)&&!R.hasOwnProperty(te)&&(ie[te]=z[te]===void 0&&K!==void 0?K[te]:z[te])}var te=arguments.length-2;if(te===1)ie.children=Z;else if(1<te){K=Array(te);for(var ee=0;ee<te;ee++)K[ee]=arguments[ee+2];ie.children=K}return{$$typeof:t,type:H.type,key:_e,ref:ge,props:ie,_owner:Q}},gt.createContext=function(H){return H={$$typeof:b,_currentValue:H,_currentValue2:H,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},H.Provider={$$typeof:y,_context:H},H.Consumer=H},gt.createElement=S,gt.createFactory=function(H){var z=S.bind(null,H);return z.type=H,z},gt.createRef=function(){return{current:null}},gt.forwardRef=function(H){return{$$typeof:i,render:H}},gt.isValidElement=I,gt.lazy=function(H){return{$$typeof:_,_payload:{_status:-1,_result:H},_init:Y}},gt.memo=function(H,z){return{$$typeof:g,type:H,compare:z===void 0?null:z}},gt.startTransition=function(H){var z=V.transition;V.transition={};try{H()}finally{V.transition=z}},gt.unstable_act=U,gt.useCallback=function(H,z){return G.current.useCallback(H,z)},gt.useContext=function(H){return G.current.useContext(H)},gt.useDebugValue=function(){},gt.useDeferredValue=function(H){return G.current.useDeferredValue(H)},gt.useEffect=function(H,z){return G.current.useEffect(H,z)},gt.useId=function(){return G.current.useId()},gt.useImperativeHandle=function(H,z,Z){return G.current.useImperativeHandle(H,z,Z)},gt.useInsertionEffect=function(H,z){return G.current.useInsertionEffect(H,z)},gt.useLayoutEffect=function(H,z){return G.current.useLayoutEffect(H,z)},gt.useMemo=function(H,z){return G.current.useMemo(H,z)},gt.useReducer=function(H,z,Z){return G.current.useReducer(H,z,Z)},gt.useRef=function(H){return G.current.useRef(H)},gt.useState=function(H){return G.current.useState(H)},gt.useSyncExternalStore=function(H,z,Z){return G.current.useSyncExternalStore(H,z,Z)},gt.useTransition=function(){return G.current.useTransition()},gt.version="18.3.1",gt}var Uf;function bd(){return Uf||(Uf=1,du.exports=_w()),du.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var $f;function ww(){if($f)return Lo;$f=1;var t=bd(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,u=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function b(i,a,g){var _,h={},k=null,T=null;g!==void 0&&(k=""+g),a.key!==void 0&&(k=""+a.key),a.ref!==void 0&&(T=a.ref);for(_ in a)l.call(a,_)&&!y.hasOwnProperty(_)&&(h[_]=a[_]);if(i&&i.defaultProps)for(_ in a=i.defaultProps,a)h[_]===void 0&&(h[_]=a[_]);return{$$typeof:e,type:i,key:k,ref:T,props:h,_owner:u.current}}return Lo.Fragment=s,Lo.jsx=b,Lo.jsxs=b,Lo}var Wf;function bw(){return Wf||(Wf=1,uu.exports=ww()),uu.exports}var o=bw(),la={},hu={exports:{}},Nn={},fu={exports:{}},pu={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var zf;function yw(){return zf||(zf=1,(function(t){function e(V,B){var U=V.length;V.push(B);e:for(;0<U;){var H=U-1>>>1,z=V[H];if(0<u(z,B))V[H]=B,V[U]=z,U=H;else break e}}function s(V){return V.length===0?null:V[0]}function l(V){if(V.length===0)return null;var B=V[0],U=V.pop();if(U!==B){V[0]=U;e:for(var H=0,z=V.length,Z=z>>>1;H<Z;){var ie=2*(H+1)-1,_e=V[ie],ge=ie+1,Q=V[ge];if(0>u(_e,U))ge<z&&0>u(Q,_e)?(V[H]=Q,V[ge]=U,H=ge):(V[H]=_e,V[ie]=U,H=ie);else if(ge<z&&0>u(Q,U))V[H]=Q,V[ge]=U,H=ge;else break e}}return B}function u(V,B){var U=V.sortIndex-B.sortIndex;return U!==0?U:V.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;t.unstable_now=function(){return y.now()}}else{var b=Date,i=b.now();t.unstable_now=function(){return b.now()-i}}var a=[],g=[],_=1,h=null,k=3,T=!1,M=!1,w=!1,d=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(V){for(var B=s(g);B!==null;){if(B.callback===null)l(g);else if(B.startTime<=V)l(g),B.sortIndex=B.expirationTime,e(a,B);else break;B=s(g)}}function x(V){if(w=!1,f(V),!M)if(s(a)!==null)M=!0,Y(j);else{var B=s(g);B!==null&&G(x,B.startTime-V)}}function j(V,B){M=!1,w&&(w=!1,m(S),S=-1),T=!0;var U=k;try{for(f(B),h=s(a);h!==null&&(!(h.expirationTime>B)||V&&!P());){var H=h.callback;if(typeof H=="function"){h.callback=null,k=h.priorityLevel;var z=H(h.expirationTime<=B);B=t.unstable_now(),typeof z=="function"?h.callback=z:h===s(a)&&l(a),f(B)}else l(a);h=s(a)}if(h!==null)var Z=!0;else{var ie=s(g);ie!==null&&G(x,ie.startTime-B),Z=!1}return Z}finally{h=null,k=U,T=!1}}var E=!1,R=null,S=-1,L=5,I=-1;function P(){return!(t.unstable_now()-I<L)}function D(){if(R!==null){var V=t.unstable_now();I=V;var B=!0;try{B=R(!0,V)}finally{B?F():(E=!1,R=null)}}else E=!1}var F;if(typeof p=="function")F=function(){p(D)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,$=W.port2;W.port1.onmessage=D,F=function(){$.postMessage(null)}}else F=function(){d(D,0)};function Y(V){R=V,E||(E=!0,F())}function G(V,B){S=d(function(){V(t.unstable_now())},B)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(V){V.callback=null},t.unstable_continueExecution=function(){M||T||(M=!0,Y(j))},t.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<V?Math.floor(1e3/V):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_getFirstCallbackNode=function(){return s(a)},t.unstable_next=function(V){switch(k){case 1:case 2:case 3:var B=3;break;default:B=k}var U=k;k=B;try{return V()}finally{k=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(V,B){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var U=k;k=V;try{return B()}finally{k=U}},t.unstable_scheduleCallback=function(V,B,U){var H=t.unstable_now();switch(typeof U=="object"&&U!==null?(U=U.delay,U=typeof U=="number"&&0<U?H+U:H):U=H,V){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=U+z,V={id:_++,callback:B,priorityLevel:V,startTime:U,expirationTime:z,sortIndex:-1},U>H?(V.sortIndex=U,e(g,V),s(a)===null&&V===s(g)&&(w?(m(S),S=-1):w=!0,G(x,U-H))):(V.sortIndex=z,e(a,V),M||T||(M=!0,Y(j))),V},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(V){var B=k;return function(){var U=k;k=B;try{return V.apply(this,arguments)}finally{k=U}}}})(pu)),pu}var qf;function kw(){return qf||(qf=1,fu.exports=yw()),fu.exports}/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Vf;function Cw(){if(Vf)return Nn;Vf=1;var t=bd(),e=kw();function s(n){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+n,c=1;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c]);return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,u={};function y(n,r){b(n,r),b(n+"Capture",r)}function b(n,r){for(u[n]=r,n=0;n<r.length;n++)l.add(r[n])}var i=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),a=Object.prototype.hasOwnProperty,g=/^[: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]*$/,_={},h={};function k(n){return a.call(h,n)?!0:a.call(_,n)?!1:g.test(n)?h[n]=!0:(_[n]=!0,!1)}function T(n,r,c,C){if(c!==null&&c.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return C?!1:c!==null?!c.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function M(n,r,c,C){if(r===null||typeof r>"u"||T(n,r,c,C))return!0;if(C)return!1;if(c!==null)switch(c.type){case 3:return!r;case 4:return r===!1;case 5:return isNaN(r);case 6:return isNaN(r)||1>r}return!1}function w(n,r,c,C,A,O,q){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=C,this.attributeNamespace=A,this.mustUseProperty=c,this.propertyName=n,this.type=r,this.sanitizeURL=O,this.removeEmptyString=q}var d={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){d[n]=new w(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var r=n[0];d[r]=new w(r,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){d[n]=new w(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){d[n]=new w(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){d[n]=new w(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){d[n]=new w(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){d[n]=new w(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){d[n]=new w(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){d[n]=new w(n,5,!1,n.toLowerCase(),null,!1,!1)});var m=/[\-:]([a-z])/g;function p(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var r=n.replace(m,p);d[r]=new w(r,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var r=n.replace(m,p);d[r]=new w(r,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var r=n.replace(m,p);d[r]=new w(r,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){d[n]=new w(n,1,!1,n.toLowerCase(),null,!1,!1)}),d.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){d[n]=new w(n,1,!1,n.toLowerCase(),null,!0,!0)});function f(n,r,c,C){var A=d.hasOwnProperty(r)?d[r]:null;(A!==null?A.type!==0:C||!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(M(r,c,A,C)&&(c=null),C||A===null?k(r)&&(c===null?n.removeAttribute(r):n.setAttribute(r,""+c)):A.mustUseProperty?n[A.propertyName]=c===null?A.type===3?!1:"":c:(r=A.attributeName,C=A.attributeNamespace,c===null?n.removeAttribute(r):(A=A.type,c=A===3||A===4&&c===!0?"":""+c,C?n.setAttributeNS(C,r,c):n.setAttribute(r,c))))}var x=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,j=Symbol.for("react.element"),E=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),P=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),G=Symbol.for("react.offscreen"),V=Symbol.iterator;function B(n){return n===null||typeof n!="object"?null:(n=V&&n[V]||n["@@iterator"],typeof n=="function"?n:null)}var U=Object.assign,H;function z(n){if(H===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);H=r&&r[1]||""}return`
|
|
34
|
-
`+H+n}var Z=!1;function ie(n,r){if(!n||Z)return"";Z=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(r)if(r=function(){throw Error()},Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(r,[])}catch(ue){var C=ue}Reflect.construct(n,[],r)}else{try{r.call()}catch(ue){C=ue}n.call(r.prototype)}else{try{throw Error()}catch(ue){C=ue}n()}}catch(ue){if(ue&&C&&typeof ue.stack=="string"){for(var A=ue.stack.split(`
|
|
35
|
-
`),O=C.stack.split(`
|
|
36
|
-
`),q=A.length-1,J=O.length-1;1<=q&&0<=J&&A[q]!==O[J];)J--;for(;1<=q&&0<=J;q--,J--)if(A[q]!==O[J]){if(q!==1||J!==1)do if(q--,J--,0>J||A[q]!==O[J]){var ne=`
|
|
37
|
-
`+A[q].replace(" at new "," at ");return n.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",n.displayName)),ne}while(1<=q&&0<=J);break}}}finally{Z=!1,Error.prepareStackTrace=c}return(n=n?n.displayName||n.name:"")?z(n):""}function _e(n){switch(n.tag){case 5:return z(n.type);case 16:return z("Lazy");case 13:return z("Suspense");case 19:return z("SuspenseList");case 0:case 2:case 15:return n=ie(n.type,!1),n;case 11:return n=ie(n.type.render,!1),n;case 1:return n=ie(n.type,!0),n;default:return""}}function ge(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case R:return"Fragment";case E:return"Portal";case L:return"Profiler";case S:return"StrictMode";case F:return"Suspense";case W:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case P:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case D:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case $:return r=n.displayName||null,r!==null?r:ge(n.type)||"Memo";case Y:r=n._payload,n=n._init;try{return ge(n(r))}catch{}}return null}function Q(n){var r=n.type;switch(n.tag){case 24:return"Cache";case 9:return(r.displayName||"Context")+".Consumer";case 10:return(r._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=r.render,n=n.displayName||n.name||"",r.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return r;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(r);case 8:return r===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r}return null}function K(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function te(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ee(n){var r=te(n)?"checked":"value",c=Object.getOwnPropertyDescriptor(n.constructor.prototype,r),C=""+n[r];if(!n.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var A=c.get,O=c.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return A.call(this)},set:function(q){C=""+q,O.call(this,q)}}),Object.defineProperty(n,r,{enumerable:c.enumerable}),{getValue:function(){return C},setValue:function(q){C=""+q},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function we(n){n._valueTracker||(n._valueTracker=ee(n))}function ke(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var c=r.getValue(),C="";return n&&(C=te(n)?n.checked?"true":"false":n.value),n=C,n!==c?(r.setValue(n),!0):!1}function Ae(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Me(n,r){var c=r.checked;return U({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:c??n._wrapperState.initialChecked})}function Je(n,r){var c=r.defaultValue==null?"":r.defaultValue,C=r.checked!=null?r.checked:r.defaultChecked;c=K(r.value!=null?r.value:c),n._wrapperState={initialChecked:C,initialValue:c,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function it(n,r){r=r.checked,r!=null&&f(n,"checked",r,!1)}function Ie(n,r){it(n,r);var c=K(r.value),C=r.type;if(c!=null)C==="number"?(c===0&&n.value===""||n.value!=c)&&(n.value=""+c):n.value!==""+c&&(n.value=""+c);else if(C==="submit"||C==="reset"){n.removeAttribute("value");return}r.hasOwnProperty("value")?mt(n,r.type,c):r.hasOwnProperty("defaultValue")&&mt(n,r.type,K(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(n.defaultChecked=!!r.defaultChecked)}function ae(n,r,c){if(r.hasOwnProperty("value")||r.hasOwnProperty("defaultValue")){var C=r.type;if(!(C!=="submit"&&C!=="reset"||r.value!==void 0&&r.value!==null))return;r=""+n._wrapperState.initialValue,c||r===n.value||(n.value=r),n.defaultValue=r}c=n.name,c!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,c!==""&&(n.name=c)}function mt(n,r,c){(r!=="number"||Ae(n.ownerDocument)!==n)&&(c==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+c&&(n.defaultValue=""+c))}var De=Array.isArray;function Fe(n,r,c,C){if(n=n.options,r){r={};for(var A=0;A<c.length;A++)r["$"+c[A]]=!0;for(c=0;c<n.length;c++)A=r.hasOwnProperty("$"+n[c].value),n[c].selected!==A&&(n[c].selected=A),A&&C&&(n[c].defaultSelected=!0)}else{for(c=""+K(c),r=null,A=0;A<n.length;A++){if(n[A].value===c){n[A].selected=!0,C&&(n[A].defaultSelected=!0);return}r!==null||n[A].disabled||(r=n[A])}r!==null&&(r.selected=!0)}}function Ze(n,r){if(r.dangerouslySetInnerHTML!=null)throw Error(s(91));return U({},r,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Se(n,r){var c=r.value;if(c==null){if(c=r.children,r=r.defaultValue,c!=null){if(r!=null)throw Error(s(92));if(De(c)){if(1<c.length)throw Error(s(93));c=c[0]}r=c}r==null&&(r=""),c=r}n._wrapperState={initialValue:K(c)}}function be(n,r){var c=K(r.value),C=K(r.defaultValue);c!=null&&(c=""+c,c!==n.value&&(n.value=c),r.defaultValue==null&&n.defaultValue!==c&&(n.defaultValue=c)),C!=null&&(n.defaultValue=""+C)}function je(n){var r=n.textContent;r===n._wrapperState.initialValue&&r!==""&&r!==null&&(n.value=r)}function pe(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Xe(n,r){return n==null||n==="http://www.w3.org/1999/xhtml"?pe(r):n==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var $e,He=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,c,C,A){MSApp.execUnsafeLocalFunction(function(){return n(r,c,C,A)})}:n})(function(n,r){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=r;else{for($e=$e||document.createElement("div"),$e.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=$e.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;r.firstChild;)n.appendChild(r.firstChild)}});function Pe(n,r){if(r){var c=n.firstChild;if(c&&c===n.lastChild&&c.nodeType===3){c.nodeValue=r;return}}n.textContent=r}var re={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];Object.keys(re).forEach(function(n){fe.forEach(function(r){r=r+n.charAt(0).toUpperCase()+n.substring(1),re[r]=re[n]})});function Le(n,r,c){return r==null||typeof r=="boolean"||r===""?"":c||typeof r!="number"||r===0||re.hasOwnProperty(n)&&re[n]?(""+r).trim():r+"px"}function Qe(n,r){n=n.style;for(var c in r)if(r.hasOwnProperty(c)){var C=c.indexOf("--")===0,A=Le(c,r[c],C);c==="float"&&(c="cssFloat"),C?n.setProperty(c,A):n[c]=A}}var at=U({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ct(n,r){if(r){if(at[n]&&(r.children!=null||r.dangerouslySetInnerHTML!=null))throw Error(s(137,n));if(r.dangerouslySetInnerHTML!=null){if(r.children!=null)throw Error(s(60));if(typeof r.dangerouslySetInnerHTML!="object"||!("__html"in r.dangerouslySetInnerHTML))throw Error(s(61))}if(r.style!=null&&typeof r.style!="object")throw Error(s(62))}}function wt(n,r){if(n.indexOf("-")===-1)return typeof r.is=="string";switch(n){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 Xt=null;function he(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var nt=null,et=null,dt=null;function de(n){if(n=fo(n)){if(typeof nt!="function")throw Error(s(280));var r=n.stateNode;r&&(r=kl(r),nt(n.stateNode,n.type,r))}}function Ke(n){et?dt?dt.push(n):dt=[n]:et=n}function ft(){if(et){var n=et,r=dt;if(dt=et=null,de(n),r)for(n=0;n<r.length;n++)de(r[n])}}function ye(n,r){return n(r)}function ht(){}var Rt=!1;function vt(n,r,c){if(Rt)return n(r,c);Rt=!0;try{return ye(n,r,c)}finally{Rt=!1,(et!==null||dt!==null)&&(ht(),ft())}}function Ye(n,r){var c=n.stateNode;if(c===null)return null;var C=kl(c);if(C===null)return null;c=C[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(C=!C.disabled)||(n=n.type,C=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!C;break e;default:n=!1}if(n)return null;if(c&&typeof c!="function")throw Error(s(231,r,typeof c));return c}var ot=!1;if(i)try{var bt={};Object.defineProperty(bt,"passive",{get:function(){ot=!0}}),window.addEventListener("test",bt,bt),window.removeEventListener("test",bt,bt)}catch{ot=!1}function un(n,r,c,C,A,O,q,J,ne){var ue=Array.prototype.slice.call(arguments,3);try{r.apply(c,ue)}catch(xe){this.onError(xe)}}var Cn=!1,Or=null,Mt=!1,on=null,Oi={onError:function(n){Cn=!0,Or=n}};function _r(n,r,c,C,A,O,q,J,ne){Cn=!1,Or=null,un.apply(Oi,arguments)}function _s(n,r,c,C,A,O,q,J,ne){if(_r.apply(this,arguments),Cn){if(Cn){var ue=Or;Cn=!1,Or=null}else throw Error(s(198));Mt||(Mt=!0,on=ue)}}function qt(n){var r=n,c=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(c=r.return),n=r.return;while(n)}return r.tag===3?c:null}function Vn(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function wr(n){if(qt(n)!==n)throw Error(s(188))}function Xs(n){var r=n.alternate;if(!r){if(r=qt(n),r===null)throw Error(s(188));return r!==n?null:n}for(var c=n,C=r;;){var A=c.return;if(A===null)break;var O=A.alternate;if(O===null){if(C=A.return,C!==null){c=C;continue}break}if(A.child===O.child){for(O=A.child;O;){if(O===c)return wr(A),n;if(O===C)return wr(A),r;O=O.sibling}throw Error(s(188))}if(c.return!==C.return)c=A,C=O;else{for(var q=!1,J=A.child;J;){if(J===c){q=!0,c=A,C=O;break}if(J===C){q=!0,C=A,c=O;break}J=J.sibling}if(!q){for(J=O.child;J;){if(J===c){q=!0,c=O,C=A;break}if(J===C){q=!0,C=O,c=A;break}J=J.sibling}if(!q)throw Error(s(189))}}if(c.alternate!==C)throw Error(s(190))}if(c.tag!==3)throw Error(s(188));return c.stateNode.current===c?n:r}function br(n){return n=Xs(n),n!==null?yr(n):null}function yr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var r=yr(n);if(r!==null)return r;n=n.sibling}return null}var nr=e.unstable_scheduleCallback,Br=e.unstable_cancelCallback,Fr=e.unstable_shouldYield,Hr=e.unstable_requestPaint,Nt=e.unstable_now,Qs=e.unstable_getCurrentPriorityLevel,rr=e.unstable_ImmediatePriority,Ur=e.unstable_UserBlockingPriority,kr=e.unstable_NormalPriority,Bi=e.unstable_LowPriority,Js=e.unstable_IdlePriority,$r=null,wn=null;function Wr(n){if(wn&&typeof wn.onCommitFiberRoot=="function")try{wn.onCommitFiberRoot($r,n,void 0,(n.current.flags&128)===128)}catch{}}var Qt=Math.clz32?Math.clz32:lt,me=Math.log,Oe=Math.LN2;function lt(n){return n>>>=0,n===0?32:31-(me(n)/Oe|0)|0}var yt=64,pt=4194304;function Jt(n){switch(n&-n){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: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 n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Dn(n,r){var c=n.pendingLanes;if(c===0)return 0;var C=0,A=n.suspendedLanes,O=n.pingedLanes,q=c&268435455;if(q!==0){var J=q&~A;J!==0?C=Jt(J):(O&=q,O!==0&&(C=Jt(O)))}else q=c&~A,q!==0?C=Jt(q):O!==0&&(C=Jt(O));if(C===0)return 0;if(r!==0&&r!==C&&(r&A)===0&&(A=C&-C,O=r&-r,A>=O||A===16&&(O&4194240)!==0))return r;if((C&4)!==0&&(C|=c&16),r=n.entangledLanes,r!==0)for(n=n.entanglements,r&=C;0<r;)c=31-Qt(r),A=1<<c,C|=n[c],r&=~A;return C}function Pn(n,r){switch(n){case 1:case 2:case 4:return r+250;case 8:case 16:case 32:case 64: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 r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function zr(n,r){for(var c=n.suspendedLanes,C=n.pingedLanes,A=n.expirationTimes,O=n.pendingLanes;0<O;){var q=31-Qt(O),J=1<<q,ne=A[q];ne===-1?((J&c)===0||(J&C)!==0)&&(A[q]=Pn(J,r)):ne<=r&&(n.expiredLanes|=J),O&=~J}}function Zs(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Fi(){var n=yt;return yt<<=1,(yt&4194240)===0&&(yt=64),n}function ws(n){for(var r=[],c=0;31>c;c++)r.push(n);return r}function sr(n,r,c){n.pendingLanes|=r,r!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,r=31-Qt(r),n[r]=c}function ir(n,r){var c=n.pendingLanes&~r;n.pendingLanes=r,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=r,n.mutableReadLanes&=r,n.entangledLanes&=r,r=n.entanglements;var C=n.eventTimes;for(n=n.expirationTimes;0<c;){var A=31-Qt(c),O=1<<A;r[A]=0,C[A]=-1,n[A]=-1,c&=~O}}function Hi(n,r){var c=n.entangledLanes|=r;for(n=n.entanglements;c;){var C=31-Qt(c),A=1<<C;A&r|n[C]&r&&(n[C]|=r),c&=~A}}var kt=0;function ei(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var Cr,or,qr,Ui,Sr,bs=!1,Rn=[],lr=null,Kn=null,bn=null,ar=new Map,ys=new Map,xt=[],$i="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 submit".split(" ");function Wi(n,r){switch(n){case"focusin":case"focusout":lr=null;break;case"dragenter":case"dragleave":Kn=null;break;case"mouseover":case"mouseout":bn=null;break;case"pointerover":case"pointerout":ar.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ys.delete(r.pointerId)}}function ks(n,r,c,C,A,O){return n===null||n.nativeEvent!==O?(n={blockedOn:r,domEventName:c,eventSystemFlags:C,nativeEvent:O,targetContainers:[A]},r!==null&&(r=fo(r),r!==null&&or(r)),n):(n.eventSystemFlags|=C,r=n.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),n)}function zi(n,r,c,C,A){switch(r){case"focusin":return lr=ks(lr,n,r,c,C,A),!0;case"dragenter":return Kn=ks(Kn,n,r,c,C,A),!0;case"mouseover":return bn=ks(bn,n,r,c,C,A),!0;case"pointerover":var O=A.pointerId;return ar.set(O,ks(ar.get(O)||null,n,r,c,C,A)),!0;case"gotpointercapture":return O=A.pointerId,ys.set(O,ks(ys.get(O)||null,n,r,c,C,A)),!0}return!1}function ja(n){var r=As(n.target);if(r!==null){var c=qt(r);if(c!==null){if(r=c.tag,r===13){if(r=Vn(c),r!==null){n.blockedOn=r,Sr(n.priority,function(){qr(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){n.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Cs(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var c=xs(n.domEventName,n.eventSystemFlags,r[0],n.nativeEvent);if(c===null){c=n.nativeEvent;var C=new c.constructor(c.type,c);Xt=C,c.target.dispatchEvent(C),Xt=null}else return r=fo(c),r!==null&&or(r),n.blockedOn=c,!1;r.shift()}return!0}function It(n,r,c){Cs(n)&&c.delete(r)}function Ut(){bs=!1,lr!==null&&Cs(lr)&&(lr=null),Kn!==null&&Cs(Kn)&&(Kn=null),bn!==null&&Cs(bn)&&(bn=null),ar.forEach(It),ys.forEach(It)}function Vr(n,r){n.blockedOn===r&&(n.blockedOn=null,bs||(bs=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Ut)))}function On(n){function r(A){return Vr(A,n)}if(0<Rn.length){Vr(Rn[0],n);for(var c=1;c<Rn.length;c++){var C=Rn[c];C.blockedOn===n&&(C.blockedOn=null)}}for(lr!==null&&Vr(lr,n),Kn!==null&&Vr(Kn,n),bn!==null&&Vr(bn,n),ar.forEach(r),ys.forEach(r),c=0;c<xt.length;c++)C=xt[c],C.blockedOn===n&&(C.blockedOn=null);for(;0<xt.length&&(c=xt[0],c.blockedOn===null);)ja(c),c.blockedOn===null&&xt.shift()}var xr=x.ReactCurrentBatchConfig,ti=!0;function Da(n,r,c,C){var A=kt,O=xr.transition;xr.transition=null;try{kt=1,ni(n,r,c,C)}finally{kt=A,xr.transition=O}}function Pa(n,r,c,C){var A=kt,O=xr.transition;xr.transition=null;try{kt=4,ni(n,r,c,C)}finally{kt=A,xr.transition=O}}function ni(n,r,c,C){if(ti){var A=xs(n,r,c,C);if(A===null)ec(n,r,C,Ss,c),Wi(n,C);else if(zi(A,n,r,c,C))C.stopPropagation();else if(Wi(n,C),r&4&&-1<$i.indexOf(n)){for(;A!==null;){var O=fo(A);if(O!==null&&Cr(O),O=xs(n,r,c,C),O===null&&ec(n,r,C,Ss,c),O===A)break;A=O}A!==null&&C.stopPropagation()}else ec(n,r,C,null,c)}}var Ss=null;function xs(n,r,c,C){if(Ss=null,n=he(C),n=As(n),n!==null)if(r=qt(n),r===null)n=null;else if(c=r.tag,c===13){if(n=Vn(r),n!==null)return n;n=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null);return Ss=n,null}function Yo(n){switch(n){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Qs()){case rr:return 1;case Ur:return 4;case kr:case Bi:return 16;case Js:return 536870912;default:return 16}default:return 16}}var Gn=null,ri=null,Es=null;function qi(){if(Es)return Es;var n,r=ri,c=r.length,C,A="value"in Gn?Gn.value:Gn.textContent,O=A.length;for(n=0;n<c&&r[n]===A[n];n++);var q=c-n;for(C=1;C<=q&&r[c-C]===A[O-C];C++);return Es=A.slice(n,1<C?1-C:void 0)}function si(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function ii(){return!0}function Vi(){return!1}function Vt(n){function r(c,C,A,O,q){this._reactName=c,this._targetInst=A,this.type=C,this.nativeEvent=O,this.target=q,this.currentTarget=null;for(var J in n)n.hasOwnProperty(J)&&(c=n[J],this[J]=c?c(O):O[J]);return this.isDefaultPrevented=(O.defaultPrevented!=null?O.defaultPrevented:O.returnValue===!1)?ii:Vi,this.isPropagationStopped=Vi,this}return U(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ii)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ii)},persist:function(){},isPersistent:ii}),r}var Er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ts=Vt(Er),Tr=U({},Er,{view:0,detail:0}),Oa=Vt(Tr),Ki,Gi,Kr,Mn=U({},Tr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qi,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Kr&&(Kr&&n.type==="mousemove"?(Ki=n.screenX-Kr.screenX,Gi=n.screenY-Kr.screenY):Gi=Ki=0,Kr=n),Ki)},movementY:function(n){return"movementY"in n?n.movementY:Gi}}),Xo=Vt(Mn),Qo=U({},Mn,{dataTransfer:0}),Ba=Vt(Qo),Jo=U({},Tr,{relatedTarget:0}),cr=Vt(Jo),Zo=U({},Er,{animationName:0,elapsedTime:0,pseudoElement:0}),Yi=Vt(Zo),Fa=U({},Er,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Xi=Vt(Fa),Ha=U({},Er,{data:0}),Ls=Vt(Ha),el={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ua={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"},$a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function oi(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=$a[n])?!!r[n]:!1}function Qi(){return oi}var li=U({},Tr,{key:function(n){if(n.key){var r=el[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=si(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Ua[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qi,charCode:function(n){return n.type==="keypress"?si(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?si(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),tl=Vt(li),nl=U({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),rl=Vt(nl),Wa=U({},Tr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qi}),sl=Vt(Wa),za=U({},Er,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ji=Vt(za),ai=U({},Mn,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),qa=Vt(ai),Va=[9,13,27,32],Ns=i&&"CompositionEvent"in window,Rs=null;i&&"documentMode"in document&&(Rs=document.documentMode);var il=i&&"TextEvent"in window&&!Rs,ol=i&&(!Ns||Rs&&8<Rs&&11>=Rs),ll=" ",al=!1;function Zi(n,r){switch(n){case"keyup":return Va.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cl(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Gr=!1;function eo(n,r){switch(n){case"compositionend":return cl(r);case"keypress":return r.which!==32?null:(al=!0,ll);case"textInput":return n=r.data,n===ll&&al?null:n;default:return null}}function ul(n,r){if(Gr)return n==="compositionend"||!Ns&&Zi(n,r)?(n=qi(),Es=ri=Gn=null,Gr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return ol&&r.locale!=="ko"?null:r.data;default:return null}}var to={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 no(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!to[n.type]:r==="textarea"}function dl(n,r,c,C){Ke(C),r=wl(r,"onChange"),0<r.length&&(c=new Ts("onChange","change",null,c,C),n.push({event:c,listeners:r}))}var Yr=null,Xr=null;function hl(n){th(n,0)}function Ms(n){var r=pi(n);if(ke(r))return n}function fl(n,r){if(n==="change")return r}var ro=!1;if(i){var so;if(i){var ci="oninput"in document;if(!ci){var Qr=document.createElement("div");Qr.setAttribute("oninput","return;"),ci=typeof Qr.oninput=="function"}so=ci}else so=!1;ro=so&&(!document.documentMode||9<document.documentMode)}function io(){Yr&&(Yr.detachEvent("onpropertychange",oo),Xr=Yr=null)}function oo(n){if(n.propertyName==="value"&&Ms(Xr)){var r=[];dl(r,Xr,n,he(n)),vt(hl,r)}}function pl(n,r,c){n==="focusin"?(io(),Yr=r,Xr=c,Yr.attachEvent("onpropertychange",oo)):n==="focusout"&&io()}function ml(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Ms(Xr)}function X(n,r){if(n==="click")return Ms(r)}function ve(n,r){if(n==="input"||n==="change")return Ms(r)}function tt(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var Et=typeof Object.is=="function"?Object.is:tt;function Kt(n,r){if(Et(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var c=Object.keys(n),C=Object.keys(r);if(c.length!==C.length)return!1;for(C=0;C<c.length;C++){var A=c[C];if(!a.call(r,A)||!Et(n[A],r[A]))return!1}return!0}function $d(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Wd(n,r){var c=$d(n);n=0;for(var C;c;){if(c.nodeType===3){if(C=n+c.textContent.length,n<=r&&C>=r)return{node:c,offset:r-n};n=C}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=$d(c)}}function zd(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?zd(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function qd(){for(var n=window,r=Ae();r instanceof n.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)n=r.contentWindow;else break;r=Ae(n.document)}return r}function Ka(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}function k_(n){var r=qd(),c=n.focusedElem,C=n.selectionRange;if(r!==c&&c&&c.ownerDocument&&zd(c.ownerDocument.documentElement,c)){if(C!==null&&Ka(c)){if(r=C.start,n=C.end,n===void 0&&(n=r),"selectionStart"in c)c.selectionStart=r,c.selectionEnd=Math.min(n,c.value.length);else if(n=(r=c.ownerDocument||document)&&r.defaultView||window,n.getSelection){n=n.getSelection();var A=c.textContent.length,O=Math.min(C.start,A);C=C.end===void 0?O:Math.min(C.end,A),!n.extend&&O>C&&(A=C,C=O,O=A),A=Wd(c,O);var q=Wd(c,C);A&&q&&(n.rangeCount!==1||n.anchorNode!==A.node||n.anchorOffset!==A.offset||n.focusNode!==q.node||n.focusOffset!==q.offset)&&(r=r.createRange(),r.setStart(A.node,A.offset),n.removeAllRanges(),O>C?(n.addRange(r),n.extend(q.node,q.offset)):(r.setEnd(q.node,q.offset),n.addRange(r)))}}for(r=[],n=c;n=n.parentNode;)n.nodeType===1&&r.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;c<r.length;c++)n=r[c],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var C_=i&&"documentMode"in document&&11>=document.documentMode,ui=null,Ga=null,lo=null,Ya=!1;function Vd(n,r,c){var C=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Ya||ui==null||ui!==Ae(C)||(C=ui,"selectionStart"in C&&Ka(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),lo&&Kt(lo,C)||(lo=C,C=wl(Ga,"onSelect"),0<C.length&&(r=new Ts("onSelect","select",null,r,c),n.push({event:r,listeners:C}),r.target=ui)))}function gl(n,r){var c={};return c[n.toLowerCase()]=r.toLowerCase(),c["Webkit"+n]="webkit"+r,c["Moz"+n]="moz"+r,c}var di={animationend:gl("Animation","AnimationEnd"),animationiteration:gl("Animation","AnimationIteration"),animationstart:gl("Animation","AnimationStart"),transitionend:gl("Transition","TransitionEnd")},Xa={},Kd={};i&&(Kd=document.createElement("div").style,"AnimationEvent"in window||(delete di.animationend.animation,delete di.animationiteration.animation,delete di.animationstart.animation),"TransitionEvent"in window||delete di.transitionend.transition);function vl(n){if(Xa[n])return Xa[n];if(!di[n])return n;var r=di[n],c;for(c in r)if(r.hasOwnProperty(c)&&c in Kd)return Xa[n]=r[c];return n}var Gd=vl("animationend"),Yd=vl("animationiteration"),Xd=vl("animationstart"),Qd=vl("transitionend"),Jd=new Map,Zd="abort auxClick 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(" ");function Jr(n,r){Jd.set(n,r),y(r,[n])}for(var Qa=0;Qa<Zd.length;Qa++){var Ja=Zd[Qa],S_=Ja.toLowerCase(),x_=Ja[0].toUpperCase()+Ja.slice(1);Jr(S_,"on"+x_)}Jr(Gd,"onAnimationEnd"),Jr(Yd,"onAnimationIteration"),Jr(Xd,"onAnimationStart"),Jr("dblclick","onDoubleClick"),Jr("focusin","onFocus"),Jr("focusout","onBlur"),Jr(Qd,"onTransitionEnd"),b("onMouseEnter",["mouseout","mouseover"]),b("onMouseLeave",["mouseout","mouseover"]),b("onPointerEnter",["pointerout","pointerover"]),b("onPointerLeave",["pointerout","pointerover"]),y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),y("onBeforeInput",["compositionend","keypress","textInput","paste"]),y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ao="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(" "),E_=new Set("cancel close invalid load scroll toggle".split(" ").concat(ao));function eh(n,r,c){var C=n.type||"unknown-event";n.currentTarget=c,_s(C,r,void 0,n),n.currentTarget=null}function th(n,r){r=(r&4)!==0;for(var c=0;c<n.length;c++){var C=n[c],A=C.event;C=C.listeners;e:{var O=void 0;if(r)for(var q=C.length-1;0<=q;q--){var J=C[q],ne=J.instance,ue=J.currentTarget;if(J=J.listener,ne!==O&&A.isPropagationStopped())break e;eh(A,J,ue),O=ne}else for(q=0;q<C.length;q++){if(J=C[q],ne=J.instance,ue=J.currentTarget,J=J.listener,ne!==O&&A.isPropagationStopped())break e;eh(A,J,ue),O=ne}}}if(Mt)throw n=on,Mt=!1,on=null,n}function Pt(n,r){var c=r[oc];c===void 0&&(c=r[oc]=new Set);var C=n+"__bubble";c.has(C)||(nh(r,n,2,!1),c.add(C))}function Za(n,r,c){var C=0;r&&(C|=4),nh(c,n,C,r)}var _l="_reactListening"+Math.random().toString(36).slice(2);function co(n){if(!n[_l]){n[_l]=!0,l.forEach(function(c){c!=="selectionchange"&&(E_.has(c)||Za(c,!1,n),Za(c,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[_l]||(r[_l]=!0,Za("selectionchange",!1,r))}}function nh(n,r,c,C){switch(Yo(r)){case 1:var A=Da;break;case 4:A=Pa;break;default:A=ni}c=A.bind(null,r,c,n),A=void 0,!ot||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(A=!0),C?A!==void 0?n.addEventListener(r,c,{capture:!0,passive:A}):n.addEventListener(r,c,!0):A!==void 0?n.addEventListener(r,c,{passive:A}):n.addEventListener(r,c,!1)}function ec(n,r,c,C,A){var O=C;if((r&1)===0&&(r&2)===0&&C!==null)e:for(;;){if(C===null)return;var q=C.tag;if(q===3||q===4){var J=C.stateNode.containerInfo;if(J===A||J.nodeType===8&&J.parentNode===A)break;if(q===4)for(q=C.return;q!==null;){var ne=q.tag;if((ne===3||ne===4)&&(ne=q.stateNode.containerInfo,ne===A||ne.nodeType===8&&ne.parentNode===A))return;q=q.return}for(;J!==null;){if(q=As(J),q===null)return;if(ne=q.tag,ne===5||ne===6){C=O=q;continue e}J=J.parentNode}}C=C.return}vt(function(){var ue=O,xe=he(c),Ee=[];e:{var Ce=Jd.get(n);if(Ce!==void 0){var Ue=Ts,ze=n;switch(n){case"keypress":if(si(c)===0)break e;case"keydown":case"keyup":Ue=tl;break;case"focusin":ze="focus",Ue=cr;break;case"focusout":ze="blur",Ue=cr;break;case"beforeblur":case"afterblur":Ue=cr;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ue=Xo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ue=Ba;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ue=sl;break;case Gd:case Yd:case Xd:Ue=Yi;break;case Qd:Ue=Ji;break;case"scroll":Ue=Oa;break;case"wheel":Ue=qa;break;case"copy":case"cut":case"paste":Ue=Xi;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ue=rl}var qe=(r&4)!==0,Gt=!qe&&n==="scroll",le=qe?Ce!==null?Ce+"Capture":null:Ce;qe=[];for(var se=ue,ce;se!==null;){ce=se;var Re=ce.stateNode;if(ce.tag===5&&Re!==null&&(ce=Re,le!==null&&(Re=Ye(se,le),Re!=null&&qe.push(uo(se,Re,ce)))),Gt)break;se=se.return}0<qe.length&&(Ce=new Ue(Ce,ze,null,c,xe),Ee.push({event:Ce,listeners:qe}))}}if((r&7)===0){e:{if(Ce=n==="mouseover"||n==="pointerover",Ue=n==="mouseout"||n==="pointerout",Ce&&c!==Xt&&(ze=c.relatedTarget||c.fromElement)&&(As(ze)||ze[Lr]))break e;if((Ue||Ce)&&(Ce=xe.window===xe?xe:(Ce=xe.ownerDocument)?Ce.defaultView||Ce.parentWindow:window,Ue?(ze=c.relatedTarget||c.toElement,Ue=ue,ze=ze?As(ze):null,ze!==null&&(Gt=qt(ze),ze!==Gt||ze.tag!==5&&ze.tag!==6)&&(ze=null)):(Ue=null,ze=ue),Ue!==ze)){if(qe=Xo,Re="onMouseLeave",le="onMouseEnter",se="mouse",(n==="pointerout"||n==="pointerover")&&(qe=rl,Re="onPointerLeave",le="onPointerEnter",se="pointer"),Gt=Ue==null?Ce:pi(Ue),ce=ze==null?Ce:pi(ze),Ce=new qe(Re,se+"leave",Ue,c,xe),Ce.target=Gt,Ce.relatedTarget=ce,Re=null,As(xe)===ue&&(qe=new qe(le,se+"enter",ze,c,xe),qe.target=ce,qe.relatedTarget=Gt,Re=qe),Gt=Re,Ue&&ze)t:{for(qe=Ue,le=ze,se=0,ce=qe;ce;ce=hi(ce))se++;for(ce=0,Re=le;Re;Re=hi(Re))ce++;for(;0<se-ce;)qe=hi(qe),se--;for(;0<ce-se;)le=hi(le),ce--;for(;se--;){if(qe===le||le!==null&&qe===le.alternate)break t;qe=hi(qe),le=hi(le)}qe=null}else qe=null;Ue!==null&&rh(Ee,Ce,Ue,qe,!1),ze!==null&&Gt!==null&&rh(Ee,Gt,ze,qe,!0)}}e:{if(Ce=ue?pi(ue):window,Ue=Ce.nodeName&&Ce.nodeName.toLowerCase(),Ue==="select"||Ue==="input"&&Ce.type==="file")var Ge=fl;else if(no(Ce))if(ro)Ge=ve;else{Ge=ml;var rt=pl}else(Ue=Ce.nodeName)&&Ue.toLowerCase()==="input"&&(Ce.type==="checkbox"||Ce.type==="radio")&&(Ge=X);if(Ge&&(Ge=Ge(n,ue))){dl(Ee,Ge,c,xe);break e}rt&&rt(n,Ce,ue),n==="focusout"&&(rt=Ce._wrapperState)&&rt.controlled&&Ce.type==="number"&&mt(Ce,"number",Ce.value)}switch(rt=ue?pi(ue):window,n){case"focusin":(no(rt)||rt.contentEditable==="true")&&(ui=rt,Ga=ue,lo=null);break;case"focusout":lo=Ga=ui=null;break;case"mousedown":Ya=!0;break;case"contextmenu":case"mouseup":case"dragend":Ya=!1,Vd(Ee,c,xe);break;case"selectionchange":if(C_)break;case"keydown":case"keyup":Vd(Ee,c,xe)}var st;if(Ns)e:{switch(n){case"compositionstart":var ut="onCompositionStart";break e;case"compositionend":ut="onCompositionEnd";break e;case"compositionupdate":ut="onCompositionUpdate";break e}ut=void 0}else Gr?Zi(n,c)&&(ut="onCompositionEnd"):n==="keydown"&&c.keyCode===229&&(ut="onCompositionStart");ut&&(ol&&c.locale!=="ko"&&(Gr||ut!=="onCompositionStart"?ut==="onCompositionEnd"&&Gr&&(st=qi()):(Gn=xe,ri="value"in Gn?Gn.value:Gn.textContent,Gr=!0)),rt=wl(ue,ut),0<rt.length&&(ut=new Ls(ut,n,null,c,xe),Ee.push({event:ut,listeners:rt}),st?ut.data=st:(st=cl(c),st!==null&&(ut.data=st)))),(st=il?eo(n,c):ul(n,c))&&(ue=wl(ue,"onBeforeInput"),0<ue.length&&(xe=new Ls("onBeforeInput","beforeinput",null,c,xe),Ee.push({event:xe,listeners:ue}),xe.data=st))}th(Ee,r)})}function uo(n,r,c){return{instance:n,listener:r,currentTarget:c}}function wl(n,r){for(var c=r+"Capture",C=[];n!==null;){var A=n,O=A.stateNode;A.tag===5&&O!==null&&(A=O,O=Ye(n,c),O!=null&&C.unshift(uo(n,O,A)),O=Ye(n,r),O!=null&&C.push(uo(n,O,A))),n=n.return}return C}function hi(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function rh(n,r,c,C,A){for(var O=r._reactName,q=[];c!==null&&c!==C;){var J=c,ne=J.alternate,ue=J.stateNode;if(ne!==null&&ne===C)break;J.tag===5&&ue!==null&&(J=ue,A?(ne=Ye(c,O),ne!=null&&q.unshift(uo(c,ne,J))):A||(ne=Ye(c,O),ne!=null&&q.push(uo(c,ne,J)))),c=c.return}q.length!==0&&n.push({event:r,listeners:q})}var T_=/\r\n?/g,L_=/\u0000|\uFFFD/g;function sh(n){return(typeof n=="string"?n:""+n).replace(T_,`
|
|
38
|
-
`).replace(L_,"")}function bl(n,r,c){if(r=sh(r),sh(n)!==r&&c)throw Error(s(425))}function yl(){}var tc=null,nc=null;function rc(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var sc=typeof setTimeout=="function"?setTimeout:void 0,N_=typeof clearTimeout=="function"?clearTimeout:void 0,ih=typeof Promise=="function"?Promise:void 0,R_=typeof queueMicrotask=="function"?queueMicrotask:typeof ih<"u"?function(n){return ih.resolve(null).then(n).catch(M_)}:sc;function M_(n){setTimeout(function(){throw n})}function ic(n,r){var c=r,C=0;do{var A=c.nextSibling;if(n.removeChild(c),A&&A.nodeType===8)if(c=A.data,c==="/$"){if(C===0){n.removeChild(A),On(r);return}C--}else c!=="$"&&c!=="$?"&&c!=="$!"||C++;c=A}while(c);On(r)}function Zr(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?")break;if(r==="/$")return null}}return n}function oh(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var c=n.data;if(c==="$"||c==="$!"||c==="$?"){if(r===0)return n;r--}else c==="/$"&&r++}n=n.previousSibling}return null}var fi=Math.random().toString(36).slice(2),ur="__reactFiber$"+fi,ho="__reactProps$"+fi,Lr="__reactContainer$"+fi,oc="__reactEvents$"+fi,A_="__reactListeners$"+fi,I_="__reactHandles$"+fi;function As(n){var r=n[ur];if(r)return r;for(var c=n.parentNode;c;){if(r=c[Lr]||c[ur]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(n=oh(n);n!==null;){if(c=n[ur])return c;n=oh(n)}return r}n=c,c=n.parentNode}return null}function fo(n){return n=n[ur]||n[Lr],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function pi(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(s(33))}function kl(n){return n[ho]||null}var lc=[],mi=-1;function es(n){return{current:n}}function Ot(n){0>mi||(n.current=lc[mi],lc[mi]=null,mi--)}function jt(n,r){mi++,lc[mi]=n.current,n.current=r}var ts={},dn=es(ts),Sn=es(!1),Is=ts;function gi(n,r){var c=n.type.contextTypes;if(!c)return ts;var C=n.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===r)return C.__reactInternalMemoizedMaskedChildContext;var A={},O;for(O in c)A[O]=r[O];return C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=A),A}function xn(n){return n=n.childContextTypes,n!=null}function Cl(){Ot(Sn),Ot(dn)}function lh(n,r,c){if(dn.current!==ts)throw Error(s(168));jt(dn,r),jt(Sn,c)}function ah(n,r,c){var C=n.stateNode;if(r=r.childContextTypes,typeof C.getChildContext!="function")return c;C=C.getChildContext();for(var A in C)if(!(A in r))throw Error(s(108,Q(n)||"Unknown",A));return U({},c,C)}function Sl(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ts,Is=dn.current,jt(dn,n),jt(Sn,Sn.current),!0}function ch(n,r,c){var C=n.stateNode;if(!C)throw Error(s(169));c?(n=ah(n,r,Is),C.__reactInternalMemoizedMergedChildContext=n,Ot(Sn),Ot(dn),jt(dn,n)):Ot(Sn),jt(Sn,c)}var Nr=null,xl=!1,ac=!1;function uh(n){Nr===null?Nr=[n]:Nr.push(n)}function j_(n){xl=!0,uh(n)}function ns(){if(!ac&&Nr!==null){ac=!0;var n=0,r=kt;try{var c=Nr;for(kt=1;n<c.length;n++){var C=c[n];do C=C(!0);while(C!==null)}Nr=null,xl=!1}catch(A){throw Nr!==null&&(Nr=Nr.slice(n+1)),nr(rr,ns),A}finally{kt=r,ac=!1}}return null}var vi=[],_i=0,El=null,Tl=0,Bn=[],Fn=0,js=null,Rr=1,Mr="";function Ds(n,r){vi[_i++]=Tl,vi[_i++]=El,El=n,Tl=r}function dh(n,r,c){Bn[Fn++]=Rr,Bn[Fn++]=Mr,Bn[Fn++]=js,js=n;var C=Rr;n=Mr;var A=32-Qt(C)-1;C&=~(1<<A),c+=1;var O=32-Qt(r)+A;if(30<O){var q=A-A%5;O=(C&(1<<q)-1).toString(32),C>>=q,A-=q,Rr=1<<32-Qt(r)+A|c<<A|C,Mr=O+n}else Rr=1<<O|c<<A|C,Mr=n}function cc(n){n.return!==null&&(Ds(n,1),dh(n,1,0))}function uc(n){for(;n===El;)El=vi[--_i],vi[_i]=null,Tl=vi[--_i],vi[_i]=null;for(;n===js;)js=Bn[--Fn],Bn[Fn]=null,Mr=Bn[--Fn],Bn[Fn]=null,Rr=Bn[--Fn],Bn[Fn]=null}var An=null,In=null,Bt=!1,Yn=null;function hh(n,r){var c=Wn(5,null,null,0);c.elementType="DELETED",c.stateNode=r,c.return=n,r=n.deletions,r===null?(n.deletions=[c],n.flags|=16):r.push(c)}function fh(n,r){switch(n.tag){case 5:var c=n.type;return r=r.nodeType!==1||c.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(n.stateNode=r,An=n,In=Zr(r.firstChild),!0):!1;case 6:return r=n.pendingProps===""||r.nodeType!==3?null:r,r!==null?(n.stateNode=r,An=n,In=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(c=js!==null?{id:Rr,overflow:Mr}:null,n.memoizedState={dehydrated:r,treeContext:c,retryLane:1073741824},c=Wn(18,null,null,0),c.stateNode=r,c.return=n,n.child=c,An=n,In=null,!0):!1;default:return!1}}function dc(n){return(n.mode&1)!==0&&(n.flags&128)===0}function hc(n){if(Bt){var r=In;if(r){var c=r;if(!fh(n,r)){if(dc(n))throw Error(s(418));r=Zr(c.nextSibling);var C=An;r&&fh(n,r)?hh(C,c):(n.flags=n.flags&-4097|2,Bt=!1,An=n)}}else{if(dc(n))throw Error(s(418));n.flags=n.flags&-4097|2,Bt=!1,An=n}}}function ph(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;An=n}function Ll(n){if(n!==An)return!1;if(!Bt)return ph(n),Bt=!0,!1;var r;if((r=n.tag!==3)&&!(r=n.tag!==5)&&(r=n.type,r=r!=="head"&&r!=="body"&&!rc(n.type,n.memoizedProps)),r&&(r=In)){if(dc(n))throw mh(),Error(s(418));for(;r;)hh(n,r),r=Zr(r.nextSibling)}if(ph(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));e:{for(n=n.nextSibling,r=0;n;){if(n.nodeType===8){var c=n.data;if(c==="/$"){if(r===0){In=Zr(n.nextSibling);break e}r--}else c!=="$"&&c!=="$!"&&c!=="$?"||r++}n=n.nextSibling}In=null}}else In=An?Zr(n.stateNode.nextSibling):null;return!0}function mh(){for(var n=In;n;)n=Zr(n.nextSibling)}function wi(){In=An=null,Bt=!1}function fc(n){Yn===null?Yn=[n]:Yn.push(n)}var D_=x.ReactCurrentBatchConfig;function po(n,r,c){if(n=c.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(c._owner){if(c=c._owner,c){if(c.tag!==1)throw Error(s(309));var C=c.stateNode}if(!C)throw Error(s(147,n));var A=C,O=""+n;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===O?r.ref:(r=function(q){var J=A.refs;q===null?delete J[O]:J[O]=q},r._stringRef=O,r)}if(typeof n!="string")throw Error(s(284));if(!c._owner)throw Error(s(290,n))}return n}function Nl(n,r){throw n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n))}function gh(n){var r=n._init;return r(n._payload)}function vh(n){function r(le,se){if(n){var ce=le.deletions;ce===null?(le.deletions=[se],le.flags|=16):ce.push(se)}}function c(le,se){if(!n)return null;for(;se!==null;)r(le,se),se=se.sibling;return null}function C(le,se){for(le=new Map;se!==null;)se.key!==null?le.set(se.key,se):le.set(se.index,se),se=se.sibling;return le}function A(le,se){return le=us(le,se),le.index=0,le.sibling=null,le}function O(le,se,ce){return le.index=ce,n?(ce=le.alternate,ce!==null?(ce=ce.index,ce<se?(le.flags|=2,se):ce):(le.flags|=2,se)):(le.flags|=1048576,se)}function q(le){return n&&le.alternate===null&&(le.flags|=2),le}function J(le,se,ce,Re){return se===null||se.tag!==6?(se=su(ce,le.mode,Re),se.return=le,se):(se=A(se,ce),se.return=le,se)}function ne(le,se,ce,Re){var Ge=ce.type;return Ge===R?xe(le,se,ce.props.children,Re,ce.key):se!==null&&(se.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===Y&&gh(Ge)===se.type)?(Re=A(se,ce.props),Re.ref=po(le,se,ce),Re.return=le,Re):(Re=Zl(ce.type,ce.key,ce.props,null,le.mode,Re),Re.ref=po(le,se,ce),Re.return=le,Re)}function ue(le,se,ce,Re){return se===null||se.tag!==4||se.stateNode.containerInfo!==ce.containerInfo||se.stateNode.implementation!==ce.implementation?(se=iu(ce,le.mode,Re),se.return=le,se):(se=A(se,ce.children||[]),se.return=le,se)}function xe(le,se,ce,Re,Ge){return se===null||se.tag!==7?(se=Ws(ce,le.mode,Re,Ge),se.return=le,se):(se=A(se,ce),se.return=le,se)}function Ee(le,se,ce){if(typeof se=="string"&&se!==""||typeof se=="number")return se=su(""+se,le.mode,ce),se.return=le,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case j:return ce=Zl(se.type,se.key,se.props,null,le.mode,ce),ce.ref=po(le,null,se),ce.return=le,ce;case E:return se=iu(se,le.mode,ce),se.return=le,se;case Y:var Re=se._init;return Ee(le,Re(se._payload),ce)}if(De(se)||B(se))return se=Ws(se,le.mode,ce,null),se.return=le,se;Nl(le,se)}return null}function Ce(le,se,ce,Re){var Ge=se!==null?se.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Ge!==null?null:J(le,se,""+ce,Re);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case j:return ce.key===Ge?ne(le,se,ce,Re):null;case E:return ce.key===Ge?ue(le,se,ce,Re):null;case Y:return Ge=ce._init,Ce(le,se,Ge(ce._payload),Re)}if(De(ce)||B(ce))return Ge!==null?null:xe(le,se,ce,Re,null);Nl(le,ce)}return null}function Ue(le,se,ce,Re,Ge){if(typeof Re=="string"&&Re!==""||typeof Re=="number")return le=le.get(ce)||null,J(se,le,""+Re,Ge);if(typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case j:return le=le.get(Re.key===null?ce:Re.key)||null,ne(se,le,Re,Ge);case E:return le=le.get(Re.key===null?ce:Re.key)||null,ue(se,le,Re,Ge);case Y:var rt=Re._init;return Ue(le,se,ce,rt(Re._payload),Ge)}if(De(Re)||B(Re))return le=le.get(ce)||null,xe(se,le,Re,Ge,null);Nl(se,Re)}return null}function ze(le,se,ce,Re){for(var Ge=null,rt=null,st=se,ut=se=0,sn=null;st!==null&&ut<ce.length;ut++){st.index>ut?(sn=st,st=null):sn=st.sibling;var St=Ce(le,st,ce[ut],Re);if(St===null){st===null&&(st=sn);break}n&&st&&St.alternate===null&&r(le,st),se=O(St,se,ut),rt===null?Ge=St:rt.sibling=St,rt=St,st=sn}if(ut===ce.length)return c(le,st),Bt&&Ds(le,ut),Ge;if(st===null){for(;ut<ce.length;ut++)st=Ee(le,ce[ut],Re),st!==null&&(se=O(st,se,ut),rt===null?Ge=st:rt.sibling=st,rt=st);return Bt&&Ds(le,ut),Ge}for(st=C(le,st);ut<ce.length;ut++)sn=Ue(st,le,ut,ce[ut],Re),sn!==null&&(n&&sn.alternate!==null&&st.delete(sn.key===null?ut:sn.key),se=O(sn,se,ut),rt===null?Ge=sn:rt.sibling=sn,rt=sn);return n&&st.forEach(function(ds){return r(le,ds)}),Bt&&Ds(le,ut),Ge}function qe(le,se,ce,Re){var Ge=B(ce);if(typeof Ge!="function")throw Error(s(150));if(ce=Ge.call(ce),ce==null)throw Error(s(151));for(var rt=Ge=null,st=se,ut=se=0,sn=null,St=ce.next();st!==null&&!St.done;ut++,St=ce.next()){st.index>ut?(sn=st,st=null):sn=st.sibling;var ds=Ce(le,st,St.value,Re);if(ds===null){st===null&&(st=sn);break}n&&st&&ds.alternate===null&&r(le,st),se=O(ds,se,ut),rt===null?Ge=ds:rt.sibling=ds,rt=ds,st=sn}if(St.done)return c(le,st),Bt&&Ds(le,ut),Ge;if(st===null){for(;!St.done;ut++,St=ce.next())St=Ee(le,St.value,Re),St!==null&&(se=O(St,se,ut),rt===null?Ge=St:rt.sibling=St,rt=St);return Bt&&Ds(le,ut),Ge}for(st=C(le,st);!St.done;ut++,St=ce.next())St=Ue(st,le,ut,St.value,Re),St!==null&&(n&&St.alternate!==null&&st.delete(St.key===null?ut:St.key),se=O(St,se,ut),rt===null?Ge=St:rt.sibling=St,rt=St);return n&&st.forEach(function(pw){return r(le,pw)}),Bt&&Ds(le,ut),Ge}function Gt(le,se,ce,Re){if(typeof ce=="object"&&ce!==null&&ce.type===R&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case j:e:{for(var Ge=ce.key,rt=se;rt!==null;){if(rt.key===Ge){if(Ge=ce.type,Ge===R){if(rt.tag===7){c(le,rt.sibling),se=A(rt,ce.props.children),se.return=le,le=se;break e}}else if(rt.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===Y&&gh(Ge)===rt.type){c(le,rt.sibling),se=A(rt,ce.props),se.ref=po(le,rt,ce),se.return=le,le=se;break e}c(le,rt);break}else r(le,rt);rt=rt.sibling}ce.type===R?(se=Ws(ce.props.children,le.mode,Re,ce.key),se.return=le,le=se):(Re=Zl(ce.type,ce.key,ce.props,null,le.mode,Re),Re.ref=po(le,se,ce),Re.return=le,le=Re)}return q(le);case E:e:{for(rt=ce.key;se!==null;){if(se.key===rt)if(se.tag===4&&se.stateNode.containerInfo===ce.containerInfo&&se.stateNode.implementation===ce.implementation){c(le,se.sibling),se=A(se,ce.children||[]),se.return=le,le=se;break e}else{c(le,se);break}else r(le,se);se=se.sibling}se=iu(ce,le.mode,Re),se.return=le,le=se}return q(le);case Y:return rt=ce._init,Gt(le,se,rt(ce._payload),Re)}if(De(ce))return ze(le,se,ce,Re);if(B(ce))return qe(le,se,ce,Re);Nl(le,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"?(ce=""+ce,se!==null&&se.tag===6?(c(le,se.sibling),se=A(se,ce),se.return=le,le=se):(c(le,se),se=su(ce,le.mode,Re),se.return=le,le=se),q(le)):c(le,se)}return Gt}var bi=vh(!0),_h=vh(!1),Rl=es(null),Ml=null,yi=null,pc=null;function mc(){pc=yi=Ml=null}function gc(n){var r=Rl.current;Ot(Rl),n._currentValue=r}function vc(n,r,c){for(;n!==null;){var C=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,C!==null&&(C.childLanes|=r)):C!==null&&(C.childLanes&r)!==r&&(C.childLanes|=r),n===c)break;n=n.return}}function ki(n,r){Ml=n,pc=yi=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&r)!==0&&(En=!0),n.firstContext=null)}function Hn(n){var r=n._currentValue;if(pc!==n)if(n={context:n,memoizedValue:r,next:null},yi===null){if(Ml===null)throw Error(s(308));yi=n,Ml.dependencies={lanes:0,firstContext:n}}else yi=yi.next=n;return r}var Ps=null;function _c(n){Ps===null?Ps=[n]:Ps.push(n)}function wh(n,r,c,C){var A=r.interleaved;return A===null?(c.next=c,_c(r)):(c.next=A.next,A.next=c),r.interleaved=c,Ar(n,C)}function Ar(n,r){n.lanes|=r;var c=n.alternate;for(c!==null&&(c.lanes|=r),c=n,n=n.return;n!==null;)n.childLanes|=r,c=n.alternate,c!==null&&(c.childLanes|=r),c=n,n=n.return;return c.tag===3?c.stateNode:null}var rs=!1;function wc(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bh(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Ir(n,r){return{eventTime:n,lane:r,tag:0,payload:null,callback:null,next:null}}function ss(n,r,c){var C=n.updateQueue;if(C===null)return null;if(C=C.shared,(Ct&2)!==0){var A=C.pending;return A===null?r.next=r:(r.next=A.next,A.next=r),C.pending=r,Ar(n,c)}return A=C.interleaved,A===null?(r.next=r,_c(C)):(r.next=A.next,A.next=r),C.interleaved=r,Ar(n,c)}function Al(n,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194240)!==0)){var C=r.lanes;C&=n.pendingLanes,c|=C,r.lanes=c,Hi(n,c)}}function yh(n,r){var c=n.updateQueue,C=n.alternate;if(C!==null&&(C=C.updateQueue,c===C)){var A=null,O=null;if(c=c.firstBaseUpdate,c!==null){do{var q={eventTime:c.eventTime,lane:c.lane,tag:c.tag,payload:c.payload,callback:c.callback,next:null};O===null?A=O=q:O=O.next=q,c=c.next}while(c!==null);O===null?A=O=r:O=O.next=r}else A=O=r;c={baseState:C.baseState,firstBaseUpdate:A,lastBaseUpdate:O,shared:C.shared,effects:C.effects},n.updateQueue=c;return}n=c.lastBaseUpdate,n===null?c.firstBaseUpdate=r:n.next=r,c.lastBaseUpdate=r}function Il(n,r,c,C){var A=n.updateQueue;rs=!1;var O=A.firstBaseUpdate,q=A.lastBaseUpdate,J=A.shared.pending;if(J!==null){A.shared.pending=null;var ne=J,ue=ne.next;ne.next=null,q===null?O=ue:q.next=ue,q=ne;var xe=n.alternate;xe!==null&&(xe=xe.updateQueue,J=xe.lastBaseUpdate,J!==q&&(J===null?xe.firstBaseUpdate=ue:J.next=ue,xe.lastBaseUpdate=ne))}if(O!==null){var Ee=A.baseState;q=0,xe=ue=ne=null,J=O;do{var Ce=J.lane,Ue=J.eventTime;if((C&Ce)===Ce){xe!==null&&(xe=xe.next={eventTime:Ue,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var ze=n,qe=J;switch(Ce=r,Ue=c,qe.tag){case 1:if(ze=qe.payload,typeof ze=="function"){Ee=ze.call(Ue,Ee,Ce);break e}Ee=ze;break e;case 3:ze.flags=ze.flags&-65537|128;case 0:if(ze=qe.payload,Ce=typeof ze=="function"?ze.call(Ue,Ee,Ce):ze,Ce==null)break e;Ee=U({},Ee,Ce);break e;case 2:rs=!0}}J.callback!==null&&J.lane!==0&&(n.flags|=64,Ce=A.effects,Ce===null?A.effects=[J]:Ce.push(J))}else Ue={eventTime:Ue,lane:Ce,tag:J.tag,payload:J.payload,callback:J.callback,next:null},xe===null?(ue=xe=Ue,ne=Ee):xe=xe.next=Ue,q|=Ce;if(J=J.next,J===null){if(J=A.shared.pending,J===null)break;Ce=J,J=Ce.next,Ce.next=null,A.lastBaseUpdate=Ce,A.shared.pending=null}}while(!0);if(xe===null&&(ne=Ee),A.baseState=ne,A.firstBaseUpdate=ue,A.lastBaseUpdate=xe,r=A.shared.interleaved,r!==null){A=r;do q|=A.lane,A=A.next;while(A!==r)}else O===null&&(A.shared.lanes=0);Fs|=q,n.lanes=q,n.memoizedState=Ee}}function kh(n,r,c){if(n=r.effects,r.effects=null,n!==null)for(r=0;r<n.length;r++){var C=n[r],A=C.callback;if(A!==null){if(C.callback=null,C=c,typeof A!="function")throw Error(s(191,A));A.call(C)}}}var mo={},dr=es(mo),go=es(mo),vo=es(mo);function Os(n){if(n===mo)throw Error(s(174));return n}function bc(n,r){switch(jt(vo,r),jt(go,n),jt(dr,mo),n=r.nodeType,n){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:Xe(null,"");break;default:n=n===8?r.parentNode:r,r=n.namespaceURI||null,n=n.tagName,r=Xe(r,n)}Ot(dr),jt(dr,r)}function Ci(){Ot(dr),Ot(go),Ot(vo)}function Ch(n){Os(vo.current);var r=Os(dr.current),c=Xe(r,n.type);r!==c&&(jt(go,n),jt(dr,c))}function yc(n){go.current===n&&(Ot(dr),Ot(go))}var Ft=es(0);function jl(n){for(var r=n;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||c.data==="$?"||c.data==="$!"))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var kc=[];function Cc(){for(var n=0;n<kc.length;n++)kc[n]._workInProgressVersionPrimary=null;kc.length=0}var Dl=x.ReactCurrentDispatcher,Sc=x.ReactCurrentBatchConfig,Bs=0,Ht=null,en=null,nn=null,Pl=!1,_o=!1,wo=0,P_=0;function hn(){throw Error(s(321))}function xc(n,r){if(r===null)return!1;for(var c=0;c<r.length&&c<n.length;c++)if(!Et(n[c],r[c]))return!1;return!0}function Ec(n,r,c,C,A,O){if(Bs=O,Ht=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,Dl.current=n===null||n.memoizedState===null?H_:U_,n=c(C,A),_o){O=0;do{if(_o=!1,wo=0,25<=O)throw Error(s(301));O+=1,nn=en=null,r.updateQueue=null,Dl.current=$_,n=c(C,A)}while(_o)}if(Dl.current=Fl,r=en!==null&&en.next!==null,Bs=0,nn=en=Ht=null,Pl=!1,r)throw Error(s(300));return n}function Tc(){var n=wo!==0;return wo=0,n}function hr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?Ht.memoizedState=nn=n:nn=nn.next=n,nn}function Un(){if(en===null){var n=Ht.alternate;n=n!==null?n.memoizedState:null}else n=en.next;var r=nn===null?Ht.memoizedState:nn.next;if(r!==null)nn=r,en=n;else{if(n===null)throw Error(s(310));en=n,n={memoizedState:en.memoizedState,baseState:en.baseState,baseQueue:en.baseQueue,queue:en.queue,next:null},nn===null?Ht.memoizedState=nn=n:nn=nn.next=n}return nn}function bo(n,r){return typeof r=="function"?r(n):r}function Lc(n){var r=Un(),c=r.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=n;var C=en,A=C.baseQueue,O=c.pending;if(O!==null){if(A!==null){var q=A.next;A.next=O.next,O.next=q}C.baseQueue=A=O,c.pending=null}if(A!==null){O=A.next,C=C.baseState;var J=q=null,ne=null,ue=O;do{var xe=ue.lane;if((Bs&xe)===xe)ne!==null&&(ne=ne.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),C=ue.hasEagerState?ue.eagerState:n(C,ue.action);else{var Ee={lane:xe,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};ne===null?(J=ne=Ee,q=C):ne=ne.next=Ee,Ht.lanes|=xe,Fs|=xe}ue=ue.next}while(ue!==null&&ue!==O);ne===null?q=C:ne.next=J,Et(C,r.memoizedState)||(En=!0),r.memoizedState=C,r.baseState=q,r.baseQueue=ne,c.lastRenderedState=C}if(n=c.interleaved,n!==null){A=n;do O=A.lane,Ht.lanes|=O,Fs|=O,A=A.next;while(A!==n)}else A===null&&(c.lanes=0);return[r.memoizedState,c.dispatch]}function Nc(n){var r=Un(),c=r.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=n;var C=c.dispatch,A=c.pending,O=r.memoizedState;if(A!==null){c.pending=null;var q=A=A.next;do O=n(O,q.action),q=q.next;while(q!==A);Et(O,r.memoizedState)||(En=!0),r.memoizedState=O,r.baseQueue===null&&(r.baseState=O),c.lastRenderedState=O}return[O,C]}function Sh(){}function xh(n,r){var c=Ht,C=Un(),A=r(),O=!Et(C.memoizedState,A);if(O&&(C.memoizedState=A,En=!0),C=C.queue,Rc(Lh.bind(null,c,C,n),[n]),C.getSnapshot!==r||O||nn!==null&&nn.memoizedState.tag&1){if(c.flags|=2048,yo(9,Th.bind(null,c,C,A,r),void 0,null),rn===null)throw Error(s(349));(Bs&30)!==0||Eh(c,r,A)}return A}function Eh(n,r,c){n.flags|=16384,n={getSnapshot:r,value:c},r=Ht.updateQueue,r===null?(r={lastEffect:null,stores:null},Ht.updateQueue=r,r.stores=[n]):(c=r.stores,c===null?r.stores=[n]:c.push(n))}function Th(n,r,c,C){r.value=c,r.getSnapshot=C,Nh(r)&&Rh(n)}function Lh(n,r,c){return c(function(){Nh(r)&&Rh(n)})}function Nh(n){var r=n.getSnapshot;n=n.value;try{var c=r();return!Et(n,c)}catch{return!0}}function Rh(n){var r=Ar(n,1);r!==null&&Zn(r,n,1,-1)}function Mh(n){var r=hr();return typeof n=="function"&&(n=n()),r.memoizedState=r.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:n},r.queue=n,n=n.dispatch=F_.bind(null,Ht,n),[r.memoizedState,n]}function yo(n,r,c,C){return n={tag:n,create:r,destroy:c,deps:C,next:null},r=Ht.updateQueue,r===null?(r={lastEffect:null,stores:null},Ht.updateQueue=r,r.lastEffect=n.next=n):(c=r.lastEffect,c===null?r.lastEffect=n.next=n:(C=c.next,c.next=n,n.next=C,r.lastEffect=n)),n}function Ah(){return Un().memoizedState}function Ol(n,r,c,C){var A=hr();Ht.flags|=n,A.memoizedState=yo(1|r,c,void 0,C===void 0?null:C)}function Bl(n,r,c,C){var A=Un();C=C===void 0?null:C;var O=void 0;if(en!==null){var q=en.memoizedState;if(O=q.destroy,C!==null&&xc(C,q.deps)){A.memoizedState=yo(r,c,O,C);return}}Ht.flags|=n,A.memoizedState=yo(1|r,c,O,C)}function Ih(n,r){return Ol(8390656,8,n,r)}function Rc(n,r){return Bl(2048,8,n,r)}function jh(n,r){return Bl(4,2,n,r)}function Dh(n,r){return Bl(4,4,n,r)}function Ph(n,r){if(typeof r=="function")return n=n(),r(n),function(){r(null)};if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function Oh(n,r,c){return c=c!=null?c.concat([n]):null,Bl(4,4,Ph.bind(null,r,n),c)}function Mc(){}function Bh(n,r){var c=Un();r=r===void 0?null:r;var C=c.memoizedState;return C!==null&&r!==null&&xc(r,C[1])?C[0]:(c.memoizedState=[n,r],n)}function Fh(n,r){var c=Un();r=r===void 0?null:r;var C=c.memoizedState;return C!==null&&r!==null&&xc(r,C[1])?C[0]:(n=n(),c.memoizedState=[n,r],n)}function Hh(n,r,c){return(Bs&21)===0?(n.baseState&&(n.baseState=!1,En=!0),n.memoizedState=c):(Et(c,r)||(c=Fi(),Ht.lanes|=c,Fs|=c,n.baseState=!0),r)}function O_(n,r){var c=kt;kt=c!==0&&4>c?c:4,n(!0);var C=Sc.transition;Sc.transition={};try{n(!1),r()}finally{kt=c,Sc.transition=C}}function Uh(){return Un().memoizedState}function B_(n,r,c){var C=as(n);if(c={lane:C,action:c,hasEagerState:!1,eagerState:null,next:null},$h(n))Wh(r,c);else if(c=wh(n,r,c,C),c!==null){var A=kn();Zn(c,n,C,A),zh(c,r,C)}}function F_(n,r,c){var C=as(n),A={lane:C,action:c,hasEagerState:!1,eagerState:null,next:null};if($h(n))Wh(r,A);else{var O=n.alternate;if(n.lanes===0&&(O===null||O.lanes===0)&&(O=r.lastRenderedReducer,O!==null))try{var q=r.lastRenderedState,J=O(q,c);if(A.hasEagerState=!0,A.eagerState=J,Et(J,q)){var ne=r.interleaved;ne===null?(A.next=A,_c(r)):(A.next=ne.next,ne.next=A),r.interleaved=A;return}}catch{}finally{}c=wh(n,r,A,C),c!==null&&(A=kn(),Zn(c,n,C,A),zh(c,r,C))}}function $h(n){var r=n.alternate;return n===Ht||r!==null&&r===Ht}function Wh(n,r){_o=Pl=!0;var c=n.pending;c===null?r.next=r:(r.next=c.next,c.next=r),n.pending=r}function zh(n,r,c){if((c&4194240)!==0){var C=r.lanes;C&=n.pendingLanes,c|=C,r.lanes=c,Hi(n,c)}}var Fl={readContext:Hn,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},H_={readContext:Hn,useCallback:function(n,r){return hr().memoizedState=[n,r===void 0?null:r],n},useContext:Hn,useEffect:Ih,useImperativeHandle:function(n,r,c){return c=c!=null?c.concat([n]):null,Ol(4194308,4,Ph.bind(null,r,n),c)},useLayoutEffect:function(n,r){return Ol(4194308,4,n,r)},useInsertionEffect:function(n,r){return Ol(4,2,n,r)},useMemo:function(n,r){var c=hr();return r=r===void 0?null:r,n=n(),c.memoizedState=[n,r],n},useReducer:function(n,r,c){var C=hr();return r=c!==void 0?c(r):r,C.memoizedState=C.baseState=r,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:r},C.queue=n,n=n.dispatch=B_.bind(null,Ht,n),[C.memoizedState,n]},useRef:function(n){var r=hr();return n={current:n},r.memoizedState=n},useState:Mh,useDebugValue:Mc,useDeferredValue:function(n){return hr().memoizedState=n},useTransition:function(){var n=Mh(!1),r=n[0];return n=O_.bind(null,n[1]),hr().memoizedState=n,[r,n]},useMutableSource:function(){},useSyncExternalStore:function(n,r,c){var C=Ht,A=hr();if(Bt){if(c===void 0)throw Error(s(407));c=c()}else{if(c=r(),rn===null)throw Error(s(349));(Bs&30)!==0||Eh(C,r,c)}A.memoizedState=c;var O={value:c,getSnapshot:r};return A.queue=O,Ih(Lh.bind(null,C,O,n),[n]),C.flags|=2048,yo(9,Th.bind(null,C,O,c,r),void 0,null),c},useId:function(){var n=hr(),r=rn.identifierPrefix;if(Bt){var c=Mr,C=Rr;c=(C&~(1<<32-Qt(C)-1)).toString(32)+c,r=":"+r+"R"+c,c=wo++,0<c&&(r+="H"+c.toString(32)),r+=":"}else c=P_++,r=":"+r+"r"+c.toString(32)+":";return n.memoizedState=r},unstable_isNewReconciler:!1},U_={readContext:Hn,useCallback:Bh,useContext:Hn,useEffect:Rc,useImperativeHandle:Oh,useInsertionEffect:jh,useLayoutEffect:Dh,useMemo:Fh,useReducer:Lc,useRef:Ah,useState:function(){return Lc(bo)},useDebugValue:Mc,useDeferredValue:function(n){var r=Un();return Hh(r,en.memoizedState,n)},useTransition:function(){var n=Lc(bo)[0],r=Un().memoizedState;return[n,r]},useMutableSource:Sh,useSyncExternalStore:xh,useId:Uh,unstable_isNewReconciler:!1},$_={readContext:Hn,useCallback:Bh,useContext:Hn,useEffect:Rc,useImperativeHandle:Oh,useInsertionEffect:jh,useLayoutEffect:Dh,useMemo:Fh,useReducer:Nc,useRef:Ah,useState:function(){return Nc(bo)},useDebugValue:Mc,useDeferredValue:function(n){var r=Un();return en===null?r.memoizedState=n:Hh(r,en.memoizedState,n)},useTransition:function(){var n=Nc(bo)[0],r=Un().memoizedState;return[n,r]},useMutableSource:Sh,useSyncExternalStore:xh,useId:Uh,unstable_isNewReconciler:!1};function Xn(n,r){if(n&&n.defaultProps){r=U({},r),n=n.defaultProps;for(var c in n)r[c]===void 0&&(r[c]=n[c]);return r}return r}function Ac(n,r,c,C){r=n.memoizedState,c=c(C,r),c=c==null?r:U({},r,c),n.memoizedState=c,n.lanes===0&&(n.updateQueue.baseState=c)}var Hl={isMounted:function(n){return(n=n._reactInternals)?qt(n)===n:!1},enqueueSetState:function(n,r,c){n=n._reactInternals;var C=kn(),A=as(n),O=Ir(C,A);O.payload=r,c!=null&&(O.callback=c),r=ss(n,O,A),r!==null&&(Zn(r,n,A,C),Al(r,n,A))},enqueueReplaceState:function(n,r,c){n=n._reactInternals;var C=kn(),A=as(n),O=Ir(C,A);O.tag=1,O.payload=r,c!=null&&(O.callback=c),r=ss(n,O,A),r!==null&&(Zn(r,n,A,C),Al(r,n,A))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var c=kn(),C=as(n),A=Ir(c,C);A.tag=2,r!=null&&(A.callback=r),r=ss(n,A,C),r!==null&&(Zn(r,n,C,c),Al(r,n,C))}};function qh(n,r,c,C,A,O,q){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(C,O,q):r.prototype&&r.prototype.isPureReactComponent?!Kt(c,C)||!Kt(A,O):!0}function Vh(n,r,c){var C=!1,A=ts,O=r.contextType;return typeof O=="object"&&O!==null?O=Hn(O):(A=xn(r)?Is:dn.current,C=r.contextTypes,O=(C=C!=null)?gi(n,A):ts),r=new r(c,O),n.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Hl,n.stateNode=r,r._reactInternals=n,C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=A,n.__reactInternalMemoizedMaskedChildContext=O),r}function Kh(n,r,c,C){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,C),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,C),r.state!==n&&Hl.enqueueReplaceState(r,r.state,null)}function Ic(n,r,c,C){var A=n.stateNode;A.props=c,A.state=n.memoizedState,A.refs={},wc(n);var O=r.contextType;typeof O=="object"&&O!==null?A.context=Hn(O):(O=xn(r)?Is:dn.current,A.context=gi(n,O)),A.state=n.memoizedState,O=r.getDerivedStateFromProps,typeof O=="function"&&(Ac(n,r,O,c),A.state=n.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof A.getSnapshotBeforeUpdate=="function"||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(r=A.state,typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount(),r!==A.state&&Hl.enqueueReplaceState(A,A.state,null),Il(n,c,A,C),A.state=n.memoizedState),typeof A.componentDidMount=="function"&&(n.flags|=4194308)}function Si(n,r){try{var c="",C=r;do c+=_e(C),C=C.return;while(C);var A=c}catch(O){A=`
|
|
39
|
-
Error generating stack: `+O.message+`
|
|
40
|
-
`+O.stack}return{value:n,source:r,stack:A,digest:null}}function jc(n,r,c){return{value:n,source:null,stack:c??null,digest:r??null}}function Dc(n,r){try{console.error(r.value)}catch(c){setTimeout(function(){throw c})}}var W_=typeof WeakMap=="function"?WeakMap:Map;function Gh(n,r,c){c=Ir(-1,c),c.tag=3,c.payload={element:null};var C=r.value;return c.callback=function(){Kl||(Kl=!0,Xc=C),Dc(n,r)},c}function Yh(n,r,c){c=Ir(-1,c),c.tag=3;var C=n.type.getDerivedStateFromError;if(typeof C=="function"){var A=r.value;c.payload=function(){return C(A)},c.callback=function(){Dc(n,r)}}var O=n.stateNode;return O!==null&&typeof O.componentDidCatch=="function"&&(c.callback=function(){Dc(n,r),typeof C!="function"&&(os===null?os=new Set([this]):os.add(this));var q=r.stack;this.componentDidCatch(r.value,{componentStack:q!==null?q:""})}),c}function Xh(n,r,c){var C=n.pingCache;if(C===null){C=n.pingCache=new W_;var A=new Set;C.set(r,A)}else A=C.get(r),A===void 0&&(A=new Set,C.set(r,A));A.has(c)||(A.add(c),n=rw.bind(null,n,r,c),r.then(n,n))}function Qh(n){do{var r;if((r=n.tag===13)&&(r=n.memoizedState,r=r!==null?r.dehydrated!==null:!0),r)return n;n=n.return}while(n!==null);return null}function Jh(n,r,c,C,A){return(n.mode&1)===0?(n===r?n.flags|=65536:(n.flags|=128,c.flags|=131072,c.flags&=-52805,c.tag===1&&(c.alternate===null?c.tag=17:(r=Ir(-1,1),r.tag=2,ss(c,r,1))),c.lanes|=1),n):(n.flags|=65536,n.lanes=A,n)}var z_=x.ReactCurrentOwner,En=!1;function yn(n,r,c,C){r.child=n===null?_h(r,null,c,C):bi(r,n.child,c,C)}function Zh(n,r,c,C,A){c=c.render;var O=r.ref;return ki(r,A),C=Ec(n,r,c,C,O,A),c=Tc(),n!==null&&!En?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,jr(n,r,A)):(Bt&&c&&cc(r),r.flags|=1,yn(n,r,C,A),r.child)}function ef(n,r,c,C,A){if(n===null){var O=c.type;return typeof O=="function"&&!ru(O)&&O.defaultProps===void 0&&c.compare===null&&c.defaultProps===void 0?(r.tag=15,r.type=O,tf(n,r,O,C,A)):(n=Zl(c.type,null,C,r,r.mode,A),n.ref=r.ref,n.return=r,r.child=n)}if(O=n.child,(n.lanes&A)===0){var q=O.memoizedProps;if(c=c.compare,c=c!==null?c:Kt,c(q,C)&&n.ref===r.ref)return jr(n,r,A)}return r.flags|=1,n=us(O,C),n.ref=r.ref,n.return=r,r.child=n}function tf(n,r,c,C,A){if(n!==null){var O=n.memoizedProps;if(Kt(O,C)&&n.ref===r.ref)if(En=!1,r.pendingProps=C=O,(n.lanes&A)!==0)(n.flags&131072)!==0&&(En=!0);else return r.lanes=n.lanes,jr(n,r,A)}return Pc(n,r,c,C,A)}function nf(n,r,c){var C=r.pendingProps,A=C.children,O=n!==null?n.memoizedState:null;if(C.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},jt(Ei,jn),jn|=c;else{if((c&1073741824)===0)return n=O!==null?O.baseLanes|c:c,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:n,cachePool:null,transitions:null},r.updateQueue=null,jt(Ei,jn),jn|=n,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=O!==null?O.baseLanes:c,jt(Ei,jn),jn|=C}else O!==null?(C=O.baseLanes|c,r.memoizedState=null):C=c,jt(Ei,jn),jn|=C;return yn(n,r,A,c),r.child}function rf(n,r){var c=r.ref;(n===null&&c!==null||n!==null&&n.ref!==c)&&(r.flags|=512,r.flags|=2097152)}function Pc(n,r,c,C,A){var O=xn(c)?Is:dn.current;return O=gi(r,O),ki(r,A),c=Ec(n,r,c,C,O,A),C=Tc(),n!==null&&!En?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,jr(n,r,A)):(Bt&&C&&cc(r),r.flags|=1,yn(n,r,c,A),r.child)}function sf(n,r,c,C,A){if(xn(c)){var O=!0;Sl(r)}else O=!1;if(ki(r,A),r.stateNode===null)$l(n,r),Vh(r,c,C),Ic(r,c,C,A),C=!0;else if(n===null){var q=r.stateNode,J=r.memoizedProps;q.props=J;var ne=q.context,ue=c.contextType;typeof ue=="object"&&ue!==null?ue=Hn(ue):(ue=xn(c)?Is:dn.current,ue=gi(r,ue));var xe=c.getDerivedStateFromProps,Ee=typeof xe=="function"||typeof q.getSnapshotBeforeUpdate=="function";Ee||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(J!==C||ne!==ue)&&Kh(r,q,C,ue),rs=!1;var Ce=r.memoizedState;q.state=Ce,Il(r,C,q,A),ne=r.memoizedState,J!==C||Ce!==ne||Sn.current||rs?(typeof xe=="function"&&(Ac(r,c,xe,C),ne=r.memoizedState),(J=rs||qh(r,c,J,C,Ce,ne,ue))?(Ee||typeof q.UNSAFE_componentWillMount!="function"&&typeof q.componentWillMount!="function"||(typeof q.componentWillMount=="function"&&q.componentWillMount(),typeof q.UNSAFE_componentWillMount=="function"&&q.UNSAFE_componentWillMount()),typeof q.componentDidMount=="function"&&(r.flags|=4194308)):(typeof q.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=C,r.memoizedState=ne),q.props=C,q.state=ne,q.context=ue,C=J):(typeof q.componentDidMount=="function"&&(r.flags|=4194308),C=!1)}else{q=r.stateNode,bh(n,r),J=r.memoizedProps,ue=r.type===r.elementType?J:Xn(r.type,J),q.props=ue,Ee=r.pendingProps,Ce=q.context,ne=c.contextType,typeof ne=="object"&&ne!==null?ne=Hn(ne):(ne=xn(c)?Is:dn.current,ne=gi(r,ne));var Ue=c.getDerivedStateFromProps;(xe=typeof Ue=="function"||typeof q.getSnapshotBeforeUpdate=="function")||typeof q.UNSAFE_componentWillReceiveProps!="function"&&typeof q.componentWillReceiveProps!="function"||(J!==Ee||Ce!==ne)&&Kh(r,q,C,ne),rs=!1,Ce=r.memoizedState,q.state=Ce,Il(r,C,q,A);var ze=r.memoizedState;J!==Ee||Ce!==ze||Sn.current||rs?(typeof Ue=="function"&&(Ac(r,c,Ue,C),ze=r.memoizedState),(ue=rs||qh(r,c,ue,C,Ce,ze,ne)||!1)?(xe||typeof q.UNSAFE_componentWillUpdate!="function"&&typeof q.componentWillUpdate!="function"||(typeof q.componentWillUpdate=="function"&&q.componentWillUpdate(C,ze,ne),typeof q.UNSAFE_componentWillUpdate=="function"&&q.UNSAFE_componentWillUpdate(C,ze,ne)),typeof q.componentDidUpdate=="function"&&(r.flags|=4),typeof q.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof q.componentDidUpdate!="function"||J===n.memoizedProps&&Ce===n.memoizedState||(r.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&Ce===n.memoizedState||(r.flags|=1024),r.memoizedProps=C,r.memoizedState=ze),q.props=C,q.state=ze,q.context=ne,C=ue):(typeof q.componentDidUpdate!="function"||J===n.memoizedProps&&Ce===n.memoizedState||(r.flags|=4),typeof q.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&Ce===n.memoizedState||(r.flags|=1024),C=!1)}return Oc(n,r,c,C,O,A)}function Oc(n,r,c,C,A,O){rf(n,r);var q=(r.flags&128)!==0;if(!C&&!q)return A&&ch(r,c,!1),jr(n,r,O);C=r.stateNode,z_.current=r;var J=q&&typeof c.getDerivedStateFromError!="function"?null:C.render();return r.flags|=1,n!==null&&q?(r.child=bi(r,n.child,null,O),r.child=bi(r,null,J,O)):yn(n,r,J,O),r.memoizedState=C.state,A&&ch(r,c,!0),r.child}function of(n){var r=n.stateNode;r.pendingContext?lh(n,r.pendingContext,r.pendingContext!==r.context):r.context&&lh(n,r.context,!1),bc(n,r.containerInfo)}function lf(n,r,c,C,A){return wi(),fc(A),r.flags|=256,yn(n,r,c,C),r.child}var Bc={dehydrated:null,treeContext:null,retryLane:0};function Fc(n){return{baseLanes:n,cachePool:null,transitions:null}}function af(n,r,c){var C=r.pendingProps,A=Ft.current,O=!1,q=(r.flags&128)!==0,J;if((J=q)||(J=n!==null&&n.memoizedState===null?!1:(A&2)!==0),J?(O=!0,r.flags&=-129):(n===null||n.memoizedState!==null)&&(A|=1),jt(Ft,A&1),n===null)return hc(r),n=r.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((r.mode&1)===0?r.lanes=1:n.data==="$!"?r.lanes=8:r.lanes=1073741824,null):(q=C.children,n=C.fallback,O?(C=r.mode,O=r.child,q={mode:"hidden",children:q},(C&1)===0&&O!==null?(O.childLanes=0,O.pendingProps=q):O=ea(q,C,0,null),n=Ws(n,C,c,null),O.return=r,n.return=r,O.sibling=n,r.child=O,r.child.memoizedState=Fc(c),r.memoizedState=Bc,n):Hc(r,q));if(A=n.memoizedState,A!==null&&(J=A.dehydrated,J!==null))return q_(n,r,q,C,J,A,c);if(O){O=C.fallback,q=r.mode,A=n.child,J=A.sibling;var ne={mode:"hidden",children:C.children};return(q&1)===0&&r.child!==A?(C=r.child,C.childLanes=0,C.pendingProps=ne,r.deletions=null):(C=us(A,ne),C.subtreeFlags=A.subtreeFlags&14680064),J!==null?O=us(J,O):(O=Ws(O,q,c,null),O.flags|=2),O.return=r,C.return=r,C.sibling=O,r.child=C,C=O,O=r.child,q=n.child.memoizedState,q=q===null?Fc(c):{baseLanes:q.baseLanes|c,cachePool:null,transitions:q.transitions},O.memoizedState=q,O.childLanes=n.childLanes&~c,r.memoizedState=Bc,C}return O=n.child,n=O.sibling,C=us(O,{mode:"visible",children:C.children}),(r.mode&1)===0&&(C.lanes=c),C.return=r,C.sibling=null,n!==null&&(c=r.deletions,c===null?(r.deletions=[n],r.flags|=16):c.push(n)),r.child=C,r.memoizedState=null,C}function Hc(n,r){return r=ea({mode:"visible",children:r},n.mode,0,null),r.return=n,n.child=r}function Ul(n,r,c,C){return C!==null&&fc(C),bi(r,n.child,null,c),n=Hc(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function q_(n,r,c,C,A,O,q){if(c)return r.flags&256?(r.flags&=-257,C=jc(Error(s(422))),Ul(n,r,q,C)):r.memoizedState!==null?(r.child=n.child,r.flags|=128,null):(O=C.fallback,A=r.mode,C=ea({mode:"visible",children:C.children},A,0,null),O=Ws(O,A,q,null),O.flags|=2,C.return=r,O.return=r,C.sibling=O,r.child=C,(r.mode&1)!==0&&bi(r,n.child,null,q),r.child.memoizedState=Fc(q),r.memoizedState=Bc,O);if((r.mode&1)===0)return Ul(n,r,q,null);if(A.data==="$!"){if(C=A.nextSibling&&A.nextSibling.dataset,C)var J=C.dgst;return C=J,O=Error(s(419)),C=jc(O,C,void 0),Ul(n,r,q,C)}if(J=(q&n.childLanes)!==0,En||J){if(C=rn,C!==null){switch(q&-q){case 4:A=2;break;case 16:A=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:A=32;break;case 536870912:A=268435456;break;default:A=0}A=(A&(C.suspendedLanes|q))!==0?0:A,A!==0&&A!==O.retryLane&&(O.retryLane=A,Ar(n,A),Zn(C,n,A,-1))}return nu(),C=jc(Error(s(421))),Ul(n,r,q,C)}return A.data==="$?"?(r.flags|=128,r.child=n.child,r=sw.bind(null,n),A._reactRetry=r,null):(n=O.treeContext,In=Zr(A.nextSibling),An=r,Bt=!0,Yn=null,n!==null&&(Bn[Fn++]=Rr,Bn[Fn++]=Mr,Bn[Fn++]=js,Rr=n.id,Mr=n.overflow,js=r),r=Hc(r,C.children),r.flags|=4096,r)}function cf(n,r,c){n.lanes|=r;var C=n.alternate;C!==null&&(C.lanes|=r),vc(n.return,r,c)}function Uc(n,r,c,C,A){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:C,tail:c,tailMode:A}:(O.isBackwards=r,O.rendering=null,O.renderingStartTime=0,O.last=C,O.tail=c,O.tailMode=A)}function uf(n,r,c){var C=r.pendingProps,A=C.revealOrder,O=C.tail;if(yn(n,r,C.children,c),C=Ft.current,(C&2)!==0)C=C&1|2,r.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&cf(n,c,r);else if(n.tag===19)cf(n,c,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}C&=1}if(jt(Ft,C),(r.mode&1)===0)r.memoizedState=null;else switch(A){case"forwards":for(c=r.child,A=null;c!==null;)n=c.alternate,n!==null&&jl(n)===null&&(A=c),c=c.sibling;c=A,c===null?(A=r.child,r.child=null):(A=c.sibling,c.sibling=null),Uc(r,!1,A,c,O);break;case"backwards":for(c=null,A=r.child,r.child=null;A!==null;){if(n=A.alternate,n!==null&&jl(n)===null){r.child=A;break}n=A.sibling,A.sibling=c,c=A,A=n}Uc(r,!0,c,null,O);break;case"together":Uc(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function $l(n,r){(r.mode&1)===0&&n!==null&&(n.alternate=null,r.alternate=null,r.flags|=2)}function jr(n,r,c){if(n!==null&&(r.dependencies=n.dependencies),Fs|=r.lanes,(c&r.childLanes)===0)return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,c=us(n,n.pendingProps),r.child=c,c.return=r;n.sibling!==null;)n=n.sibling,c=c.sibling=us(n,n.pendingProps),c.return=r;c.sibling=null}return r.child}function V_(n,r,c){switch(r.tag){case 3:of(r),wi();break;case 5:Ch(r);break;case 1:xn(r.type)&&Sl(r);break;case 4:bc(r,r.stateNode.containerInfo);break;case 10:var C=r.type._context,A=r.memoizedProps.value;jt(Rl,C._currentValue),C._currentValue=A;break;case 13:if(C=r.memoizedState,C!==null)return C.dehydrated!==null?(jt(Ft,Ft.current&1),r.flags|=128,null):(c&r.child.childLanes)!==0?af(n,r,c):(jt(Ft,Ft.current&1),n=jr(n,r,c),n!==null?n.sibling:null);jt(Ft,Ft.current&1);break;case 19:if(C=(c&r.childLanes)!==0,(n.flags&128)!==0){if(C)return uf(n,r,c);r.flags|=128}if(A=r.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),jt(Ft,Ft.current),C)break;return null;case 22:case 23:return r.lanes=0,nf(n,r,c)}return jr(n,r,c)}var df,$c,hf,ff;df=function(n,r){for(var c=r.child;c!==null;){if(c.tag===5||c.tag===6)n.appendChild(c.stateNode);else if(c.tag!==4&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===r)break;for(;c.sibling===null;){if(c.return===null||c.return===r)return;c=c.return}c.sibling.return=c.return,c=c.sibling}},$c=function(){},hf=function(n,r,c,C){var A=n.memoizedProps;if(A!==C){n=r.stateNode,Os(dr.current);var O=null;switch(c){case"input":A=Me(n,A),C=Me(n,C),O=[];break;case"select":A=U({},A,{value:void 0}),C=U({},C,{value:void 0}),O=[];break;case"textarea":A=Ze(n,A),C=Ze(n,C),O=[];break;default:typeof A.onClick!="function"&&typeof C.onClick=="function"&&(n.onclick=yl)}ct(c,C);var q;c=null;for(ue in A)if(!C.hasOwnProperty(ue)&&A.hasOwnProperty(ue)&&A[ue]!=null)if(ue==="style"){var J=A[ue];for(q in J)J.hasOwnProperty(q)&&(c||(c={}),c[q]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(u.hasOwnProperty(ue)?O||(O=[]):(O=O||[]).push(ue,null));for(ue in C){var ne=C[ue];if(J=A!=null?A[ue]:void 0,C.hasOwnProperty(ue)&&ne!==J&&(ne!=null||J!=null))if(ue==="style")if(J){for(q in J)!J.hasOwnProperty(q)||ne&&ne.hasOwnProperty(q)||(c||(c={}),c[q]="");for(q in ne)ne.hasOwnProperty(q)&&J[q]!==ne[q]&&(c||(c={}),c[q]=ne[q])}else c||(O||(O=[]),O.push(ue,c)),c=ne;else ue==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,J=J?J.__html:void 0,ne!=null&&J!==ne&&(O=O||[]).push(ue,ne)):ue==="children"?typeof ne!="string"&&typeof ne!="number"||(O=O||[]).push(ue,""+ne):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(u.hasOwnProperty(ue)?(ne!=null&&ue==="onScroll"&&Pt("scroll",n),O||J===ne||(O=[])):(O=O||[]).push(ue,ne))}c&&(O=O||[]).push("style",c);var ue=O;(r.updateQueue=ue)&&(r.flags|=4)}},ff=function(n,r,c,C){c!==C&&(r.flags|=4)};function ko(n,r){if(!Bt)switch(n.tailMode){case"hidden":r=n.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?n.tail=null:c.sibling=null;break;case"collapsed":c=n.tail;for(var C=null;c!==null;)c.alternate!==null&&(C=c),c=c.sibling;C===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:C.sibling=null}}function fn(n){var r=n.alternate!==null&&n.alternate.child===n.child,c=0,C=0;if(r)for(var A=n.child;A!==null;)c|=A.lanes|A.childLanes,C|=A.subtreeFlags&14680064,C|=A.flags&14680064,A.return=n,A=A.sibling;else for(A=n.child;A!==null;)c|=A.lanes|A.childLanes,C|=A.subtreeFlags,C|=A.flags,A.return=n,A=A.sibling;return n.subtreeFlags|=C,n.childLanes=c,r}function K_(n,r,c){var C=r.pendingProps;switch(uc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fn(r),null;case 1:return xn(r.type)&&Cl(),fn(r),null;case 3:return C=r.stateNode,Ci(),Ot(Sn),Ot(dn),Cc(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(n===null||n.child===null)&&(Ll(r)?r.flags|=4:n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Yn!==null&&(Zc(Yn),Yn=null))),$c(n,r),fn(r),null;case 5:yc(r);var A=Os(vo.current);if(c=r.type,n!==null&&r.stateNode!=null)hf(n,r,c,C,A),n.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!C){if(r.stateNode===null)throw Error(s(166));return fn(r),null}if(n=Os(dr.current),Ll(r)){C=r.stateNode,c=r.type;var O=r.memoizedProps;switch(C[ur]=r,C[ho]=O,n=(r.mode&1)!==0,c){case"dialog":Pt("cancel",C),Pt("close",C);break;case"iframe":case"object":case"embed":Pt("load",C);break;case"video":case"audio":for(A=0;A<ao.length;A++)Pt(ao[A],C);break;case"source":Pt("error",C);break;case"img":case"image":case"link":Pt("error",C),Pt("load",C);break;case"details":Pt("toggle",C);break;case"input":Je(C,O),Pt("invalid",C);break;case"select":C._wrapperState={wasMultiple:!!O.multiple},Pt("invalid",C);break;case"textarea":Se(C,O),Pt("invalid",C)}ct(c,O),A=null;for(var q in O)if(O.hasOwnProperty(q)){var J=O[q];q==="children"?typeof J=="string"?C.textContent!==J&&(O.suppressHydrationWarning!==!0&&bl(C.textContent,J,n),A=["children",J]):typeof J=="number"&&C.textContent!==""+J&&(O.suppressHydrationWarning!==!0&&bl(C.textContent,J,n),A=["children",""+J]):u.hasOwnProperty(q)&&J!=null&&q==="onScroll"&&Pt("scroll",C)}switch(c){case"input":we(C),ae(C,O,!0);break;case"textarea":we(C),je(C);break;case"select":case"option":break;default:typeof O.onClick=="function"&&(C.onclick=yl)}C=A,r.updateQueue=C,C!==null&&(r.flags|=4)}else{q=A.nodeType===9?A:A.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=pe(c)),n==="http://www.w3.org/1999/xhtml"?c==="script"?(n=q.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof C.is=="string"?n=q.createElement(c,{is:C.is}):(n=q.createElement(c),c==="select"&&(q=n,C.multiple?q.multiple=!0:C.size&&(q.size=C.size))):n=q.createElementNS(n,c),n[ur]=r,n[ho]=C,df(n,r,!1,!1),r.stateNode=n;e:{switch(q=wt(c,C),c){case"dialog":Pt("cancel",n),Pt("close",n),A=C;break;case"iframe":case"object":case"embed":Pt("load",n),A=C;break;case"video":case"audio":for(A=0;A<ao.length;A++)Pt(ao[A],n);A=C;break;case"source":Pt("error",n),A=C;break;case"img":case"image":case"link":Pt("error",n),Pt("load",n),A=C;break;case"details":Pt("toggle",n),A=C;break;case"input":Je(n,C),A=Me(n,C),Pt("invalid",n);break;case"option":A=C;break;case"select":n._wrapperState={wasMultiple:!!C.multiple},A=U({},C,{value:void 0}),Pt("invalid",n);break;case"textarea":Se(n,C),A=Ze(n,C),Pt("invalid",n);break;default:A=C}ct(c,A),J=A;for(O in J)if(J.hasOwnProperty(O)){var ne=J[O];O==="style"?Qe(n,ne):O==="dangerouslySetInnerHTML"?(ne=ne?ne.__html:void 0,ne!=null&&He(n,ne)):O==="children"?typeof ne=="string"?(c!=="textarea"||ne!=="")&&Pe(n,ne):typeof ne=="number"&&Pe(n,""+ne):O!=="suppressContentEditableWarning"&&O!=="suppressHydrationWarning"&&O!=="autoFocus"&&(u.hasOwnProperty(O)?ne!=null&&O==="onScroll"&&Pt("scroll",n):ne!=null&&f(n,O,ne,q))}switch(c){case"input":we(n),ae(n,C,!1);break;case"textarea":we(n),je(n);break;case"option":C.value!=null&&n.setAttribute("value",""+K(C.value));break;case"select":n.multiple=!!C.multiple,O=C.value,O!=null?Fe(n,!!C.multiple,O,!1):C.defaultValue!=null&&Fe(n,!!C.multiple,C.defaultValue,!0);break;default:typeof A.onClick=="function"&&(n.onclick=yl)}switch(c){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}}C&&(r.flags|=4)}r.ref!==null&&(r.flags|=512,r.flags|=2097152)}return fn(r),null;case 6:if(n&&r.stateNode!=null)ff(n,r,n.memoizedProps,C);else{if(typeof C!="string"&&r.stateNode===null)throw Error(s(166));if(c=Os(vo.current),Os(dr.current),Ll(r)){if(C=r.stateNode,c=r.memoizedProps,C[ur]=r,(O=C.nodeValue!==c)&&(n=An,n!==null))switch(n.tag){case 3:bl(C.nodeValue,c,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&bl(C.nodeValue,c,(n.mode&1)!==0)}O&&(r.flags|=4)}else C=(c.nodeType===9?c:c.ownerDocument).createTextNode(C),C[ur]=r,r.stateNode=C}return fn(r),null;case 13:if(Ot(Ft),C=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Bt&&In!==null&&(r.mode&1)!==0&&(r.flags&128)===0)mh(),wi(),r.flags|=98560,O=!1;else if(O=Ll(r),C!==null&&C.dehydrated!==null){if(n===null){if(!O)throw Error(s(318));if(O=r.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(s(317));O[ur]=r}else wi(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;fn(r),O=!1}else Yn!==null&&(Zc(Yn),Yn=null),O=!0;if(!O)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=c,r):(C=C!==null,C!==(n!==null&&n.memoizedState!==null)&&C&&(r.child.flags|=8192,(r.mode&1)!==0&&(n===null||(Ft.current&1)!==0?tn===0&&(tn=3):nu())),r.updateQueue!==null&&(r.flags|=4),fn(r),null);case 4:return Ci(),$c(n,r),n===null&&co(r.stateNode.containerInfo),fn(r),null;case 10:return gc(r.type._context),fn(r),null;case 17:return xn(r.type)&&Cl(),fn(r),null;case 19:if(Ot(Ft),O=r.memoizedState,O===null)return fn(r),null;if(C=(r.flags&128)!==0,q=O.rendering,q===null)if(C)ko(O,!1);else{if(tn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(q=jl(n),q!==null){for(r.flags|=128,ko(O,!1),C=q.updateQueue,C!==null&&(r.updateQueue=C,r.flags|=4),r.subtreeFlags=0,C=c,c=r.child;c!==null;)O=c,n=C,O.flags&=14680066,q=O.alternate,q===null?(O.childLanes=0,O.lanes=n,O.child=null,O.subtreeFlags=0,O.memoizedProps=null,O.memoizedState=null,O.updateQueue=null,O.dependencies=null,O.stateNode=null):(O.childLanes=q.childLanes,O.lanes=q.lanes,O.child=q.child,O.subtreeFlags=0,O.deletions=null,O.memoizedProps=q.memoizedProps,O.memoizedState=q.memoizedState,O.updateQueue=q.updateQueue,O.type=q.type,n=q.dependencies,O.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),c=c.sibling;return jt(Ft,Ft.current&1|2),r.child}n=n.sibling}O.tail!==null&&Nt()>Ti&&(r.flags|=128,C=!0,ko(O,!1),r.lanes=4194304)}else{if(!C)if(n=jl(q),n!==null){if(r.flags|=128,C=!0,c=n.updateQueue,c!==null&&(r.updateQueue=c,r.flags|=4),ko(O,!0),O.tail===null&&O.tailMode==="hidden"&&!q.alternate&&!Bt)return fn(r),null}else 2*Nt()-O.renderingStartTime>Ti&&c!==1073741824&&(r.flags|=128,C=!0,ko(O,!1),r.lanes=4194304);O.isBackwards?(q.sibling=r.child,r.child=q):(c=O.last,c!==null?c.sibling=q:r.child=q,O.last=q)}return O.tail!==null?(r=O.tail,O.rendering=r,O.tail=r.sibling,O.renderingStartTime=Nt(),r.sibling=null,c=Ft.current,jt(Ft,C?c&1|2:c&1),r):(fn(r),null);case 22:case 23:return tu(),C=r.memoizedState!==null,n!==null&&n.memoizedState!==null!==C&&(r.flags|=8192),C&&(r.mode&1)!==0?(jn&1073741824)!==0&&(fn(r),r.subtreeFlags&6&&(r.flags|=8192)):fn(r),null;case 24:return null;case 25:return null}throw Error(s(156,r.tag))}function G_(n,r){switch(uc(r),r.tag){case 1:return xn(r.type)&&Cl(),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ci(),Ot(Sn),Ot(dn),Cc(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 5:return yc(r),null;case 13:if(Ot(Ft),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));wi()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Ot(Ft),null;case 4:return Ci(),null;case 10:return gc(r.type._context),null;case 22:case 23:return tu(),null;case 24:return null;default:return null}}var Wl=!1,pn=!1,Y_=typeof WeakSet=="function"?WeakSet:Set,We=null;function xi(n,r){var c=n.ref;if(c!==null)if(typeof c=="function")try{c(null)}catch(C){$t(n,r,C)}else c.current=null}function Wc(n,r,c){try{c()}catch(C){$t(n,r,C)}}var pf=!1;function X_(n,r){if(tc=ti,n=qd(),Ka(n)){if("selectionStart"in n)var c={start:n.selectionStart,end:n.selectionEnd};else e:{c=(c=n.ownerDocument)&&c.defaultView||window;var C=c.getSelection&&c.getSelection();if(C&&C.rangeCount!==0){c=C.anchorNode;var A=C.anchorOffset,O=C.focusNode;C=C.focusOffset;try{c.nodeType,O.nodeType}catch{c=null;break e}var q=0,J=-1,ne=-1,ue=0,xe=0,Ee=n,Ce=null;t:for(;;){for(var Ue;Ee!==c||A!==0&&Ee.nodeType!==3||(J=q+A),Ee!==O||C!==0&&Ee.nodeType!==3||(ne=q+C),Ee.nodeType===3&&(q+=Ee.nodeValue.length),(Ue=Ee.firstChild)!==null;)Ce=Ee,Ee=Ue;for(;;){if(Ee===n)break t;if(Ce===c&&++ue===A&&(J=q),Ce===O&&++xe===C&&(ne=q),(Ue=Ee.nextSibling)!==null)break;Ee=Ce,Ce=Ee.parentNode}Ee=Ue}c=J===-1||ne===-1?null:{start:J,end:ne}}else c=null}c=c||{start:0,end:0}}else c=null;for(nc={focusedElem:n,selectionRange:c},ti=!1,We=r;We!==null;)if(r=We,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,We=n;else for(;We!==null;){r=We;try{var ze=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(ze!==null){var qe=ze.memoizedProps,Gt=ze.memoizedState,le=r.stateNode,se=le.getSnapshotBeforeUpdate(r.elementType===r.type?qe:Xn(r.type,qe),Gt);le.__reactInternalSnapshotBeforeUpdate=se}break;case 3:var ce=r.stateNode.containerInfo;ce.nodeType===1?ce.textContent="":ce.nodeType===9&&ce.documentElement&&ce.removeChild(ce.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Re){$t(r,r.return,Re)}if(n=r.sibling,n!==null){n.return=r.return,We=n;break}We=r.return}return ze=pf,pf=!1,ze}function Co(n,r,c){var C=r.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var A=C=C.next;do{if((A.tag&n)===n){var O=A.destroy;A.destroy=void 0,O!==void 0&&Wc(r,c,O)}A=A.next}while(A!==C)}}function zl(n,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var c=r=r.next;do{if((c.tag&n)===n){var C=c.create;c.destroy=C()}c=c.next}while(c!==r)}}function zc(n){var r=n.ref;if(r!==null){var c=n.stateNode;switch(n.tag){case 5:n=c;break;default:n=c}typeof r=="function"?r(n):r.current=n}}function mf(n){var r=n.alternate;r!==null&&(n.alternate=null,mf(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&(delete r[ur],delete r[ho],delete r[oc],delete r[A_],delete r[I_])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function gf(n){return n.tag===5||n.tag===3||n.tag===4}function vf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||gf(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function qc(n,r,c){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?c.nodeType===8?c.parentNode.insertBefore(n,r):c.insertBefore(n,r):(c.nodeType===8?(r=c.parentNode,r.insertBefore(n,c)):(r=c,r.appendChild(n)),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=yl));else if(C!==4&&(n=n.child,n!==null))for(qc(n,r,c),n=n.sibling;n!==null;)qc(n,r,c),n=n.sibling}function Vc(n,r,c){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?c.insertBefore(n,r):c.appendChild(n);else if(C!==4&&(n=n.child,n!==null))for(Vc(n,r,c),n=n.sibling;n!==null;)Vc(n,r,c),n=n.sibling}var ln=null,Qn=!1;function is(n,r,c){for(c=c.child;c!==null;)_f(n,r,c),c=c.sibling}function _f(n,r,c){if(wn&&typeof wn.onCommitFiberUnmount=="function")try{wn.onCommitFiberUnmount($r,c)}catch{}switch(c.tag){case 5:pn||xi(c,r);case 6:var C=ln,A=Qn;ln=null,is(n,r,c),ln=C,Qn=A,ln!==null&&(Qn?(n=ln,c=c.stateNode,n.nodeType===8?n.parentNode.removeChild(c):n.removeChild(c)):ln.removeChild(c.stateNode));break;case 18:ln!==null&&(Qn?(n=ln,c=c.stateNode,n.nodeType===8?ic(n.parentNode,c):n.nodeType===1&&ic(n,c),On(n)):ic(ln,c.stateNode));break;case 4:C=ln,A=Qn,ln=c.stateNode.containerInfo,Qn=!0,is(n,r,c),ln=C,Qn=A;break;case 0:case 11:case 14:case 15:if(!pn&&(C=c.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){A=C=C.next;do{var O=A,q=O.destroy;O=O.tag,q!==void 0&&((O&2)!==0||(O&4)!==0)&&Wc(c,r,q),A=A.next}while(A!==C)}is(n,r,c);break;case 1:if(!pn&&(xi(c,r),C=c.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=c.memoizedProps,C.state=c.memoizedState,C.componentWillUnmount()}catch(J){$t(c,r,J)}is(n,r,c);break;case 21:is(n,r,c);break;case 22:c.mode&1?(pn=(C=pn)||c.memoizedState!==null,is(n,r,c),pn=C):is(n,r,c);break;default:is(n,r,c)}}function wf(n){var r=n.updateQueue;if(r!==null){n.updateQueue=null;var c=n.stateNode;c===null&&(c=n.stateNode=new Y_),r.forEach(function(C){var A=iw.bind(null,n,C);c.has(C)||(c.add(C),C.then(A,A))})}}function Jn(n,r){var c=r.deletions;if(c!==null)for(var C=0;C<c.length;C++){var A=c[C];try{var O=n,q=r,J=q;e:for(;J!==null;){switch(J.tag){case 5:ln=J.stateNode,Qn=!1;break e;case 3:ln=J.stateNode.containerInfo,Qn=!0;break e;case 4:ln=J.stateNode.containerInfo,Qn=!0;break e}J=J.return}if(ln===null)throw Error(s(160));_f(O,q,A),ln=null,Qn=!1;var ne=A.alternate;ne!==null&&(ne.return=null),A.return=null}catch(ue){$t(A,r,ue)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)bf(r,n),r=r.sibling}function bf(n,r){var c=n.alternate,C=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(Jn(r,n),fr(n),C&4){try{Co(3,n,n.return),zl(3,n)}catch(qe){$t(n,n.return,qe)}try{Co(5,n,n.return)}catch(qe){$t(n,n.return,qe)}}break;case 1:Jn(r,n),fr(n),C&512&&c!==null&&xi(c,c.return);break;case 5:if(Jn(r,n),fr(n),C&512&&c!==null&&xi(c,c.return),n.flags&32){var A=n.stateNode;try{Pe(A,"")}catch(qe){$t(n,n.return,qe)}}if(C&4&&(A=n.stateNode,A!=null)){var O=n.memoizedProps,q=c!==null?c.memoizedProps:O,J=n.type,ne=n.updateQueue;if(n.updateQueue=null,ne!==null)try{J==="input"&&O.type==="radio"&&O.name!=null&&it(A,O),wt(J,q);var ue=wt(J,O);for(q=0;q<ne.length;q+=2){var xe=ne[q],Ee=ne[q+1];xe==="style"?Qe(A,Ee):xe==="dangerouslySetInnerHTML"?He(A,Ee):xe==="children"?Pe(A,Ee):f(A,xe,Ee,ue)}switch(J){case"input":Ie(A,O);break;case"textarea":be(A,O);break;case"select":var Ce=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!O.multiple;var Ue=O.value;Ue!=null?Fe(A,!!O.multiple,Ue,!1):Ce!==!!O.multiple&&(O.defaultValue!=null?Fe(A,!!O.multiple,O.defaultValue,!0):Fe(A,!!O.multiple,O.multiple?[]:"",!1))}A[ho]=O}catch(qe){$t(n,n.return,qe)}}break;case 6:if(Jn(r,n),fr(n),C&4){if(n.stateNode===null)throw Error(s(162));A=n.stateNode,O=n.memoizedProps;try{A.nodeValue=O}catch(qe){$t(n,n.return,qe)}}break;case 3:if(Jn(r,n),fr(n),C&4&&c!==null&&c.memoizedState.isDehydrated)try{On(r.containerInfo)}catch(qe){$t(n,n.return,qe)}break;case 4:Jn(r,n),fr(n);break;case 13:Jn(r,n),fr(n),A=n.child,A.flags&8192&&(O=A.memoizedState!==null,A.stateNode.isHidden=O,!O||A.alternate!==null&&A.alternate.memoizedState!==null||(Yc=Nt())),C&4&&wf(n);break;case 22:if(xe=c!==null&&c.memoizedState!==null,n.mode&1?(pn=(ue=pn)||xe,Jn(r,n),pn=ue):Jn(r,n),fr(n),C&8192){if(ue=n.memoizedState!==null,(n.stateNode.isHidden=ue)&&!xe&&(n.mode&1)!==0)for(We=n,xe=n.child;xe!==null;){for(Ee=We=xe;We!==null;){switch(Ce=We,Ue=Ce.child,Ce.tag){case 0:case 11:case 14:case 15:Co(4,Ce,Ce.return);break;case 1:xi(Ce,Ce.return);var ze=Ce.stateNode;if(typeof ze.componentWillUnmount=="function"){C=Ce,c=Ce.return;try{r=C,ze.props=r.memoizedProps,ze.state=r.memoizedState,ze.componentWillUnmount()}catch(qe){$t(C,c,qe)}}break;case 5:xi(Ce,Ce.return);break;case 22:if(Ce.memoizedState!==null){Cf(Ee);continue}}Ue!==null?(Ue.return=Ce,We=Ue):Cf(Ee)}xe=xe.sibling}e:for(xe=null,Ee=n;;){if(Ee.tag===5){if(xe===null){xe=Ee;try{A=Ee.stateNode,ue?(O=A.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none"):(J=Ee.stateNode,ne=Ee.memoizedProps.style,q=ne!=null&&ne.hasOwnProperty("display")?ne.display:null,J.style.display=Le("display",q))}catch(qe){$t(n,n.return,qe)}}}else if(Ee.tag===6){if(xe===null)try{Ee.stateNode.nodeValue=ue?"":Ee.memoizedProps}catch(qe){$t(n,n.return,qe)}}else if((Ee.tag!==22&&Ee.tag!==23||Ee.memoizedState===null||Ee===n)&&Ee.child!==null){Ee.child.return=Ee,Ee=Ee.child;continue}if(Ee===n)break e;for(;Ee.sibling===null;){if(Ee.return===null||Ee.return===n)break e;xe===Ee&&(xe=null),Ee=Ee.return}xe===Ee&&(xe=null),Ee.sibling.return=Ee.return,Ee=Ee.sibling}}break;case 19:Jn(r,n),fr(n),C&4&&wf(n);break;case 21:break;default:Jn(r,n),fr(n)}}function fr(n){var r=n.flags;if(r&2){try{e:{for(var c=n.return;c!==null;){if(gf(c)){var C=c;break e}c=c.return}throw Error(s(160))}switch(C.tag){case 5:var A=C.stateNode;C.flags&32&&(Pe(A,""),C.flags&=-33);var O=vf(n);Vc(n,O,A);break;case 3:case 4:var q=C.stateNode.containerInfo,J=vf(n);qc(n,J,q);break;default:throw Error(s(161))}}catch(ne){$t(n,n.return,ne)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function Q_(n,r,c){We=n,yf(n)}function yf(n,r,c){for(var C=(n.mode&1)!==0;We!==null;){var A=We,O=A.child;if(A.tag===22&&C){var q=A.memoizedState!==null||Wl;if(!q){var J=A.alternate,ne=J!==null&&J.memoizedState!==null||pn;J=Wl;var ue=pn;if(Wl=q,(pn=ne)&&!ue)for(We=A;We!==null;)q=We,ne=q.child,q.tag===22&&q.memoizedState!==null?Sf(A):ne!==null?(ne.return=q,We=ne):Sf(A);for(;O!==null;)We=O,yf(O),O=O.sibling;We=A,Wl=J,pn=ue}kf(n)}else(A.subtreeFlags&8772)!==0&&O!==null?(O.return=A,We=O):kf(n)}}function kf(n){for(;We!==null;){var r=We;if((r.flags&8772)!==0){var c=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:pn||zl(5,r);break;case 1:var C=r.stateNode;if(r.flags&4&&!pn)if(c===null)C.componentDidMount();else{var A=r.elementType===r.type?c.memoizedProps:Xn(r.type,c.memoizedProps);C.componentDidUpdate(A,c.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var O=r.updateQueue;O!==null&&kh(r,O,C);break;case 3:var q=r.updateQueue;if(q!==null){if(c=null,r.child!==null)switch(r.child.tag){case 5:c=r.child.stateNode;break;case 1:c=r.child.stateNode}kh(r,q,c)}break;case 5:var J=r.stateNode;if(c===null&&r.flags&4){c=J;var ne=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":ne.autoFocus&&c.focus();break;case"img":ne.src&&(c.src=ne.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var ue=r.alternate;if(ue!==null){var xe=ue.memoizedState;if(xe!==null){var Ee=xe.dehydrated;Ee!==null&&On(Ee)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}pn||r.flags&512&&zc(r)}catch(Ce){$t(r,r.return,Ce)}}if(r===n){We=null;break}if(c=r.sibling,c!==null){c.return=r.return,We=c;break}We=r.return}}function Cf(n){for(;We!==null;){var r=We;if(r===n){We=null;break}var c=r.sibling;if(c!==null){c.return=r.return,We=c;break}We=r.return}}function Sf(n){for(;We!==null;){var r=We;try{switch(r.tag){case 0:case 11:case 15:var c=r.return;try{zl(4,r)}catch(ne){$t(r,c,ne)}break;case 1:var C=r.stateNode;if(typeof C.componentDidMount=="function"){var A=r.return;try{C.componentDidMount()}catch(ne){$t(r,A,ne)}}var O=r.return;try{zc(r)}catch(ne){$t(r,O,ne)}break;case 5:var q=r.return;try{zc(r)}catch(ne){$t(r,q,ne)}}}catch(ne){$t(r,r.return,ne)}if(r===n){We=null;break}var J=r.sibling;if(J!==null){J.return=r.return,We=J;break}We=r.return}}var J_=Math.ceil,ql=x.ReactCurrentDispatcher,Kc=x.ReactCurrentOwner,$n=x.ReactCurrentBatchConfig,Ct=0,rn=null,Zt=null,an=0,jn=0,Ei=es(0),tn=0,So=null,Fs=0,Vl=0,Gc=0,xo=null,Tn=null,Yc=0,Ti=1/0,Dr=null,Kl=!1,Xc=null,os=null,Gl=!1,ls=null,Yl=0,Eo=0,Qc=null,Xl=-1,Ql=0;function kn(){return(Ct&6)!==0?Nt():Xl!==-1?Xl:Xl=Nt()}function as(n){return(n.mode&1)===0?1:(Ct&2)!==0&&an!==0?an&-an:D_.transition!==null?(Ql===0&&(Ql=Fi()),Ql):(n=kt,n!==0||(n=window.event,n=n===void 0?16:Yo(n.type)),n)}function Zn(n,r,c,C){if(50<Eo)throw Eo=0,Qc=null,Error(s(185));sr(n,c,C),((Ct&2)===0||n!==rn)&&(n===rn&&((Ct&2)===0&&(Vl|=c),tn===4&&cs(n,an)),Ln(n,C),c===1&&Ct===0&&(r.mode&1)===0&&(Ti=Nt()+500,xl&&ns()))}function Ln(n,r){var c=n.callbackNode;zr(n,r);var C=Dn(n,n===rn?an:0);if(C===0)c!==null&&Br(c),n.callbackNode=null,n.callbackPriority=0;else if(r=C&-C,n.callbackPriority!==r){if(c!=null&&Br(c),r===1)n.tag===0?j_(Ef.bind(null,n)):uh(Ef.bind(null,n)),R_(function(){(Ct&6)===0&&ns()}),c=null;else{switch(ei(C)){case 1:c=rr;break;case 4:c=Ur;break;case 16:c=kr;break;case 536870912:c=Js;break;default:c=kr}c=jf(c,xf.bind(null,n))}n.callbackPriority=r,n.callbackNode=c}}function xf(n,r){if(Xl=-1,Ql=0,(Ct&6)!==0)throw Error(s(327));var c=n.callbackNode;if(Li()&&n.callbackNode!==c)return null;var C=Dn(n,n===rn?an:0);if(C===0)return null;if((C&30)!==0||(C&n.expiredLanes)!==0||r)r=Jl(n,C);else{r=C;var A=Ct;Ct|=2;var O=Lf();(rn!==n||an!==r)&&(Dr=null,Ti=Nt()+500,Us(n,r));do try{tw();break}catch(J){Tf(n,J)}while(!0);mc(),ql.current=O,Ct=A,Zt!==null?r=0:(rn=null,an=0,r=tn)}if(r!==0){if(r===2&&(A=Zs(n),A!==0&&(C=A,r=Jc(n,A))),r===1)throw c=So,Us(n,0),cs(n,C),Ln(n,Nt()),c;if(r===6)cs(n,C);else{if(A=n.current.alternate,(C&30)===0&&!Z_(A)&&(r=Jl(n,C),r===2&&(O=Zs(n),O!==0&&(C=O,r=Jc(n,O))),r===1))throw c=So,Us(n,0),cs(n,C),Ln(n,Nt()),c;switch(n.finishedWork=A,n.finishedLanes=C,r){case 0:case 1:throw Error(s(345));case 2:$s(n,Tn,Dr);break;case 3:if(cs(n,C),(C&130023424)===C&&(r=Yc+500-Nt(),10<r)){if(Dn(n,0)!==0)break;if(A=n.suspendedLanes,(A&C)!==C){kn(),n.pingedLanes|=n.suspendedLanes&A;break}n.timeoutHandle=sc($s.bind(null,n,Tn,Dr),r);break}$s(n,Tn,Dr);break;case 4:if(cs(n,C),(C&4194240)===C)break;for(r=n.eventTimes,A=-1;0<C;){var q=31-Qt(C);O=1<<q,q=r[q],q>A&&(A=q),C&=~O}if(C=A,C=Nt()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*J_(C/1960))-C,10<C){n.timeoutHandle=sc($s.bind(null,n,Tn,Dr),C);break}$s(n,Tn,Dr);break;case 5:$s(n,Tn,Dr);break;default:throw Error(s(329))}}}return Ln(n,Nt()),n.callbackNode===c?xf.bind(null,n):null}function Jc(n,r){var c=xo;return n.current.memoizedState.isDehydrated&&(Us(n,r).flags|=256),n=Jl(n,r),n!==2&&(r=Tn,Tn=c,r!==null&&Zc(r)),n}function Zc(n){Tn===null?Tn=n:Tn.push.apply(Tn,n)}function Z_(n){for(var r=n;;){if(r.flags&16384){var c=r.updateQueue;if(c!==null&&(c=c.stores,c!==null))for(var C=0;C<c.length;C++){var A=c[C],O=A.getSnapshot;A=A.value;try{if(!Et(O(),A))return!1}catch{return!1}}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function cs(n,r){for(r&=~Gc,r&=~Vl,n.suspendedLanes|=r,n.pingedLanes&=~r,n=n.expirationTimes;0<r;){var c=31-Qt(r),C=1<<c;n[c]=-1,r&=~C}}function Ef(n){if((Ct&6)!==0)throw Error(s(327));Li();var r=Dn(n,0);if((r&1)===0)return Ln(n,Nt()),null;var c=Jl(n,r);if(n.tag!==0&&c===2){var C=Zs(n);C!==0&&(r=C,c=Jc(n,C))}if(c===1)throw c=So,Us(n,0),cs(n,r),Ln(n,Nt()),c;if(c===6)throw Error(s(345));return n.finishedWork=n.current.alternate,n.finishedLanes=r,$s(n,Tn,Dr),Ln(n,Nt()),null}function eu(n,r){var c=Ct;Ct|=1;try{return n(r)}finally{Ct=c,Ct===0&&(Ti=Nt()+500,xl&&ns())}}function Hs(n){ls!==null&&ls.tag===0&&(Ct&6)===0&&Li();var r=Ct;Ct|=1;var c=$n.transition,C=kt;try{if($n.transition=null,kt=1,n)return n()}finally{kt=C,$n.transition=c,Ct=r,(Ct&6)===0&&ns()}}function tu(){jn=Ei.current,Ot(Ei)}function Us(n,r){n.finishedWork=null,n.finishedLanes=0;var c=n.timeoutHandle;if(c!==-1&&(n.timeoutHandle=-1,N_(c)),Zt!==null)for(c=Zt.return;c!==null;){var C=c;switch(uc(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&Cl();break;case 3:Ci(),Ot(Sn),Ot(dn),Cc();break;case 5:yc(C);break;case 4:Ci();break;case 13:Ot(Ft);break;case 19:Ot(Ft);break;case 10:gc(C.type._context);break;case 22:case 23:tu()}c=c.return}if(rn=n,Zt=n=us(n.current,null),an=jn=r,tn=0,So=null,Gc=Vl=Fs=0,Tn=xo=null,Ps!==null){for(r=0;r<Ps.length;r++)if(c=Ps[r],C=c.interleaved,C!==null){c.interleaved=null;var A=C.next,O=c.pending;if(O!==null){var q=O.next;O.next=A,C.next=q}c.pending=C}Ps=null}return n}function Tf(n,r){do{var c=Zt;try{if(mc(),Dl.current=Fl,Pl){for(var C=Ht.memoizedState;C!==null;){var A=C.queue;A!==null&&(A.pending=null),C=C.next}Pl=!1}if(Bs=0,nn=en=Ht=null,_o=!1,wo=0,Kc.current=null,c===null||c.return===null){tn=1,So=r,Zt=null;break}e:{var O=n,q=c.return,J=c,ne=r;if(r=an,J.flags|=32768,ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var ue=ne,xe=J,Ee=xe.tag;if((xe.mode&1)===0&&(Ee===0||Ee===11||Ee===15)){var Ce=xe.alternate;Ce?(xe.updateQueue=Ce.updateQueue,xe.memoizedState=Ce.memoizedState,xe.lanes=Ce.lanes):(xe.updateQueue=null,xe.memoizedState=null)}var Ue=Qh(q);if(Ue!==null){Ue.flags&=-257,Jh(Ue,q,J,O,r),Ue.mode&1&&Xh(O,ue,r),r=Ue,ne=ue;var ze=r.updateQueue;if(ze===null){var qe=new Set;qe.add(ne),r.updateQueue=qe}else ze.add(ne);break e}else{if((r&1)===0){Xh(O,ue,r),nu();break e}ne=Error(s(426))}}else if(Bt&&J.mode&1){var Gt=Qh(q);if(Gt!==null){(Gt.flags&65536)===0&&(Gt.flags|=256),Jh(Gt,q,J,O,r),fc(Si(ne,J));break e}}O=ne=Si(ne,J),tn!==4&&(tn=2),xo===null?xo=[O]:xo.push(O),O=q;do{switch(O.tag){case 3:O.flags|=65536,r&=-r,O.lanes|=r;var le=Gh(O,ne,r);yh(O,le);break e;case 1:J=ne;var se=O.type,ce=O.stateNode;if((O.flags&128)===0&&(typeof se.getDerivedStateFromError=="function"||ce!==null&&typeof ce.componentDidCatch=="function"&&(os===null||!os.has(ce)))){O.flags|=65536,r&=-r,O.lanes|=r;var Re=Yh(O,J,r);yh(O,Re);break e}}O=O.return}while(O!==null)}Rf(c)}catch(Ge){r=Ge,Zt===c&&c!==null&&(Zt=c=c.return);continue}break}while(!0)}function Lf(){var n=ql.current;return ql.current=Fl,n===null?Fl:n}function nu(){(tn===0||tn===3||tn===2)&&(tn=4),rn===null||(Fs&268435455)===0&&(Vl&268435455)===0||cs(rn,an)}function Jl(n,r){var c=Ct;Ct|=2;var C=Lf();(rn!==n||an!==r)&&(Dr=null,Us(n,r));do try{ew();break}catch(A){Tf(n,A)}while(!0);if(mc(),Ct=c,ql.current=C,Zt!==null)throw Error(s(261));return rn=null,an=0,tn}function ew(){for(;Zt!==null;)Nf(Zt)}function tw(){for(;Zt!==null&&!Fr();)Nf(Zt)}function Nf(n){var r=If(n.alternate,n,jn);n.memoizedProps=n.pendingProps,r===null?Rf(n):Zt=r,Kc.current=null}function Rf(n){var r=n;do{var c=r.alternate;if(n=r.return,(r.flags&32768)===0){if(c=K_(c,r,jn),c!==null){Zt=c;return}}else{if(c=G_(c,r),c!==null){c.flags&=32767,Zt=c;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{tn=6,Zt=null;return}}if(r=r.sibling,r!==null){Zt=r;return}Zt=r=n}while(r!==null);tn===0&&(tn=5)}function $s(n,r,c){var C=kt,A=$n.transition;try{$n.transition=null,kt=1,nw(n,r,c,C)}finally{$n.transition=A,kt=C}return null}function nw(n,r,c,C){do Li();while(ls!==null);if((Ct&6)!==0)throw Error(s(327));c=n.finishedWork;var A=n.finishedLanes;if(c===null)return null;if(n.finishedWork=null,n.finishedLanes=0,c===n.current)throw Error(s(177));n.callbackNode=null,n.callbackPriority=0;var O=c.lanes|c.childLanes;if(ir(n,O),n===rn&&(Zt=rn=null,an=0),(c.subtreeFlags&2064)===0&&(c.flags&2064)===0||Gl||(Gl=!0,jf(kr,function(){return Li(),null})),O=(c.flags&15990)!==0,(c.subtreeFlags&15990)!==0||O){O=$n.transition,$n.transition=null;var q=kt;kt=1;var J=Ct;Ct|=4,Kc.current=null,X_(n,c),bf(c,n),k_(nc),ti=!!tc,nc=tc=null,n.current=c,Q_(c),Hr(),Ct=J,kt=q,$n.transition=O}else n.current=c;if(Gl&&(Gl=!1,ls=n,Yl=A),O=n.pendingLanes,O===0&&(os=null),Wr(c.stateNode),Ln(n,Nt()),r!==null)for(C=n.onRecoverableError,c=0;c<r.length;c++)A=r[c],C(A.value,{componentStack:A.stack,digest:A.digest});if(Kl)throw Kl=!1,n=Xc,Xc=null,n;return(Yl&1)!==0&&n.tag!==0&&Li(),O=n.pendingLanes,(O&1)!==0?n===Qc?Eo++:(Eo=0,Qc=n):Eo=0,ns(),null}function Li(){if(ls!==null){var n=ei(Yl),r=$n.transition,c=kt;try{if($n.transition=null,kt=16>n?16:n,ls===null)var C=!1;else{if(n=ls,ls=null,Yl=0,(Ct&6)!==0)throw Error(s(331));var A=Ct;for(Ct|=4,We=n.current;We!==null;){var O=We,q=O.child;if((We.flags&16)!==0){var J=O.deletions;if(J!==null){for(var ne=0;ne<J.length;ne++){var ue=J[ne];for(We=ue;We!==null;){var xe=We;switch(xe.tag){case 0:case 11:case 15:Co(8,xe,O)}var Ee=xe.child;if(Ee!==null)Ee.return=xe,We=Ee;else for(;We!==null;){xe=We;var Ce=xe.sibling,Ue=xe.return;if(mf(xe),xe===ue){We=null;break}if(Ce!==null){Ce.return=Ue,We=Ce;break}We=Ue}}}var ze=O.alternate;if(ze!==null){var qe=ze.child;if(qe!==null){ze.child=null;do{var Gt=qe.sibling;qe.sibling=null,qe=Gt}while(qe!==null)}}We=O}}if((O.subtreeFlags&2064)!==0&&q!==null)q.return=O,We=q;else e:for(;We!==null;){if(O=We,(O.flags&2048)!==0)switch(O.tag){case 0:case 11:case 15:Co(9,O,O.return)}var le=O.sibling;if(le!==null){le.return=O.return,We=le;break e}We=O.return}}var se=n.current;for(We=se;We!==null;){q=We;var ce=q.child;if((q.subtreeFlags&2064)!==0&&ce!==null)ce.return=q,We=ce;else e:for(q=se;We!==null;){if(J=We,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:zl(9,J)}}catch(Ge){$t(J,J.return,Ge)}if(J===q){We=null;break e}var Re=J.sibling;if(Re!==null){Re.return=J.return,We=Re;break e}We=J.return}}if(Ct=A,ns(),wn&&typeof wn.onPostCommitFiberRoot=="function")try{wn.onPostCommitFiberRoot($r,n)}catch{}C=!0}return C}finally{kt=c,$n.transition=r}}return!1}function Mf(n,r,c){r=Si(c,r),r=Gh(n,r,1),n=ss(n,r,1),r=kn(),n!==null&&(sr(n,1,r),Ln(n,r))}function $t(n,r,c){if(n.tag===3)Mf(n,n,c);else for(;r!==null;){if(r.tag===3){Mf(r,n,c);break}else if(r.tag===1){var C=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(os===null||!os.has(C))){n=Si(c,n),n=Yh(r,n,1),r=ss(r,n,1),n=kn(),r!==null&&(sr(r,1,n),Ln(r,n));break}}r=r.return}}function rw(n,r,c){var C=n.pingCache;C!==null&&C.delete(r),r=kn(),n.pingedLanes|=n.suspendedLanes&c,rn===n&&(an&c)===c&&(tn===4||tn===3&&(an&130023424)===an&&500>Nt()-Yc?Us(n,0):Gc|=c),Ln(n,r)}function Af(n,r){r===0&&((n.mode&1)===0?r=1:(r=pt,pt<<=1,(pt&130023424)===0&&(pt=4194304)));var c=kn();n=Ar(n,r),n!==null&&(sr(n,r,c),Ln(n,c))}function sw(n){var r=n.memoizedState,c=0;r!==null&&(c=r.retryLane),Af(n,c)}function iw(n,r){var c=0;switch(n.tag){case 13:var C=n.stateNode,A=n.memoizedState;A!==null&&(c=A.retryLane);break;case 19:C=n.stateNode;break;default:throw Error(s(314))}C!==null&&C.delete(r),Af(n,c)}var If;If=function(n,r,c){if(n!==null)if(n.memoizedProps!==r.pendingProps||Sn.current)En=!0;else{if((n.lanes&c)===0&&(r.flags&128)===0)return En=!1,V_(n,r,c);En=(n.flags&131072)!==0}else En=!1,Bt&&(r.flags&1048576)!==0&&dh(r,Tl,r.index);switch(r.lanes=0,r.tag){case 2:var C=r.type;$l(n,r),n=r.pendingProps;var A=gi(r,dn.current);ki(r,c),A=Ec(null,r,C,n,A,c);var O=Tc();return r.flags|=1,typeof A=="object"&&A!==null&&typeof A.render=="function"&&A.$$typeof===void 0?(r.tag=1,r.memoizedState=null,r.updateQueue=null,xn(C)?(O=!0,Sl(r)):O=!1,r.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,wc(r),A.updater=Hl,r.stateNode=A,A._reactInternals=r,Ic(r,C,n,c),r=Oc(null,r,C,!0,O,c)):(r.tag=0,Bt&&O&&cc(r),yn(null,r,A,c),r=r.child),r;case 16:C=r.elementType;e:{switch($l(n,r),n=r.pendingProps,A=C._init,C=A(C._payload),r.type=C,A=r.tag=lw(C),n=Xn(C,n),A){case 0:r=Pc(null,r,C,n,c);break e;case 1:r=sf(null,r,C,n,c);break e;case 11:r=Zh(null,r,C,n,c);break e;case 14:r=ef(null,r,C,Xn(C.type,n),c);break e}throw Error(s(306,C,""))}return r;case 0:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),Pc(n,r,C,A,c);case 1:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),sf(n,r,C,A,c);case 3:e:{if(of(r),n===null)throw Error(s(387));C=r.pendingProps,O=r.memoizedState,A=O.element,bh(n,r),Il(r,C,null,c);var q=r.memoizedState;if(C=q.element,O.isDehydrated)if(O={element:C,isDehydrated:!1,cache:q.cache,pendingSuspenseBoundaries:q.pendingSuspenseBoundaries,transitions:q.transitions},r.updateQueue.baseState=O,r.memoizedState=O,r.flags&256){A=Si(Error(s(423)),r),r=lf(n,r,C,c,A);break e}else if(C!==A){A=Si(Error(s(424)),r),r=lf(n,r,C,c,A);break e}else for(In=Zr(r.stateNode.containerInfo.firstChild),An=r,Bt=!0,Yn=null,c=_h(r,null,C,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(wi(),C===A){r=jr(n,r,c);break e}yn(n,r,C,c)}r=r.child}return r;case 5:return Ch(r),n===null&&hc(r),C=r.type,A=r.pendingProps,O=n!==null?n.memoizedProps:null,q=A.children,rc(C,A)?q=null:O!==null&&rc(C,O)&&(r.flags|=32),rf(n,r),yn(n,r,q,c),r.child;case 6:return n===null&&hc(r),null;case 13:return af(n,r,c);case 4:return bc(r,r.stateNode.containerInfo),C=r.pendingProps,n===null?r.child=bi(r,null,C,c):yn(n,r,C,c),r.child;case 11:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),Zh(n,r,C,A,c);case 7:return yn(n,r,r.pendingProps,c),r.child;case 8:return yn(n,r,r.pendingProps.children,c),r.child;case 12:return yn(n,r,r.pendingProps.children,c),r.child;case 10:e:{if(C=r.type._context,A=r.pendingProps,O=r.memoizedProps,q=A.value,jt(Rl,C._currentValue),C._currentValue=q,O!==null)if(Et(O.value,q)){if(O.children===A.children&&!Sn.current){r=jr(n,r,c);break e}}else for(O=r.child,O!==null&&(O.return=r);O!==null;){var J=O.dependencies;if(J!==null){q=O.child;for(var ne=J.firstContext;ne!==null;){if(ne.context===C){if(O.tag===1){ne=Ir(-1,c&-c),ne.tag=2;var ue=O.updateQueue;if(ue!==null){ue=ue.shared;var xe=ue.pending;xe===null?ne.next=ne:(ne.next=xe.next,xe.next=ne),ue.pending=ne}}O.lanes|=c,ne=O.alternate,ne!==null&&(ne.lanes|=c),vc(O.return,c,r),J.lanes|=c;break}ne=ne.next}}else if(O.tag===10)q=O.type===r.type?null:O.child;else if(O.tag===18){if(q=O.return,q===null)throw Error(s(341));q.lanes|=c,J=q.alternate,J!==null&&(J.lanes|=c),vc(q,c,r),q=O.sibling}else q=O.child;if(q!==null)q.return=O;else for(q=O;q!==null;){if(q===r){q=null;break}if(O=q.sibling,O!==null){O.return=q.return,q=O;break}q=q.return}O=q}yn(n,r,A.children,c),r=r.child}return r;case 9:return A=r.type,C=r.pendingProps.children,ki(r,c),A=Hn(A),C=C(A),r.flags|=1,yn(n,r,C,c),r.child;case 14:return C=r.type,A=Xn(C,r.pendingProps),A=Xn(C.type,A),ef(n,r,C,A,c);case 15:return tf(n,r,r.type,r.pendingProps,c);case 17:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:Xn(C,A),$l(n,r),r.tag=1,xn(C)?(n=!0,Sl(r)):n=!1,ki(r,c),Vh(r,C,A),Ic(r,C,A,c),Oc(null,r,C,!0,n,c);case 19:return uf(n,r,c);case 22:return nf(n,r,c)}throw Error(s(156,r.tag))};function jf(n,r){return nr(n,r)}function ow(n,r,c,C){this.tag=n,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wn(n,r,c,C){return new ow(n,r,c,C)}function ru(n){return n=n.prototype,!(!n||!n.isReactComponent)}function lw(n){if(typeof n=="function")return ru(n)?1:0;if(n!=null){if(n=n.$$typeof,n===D)return 11;if(n===$)return 14}return 2}function us(n,r){var c=n.alternate;return c===null?(c=Wn(n.tag,r,n.key,n.mode),c.elementType=n.elementType,c.type=n.type,c.stateNode=n.stateNode,c.alternate=n,n.alternate=c):(c.pendingProps=r,c.type=n.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=n.flags&14680064,c.childLanes=n.childLanes,c.lanes=n.lanes,c.child=n.child,c.memoizedProps=n.memoizedProps,c.memoizedState=n.memoizedState,c.updateQueue=n.updateQueue,r=n.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=n.sibling,c.index=n.index,c.ref=n.ref,c}function Zl(n,r,c,C,A,O){var q=2;if(C=n,typeof n=="function")ru(n)&&(q=1);else if(typeof n=="string")q=5;else e:switch(n){case R:return Ws(c.children,A,O,r);case S:q=8,A|=8;break;case L:return n=Wn(12,c,r,A|2),n.elementType=L,n.lanes=O,n;case F:return n=Wn(13,c,r,A),n.elementType=F,n.lanes=O,n;case W:return n=Wn(19,c,r,A),n.elementType=W,n.lanes=O,n;case G:return ea(c,A,O,r);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:q=10;break e;case P:q=9;break e;case D:q=11;break e;case $:q=14;break e;case Y:q=16,C=null;break e}throw Error(s(130,n==null?n:typeof n,""))}return r=Wn(q,c,r,A),r.elementType=n,r.type=C,r.lanes=O,r}function Ws(n,r,c,C){return n=Wn(7,n,C,r),n.lanes=c,n}function ea(n,r,c,C){return n=Wn(22,n,C,r),n.elementType=G,n.lanes=c,n.stateNode={isHidden:!1},n}function su(n,r,c){return n=Wn(6,n,null,r),n.lanes=c,n}function iu(n,r,c){return r=Wn(4,n.children!==null?n.children:[],n.key,r),r.lanes=c,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}function aw(n,r,c,C,A){this.tag=r,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ws(0),this.expirationTimes=ws(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ws(0),this.identifierPrefix=C,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function ou(n,r,c,C,A,O,q,J,ne){return n=new aw(n,r,c,J,ne),r===1?(r=1,O===!0&&(r|=8)):r=0,O=Wn(3,null,null,r),n.current=O,O.stateNode=n,O.memoizedState={element:C,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null},wc(O),n}function cw(n,r,c){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:C==null?null:""+C,children:n,containerInfo:r,implementation:c}}function Df(n){if(!n)return ts;n=n._reactInternals;e:{if(qt(n)!==n||n.tag!==1)throw Error(s(170));var r=n;do{switch(r.tag){case 3:r=r.stateNode.context;break e;case 1:if(xn(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(s(171))}if(n.tag===1){var c=n.type;if(xn(c))return ah(n,c,r)}return r}function Pf(n,r,c,C,A,O,q,J,ne){return n=ou(c,C,!0,n,A,O,q,J,ne),n.context=Df(null),c=n.current,C=kn(),A=as(c),O=Ir(C,A),O.callback=r??null,ss(c,O,A),n.current.lanes=A,sr(n,A,C),Ln(n,C),n}function ta(n,r,c,C){var A=r.current,O=kn(),q=as(A);return c=Df(c),r.context===null?r.context=c:r.pendingContext=c,r=Ir(O,q),r.payload={element:n},C=C===void 0?null:C,C!==null&&(r.callback=C),n=ss(A,r,q),n!==null&&(Zn(n,A,q,O),Al(n,A,q)),q}function na(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function Of(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var c=n.retryLane;n.retryLane=c!==0&&c<r?c:r}}function lu(n,r){Of(n,r),(n=n.alternate)&&Of(n,r)}function uw(){return null}var Bf=typeof reportError=="function"?reportError:function(n){console.error(n)};function au(n){this._internalRoot=n}ra.prototype.render=au.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));ta(n,r,null,null)},ra.prototype.unmount=au.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;Hs(function(){ta(null,n,null,null)}),r[Lr]=null}};function ra(n){this._internalRoot=n}ra.prototype.unstable_scheduleHydration=function(n){if(n){var r=Ui();n={blockedOn:null,target:n,priority:r};for(var c=0;c<xt.length&&r!==0&&r<xt[c].priority;c++);xt.splice(c,0,n),c===0&&ja(n)}};function cu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function sa(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Ff(){}function dw(n,r,c,C,A){if(A){if(typeof C=="function"){var O=C;C=function(){var ue=na(q);O.call(ue)}}var q=Pf(r,C,n,0,null,!1,!1,"",Ff);return n._reactRootContainer=q,n[Lr]=q.current,co(n.nodeType===8?n.parentNode:n),Hs(),q}for(;A=n.lastChild;)n.removeChild(A);if(typeof C=="function"){var J=C;C=function(){var ue=na(ne);J.call(ue)}}var ne=ou(n,0,!1,null,null,!1,!1,"",Ff);return n._reactRootContainer=ne,n[Lr]=ne.current,co(n.nodeType===8?n.parentNode:n),Hs(function(){ta(r,ne,c,C)}),ne}function ia(n,r,c,C,A){var O=c._reactRootContainer;if(O){var q=O;if(typeof A=="function"){var J=A;A=function(){var ne=na(q);J.call(ne)}}ta(r,q,n,A)}else q=dw(c,r,n,A,C);return na(q)}Cr=function(n){switch(n.tag){case 3:var r=n.stateNode;if(r.current.memoizedState.isDehydrated){var c=Jt(r.pendingLanes);c!==0&&(Hi(r,c|1),Ln(r,Nt()),(Ct&6)===0&&(Ti=Nt()+500,ns()))}break;case 13:Hs(function(){var C=Ar(n,1);if(C!==null){var A=kn();Zn(C,n,1,A)}}),lu(n,1)}},or=function(n){if(n.tag===13){var r=Ar(n,134217728);if(r!==null){var c=kn();Zn(r,n,134217728,c)}lu(n,134217728)}},qr=function(n){if(n.tag===13){var r=as(n),c=Ar(n,r);if(c!==null){var C=kn();Zn(c,n,r,C)}lu(n,r)}},Ui=function(){return kt},Sr=function(n,r){var c=kt;try{return kt=n,r()}finally{kt=c}},nt=function(n,r,c){switch(r){case"input":if(Ie(n,c),r=c.name,c.type==="radio"&&r!=null){for(c=n;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<c.length;r++){var C=c[r];if(C!==n&&C.form===n.form){var A=kl(C);if(!A)throw Error(s(90));ke(C),Ie(C,A)}}}break;case"textarea":be(n,c);break;case"select":r=c.value,r!=null&&Fe(n,!!c.multiple,r,!1)}},ye=eu,ht=Hs;var hw={usingClientEntryPoint:!1,Events:[fo,pi,kl,Ke,ft,eu]},To={findFiberByHostInstance:As,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},fw={bundleType:To.bundleType,version:To.version,rendererPackageName:To.rendererPackageName,rendererConfig:To.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=br(n),n===null?null:n.stateNode},findFiberByHostInstance:To.findFiberByHostInstance||uw,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var oa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!oa.isDisabled&&oa.supportsFiber)try{$r=oa.inject(fw),wn=oa}catch{}}return Nn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hw,Nn.createPortal=function(n,r){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cu(r))throw Error(s(200));return cw(n,r,null,c)},Nn.createRoot=function(n,r){if(!cu(n))throw Error(s(299));var c=!1,C="",A=Bf;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(C=r.identifierPrefix),r.onRecoverableError!==void 0&&(A=r.onRecoverableError)),r=ou(n,1,!1,null,null,c,!1,C,A),n[Lr]=r.current,co(n.nodeType===8?n.parentNode:n),new au(r)},Nn.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=br(r),n=n===null?null:n.stateNode,n},Nn.flushSync=function(n){return Hs(n)},Nn.hydrate=function(n,r,c){if(!sa(r))throw Error(s(200));return ia(null,n,r,!0,c)},Nn.hydrateRoot=function(n,r,c){if(!cu(n))throw Error(s(405));var C=c!=null&&c.hydratedSources||null,A=!1,O="",q=Bf;if(c!=null&&(c.unstable_strictMode===!0&&(A=!0),c.identifierPrefix!==void 0&&(O=c.identifierPrefix),c.onRecoverableError!==void 0&&(q=c.onRecoverableError)),r=Pf(r,null,n,1,c??null,A,!1,O,q),n[Lr]=r.current,co(n),C)for(n=0;n<C.length;n++)c=C[n],A=c._getVersion,A=A(c._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[c,A]:r.mutableSourceEagerHydrationData.push(c,A);return new ra(r)},Nn.render=function(n,r,c){if(!sa(r))throw Error(s(200));return ia(null,n,r,!1,c)},Nn.unmountComponentAtNode=function(n){if(!sa(n))throw Error(s(40));return n._reactRootContainer?(Hs(function(){ia(null,null,n,!1,function(){n._reactRootContainer=null,n[Lr]=null})}),!0):!1},Nn.unstable_batchedUpdates=eu,Nn.unstable_renderSubtreeIntoContainer=function(n,r,c,C){if(!sa(c))throw Error(s(200));if(n==null||n._reactInternals===void 0)throw Error(s(38));return ia(n,r,c,!1,C)},Nn.version="18.3.1-next-f1338f8080-20240426",Nn}var Kf;function og(){if(Kf)return hu.exports;Kf=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),hu.exports=Cw(),hu.exports}var Gf;function Sw(){if(Gf)return la;Gf=1;var t=og();return la.createRoot=t.createRoot,la.hydrateRoot=t.hydrateRoot,la}var xw=Sw(),N=bd();const Ew=vw(N);function Ne(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Be(t){return typeof t=="string"?t:null}function oe(t){return typeof t=="string"&&t.length>0?t:null}function _t(t){return typeof t=="boolean"?t:null}function Te(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function Tw(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:null}function Yt(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){if(typeof s!="string")return null;e.push(s)}return e}function Lt(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const u=e(l);if(u===null)return null;s.push(u)}return s}function zt(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const u=e(l);u!==null&&s.push(u)}return s}function Ve(t,e){return typeof t=="string"&&e.includes(t)?t:null}function Lw(t){try{return JSON.parse(t)}catch{return}}const Nw=["auto","default","acceptEdits","plan"];function Ks(t){return typeof t=="string"&&Nw.includes(t)}const Rw={agentUnknown:[],answerFreeTextMulti:[],answerInterrupted:[],answerInvalid:[],answerMenuChanged:[],answerNoFreeText:[],answerNotPending:[],answerSendFailed:[],answersUnsupported:[],archiveOpenTab:[],attachmentEmpty:["name"],attachmentExecutable:["name"],attachmentSaveFailed:[],attachmentTooLarge:["max","name","size"],badMessage:[],cliFolderClosed:[],cliMissing:["command","url"],cliNotFound:[],cliNotInstalled:["label"],cliOpenFailed:[],continueFailed:[],continueHistoryMissing:[],continueNoFolder:[],continueNotInHistory:[],continueReadFailed:[],continueSameCli:[],continueTabFailed:[],continueTranscriptFailed:[],conversationNotFollowed:[],cwdMissing:["cwd"],cwdNotDir:["cwd"],diffBinaryUntracked:[],diffNewEmpty:[],diffNoStaged:[],diffNoUnstaged:[],diffReadFailed:[],dirReadFailed:[],dirSearchFailed:[],fileReadFailed:[],fileSaveBlocked:[],fileSaveFailed:[],fileSaveTooLarge:["max"],filesPerMessage:["max"],forceSendFailed:[],forceSendNoCli:[],forceSendNothing:[],forceSendUnsupported:[],forceSendWaiting:[],gitCommandFailed:["command"],gitMissing:[],gitNotFound:[],gitNotRepo:[],gitRunFailed:[],gitStatusUnknown:[],gitUnexpected:["command"],handoffEmpty:[],handoffNoTranscript:[],imageEmpty:[],imageTooLarge:["max","size"],imageTypeUnsupported:["type"],imageUnknownFormat:[],imagesPerMessage:["max"],imagesUnsupported:[],memoryAppeared:["file"],memoryBrokenBlock:["file"],memoryChooseFile:[],memoryGitFailed:["detail"],memoryHardLinks:["file"],memoryLinkOutside:["path"],memoryNotAFile:["label"],memoryNotInstalled:[],memoryNotUtf8:["file"],memoryNoteClaude:[],memoryNoteGone:[],memoryNoteHardLink:["path"],memoryNoteHardLinkCmd:["path"],memoryNoteName:[],memoryNoteOpenCode:[],memorySameFile:["file","other"],memoryViaEncoding:["file"],memoryViaFallback:[],memoryViaFile:["file"],memoryViaNoBlock:["file"],memoryViaNoBlockEither:[],memoryViaNoFolder:[],memoryViaNoIndex:[],memoryViaOutside:["file"],modePendingConfirmation:[],modeUnreachable:["key"],modesUnsupported:[],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],operationFailed:["detail"],pasteImageFailed:[],pathMissing:[],pathNotRelative:[],pathNullByte:[],pathOpenFailed:[],pathOutside:[],pendingSubmitAnswer:["label"],pendingSubmitPermission:["label"],pickerCliFolder:[],pickerClosed:[],pickerCreateFailed:[],pickerFolderExists:[],pickerListFailed:[],pickerNameChars:[],pickerNameInvalid:[],pickerNoProjectsHere:[],pickerNotListed:[],pickerRootMissing:[],pickerTooMany:[],planReadFailed:[],queueEditBusyEditor:[],queueEditDelivered:[],queueEditFailed:[],queueEditForced:[],queueEditNoCli:[],queueEditNotCleared:[],queueEditNotOnScreen:[],queueEditNothing:[],queueEditUnsupported:[],queueEditWaiting:[],raw:["text"],relaunchCloseFailed:[],remoteDeviceGone:[],remoteFailed:[],remoteHostOnly:[],remoteNotActive:[],remoteOpensOnHost:[],remotePortInvalid:["max","min"],remoteTooManyDevices:["max"],rewindBusy:[],rewindFailed:[],rewindNoCli:[],rewindUnknownMessage:[],rewindUnsupported:[],scheduleEmpty:[],scheduleGone:[],scheduleNoConversation:[],scheduleOff:[],schedulePast:[],scheduleSaveFailed:[],scheduleSending:[],scheduleTooFar:["days"],scheduleTooLong:["max"],scheduleTooMany:["max"],scheduleUnsupported:["label"],scheduledCliNotReady:[],scheduledCliOpenFailed:[],scheduledElsewhereTimeout:[],scheduledMissed:[],scheduledNoTab:[],scheduledUncertain:[],scheduledUncertainWrite:[],scheduledUnconfirmed:[],scheduledWaitAnswer:[],scheduledWaitBusy:[],scheduledWaitElsewhere:[],scheduledWaitGrace:[],scheduledWaitNoTab:[],scheduledWaitOtherInstance:[],searchFailed:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],shellNotFound:[],submitInterrupted:[],submitStartupDialog:["label"],submitStoppedTool:["label"],submitStoppedToolNoLabel:[],submitStoppedWaiting:["label"],submitStoppedWaitingNoLabel:[],tabClosedWhileOpening:[],tabDirGone:[],tabOpenFailed:[],terminalAsleep:[],terminalGone:[],terminalOpenFailed:[],tooManyTabs:["max"],vaultBusyMeasuring:[],vaultBusyMoving:[],vaultBusyWriting:[],vaultCannotWrite:[],vaultCurrentInsideTarget:[],vaultDiskFull:["detail"],vaultFailed:[],vaultIndexNotReady:[],vaultMeasureFirst:[],vaultMemoryFailed:["cwd","detail"],vaultMoveFailed:["detail"],vaultMoving:[],vaultNoCopyYet:[],vaultNotLoaded:[],vaultProjectGone:[],vaultReasonNewerFormat:[],vaultReasonOriginMissing:[],vaultReasonUnsafeId:[],vaultSessionFailed:["agent","detail","session"],vaultSessionMissing:[],vaultTargetCliFolder:[],vaultTargetInsideCurrent:[],vaultTargetNotAbsolute:[],waitingSubmit:["label"],worktreeBaseAdvanced:["base"],worktreeBaseMissing:["base"],worktreeBaseNotOpen:["base"],worktreeBranchExists:["branch"],worktreeBranchInUse:["branch"],worktreeBranchInvalid:["branch"],worktreeBranchMissing:["branch"],worktreeBranchMoved:["branch"],worktreeBranchNotIntegrated:["branch"],worktreeDiffEmpty:[],worktreeDiscardFailed:["detail"],worktreeFailed:[],worktreeFileNotInBranch:[],worktreeFolderExists:["folder"],worktreeGitFailed:["detail"],worktreeInUse:[],worktreeLocalChanges:["count"],worktreeNoConflicts:[],worktreeNoReview:[],worktreeNotRepo:[],worktreeNotesConflict:["count"],worktreeNotesFailed:["detail"],worktreeNothingToCommit:[],worktreeNothingToIntegrate:[],worktreeNothingToReview:[],worktreeProjectUnknown:[],worktreeReviewUnread:[],worktreeUncommitted:["count"],worktreeUnknown:[],worktreeUntrackedChanged:[],worktreeUpToDate:["base"]};function Mw(t){return Object.prototype.hasOwnProperty.call(Rw,t)}function tr(t,e=0){const s=Ne(t);if(s===null)return null;const l=Be(s.key);if(l===null||l.length===0)return null;const u=s.params;if(u===void 0)return{key:l};const y=Ne(u);if(y===null)return null;const b={};for(const[i,a]of Object.entries(y)){if(typeof a=="string"||typeof a=="number"&&Number.isFinite(a)){b[i]=a;continue}const g=e===0?tr(a,e+1):null;if(g===null)return null;b[i]=g}return{key:l,params:b}}function Aw(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){const l=tr(s);if(l===null)return null;e.push(l)}return e}const gr=["claude-code","codex","opencode","antigravity","pi"],Iw=["gemini-cli","antigravity-ide"],Ma=[...gr,...Iw],jw={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Di(t){return gr.includes(t)}const Dw=["at-quoted","bare-path-paste","quoted-path-line"],Pw=["at"],Ow=["usage-with-variants","token-count","usage-with-catalog","status-line"],Bw=["child-session-marker"],Fw=["active","missing","other-command","disabled","unreadable"],Hw=["cli","tools"];function lg(t,e=null){return!t.statusSource||e==="unknown"}const ag={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1,forceSend:!1,editQueue:!1,scheduledSend:!1,readOnlyLaunch:null};function Uw(t,e){var u;const s=t.permissionCycle;if(s===null)return null;const l=e?((u=t.readOnlyLaunch)==null?void 0:u.mode)??null:null;return l!==null&&s.modes.includes(l)?l:s.launchMode}function yd(t){return t.filter(e=>e.available).length>1}function $w(t){const e=Ne(t);if(e===null)return null;const s=e.modes;if(!Array.isArray(s)||s.length===0)return null;const l=[];for(const b of s){if(!Ks(b))return null;l.push(b)}const u=e.launchMode;if(!Ks(u)||!l.includes(u))return null;const y=oe(e.keyLabel);return y===null?null:{modes:l,launchMode:u,keyLabel:y,approvesPendingOnCycle:e.approvesPendingOnCycle===!0}}function Ww(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.guard,Hw),l=e.mode;return s===null||l!==null&&!Ks(l)?null:{mode:l===null?null:l,guard:s}}function Yf(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.state,Fw),l=oe(e.settingsPath),u=oe(e.scriptPath),y=e.fragment,b=y===null?null:oe(y);return s===null||l===null||u===null||y!==null&&b===null?null:{state:s,settingsPath:l,scriptPath:u,fragment:b}}function zw(t){const e=Ne(t);if(e===null)return null;const s=oe(e.value),l=Be(e.label),u=Be(e.family),y=_t(e.long),b=e.window,i=b===null?null:Te(b);return s===null||l===null||u===null||y===null||b!==null&&i===null?null:{value:s,label:l,family:u,long:y,window:i}}function qw(t){const e=Ne(t);if(e===null)return null;const s=oe(e.value),l=Be(e.label);return s===null||l===null?null:{value:s,label:l}}function Xf(t,e){const s=Lt(t,e);return s===null||s.length===0?null:s}function Vw(t){const e=Ne(t);return e===null?{...ag}:{sessionIdAtLaunch:e.sessionIdAtLaunch===!0,resume:e.resume===!0,statusSource:e.statusSource===!0,readySignal:e.readySignal===!0,permissionCycle:$w(e.permissionCycle),models:Xf(e.models,zw),efforts:Xf(e.efforts,qw),questionCards:e.questionCards===!0,imagesByPath:Ve(e.imagesByPath,Dw),fileMentions:Ve(e.fileMentions,Pw),rewind:e.rewind===!0,contextWindowSource:Ve(e.contextWindowSource,Ow),plans:e.plans===!0,waitingBlocksSubmit:e.waitingBlocksSubmit===!0,forceSend:e.forceSend===!0,editQueue:e.editQueue===!0,scheduledSend:e.scheduledSend===!0,readOnlyLaunch:Ww(e.readOnlyLaunch)}}function Qf(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.id,gr),l=Be(e.label),u=Be(e.command),y=Be(e.installUrl);return s===null||l===null||u===null||y===null?null:{id:s,label:l,command:u,available:e.available===!0,version:Be(e.version),installUrl:y,missingMessage:tr(e.missingMessage),capabilities:Vw(e.capabilities),environmentNotice:Ve(e.environmentNotice,Bw),statusLine:Yf(e.statusLine),planLimitsSetup:Yf(e.planLimitsSetup)}}const Kw=["staged","unstaged","untracked","conflict"],cg=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],Gw=["ready","not-a-repo","git-missing","error"],mu={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},Yw=["meta","hunk","context","added","removed"];function Xw(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path),l=Ve(e.kind,cg),u=Ve(e.stage,Kw);return s===null||l===null||u===null?null:{path:s,kind:l,stage:u,oldPath:Be(e.oldPath)}}function Qw(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path);return s===null?null:{path:s,branch:Be(e.branch),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0}}function Jw(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.state,Gw),l=Be(e.repoRoot),u=Te(e.ahead),y=Te(e.behind),b=Lt(e.changes,Xw),i=Lt(e.worktrees,Qw),a=Te(e.updatedAt);return s===null||l===null||u===null||y===null||b===null||i===null||a===null?null:{state:s,message:tr(e.message),repoRoot:l,branch:Be(e.branch),head:Be(e.head),upstream:Be(e.upstream),ahead:u,behind:y,changes:b,worktrees:i,truncated:e.truncated===!0,updatedAt:a}}function Zw(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.kind,Yw),l=Be(e.text);return s===null||l===null?null:{kind:s,text:l,oldLine:Te(e.oldLine),newLine:Te(e.newLine)}}function Jf(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path),l=_t(e.staged),u=Lt(e.lines,Zw);return s===null||l===null||u===null?null:{path:s,staged:l,lines:u,truncated:e.truncated===!0,binary:e.binary===!0,message:tr(e.message)}}const e0=100,t0=/^[A-Za-z0-9._/-]+$/,n0=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function r0(t){if(t.length===0)return"empty";if(t.length>e0)return"too-long";if(!t0.test(t))return"characters";if(t.startsWith("-"))return"starts-with-dash";if(t.startsWith("/")||t.endsWith("/")||t.includes("//"))return"slashes";const e=t.split("/");if(t.includes("..")||t.endsWith(".")||e.some(l=>l.startsWith(".")))return"dots";if(e.some(l=>l.endsWith(".lock")))return"lock";if(t==="HEAD")return"reserved";const s=ug(t).split(".")[0]??"";return n0.test(s)?"reserved":null}function ug(t){return t.split("/").join("-")}const s0=8,i0=["nested-repo","too-many","copied"],o0=2e4,l0=["clean","conflicts"],a0=["ready","changes","none"],c0=["working","pending","done"],u0=["nothing","behind","no-base-folder","local-changes"],d0=["not-integrated","checked-out"];function h0(t,e){const s=b=>b==="cli"?0:b==="tools"?1:2,l=e.filter(b=>b.id!==t),u=l.length>0?l:e;let y=null;for(const b of u)(y===null||s(b.guard)<s(y.guard))&&(y=b);return(y==null?void 0:y.id)??null}function f0(t){return typeof t=="string"&&/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(t)?t:null}function p0(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)?t:null}function m0(t){const e=Ne(t);if(e===null)return null;const s=Te(e.files),l=Te(e.bytes);if(s===null||l===null)return null;if(e.blocked!==null&&e.blocked!==void 0){const y=Ve(e.blocked,i0);return y===null?null:{files:s,bytes:l,stamp:null,blocked:y}}const u=p0(e.stamp);return u===null?null:{files:s,bytes:l,stamp:u,blocked:null}}function g0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.mainCwd),l=_t(e.linked);return s===null||l===null?null:{mainCwd:s,branch:oe(e.branch),linked:l}}function v0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.branch),l=_t(e.exists);return s===null||l===null?null:{branch:s,exists:l,reopenable:e.reopenable===!0}}function Zf(t){const e=Ne(t);if(e===null)return null;const s=Te(e.files),l=Te(e.bytes),u=Yt(e.sample);return s===null||l===null||u===null?null:{files:s,bytes:l,overCap:e.overCap===!0,sample:u}}function _0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.name);return s===null?null:{name:s,checkedOut:e.checkedOut===!0}}function w0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.mainRoot),l=oe(e.parentDir),u=oe(e.separator),y=Lt(e.branches,_0),b=Te(e.mainChanges),i=Zf(e.notes),a=e.include===null?null:Zf(e.include);return s===null||l===null||u===null||y===null||b===null||i===null||e.include!==null&&a===null?null:{mainRoot:s,parentDir:l,separator:u,currentBranch:oe(e.currentBranch),branches:y,mainChanges:b,include:a,notes:i}}function b0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path);if(s===null)return null;const l=e.integrated;return{id:oe(e.id),path:s,branch:oe(e.branch),base:oe(e.base),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0,changes:Te(e.changes),ahead:Te(e.ahead),integrated:typeof l=="boolean"?l:null,behind:Te(e.behind),merge:y0(e.merge),overlaps:zt(e.overlaps,k0)??[],review:dg(e.review)}}function kd(t){const e=Yt(t.files),s=Te(t.fileCount);return e===null||s===null?null:{files:e,fileCount:s}}function y0(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.state,l0),l=kd(e);return s===null||l===null?null:{state:s,...l}}function k0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.branch),l=kd(e);return s===null||l===null?null:{branch:s,...l}}function dg(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,gr),l=Ve(e.state,c0),u=Te(e.requestedAt);return s===null||l===null||u===null?null:{agent:s,state:l,verdict:l==="done"?Ve(e.verdict,a0)??"none":null,stale:e.stale===!0,requestedAt:u,terminalId:oe(e.terminalId)}}function C0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.sha),l=Be(e.subject),u=Te(e.at);return s===null||l===null||u===null?null:{sha:s,subject:l,at:u}}function S0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path),l=Ve(e.kind,cg);return s===null||l===null?null:{path:s,oldPath:oe(e.oldPath),kind:l}}function x0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),y=Lt(e.commits,C0),b=Te(e.commitCount),i=Lt(e.files,S0),a=Te(e.fileCount),g=Te(e.uncommitted);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null?null:{id:s,branch:l,base:u,commits:y,commitCount:b,files:i,fileCount:a,uncommitted:g}}function E0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),y=oe(e.prompt),b=Te(e.ahead),i=Te(e.uncommitted),a=_t(e.branchBusy);return s===null||l===null||u===null||y===null||b===null||i===null||a===null?null:{id:s,branch:l,base:u,author:Ve(e.author,gr),prompt:y,ahead:b,uncommitted:i,branchBusy:a}}function T0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),y=Te(e.ahead),b=Te(e.behind),i=kd(e),a=Lt(e.tabs,hg),g=Yt(e.localConflicts),_=Te(e.branchUncommitted),h=e.blocker,k=h===null?null:Ve(h,u0);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null||_===null||h!==null&&k===null?null:{id:s,branch:l,base:u,baseFolder:oe(e.baseFolder),command:oe(e.command),branchCommit:f0(e.branchCommit),ahead:y,behind:b,...i,review:dg(e.review),tabs:a,localConflicts:g,branchUncommitted:_,blocker:k,notes:L0(e.notes)}}function L0(t){const e=Ne(t);if(e===null)return null;const s=Yt(e.returning),l=Yt(e.conflicts);return s===null||l===null?null:{returning:s,merging:Yt(e.merging)??[],resolved:Yt(e.resolved)??[],conflicts:l}}function N0(t){const e=Ne(t);if(e===null)return null;const s=Te(e.commits),l=oe(e.base);if(s===null||l===null)return null;const u=Ne(e.notes),y=Te(u==null?void 0:u.returned),b=Yt(u==null?void 0:u.stayed);return y===null||b===null?{commits:s,base:l}:{commits:s,base:l,notes:{returned:y,stayed:b}}}function R0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base);return s===null||l===null||u===null?null:{id:s,branch:l,base:u,ahead:Te(e.ahead)}}function M0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.base),y=oe(e.folder),b=oe(e.command),i=e.blocker,a=i===null?null:Ve(i,d0);return s===null||l===null||u===null||y===null||b===null||i!==null&&a===null?null:{id:s,branch:l,base:u,folder:y,command:b,ahead:Te(e.ahead),blocker:a}}const A0=["agent","shell"];function hg(t){const e=Ne(t);if(e===null)return null;const s=oe(e.terminalId),l=Ve(e.kind,A0),u=Be(e.label);return s===null||l===null||u===null?null:{terminalId:s,kind:l,label:u}}const ep=255;function I0(t){var y;const e=Ne(t);if(e===null)return null;const s=Tw(e.pid),l=oe(e.name);if(s===null||l===null||l.length>ep)return null;const u=((y=Be(e.description))==null?void 0:y.trim())??"";return{pid:s,name:l,description:u.length>0&&u.length<=ep?u:null}}function j0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=oe(e.branch),u=oe(e.path),y=Yt(e.commands),b=Yt(e.uncommitted),i=Te(e.uncommittedCount),a=Lt(e.tabs,hg),g=Yt(e.returning),_=Yt(e.conflicts),h=_t(e.deletesBranch);if(s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null||_===null||h===null)return null;const k=typeof e.inUse=="boolean"?e.inUse:null;return{id:s,branch:l,path:u,commands:y,uncommitted:b,uncommittedCount:i,untracked:i>0?m0(e.untracked):null,tabs:a,returning:g,merging:(Yt(e.merging)??[]).filter(T=>g.includes(T)),resolved:Yt(e.resolved)??[],conflicts:_,inUse:k,holders:k===!0?(zt(e.holders,I0)??[]).slice(0,s0):[],deletesBranch:h,branchUnused:h&&e.branchUnused===!0,createdBranch:e.createdBranch!==!1}}function D0(t){const e=Ne(t);if(e===null)return null;const s=_t(e.branchDeleted),l=Te(e.returned),u=Te(e.discarded);return s===null||l===null||u===null?null:{branchDeleted:s,returned:l,discarded:u,discardedFiles:Te(e.discardedFiles)??0}}const P0=["custom","ai","first-message","none"],O0=["native","vault"],B0=["idle","scanning","ready"],F0=["agent","shell"],H0=["busy","idle","waiting","offline","unknown"],U0=["server-closed"];function $0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.sessionId),l=Be(e.title),u=Ve(e.titleSource,P0),y=Te(e.updatedAt),b=Te(e.sizeBytes);if(s===null||l===null||u===null||y===null||b===null)return null;const i=e.agent===void 0?"claude-code":Ve(e.agent,Ma);if(i===null)return null;const a=Be(e.cwd)??"";return{agent:i,sessionId:s,cwd:a,title:l,titleSource:u,updatedAt:y,sizeBytes:b,archived:e.archived===!0,storage:Ve(e.storage,O0)??"native",partial:e.partial===!0,worktree:v0(e.worktree)}}function W0(t){const e=Ne(t);if(e===null)return null;const s=Be(e.cwd),l=_t(e.cwdExists),u=zt(e.sessions,$0),y=Te(e.lastActivityAt);if(s===null||l===null||u===null||y===null)return null;const b=oe(e.key);if(b!==null)return{key:b,fallbackName:Be(e.fallbackName)??"",cwd:s,cwdExists:l,isGitRepo:e.isGitRepo===!0,sessions:u,lastActivityAt:y};const i=oe(e.slug);return i===null?null:{key:i,fallbackName:s.length===0?i:"",cwd:s,cwdExists:l,isGitRepo:!1,sessions:u,lastActivityAt:y}}function z0(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.state,B0),l=Te(e.scannedFiles),u=Te(e.totalFiles);return s===null||l===null||u===null?null:{state:s,scannedFiles:l,totalFiles:u}}function tp(t){const e=Ne(t);if(e===null)return null;const s=oe(e.terminalId),l=Ve(e.kind,F0)??"agent";let u=null;if(l==="agent"&&(u=e.agent===void 0?"claude-code":Ve(e.agent,gr),u===null))return null;const y=Be(e.cwd),b=Be(e.sessionId),i=Be(e.label),a=_t(e.resumed),g=Te(e.createdAt),_=_t(e.alive);if(s===null||y===null||b===null||i===null||a===null||g===null||_===null)return null;const h=e.exitCode;return{terminalId:s,kind:l,agent:u,cwd:y,sessionId:b,label:i,resumed:a,createdAt:g,alive:_,exitCode:typeof h=="number"?h:null,sleeping:e.sleeping===!0,launchedAt:Te(e.launchedAt),worktree:g0(e.worktree),review:l==="agent"&&e.review===!0}}const fg=["user","assistant"];function aa(t){return t.replace(/[`*_]/g,"").replace(/\s+/g," ").trim().toLowerCase()}function q0(t,e){return aa(t.question)===aa(e.question)&&t.multiSelect===e.multiSelect&&t.options.length===e.options.length&&t.options.every((s,l)=>{var b;const u=aa(s.label),y=aa(((b=e.options[l])==null?void 0:b.label)??"");return u.length>0&&y.length>0&&(u.startsWith(y)||y.startsWith(u))})}function V0(t,e){return t>0&&e!==null&&t<e}const pg=["content","attachment","pasted"],K0=["compacted","interrupted","error"],G0=["cli-plans","project","scratch"],Y0=120,X0=20,Q0=20,np=4e3,gu={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},rp=["waiting","live","unavailable","no-transcript"];function J0(t){const e=Ne(t);if(e===null)return null;const s=Te(e.inputTokens),l=Te(e.outputTokens),u=Te(e.cacheCreationInputTokens),y=Te(e.cacheReadInputTokens);return s===null||l===null||u===null||y===null?null:{inputTokens:s,outputTokens:l,cacheCreationInputTokens:u,cacheReadInputTokens:y}}function Z0(t){const e=Ne(t);if(e===null)return null;const s=oe(e.label);return s===null?null:{label:s,description:Be(e.description)??""}}function eb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.question),l=Lt(e.options,Z0);return s===null||l===null||l.length===0?null:{question:s,header:Be(e.header)??"",multiSelect:e.multiSelect===!0,options:l}}function Cd(t){const e=Ne(t);if(e===null)return null;switch(e.kind){case"text":{const s=Be(e.text),l=_t(e.truncated);return s===null||l===null?null:{kind:"text",text:s,truncated:l}}case"tool-call":{const s=Be(e.toolUseId),l=Be(e.name),u=Be(e.input),y=_t(e.truncated);return s===null||l===null||u===null||y===null?null:{kind:"tool-call",toolUseId:s,name:l,input:u,truncated:y}}case"tool-result":{const s=Be(e.toolUseId),l=Be(e.text),u=_t(e.isError),y=_t(e.truncated),b=Te(e.imageCount);return s===null||l===null||u===null||y===null||b===null?null:{kind:"tool-result",toolUseId:s,text:l,isError:u,truncated:y,imageCount:b}}case"thinking":return{kind:"thinking"};case"question":{const s=oe(e.toolUseId),l=Lt(e.questions,eb);return s===null||l===null||l.length===0?null:{kind:"question",toolUseId:s,questions:l}}case"image":{const s=Te(e.index),l=Be(e.mediaType);if(s===null||l===null)return null;const u=Ve(e.source,pg)??"content";return{kind:"image",index:s,mediaType:l,source:u}}case"notice":{const s=Ve(e.notice,K0);return s===null?null:{kind:"notice",notice:s,detail:Be(e.detail)??""}}default:return null}}function vu(t){const e=Ne(t);if(e===null)return null;const s=oe(e.eventId),l=Ve(e.role,fg),u=Te(e.at),y=Lt(e.parts,Cd);return s===null||l===null||u===null||y===null?null:{eventId:s,role:l,at:u,parts:y,model:Be(e.model),usage:J0(e.usage),effort:Be(e.effort),durationMs:Te(e.durationMs),queued:e.queued===!0}}function tb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.toolUseId),l=Be(e.description),u=Te(e.startedAt);return s===null||l===null||u===null?null:{toolUseId:s,description:l.slice(0,Y0),background:e.background===!0,startedAt:u}}function nb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=Be(e.text),u=Te(e.images),y=Te(e.at);if(s===null||l===null||u===null||y===null)return null;const b={id:s,text:l.slice(0,np),truncated:e.truncated===!0||l.length>np,images:Math.max(0,Math.floor(u)),at:y},i=oe(e.eventId);return i!==null&&(b.eventId=i),e.forced===!0&&(b.forced=!0),b}function sp(t){const e=Ne(t);if(e===null)return null;const s=Te(e.lastRequestTokens),l=Te(e.lastOutputTokens),u=Te(e.totalInputTokens),y=Te(e.totalOutputTokens),b=Te(e.totalCacheReadTokens),i=Te(e.assistantMessages);if(s===null||l===null||u===null||y===null||b===null||i===null)return null;const a=Be(e.lastEffort);return{lastRequestTokens:s,lastOutputTokens:l,lastModel:Be(e.lastModel),contextWindow:Te(e.contextWindow),contextWindowEstimated:e.contextWindowEstimated===!0,totalInputTokens:u,totalOutputTokens:y,totalCacheReadTokens:b,assistantMessages:i,...a!==null?{lastEffort:a}:{},...e.compacted===!0?{compacted:!0}:{}}}function rb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.fileName),l=oe(e.title),u=Te(e.modifiedAt),y=Te(e.sizeBytes);if(s===null||l===null||u===null||y===null)return null;const b=e.origin,i=G0.find(g=>g===b)??"cli-plans",a=Be(e.path)??"";return{fileName:s,title:l,origin:i,path:a,absolutePath:Be(e.absolutePath)??"",exists:e.exists===!0,modifiedAt:u,sizeBytes:y}}function sb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.fileName),l=Be(e.text);return s===null||l===null?null:{fileName:s,text:l,truncated:e.truncated===!0}}const mg=[{value:"default",label:"Por defecto",family:"",long:!1,window:null},{value:"opus",label:"Opus",family:"opus",long:!1,window:2e5},{value:"opus[1m]",label:"Opus",family:"opus",long:!0,window:1e6},{value:"sonnet",label:"Sonnet",family:"sonnet",long:!1,window:2e5},{value:"sonnet[1m]",label:"Sonnet",family:"sonnet",long:!0,window:1e6},{value:"haiku",label:"Haiku",family:"haiku",long:!1,window:2e5},{value:"fable",label:"Fable",family:"fable",long:!1,window:2e5},{value:"fable[1m]",label:"Fable",family:"fable",long:!0,window:1e6}];function ib(t){if(t.window===null)return t.label;const e=t.window>=1e6?`${Math.round(t.window/1e6)}M`:`${Math.round(t.window/1e3)}k`;return`${t.label} · ${e}`}function ob(t,e=mg){const s=lb(t,e);if(s===null||t===null)return null;const l=t.includes("[1m]");return e.find(u=>u.family===s&&u.long===l)??null}function lb(t,e=mg){var l;return t===null||t.length===0?null:((l=e.filter(u=>u.family.length>0).sort((u,y)=>y.family.length-u.family.length).find(u=>t.includes(u.family)))==null?void 0:l.family)??null}function ab(t){return`/model ${t}`}const Sd="/effort";function cb(t,e=Sd){return`${e} ${t}`}const ub=["dir","file"],db=["ignored","always"];function hb(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)}function gg(t){const e=Ne(t);if(e===null)return null;const s=oe(e.name),l=oe(e.path),u=Ve(e.kind,ub),y=Te(e.sizeBytes),b=Te(e.modifiedAt);if(s===null||l===null||u===null||y===null||b===null)return null;const i=Ve(e.hidden,db),a={name:s,path:l,kind:u,sizeBytes:y,modifiedAt:b};return i===null?a:{...a,hidden:i}}function fb(t){const e=Ne(t);if(e===null)return null;const s=Be(e.query),l=Lt(e.entries,gg);return s===null||l===null?null:{query:s,entries:l,truncated:e.truncated===!0}}function pb(t){const e=Ne(t);if(e===null)return null;const s=Be(e.path),l=Lt(e.entries,gg),u=Te(e.hiddenCount);return s===null||l===null||u===null?null:{path:s,entries:l,truncated:e.truncated===!0,hiddenCount:u}}function ip(t){const e=Ne(t);if(e===null)return null;const s=oe(e.path),l=Be(e.text),u=Te(e.sizeBytes),y=_t(e.binary);if(s===null||l===null||u===null||y===null)return null;const b={path:s,language:Be(e.language),text:l,sizeBytes:u,truncated:e.truncated===!0,binary:y},i=e.hash;return e.editable===!0&&hb(i)?{...b,editable:!0,hash:i}:b}function mb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.pickerId),l=oe(e.path),u=Lt(e.entries,b=>oe(b)),y=Lt(e.roots,b=>oe(b));return s===null||l===null||u===null||y===null?null:{pickerId:s,path:l,entries:u,roots:y,canGoUp:e.canGoUp===!0,truncated:e.truncated===!0}}const vg=1e6,gb=100,vb=999999;function _g(t){return t.pasted.reduce((e,s)=>e+s.text.length,t.text.length)}function ba(t){return t.text.trim().length===0&&t.pasted.every(e=>e.text.trim().length===0)}function wg(t,e){return t.text!==e.text||t.pasted.length!==e.pasted.length?!1:t.pasted.every((s,l)=>{const u=e.pasted[l];return u!==void 0&&u.number===s.number&&u.text===s.text})}function _b(t){const e=Ne(t);if(e===null)return null;const s=e.number,l=Be(e.text);return typeof s!="number"||!Number.isInteger(s)||s<1||s>vb||l===null?null:{number:s,text:l}}function wb(t){const e=Ne(t);if(e===null)return null;const s=Be(e.text),l=Lt(e.pasted,_b);return s===null||l===null||l.length>gb||new Set(l.map(u=>u.number)).size!==l.length?null:{text:s,pasted:l}}const Gu=720*60*60*1e3,bb=["scheduled","waiting","sending","paused","failed"];function yb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=Ve(e.agent,gr),u=oe(e.sessionId),y=e.terminalId,b=y===null?null:oe(y),i=Be(e.text),a=Te(e.sendAt),g=Te(e.createdAt),_=Ve(e.state,bb),h=e.note,k=h==null?null:tr(h);return s===null||l===null||u===null||i===null||a===null||g===null||_===null||y!==null&&b===null||h!=null&&k===null?null:{id:s,agent:l,sessionId:u,terminalId:b,text:i,sendAt:a,createdAt:g,state:_,note:k}}const ya="MEMORY.md",xd=["AGENTS.md","CLAUDE.md"],bg=["claude-code","codex","antigravity","opencode","pi"],kb=["outside","encoding"],Cb=["create","append-block","replace-block","append-lines","copy"];function Sb(t){return{instructionFiles:[...xd],gitMode:t!==null&&t.git.kind==="error"?"version":"ignore",importNative:t!==null&&t.native.pending>0,copyFromMainWorktree:t!==null&&t.git.kind==="repo"&&t.git.worktree!==null&&t.git.worktree.mainHasMemory}}function xb(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.name,xd),l=_t(e.exists),u=_t(e.hasBlock),y=_t(e.blockCurrent),b=_t(e.brokenBlock),i=e.problem,a=i===null?null:Ve(i,kb);return s===null||l===null||u===null||y===null||b===null||i!==null&&a===null?null:{name:s,exists:l,hasBlock:u,blockCurrent:y,brokenBlock:b,problem:a}}function Eb(t){const e=Ne(t);if(e===null)return null;switch(e.kind){case"not-repo":return{kind:"not-repo"};case"error":{const s=tr(e.message);return s===null?null:{kind:"error",message:s}}case"repo":{const s=_t(e.ignored);if(s===null)return null;if(e.worktree===null)return{kind:"repo",ignored:s,worktree:null};const l=Ne(e.worktree);if(l===null)return null;const u=oe(l.mainPath),y=_t(l.mainHasMemory);return u===null||y===null?null:{kind:"repo",ignored:s,worktree:{mainPath:u,mainHasMemory:y}}}default:return null}}function Tb(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,bg),l=oe(e.label),u=_t(e.reaches),y=tr(e.via);return s===null||l===null||u===null||y===null?null:{agent:s,label:l,reaches:u,via:y}}function Lb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.name),l=Be(e.title),u=Be(e.description),y=Te(e.sizeBytes),b=Te(e.modifiedAt);return s===null||l===null||u===null||y===null||b===null?null:{name:s,title:l,description:u,sizeBytes:y,modifiedAt:b}}const Nb=["line","command","json"];function Rb(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,bg),l=oe(e.label),u=oe(e.target),y=Ve(e.kind,Nb),b=oe(e.text),i=tr(e.note);return s===null||l===null||u===null||y===null||b===null||i===null?null:{agent:s,label:l,target:u,kind:y,text:b,note:i}}function Mb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.cwd),l=_t(e.folderExists),u=_t(e.indexExists),y=_t(e.installed),b=Lt(e.notes,Lb),i=Lt(e.files,xb),a=Eb(e.git),g=Lt(e.reach,Tb),_=Ne(e.native),h=_===null?null:Te(_.available),k=_===null?null:Te(_.pending),T=Lt(e.globalFragments,Rb);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null||h===null||k===null||T===null?null:{cwd:s,folderExists:l,indexExists:u,installed:y,notes:b,files:i,git:a,reach:g,native:{available:h,pending:k},globalFragments:T}}function op(t){const e=Ne(t);if(e===null)return null;const s=oe(e.file),l=Ve(e.action,Cb),u=Be(e.preview),y=Be(e.copiedFrom);return s===null||l===null||u===null?null:{file:s,action:l,preview:u,copiedFrom:y}}function Ab(t){const e=Ne(t);if(e===null)return null;const s=oe(e.name),l=Be(e.text),u=_t(e.truncated);return s===null||l===null||u===null?null:{name:s,text:l,truncated:u}}const lp=20;function Ib(t,e="Nota"){const s=t.text.split(`
|
|
41
|
-
`).map(l=>l.trim()).find(l=>l.length>0);return s===void 0?t.images.length>0?"Imagen":e:s.length>40?`${s.slice(0,40)}…`:s}function jb(t){const e=Ne(t);if(e===null)return null;const s=oe(e.imageId),l=oe(e.mediaType),u=Te(e.bytes);return s===null||l===null||u===null?null:{imageId:s,mediaType:l,bytes:u}}function Db(t){const e=Ne(t);if(e===null)return null;const s=oe(e.noteId),l=Be(e.text),u=Lt(e.images,jb),y=Te(e.createdAt),b=Te(e.updatedAt);return s===null||l===null||u===null?null:{noteId:s,text:l,images:u,createdAt:y??0,updatedAt:b??0}}const zs={fiveHours:300,day:1440,week:10080,month:43200},Pb=8,Ob=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;function Bb(t){const e=Ne(t);if(e===null)return null;const s=e.id;if(typeof s!="string"||!Ob.test(s))return null;const l=Te(e.usedPercent),u=Te(e.observedAt);if(l===null||l<0||u===null||u<=0)return null;const y=e.minutes,b=y===null?null:Te(y);if(y!==null&&(b===null||b<=0))return null;const i=e.resetsAt,a=i===null?null:Te(i);return i!==null&&(a===null||a<=0)?null:{id:s,minutes:b,usedPercent:l,resetsAt:a,observedAt:u}}function Fb(t){var e;return((e=zt(t,Bb))==null?void 0:e.slice(0,Pb))??null}function Hb(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,gr),l=Fb(e.windows);return s===null||l===null?null:{agent:s,windows:l}}function Ub(t,e){return t.filter(s=>s.resetsAt===null||s.resetsAt>e)}const yg=3,$b=3e4,Wb=["results","time"];function Ai(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function jo(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function kg(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,Ma),l=oe(e.sessionId),u=jo(e.cwd,Be),y=Be(e.title),b=jo(e.eventId,oe),i=jo(e.role,k=>Ve(k,fg)),a=jo(e.at,Te),g=Be(e.snippet),_=Ai(e.matchStart),h=Ai(e.matchLength);return s===null||l===null||u===void 0||y===null||b===void 0||i===void 0||a===void 0||g===null||_===null||h===null||_+h>g.length?null:{agent:s,sessionId:l,cwd:u,title:y,eventId:b,role:i,at:a,snippet:g,matchStart:_,matchLength:h}}function zb(t){const e=Ne(t);if(e===null)return null;const s=Be(e.query),l=zt(e.hits,kg),u=Ai(e.sessionsScanned),y=Ai(e.sessionsTotal),b=jo(e.truncated,i=>Ve(i,Wb));return s===null||l===null||u===null||y===null||u>y||b===void 0?null:{query:s,hits:l,sessionsScanned:u,sessionsTotal:y,truncated:b}}function qb(t){const e=Ne(t);if(e===null)return null;const s=Be(e.query),l=zt(e.hits,kg),u=Ai(e.sessionsScanned),y=Ai(e.sessionsTotal);return s===null||l===null||u===null||y===null||u>y?null:{query:s,hits:l,sessionsScanned:u,sessionsTotal:y}}const Vb=["off","idle","measuring","writing","moving"];function gn(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function No(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function Kb(t){const e=Ne(t);if(e===null)return null;const s=Ve(e.agent,Ma),l=gn(e.sessions),u=gn(e.eventBytes),y=gn(e.images),b=gn(e.imageBytes),i=gn(e.skippedArchived),a=gn(e.skippedEmpty),g=gn(e.unsupported),_=gn(e.failed),h=Aw(e.failureReasons);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null||_===null||h===null?null:{agent:s,sessions:l,eventBytes:u,images:y,imageBytes:b,skippedArchived:i,skippedEmpty:a,unsupported:g,failed:_,failureReasons:h}}function Gb(t){const e=Ne(t);if(e===null)return null;const s=Te(e.measuredAt),l=Te(e.durationMs),u=zt(e.byAgent,Kb),y=gn(e.memoryProjects),b=gn(e.memoryBytes);return s===null||l===null||u===null||y===null||b===null?null:{measuredAt:s,durationMs:l,byAgent:u,memoryProjects:y,memoryBytes:b}}function Yb(t){const e=Ne(t);if(e===null)return null;const s=gn(e.done),l=gn(e.total);return s===null||l===null?null:{done:s,total:l}}function Xb(t){const e=Ne(t);if(e===null)return null;const s=_t(e.enabled),l=Be(e.dir),u=_t(e.isDefaultDir),y=Ve(e.state,Vb),b=gn(e.sessions),i=gn(e.passSessions),a=gn(e.bytes),g=gn(e.pending),_=No(e.progress,Yb),h=No(e.lastPassAt,Te),k=No(e.measurement,Gb),T=No(e.previousDir,Be),M=No(e.lastError,tr);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null||_===void 0||h===void 0||k===void 0||T===void 0||M===void 0?null:{enabled:s,dir:l,isDefaultDir:u,state:y,progress:_,sessions:b,passSessions:i,bytes:a,lastPassAt:h,pending:g,measurement:k,previousDir:T,lastError:M}}const Cg=1024,Sg=65535,Qb="pair",Jb=4001;function Zb(t){return typeof t=="number"&&Number.isInteger(t)&&t>=Cg&&t<=Sg}const ey=["off","active","restart-needed","port-busy"];function ty(t){const e=Ne(t);if(e===null)return null;const s=oe(e.id),l=Be(e.label),u=Te(e.createdAt),y=_t(e.connected);if(s===null||l===null||u===null||y===null)return null;const b=e.lastSeenAt,i=b==null?null:Te(b);return b!=null&&i===null?null:{id:s,label:l,createdAt:u,lastSeenAt:i,connected:y}}function ny(t){const e=Ne(t);if(e===null)return null;const s=_t(e.enabled),l=Te(e.port),u=Ve(e.state,ey),y=Te(e.listeningPort),b=Be(e.sshUser),i=Yt(e.hostNames),a=_t(e.pairingActive),g=Lt(e.devices,ty);return s===null||l===null||u===null||y===null||b===null||i===null||a===null||g===null?null:{enabled:s,port:l,state:u,listeningPort:y,sshUser:b,hostNames:i,pairingActive:a,devices:g}}function ry(t){const e=Ne(t);if(e===null)return null;const s=oe(e.code),l=Te(e.expiresAt);return s===null||l===null?null:{code:s,expiresAt:l}}const sy=["powershell-admin","powershell","terminal"];function iy(t){const e=Ne(t);if(e===null)return null;const s=oe(e.payload),l=oe(e.authorizeCommand),u=Ve(e.shell,sy),y=oe(e.code),b=Te(e.expiresAt);return s===null||l===null||u===null||y===null||b===null?null:{payload:s,authorizeCommand:l,shell:u,code:y,expiresAt:b}}const oy=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function xg(t){return Ve(t,oy)}function ly(t){const e=Ne(t);if(e===null)return null;const s=xg(e.id),l=oe(e.label);return s===null||s==="auto"||l===null?null:{id:s,label:l}}function ap(t){return Array.isArray(t)?[...new Set(t.filter(e=>typeof e=="string"&&Di(e)))]:null}function ay(t){const e=Ne(t);if(e===null)return null;const s=xg(e.consoleShell),l=zt(e.consoleShells,ly),u=e.shellName,y=u===null?null:oe(u),b=ap(e.disabledAgents),i=ap(e.disabledAtStart);if(s===null||l===null||b===null||i===null||u!==null&&y===null)return null;const a=e.scheduledMessages===!0;return{consoleShell:s,consoleShells:l,shellName:y,disabledAgents:b,disabledAtStart:i,scheduledMessages:a}}const Ri=8,cy="/ws",Yu="token",qs=12*1024*1024,Ro=8,cp=10*1024*1024,_u=4,up=100,uy=512,dy=["saved","changed"],hy=["sending","prefilled"],fy=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound","requested","queue-edit","unscheduled"],py=["cli-not-found","shell-not-found","spawn-failed","bad-message","unknown-terminal","terminal-asleep","invalid-cwd","too-many-terminals","invalid-path","read-failed","submit-failed","answer-failed","mode-failed","archive-failed","notes-failed","picker-failed","memory-failed","vault-failed","continue-failed","search-failed","remote-failed","settings-failed","rewind-failed","force-send-failed","queue-edit-failed","write-failed","worktree-failed","schedule-failed","remote-refused","agent-unsupported","internal"];function my(t){const e={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return e;const s=t;return{model:oe(s.model),effort:oe(s.effort),contextWindow:Te(s.contextWindow)}}function gy(t){const e=Ne(t);if(e===null)return null;const s=oe(e.terminalId),l=wb(e.draft);return s===null||l===null?null:{terminalId:s,draft:l}}function dp(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function ca(t,e){const s=oe(e.requestId);return s!==null&&(t.requestId=s),t}function hp(t){var e;return((e=zt(t,tb))==null?void 0:e.slice(0,X0))??null}function wu(t){var e;return((e=zt(t,nb))==null?void 0:e.slice(0,Q0))??null}function fp(t){const e=Cd(t);return e!==null&&e.kind==="question"?e:null}function vy(t){const e=Ne(Lw(t));if(e===null)return null;switch(e.type){case"hello":{const s=Te(e.protocolVersion),l=Be(e.platform),u=Be(e.defaultCwd);return s===null||l===null||u===null?null:{type:"hello",protocolVersion:s,agents:zt(e.agents,Qf)??[],defaultAgent:Ve(e.defaultAgent,gr),platform:l,defaultCwd:u,shellName:oe(e.shellName),remoteClient:e.remoteClient===!0,fileCheck:e.fileCheck===!0,fileWrite:e.fileWrite===!0}}case"agents":{const s=zt(e.agents,Qf);return s===null?null:{type:"agents",agents:s,defaultAgent:Ve(e.defaultAgent,gr)}}case"terminal.list":{const s=zt(e.terminals,tp),l=Yt(e.order);return s===null||l===null?null:{type:"terminal.list",terminals:s,order:l}}case"terminal.opened":{const s=oe(e.requestId),l=tp(e.terminal);return s===null||l===null?null:{type:"terminal.opened",requestId:s,terminal:l}}case"terminal.output":{const s=oe(e.terminalId),l=Be(e.data);return s===null||l===null?null:{type:"terminal.output",terminalId:s,data:l}}case"terminal.replay":{const s=oe(e.terminalId),l=Be(e.data);return s===null||l===null?null:{type:"terminal.replay",terminalId:s,data:l,truncated:e.truncated===!0}}case"terminal.exit":{const s=oe(e.terminalId),l=Te(e.exitCode);if(s===null||l===null)return null;const u=e.signal;return{type:"terminal.exit",terminalId:s,exitCode:l,signal:typeof u=="number"?u:null}}case"terminal.closed":{const s=oe(e.terminalId);return s===null?null:{type:"terminal.closed",terminalId:s}}case"terminal.activity":{const s=oe(e.terminalId),l=Ve(e.activity,H0);if(s===null||l===null)return null;const u=l==="offline"?Ve(e.offlineReason,U0):null;return u===null?{type:"terminal.activity",terminalId:s,activity:l}:{type:"terminal.activity",terminalId:s,activity:l,offlineReason:u}}case"index.status":{const s=z0(e.status);return s===null?null:{type:"index.status",status:s}}case"index.projects":{const s=zt(e.projects,W0);return s===null?null:{type:"index.projects",projects:s,replace:e.replace===!0}}case"conversation.reset":{const s=oe(e.terminalId),l=Be(e.sessionId),u=Ve(e.state,rp),y=zt(e.events,vu),b=sp(e.usage);return s===null||l===null||u===null||y===null||b===null?null:{type:"conversation.reset",terminalId:s,sessionId:l,state:u,events:y,hasMore:e.hasMore===!0,usage:b,permissionMode:Ks(e.permissionMode)?e.permissionMode:null,defaults:my(e.defaults),waitingFor:oe(e.waitingFor),openToolCall:e.openToolCall===!0,subagents:hp(e.subagents)??[],queue:wu(e.queue)??[],liveQuestion:fp(e.liveQuestion)}}case"conversation.liveQuestion":{const s=oe(e.terminalId),l=e.question===null?null:fp(e.question);return s===null||e.question!==null&&l===null?null:{type:"conversation.liveQuestion",terminalId:s,question:l}}case"conversation.subagents":{const s=oe(e.terminalId),l=hp(e.subagents);return s===null||l===null?null:{type:"conversation.subagents",terminalId:s,subagents:l}}case"conversation.queue":{const s=oe(e.terminalId),l=wu(e.queue);return s===null||l===null?null:{type:"conversation.queue",terminalId:s,queue:l}}case"agent.forceSent":{const s=oe(e.terminalId),l=oe(e.requestId),u=_t(e.sent);return s===null||l===null||u===null?null:{type:"agent.forceSent",terminalId:s,requestId:l,sent:u}}case"agent.queueEdited":{const s=oe(e.terminalId),l=oe(e.requestId),u=_t(e.edited);return s===null||l===null||u===null?null:{type:"agent.queueEdited",terminalId:s,requestId:l,edited:u}}case"agent.submitted":{const s=oe(e.terminalId),l=oe(e.requestId),u=_t(e.delivered);return s===null||l===null||u===null?null:{type:"agent.submitted",terminalId:s,requestId:l,delivered:u}}case"agent.rewound":{const s=oe(e.terminalId),l=oe(e.requestId),u=_t(e.codeRestored);return s===null||l===null||u===null?null:{type:"agent.rewound",terminalId:s,requestId:l,codeRestored:u}}case"conversation.append":{const s=oe(e.terminalId),l=zt(e.events,vu),u=sp(e.usage);if(s===null||l===null||u===null)return null;const y={type:"conversation.append",terminalId:s,events:l,usage:u,permissionMode:Ks(e.permissionMode)?e.permissionMode:null},b=wu(e.queue);return b!==null&&(y.queue=b),y}case"conversation.mode":{const s=oe(e.terminalId),l=e.mode;return s===null||!Ks(l)?null:{type:"conversation.mode",terminalId:s,mode:l}}case"conversation.waiting":{const s=oe(e.terminalId);return s===null?null:{type:"conversation.waiting",terminalId:s,waitingFor:oe(e.waitingFor)}}case"conversation.toolCall":{const s=oe(e.terminalId),l=_t(e.open);return s===null||l===null?null:{type:"conversation.toolCall",terminalId:s,open:l}}case"conversation.page":{const s=oe(e.terminalId),l=zt(e.events,vu);return s===null||l===null?null:{type:"conversation.page",terminalId:s,events:l,hasMore:e.hasMore===!0}}case"conversation.turns":{const s=oe(e.terminalId),l=Lt(e.turns,u=>{const y=Ne(u);if(y===null)return null;const b=oe(y.eventId),i=Te(y.durationMs);return b===null||i===null?null:{eventId:b,durationMs:i}});return s===null||l===null?null:{type:"conversation.turns",terminalId:s,turns:l}}case"conversation.parts":{const s=oe(e.terminalId),l=Lt(e.updates,u=>{const y=Ne(u);if(y===null)return null;const b=oe(y.eventId),i=Lt(y.parts,Cd);return b===null||i===null?null:{eventId:b,parts:i}});return s===null||l===null?null:{type:"conversation.parts",terminalId:s,updates:l}}case"conversation.imageData":{const s=oe(e.terminalId),l=oe(e.eventId),u=Te(e.index),y=Be(e.mediaType);if(s===null||l===null||u===null||y===null)return null;const b=e.data;return{type:"conversation.imageData",terminalId:s,eventId:l,index:u,source:Ve(e.source,pg)??"content",mediaType:y,data:typeof b=="string"?b:null}}case"conversation.state":{const s=oe(e.terminalId),l=Ve(e.state,rp);return s===null||l===null?null:{type:"conversation.state",terminalId:s,state:l}}case"git.status":{const s=oe(e.terminalId),l=Jw(e.status);return s===null||l===null?null:{type:"git.status",terminalId:s,status:l}}case"git.diff":{const s=oe(e.terminalId),l=Jf(e.diff);return s===null||l===null?null:{type:"git.diff",terminalId:s,diff:l}}case"files.listing":{const s=oe(e.terminalId),l=pb(e.listing);return s===null||l===null?null:{type:"files.listing",terminalId:s,listing:l}}case"picker.listing":{const s=mb(e.listing);return s===null?null:{type:"picker.listing",listing:s}}case"files.preview":{const s=oe(e.terminalId),l=ip(e.preview);return s===null||l===null?null:{type:"files.preview",terminalId:s,preview:l}}case"files.checked":{const s=oe(e.terminalId),l=oe(e.requestId),u=Yt(e.existing),y=Yt(e.directories)??[];return s===null||l===null||u===null?null:{type:"files.checked",terminalId:s,requestId:l,existing:u,directories:y}}case"files.saved":{const s=oe(e.terminalId),l=oe(e.requestId),u=oe(e.path),y=Ve(e.outcome,dy),b=e.preview===null?null:ip(e.preview);return s===null||l===null||u===null||y===null||b===null&&(y==="saved"||e.preview!==null)?null:{type:"files.saved",terminalId:s,requestId:l,path:u,outcome:y,preview:b}}case"conversation.plans":{const s=oe(e.terminalId),l=Lt(e.plans,rb);return s===null||l===null?null:{type:"conversation.plans",terminalId:s,plans:l}}case"plans.content":{const s=oe(e.terminalId),l=sb(e.plan);return s===null||l===null?null:{type:"plans.content",terminalId:s,plan:l}}case"files.results":{const s=oe(e.terminalId),l=fb(e.result);return s===null||l===null?null:{type:"files.results",terminalId:s,result:l}}case"notes.list":{const s=Lt(e.notes,Db);return s===null?null:{type:"notes.list",notes:s}}case"notes.imageData":{const s=oe(e.imageId),l=Be(e.mediaType);if(s===null||l===null)return null;const u=e.data;return{type:"notes.imageData",imageId:s,mediaType:l,data:typeof u=="string"?u:null}}case"memory.status":{const s=oe(e.terminalId),l=Mb(e.status);return s===null||l===null?null:{type:"memory.status",terminalId:s,status:l}}case"memory.planned":{const s=oe(e.terminalId),l=Lt(e.changes,op);return s===null||l===null?null:ca({type:"memory.planned",terminalId:s,changes:l},e)}case"memory.installed":{const s=oe(e.terminalId),l=Lt(e.applied,op);return s===null||l===null?null:ca({type:"memory.installed",terminalId:s,applied:l},e)}case"memory.imported":{const s=oe(e.terminalId),l=Yt(e.copied),u=Yt(e.skipped);return s===null||l===null||u===null?null:ca({type:"memory.imported",terminalId:s,copied:l,skipped:u},e)}case"memory.content":{const s=oe(e.terminalId),l=Ab(e.note);return s===null||l===null?null:ca({type:"memory.content",terminalId:s,note:l},e)}case"vault.status":{const s=Xb(e.status);return s===null?null:{type:"vault.status",status:s}}case"vault.exported":{const s=oe(e.projectKey),l=Te(e.sessions);return s===null||l===null?null:{type:"vault.exported",projectKey:s,sessions:l}}case"session.continued":{const s=oe(e.requestId),l=oe(e.terminalId),u=Ne(e.source),y=Ve(u==null?void 0:u.agent,Ma),b=oe(u==null?void 0:u.sessionId),i=Be(u==null?void 0:u.title),a=dp(e.includedTurns),g=dp(e.totalTurns),_=Ve(e.delivery,hy);return s===null||l===null||y===null||b===null||i===null||a===null||g===null||a>g||_===null?null:{type:"session.continued",requestId:s,terminalId:l,source:{agent:y,sessionId:b,title:i},includedTurns:a,totalTurns:g,totalTurnsIsMinimum:e.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const s=oe(e.terminalId),l=oe(e.text),u=Ve(e.reason,fy);if(s===null||l===null||u===null)return null;const y={type:"composer.prefill",terminalId:s,text:l,reason:u};if(e.pasted!==void 0){const i=Yt(e.pasted);if(i===null)return null;i.length>0&&(y.pasted=i)}const b=oe(e.requestId);return b!==null&&(y.requestId=b),y}case"composer.drafts":{const s=zt(e.drafts,gy);return s===null?null:{type:"composer.drafts",drafts:s}}case"search.progress":{const s=oe(e.searchId),l=qb(e.progress);return s===null||l===null?null:{type:"search.progress",searchId:s,progress:l}}case"remote.status":{const s=ny(e.status);return s===null?null:{type:"remote.status",status:s}}case"settings.status":{const s=ay(e.settings);return s===null?null:{type:"settings.status",settings:s}}case"schedule.list":{const s=zt(e.messages,yb);return s===null?null:{type:"schedule.list",messages:s}}case"schedule.created":{const s=oe(e.requestId),l=oe(e.id);return s===null||l===null?null:{type:"schedule.created",requestId:s,id:l}}case"plan.limits":{const s=zt(e.limits,Hb);return s===null?null:{type:"plan.limits",limits:s}}case"remote.pairing.code":{const s=ry(e.pairing);return s===null?null:{type:"remote.pairing.code",pairing:s}}case"remote.phone.pairing":{const s=iy(e.pairing);return s===null?null:{type:"remote.phone.pairing",pairing:s}}case"search.results":{const s=oe(e.searchId),l=zb(e.result);return s===null||l===null?null:{type:"search.results",searchId:s,result:l}}case"worktree.inspected":{const s=oe(e.requestId),l=w0(e.inspection);return s===null||l===null?null:{type:"worktree.inspected",requestId:s,inspection:l}}case"worktree.rows":{const s=oe(e.terminalId),l=zt(e.rows,b0);if(s===null||l===null)return null;const u=zt(e.kept,R0);return u===null?{type:"worktree.rows",terminalId:s,rows:l}:{type:"worktree.rows",terminalId:s,rows:l,kept:u}}case"worktree.removePlan":{const s=oe(e.requestId),l=j0(e.plan);return s===null||l===null?null:{type:"worktree.removePlan",requestId:s,plan:l}}case"worktree.removed":{const s=oe(e.requestId),l=oe(e.worktreeId),u=D0(e.outcome);return s===null||l===null||u===null?null:{type:"worktree.removed",requestId:s,worktreeId:l,outcome:u}}case"worktree.changed":return{type:"worktree.changed"};case"worktree.branchChanges":{const s=oe(e.requestId),l=x0(e.changes);return s===null||l===null?null:{type:"worktree.branchChanges",requestId:s,changes:l}}case"worktree.branchDiff":{const s=oe(e.requestId),l=oe(e.worktreeId),u=Jf(e.diff);return s===null||l===null||u===null?null:{type:"worktree.branchDiff",requestId:s,worktreeId:l,diff:u}}case"worktree.reviewPlan":{const s=oe(e.requestId),l=E0(e.plan);return s===null||l===null?null:{type:"worktree.reviewPlan",requestId:s,plan:l}}case"worktree.integratePlan":{const s=oe(e.requestId),l=T0(e.plan);return s===null||l===null?null:{type:"worktree.integratePlan",requestId:s,plan:l}}case"worktree.integrated":{const s=oe(e.requestId),l=oe(e.worktreeId),u=N0(e.outcome);return s===null||l===null||u===null?null:{type:"worktree.integrated",requestId:s,worktreeId:l,outcome:u}}case"worktree.deleteBranchPlan":{const s=oe(e.requestId),l=M0(e.plan);return s===null||l===null?null:{type:"worktree.deleteBranchPlan",requestId:s,plan:l}}case"worktree.branchDeleted":{const s=oe(e.requestId),l=oe(e.worktreeId),u=oe(e.branch);return s===null||l===null||u===null?null:{type:"worktree.branchDeleted",requestId:s,worktreeId:l,branch:u}}case"error":{const s=tr(e.text);if(s===null)return null;const u={type:"error",code:Ve(e.code,py)??"internal",text:s},y=Be(e.detail);y!==null&&(u.detail=y);const b=oe(e.requestId);return b!==null&&(u.requestId=b),u}default:return null}}function pp(t){return JSON.stringify(t)}const _y=/^[A-Za-z]:\\$/;function vr(t,e){return t.length===0?"":e==="win32"?wy(t):by(t)}function wy(t){let e=t.replace(/\//g,"\\");for(e.startsWith("\\\\?\\UNC\\")?e=`\\\\${e.slice(8)}`:e.startsWith("\\\\?\\")&&(e=e.slice(4)),e=e.startsWith("\\\\")?`\\\\${e.slice(2).replace(/\\+/g,"\\")}`:e.replace(/\\+/g,"\\");e.endsWith("\\")&&!_y.test(e);)e=e.slice(0,-1);return e.toLowerCase()}function Eg(t,e,s){return t.length===0||s==="win32"&&t!==e&&t.toLowerCase()===e.toLowerCase()?e:t}function by(t){let e=t.replace(/\/+/g,"/");for(;e.length>1&&e.endsWith("/");)e=e.slice(0,-1);return e}function Xu(t){var e;return((e=t.worktree)==null?void 0:e.mainCwd)??t.cwd}function yy(t,e,s,l){if(s.kind!=="agent")return t.length;const u=vr(Xu(s),l);let y=-1;for(const[b,i]of t.entries()){const a=e(i);a===void 0||a.kind!=="agent"||vr(Xu(a),l)===u&&(y=b)}return y===-1?t.length:y+1}function Ed(t){return`[Pasted text #${t}]`}function ky(t){return`[Start of pasted text #${t}]`}function Cy(t){return`[End of pasted text #${t}]`}function Sy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function xy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function Ey(){return/\[Pasted text #(\d{1,6})\]/g}const Tg="https://buymeacoffee.com/cvelasquez",Ty="modulepreload",Ly=function(t){return"/"+t},mp={},pr=function(e,s,l){let u=Promise.resolve();if(s&&s.length>0){let b=function(g){return Promise.all(g.map(_=>Promise.resolve(_).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));u=b(s.map(g=>{if(g=Ly(g),g in mp)return;mp[g]=!0;const _=g.endsWith(".css"),h=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${h}`))return;const k=document.createElement("link");if(k.rel=_?"stylesheet":Ty,_||(k.as="script"),k.crossOrigin="",k.href=g,a&&k.setAttribute("nonce",a),document.head.appendChild(k),_)return new Promise((T,M)=>{k.addEventListener("load",T),k.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${g}`)))})}))}function y(b){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=b,window.dispatchEvent(i),!i.defaultPrevented)throw b}return u.then(b=>{for(const i of b||[])i.status==="rejected"&&y(i.reason);return e().catch(y)})},Ny={"agent.composer.imagesRefused":"This CLI doesn't take images from the message box.","agent.continue.discovering":"The session isn't in the history yet: it shows up with the first message.","agent.continue.noConversation":"This tab doesn't have a conversation to continue yet.","agent.continue.noMessages":"This conversation doesn't have any messages to continue yet.","agent.continue.title":"Continue this conversation with another CLI","agent.continue.titleMain":"Continue this conversation in the main folder","agent.dot.idle":"Ready, nothing in progress","agent.dot.noStatus":"This CLI doesn't publish its status","agent.dot.open":"CLI open","agent.dot.statusLineOnly":"This CLI only publishes its status with the status line configured","agent.dot.statusLinePending":"The status line hasn't published this conversation's status yet","agent.handoff.notice":"Continued from {{label}}: the agent starts from a transcript of {{turns}}, not from the context it had. Tool results are trimmed and images don't carry over.","agent.handoff.prefill.noDelivery":"The message is in the message box: check it and send it with Enter.","agent.handoff.prefill.notReady":"The CLI wasn't ready in time: the message is in the message box for you to send.","agent.handoff.prefill.sendFailed":"It couldn't be sent automatically: the message is in the message box for you to send.","agent.handoff.sending":"Sending the continuation…","agent.handoff.tabLabel":"Continued: {{title}}","agent.handoff.tabLabelNoTitle":"Continued","agent.handoff.turns.all_one":"the {{count}} turn","agent.handoff.turns.all_other":"the {{count}} turns","agent.handoff.turns.lastManyOfMore_one":"the last {{included}} of more than {{count}} turn","agent.handoff.turns.lastManyOfMore_other":"the last {{included}} of more than {{count}} turns","agent.handoff.turns.lastMany_one":"the last {{included}} of {{count}} turn","agent.handoff.turns.lastMany_other":"the last {{included}} of {{count}} turns","agent.handoff.turns.lastOne":"the last turn of {{total}}","agent.handoff.turns.lastOneOfMore":"the last turn of more than {{total}}","agent.handoff.turns.single":"the only turn","agent.meter.idle.compacted":"The context was compacted after the last measured response. The new size shows up with the next response.","agent.meter.idle.noFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and the project's instructions file already take up context, and the real number shows up with the first response.","agent.meter.idle.statusLine":"The status line hasn't published tokens for this conversation yet. It doesn't start at zero: the number shows up when the CLI runs it, with the first message or when the session resumes.","agent.meter.idle.withFile":"The session hasn't measured any response yet. It doesn't start at zero: the system prompt, the tools and {{file}} already take up context, and the real number shows up with the first response.","agent.meter.origin.catalog":"limit from the CLI's model catalog","agent.meter.origin.estimated":"limit inferred from the measured tokens","agent.meter.setup.disabled":"This CLI only publishes its tokens through its status line, and the app's status line is disabled. Configure explains how.","agent.meter.setup.missing":"This CLI only publishes its tokens through its status line, and it isn't configured yet. Configure explains how.","agent.meter.setup.otherCommand":"This CLI only publishes its tokens through its status line, and you have another status line configured. Configure explains how.","agent.meter.setup.unreadable":"This CLI only publishes its tokens through its status line, and its settings.json couldn't be read. Configure explains how.","agent.mode.blocked":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","agent.mode.title":"{{mode}} mode: {{hint}}. Changing it sends {{key}} to the CLI tab","agent.mode.titleBlind":"{{title}}. Without status line data the app can't tell whether a confirmation is pending; changing the mode at that moment approves it","agent.note.empty":"The note is empty","agent.note.needsTab":"Open a tab first: the conversation opens in its project","agent.note.noReadySignal":"This tab's CLI doesn't say when it's ready, so the note can't be sent","agent.note.send":"Send the note to the agent in a new conversation in {{cwd}}","agent.openBlocked":"Opening a tab in this project…","agent.openTool.noLabel":"The CLI has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.openTool.withLabel":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","agent.queueReturned.noLabel":"The CLI didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.queueReturned.withLabel":"{{label}} didn't get to deliver the message you sent while it was working: the interrupt came first. It's back in the message box, unsent.","agent.serverClosed.noLabel":"The CLI server closed and this tab lost its connection.","agent.serverClosed.relaunch":"Relaunch","agent.serverClosed.relaunching":"Relaunching…","agent.serverClosed.withLabel":"The {{label}} server closed and this tab lost its connection.","agent.session.cliMissing":"{{label}} isn't installed.","agent.shortcuts.antigravity.answerPermission":"Answer a permission request: 1 allows it, 4 rejects it","agent.shortcuts.antigravity.cycleMode":"Change the mode: accept-edits, plan and default (with focus on the terminal)","agent.shortcuts.antigravity.help":"Show the CLI's shortcuts","agent.shortcuts.antigravity.interrupt":"Interrupt the current turn, or cancel a permission request","agent.shortcuts.claudeCode.cancel":"Cancel","agent.shortcuts.claudeCode.cycleMode":"Change the permission mode (with focus on the terminal)","agent.shortcuts.claudeCode.fullOutput":"Show the full output","agent.shortcuts.claudeCode.pasteImage":"Paste an image from the clipboard","agent.shortcuts.claudeCode.pasteText":"Paste text from the clipboard","agent.shortcuts.claudeCode.rewind":"Open the rewind menu","agent.shortcuts.claudeCode.searchHistory":"Search the command history","agent.shortcuts.codex.cycleMode":"Switch between the default mode and Plan (with focus on the terminal)","agent.shortcuts.codex.editPrevious":"Edit a previous message","agent.shortcuts.codex.effort":"Lower / raise the effort","agent.shortcuts.codex.externalEditor":"Edit the message in the external editor","agent.shortcuts.codex.interruptOrExit":"Interrupt, or exit if there's no turn","agent.shortcuts.codex.interruptTurn":"Interrupt the current turn","agent.shortcuts.codex.mention":"Mention a file, a skill or a plugin","agent.shortcuts.codex.note":"Alt + ← / → switch agents inside Codex, but here the app uses them to switch tabs.","agent.shortcuts.codex.queue":"Queue the message while the agent works","agent.shortcuts.codex.searchHistory":"Search the message history","agent.shortcuts.codex.transcript":"Show the transcript","agent.shortcuts.commands":"Commands","agent.shortcuts.composer.newline":"New line without sending","agent.shortcuts.composer.pasteText":"Paste text","agent.shortcuts.composer.pasteWithImages":"Paste text or an image (it stays as a thumbnail)","agent.shortcuts.composer.send":"Send the message","agent.shortcuts.interruptCli":"Interrupt whatever the CLI is doing","agent.shortcuts.leaderThen":"Ctrl + X, then {{key}}","agent.shortcuts.opencode.clearInput":"Clear the input; twice, exit","agent.shortcuts.opencode.commandList":"Command list, with the model variants","agent.shortcuts.opencode.cycleAgent":"Switch agent, build or plan (with focus on the terminal)","agent.shortcuts.opencode.interrupt":"Interrupt (the first press only warns)","agent.shortcuts.opencode.model":"Choose a model","agent.shortcuts.opencode.newSession":"New session: the tab stays tied to the session it was opened with","agent.shortcuts.opencode.newline":"New line","agent.shortcuts.opencode.note":"Ctrl + T switches the model variant inside OpenCode, but the browser keeps it for itself: it's under Ctrl + P.","agent.shortcuts.opencode.paste":"Paste","agent.shortcuts.pi.bash":"Run a shell command","agent.shortcuts.pi.clearOrExit":"Clear the editor; twice, exit","agent.shortcuts.pi.cycleThinking":"Change the thinking level (with focus on the terminal)","agent.shortcuts.pi.model":"Choose a model","agent.shortcuts.pi.newline":"New line","agent.shortcuts.pi.nextModel":"Switch to the next model","agent.shortcuts.pi.toolOutput":"Collapse or expand tool output","agent.shortcuts.pi.tree":"With the editor empty: open the session tree","agent.statusLine.noFragment":"The app's folder has characters the console interprets (such as & % ! or quotes), and with them there's no line the CLI can run: on Windows it runs it with cmd /c and no quote gets through. Moving the configuration folder to a path without those characters fixes it.","agent.statusLine.state.active":"Configured","agent.statusLine.state.disabled":"Disabled (enabled: false)","agent.statusLine.state.missing":"Not configured","agent.statusLine.state.otherCommand":"You have another status line: pasting this one replaces it","agent.statusLine.state.unreadable":"Couldn't read settings.json","agent.stoppedEarly":"You stopped it before the agent started: the message is back in the message box so you can fix it.","agent.thread.discovering":"The session shows up in the history with the first message.","agent.thread.noTranscript":"This conversation comes from a CLI version that didn't leave a readable transcript. It can be resumed from the sidebar, but there's nothing to show here.","agent.waiting.answer":"The CLI is waiting for an answer from you.","agent.waiting.permission":"The CLI is waiting for you to authorize a tool.","agent.waiting.question":"The agent asked you a question: answer it in the thread.","agentMenu.chooseTitle":"Choose which CLI to open with","agentMenu.openWith":"Open with","agentMenu.titleWithAgent":"{{title}} — with {{label}}","app.banner.revoked":"This device's access was revoked, or remote access was turned off. To come back, pair it again from the computer running Agent Workbench.","app.divider.consoleHeight":"Drag to change the console's height","app.divider.width":"Drag to change the width","app.empty.hint":"Pick a project on the left, or open a session from the history to resume it.","app.empty.newSession":"New session in {{cwd}}","app.empty.noTabs":"No open tabs.","app.empty.opening":"Opening…","app.header.cliVersion":"CLI {{version}}","app.header.remoteAccess":"Remote access","app.header.remoteBadge":"Remote","app.header.remoteBadgeTitle":"This window is connected from a paired device. Managing remote access, and anything that opens a file with the apps of the computer running Agent Workbench, is only available on that computer.","app.header.shortcuts":"Show keyboard shortcuts","app.markerNotice":"This server was started from inside a CLI session. The <code>{{variable}}</code> variable was removed from the tabs' environment: it turns off history saving, and without that there would be no conversation or context meter. The rest of the environment is left untouched.","app.panel.name":"Panel","app.panel.show":"Show the right panel (Alt+P)","app.picker.project.confirm":"Open here","app.picker.project.confirmTitle":"Open an agent tab in {{path}}","app.picker.project.title":"New project","app.picker.vault.confirm":"Use this folder","app.picker.vault.confirmTitle":"Move the backup to {{path}}. The current folder stays untouched","app.picker.vault.title":"Backup folder","app.sidebar.name":"Projects","app.sidebar.show":"Show the project list","app.status.connecting":"Connecting","app.status.failed":"No connection","app.status.open":"Connected","app.status.reconnecting":"Reconnecting","app.status.revoked":"Access revoked","archive.allBlocked_one":"Its only conversation has an open tab. Close it first.","archive.allBlocked_other":"Its {{count}} conversations have an open tab. Close them first.","archive.blockedStays_one":"Another one has an open tab and stays.","archive.blockedStays_other":"{{count}} others have an open tab and stay.","archive.confirm_one":"Archive {{count}} conversation?","archive.confirm_other":"Archive the {{count}} conversations?","archive.withBlocked":"{{confirm}} {{blocked}}","common.cancel":"Cancel","common.close":"Close","common.closeEsc":"Close (Esc)","common.copied":"Copied","common.copyCode":"Copy code","common.dismissNotice":"Dismiss the notice","common.gotIt":"Got it","composer.attach":"Attach a file","composer.attachTitle":"Attach a file: a log, a PDF, a document or an image","composer.chip.editHint":"Show and edit the pasted text","composer.chip.editorLabel":"Edit pasted text #{{number}}","composer.chip.pastedTextEmpty":"#{{number}} · Pasted text · empty, won't be sent","composer.chip.pastedText_one":"#{{number}} · Pasted text · {{count}} line","composer.chip.pastedText_other":"#{{number}} · Pasted text · {{count}} lines","composer.chip.remove":"Remove","composer.pastedImage":"pasted image","composer.placeholder.ended":"This tab's session has ended.","composer.placeholder.ready":"Type your message.","composer.placeholder.sleeping":"This tab doesn't have the CLI open yet.","composer.problem.draftTooLong":"This message is too long to keep as a draft: if you close Agent Workbench before sending it, it will be lost.","composer.problem.empty":'"{{name}}" is empty.',"composer.problem.imageTooBig":"The image is {{size}} MB; the maximum is {{max}} MB.","composer.problem.imageUnreadable":"Couldn't read the image from the clipboard.","composer.problem.tooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"composer.problem.tooManyFiles_one":"Up to {{count}} file per message.","composer.problem.tooManyFiles_other":"Up to {{count}} files per message.","composer.problem.tooManyImages_one":"Up to {{count}} image per message.","composer.problem.tooManyImages_other":"Up to {{count}} images per message.","composer.problem.unreadable":`Couldn't read "{{name}}".`,"composer.resizeTitle":"Drag to resize the message box","composer.send":"Send","composer.sendTitle":"Send (Enter)","composer.stop":"Stop","composer.stopTitle":"Interrupt whatever the CLI is doing (Esc)","console.collapse":"Collapse. The processes keep running: to end them, use each terminal's ×","console.name":"Console","console.noShell":"No system console was found to open.","console.openAnother":"Open another {{shell}} in {{cwd}}","console.openAnyIn":"Open a console in {{cwd}}","console.openIn":"Open {{shell}} in {{cwd}}","console.tab.close":"Close this terminal and end its process","console.tab.exited":"Exited with code {{code}}","console.tab.label":"Terminal {{number}}","console.tab.title":"{{shell}} {{number}} in {{cwd}}","continue.menuLabel":"Continue with","controls.effort.high":"High","controls.effort.inUse":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab","controls.effort.inUseSaved":"Effort in use: {{effort}}. Changing it sends {{command}} to the CLI tab, and the CLI saves it as the default for the next tabs","controls.effort.low":"Low","controls.effort.max":"Max","controls.effort.medium":"Medium","controls.effort.minimal":"Minimal","controls.effort.noData":"Effort: no data. Not every model has levels — with haiku, /effort leaves no trace","controls.effort.off":"Off","controls.effort.placeholder":"effort — no data","controls.effort.provisional":"Effort from your configuration: {{effort}}. No response has confirmed it yet","controls.effort.xhigh":"Very high","controls.model.default":"Default","controls.model.inUse":"Model in use: {{model}}. Changing it sends /model to the CLI tab","controls.model.inUseSaved":"Model in use: {{model}}. Changing it sends /model to the CLI tab, and the CLI saves it as the default for the next tabs","controls.model.noData":"Model: there hasn't been any response in this session yet","controls.model.placeholder":"model — no data","controls.model.provisional":"Model from your configuration: {{model}}. No response has confirmed it yet","conversation.answerUnconfirmed":"The CLI didn't confirm this answer. Try again, or answer in the CLI tab.","diff.binary":"Binary file: there's no diff to show.","diff.noChanges":"No changes.","diff.truncated":"The diff was cut off because of its size. The full file is easier to read outside this panel.","docs.backToList":"Show the list","docs.edit.adopt":"Move my changes to the new version","docs.edit.button":"Edit","docs.edit.cancel":"Cancel","docs.edit.closeConfirm":"This file has unsaved changes. Discard them and close it?","docs.edit.conflict":"The file changed on disk while you were editing it. Your changes weren't saved.","docs.edit.discard":"Discard","docs.edit.discardAndClose":"Discard and close","docs.edit.discardConfirm":"Discard your changes?","docs.edit.discardMine":"Discard my changes","docs.edit.editing":"Editing {{name}}","docs.edit.gone":"The file is no longer on disk, or its new version can't be edited here. Your changes weren't saved: copy them if you need them.","docs.edit.keepEditing":"Keep editing","docs.edit.lost":"The connection dropped while saving. Save again to be sure.","docs.edit.noChanges":"No changes","docs.edit.pending":"Your changes, not saved yet. Move them into the file and save.","docs.edit.pendingDone":"Done","docs.edit.save":"Save","docs.edit.saveTitle":"Save (Ctrl+S)","docs.edit.saved":"Saved","docs.edit.saving":"Saving…","docs.edit.title":"Edit this file here","docs.edit.tooLarge":"It's too big to edit here","docs.edit.unsafe":"It isn't plain UTF-8 text: saving it from here could damage it","docs.edit.unsaved":"Unsaved changes","docs.failed":"Couldn't read the document. Use ⟳ to try again.","docs.mode.formatted":"Formatted","docs.mode.label":"How to show this Markdown","docs.mode.source":"Source","docs.reload":"Read the document again","docs.reloadFailed":"Couldn't read it again: this is the last version that arrived.","docs.search.placeholder":"Search this document","docs.tab.close":"Close this document","files.allHidden":"everything in it is hidden","files.empty":"empty","files.hidden.hide":"Hide again what .gitignore and the built-in list exclude","files.hidden.show":"Also show what .gitignore and the built-in list exclude","files.hiddenCount_one":"{{count}} hidden","files.hiddenCount_other":"{{count}} hidden","files.hiddenTitle":"Hidden: .git, node_modules, dist, bin, obj and whatever .gitignore says","files.insertFolderPath":"Put this folder's path in your message","files.insertPath":"Put the path of {{name}} in your message","files.loading":"loading…","files.menu.copyAbsolute":"Copy absolute path","files.menu.copyRelative":"Copy relative path","files.menu.insertMention":"Insert as @path","files.menu.openWithSystem":"Open with the default app","files.moreEntries":"there are more entries than shown","files.pathInserted":"Added to your message","files.preview.binary":"Binary file: no preview.","files.preview.insertPath":"Put the path in your message","files.preview.truncated":"The file was cut off because of its size. Open it with the default app to see all of it.","files.readDirFailed":"Couldn't read the directory.","files.readingDir":"Reading the directory…","files.readingFile":"Reading the file…","files.refresh":"Reload the tree","files.reveal":"Open {{name}} in the system's file explorer","files.revealFolder":"Open this folder in the system's file explorer","files.row.alwaysHidden":"always hidden: .git, node_modules, dist, bin, obj","files.row.ignored":"hidden by .gitignore","files.search.clear":"Clear (Esc)","files.search.more":"there are more results than shown","files.search.moreTitle":"Narrow the search to see them all","files.search.none":"No file with that name.","files.search.placeholder":"Search files by name…","files.search.prompt":"Type to search.","files.search.searching":"Searching…","format.bytes.b":"{{value}} B","format.bytes.gb":"{{value}} GB","format.bytes.kb":"{{value}} KB","format.bytes.mb":"{{value}} MB","format.duration.minutes":"{{value}} min","format.duration.minutesSeconds":"{{minutes}} min {{seconds}} s","format.duration.ms":"{{value}} ms","format.duration.seconds":"{{value}} s","format.duration.underSecond":"less than 1 s","format.timeLeft.daysHours":"{{days}}d {{hours}}h","format.timeLeft.hoursMinutes":"{{hours}}h {{minutes}}m","format.timeLeft.minutes":"{{minutes}}m","format.timeLeft.underMinute":"<1m","git.aheadBehindTitle":"Commits ahead of and behind the upstream branch","git.backToChanges":"Changes","git.clean":"The working tree is clean.","git.detached":"Detached HEAD","git.detachedAt":"Detached HEAD @ {{head}}","git.group.conflict":"Conflicted","git.group.conflictHint":"They need to be resolved before going on","git.group.staged":"Staged","git.group.stagedHint":"Already added with git add","git.group.unstaged":"Unstaged","git.group.unstagedHint":"Modified in the working tree","git.group.untracked":"Untracked","git.group.untrackedHint":"New files git doesn't know about","git.kind.added":"added","git.kind.conflict":"conflicted","git.kind.copied":"copied","git.kind.deleted":"deleted","git.kind.modified":"modified","git.kind.renamed":"renamed","git.kind.typeChanged":"type changed","git.kind.untracked":"untracked","git.newFolderTitle":"{{path}} — new folder; its contents show up in Files","git.readingDiff":"Reading the diff…","git.refresh":"Refresh the status now","git.stagedTag":"staged","git.truncated":"There are more changes than shown. It usually means a rule is missing from <code>.gitignore</code>.","git.unknownState":"The repository's status isn't known yet.","git.upstreamTitle":"Upstream branch: {{upstream}}","git.worktrees.detached":"detached","header.locale.auto":"Automatic (browser: {{name}})","header.locale.title":"Language: {{name}}","header.locale.titleAuto":"Language: {{name}} (automatic, from the browser)","memory.action.appendBlock":"the block will be added at the end","memory.action.appendLines":"lines will be added at the end","memory.action.copy":"will be copied","memory.action.create":"will be created","memory.action.replaceBlock":"the block will be replaced","memory.back":"← Memory","memory.error.connectionLost":"The connection dropped before the response. Once it reconnects, the status shows what got written.","memory.form.copyFromMain":"Copy the notes from the main worktree","memory.form.existingNotes":"Existing notes","memory.form.files":"Instruction files","memory.form.importNative_one":"Import {{count}} note from Claude Code's memory","memory.form.importNative_other":"Import {{count}} notes from Claude Code's memory","memory.form.noFiles":"Choose at least one instruction file","memory.form.planning":"Calculating…","memory.form.preview":"Preview changes","memory.git.alreadyIgnored":"This repo already ignores <code>.agents/memory/</code>. To track it, that rule has to be removed from <code>.gitignore</code> by hand.","memory.git.blocked":"With git returning an error, it can only be installed without touching .gitignore","memory.git.dontTouch":"Don't touch <code>.gitignore</code>","memory.git.errorHint":"git returned an error","memory.git.errorWarning":"git returned an error, so there's no telling whether the memory is ignored. It can be installed without touching <code>.gitignore</code>.","memory.git.ignore":"Ignore the memory","memory.git.ignoreHint":"recommended","memory.git.version":"Track it","memory.git.versionHint":"for private repos","memory.global.copy":"Copy the snippet","memory.global.intro":"What applies to all your projects goes in <code>~/.agents/global.md</code>. The app doesn't write it: each CLI reads it once you add its snippet.","memory.global.title":"Global memory","memory.index":"Index","memory.intro.what":"Shared memory keeps what the agents learn about this project —decisions, constraints, pitfalls they already ran into— for the next session.","memory.intro.where":"It lives in <code>.agents/memory/</code>: one note per file and an index, <code>MEMORY.md</code>. The four CLIs read it through a marked block in their instructions file. Nothing is written until you confirm the changes.","memory.list.empty":"No notes yet. The agents save them here when they learn something that's useful in another session.","memory.list.notes":"Notes","memory.loading":"Reading the memory…","memory.native.import_one":"Import {{count}} note","memory.native.import_other":"Import {{count}} notes","memory.native.importing":"Importing…","memory.native.pending_one":"Claude Code's own memory has {{count}} note that isn't here.","memory.native.pending_other":"Claude Code's own memory has {{count}} notes that aren't here.","memory.note.loading":"Reading the note…","memory.note.truncated":"The note was cut off because of its size.","memory.plan.back":"Back","memory.plan.changes":"Changes","memory.plan.copiedFrom":"Copy of {{path}}","memory.plan.install":"Install","memory.plan.nothing":"There's nothing to change: the bridge is already up to date.","memory.plan.update":"Update","memory.plan.writing":"Writing…","memory.problem.brokenBlock":"Its block markers are malformed","memory.problem.brokenBlockWarning":"<code>{{file}}</code> has malformed memory block markers: one without its pair, or the block repeated. The app won't touch it until you fix it by hand.","memory.problem.encoding":"It isn't in UTF-8","memory.problem.encodingWarning":"<code>{{file}}</code> isn't in UTF-8 (it looks like UTF-16, which is what <code>></code> writes in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it until then.","memory.problem.outside":"It's a link that points outside the project","memory.problem.outsideWarning":"<code>{{file}}</code> is a link that points outside the project: the app doesn't read or write it.","memory.reach.adjust":"Adjust","memory.reach.adjustTitle":"Choose the bridge's instruction files again","memory.reach.doesNotReach":": doesn't reach the memory, {{via}}","memory.reach.reaches":": reaches the memory through {{via}}","memory.reach.title":"{{label}}: {{via}}","memory.result.imported_one":"Imported {{count}} note.","memory.result.imported_other":"Imported {{count}} notes.","memory.result.installed_one":"Done: {{count}} file changed.","memory.result.installed_other":"Done: {{count}} files changed.","memory.result.nothingChanged":"There was nothing to change: the bridge was already up to date.","memory.result.nothingImported":"There were no new notes to import.","memory.result.skipped_one":"Not overwritten because it already existed with different content: {{files}}.","memory.result.skipped_other":"Not overwritten because they already existed with different content: {{files}}.","memory.result.withSkipped":"{{result}} {{skipped}}","memory.update.button":"Update the bridge","memory.update.missing":"The block is missing from {{files}}.","memory.update.outdatedAndMissing_one":"{{outdated}} has an outdated block; the block is missing from {{missing}}.","memory.update.outdatedAndMissing_other":"{{outdated}} have an outdated block; the block is missing from {{missing}}.","memory.update.outdated_one":"{{files}} has an outdated block.","memory.update.outdated_other":"{{files}} have an outdated block.","meter.compact":"Compact","meter.compactBusy":"Wait for the agent to finish to compact.","meter.compactNoCli":"Open the CLI to compact.","meter.compactTitle":"Sends {{command}} to the CLI: it summarizes the conversation to free up context.","meter.configure":"Configure","meter.label":"Context","meter.lastResponseTitle":"The model's last response","meter.modelWithOrigin":"{{model}} — {{origin}}","meter.noTokens":"this CLI doesn't publish tokens","meter.noTokensTitle":"This CLI doesn't publish how many tokens each response uses, so there's nothing to measure.","meter.output":"output {{tokens}}","meter.responses_one":"{{count}} response","meter.responses_other":"{{count}} responses","meter.sessionTitle":"Total for the whole session","meter.sessionTotals_one":"session {{output}} out · {{cache}} cache · {{count}} response","meter.sessionTotals_other":"session {{output}} out · {{cache}} cache · {{count}} responses","meter.unknownModel":"unrecognized model: showing the tokens, not the window size","meter.unknownModelShort":"unrecognized model: no window size","meter.unmeasured":"not measured","meter.windowPercent":"{{percent}}% of the window","mode.acceptEdits.hint":"Accepts file edits without asking","mode.acceptEdits.label":"Accept edits","mode.auto.hint":"The CLI decides on its own which tools to use, without asking","mode.auto.label":"Auto","mode.default.hint":"Asks before each tool that isn't allowed","mode.default.label":"Manual","mode.plan.hint":"Researches and proposes a plan, without touching anything until you approve it","mode.plan.label":"Plan","narrow.keys.ctrlO":"Ctrl+O (in Claude Code, expands what is shown cut short)","narrow.keys.ctrlX":"Ctrl+X","narrow.keys.down":"Down arrow","narrow.keys.esc":"Escape","narrow.keys.interrupt":"Ctrl+C: interrupt","narrow.keys.label":"Terminal keys","narrow.keys.left":"Left arrow","narrow.keys.right":"Right arrow","narrow.keys.shiftTab":"Shift+Tab (in Claude Code, cycles the permission mode)","narrow.keys.tab":"Tab","narrow.keys.up":"Up arrow","narrow.menu.chimePage":"This page","narrow.menu.chimeSystem":"System","narrow.menu.cli":"CLI","narrow.menu.connection":"Connection","narrow.menu.folder":"Folder","narrow.menu.language":"Language","narrow.menu.notifications":"System notifications","narrow.menu.phoneAppDisconnect":"Disconnect","narrow.menu.phoneAppSettings":"Settings","narrow.menu.shortcuts":"Keyboard shortcuts","narrow.menu.sound":"Notification sound","narrow.menu.theme":"Theme","narrow.more":"More","narrow.projects":"Projects","narrow.tabs.close":"Close tab","narrow.tabs.new":"New tab","narrow.tabs.none":"No tabs open.","narrow.tabs.open":"Tabs","narrow.tabs.rename":"Rename","narrow.view.chat":"Chat","notes.attach":"Attach an image from a file","notes.closeConfirm":"Closing this note deletes it, along with its images.","notes.closeNote":"Close the note. It's deleted, along with its images","notes.collapse":"Collapse. Notes aren't lost: the × on each tab is what closes them","notes.empty":"No notes. The <b>+</b> opens one; they're for jotting down an idea without leaving what you're doing.","notes.expand":"Expand the notes","notes.imageAlt":"note image","notes.imageFallbackName":"the image","notes.imageOnly":"Image","notes.imageTooBig":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"notes.imageUnavailable":"the image isn't available","notes.lightboxClose":"Click to close","notes.name":"Notes","notes.new":"New note","notes.placeholder":"Jot down an idea. Images can be pasted or dragged here.","notes.readFailed":"Couldn't read the image.","notes.removeImage":"Remove the image","notes.resize":"Drag to change the height","notes.thumbMissing":"missing","notes.toComposer":"To message box","notes.toComposer.loading":"Loading the note's images…","notes.toComposer.needsTab":"Open a tab first: the note goes to its message box","notes.toComposer.title":"Put the note in the message box of “{{tab}}”, to add to it and send it to that conversation","notes.tooManyImages_one":"Up to {{count}} image per note.","notes.tooManyImages_other":"Up to {{count}} images per note.","notes.untitled":"Note","notify.attention":"“{{tab}}” is waiting for you","notify.done":"“{{tab}}” finished","panel.cliUnseen":"The CLI wrote something","panel.hide":"Hide the panel (Alt+P)","panel.restoreWidth":"Restore the column's width","panel.tab.cli":"CLI","panel.tab.files":"Files","panel.tab.git":"Changes","panel.tab.memory":"Memory","panel.tab.plans":"Plans","panel.widen":"Widen the column — the CLI's interface needs room to draw diffs and tables","picker.create":"Create","picker.createHere":"Create a folder here","picker.empty":"There are no subfolders here.","picker.goTo":"Go to {{root}}","picker.loading":"Reading the disk...","picker.newFolderName":"Folder name","picker.truncated":"There are more subfolders than fit in the list. Open one to narrow it down.","picker.up":"parent folder","plan.label":"Plan","plan.noData":"no data","plan.noDataTitle":"The status line is configured, but it hasn't published your plan limits yet: they arrive with the first response of each session. The CLI only publishes them for subscription plans.","plan.noReset":"no reset time","plan.observed":"Last update: {{when}}","plan.resetsIn":"resets in {{time}} ({{at}})","plan.setup.disabled":"This CLI publishes your plan limits only through its status line, and the app's status line is disabled. Configure explains how.","plan.setup.missing":"This CLI publishes your plan limits (the 5-hour window and the week) only through its status line, and it isn't configured yet. Configure explains how.","plan.setup.otherCommand":"This CLI publishes your plan limits only through its status line, and you have another status line configured. Configure explains how.","plan.setup.unreadable":"This CLI publishes your plan limits only through its status line, and its settings.json couldn't be read. Configure explains how.","plan.used":"{{percent}} used","plan.window.day":"Day","plan.window.days":"{{value}}d","plan.window.fiveHours":"5h","plan.window.hours":"{{value}}h","plan.window.month":"Month","plan.window.quota":"Quota","plan.window.week":"Week","plans.empty":"This conversation hasn't written any documents yet. Plans from plan mode show up here, along with the <code>.md</code> files the agent saves in the project or in its temporary folder.","plans.loading":"Reading the plan…","plans.missing":"missing","plans.missingTitle":"The file is no longer on disk","plans.truncated":"The plan was cut off because of its size.","remote.address":"This computer's address","remote.copied":"Copied","remote.copy":"Copy","remote.device.connected":"Connected now","remote.device.lastSeen":"Last seen: {{when}}","remote.device.never":"Never connected","remote.device.paired":"Paired: {{when}}","remote.device.rename":"Rename","remote.device.revoke":"Revoke","remote.device.revokeConfirm":"Click again to revoke","remote.devices":"Paired devices","remote.devices.empty":"None yet.","remote.intro":"Use Agent Workbench from another computer on your network, or from your phone. Nothing is opened to the network: the connection goes through an SSH tunnel.","remote.onlyOnHost":"Only on the computer running Agent Workbench: it opens with that computer's apps.","remote.pair.after":"After that, the other computer just opens {{url}}.","remote.pair.cancel":"Cancel","remote.pair.expires":"It works once and expires in {{time}}.","remote.pair.needsActive":"You can pair once remote access is on and running.","remote.pair.open":"With the tunnel running, open this address in the other computer's browser:","remote.pair.start":"Pair a device","remote.phone.authorize.admin":"1. Authorize the phone's key: on this computer, paste this into PowerShell as administrator.","remote.phone.authorize.powershell":"1. Authorize the phone's key: on this computer, paste this into PowerShell.","remote.phone.authorize.terminal":"1. Authorize the phone's key: on this computer, paste this into a terminal.","remote.phone.authorizeOnce":"The key only opens the tunnel to Agent Workbench: no terminal and no commands. If you already pasted it, you don't need to do it again.","remote.phone.hint":"Using the Android app? It only needs step 1: it opens the tunnel and pairs itself.","remote.phone.qrLabel":"Code to scan with the phone","remote.phone.scan":"2. In the app, tap “Scan code” and point the camera here:","remote.phone.secret":"Don't share this code or a photo of it: it carries the phone's key.","remote.phone.start":"Pair a phone","remote.phone.title":"A phone","remote.port":"Port","remote.portInvalid":"A number between {{min}} and {{max}}.","remote.portSave":"Save","remote.restartHint":"Turning it on, or changing the port, takes effect when you restart Agent Workbench. Restarting closes the open CLIs: the tabs come back asleep.","remote.ssh.linux":"In a terminal (Ubuntu or Debian; on other distributions, install their OpenSSH server):","remote.ssh.macos":"System Settings → General → Sharing → turn on “Remote Login”.","remote.ssh.windows":"Open PowerShell as administrator and paste this. The first line downloads and installs the server: it takes a few minutes and shows “Running” meanwhile. Wait until the prompt comes back before moving on.","remote.state.active":"On, port {{port}}","remote.state.off":"Off","remote.state.portBusy":"Port {{port}} is busy, so remote access isn't working in this run. Close the other program (it may be another Agent Workbench) and restart, or choose another port.","remote.state.restartNeeded":"On, but it takes effect when you restart Agent Workbench","remote.step.host":"1. On this computer, once: turn on SSH","remote.step.hostHint":"It's a system setting that needs administrator rights, so the app doesn't do it for you. This computer's system is open:","remote.step.pair":"3. Pair it, once per device","remote.step.tunnel":"2. On the other computer, each time you use it","remote.step.tunnelHint":"Paste this command into its terminal and leave it open. It asks for the password of your user on this computer.","remote.title":"Remote access","remote.trouble":"Not connecting?","remote.trouble.network":"On Windows, check that this computer's Wi‑Fi network is set to Private.","remote.turnOff":"Turn off","remote.turnOffHint":"Turning it off takes effect right away: paired devices are disconnected, and stay paired.","remote.turnOn":"Turn on remote access","remote.userHint":"If SSH rejects “{{user}}”: with a Microsoft or work account, try the name of your user folder (C:\\Users\\<name>) and the account password, not the PIN.","remote.vpnHint":"A work VPN that blocks the local network cuts the connection while it's on. The app can't do anything about that.","rewind.filesHint":"Changes made by hand or with console commands are not undone.","rewind.filesSection":"Files the agent changed since then","rewind.intro":"This message and everything after it are undone. The message comes back to the message box so you can edit it.","rewind.running":"Going back…","rewind.title":"Go back to before this message","rewind.undo":"Undo","rewind.undoAll":"Undo conversation and code","rewind.undoConversation":"Conversation only","scheduled.close.confirm":"Close anyway","scheduled.close.keep":"Don't close","scheduled.close.title":"Close the tab","scheduled.close.warning_one":"This tab has a message scheduled for {{when}}. If you close it, it won't be sent.","scheduled.close.warning_other":"This tab has {{count}} scheduled messages, the first one for {{when}}. If you close it, none of them will be sent.","scheduled.composer.empty":"Write the message you want to schedule","scheduled.composer.label":"Schedule","scheduled.composer.onlyText":"A scheduled message can only be text: remove the images and files","scheduled.composer.title":"Schedule the message","scheduled.menu.day":"Day","scheduled.menu.inHour":"In an hour","scheduled.menu.invalid":"Pick a day and a time","scheduled.menu.past":"That time has already passed","scheduled.menu.schedule":"Schedule","scheduled.menu.time":"Time","scheduled.menu.title":"Schedule the message","scheduled.menu.tomorrow":"Tomorrow at 9 AM","scheduled.menu.tooFar":"You can schedule up to {{days}} days ahead","scheduled.state.due":"it's time: about to send it","scheduled.state.failed":"Not sent","scheduled.state.paused":"paused: scheduled messages are off in Settings ({{when}})","scheduled.state.scheduled":"scheduled for {{when}}","scheduled.state.sending":"sending…","scheduled.tab.failed_one":"A scheduled message wasn't sent","scheduled.tab.failed_other":"{{count}} scheduled messages weren't sent","scheduled.tab.next_one":"Scheduled message: {{when}}","scheduled.tab.next_other":"{{count}} scheduled messages, the next one {{when}}","scheduled.thread.cancel":"Cancel sending","scheduled.thread.cancelTitle":"Takes it off the schedule and puts the text back in the message box","scheduled.thread.sendNow":"Send now","scheduled.thread.sendNowTitle":"Sends it right away. If the agent is working, it waits for it to finish","scheduled.when.ahead":"{{when}} (in {{left}})","scheduled.worktree.cancels_one":"One of its tabs has a scheduled message: removing the branch cancels it.","scheduled.worktree.cancels_other":"Its tabs have {{count}} scheduled messages: removing the branch cancels them.","search.found":"{{hits}} in {{sessions}}","search.hits_one":"{{count}} match","search.hits_other":"{{count}} matches","search.mode.conversations":"In conversations","search.mode.conversationsTitle":"Searches the text of the conversations saved in the backup, ignoring case and accents","search.mode.titles":"In titles","search.off":"The backup is off: the search covers what it saved while it was on.","search.placeholder.conversations":"Search the conversations (Enter)","search.placeholder.titles":"Filter projects and sessions","search.role.assistant":"Response","search.role.title":"Title","search.role.user":"Request","search.sessions_one":"{{count}} session","search.sessions_other":"{{count}} sessions","search.status.done":"{{found}}.","search.status.none":"No results","search.status.noneIn":"No results in {{sessions}}.","search.status.progressFound_one":"Searching… {{scanned}} of {{count}} session, {{found}} so far.","search.status.progressFound_other":"Searching… {{scanned}} of {{count}} sessions, {{found}} so far.","search.status.progress_one":"Searching… {{scanned}} of {{count}} session.","search.status.progress_other":"Searching… {{scanned}} of {{count}} sessions.","search.status.searching":"Searching…","search.status.truncatedResults":"{{found}}: these are the first ones, refine the search to see the rest.","search.status.truncatedTime":"{{found}}: the search stopped after {{seconds}} s and {{left}} were left unchecked.","search.tooShort":"Type at least {{min}} characters and press Enter.","searchHook.connectionLost":"The connection to the server was lost: search again.","server.agentUnknown":"This server doesn't know how to launch that CLI.","server.answerFreeTextMulti":"In a multiple-choice question, write your own answer in the CLI tab.","server.answerInterrupted":"The answer wasn't fully sent: the interruption cut it off.","server.answerInvalid":"The answer doesn't match the question.","server.answerMenuChanged":"The question no longer looks the way it was read: answer it in the CLI tab.","server.answerNoFreeText":"This question doesn't accept a written answer: choose one of the options.","server.answerNotPending":"That question is no longer waiting for an answer.","server.answerSendFailed":"The answer couldn't be sent: answer it in the CLI tab.","server.answersUnsupported":"This CLI doesn't take answers from the conversation. Answer it in the CLI tab.","server.archiveOpenTab":"Sessions with an open tab aren't archived. Close it first.","server.attachmentEmpty":'"{{name}}" arrived empty.',"server.attachmentExecutable":`Executables aren't attached: "{{name}}".`,"server.attachmentSaveFailed":"The attached file couldn't be saved.","server.attachmentTooLarge":'"{{name}}" is {{size}} MB; the maximum is {{max}} MB.',"server.badMessage":"Message not recognized by the protocol.","server.cliFolderClosed":"That's inside a CLI's own folder: the app doesn't open it.","server.cliMissing":`The "{{command}}" command wasn't found in the PATH. Agent Workbench uses the CLI you already have installed: it doesn't include or download it. Install it from {{url}} and start again.`,"server.cliNotFound":"The CLI isn't installed or wasn't found in the PATH.","server.cliNotInstalled":"{{label}} isn't installed or wasn't found in the PATH.","server.cliOpenFailed":"The tab's CLI couldn't be opened.","server.continueFailed":"The continuation couldn't be prepared.","server.continueHistoryMissing":"That conversation's history wasn't found.","server.continueNoFolder":"That conversation doesn't say which folder it ran in.","server.continueNotInHistory":"That conversation isn't in the history: if it just started, try again in a few seconds.","server.continueReadFailed":"That conversation couldn't be read.","server.continueSameCli":"That conversation already belongs to that CLI: to continue it, open it from the sidebar.","server.continueTabFailed":"The continuation's tab couldn't be opened.","server.continueTranscriptFailed":"The continuation's transcript couldn't be saved.","server.conversationNotFollowed":"That conversation is no longer being followed.","server.cwdMissing":"The directory doesn't exist: {{cwd}}","server.cwdNotDir":"It isn't a directory: {{cwd}}","server.diffBinaryUntracked":"Untracked binary file.","server.diffNewEmpty":"New, empty file.","server.diffNoStaged":"There are no staged changes for this file.","server.diffNoUnstaged":"There are no unstaged changes for this file.","server.diffReadFailed":"The diff couldn't be read.","server.dirReadFailed":"The directory couldn't be read.","server.dirSearchFailed":"The directory couldn't be searched.","server.fileReadFailed":"The file couldn't be read.","server.fileSaveBlocked":"The file couldn't be saved: it's read-only, or another program has it open.","server.fileSaveFailed":"The file couldn't be saved.","server.fileSaveTooLarge":"It's too big to save from here: the limit is {{max}}.","server.filesPerMessage":"You can attach up to {{max}} files per message.","server.forceSendFailed":"Couldn't force the send: the message is still queued.","server.forceSendNoCli":"This tab's CLI isn't open.","server.forceSendNothing":"Nothing is queued: the message already reached the agent.","server.forceSendUnsupported":"This tab's CLI can't force a send from the app.","server.forceSendWaiting":"The CLI is waiting for your answer: answer it before forcing the send.","server.gitCommandFailed":"git {{command}} failed.","server.gitMissing":"git wasn't found in the PATH. The Changes panel needs git installed; the rest of the app works the same.","server.gitNotFound":"git wasn't found in the PATH.","server.gitNotRepo":"This folder isn't inside a git repository.","server.gitRunFailed":"git couldn't be run to read the repository's status.","server.gitStatusUnknown":"The repository's status isn't known yet.","server.gitUnexpected":"Unexpected answer from git {{command}}.","server.handoffEmpty":"That conversation has no messages to continue.","server.handoffNoTranscript":"That conversation has no messages to continue: that CLI didn't leave a readable transcript.","server.imageEmpty":"The image arrived empty.","server.imageTooLarge":"The image is {{size}} MB; the maximum is {{max}} MB.","server.imageTypeUnsupported":"Image type not supported: {{type}}","server.imageUnknownFormat":"The content isn't an image in a known format.","server.imagesPerMessage":"You can attach up to {{max}} images per message.","server.imagesUnsupported":"This CLI doesn't take images from the message box.","server.memoryAppeared":"{{file}} appeared during the installation. Review the changes again.","server.memoryBrokenBlock":"{{file}} has malformed memory block markers (one without its pair, or the block repeated). Fix it by hand: the app won't touch that file in the meantime.","server.memoryChooseFile":"Choose at least one instructions file.","server.memoryGitFailed":"git couldn't be queried ({{detail}}). Without that, there's no telling whether .gitignore needs changes.","server.memoryHardLinks":"{{file}} has hard links: the app doesn't modify it, because writing it would break the link. Add the block by hand.","server.memoryLinkOutside":"{{path}} points outside the project (a link or a junction): the app doesn't write there.","server.memoryNotAFile":"{{label}} exists but isn't a file.","server.memoryNotInstalled":"Install the bridge first: the .agents/memory folder is missing.","server.memoryNotUtf8":"{{file}} isn't UTF-8 (it looks like UTF-16, which is what `>` leaves in Windows PowerShell 5.1). Save it as UTF-8: the app won't touch it in the meantime.","server.memoryNoteClaude":"Add this line at the end. Claude Code imports the file at startup.","server.memoryNoteGone":"That note no longer exists.","server.memoryNoteHardLink":"Hard link. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteHardLinkCmd":"Hard link, in cmd. `~/{{path}}` has to exist first, and the CLI's file must not: if it exists, move what it has into `global.md` and delete it. If your editor saves by replacing the file, the link breaks: in that case copy the content.","server.memoryNoteName":"That name isn't a memory note.","server.memoryNoteOpenCode":"Inside the root object. Absolute path: OpenCode doesn't expand `~` in this key (unverified).","server.memorySameFile":"{{other}} and {{file}} are the same file (a link). Choose just one.","server.memoryViaEncoding":"{{file}} isn't UTF-8","server.memoryViaFallback":"CLAUDE.md (fallback)","server.memoryViaFile":"{{file}}","server.memoryViaNoBlock":"the block is missing in {{file}}","server.memoryViaNoBlockEither":"the block is missing in AGENTS.md or CLAUDE.md","server.memoryViaNoFolder":"the .agents/memory folder is missing","server.memoryViaNoIndex":".agents/memory/MEMORY.md is missing","server.memoryViaOutside":"{{file}} points outside the project","server.modePendingConfirmation":"There's a confirmation pending in the CLI: changing the mode now would approve it. Answer it in the CLI tab.","server.modeUnreachable":"That mode can't be reached from the current one. Change it with {{key}} in the CLI tab.","server.modesUnsupported":"This CLI has no permission modes to change from here.","server.noteCliNotStarted":"That tab's CLI didn't manage to start; the note wasn't sent.","server.noteEmpty":"The note is empty.","server.noteExists":"That note already exists.","server.noteGone":"The note no longer exists.","server.noteIdInvalid":"The note's id isn't valid.","server.noteImageFailed":"An image from the note couldn't be attached.","server.noteImagesMax":"Up to {{max}} images per note.","server.noteImagesUnsupported":"This CLI doesn't take images; the note wasn't sent.","server.noteInterrupted":"The note wasn't fully sent: the interruption cut it off.","server.noteNoAgent":"That tab has no agent to send the note to.","server.noteNoReadySignal":"This CLI doesn't say when it's ready; the note wasn't sent.","server.noteSaveFailed":"The note couldn't be saved.","server.noteTooLong":"A note holds up to {{max}} characters.","server.notesMax":"Up to {{max}} open notes. Close one first.","server.openToolSubmit":"{{label}} has a tool without a result: it may be asking for approval. Answer it in the CLI tab.","server.operationFailed":"The operation couldn't be completed: {{detail}}","server.pasteImageFailed":"The pasted image couldn't be saved.","server.pathMissing":"The path doesn't exist.","server.pathNotRelative":"Only paths relative to the tab's directory are accepted.","server.pathNullByte":"The path contains a null byte.","server.pathOpenFailed":"The path couldn't be opened.","server.pathOutside":"The path goes outside the tab's directory.","server.pendingSubmitAnswer":"{{label}} is waiting for an answer: the message's Enter would answer it. Answer it in the CLI tab.","server.pendingSubmitPermission":"{{label}} is waiting for you to authorize a tool: the message's Enter would approve it. Answer it in the CLI tab.","server.pickerCliFolder":"That folder belongs to the CLI and can't be opened from here.","server.pickerClosed":"That folder picker is no longer open.","server.pickerCreateFailed":"The folder couldn't be created there.","server.pickerFolderExists":"There's already a folder with that name.","server.pickerListFailed":"That folder couldn't be listed.","server.pickerNameChars":"The name has characters that can't be used.","server.pickerNameInvalid":"The folder name isn't valid.","server.pickerNoProjectsHere":"Projects aren't created there: it's the CLI's folder.","server.pickerNotListed":"That folder isn't in the current listing.","server.pickerRootMissing":"That root doesn't exist.","server.pickerTooMany":"Too many folder pickers are open.","server.planReadFailed":"The plan couldn't be read.","server.queueEditBusyEditor":"The CLI's input box has text: edit the queue in the CLI tab.","server.queueEditDelivered":"The agent had just received it: it's no longer queued.","server.queueEditFailed":"Couldn't take it out of the queue: it's still queued.","server.queueEditForced":"You already forced the send: the CLI is handing it to the agent.","server.queueEditNoCli":"This tab's CLI isn't open.","server.queueEditNotCleared":"The queue went back to the CLI's input box, but the app couldn't clear it: your messages are there, in the CLI tab.","server.queueEditNotOnScreen":"The CLI doesn't show anything queued: it may have just handed it to the agent.","server.queueEditNothing":"Nothing is queued: the message already reached the agent.","server.queueEditUnsupported":"This tab's CLI can't edit its queue from the app.","server.queueEditWaiting":"The CLI is waiting for your answer: answer it before editing the queue.","server.raw":"{{text}}","server.relaunchCloseFailed":"The tab's CLI couldn't be closed to relaunch it.","server.remoteDeviceGone":"That device is no longer paired.","server.remoteFailed":"The remote access change couldn't be made.","server.remoteHostOnly":"Remote access is managed only from the computer running Agent Workbench.","server.remoteNotActive":"Remote access isn't on and running yet. Turn it on and restart Agent Workbench.","server.remoteOpensOnHost":"That opens a window on the computer running Agent Workbench, so it isn't available from a remote device.","server.remotePortInvalid":"The port has to be a number between {{min}} and {{max}}.","server.remoteTooManyDevices":"There are already {{max}} paired devices. Revoke one first.","server.rewindBusy":"The CLI is working: stop it before going back.","server.rewindFailed":"Couldn't go back from here, and nothing was undone. Do it in the CLI tab with Esc Esc.","server.rewindNoCli":"This tab's CLI isn't open: open it to go back.","server.rewindUnknownMessage":"That message is no longer in the conversation.","server.rewindUnsupported":"This tab's CLI can't go back from the app.","server.scheduleEmpty":"There's nothing to schedule.","server.scheduleGone":"That scheduled message isn't there anymore: it was sent or canceled.","server.scheduleNoConversation":"This tab has no conversation yet: send a first message before scheduling one.","server.scheduleOff":"Scheduled messages are off in Settings.","server.schedulePast":"That time has already passed: pick a later one.","server.scheduleSaveFailed":"The scheduled message couldn't be saved.","server.scheduleSending":"That message is already being sent.","server.scheduleTooFar":"You can schedule up to {{days}} days ahead.","server.scheduleTooLong":"The message is too long to schedule: the limit is {{max}} characters.","server.scheduleTooMany":"There are already {{max}} scheduled messages: send or cancel one first.","server.scheduleUnsupported":"{{label}} doesn't take scheduled messages yet.","server.scheduledCliNotReady":"Not sent: the CLI didn't get ready to receive it.","server.scheduledCliOpenFailed":"Not sent: the CLI couldn't be opened.","server.scheduledElsewhereTimeout":"Not sent: the conversation stayed open in another program.","server.scheduledMissed":"Not sent: the app wasn't open at that time.","server.scheduledNoTab":"Not sent: no tab had this conversation.","server.scheduledUncertain":"Unknown whether it arrived: the app closed while sending it. Check the conversation.","server.scheduledUncertainWrite":"Unknown whether it arrived: it was cut off while being written. Check the conversation.","server.scheduledUnconfirmed":"Unknown whether it arrived: it didn't show up in the conversation. Check the CLI tab.","server.scheduledWaitAnswer":"It's time: waiting for you to answer what the CLI is asking.","server.scheduledWaitBusy":"It's time: waiting for the agent to finish.","server.scheduledWaitElsewhere":"It's time, but the conversation is open in another program: waiting for it to close.","server.scheduledWaitGrace":"It's time: waiting a minute in case another Agent Workbench open on this computer sends it.","server.scheduledWaitNoTab":"It's time, but no tab has this conversation.","server.scheduledWaitOtherInstance":"Another Agent Workbench open on this computer is sending it.","server.searchFailed":"The backup couldn't be searched.","server.settingsFailed":"Couldn't save the settings.","server.settingsHostOnly":"These settings can only be changed on the computer running Agent Workbench.","server.settingsShellMissing":"That console isn't installed anymore.","server.shellNotFound":"No system console was found to open.","server.submitInterrupted":"The message wasn't fully sent: the interruption cut it off.","server.submitStartupDialog":"{{label}} is asking something on its screen before it takes messages, like whether you trust this folder. Answer it in the CLI tab and send again: the message is back in the message box.","server.submitStoppedTool":"The message wasn't fully sent: {{label}} opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedToolNoLabel":"The message wasn't fully sent: the CLI opened a tool while it was being typed and may be asking for approval. Check the CLI tab.","server.submitStoppedWaiting":"The message wasn't fully sent: {{label}} started waiting for an answer while it was being typed. Answer it before sending another message.","server.submitStoppedWaitingNoLabel":"The message wasn't fully sent: the CLI started waiting for an answer while it was being typed. Answer it before sending another message.","server.tabClosedWhileOpening":"The tab closed while it was opening.","server.tabDirGone":"The tab's directory no longer exists.","server.tabOpenFailed":"The tab couldn't be opened.","server.terminalAsleep":"This tab doesn't have its CLI open. Open it to write to the agent.","server.terminalGone":"The terminal no longer exists.","server.terminalOpenFailed":"The terminal couldn't be opened.","server.tooManyTabs":"You can't open more than {{max}} tabs at once.","server.vaultBusyMeasuring":"The backup is busy measuring. Try again when it's done.","server.vaultBusyMoving":"The backup is busy moving to another folder. Try again when it's done.","server.vaultBusyWriting":"The backup is busy copying. Try again when it's done.","server.vaultCannotWrite":"That folder can't be written to.","server.vaultCurrentInsideTarget":"The current backup can't end up inside the new folder.","server.vaultDiskFull":"Disk full: the pass stopped ({{detail}})","server.vaultFailed":"The backup operation couldn't be completed.","server.vaultIndexNotReady":"The history is still being read. Measure when it's done.","server.vaultMeasureFirst":"First measure how much it would take.","server.vaultMemoryFailed":"memory of {{cwd}}: {{detail}}","server.vaultMoveFailed":"The backup couldn't be moved: {{detail}}","server.vaultMoving":"The backup is moving to another folder. Try again when it's done.","server.vaultNoCopyYet":"There's no backup yet.","server.vaultNotLoaded":"The backup isn't loaded.","server.vaultProjectGone":"That project is no longer in the sidebar.","server.vaultReasonNewerFormat":"the existing copy is in a newer format","server.vaultReasonOriginMissing":"the source wasn't found","server.vaultReasonUnsafeId":"a session id that can't be copied","server.vaultSessionFailed":"{{agent}}/{{session}}: {{detail}}","server.vaultSessionMissing":"That session isn't in the backup.","server.vaultTargetCliFolder":"That folder belongs to a CLI: the backup isn't kept there.","server.vaultTargetInsideCurrent":"The new folder can't be inside the current backup.","server.vaultTargetNotAbsolute":"The backup folder has to be an absolute path.","server.waitingSubmit":"{{label}} is waiting for an answer: answer it before sending another message.","server.worktreeBaseAdvanced":"{{base}} moved ahead: the branch has to catch up first. Nothing was merged.","server.worktreeBaseMissing":"The branch {{base}} doesn't exist in this repository.","server.worktreeBaseNotOpen":"{{base}} isn't checked out in any folder, so there's nowhere to merge it.","server.worktreeBranchExists":"The branch {{branch}} already exists.","server.worktreeBranchInUse":"The branch {{branch}} is already open in another folder.","server.worktreeBranchInvalid":"{{branch}} isn't a valid branch name.","server.worktreeBranchMissing":"The branch {{branch}} doesn't exist anymore.","server.worktreeBranchMoved":"The branch {{branch}} changed after you opened this plan: close it and open it again to see what would go in. Nothing was integrated.","server.worktreeBranchNotIntegrated":"The branch {{branch}} has unmerged commits: it wasn't deleted.","server.worktreeDiffEmpty":"This file has no line changes against the base.","server.worktreeDiscardFailed":"Couldn't delete all the new files: {{detail}}. The branch wasn't removed.","server.worktreeFailed":"The separate branch couldn't be handled.","server.worktreeFileNotInBranch":"That file isn't among the ones the branch changed.","server.worktreeFolderExists":"The folder {{folder}} already exists. Choose another branch name.","server.worktreeGitFailed":"git refused: {{detail}}","server.worktreeInUse":"Another program has the branch's folder open. Close it and try again.","server.worktreeLocalChanges":"Uncommitted files in the base folder that the branch touches: {{count}}. git would refuse, so nothing was merged.","server.worktreeNoConflicts":"There are no notes left that can't be combined on their own.","server.worktreeNoReview":"That branch has no review yet.","server.worktreeNotRepo":"This folder isn't in a git repository.","server.worktreeNotesConflict":"Notes that changed on both sides and can't be combined: {{count}}. Nothing was removed.","server.worktreeNotesFailed":"The notes couldn't go back to the main folder, so nothing was removed: {{detail}}","server.worktreeNothingToCommit":"The branch has nothing uncommitted anymore.","server.worktreeNothingToIntegrate":"There's nothing to merge: the branch has no commits its base lacks.","server.worktreeNothingToReview":"There's nothing to review: the branch has no commits or changes of its own.","server.worktreeProjectUnknown":"The project's folder isn't there anymore.","server.worktreeReviewUnread":"The reviewer's answer couldn't be read: if it just finished, try again in a few seconds.","server.worktreeUncommitted":"Files with uncommitted changes: {{count}}. Nothing was removed.","server.worktreeUnknown":"That separate branch isn't in the app's list anymore.","server.worktreeUntrackedChanged":"The new files changed since you looked at them. Nothing was removed.","server.worktreeUpToDate":"The branch is already up to date with {{base}}.","session.untitled":"Untitled session","settings.cli.disabled":"Off","settings.cli.hint":"An unchecked CLI doesn't show in the menu or the sidebar, and its history isn't read.","settings.cli.install":"How to install it","settings.cli.notInstalled":"Not installed","settings.cli.restart":"Changes to the CLIs apply when you restart the app.","settings.console.auto":"Automatic","settings.console.autoWith":"Automatic ({{shell}})","settings.console.hint":"For consoles you open from now on; the open ones keep theirs.","settings.hiddenHint":"Hidden: {{name}}. You can show it again from ⚙ Settings.","settings.hide.console":"Hide the console (it comes back from ⚙ Settings)","settings.hide.notes":"Hide the notes (they come back from ⚙ Settings)","settings.hostOnly":"These settings can only be changed on the computer running Agent Workbench.","settings.language":"Language","settings.more.open":"{{name}}…","settings.oldServer":"The server is from an older version: restart it to choose the console and the CLIs.","settings.open":"Settings","settings.panels.cliAlways":"The CLI tab is always shown: the agent's permissions and questions appear there.","settings.panels.consoleConfirmYes":"Hide and close","settings.panels.consoleConfirm_one":"Hiding the console closes {{count}} open terminal.","settings.panels.consoleConfirm_other":"Hiding the console closes {{count}} open terminals.","settings.scheduled.enable":"Schedule messages","settings.scheduled.hint":"Adds a clock to the message box, so a message sends itself at the time you pick, in the same conversation. Turning it off doesn't delete what you scheduled: it stays paused.","settings.scheduled.needsStatusLine":"In {{agent}} the clock shows up once you set up its status line.","settings.section.appearance":"Appearance","settings.section.clis":"CLIs","settings.section.console":"Console","settings.section.more":"More","settings.section.panels":"Panels","settings.section.scheduled":"Scheduled messages","settings.terminalTheme":"Terminal theme","settings.terminalTheme.dark":"Always dark","settings.terminalTheme.follow":"Follow the app's theme","settings.terminalTheme.hint":"CLIs pick their colors for a dark terminal: on a light one, some text is hard to read.","settings.title":"Settings","shortcuts.altNumber":"<strong>Alt + number</strong> isn't used either, on purpose: on Windows, Alt with the numeric keypad is how you type characters that aren't on the keyboard (<kbd>Alt + 164</kbd> = ñ). Intercepting it breaks typing accented characters. To switch tabs there are <kbd>Alt + ←</kbd> and <kbd>Alt + →</kbd>.","shortcuts.app.closeTab":"Close the active tab","shortcuts.app.newTab":"New tab in the current tab's directory","shortcuts.app.previousTab":"Go back to the previous tab (outside the terminal: inside, it goes to the CLI)","shortcuts.app.switchTab":"Previous / next tab (also Alt + PgUp / PgDn)","shortcuts.app.togglePanel":"Show or hide the right panel","shortcuts.ariaLabel":"Keyboard shortcuts","shortcuts.browserReserved":"<strong>Ctrl+T</strong>, <strong>Ctrl+W</strong> and <strong>Ctrl+Tab</strong> can't be used: the browser keeps them for its own tabs and the event never reaches the page.","shortcuts.cliHint":"The CLI handles these. The app doesn't intercept them: they reach it as they are. In the terminal, a new line is still <kbd>Ctrl + J</kbd> and images are pasted with <kbd>Alt + V</kbd>; the message box is the one with the keys above.","shortcuts.section.app":"Application","shortcuts.section.cli":"CLI, inside the terminal","shortcuts.section.composer":"In the message box","shortcuts.title":"Shortcuts","sidebar.action.archive":"Archive","sidebar.action.restore":"Restore","sidebar.action.undo":"Undo","sidebar.archived.hide_one":"Hide {{count}} archived","sidebar.archived.hide_other":"Hide {{count}} archived","sidebar.archived.show_one":"Show {{count}} archived","sidebar.archived.show_other":"Show {{count}} archived","sidebar.archived.toggleTitle":"Archived sessions stay on disk; this only shows or hides them","sidebar.empty.noMatch":"Nothing matches the filter.","sidebar.empty.noProjects":"No projects found in the history.","sidebar.hide":"Hide the projects","sidebar.history.button":"Archive history…","sidebar.history.buttonTitle":"Hide a CLI's sessions from before today in one go. Nothing is deleted","sidebar.history.confirm_one":"{{count}} {{label}} session will be hidden; nothing is deleted","sidebar.history.confirm_other":"{{count}} {{label}} sessions will be hidden; nothing is deleted","sidebar.history.count_one":"{{count}} session from before today","sidebar.history.count_other":"{{count}} sessions from before today","sidebar.history.heading":"Archive everything before today","sidebar.history.region":"Archive history","sidebar.indexing":"Indexing {{scanned}} / {{total}}","sidebar.newProject":"New project: choose or create a folder","sidebar.project.archive":"Archive project","sidebar.project.archiveTitle":"Archive the project: hides its conversations from the sidebar. Nothing is deleted","sidebar.project.export":"Export to Markdown","sidebar.project.folderGone":"The folder no longer exists on disk","sidebar.project.missing":"folder not found","sidebar.project.newSession":"New session in this project","sidebar.reindex":"Reindex the history","sidebar.searchMode.label":"Where to search","sidebar.searchMode.titlesTitle":"Filters the list by project name and session title","sidebar.selection.count_one":"{{count}} selected","sidebar.selection.count_other":"{{count}} selected","sidebar.session.archive":"Archive — hides it from the list, nothing is deleted","sidebar.session.blocked":"It has an open tab. Close it first.","sidebar.session.restore":"Restore to the list","sidebar.undo.dismissTitle":"Dismiss the notice; the sessions stay archived","sidebar.undo.text_one":"Archived {{count}} session from {{what}}","sidebar.undo.text_other":"Archived {{count}} sessions from {{what}}","sidebar.vaultLine.lastError":"Last error: {{error}}","sidebar.vaultLine.title":"See the backup's status and folder","sound.notify.blocked":"The browser is blocking this page's notifications. Allow them in the site's settings and click again.","sound.notify.off":"System notifications off — click to turn them on","sound.notify.on":"System notifications on — click to turn them off. They only show when this window isn't in view.","sound.off":"Notification sound muted — click to turn it on","sound.on":"Notification sound on — click to mute","sound.volume":"Notification sound volume","statusLine.agentPrompt":`Set up the status line of {{agent}}. In the file {{path}}, add the statusLine key from this JSON without touching the other keys; if the file doesn't exist, create it with this content:
|
|
42
|
-
|
|
43
|
-
{{fragment}}
|
|
44
|
-
|
|
45
|
-
Copy the command value exactly as it is, without adding or removing quotes or slashes. If the file already has a statusLine, don't replace it: tell me. Don't show the rest of the file or open other files in that folder.`,"statusLine.benefit":"With the status line configured, this CLI's tabs show their status, the “waiting” bar when it asks for permission to use a tool, the context meter with the exact window, and how much of your quota is left. Without it there's no way to know: the CLI doesn't leave it in any other file.","statusLine.check":"Check","statusLine.checkHint":"The app also notices on its own within a couple of seconds.","statusLine.checking":"Checking…","statusLine.copied":"Copied","statusLine.copy":"Copy","statusLine.copyPrompt":"Copy a request for your agent","statusLine.copyPromptTitle":"Copy a request so an AI agent adds the line for you","statusLine.copyTitle":"Copy the line to the clipboard","statusLine.lineSection":"The line","statusLine.mergeHint":"Merge it with what the file below already has, without replacing it: if it already has braces, add only the <kbd>statusLine</kbd> key.","statusLine.planBenefit":"With the status line configured, the bar above the conversation shows how much of your plan you've used in the 5-hour window and in the week, and when each one resets. The CLI doesn't leave this in any other file, and only publishes it for subscription plans.","statusLine.planNoFragment":"The app's folder has characters that the shell interprets inside quotes ($, ` or \"), and with them there's no line the CLI can run. Moving the configuration folder to a path without those characters fixes it.","statusLine.planReplaces":"The CLI allows a single status line: this one replaces any other you have. And with a status line configured, the CLI stops showing some hints at its bottom, such as “esc to interrupt”.","statusLine.planScriptHint":"It only saves the two limits and the session id, in the app's folder, and prints them as a short line at the bottom of the CLI. It doesn't save the folder, the transcript, the cost or the model, which the CLI also passes to it.","statusLine.promptCopied":"Copied","statusLine.runsEverywhere":"With the line in place, every CLI session runs it, including the ones you open outside the app, and it needs <kbd>node</kbd> in the PATH.","statusLine.scriptHint":"It only saves the status, model and tokens of each conversation, and how much of your quota is left, in the app's folder. It doesn't save your email, your plan or the cost, which the CLI also passes to it, and it doesn't print anything: the CLI's own line stays as it is.","statusLine.scriptSection":"What the script does","statusLine.title":"{{agent}} status line","statusLine.whereHint":"The app doesn't touch that file: you edit it.","statusLine.whereSection":"Where","summary.alsoWorksWith":"Also works with: {{names}}","summary.newerServer":"The server is from a newer version than this page (protocol {{server}}, this page uses {{page}}). Reload the page with F5.","summary.outdatedServer":"The running server is from an older version than this page (protocol {{server}}, this page uses {{page}}). Restart it and reload the page.","support.dismiss":"Not now","support.link":"Support","support.notice":"If Agent Workbench is useful to you, consider supporting it.","tabs.aria.opening":"opening","tabs.aria.working":"working","tabs.close":"Close (Alt+W)","tabs.dot.busy":"The agent is working","tabs.dot.exited":"This tab's CLI has closed","tabs.dot.sleeping":"Sleeping: readable, no CLI open","tabs.dot.waiting":"The CLI is waiting for an answer from you","tabs.new":"New tab (Alt+T)","tabs.state.alive":"active","tabs.state.exited":"exited (code {{code}})","tabs.state.opening":"opening…","tabs.state.sleeping":"sleeping","terminal.exited":"the process exited (code {{code}})","terminal.replayTruncated":"earlier output trimmed","theme.dark":"Dark theme","theme.light":"Light theme","theme.system":"System theme","theme.title":"{{theme}} — click to change","thread.continueCli":"CLI","thread.copyMessage":"Copy this message's text","thread.empty.noMessages":"The session doesn't have any messages yet.","thread.empty.unavailable":"This tab doesn't have a known directory, so there's no session file to follow.","thread.empty.waiting":"Waiting for the first message. The session file is created when the conversation starts.","thread.fold.less":"show less","thread.fold.more_one":"show {{count}} line","thread.fold.more_other":"show all {{count}} lines","thread.goToCli":"Go to the CLI tab","thread.image.alt":"message image","thread.image.gone":"the image is no longer in the file","thread.image.loading":"loading image…","thread.image.openTitle":"Click to see it full size","thread.jumpToEnd":"Jump to the end","thread.jumpToEndNew_one":"Jump to the end: {{count}} new message","thread.jumpToEndNew_other":"Jump to the end: {{count}} new messages","thread.jumpToOwn":"Jump to your previous message","thread.loadEarlier":"Load earlier messages","thread.loadingMore":"Loading...","thread.notice.compacted":"Context compacted","thread.notice.compactedAuto":"Context compacted automatically","thread.notice.error":"The CLI returned an error: {{detail}}","thread.notice.errorNoDetail":"The CLI returned an error","thread.notice.interrupted":"Interrupted","thread.openFolder":"Open {{path}} in the system's file explorer","thread.openInFiles":"Open {{path}} in the Files tab","thread.pasted_one":"Pasted text #{{number}} · {{count}} line","thread.pasted_other":"Pasted text #{{number}} · {{count}} lines","thread.question.answerInCli":"Answer in the CLI tab","thread.question.answered":"Answered","thread.question.closed":"The CLI closed with this question open","thread.question.multi":"multiple","thread.question.noCli":"Can't answer without the CLI open","thread.question.pickEach":"Pick an option in each question · you can also answer in the CLI tab","thread.question.pickOne":"Pick an option · you can also answer in the CLI tab","thread.question.placeholder":"Write your answer","thread.question.send":"Send","thread.question.sendAnswers":"Send answers","thread.question.useText":"Use this text","thread.question.writeOther":"Write another answer…","thread.question.writeOtherHint":"To suggest an alternative, or give more context","thread.queue.edit":"Edit","thread.queue.editTitle_one":"Takes it out of the queue and brings it to the message box to edit. ↑ in the empty box does the same","thread.queue.editTitle_other":"Takes the {{count}} queued messages out together and brings them to the message box: the CLI doesn't take out just one. ↑ in the empty box does the same","thread.queue.editing":"Bringing it back…","thread.queue.forceBlocked":"The CLI is waiting for your answer: answer it first","thread.queue.forceSend":"Force send now","thread.queue.forceSendTitle":"The agent stops what it's doing and reads your message now. Use it when it's heading the wrong way","thread.queue.forced":"sent to the agent","thread.queue.forcedTitle":"You forced the send: the CLI is handing it to the agent, and it shows up in the conversation once the CLI records it","thread.queue.forcing":"Sending…","thread.queue.images_one":"+{{count}} image","thread.queue.images_other":"+{{count}} images","thread.queue.label":"queued","thread.queue.labelTitle":"You sent it while the agent was working: the CLI hands it over when the agent can read it","thread.rewind":"Go back to before this message","thread.rewindBusy":"Stop the agent first to go back to before this message","thread.search.next":"Next","thread.search.none":"no results","thread.search.placeholder":"Search the conversation","thread.search.previous":"Previous","thread.status.awaitingReply":"Delivered to the CLI · no reply yet · {{elapsed}}","thread.status.delivered":"Delivered to the CLI","thread.status.sending":"Sending to the CLI…","thread.status.subagent":"{{name}} ({{elapsed}})","thread.status.subagentUnnamed":"unnamed","thread.status.subagentsMore_one":"{{count}} more","thread.status.subagentsMore_other":"{{count}} more","thread.status.subagents_one":"{{count}} subagent still working: {{list}}","thread.status.subagents_other":"{{count}} subagents still working: {{list}}","thread.status.working":"The agent is working…","thread.status.workingDelivered":"The agent is working · message delivered","thread.status.workingFor":"The agent is working · {{elapsed}}","thread.status.workingForDelivered":"The agent is working · {{elapsed}} · message delivered","thread.tool.error":"error","thread.tool.imagesNotSent_one":"({{count}} image: not sent to the panel)","thread.tool.imagesNotSent_other":"({{count}} images: not sent to the panel)","thread.tool.images_one":"{{count}} image","thread.tool.images_other":"{{count}} images","thread.tool.input":"input","thread.tool.noOutput":"(no output)","thread.tool.orphanResult":"orphan result","thread.tool.result":"result","thread.truncated":"… (truncated)","thread.turn.effort":"effort {{effort}}","thread.turn.queued":"sent while it was working","thread.turn.queuedTitle":"You wrote it while the agent was working: it went into the turn already in progress","thread.turn.you":"You","thread.wake.exited":"This tab's CLI closed.","thread.wake.exitedWithCode":"This tab's CLI closed (exit code {{code}}).","thread.wake.open":"Open CLI","thread.wake.opening":"Opening…","thread.wake.sleeping":"You're reading this conversation without the CLI open. Open it to write to the agent.","threadFont.size.l":"large","threadFont.size.m":"normal","threadFont.size.s":"small","threadFont.title":"Font size: {{current}} (click: {{next}})","time.daysAgo":"{{count}} d ago","time.hoursAgo":"{{count}} h ago","time.justNow":"just now","time.minutesAgo":"{{count}} min ago","tools.run.agent_one":"{{count}} subagent","tools.run.agent_other":"{{count}} subagents","tools.run.callsTo_one":"{{count}} call to {{name}}","tools.run.callsTo_other":"{{count}} calls to {{name}}","tools.run.edit_one":"{{count}} edit","tools.run.edit_other":"{{count}} edits","tools.run.find_one":"{{count}} project search","tools.run.find_other":"{{count}} project searches","tools.run.read_one":"{{count}} file read","tools.run.read_other":"{{count}} files read","tools.run.shell_one":"{{count}} console command","tools.run.shell_other":"{{count}} console commands","tools.run.todo_one":"{{count}} to-do list","tools.run.todo_other":"{{count}} to-do lists","tools.run.web_one":"{{count}} search","tools.run.web_other":"{{count}} searches","vault.archived":"Archived sessions aren't copied, and archiving one that was already copied doesn't delete its copy. The app never deletes anything from this folder.","vault.busy":"A backup operation is in progress. Wait for it to finish.","vault.button.off":"Backup: off. Set it up","vault.button.on":"Backup: on. See the status and the folder","vault.dialog.activate":"Turn on","vault.dialog.activateExistingHint":"The folder already has a backup. Once on, it completes it and keeps it up to date.","vault.dialog.activateExistingTitle":"The folder already has a backup: turning it on completes it","vault.dialog.activateMeasuredHint":"Copies everything measured and, after that, every session that changes and stays quiet for a minute.","vault.dialog.activateMeasuredTitle":"Copies what was measured now and, after that, every session that changes","vault.dialog.changeDir":"Change folder…","vault.dialog.changeDirTitle":"Choose another folder. What was copied gets copied there; this one stays untouched","vault.dialog.defaultDir":"It's the default one, in the app's folder.","vault.dialog.folderSection":"Folder","vault.dialog.inFolder":"In the folder","vault.dialog.lastError":"Last error","vault.dialog.lastPass":"last pass {{when}}","vault.dialog.measure":"Measure","vault.dialog.measureAgain":"Measure again","vault.dialog.measureTitle":"Reads the whole history without writing anything, not even the folder","vault.dialog.needsMeasure":"First measure how much it would take: then “{{activate}}” shows up.","vault.dialog.openFolder":"Open folder","vault.dialog.openFolderTitle":"Open the folder in the system's file explorer","vault.dialog.pendingCalm_one":"{{count}} waiting for its quiet minute","vault.dialog.pendingCalm_other":"{{count}} waiting for their quiet minute","vault.dialog.sizeSection":"How much it would take","vault.dialog.table.archived":"Archived","vault.dialog.table.archivedTitle":"Archived sessions aren't copied","vault.dialog.table.images":"Images","vault.dialog.table.memory_one":"Memory of {{count}} project","vault.dialog.table.memory_other":"Memory of {{count}} projects","vault.dialog.table.sessions":"Sessions","vault.dialog.table.size":"Size","vault.dialog.table.total":"Total","vault.dialog.turnOff":"Turn off","vault.dialog.turnOffHint":"Turning it off doesn't delete anything: what was copied stays in the folder.","vault.dialog.waiting":"Waiting for the server's status…","vault.export.done":"Exported: the folder was opened","vault.export.exporting":"Exporting to Markdown…","vault.export.idle":"Export this project's sessions to Markdown","vault.indexNotReady":"The history is still being read. Measure when it's done.","vault.line.copying":"copying","vault.line.copyingProgress":"copying {{done}} / {{total}}","vault.line.measuring":"measuring","vault.line.moving":"moving to another folder","vault.line.neverCopied":"not copied yet","vault.line.pending_one":"{{count}} waiting","vault.line.pending_other":"{{count}} waiting","vault.mark.copy":"backup","vault.mark.copyTitle":"The CLI's history no longer has this session. The backup opens, in Markdown.","vault.mark.partial":"partial","vault.mark.partialTitle":"Only the summary and the documents were recovered: the conversation's content is encrypted.","vault.measure.summary":"Measured {{when}}, in {{duration}}","vault.measure.summaryNoWhen":"Measured in {{duration}}","vault.name":"Backup","vault.note.empty_one":"{{count}} empty","vault.note.empty_other":"{{count}} empty","vault.note.failedWithReasons_one":"{{count}} failed ({{reasons}})","vault.note.failedWithReasons_other":"{{count}} failed ({{reasons}})","vault.note.failed_one":"{{count}} failed","vault.note.failed_other":"{{count}} failed","vault.note.notCopied":"Not copied: {{parts}}","vault.note.unsupported_one":"{{count}} without a full read","vault.note.unsupported_other":"{{count}} without a full read","vault.previousDir":"The previous folder was left untouched: {{dir}}","vault.privacy":"It keeps the same as each CLI's history —messages, tool inputs and results, images— in a folder of yours. If you put it in a synced folder or in a repository, all that travels with it.","vault.sessions_one":"{{count}} session","vault.sessions_other":"{{count}} sessions","vault.state.measuring":"Measuring…","vault.state.measuringProgress":"Measuring… {{done}} / {{total}}","vault.state.moving":"Moving to another folder…","vault.state.off":"Off","vault.state.on":"On","vault.state.writing":"Copying…","vault.state.writingProgress":"Copying… {{done}} / {{total}}","workspace.connectFailed":"Couldn't connect to the local server. Open the URL it printed at startup again.","worktree.actions.catchUp":"Catch up","worktree.actions.catchUpTitle":"Leaves in the branch's box, without sending it, the request to bring in {{base}} with a rebase that its agent runs","worktree.actions.integrate":"Merge into {{base}}","worktree.actions.integrateTitle":"Moves {{base}} up to the tip of the branch with git merge --ff-only, without creating commits. It shows the plan first","worktree.actions.review":"Ask for a review","worktree.actions.reviewTitle":"Another CLI reviews the branch in its folder, without touching it, and answers with a verdict","worktree.actions.sendReview":"Send to the branch","worktree.actions.sendReviewTitle":"Leaves the reviewer's answer in the box of the branch's tab, without sending it: you read it and send it","worktree.actions.showReviewer":"Show","worktree.actions.showReviewerTitle":"Go to the reviewer's tab","worktree.actions.viewChanges":"See changes","worktree.actions.viewChangesTitle":"What the branch brings against its base: its commits and files, read only","worktree.branch.characters":"Use only letters without accents, numbers, -, _, . and /.","worktree.branch.dots":"No .., and no part that starts or ends with a dot.","worktree.branch.empty":"Write a name for the branch.","worktree.branch.lock":"No part can end in .lock.","worktree.branch.reserved":"That name is reserved.","worktree.branch.slashes":"No / at the start or at the end, and never two in a row.","worktree.branch.startsWithDash":"It can't start with -.","worktree.branch.tooLong":"Too long: 100 characters at most.","worktree.changes.commits":"Commits","worktree.changes.empty":"The branch brings no commits against {{base}}.","worktree.changes.files":"Files","worktree.changes.loading":"Reading what the branch brings…","worktree.changes.more_one":"and {{count}} more","worktree.changes.more_other":"and {{count}} more","worktree.changes.title":"{{branch}} against {{base}}","worktree.changes.uncommitted_one":"The branch has {{count}} uncommitted file: it isn't here, it's in its tab's Changes.","worktree.changes.uncommitted_other":"The branch has {{count}} uncommitted files: they aren't here, they're in its tab's Changes.","worktree.copy.summary_one":"{{count}} file, {{size}}","worktree.copy.summary_other":"{{count}} files, {{size}}","worktree.create.agent":"CLI","worktree.create.baseMissing":"Choose the branch it starts from.","worktree.create.branch":"Branch","worktree.create.branchExists":'That branch already exists. To open it, choose "A branch that already exists".',"worktree.create.branchInUse":"That branch is already open in another folder.","worktree.create.branchPlaceholder":"e.g. fix-login","worktree.create.command":"Command","worktree.create.copyList":"{{summary}}: {{list}}.","worktree.create.copyNone":"The repository doesn't ignore any instructions or memory, so there's nothing to copy.","worktree.create.copyNotes":"Copy the instructions and memory the repository ignores.","worktree.create.copySection":"Ignored notes","worktree.create.creating":"Creating…","worktree.create.folder":"Folder","worktree.create.include":"What .worktreeinclude asks for is copied too: {{summary}}.","worktree.create.includeOverCap":"What .worktreeinclude asks for is over the limit ({{summary}}), so it isn't copied.","worktree.create.intro":"The branch gets its own folder next to {{project}}, so its agent works without touching the main folder or the other branches. Only if you want it: projects where you don't open one stay as they are.","worktree.create.loading":"Reading the repository…","worktree.create.mainChanges_one":"The main folder has {{count}} file with uncommitted changes: the new branch starts from the last commit and doesn't take it.","worktree.create.mainChanges_other":"The main folder has {{count}} files with uncommitted changes: the new branch starts from the last commit and doesn't take them.","worktree.create.modeExisting":"A branch that already exists","worktree.create.modeNew":"New branch, from","worktree.create.noFreeBranch":"Every other branch is already open in a folder.","worktree.create.overCap":"{{summary}}: over the limit, so they aren't copied.","worktree.create.submit":"Create and open","worktree.create.title":"New session on a separate branch","worktree.deleteBranch.checkedOut":"The branch {{branch}} is open in a folder: remove that first.","worktree.deleteBranch.deleting":"Deleting…","worktree.deleteBranch.done":"The branch {{branch}} was deleted.","worktree.deleteBranch.intro":"The branch is already merged into {{base}}: no commit is lost, and its conversations can still be reopened from the sidebar.","worktree.deleteBranch.loading":"Looking at the branch…","worktree.deleteBranch.noBase":"{{base}} is gone: there's no way to know whether the branch has unmerged commits, so it isn't deleted from here. Delete it in the terminal if you know nothing is lost.","worktree.deleteBranch.notIntegrated_one":"It has {{count}} commit that {{base}} doesn't: it isn't deleted from here, so it isn't lost. Reopen it from the sidebar and merge it, or delete it in the terminal.","worktree.deleteBranch.notIntegrated_other":"It has {{count}} commits that {{base}} doesn't: it isn't deleted from here, so they aren't lost. Reopen it from the sidebar and merge it, or delete it in the terminal.","worktree.deleteBranch.submit":"Delete","worktree.deleteBranch.title":"Delete the branch {{branch}}","worktree.integrate.blockerBehind":"{{base}} moved ahead: catch up first.","worktree.integrate.blockerLocal_one":"The {{base}} folder has uncommitted changes in {{count}} file the branch touches, and git would refuse: {{list}}. Commit or undo it there first.","worktree.integrate.blockerLocal_other":"The {{base}} folder has uncommitted changes in {{count}} files the branch touches, and git would refuse: {{list}}. Commit or undo them there first.","worktree.integrate.blockerNoBase":"{{base}} isn't checked out in any folder.","worktree.integrate.blockerNothing":"There's nothing to merge: the branch has no commits that {{base}} lacks.","worktree.integrate.branchUncommitted_one":"The branch has {{count}} uncommitted file: it doesn't go in.","worktree.integrate.branchUncommitted_other":"The branch has {{count}} uncommitted files: they don't go in.","worktree.integrate.command":"Command","worktree.integrate.doneOthers":"The other branches will say that {{base}} moved ahead. The separate branch is still there: you can remove it now.","worktree.integrate.done_one":"Done: {{base}} now has the branch's {{count}} commit.","worktree.integrate.done_other":"Done: {{base}} now has the branch's {{count}} commits.","worktree.integrate.files_one":"{{count}} file changes: {{list}}","worktree.integrate.files_other":"{{count}} files change: {{list}}","worktree.integrate.folder":"Where","worktree.integrate.integrating":"Merging…","worktree.integrate.intro_one":"{{count}} commit goes into {{base}}, with no new commit: {{base}} moves forward to the branch's tip.","worktree.integrate.intro_other":"{{count}} commits go into {{base}}, with no new commit: {{base}} moves forward to the branch's tip.","worktree.integrate.loading":"Putting the plan together…","worktree.integrate.noReview":"Nobody reviewed this branch. That doesn't stop the merge: it's your call.","worktree.integrate.notesStay":"These notes changed on both sides and can't be combined on their own: {{list}}. They stay in the branch, and you decide what to do with them when you remove it.","worktree.integrate.notesStayed":"These stayed in the branch, because they can't be combined on their own: {{list}}. You decide what to do with them when you remove it.","worktree.integrate.remove":"Remove the separate branch","worktree.integrate.removeTitle":"Opens the plan to remove its folder","worktree.integrate.submit":"Merge","worktree.integrate.tabs":"The files of these tabs change: {{list}}.","worktree.integrate.title":"Merge {{branch}} into {{base}}","worktree.integrate.titleLoading":"Merge {{branch}}","worktree.new":"New session on a separate branch","worktree.notes.back_one":"{{count}} note goes back to the main folder.","worktree.notes.back_other":"{{count}} notes go back to the main folder.","worktree.notes.hide":"hide","worktree.notes.mergedMark":"combined","worktree.notes.merged_one":"{{count}} is combined with what changed there.","worktree.notes.merged_other":"{{count}} are combined with what changed there.","worktree.notes.resolved_one":"The branch's agent already combined {{list}}: it stays as it is in the main folder.","worktree.notes.resolved_other":"The branch's agent already combined {{list}}: they stay as they are in the main folder.","worktree.notes.returned_one":"{{count}} note went back to the main folder.","worktree.notes.returned_other":"{{count}} notes went back to the main folder.","worktree.notes.show":"show which","worktree.remove.askCommit_one":"Ask the agent to commit it","worktree.remove.askCommit_other":"Ask the agent to commit them","worktree.remove.askNotes":"Ask the agent to combine them","worktree.remove.askTitle":"Leaves the request in the branch tab's message box, without sending it","worktree.remove.commands":"Commands","worktree.remove.conflicts":"These notes changed on both sides and can't be combined on their own: {{list}}. If you remove the branch now, what it changed in them is lost.","worktree.remove.deletesBranch":"It's already merged: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.deletesUnusedBranch":"It has no commits of its own: its folder and the branch {{branch}} are deleted. Its conversations can still be reopened from the sidebar.","worktree.remove.discard":"Remove and lose those changes","worktree.remove.discardFiles":"Remove and lose these files","worktree.remove.done":"The separate branch was removed.","worktree.remove.doneBranch":"The branch was deleted too.","worktree.remove.doneDiscardedFiles_one":"{{count}} new file was lost, as you chose.","worktree.remove.doneDiscardedFiles_other":"{{count}} new files were lost, as you chose.","worktree.remove.doneDiscarded_one":"{{count}} note was lost, as you chose.","worktree.remove.doneDiscarded_other":"{{count}} notes were lost, as you chose.","worktree.remove.holder":"{{program}} ({{exe}}, PID {{pids}})","worktree.remove.holderExe":"{{exe}} (PID {{pids}})","worktree.remove.inUse":"Another program has the folder open (an editor, a development server). Close it and try again.","worktree.remove.inUseBy_one":"{{list}} has the folder open. Close it and try again.","worktree.remove.inUseBy_other":"{{list}} have the folder open. Close them and try again.","worktree.remove.keepsBranch":"It isn't merged yet: its folder is removed, and the branch {{branch}} stays saved in Changes, to merge it or open it again.","worktree.remove.keepsExistingBranch":"The branch {{branch}} already existed: only its folder is removed, and the branch stays.","worktree.remove.loading":"Checking what's in its folder…","worktree.remove.removing":"Removing…","worktree.remove.retry":"Try again","worktree.remove.submit":"Remove","worktree.remove.tabs":"These close: {{list}}.","worktree.remove.title":"Remove the separate branch {{branch}}","worktree.remove.uncommitted_one":"It has {{count}} uncommitted file, and a branch with uncommitted work isn't removed:","worktree.remove.uncommitted_other":"It has {{count}} uncommitted files, and a branch with uncommitted work isn't removed:","worktree.remove.untrackedAccepted":"Lost along with the branch:","worktree.remove.untrackedCopied":"It has new uncommitted files, and among them something that was copied from the main folder and that this branch doesn't ignore: that isn't lost from here. Ask the agent to commit it or delete it:","worktree.remove.untrackedNestedRepo":"It has new uncommitted files, and there's a git repository inside (it may have commits that exist nowhere else): that isn't lost from here. If it's not needed, ask the agent to delete it:","worktree.remove.untrackedTooMany":"It has more than {{max}} new uncommitted files: too many to check and lose from here. If they're not needed, ask the agent to delete them:","worktree.remove.untracked_one":"It has {{count}} new uncommitted file ({{size}}). If it's work, ask the agent to commit it; if not, you can remove the branch and lose it:","worktree.remove.untracked_other":"It has {{count}} new uncommitted files ({{size}}). If they're work, ask the agent to commit them; if not, you can remove the branch and lose them:","worktree.review.author":"{{agent}} worked on the branch: another CLI sees what it takes for granted.","worktree.review.branchBusy":"The branch's tab is working: the review may see something half done.","worktree.review.deliveryPrefill":"The request waits in its box: you send it with Enter.","worktree.review.deliverySent":"The request is sent by itself when the CLI is ready.","worktree.review.guardCli":"{{agent}} starts read-only: it can't edit the branch.","worktree.review.guardNone":"{{agent}} can edit the branch's files: the request tells it not to.","worktree.review.guardTools":"{{agent}} starts without its edit tools, but its shell could still write: the request tells it not to.","worktree.review.intro":"Another CLI reviews what the branch brings against {{base}}, in its folder, and ends with a verdict. Testing it and merging are still up to you.","worktree.review.loading":"Looking at the branch…","worktree.review.nothing":"The branch has nothing to review against {{base}}.","worktree.review.prompt":"What it receives","worktree.review.quota":"Each review uses the quota of the CLI that reviews.","worktree.review.requesting":"Opening…","worktree.review.reviewer":"Who reviews","worktree.review.sameCli":"{{agent}} reviews, in a new conversation.","worktree.review.stale":"{{text}} (of an earlier commit)","worktree.review.stateChanges":"{{agent}} review: asks for changes","worktree.review.stateNone":"{{agent}} review: no verdict","worktree.review.statePending":"{{agent}} review: no answer yet","worktree.review.stateReady":"{{agent}} review: ready to merge","worktree.review.stateWorking":"{{agent}} review: in progress","worktree.review.submit":"Ask for the review","worktree.review.title":"Ask for a review of {{branch}}","worktree.review.uncommitted_one":"The branch has {{count}} uncommitted file: the reviewer looks at it too.","worktree.review.uncommitted_other":"The branch has {{count}} uncommitted files: the reviewer looks at them too.","worktree.rows.ahead_one":"{{count}} commit ahead","worktree.rows.ahead_other":"{{count}} commits ahead","worktree.rows.behind_one":"{{base}} has {{count}} new commit","worktree.rows.behind_other":"{{base}} has {{count}} new commits","worktree.rows.changes_one":"{{count}} uncommitted","worktree.rows.changes_other":"{{count}} uncommitted","worktree.rows.clean":"no changes","worktree.rows.current":"this tab","worktree.rows.deleteBranch":"Delete branch","worktree.rows.deleteBranchTitle":"Opens the plan to delete the branch, with git branch -d","worktree.rows.heading":"Separate branches","worktree.rows.headingTitle":"The other folders of this repository, each with its branch","worktree.rows.integrated":"merged","worktree.rows.kept":"folder removed","worktree.rows.keptTitle":"The app removed its folder and the branch is still in the repository: its conversations can be reopened from the sidebar","worktree.rows.main":"main folder","worktree.rows.mergeClean":"no conflicts","worktree.rows.mergeConflicts_one":"conflicts in {{count}} file: {{list}}","worktree.rows.mergeConflicts_other":"conflicts in {{count}} files: {{list}}","worktree.rows.notIntegrated_one":"{{count}} commit not merged","worktree.rows.notIntegrated_other":"{{count}} commits not merged","worktree.rows.open":"Open","worktree.rows.openTitle":"Go to its tab, or open one in that folder","worktree.rows.overlap":"{{branch}} touches it too: {{list}}","worktree.rows.remove":"Remove","worktree.rows.removeTitle":"Remove its folder; the branch stays unless it's already merged","worktree.sidebar.branchTitle":"Worked on the separate branch {{branch}}","worktree.sidebar.removed":"removed","worktree.sidebar.removedTitle":"This conversation worked on a separate branch whose folder was removed","worktree.sidebar.reopen":"Reopen the branch","worktree.sidebar.reopenTitle":"Reopen the branch: takes it out again in the same folder (if it was deleted, it's created again at the commit where it ended) and resumes this conversation","worktree.tab.linkedTitle":"Branch {{branch}}, apart from {{main}}","worktree.tab.mainTitle":"Branch {{branch}}, in the main folder","worktree.tab.review":"review","worktree.tab.reviewTitle":"Review tab: its CLI started read-only, if it has a way to"},Td=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],Lg="en",bu={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},Ry={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Ld={en:"en-US",es:"es-419",de:"de-DE",fr:"fr-FR","pt-BR":"pt-BR",ru:"ru-RU",ja:"ja-JP",ko:"ko-KR","zh-CN":"zh-CN"},My={es:()=>pr(()=>import("./es-CFiCJcc8.js"),[]),de:()=>pr(()=>import("./de-5zSaN2t-.js"),[]),fr:()=>pr(()=>import("./fr-C7R68L38.js"),[]),"pt-BR":()=>pr(()=>import("./pt-BR-CULiM_-O.js"),[]),ru:()=>pr(()=>import("./ru-D8gI2TvJ.js"),[]),ja:()=>pr(()=>import("./ja-CsWmKRl-.js"),[]),ko:()=>pr(()=>import("./ko-DakWHUDB.js"),[]),"zh-CN":()=>pr(()=>import("./zh-CN-BYr9GmHu.js"),[])},Ng=Ny,Qu=new Map([["en",Ng]]),gp=new Map,Ju=new Set;let Oo=Lg,Zu=Ld[Lg],vp=0;function Rg(t){return Td.includes(t)}function ed(){return Oo}function Gs(){return Zu}function Ay(t){return Ld[t]}function Mg(t){return Ju.add(t),()=>Ju.delete(t)}async function Ag(t,e=Ld[t]){const s=++vp;if(!Qu.has(t)&&t!=="en"){const l=await My[t]();Qu.set(t,l.default)}if(s===vp&&!(Oo===t&&Zu===e)){Oo=t,Zu=e;for(const l of Ju)l()}}function Iy(t,e){let s=gp.get(t);return s===void 0&&(s=new Intl.PluralRules(t),gp.set(t,s)),s.select(e)}function _p(t,e,s,l){if(l!==void 0){const u=t[`${s}_${Iy(e,l)}`]??t[`${s}_other`];if(u!==void 0)return u}return t[s]}function jy(t,e,s,l){const u=l==null?void 0:l.count,y=typeof u=="number"?u:void 0;return(t===void 0?void 0:_p(t,e,s,y))??_p(Ng,"en",s,y)??s}function ga(t,e){return e===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(s,l)=>{const u=e[l];return u===void 0?s:String(u)})}function Ig(t,e){return jy(Qu.get(Oo),Oo,t,e)}function v(t,e){return ga(Ig(t,e),e)}function Dy(){return[{keys:"Esc",description:v("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:v("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:v("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:v("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:v("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:v("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:v("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:v("agent.shortcuts.codex.searchHistory")},{keys:"@",description:v("agent.shortcuts.codex.mention")},{keys:"/",description:v("agent.shortcuts.commands")},{keys:"Ctrl + G",description:v("agent.shortcuts.codex.externalEditor")}]}function Py(){return[{keys:"Esc Esc",description:v("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:v("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:v("agent.shortcuts.opencode.commandList")},{keys:v("agent.shortcuts.leaderThen",{key:"M"}),description:v("agent.shortcuts.opencode.model")},{keys:v("agent.shortcuts.leaderThen",{key:"N"}),description:v("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:v("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:v("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:v("agent.shortcuts.opencode.paste")}]}function Oy(){return[{keys:"Esc",description:v("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:v("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:v("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:v("agent.shortcuts.commands")},{keys:"?",description:v("agent.shortcuts.antigravity.help")}]}function By(){return[{keys:"Esc",description:v("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:v("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:v("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:v("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:v("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:v("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:v("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:v("agent.shortcuts.pi.newline")},{keys:"!",description:v("agent.shortcuts.pi.bash")},{keys:"/",description:v("agent.shortcuts.commands")}]}function Fy(){return[{keys:"Esc",description:v("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:v("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:v("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:v("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:v("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:v("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:v("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:v("agent.shortcuts.claudeCode.pasteText")}]}const vs={"claude-code":{shortLabel:"CC",get shortcuts(){return Fy()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1,compactCommand:"/compact"},codex:{shortLabel:"CX",get shortcuts(){return Dy()},get shortcutsNote(){return v("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},opencode:{shortLabel:"OC",get shortcuts(){return Py()},get shortcutsNote(){return v("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},antigravity:{shortLabel:"AG",get shortcuts(){return Oy()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0,compactCommand:"/compact"},pi:{shortLabel:"PI",get shortcuts(){return By()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking",compactCommand:"/compact"}};function Hy(t){return(t===null?void 0:vs[t].effortCommand)??Sd}function Uy(t){return t===null?null:vs[t].compactCommand}const $y={"gemini-cli":"GC","antigravity-ide":"AI"};function Wy(t){return Di(t)?vs[t].shortLabel:$y[t]}function zo(t,e){var s;return Di(t)?((s=e.find(l=>l.id===t))==null?void 0:s.label)??t:jw[t]}const jg="Sesion sin titulo";function mr(t,e){return e==="none"||t===jg?v("session.untitled"):t}function zy(t,e){const s=new Map;for(const u of e)u.titleSource==="none"||u.title===jg||s.set(`${u.agent}\0${u.sessionId}`,u.title);const l=new Map;for(const u of t){if(u.agent===null||u.sessionId.length===0)continue;const y=s.get(`${u.agent}\0${u.sessionId}`);y!==void 0&&l.set(u.terminalId,y)}return l}function va(t){return t.storage==="native"&&Di(t.agent)}function qy(t){return t!==null&&vs[t].savesModelChoice}function Vy(t,e,s){if(e!=null)return e;for(let l=t.length-1;l>=0;l-=1){const u=t[l];if(!(u===void 0||u.effort===null))return s===null||u.at>=s?u.effort:null}return null}function Ky(t){return t===null?null:vs[t].instructionsFile}function Gy(t,e=!1){const s=t.permissionCycle,l=Uw(t,e);return{modeCycle:s===null||l===null||l===s.launchMode?s:{...s,launchMode:l},models:t.models,efforts:t.efforts,imagesAllowed:t.imagesByPath!==null,rewind:t.rewind,questionsAnswerable:t.questionCards,fileMentions:t.fileMentions!==null,plansAvailable:t.plans,contextWindowSource:t.contextWindowSource,noteSendable:t.readySignal,forceSend:t.forceSend,editQueue:t.editQueue,scheduledSend:t.scheduledSend}}function Yy(t,e){const s=ob(e,t);return s===null?null:t.find(l=>l.value===s.value)??null}function Xy(t,e){return t??e.launchMode}const Qy={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},Jy={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function Dg(t){return v(Qy[t])}function Zy(t){return v(Jy[t])}function ek(t,e){return v("agent.mode.title",{mode:Dg(t),hint:Zy(t),key:e.keyLabel})}function Pg(t,e){return t.approvesPendingOnCycle&&e!==null}function tk(t,e,s,l){if(Pg(e,l))return v("agent.mode.blocked");const u=ek(t,e);return!e.approvesPendingOnCycle||s?u:v("agent.mode.titleBlind",{title:u})}const nk={active:"agent.statusLine.state.active",missing:"agent.statusLine.state.missing","other-command":"agent.statusLine.state.otherCommand",disabled:"agent.statusLine.state.disabled",unreadable:"agent.statusLine.state.unreadable"};function rk(t){return v(nk[t])}function sk(){return v("agent.statusLine.noFragment")}function ik(t,e){return t.fragment===null?null:v("statusLine.agentPrompt",{agent:e,path:t.settingsPath,fragment:t.fragment})}function ok(t,e){return t.filter(s=>s.available&&!e.includes(s.id)&&s.statusLine!==null&&s.statusLine.state!=="active"&&!s.capabilities.scheduledSend)}function lk(t,e,s=new Set){return t.filter(l=>(e||l.id!=="plans")&&(l.id==="cli"||!s.has(l.id)))}function ak(t,e,s=new Set){return t==="plans"&&!e||t!=="cli"&&s.has(t)?"cli":t}function ck(t,e,s){const l=u=>u===null?void 0:e.find(y=>y.id===u);return l(t)??l(s)??e[0]??null}function uk(t){return[{keys:"Enter",description:v("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:v("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:v(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:v("agent.shortcuts.interruptCli")}]}function wp(){return v("agent.composer.imagesRefused")}function dk(t,e,s){return e.compacted===!0&&e.contextWindow!==null&&e.contextWindowEstimated!==!0?e.contextWindow:s??(t==="token-count"||t==="status-line"?e.contextWindow:null)}function hk(t,e){return e.compacted===!0?!1:t==="status-line"?e.lastRequestTokens>0:e.assistantMessages>0}function fk(t,e){return t===null&&e!==null&&e.state!=="active"}function pk(t){return v(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function mk(t,e){return e.contextWindowEstimated?v("agent.meter.origin.estimated"):t==="usage-with-catalog"&&e.contextWindow!==null?v("agent.meter.origin.catalog"):null}function gk(t,e=null,s=!1){return s?v("agent.meter.idle.compacted"):e==="status-line"?v("agent.meter.idle.statusLine"):t===null?v("agent.meter.idle.noFile"):v("agent.meter.idle.withFile",{file:t})}function vk(t,e=null){return t==="idle"?v("agent.dot.idle"):t==="unknown"?e===null?v("agent.dot.noStatus"):e.state==="active"?v("agent.dot.statusLinePending"):v("agent.dot.statusLineOnly"):v("agent.dot.open")}function bp(t,e){return t.length===0?!0:t.some(s=>s.id===e&&s.available&&s.capabilities.resume)}function _k(t,e,s){return t?s?v("agent.note.empty"):v("agent.note.send",{cwd:e??""}):v(e===null?"agent.note.needsTab":"agent.note.noReadySignal")}function wk(t,e,s){return t===null?v("notes.toComposer.needsTab"):e?v("agent.note.empty"):s?v("notes.toComposer.title",{tab:t}):v("notes.toComposer.loading")}function Og(t,e,s){const l=vr(e,s);let u=null;for(const y of t)y.kind!=="agent"||y.agent===null||vr(y.cwd,s)===l&&(u=y.agent);return u}function Bg(t,e){var l;const s=e.filter(u=>u.available);for(const u of t)if(u!==null&&s.some(y=>y.id===u))return u;return((l=s[0])==null?void 0:l.id)??null}function bk(t){let e=null;for(const s of t){const l=s.agent;Di(l)&&(e===null||s.updatedAt>e.updatedAt)&&(e={agent:l,updatedAt:s.updatedAt})}return(e==null?void 0:e.agent)??null}function yk(t,e,s,l,u){return Bg([Og(t,e,s),u],l)}function yp(t,e,s,l,u){return Bg([Og(t,e.cwd,s),bk(e.sessions),u],l)}function td(t){return t.filter(e=>e.available)}function kk(t,e){const s=t.findIndex(l=>l.id===e);return s===-1?0:s}function Ck(t,e,s){return s<=0?0:((t+e)%s+s)%s}function Fg(t,e,s,l=4){const u=t.bottom+2,y=t.top-2-e.height,b=u+e.height+l<=s.height||y<l?Math.max(l,Math.min(u,s.height-e.height-l)):y;return{left:Math.max(l,Math.min(t.left,s.width-e.width-l)),top:b}}function Hg(t,e,s){const l=t;return l===null||typeof l!="object"||typeof l.contains!="function"?!0:s!==null&&s.contains(t)?!1:l.contains(e)}function Ug(t,e,s=!1,l=!1){return e===null||s?[]:l?td(t):yd(t)?td(t).filter(u=>u.id!==e):[]}function Nd(t=!1){return v(t?"agent.continue.titleMain":"agent.continue.title")}function Sk(t,e,s){return e?v("agent.continue.discovering"):t.length===0?v("agent.continue.noConversation"):s?null:v("agent.continue.noMessages")}function xk(t,e,s,l){const u=e>=s&&!l?s===1?v("agent.handoff.turns.single"):v("agent.handoff.turns.all",{count:s}):e===1?l?v("agent.handoff.turns.lastOneOfMore",{total:s}):v("agent.handoff.turns.lastOne",{total:s}):l?v("agent.handoff.turns.lastManyOfMore",{count:s,included:e}):v("agent.handoff.turns.lastMany",{count:s,included:e});return v("agent.handoff.notice",{label:t,turns:u})}const kp=40;function Cp(t){const e=t.replace(/\s+/g," ").trim(),s=[...e],l=s.length>kp?`${s.slice(0,kp).join("").trimEnd()}…`:e;return l.length>0?v("agent.handoff.tabLabel",{title:l}):v("agent.handoff.tabLabelNoTitle")}function Ek(){return v("agent.handoff.sending")}function Tk(t){return t===null?v("agent.queueReturned.noLabel"):v("agent.queueReturned.withLabel",{label:t})}function Lk(){return v("agent.stoppedEarly")}function Nk(t){switch(t){case"no-delivery":return v("agent.handoff.prefill.noDelivery");case"not-ready":return v("agent.handoff.prefill.notReady");case"send-failed":return v("agent.handoff.prefill.sendFailed")}}function $g(t,e){return t.trim().length===0?e:`${e}
|
|
46
|
-
|
|
47
|
-
${t}`}function Rk(t,e){return t&&e!==null}function Mk(t,e,s){if(!Di(t))return{badge:!0,unavailableTitle:null};const l=e.find(b=>b.id===t),u=e.some(b=>b.available),y=l!==void 0&&!l.available&&u;return{badge:s||y,unavailableTitle:y?v("agent.session.cliMissing",{label:l.label}):null}}function Ak(t,e,s){return t!==null&&e===""&&!s.sessionIdAtLaunch}function Ik(){return v("agent.thread.noTranscript")}function jk(){return v("agent.thread.discovering")}function Dk(t,e,s,l,u=null){return!l||!lg(t,u)||!e?null:s===null?v("agent.openTool.noLabel"):v("agent.openTool.withLabel",{label:s})}function Wg(t,e=!1){return v(t==="permission prompt"?"agent.waiting.permission":t==="question"&&e?"agent.waiting.question":"agent.waiting.answer")}function Pk(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function Ok(t){return t===null?v("agent.serverClosed.noLabel"):v("agent.serverClosed.withLabel",{label:t})}function Bk(){return v("agent.serverClosed.relaunch")}function Fk(){return v("agent.serverClosed.relaunching")}function Hk(t,e){const s=new Map,l=[];for(const[u,y]of t){const b=e.find(i=>i.terminalId===u);b===void 0||b.alive&&y==="exited"?l.push(u):s.set(u,b.alive?y:"exited")}return{phases:s,finished:l}}function Uk(t,e,s){var l;return!s||e===null||((l=t.permissionCycle)==null?void 0:l.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:Wg(e,t.questionCards)}const Sp=2e4;function $k(t){if(t.label.length>0)return t.label;const e=t.cwd.split(/[\\/]/).filter(s=>s.length>0);return e[e.length-1]??t.cwd}function Wk(t,e,s){const l=t.map(y=>({terminalId:y.terminalId,kind:y.kind,cwd:y.cwd,worktree:y.worktree??null})),u=[];for(const y of e){const b=yy(l.map(i=>i.terminalId),i=>l.find(a=>a.terminalId===i),{kind:"agent",cwd:y.cwd},s);u.push({pending:y,index:b,label:$k(y)}),l.splice(b,0,{terminalId:`pending:${y.requestId}`,kind:"agent",cwd:y.cwd})}return u}function xp(t,e,s){const l=vr(e,s);return t.some(u=>vr(u.cwd,s)===l)}function zg(){return v("agent.openBlocked")}const zk={off:"controls.effort.off",minimal:"controls.effort.minimal",low:"controls.effort.low",medium:"controls.effort.medium",high:"controls.effort.high",xhigh:"controls.effort.xhigh",max:"controls.effort.max"};function qk(t){const e=zk[t.value];return e===void 0?t.label:v(e)}function Vk(t){return t.value==="default"?v("controls.model.default"):ib(t)}function Kk({models:t,efforts:e,model:s,effort:l,modelProvisional:u=!1,effortProvisional:y=!1,savesChoice:b=!1,effortCommandName:i=Sd,disabled:a,onCommand:g}){const _=t===null?null:Yy(t,s),h=_===null&&s!==null;return o.jsxs(o.Fragment,{children:[t!==null&&o.jsxs("select",{className:"agent-select",value:(_==null?void 0:_.value)??"",disabled:a,onChange:k=>{k.target.value.length>0&&g(ab(k.target.value))},title:s===null?v("controls.model.noData"):u?v("controls.model.provisional",{model:s}):b?v("controls.model.inUseSaved",{model:s}):v("controls.model.inUse",{model:s}),children:[_===null&&o.jsx("option",{value:"",children:h?s??"":v("controls.model.placeholder")}),t.map(k=>o.jsx("option",{value:k.value,children:Vk(k)},k.value))]}),e!==null&&o.jsxs("select",{className:"agent-select",value:l??"",disabled:a,onChange:k=>{k.target.value.length>0&&g(cb(k.target.value,i))},title:l===null?v("controls.effort.noData"):y?v("controls.effort.provisional",{effort:l}):b?v("controls.effort.inUseSaved",{effort:l,command:i}):v("controls.effort.inUse",{effort:l,command:i}),children:[l===null&&o.jsx("option",{value:"",children:v("controls.effort.placeholder")}),e.map(k=>o.jsx("option",{value:k.value,children:qk(k)},k.value))]})]})}function Gk({mode:t,cycle:e,disabled:s,waitingFor:l=null,statusKnown:u=!0,onChange:y}){const b=Xy(t,e);return o.jsx("select",{className:"agent-select agent-select-mode",value:b,disabled:s||Pg(e,l),onChange:i=>{Ks(i.target.value)&&y(i.target.value)},title:tk(b,e,u,l),children:e.modes.map(i=>o.jsx("option",{value:i,children:Dg(i)},i))})}function Bo(t){const e=t.replace(/(\r?\n)+$/,"");return e.length===0?0:e.split(`
|
|
48
|
-
`).length}function Yk(t,e){return e===0?v("composer.chip.pastedTextEmpty",{number:t}):v("composer.chip.pastedText",{number:t,count:e})}function qg(t){return t.length===0?1:Math.max(...t)+1}function Vg(t){const e=new Set;for(const s of t.matchAll(Ey()))e.add(Number(s[1]));return[...e].sort((s,l)=>s-l)}const Xk=/[^\s([{"'¿¡«]/u,Qk=/[\p{L}\p{N}]/u;function Jk(t,e,s,l){const{start:u,end:y,before:b,after:i}=Kg(t,e,s),a=`${b!==""&&Xk.test(b)?" ":""}${Ed(l)}${i!==""&&Qk.test(i)?" ":""}`;return Gg(t,u,y,a)}const Zk=/[^\s([{¿¡«]/u,eC=/[\p{L}\p{N}"'«]/u;function Ep(t,e,s,l){const{start:u,end:y,before:b,after:i}=Kg(t,e,s),a=b!==""&&Zk.test(b),g=i===""||eC.test(i),_=`${a?" ":""}${l}${g?" ":""}`;return Gg(t,u,y,_)}function Kg(t,e,s){const l=Math.max(0,Math.min(e,t.length)),u=Math.max(l,Math.min(s,t.length));return{start:l,end:u,before:l>0?t.charAt(l-1):"",after:u<t.length?t.charAt(u):""}}function Gg(t,e,s,l){return{text:`${t.slice(0,e)}${l}${t.slice(s)}`,inserted:l,caret:e+l.length}}function Yg(t,e){const s=new RegExp(`( ?)${nC(Ed(e))}( ?)`,"g");return t.replace(s,(l,u,y)=>u!==""&&y!==""?" ":"")}function Tp(t,e){let s=e;const l=[];for(const u of t){const y=u.text.replace(/\r\n?/g,`
|
|
49
|
-
`).replace(/\n+$/,"");if(y.trim().length===0){s=Yg(s,u.number);continue}l.push(`${ky(u.number)}
|
|
50
|
-
${y}
|
|
51
|
-
${Cy(u.number)}`)}return s.trim().length>0&&l.push(s),l.join(`
|
|
52
|
-
|
|
53
|
-
`)}function tC(t,e=!1){const s=t.replace(/\r\n?/g,`
|
|
54
|
-
`),l=[],u=a=>{const g=a.replace(/^\n+|\n+$/g,"");g.trim().length>0&&l.push({kind:"text",text:g})};let y=0;for(const a of s.matchAll(Sy())){const g=a[1]??"",_=(a.index??0)+g.length;u(s.slice(y,_)),l.push({kind:"pasted",number:Number(a[2]),text:a[3]??"",complete:!0}),y=(a.index??0)+a[0].length}const b=s.slice(y),i=e?xy().exec(b):null;if(i!==null){const a=i.index+(i[1]??"").length;u(b.slice(0,a)),l.push({kind:"pasted",number:Number(i[2]),text:b.slice(i.index+i[0].length),complete:!1})}else u(b);return l.some(a=>a.kind==="pasted")?l:[{kind:"text",text:t}]}function nC(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const rC=800;function _a(t){return{text:t.text,pasted:t.items.flatMap(e=>e.kind==="text"?[{number:e.number,text:e.text}]:[])}}function sC(t,e){return{text:t.text,items:t.pasted.map(s=>({id:e(),kind:"text",number:s.number,text:s.text,lines:Bo(s.text)}))}}function Lp(t,e,s){const l=[...t.items.flatMap(i=>i.kind==="text"?[i.number]:[]),...Vg(t.text)],u=[];for(const i of e.pasted){const a=qg([...l,...u.map(g=>g.kind==="text"?g.number:0)]);u.push({id:s(),kind:"text",number:a,text:i,lines:Bo(i)})}const y=u.map(i=>i.kind==="text"?Ed(i.number):"").join(" "),b=y.length===0?e.text:`${e.text}
|
|
55
|
-
|
|
56
|
-
${y}`;return{text:$g(t.text,b),items:[...t.items,...u]}}function iC(t,e){if(e===void 0)return{start:t,end:t,direction:"forward",scrollTop:"end"};const s=y=>Math.min(Math.max(0,y),t),l=s(e.selectionStart),u=Math.max(l,s(e.selectionEnd));return{start:l,end:u,direction:e.backward?"backward":"forward",scrollTop:Math.max(0,e.scrollTop)}}function oC(t){return _g(_a(t))>vg}function Ni(t,e){return t===void 0||ba(t)?ba(e):wg(t,e)}const Np={text:"",pasted:[]};function lC(t,e,s){const l=sC(t,s),u=((e==null?void 0:e.items)??[]).filter(y=>y.kind!=="text");return{text:l.text,items:[...l.items,...u]}}class aC{constructor(e){Wt(this,"local",new Map);Wt(this,"views",new Map);Wt(this,"saved",new Map);Wt(this,"heard",new Map);Wt(this,"unconfirmed",new Map);Wt(this,"submitting",new Map);Wt(this,"pending",new Map);Wt(this,"listeners",new Set);Wt(this,"serverKeeps",!1);this.deps=e}get(e){return this.local.get(e)}put(e,s){this.local.set(e,s),this.schedule(e,_a(s))}rememberView(e,s){this.views.set(e,s)}viewOf(e){return this.views.get(e)}submitted(e,s){this.cancel(e),this.local.delete(e),this.views.delete(e),this.saved.delete(e),this.unconfirmed.delete(e),this.submitting.set(e,s?"sent":"queued")}restore(e){const s=!this.serverKeeps;this.serverKeeps=!0;const l=[];for(const{terminalId:u,draft:y}of e)this.receive(u,y,s)&&l.push(u);for(const u of l)for(const y of this.listeners)y(u);for(const[u,y]of[...this.pending])y.handle===null&&this.sendNow(u)}reconnected(){this.serverKeeps=!1;for(const[e,s]of[...this.submitting])s==="sent"?this.submitting.delete(e):this.submitting.set(e,"sent")}retain(e){const s=new Set(e);for(const l of new Set([...this.local.keys(),...this.views.keys(),...this.saved.keys(),...this.heard.keys(),...this.unconfirmed.keys(),...this.submitting.keys(),...this.pending.keys()]))s.has(l)||(this.cancel(l),this.local.delete(l),this.views.delete(l),this.saved.delete(l),this.heard.delete(l),this.unconfirmed.delete(l),this.submitting.delete(l))}flushAll(){for(const e of[...this.pending.keys()])this.sendNow(e)}onRestored(e){return this.listeners.add(e),()=>this.listeners.delete(e)}receive(e,s,l){const u=this.heard.get(e);if(this.heard.set(e,s),this.submitting.has(e)){if(!ba(s))return!1;this.submitting.delete(e)}const y=this.unconfirmed.get(e);if(y!==void 0)if(Ni(y,s))this.unconfirmed.delete(e);else if(l)if(Ni(u,s)){this.unconfirmed.delete(e),this.setSaved(e,s);const g=this.local.get(e);return g!==void 0&&this.schedule(e,_a(g)),!1}else this.unconfirmed.delete(e);else return!1;const b=this.local.get(e),i=b===void 0?Np:_a(b),a=Ni(this.saved.get(e),i);return this.setSaved(e,s),this.pending.has(e)||!a||Ni(s,i)?!1:(this.local.set(e,lC(s,b,this.deps.newId)),this.views.delete(e),!0)}setSaved(e,s){ba(s)?this.saved.delete(e):this.saved.set(e,s)}schedule(e,s){const l=this.pending.get(e);if(l!==void 0&&wg(l.draft,s)||(this.cancel(e),Ni(this.saved.get(e),s)))return;const u=this.deps.setTimer(()=>this.sendNow(e),this.deps.delayMs??rC);this.pending.set(e,{handle:u,draft:s})}cancel(e){const s=this.pending.get(e);s!==void 0&&(s.handle!==null&&this.deps.clearTimer(s.handle),this.pending.delete(e))}sendNow(e){const s=this.pending.get(e);if(s===void 0)return;if(s.handle!==null&&this.deps.clearTimer(s.handle),!this.serverKeeps||!this.deps.connected()){this.pending.set(e,{handle:null,draft:s.draft});return}this.pending.delete(e);const l=_g(s.draft)>vg?Np:s.draft;Ni(this.saved.get(e),l)||(this.deps.send(e,l),this.unconfirmed.set(e,l),this.setSaved(e,l))}}const nd=1024,rd=nd*1024,Rp=rd*1024;function Mi(t,e=0){return new Intl.NumberFormat(Gs(),{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}function vn(t){return!Number.isFinite(t)||t<nd?v("format.bytes.b",{value:Mi(Math.max(0,Math.round(t)||0))}):t<rd?v("format.bytes.kb",{value:Mi(Math.round(t/nd))}):t<Rp?v("format.bytes.mb",{value:Mi(t/rd,1)}):v("format.bytes.gb",{value:Mi(t/Rp,2)})}function Xg(t){const e=Math.floor(t/60),s=t%60;return s===0?v("format.duration.minutes",{value:e}):v("format.duration.minutesSeconds",{minutes:e,seconds:s})}function cC(t){if(t<1e3)return v("format.duration.ms",{value:t});const e=Math.round(t/1e3);return e<60?v("format.duration.seconds",{value:e}):Xg(e)}function Fo(t){if(!Number.isFinite(t)||t<1e3)return v("format.duration.underSecond");const e=Math.round(t/1e3);return e<60?v("format.duration.seconds",{value:e}):Xg(e)}function qn(t,e=Date.now()){if(t<=0)return"";const s=Math.floor((e-t)/6e4);if(s<1)return v("time.justNow");if(s<60)return v("time.minutesAgo",{count:s});const l=Math.floor(s/60);if(l<24)return v("time.hoursAgo",{count:l});const u=Math.floor(l/24);return u<30?v("time.daysAgo",{count:u}):Rd(t)}function Rd(t){return new Date(t).toLocaleDateString(Gs())}function Ii(t){return new Date(t).toLocaleTimeString(Gs(),{hour:"2-digit",minute:"2-digit"})}function uC(t){return new Date(t).toLocaleString(Gs(),{weekday:"short",hour:"2-digit",minute:"2-digit"})}function qo(t){return new Date(t).toLocaleString(Gs(),{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function Md(t){const e=Math.floor(Math.max(0,t)/6e4);if(e<1)return v("format.timeLeft.underMinute");const s=Math.floor(e/1440),l=Math.floor(e%1440/60);return s>0?v("format.timeLeft.daysHours",{days:s,hours:l}):l>0?v("format.timeLeft.hoursMinutes",{hours:l,minutes:e%60}):v("format.timeLeft.minutes",{minutes:e})}function dC(t){return new Intl.NumberFormat(Gs(),{style:"percent",maximumFractionDigits:0}).format(t/100)}function _n(t){return new Intl.ListFormat(Gs(),{type:"conjunction"}).format(t)}var Ad=og();function Qg({src:t,caption:e,onClose:s}){return N.useEffect(()=>{const l=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopPropagation(),s())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[s]),Ad.createPortal(o.jsxs("div",{className:"viewer",onClick:s,role:"presentation",children:[o.jsx("div",{className:"viewer-frame",onClick:l=>l.stopPropagation(),children:o.jsx("img",{className:"viewer-image",src:t,alt:e})}),o.jsxs("div",{className:"viewer-bar",children:[o.jsx("span",{className:"viewer-caption",children:e}),o.jsx("button",{className:"viewer-close",onClick:s,title:v("common.closeEsc"),children:"×"})]})]}),document.body)}const hC=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,fC=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,pC=/^([ \t]*)([-*•])([ \t]+)/;function Mp(t){const e=hC.exec(t);if(e!==null){const[u,y="",b="",i=".",a=" "]=e;return{kind:"number",indent:y,value:Number(b),upper:!1,sep:i,space:a,length:u.length}}const s=fC.exec(t);if(s!==null){const[u,y="",b="a",i=" "]=s;return{kind:"letter",indent:y,value:b.toLowerCase().charCodeAt(0)-97,upper:b!==b.toLowerCase(),sep:")",space:i,length:u.length}}const l=pC.exec(t);if(l!==null){const[u,y="",b="-",i=" "]=l;return{kind:"bullet",indent:y,value:0,upper:!1,sep:b,space:i,length:u.length}}return null}function Ap(t,e){if(t.kind==="bullet")return`${t.indent}${t.sep}${t.space}`;if(t.kind==="number")return`${t.indent}${e}${t.sep}${t.space}`;if(e>25)return null;const s=String.fromCharCode(97+e);return`${t.indent}${t.upper?s.toUpperCase():s}${t.sep}${t.space}`}function mC(t,e){return t.kind===e.kind&&t.indent===e.indent&&t.sep===e.sep&&t.upper===e.upper}function gC(t,e,s){if(e!==s)return null;const l=t.lastIndexOf(`
|
|
57
|
-
`,e-1)+1,u=t.indexOf(`
|
|
58
|
-
`,e),y=u===-1?t.length:u,b=t.slice(l,y),i=Mp(b);if(i===null||e-l<i.length)return null;if(b.slice(i.length).trim().length===0)return{from:l,to:y,text:"",caret:l};const a=Ap(i,i.value+1);if(a===null)return null;let g="",_=y;if(i.kind!=="bullet"){let h=i.value+1;for(;_<t.length;){const k=_+1,T=t.indexOf(`
|
|
59
|
-
`,k),M=T===-1?t.length:T,w=t.slice(k,M),d=Mp(w);if(d===null||!mC(i,d)||d.value!==h)break;const m=Ap(d,d.value+1);if(m===null)break;g+=`
|
|
60
|
-
${m}${w.slice(d.length)}`,h+=1,_=M}}return{from:e,to:_,text:`
|
|
61
|
-
${a}${t.slice(e,y)}${g}`,caret:e+1+a.length}}const vC=768,_C=`(max-width: ${vC}px)`,wC="(hover: none)",Ip="agent-workbench.narrow-view",Jg="tab",Zg=["chat","cli","git","files","plans","memory","notes","console"];function bC(t){return typeof t=="string"&&Zg.includes(t)}function yC(t){return bC(t)?t:null}function kC(t){const e=t.hidden??new Set,s=l=>l==="chat"||l==="cli"||!e.has(l);return t.hasTab?Zg.filter(l=>(l!=="plans"||t.plansAvailable)&&s(l)):["chat","notes"].filter(s)}function CC(t,e){return e.includes(t)?t:"chat"}function jp(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const SC={chat:"narrow.view.chat",cli:"panel.tab.cli",git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",notes:"notes.name",console:"console.name"};function xC(t){return SC[t]}const EC=/^[A-Za-z0-9_-]{1,80}$/;function TC(t){const e=new URLSearchParams(t).get(Jg);return e!==null&&EC.test(e)?e:null}function LC(t,e){const s=new URLSearchParams(t);for(const u of e)s.delete(u);const l=s.toString();return l.length>0?`?${l}`:""}const NC=[{id:"esc",label:"Esc",data:"\x1B",titleKey:"narrow.keys.esc"},{id:"tab",label:"Tab",data:" ",titleKey:"narrow.keys.tab"},{id:"shift-tab",label:"⇧Tab",data:"\x1B[Z",titleKey:"narrow.keys.shiftTab"},{id:"up",label:"↑",data:"\x1B[A",titleKey:"narrow.keys.up"},{id:"down",label:"↓",data:"\x1B[B",titleKey:"narrow.keys.down"},{id:"left",label:"←",data:"\x1B[D",titleKey:"narrow.keys.left"},{id:"right",label:"→",data:"\x1B[C",titleKey:"narrow.keys.right"},{id:"interrupt",label:"^C",data:"",titleKey:"narrow.keys.interrupt"},{id:"ctrl-o",label:"^O",data:"",titleKey:"narrow.keys.ctrlO"},{id:"ctrl-x",label:"^X",data:"",titleKey:"narrow.keys.ctrlX"}];function RC(t,e){return t.shiftKey||t.altKey?!1:!e||t.ctrlKey||t.metaKey}const MC="AgentWorkbenchAndroid/",AC="agentworkbench://settings",IC="agentworkbench://disconnect",Dp="agentWorkbenchBack";function ev(t){return t.includes(MC)}function jC(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}function Pp(t,e){const s=e.replace(/^\s*\n/,"").trimEnd();if(s.trim().length===0)return null;const l=t.trimEnd();return{from:l.length,inserted:l.length===0?s:`
|
|
62
|
-
|
|
63
|
-
${s}`}}function DC(t,e,s){const l=[];return t.forEach((u,y)=>{const b=e[u.imageId];if(typeof b!="string")return;const i=OC(b);i!==null&&l.push({...i,dataUrl:b,name:s(y)})}),l}function PC(t,e){return t.every(s=>e[s.imageId]!==void 0)}function OC(t){const e=/^data:([^;,]+);base64,([A-Za-z0-9+/]*={0,2})$/.exec(t),s=e==null?void 0:e[1],l=e==null?void 0:e[2];if(s===void 0||l===void 0)return null;const u=l.endsWith("==")?2:l.endsWith("=")?1:0;return{mediaType:s,base64:l,bytes:l.length/4*3-u}}function At(t){if(!Mw(t.key))return t.key;let e;if(t.params!==void 0){const s={};for(const[l,u]of Object.entries(t.params))s[l]=typeof u=="object"?At(u):u;e=s}return v(`server.${t.key}`,e)}const tv=3600*1e3;function nv(t){const e=new Date(t+tv);e.setSeconds(0,0);const s=new Date(t);return s.setDate(s.getDate()+1),s.setHours(9,0,0,0),[{id:"in-hour",at:e.getTime()},{id:"tomorrow-morning",at:s.getTime()}]}function ka(t){return String(t).padStart(2,"0")}function sd(t){const e=new Date(t);return`${e.getFullYear()}-${ka(e.getMonth()+1)}-${ka(e.getDate())}`}function BC(t){const e=new Date(t);return`${ka(e.getHours())}:${ka(e.getMinutes())}`}function FC(t){var s;const e=((s=nv(t)[1])==null?void 0:s.at)??t+24*tv;return{date:sd(e),time:BC(e)}}function HC(t){return{min:sd(t),max:sd(t+Gu)}}function UC(t,e){const s=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t),l=/^(\d{2}):(\d{2})$/.exec(e);if(s===null||l===null)return null;const[u,y,b]=[Number(s[1]),Number(s[2]),Number(s[3])],[i,a]=[Number(l[1]),Number(l[2])];if(y<1||y>12||b<1||b>31||i>23||a>59)return null;const g=new Date(u,y-1,b,i,a,0,0);return g.getFullYear()!==u||g.getMonth()!==y-1||g.getDate()!==b?null:g.getTime()}function $C(t,e){return t===null?v("scheduled.menu.invalid"):t<=e?v("scheduled.menu.past"):t-e>Gu?v("scheduled.menu.tooFar",{days:Math.round(Gu/864e5)}):null}function WC(t,e){const s=qo(t);return t>e?v("scheduled.when.ahead",{when:s,left:Md(t-e)}):s}function zC(t,e){switch(t.state){case"scheduled":return v("scheduled.state.scheduled",{when:WC(t.sendAt,e)});case"waiting":return t.note===null?v("scheduled.state.due"):At(t.note);case"sending":return v("scheduled.state.sending");case"paused":return v("scheduled.state.paused",{when:qo(t.sendAt)});case"failed":return t.note===null?v("scheduled.state.failed"):At(t.note)}}function qC(t,e){return t===null||e===null?[]:t.filter(s=>s.terminalId===e).sort((s,l)=>s.sendAt-l.sendAt)}function rv(t){if(t.length===0)return null;const e=t.filter(l=>l.state==="failed").length;if(e>0)return v("scheduled.tab.failed",{count:e});const s=t[0];return s===void 0?null:v("scheduled.tab.next",{count:t.length,when:qo(s.sendAt)})}function VC(t){return t.some(e=>e.state==="failed")}function KC(t){const e=t.filter(l=>l.state!=="failed"),s=e[0];return s===void 0?null:v("scheduled.close.warning",{count:e.length,when:qo(s.sendAt)})}function GC(t){return t.state!=="sending"}const YC={"in-hour":"scheduled.menu.inHour","tomorrow-morning":"scheduled.menu.tomorrow"};function XC({anchor:t,onPick:e,onClose:s}){const[l]=N.useState(()=>Date.now()),u=N.useMemo(()=>nv(l),[l]),y=N.useMemo(()=>HC(l),[l]),[b,i]=N.useState(()=>FC(l)),a=UC(b.date,b.time),g=$C(a,Date.now()),[_,h]=N.useState(null),k=N.useRef(null),T=N.useRef(null),M=N.useRef(!1),w=N.useCallback(()=>{const d=k.current;if(d===null)return;const m=t.getBoundingClientRect(),p=d.getBoundingClientRect();h(Fg({left:m.left,top:m.top,bottom:m.bottom},{width:p.width,height:p.height},{width:window.innerWidth,height:window.innerHeight}))},[t]);return N.useLayoutEffect(w,[w]),N.useEffect(()=>{var d;_===null||M.current||(M.current=!0,(d=T.current)==null||d.focus())},[_]),N.useEffect(()=>{const d=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),s(),t.focus())},m=x=>{var E;const j=x.target;j instanceof Node&&((E=k.current)!=null&&E.contains(j)||t.contains(j))||s()},p=x=>{Hg(x.target,t,k.current)&&s()},f=()=>{t.isConnected?w():s()};return window.addEventListener("keydown",d,!0),document.addEventListener("pointerdown",m,!0),window.addEventListener("scroll",p,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("keydown",d,!0),document.removeEventListener("pointerdown",m,!0),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",f)}},[t,s,w]),Ad.createPortal(o.jsxs("div",{ref:k,className:"schedule-menu",role:"dialog","aria-label":v("scheduled.menu.title"),style:_===null?{left:0,top:0,visibility:"hidden"}:{left:`${_.left}px`,top:`${_.top}px`},children:[o.jsx("div",{className:"schedule-menu-title",children:v("scheduled.menu.title")}),u.map((d,m)=>o.jsxs("button",{ref:m===0?T:void 0,className:"schedule-menu-item",onClick:()=>e(d.at),children:[o.jsx("span",{className:"schedule-menu-label",children:v(YC[d.id])}),o.jsx("span",{className:"schedule-menu-when",children:qo(d.at)})]},d.id)),o.jsxs("div",{className:"schedule-menu-custom",children:[o.jsxs("label",{className:"schedule-menu-field",children:[o.jsx("span",{children:v("scheduled.menu.day")}),o.jsx("input",{type:"date",value:b.date,min:y.min,max:y.max,onChange:d=>i(m=>({...m,date:d.target.value}))})]}),o.jsxs("label",{className:"schedule-menu-field",children:[o.jsx("span",{children:v("scheduled.menu.time")}),o.jsx("input",{type:"time",value:b.time,onChange:d=>i(m=>({...m,time:d.target.value}))})]}),o.jsx("button",{className:"primary-button primary-button-small",disabled:g!==null||a===null,title:g??void 0,onClick:()=>{a!==null&&e(a)},children:v("scheduled.menu.schedule")})]}),g!==null&&o.jsx("p",{className:"schedule-menu-hint",children:g})]}),document.body)}const QC=6e4,JC=10*6e4,ZC=15e3,e1=4e3,t1=3,sv={runStartedAt:null,busySeenAt:null};function iv(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function n1(t,e){var l;let s=0;if(t!==null){const u=e.findIndex(y=>y.eventId===t);if(u===-1)return!0;s=u+1}for(let u=s;u<e.length;u+=1)if(((l=e[u])==null?void 0:l.role)==="assistant")return!0;return!1}function r1(t,e,s,l){const u=e==="busy"||t==="busy"?l:s.busySeenAt;let y=null;return e==="busy"?t==="idle"?y=l:(t==="busy"||t==="waiting")&&(y=s.runStartedAt):e==="waiting"&&(y=s.runStartedAt),{runStartedAt:y,busySeenAt:u}}function s1(t,e,s,l){const u=new Map;for(const[y,b]of e){const i=t.get(y),a=s.get(y);u.set(y,a!==void 0&&i===b?a:r1(i,b,a??sv,l))}return u}function i1(t,e){const s=new Map;for(const[l,u]of t)u.phase!=="sending"?s.set(l,u):u.queued&&s.set(l,{...u,queued:!1,sentAt:e});return s}function o1(t,e,s){const l=t.get(e.terminalId);if(l===void 0||l.requestId!==e.requestId)return t;const u=new Map(t);return e.delivered?u.set(e.terminalId,{...l,phase:"delivered",queued:!1,deliveredAt:s}):u.delete(e.terminalId),u}function l1(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:e,activity:s,now:l}=t,u=t.clock??sv;if((e==null?void 0:e.phase)==="sending"&&(e.queued||l-e.sentAt<QC))return{kind:"sending"};const y=(e==null?void 0:e.phase)==="delivered"?e.deliveredAt:null;return s==="busy"?{kind:"working",since:u.runStartedAt,justDelivered:y!==null&&l-y<e1}:e===null||y===null||n1(e.afterEventId,t.events)?null:s==="unknown"?l-y<JC?{kind:"awaiting-reply",since:y}:null:s!=="idle"&&s!==null||u.busySeenAt!==null&&u.busySeenAt>=e.sentAt?null:l-y<ZC?{kind:"delivered"}:null}function a1(t,e){switch(t.kind){case"sending":return v("thread.status.sending");case"delivered":return v("thread.status.delivered");case"working":{const s=t.since===null?0:e-t.since;if(s<1e3)return t.justDelivered?v("thread.status.workingDelivered"):v("thread.status.working");const l={elapsed:Fo(s)};return t.justDelivered?v("thread.status.workingForDelivered",l):v("thread.status.workingFor",l)}case"awaiting-reply":{const s=e-t.since;return s<1e3?v("thread.status.delivered"):v("thread.status.awaitingReply",{elapsed:Fo(s)})}}}function c1(t,e){const s=t.slice(0,t1).map(u=>v("thread.status.subagent",{name:u.description.length>0?u.description:v("thread.status.subagentUnnamed"),elapsed:Fo(Math.max(0,e-u.startedAt))})),l=t.length-s.length;return l>0&&s.push(v("thread.status.subagentsMore",{count:l})),v("thread.status.subagents",{count:t.length,list:_n(s)})}const u1=5,d1=1200;function ua(){return crypto.randomUUID()}function h1(t=!0){const[e,s]=N.useState([]),[l,u]=N.useState(null),y=N.useCallback(w=>{if(e.filter(m=>m.kind==="image").length>=Ro){u(v("composer.problem.tooManyImages",{count:Ro}));return}if(w.size>qs){const m=Math.round(w.size/1024/1024),p=qs/1024/1024;u(w.name.length>0?v("composer.problem.tooBig",{name:w.name,size:m,max:p}):v("composer.problem.imageTooBig",{size:m,max:p}));return}const d=new FileReader;d.onload=()=>{const m=d.result;if(typeof m!="string")return;const p=m.indexOf(",");p!==-1&&s(f=>f.filter(x=>x.kind==="image").length>=Ro?f:[...f,{id:ua(),kind:"image",mediaType:w.type,base64:m.slice(p+1),dataUrl:m,bytes:w.size,name:w.name.length>0?w.name:v("composer.pastedImage")}])},d.onerror=()=>u(v("composer.problem.imageUnreadable")),d.readAsDataURL(w)},[e]),b=N.useCallback(w=>{if(e.filter(m=>m.kind==="file").length>=_u){u(v("composer.problem.tooManyFiles",{count:_u}));return}if(w.size===0){u(v("composer.problem.empty",{name:w.name}));return}if(w.size>cp){u(v("composer.problem.tooBig",{name:w.name,size:Math.round(w.size/1024/1024),max:cp/1024/1024}));return}const d=new FileReader;d.onload=()=>{const m=d.result;if(typeof m!="string")return;const p=m.indexOf(",");p!==-1&&s(f=>f.filter(x=>x.kind==="file").length>=_u?f:[...f,{id:ua(),kind:"file",name:w.name.length>0?w.name:"archivo",base64:m.slice(p+1),bytes:w.size}])},d.onerror=()=>u(v("composer.problem.unreadable",{name:w.name})),d.readAsDataURL(w)},[e]),i=N.useCallback(w=>{const d=Array.from(w),m=d.filter(f=>f.type.startsWith("image/")),p=d.filter(f=>!f.type.startsWith("image/"));if(m.length>0&&!t)u(wp());else for(const f of m)y(f);for(const f of p)b(f)},[y,b,t]),a=N.useCallback((w,d=[])=>{if(w.files.length>0)return i(w.files),{consumed:!0,pastedNumber:null};const m=w.getData("text/plain");if(m.length===0)return{consumed:!1,pastedNumber:null};if(m.split(`
|
|
64
|
-
`).length<u1&&m.length<d1)return{consumed:!1,pastedNumber:null};const p=qg([...e.flatMap(f=>f.kind==="text"?[f.number]:[]),...d]);return s(f=>[...f,{id:ua(),kind:"text",number:p,text:m,lines:Bo(m)}]),{consumed:!0,pastedNumber:p}},[i,e]),g=N.useCallback(w=>{if(w.length===0)return;if(!t){u(wp());return}const d=Ro-e.filter(x=>x.kind==="image").length,m=w.filter(x=>x.bytes<=qs),p=w.find(x=>x.bytes>qs);p!==void 0&&u(v("composer.problem.imageTooBig",{size:Math.round(p.bytes/1024/1024),max:qs/1024/1024})),m.length>d&&u(v("composer.problem.tooManyImages",{count:Ro}));const f=m.slice(0,Math.max(0,d)).map(x=>({...x,id:ua(),kind:"image"}));f.length>0&&s(x=>[...x,...f])},[e,t]),_=N.useCallback(w=>{s(d=>d.filter(m=>m.id!==w))},[]),h=N.useCallback((w,d)=>{s(m=>m.map(p=>p.id===w&&p.kind==="text"?{...p,text:d,lines:Bo(d)}:p))},[]),k=N.useCallback(w=>{s(w),u(null)},[]),T=N.useCallback(()=>k([]),[k]),M=N.useCallback(()=>u(null),[]);return{items:e,problem:l,acceptPaste:a,acceptFiles:i,acceptImages:g,remove:_,updateText:h,replace:k,clear:T,dismissProblem:M}}function wa({min:t,max:e,value:s,measure:l,onChange:u,onCommit:y,onStart:b}){const i=N.useRef(!1),a=N.useRef(s),g=N.useCallback(k=>{i.current=!0,a.current=s,b==null||b(k),k.currentTarget.setPointerCapture(k.pointerId),k.preventDefault()},[b,s]),_=N.useCallback(k=>{if(!i.current)return;const T=Math.min(e,Math.max(t,l(k)));a.current=T,u(T)},[e,t,l,u]),h=N.useCallback(k=>{i.current&&(i.current=!1,k.currentTarget.releasePointerCapture(k.pointerId),y(a.current))},[y]);return{onPointerDown:g,onPointerMove:_,onPointerUp:h,onPointerCancel:h}}function ov(t){const[e,s]=N.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return N.useEffect(()=>{const l=window.matchMedia(t),u=()=>s(l.matches);return u(),l.addEventListener("change",u),()=>l.removeEventListener("change",u)},[t]),e}function f1(){return ov(_C)}function p1(){return ov(wC)}const lv="agent_workbench_prefs",id="agent-workbench.",av=/^[a-z0-9][a-z0-9.-]{0,59}$/,cv=200,m1=400*24*60*60,g1=3500;function v1(t){const e=new Map;for(const s of t.split(";")){const l=s.indexOf("=");if(l===-1||s.slice(0,l).trim()!==lv)continue;let u;try{u=JSON.parse(decodeURIComponent(s.slice(l+1).trim()))}catch{return e}if(u===null||typeof u!="object"||Array.isArray(u))return e;for(const[y,b]of Object.entries(u))!av.test(y)||typeof b!="string"||b.length>cv||e.set(`${id}${y}`,b);return e}return e}function _1(t){const e={};for(const[l,u]of t){if(!l.startsWith(id))continue;const y=l.slice(id.length);!av.test(y)||u.length>cv||(e[y]=u)}const s=encodeURIComponent(JSON.stringify(e));return s.length>g1?null:s}function w1(t){return`${lv}=${t}; Path=/; Max-Age=${m1}; SameSite=Strict`}function uv(){try{return v1(document.cookie)}catch{return new Map}}function dv(t,e){const s=uv();if(s.get(t)===e)return;s.set(t,e);const l=_1(s);if(l!==null)try{document.cookie=w1(l)}catch{}}function Dt(t,e,s){const l=uv().get(t);if(l!==void 0){const u=s(l);if(u!==null)return u}try{const u=window.localStorage.getItem(t);if(u===null)return e;const y=s(u);return y===null?e:(l===void 0&&dv(t,u),y)}catch{return e}}function Tt(t,e){dv(t,e);try{window.localStorage.setItem(t,e)}catch{}}function b1(t,e,s){const l=Number.parseInt(t,10);return Number.isFinite(l)&&l>=e&&l<=s?l:null}const Op=90,y1=260,Bp=720,Fp="agent-workbench.composer-height";function Hp(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function k1({connection:t,drafts:e,terminalId:s,alive:l,sleeping:u=!1,projectColor:y,activity:b,controls:i,leading:a,imagesAllowed:g=!0,blockedReason:_=null,prefills:h,onPrefillApplied:k,notice:T=null,onDismissNotice:M,onSubmitted:w,fontSize:d,insertRef:m,noteInsertRef:p,onEditQueue:f,onSchedule:x}){const[j,E]=N.useState(""),[R,S]=N.useState(!1),[L,I]=N.useState(null),P=h1(g),D=N.useRef(null),F=p1(),[W,$]=N.useState(()=>Dt(Fp,y1,re=>b1(re,Op,Bp))),[Y,G]=N.useState(!1),V=N.useCallback(()=>{const re=D.current;if(re===null)return;re.style.height="auto";const fe=re.offsetHeight-re.clientHeight,Le=re.scrollHeight+fe,Qe=Y?W:Math.min(Le,W);re.style.height=`${Qe}px`,re.style.overflowY=Le>Qe?"auto":"hidden"},[W,Y]);N.useEffect(V,[j,V,d]);const B=N.useRef(0),U=N.useRef(0),H=wa({min:Op,max:Bp,value:W,measure:N.useCallback(re=>B.current-re.clientY-U.current,[]),onChange:$,onCommit:N.useCallback(re=>{G(!1),Tt(Fp,String(re))},[]),onStart:N.useCallback(re=>{const fe=D.current,Le=fe==null?void 0:fe.getBoundingClientRect();B.current=(Le==null?void 0:Le.bottom)??re.clientY,U.current=((Le==null?void 0:Le.bottom)??re.clientY)-re.clientY-((Le==null?void 0:Le.height)??0),G(!0)},[])}),z=N.useRef(null),[Z,ie]=N.useState(0),_e=N.useCallback(()=>ie(re=>re+1),[]),ge=N.useRef(j);ge.current=j;const Q=N.useRef(P.items);Q.current=P.items;const{replace:K}=P;N.useEffect(()=>{const re=z.current;re!==null&&e.put(re,{text:j,items:P.items})},[j,P.items,e]),N.useEffect(()=>{var Le;const re=z.current;if(re===s)return;if(z.current=s,re!==null){e.put(re,{text:ge.current,items:Q.current});const Qe=D.current;Qe!==null&&e.rememberView(re,Hp(Qe))}const fe=s===null?void 0:e.get(s);E((fe==null?void 0:fe.text)??""),K((fe==null?void 0:fe.items)??[]),_e(),s!==null&&((Le=D.current)==null||Le.focus())},[s,K,e,_e]),N.useEffect(()=>()=>{const re=z.current;re!==null&&e.put(re,{text:ge.current,items:Q.current})},[e]),N.useLayoutEffect(()=>()=>{const re=z.current,fe=D.current;re!==null&&fe!==null&&e.rememberView(re,Hp(fe))},[e]),N.useEffect(()=>{if(Z===0)return;const re=z.current,fe=D.current;if(re===null||fe===null)return;const Le=iC(fe.value.length,e.viewOf(re));fe.setSelectionRange(Le.start,Le.end,Le.direction),fe.scrollTop=Le.scrollTop==="end"?fe.scrollHeight:Le.scrollTop},[Z,e]),N.useEffect(()=>e.onRestored(re=>{if(re!==z.current)return;const fe=e.get(re);fe!==void 0&&(E(fe.text),K(fe.items),_e())}),[e,K,_e]);const te=N.useRef(new Set);N.useEffect(()=>{var re;if(!(h===void 0||h.length===0)){for(const fe of h)if(!te.current.has(fe.id)){if(te.current.add(fe.id),fe.terminalId===z.current&&fe.pasted.length===0)E(Le=>$g(Le,fe.text)),fe.focus&&((re=D.current)==null||re.focus());else if(fe.terminalId===z.current){const Le=Lp({text:ge.current,items:Q.current},fe,()=>crypto.randomUUID());E(Le.text),K(Le.items)}else{const Le=e.get(fe.terminalId);e.put(fe.terminalId,Lp({text:(Le==null?void 0:Le.text)??"",items:(Le==null?void 0:Le.items)??[]},fe,()=>crypto.randomUUID()))}k==null||k(fe.id)}}},[h,k,e,K]);const ee=N.useCallback(()=>{if(s===null||_!==null)return;const re=P.items.filter(wt=>wt.kind==="text").map(wt=>({number:wt.number,text:wt.text})),fe=P.items.filter(wt=>wt.kind==="image").map(wt=>({mediaType:wt.mediaType,data:wt.base64})),Le=P.items.filter(wt=>wt.kind==="file").map(wt=>({name:wt.name,data:wt.base64})),Qe=Tp(re,j);if(Qe.length===0&&fe.length===0&&Le.length===0)return;const at=iv(),ct=t.send({type:"agent.submit",terminalId:s,text:Qe,images:fe,...Le.length>0?{files:Le}:{},requestId:at});e.submitted(s,ct),E(""),P.clear(),w==null||w(s,at,!ct)},[t,e,s,j,P,_,w]),we=N.useCallback(re=>{if(I(null),s===null||x===void 0||P.items.some(at=>at.kind!=="text"))return;const fe=P.items.filter(at=>at.kind==="text").map(at=>({number:at.number,text:at.text})),Le=Tp(fe,j);if(Le.trim().length===0)return;const Qe=x(s,Le,re);e.submitted(s,Qe),E(""),P.clear()},[s,x,P,j,e]),ke=N.useCallback(()=>I(null),[]);N.useEffect(()=>I(null),[s]);const Ae=x!==void 0;N.useEffect(()=>{Ae||I(null)},[Ae]);const Me=N.useCallback(()=>{s!==null&&t.send({type:"agent.interrupt",terminalId:s})},[t,s]),Je=N.useCallback((re,fe)=>{re.setSelectionRange(fe.from,fe.to);let Le=!1;try{Le=fe.text.length>0?document.execCommand("insertText",!1,fe.text):document.execCommand("delete")}catch{Le=!1}Le||(re.setRangeText(fe.text,fe.from,fe.to,"end"),E(re.value)),re.setSelectionRange(fe.caret,fe.caret)},[]),it=N.useCallback(re=>{if(re.key==="Enter"&&RC(re,F)){re.preventDefault(),ee();return}if(re.key==="Enter"&&!re.nativeEvent.isComposing){const fe=re.currentTarget,Le=gC(fe.value,fe.selectionStart,fe.selectionEnd);if(Le!==null){re.preventDefault(),Je(fe,Le);return}}if(re.key==="Escape"){re.preventDefault(),Me();return}re.key==="ArrowUp"&&f!==void 0&&!re.shiftKey&&!re.altKey&&!re.ctrlKey&&!re.metaKey&&!re.nativeEvent.isComposing&&re.currentTarget.value.length===0&&P.items.length===0&&(re.preventDefault(),f())},[ee,Me,F,Je,f,P.items.length]),Ie=N.useCallback((re,fe)=>{const{inserted:Le}=Jk(re.value,re.selectionStart,re.selectionEnd,fe);let Qe=!1;try{Qe=document.execCommand("insertText",!1,Le)}catch{Qe=!1}Qe||(re.setRangeText(Le,re.selectionStart,re.selectionEnd,"end"),E(re.value))},[]),ae=N.useCallback((re,fe)=>{const Le=D.current;if(Le===null||Le.disabled){E(ct=>Ep(ct,ct.length,ct.length,re).text);return}const{inserted:Qe}=Ep(Le.value,Le.selectionStart,Le.selectionEnd,re);let at=!1;if(fe){Le.focus();try{at=document.execCommand("insertText",!1,Qe)}catch{at=!1}}at||(Le.setRangeText(Qe,Le.selectionStart,Le.selectionEnd,"end"),E(Le.value))},[]);N.useEffect(()=>{if(m!==void 0)return m.current=ae,()=>{m.current===ae&&(m.current=null)}},[m,ae]);const{acceptImages:mt}=P,De=N.useCallback((re,fe,Le)=>{const Qe=D.current;if(Qe===null||Qe.disabled)E(at=>{const ct=Pp(at,re);return ct===null?at:at.slice(0,ct.from)+ct.inserted});else{const at=Pp(Qe.value,re);if(at!==null){Qe.setSelectionRange(at.from,Qe.value.length);let ct=!1;if(Le){Qe.focus();try{ct=document.execCommand("insertText",!1,at.inserted)}catch{ct=!1}}ct||(Qe.setRangeText(at.inserted,at.from,Qe.value.length,"end"),E(Qe.value))}}mt(fe)},[mt]);N.useEffect(()=>{if(p!==void 0)return p.current=De,()=>{p.current===De&&(p.current=null)}},[p,De]);const Fe=N.useCallback(re=>{if(re.clipboardData===null)return;const fe=P.acceptPaste(re.clipboardData,Vg(re.currentTarget.value));fe.consumed&&(re.preventDefault(),fe.pastedNumber!==null&&Ie(re.currentTarget,fe.pastedNumber))},[P,Ie]),Ze=N.useCallback(re=>{P.remove(re.id),re.kind==="text"&&E(fe=>Yg(fe,re.number))},[P]),Se=N.useRef(null),be=s===null||!l,je=j.trim().length>0||P.items.some(re=>re.kind!=="text"||re.text.trim().length>0),pe=l&&b!=="idle",Xe=je||!pe,$e=oC({text:j,items:P.items}),Pe=P.items.some(re=>re.kind!=="text")?v("scheduled.composer.onlyText"):je?null:v("scheduled.composer.empty");return o.jsxs("div",{className:`composer${R?" composer-dragging":""}`,style:y===void 0?void 0:{"--composer-accent":y},onDragOver:re=>{Array.from(re.dataTransfer.types).includes("Files")&&(re.preventDefault(),S(!0))},onDragLeave:()=>S(!1),onDrop:re=>{re.preventDefault(),S(!1),P.acceptFiles(re.dataTransfer.files)},children:[o.jsx("div",{className:"hdivider composer-divider",...H,title:v("composer.resizeTitle")}),T!==null&&o.jsxs("div",{className:"handoff-notice",role:"status",children:[o.jsxs("span",{className:"handoff-notice-text",children:[T.text,T.status!==null&&o.jsx("span",{className:"handoff-notice-status",children:T.status})]}),M!==void 0&&o.jsx("button",{className:"icon-button",onClick:M,title:v("common.dismissNotice"),children:"×"})]}),P.problem!==null&&o.jsxs("div",{className:"composer-problem",children:[o.jsx("span",{children:P.problem}),o.jsx("button",{className:"icon-button",onClick:P.dismissProblem,title:v("common.close"),children:"×"})]}),$e&&o.jsx("div",{className:"composer-problem",role:"status",children:o.jsx("span",{children:v("composer.problem.draftTooLong")})}),P.items.length>0&&o.jsx("div",{className:"composer-chips",children:P.items.map(re=>o.jsx(C1,{item:re,onRemove:()=>Ze(re),onEdit:fe=>P.updateText(re.id,fe),onDoneEditing:()=>{var fe;return(fe=D.current)==null?void 0:fe.focus()}},re.id))}),o.jsxs("div",{className:`composer-field${pe&&Xe?" composer-field-two":""}`,children:[o.jsx("textarea",{ref:D,className:"composer-input",value:j,rows:1,placeholder:v(be?u?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:be,onChange:re=>E(re.target.value),onKeyDown:it,onPaste:Fe,spellCheck:!1}),o.jsxs("div",{className:"composer-field-actions",children:[pe&&o.jsx("button",{className:"composer-icon composer-stop",onClick:Me,disabled:be,title:v("composer.stopTitle"),"aria-label":v("composer.stop"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"14",height:"14","aria-hidden":"true",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor"})})}),Xe&&o.jsx("button",{className:"composer-icon composer-send",onClick:ee,disabled:be||!je||_!==null,title:_??v("composer.sendTitle"),"aria-label":v("composer.send"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:o.jsx("path",{d:"M12 19V5M5.5 11.5 12 5l6.5 6.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),o.jsxs("div",{className:"composer-bar",children:[o.jsx("input",{ref:Se,type:"file",multiple:!0,hidden:!0,onChange:re=>{re.target.files!==null&&P.acceptFiles(re.target.files),re.target.value=""}}),o.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var re;return(re=Se.current)==null?void 0:re.click()},disabled:be,title:v("composer.attachTitle"),"aria-label":v("composer.attach"),children:o.jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:o.jsx("path",{d:"M21.4 11.1 12.3 20.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),x!==void 0&&o.jsx("button",{className:`icon-button composer-schedule${L!==null?" composer-schedule-open":""}`,onClick:re=>{const fe=re.currentTarget;I(Le=>Le===null?fe:null)},disabled:be||Pe!==null,title:Pe??v("scheduled.composer.title"),"aria-label":v("scheduled.composer.label"),"aria-haspopup":"dialog","aria-expanded":L!==null,children:o.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16","aria-hidden":"true",children:[o.jsx("circle",{cx:"12",cy:"12",r:"8.5",fill:"none",stroke:"currentColor",strokeWidth:"2"}),o.jsx("path",{d:"M12 7.5V12l3 2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}),L!==null&&o.jsx(XC,{anchor:L,onPick:we,onClose:ke}),a,o.jsx("span",{className:"composer-spacer"}),i]})]})}function C1({item:t,onRemove:e,onEdit:s,onDoneEditing:l}){const[u,y]=N.useState(!1);if(t.kind==="image"){const b=`${t.name} · ${vn(t.bytes)}`;return o.jsxs("figure",{className:"chip chip-image",title:b,children:[o.jsx("img",{src:t.dataUrl,alt:t.name,onClick:()=>y(!0)}),o.jsx("button",{className:"chip-remove",onClick:e,title:v("composer.chip.remove"),children:"×"}),u&&o.jsx(Qg,{src:t.dataUrl,caption:b,onClose:()=>y(!1)})]})}return t.kind==="file"?o.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${vn(t.bytes)}`,children:[o.jsxs("span",{className:"chip-toggle chip-file-label",children:[o.jsx("span",{className:"chip-icon",children:"▤"}),o.jsx("span",{className:"chip-file-name",children:t.name}),o.jsx("span",{className:"chip-file-size",children:vn(t.bytes)})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:v("composer.chip.remove"),children:"×"})]}):o.jsxs("div",{className:`chip chip-text${u?" chip-open":""}`,children:[o.jsxs("button",{className:"chip-toggle",onClick:()=>y(b=>!b),title:v("composer.chip.editHint"),"aria-expanded":u,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),Yk(t.number,t.lines),o.jsx("span",{className:"chip-chevron",children:u?"▾":"▸"})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:v("composer.chip.remove"),children:"×"}),u&&o.jsx("textarea",{className:"chip-editor",value:t.text,onChange:b=>s(b.target.value),onKeyDown:b=>{b.key==="Escape"&&(b.preventDefault(),y(!1),l())},"aria-label":v("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var yu={exports:{}},Up;function S1(){return Up||(Up=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={};return(()=>{var l=s;Object.defineProperty(l,"__esModule",{value:!0}),l.FitAddon=void 0,l.FitAddon=class{activate(u){this._terminal=u}dispose(){}fit(){const u=this.proposeDimensions();if(!u||!this._terminal||isNaN(u.cols)||isNaN(u.rows))return;const y=this._terminal._core;this._terminal.rows===u.rows&&this._terminal.cols===u.cols||(y._renderService.clear(),this._terminal.resize(u.cols,u.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const u=this._terminal._core,y=u._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;const b=this._terminal.options.scrollback===0?0:u.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue("height")),g=Math.max(0,parseInt(i.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),h=a-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),k=g-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-b;return{cols:Math.max(2,Math.floor(k/y.css.cell.width)),rows:Math.max(1,Math.floor(h/y.css.cell.height))}}}})(),s})()))})(yu)),yu.exports}var x1=S1(),ku={exports:{}},$p;function E1(){return $p||($p=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={6:(b,i)=>{function a(_){try{const h=new URL(_),k=h.password&&h.username?`${h.protocol}//${h.username}:${h.password}@${h.host}`:h.username?`${h.protocol}//${h.username}@${h.host}`:`${h.protocol}//${h.host}`;return _.toLocaleLowerCase().startsWith(k.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(i,"__esModule",{value:!0}),i.LinkComputer=i.WebLinkProvider=void 0,i.WebLinkProvider=class{constructor(_,h,k,T={}){this._terminal=_,this._regex=h,this._handler=k,this._options=T}provideLinks(_,h){const k=g.computeLink(_,this._regex,this._terminal,this._handler);h(this._addCallbacks(k))}_addCallbacks(_){return _.map((h=>(h.leave=this._options.leave,h.hover=(k,T)=>{if(this._options.hover){const{range:M}=h;this._options.hover(k,T,M)}},h)))}};class g{static computeLink(h,k,T,M){const w=new RegExp(k.source,(k.flags||"")+"g"),[d,m]=g._getWindowedLineStrings(h-1,T),p=d.join("");let f;const x=[];for(;f=w.exec(p);){const j=f[0];if(!a(j))continue;const[E,R]=g._mapStrIdx(T,m,0,f.index),[S,L]=g._mapStrIdx(T,E,R,j.length);if(E===-1||R===-1||S===-1||L===-1)continue;const I={start:{x:R+1,y:E+1},end:{x:L,y:S+1}};x.push({range:I,text:j,activate:M})}return x}static _getWindowedLineStrings(h,k){let T,M=h,w=h,d=0,m="";const p=[];if(T=k.buffer.active.getLine(h)){const f=T.translateToString(!0);if(T.isWrapped&&f[0]!==" "){for(d=0;(T=k.buffer.active.getLine(--M))&&d<2048&&(m=T.translateToString(!0),d+=m.length,p.push(m),T.isWrapped&&m.indexOf(" ")===-1););p.reverse()}for(p.push(f),d=0;(T=k.buffer.active.getLine(++w))&&T.isWrapped&&d<2048&&(m=T.translateToString(!0),d+=m.length,p.push(m),m.indexOf(" ")===-1););}return[p,M]}static _mapStrIdx(h,k,T,M){const w=h.buffer.active,d=w.getNullCell();let m=T;for(;M;){const p=w.getLine(k);if(!p)return[-1,-1];for(let f=m;f<p.length;++f){p.getCell(f,d);const x=d.getChars();if(d.getWidth()&&(M-=x.length||1,f===p.length-1&&x==="")){const j=w.getLine(k+1);j&&j.isWrapped&&(j.getCell(0,d),d.getWidth()===2&&(M+=1))}if(M<0)return[k,f]}k++,m=0}return[k,m]}}i.LinkComputer=g}},l={};function u(b){var i=l[b];if(i!==void 0)return i.exports;var a=l[b]={exports:{}};return s[b](a,a.exports,u),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.WebLinksAddon=void 0;const i=u(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function g(_,h){const k=window.open();if(k){try{k.opener=null}catch{}k.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}b.WebLinksAddon=class{constructor(_=g,h={}){this._handler=_,this._options=h}activate(_){this._terminal=_;const h=this._options,k=h.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new i.WebLinkProvider(this._terminal,k,this._handler,h))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),y})()))})(ku)),ku.exports}var T1=E1(),Cu={exports:{}},Wp;function L1(){return Wp||(Wp=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={965:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GlyphRenderer=void 0;const g=a(374),_=a(509),h=a(855),k=a(859),T=a(381),M=11,w=M*Float32Array.BYTES_PER_ELEMENT;let d,m=0,p=0,f=0;class x extends k.Disposable{constructor(E,R,S,L){super(),this._terminal=E,this._gl=R,this._dimensions=S,this._optionsService=L,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const I=this._gl;_.TextureAtlas.maxAtlasPages===void 0&&(_.TextureAtlas.maxAtlasPages=Math.min(32,(0,g.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,g.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_SIZE))),this._program=(0,g.throwIfFalsy)((0,T.createProgram)(I,`#version 300 es
|
|
65
|
-
layout (location = 0) in vec2 a_unitquad;
|
|
66
|
-
layout (location = 1) in vec2 a_cellpos;
|
|
67
|
-
layout (location = 2) in vec2 a_offset;
|
|
68
|
-
layout (location = 3) in vec2 a_size;
|
|
69
|
-
layout (location = 4) in float a_texpage;
|
|
70
|
-
layout (location = 5) in vec2 a_texcoord;
|
|
71
|
-
layout (location = 6) in vec2 a_texsize;
|
|
72
|
-
|
|
73
|
-
uniform mat4 u_projection;
|
|
74
|
-
uniform vec2 u_resolution;
|
|
75
|
-
|
|
76
|
-
out vec2 v_texcoord;
|
|
77
|
-
flat out int v_texpage;
|
|
78
|
-
|
|
79
|
-
void main() {
|
|
80
|
-
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
81
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
82
|
-
v_texpage = int(a_texpage);
|
|
83
|
-
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
84
|
-
}`,(function(Y){let G="";for(let V=1;V<Y;V++)G+=` else if (v_texpage == ${V}) { outColor = texture(u_texture[${V}], v_texcoord); }`;return`#version 300 es
|
|
85
|
-
precision lowp float;
|
|
86
|
-
|
|
87
|
-
in vec2 v_texcoord;
|
|
88
|
-
flat in int v_texpage;
|
|
89
|
-
|
|
90
|
-
uniform sampler2D u_texture[${Y}];
|
|
91
|
-
|
|
92
|
-
out vec4 outColor;
|
|
93
|
-
|
|
94
|
-
void main() {
|
|
95
|
-
if (v_texpage == 0) {
|
|
96
|
-
outColor = texture(u_texture[0], v_texcoord);
|
|
97
|
-
} ${G}
|
|
98
|
-
}`})(_.TextureAtlas.maxAtlasPages))),this.register((0,k.toDisposable)((()=>I.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,g.throwIfFalsy)(I.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=I.createVertexArray(),I.bindVertexArray(this._vertexArrayObject);const P=new Float32Array([0,0,1,0,0,1,1,1]),D=I.createBuffer();this.register((0,k.toDisposable)((()=>I.deleteBuffer(D)))),I.bindBuffer(I.ARRAY_BUFFER,D),I.bufferData(I.ARRAY_BUFFER,P,I.STATIC_DRAW),I.enableVertexAttribArray(0),I.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const F=new Uint8Array([0,1,2,3]),W=I.createBuffer();this.register((0,k.toDisposable)((()=>I.deleteBuffer(W)))),I.bindBuffer(I.ELEMENT_ARRAY_BUFFER,W),I.bufferData(I.ELEMENT_ARRAY_BUFFER,F,I.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(I.createBuffer()),this.register((0,k.toDisposable)((()=>I.deleteBuffer(this._attributesBuffer)))),I.bindBuffer(I.ARRAY_BUFFER,this._attributesBuffer),I.enableVertexAttribArray(2),I.vertexAttribPointer(2,2,I.FLOAT,!1,w,0),I.vertexAttribDivisor(2,1),I.enableVertexAttribArray(3),I.vertexAttribPointer(3,2,I.FLOAT,!1,w,2*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(3,1),I.enableVertexAttribArray(4),I.vertexAttribPointer(4,1,I.FLOAT,!1,w,4*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(4,1),I.enableVertexAttribArray(5),I.vertexAttribPointer(5,2,I.FLOAT,!1,w,5*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(5,1),I.enableVertexAttribArray(6),I.vertexAttribPointer(6,2,I.FLOAT,!1,w,7*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(6,1),I.enableVertexAttribArray(1),I.vertexAttribPointer(1,2,I.FLOAT,!1,w,9*Float32Array.BYTES_PER_ELEMENT),I.vertexAttribDivisor(1,1),I.useProgram(this._program);const $=new Int32Array(_.TextureAtlas.maxAtlasPages);for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++)$[Y]=Y;I.uniform1iv(this._textureLocation,$),I.uniformMatrix4fv(this._projectionLocation,!1,T.PROJECTION_MATRIX),this._atlasTextures=[];for(let Y=0;Y<_.TextureAtlas.maxAtlasPages;Y++){const G=new T.GLTexture((0,g.throwIfFalsy)(I.createTexture()));this.register((0,k.toDisposable)((()=>I.deleteTexture(G.texture)))),I.activeTexture(I.TEXTURE0+Y),I.bindTexture(I.TEXTURE_2D,G.texture),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_2D,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texImage2D(I.TEXTURE_2D,0,I.RGBA,1,1,0,I.RGBA,I.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[Y]=G}I.enable(I.BLEND),I.blendFunc(I.SRC_ALPHA,I.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(E,R,S,L,I,P,D,F,W){this._updateCell(this._vertices.attributes,E,R,S,L,I,P,D,F,W)}_updateCell(E,R,S,L,I,P,D,F,W,$){m=(S*this._terminal.cols+R)*M,L!==h.NULL_CELL_CODE&&L!==void 0?this._atlas&&(d=F&&F.length>1?this._atlas.getRasterizedGlyphCombinedChar(F,I,P,D,!1):this._atlas.getRasterizedGlyph(L,I,P,D,!1),p=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),I!==$&&d.offset.x>p?(f=d.offset.x-p,E[m]=-(d.offset.x-f)+this._dimensions.device.char.left,E[m+1]=-d.offset.y+this._dimensions.device.char.top,E[m+2]=(d.size.x-f)/this._dimensions.device.canvas.width,E[m+3]=d.size.y/this._dimensions.device.canvas.height,E[m+4]=d.texturePage,E[m+5]=d.texturePositionClipSpace.x+f/this._atlas.pages[d.texturePage].canvas.width,E[m+6]=d.texturePositionClipSpace.y,E[m+7]=d.sizeClipSpace.x-f/this._atlas.pages[d.texturePage].canvas.width,E[m+8]=d.sizeClipSpace.y):(E[m]=-d.offset.x+this._dimensions.device.char.left,E[m+1]=-d.offset.y+this._dimensions.device.char.top,E[m+2]=d.size.x/this._dimensions.device.canvas.width,E[m+3]=d.size.y/this._dimensions.device.canvas.height,E[m+4]=d.texturePage,E[m+5]=d.texturePositionClipSpace.x,E[m+6]=d.texturePositionClipSpace.y,E[m+7]=d.sizeClipSpace.x,E[m+8]=d.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,g.allowRescaling)(L,W,d.size.x,this._dimensions.device.cell.width)&&(E[m+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):E.fill(0,m,m+M-1-2)}clear(){const E=this._terminal,R=E.cols*E.rows*M;this._vertices.count!==R?this._vertices.attributes=new Float32Array(R):this._vertices.attributes.fill(0);let S=0;for(;S<this._vertices.attributesBuffers.length;S++)this._vertices.count!==R?this._vertices.attributesBuffers[S]=new Float32Array(R):this._vertices.attributesBuffers[S].fill(0);this._vertices.count=R,S=0;for(let L=0;L<E.rows;L++)for(let I=0;I<E.cols;I++)this._vertices.attributes[S+9]=I/E.cols,this._vertices.attributes[S+10]=L/E.rows,S+=M}handleResize(){const E=this._gl;E.useProgram(this._program),E.viewport(0,0,E.canvas.width,E.canvas.height),E.uniform2f(this._resolutionLocation,E.canvas.width,E.canvas.height),this.clear()}render(E){if(!this._atlas)return;const R=this._gl;R.useProgram(this._program),R.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const S=this._vertices.attributesBuffers[this._activeBuffer];let L=0;for(let I=0;I<E.lineLengths.length;I++){const P=I*this._terminal.cols*M,D=this._vertices.attributes.subarray(P,P+E.lineLengths[I]*M);S.set(D,L),L+=D.length}R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.bufferData(R.ARRAY_BUFFER,S.subarray(0,L),R.STREAM_DRAW);for(let I=0;I<this._atlas.pages.length;I++)this._atlas.pages[I].version!==this._atlasTextures[I].version&&this._bindAtlasPageTexture(R,this._atlas,I);R.drawElementsInstanced(R.TRIANGLE_STRIP,4,R.UNSIGNED_BYTE,0,L/M)}setAtlas(E){this._atlas=E;for(const R of this._atlasTextures)R.version=-1}_bindAtlasPageTexture(E,R,S){E.activeTexture(E.TEXTURE0+S),E.bindTexture(E.TEXTURE_2D,this._atlasTextures[S].texture),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_S,E.CLAMP_TO_EDGE),E.texParameteri(E.TEXTURE_2D,E.TEXTURE_WRAP_T,E.CLAMP_TO_EDGE),E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,R.pages[S].canvas),E.generateMipmap(E.TEXTURE_2D),this._atlasTextures[S].version=R.pages[S].version}setDimensions(E){this._dimensions=E}}i.GlyphRenderer=x},742:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const g=a(374),_=a(859),h=a(310),k=a(381),T=8*Float32Array.BYTES_PER_ELEMENT;class M{constructor(){this.attributes=new Float32Array(160),this.count=0}}let w=0,d=0,m=0,p=0,f=0,x=0,j=0;class E extends _.Disposable{constructor(S,L,I,P){super(),this._terminal=S,this._gl=L,this._dimensions=I,this._themeService=P,this._vertices=new M,this._verticesCursor=new M;const D=this._gl;this._program=(0,g.throwIfFalsy)((0,k.createProgram)(D,`#version 300 es
|
|
99
|
-
layout (location = 0) in vec2 a_position;
|
|
100
|
-
layout (location = 1) in vec2 a_size;
|
|
101
|
-
layout (location = 2) in vec4 a_color;
|
|
102
|
-
layout (location = 3) in vec2 a_unitquad;
|
|
103
|
-
|
|
104
|
-
uniform mat4 u_projection;
|
|
105
|
-
|
|
106
|
-
out vec4 v_color;
|
|
107
|
-
|
|
108
|
-
void main() {
|
|
109
|
-
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
110
|
-
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
111
|
-
v_color = a_color;
|
|
112
|
-
}`,`#version 300 es
|
|
113
|
-
precision lowp float;
|
|
114
|
-
|
|
115
|
-
in vec4 v_color;
|
|
116
|
-
|
|
117
|
-
out vec4 outColor;
|
|
118
|
-
|
|
119
|
-
void main() {
|
|
120
|
-
outColor = v_color;
|
|
121
|
-
}`)),this.register((0,_.toDisposable)((()=>D.deleteProgram(this._program)))),this._projectionLocation=(0,g.throwIfFalsy)(D.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=D.createVertexArray(),D.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),W=D.createBuffer();this.register((0,_.toDisposable)((()=>D.deleteBuffer(W)))),D.bindBuffer(D.ARRAY_BUFFER,W),D.bufferData(D.ARRAY_BUFFER,F,D.STATIC_DRAW),D.enableVertexAttribArray(3),D.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const $=new Uint8Array([0,1,2,3]),Y=D.createBuffer();this.register((0,_.toDisposable)((()=>D.deleteBuffer(Y)))),D.bindBuffer(D.ELEMENT_ARRAY_BUFFER,Y),D.bufferData(D.ELEMENT_ARRAY_BUFFER,$,D.STATIC_DRAW),this._attributesBuffer=(0,g.throwIfFalsy)(D.createBuffer()),this.register((0,_.toDisposable)((()=>D.deleteBuffer(this._attributesBuffer)))),D.bindBuffer(D.ARRAY_BUFFER,this._attributesBuffer),D.enableVertexAttribArray(0),D.vertexAttribPointer(0,2,D.FLOAT,!1,T,0),D.vertexAttribDivisor(0,1),D.enableVertexAttribArray(1),D.vertexAttribPointer(1,2,D.FLOAT,!1,T,2*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(1,1),D.enableVertexAttribArray(2),D.vertexAttribPointer(2,4,D.FLOAT,!1,T,4*Float32Array.BYTES_PER_ELEMENT),D.vertexAttribDivisor(2,1),this._updateCachedColors(P.colors),this.register(this._themeService.onChangeColors((G=>{this._updateCachedColors(G),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(S){const L=this._gl;L.useProgram(this._program),L.bindVertexArray(this._vertexArrayObject),L.uniformMatrix4fv(this._projectionLocation,!1,k.PROJECTION_MATRIX),L.bindBuffer(L.ARRAY_BUFFER,this._attributesBuffer),L.bufferData(L.ARRAY_BUFFER,S.attributes,L.DYNAMIC_DRAW),L.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,L.UNSIGNED_BYTE,0,S.count)}handleResize(){this._updateViewportRectangle()}setDimensions(S){this._dimensions=S}_updateCachedColors(S){this._bgFloat=this._colorToFloat32Array(S.background),this._cursorFloat=this._colorToFloat32Array(S.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(S){const L=this._terminal,I=this._vertices;let P,D,F,W,$,Y,G,V,B,U,H,z=1;for(P=0;P<L.rows;P++){for(F=-1,W=0,$=0,Y=!1,D=0;D<L.cols;D++)G=(P*L.cols+D)*h.RENDER_MODEL_INDICIES_PER_CELL,V=S.cells[G+h.RENDER_MODEL_BG_OFFSET],B=S.cells[G+h.RENDER_MODEL_FG_OFFSET],U=!!(67108864&B),(V!==W||B!==$&&(Y||U))&&((W!==0||Y&&$!==0)&&(H=8*z++,this._updateRectangle(I,H,$,W,F,D,P)),F=D,W=V,$=B,Y=U);(W!==0||Y&&$!==0)&&(H=8*z++,this._updateRectangle(I,H,$,W,F,L.cols,P))}I.count=z}updateCursor(S){const L=this._verticesCursor,I=S.cursor;if(!I||I.style==="block")return void(L.count=0);let P,D=0;I.style!=="bar"&&I.style!=="outline"||(P=8*D++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,I.y*this._dimensions.device.cell.height,I.style==="bar"?I.dpr*I.cursorWidth:I.dpr,this._dimensions.device.cell.height,this._cursorFloat)),I.style!=="underline"&&I.style!=="outline"||(P=8*D++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,(I.y+1)*this._dimensions.device.cell.height-I.dpr,I.width*this._dimensions.device.cell.width,I.dpr,this._cursorFloat)),I.style==="outline"&&(P=8*D++,this._addRectangleFloat(L.attributes,P,I.x*this._dimensions.device.cell.width,I.y*this._dimensions.device.cell.height,I.width*this._dimensions.device.cell.width,I.dpr,this._cursorFloat),P=8*D++,this._addRectangleFloat(L.attributes,P,(I.x+I.width)*this._dimensions.device.cell.width-I.dpr,I.y*this._dimensions.device.cell.height,I.dpr,this._dimensions.device.cell.height,this._cursorFloat)),L.count=D}_updateRectangle(S,L,I,P,D,F,W){if(67108864&I)switch(50331648&I){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&I].rgba;break;case 50331648:w=(16777215&I)<<8;break;default:w=this._themeService.colors.foreground.rgba}else switch(50331648&P){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&P].rgba;break;case 50331648:w=(16777215&P)<<8;break;default:w=this._themeService.colors.background.rgba}S.attributes.length<L+4&&(S.attributes=(0,k.expandFloat32Array)(S.attributes,this._terminal.rows*this._terminal.cols*8)),d=D*this._dimensions.device.cell.width,m=W*this._dimensions.device.cell.height,p=(w>>24&255)/255,f=(w>>16&255)/255,x=(w>>8&255)/255,j=1,this._addRectangle(S.attributes,L,d,m,(F-D)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p,f,x,j)}_addRectangle(S,L,I,P,D,F,W,$,Y,G){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=P/this._dimensions.device.canvas.height,S[L+2]=D/this._dimensions.device.canvas.width,S[L+3]=F/this._dimensions.device.canvas.height,S[L+4]=W,S[L+5]=$,S[L+6]=Y,S[L+7]=G}_addRectangleFloat(S,L,I,P,D,F,W){S[L]=I/this._dimensions.device.canvas.width,S[L+1]=P/this._dimensions.device.canvas.height,S[L+2]=D/this._dimensions.device.canvas.width,S[L+3]=F/this._dimensions.device.canvas.height,S[L+4]=W[0],S[L+5]=W[1],S[L+6]=W[2],S[L+7]=W[3]}_colorToFloat32Array(S){return new Float32Array([(S.rgba>>24&255)/255,(S.rgba>>16&255)/255,(S.rgba>>8&255)/255,(255&S.rgba)/255])}}i.RectangleRenderer=E},310:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderModel=i.COMBINED_CHAR_BIT_MASK=i.RENDER_MODEL_EXT_OFFSET=i.RENDER_MODEL_FG_OFFSET=i.RENDER_MODEL_BG_OFFSET=i.RENDER_MODEL_INDICIES_PER_CELL=void 0;const g=a(296);i.RENDER_MODEL_INDICIES_PER_CELL=4,i.RENDER_MODEL_BG_OFFSET=1,i.RENDER_MODEL_FG_OFFSET=2,i.RENDER_MODEL_EXT_OFFSET=3,i.COMBINED_CHAR_BIT_MASK=2147483648,i.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,g.createSelectionRenderModel)()}resize(_,h){const k=_*h*i.RENDER_MODEL_INDICIES_PER_CELL;k!==this.cells.length&&(this.cells=new Uint32Array(k),this.lineLengths=new Uint32Array(h))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.JoinedCellData=i.WebglRenderer=void 0;const g=a(820),_=a(274),h=a(627),k=a(457),T=a(56),M=a(374),w=a(345),d=a(859),m=a(147),p=a(782),f=a(855),x=a(965),j=a(742),E=a(310),R=a(733);class S extends d.Disposable{constructor(D,F,W,$,Y,G,V,B,U){super(),this._terminal=D,this._characterJoinerService=F,this._charSizeService=W,this._coreBrowserService=$,this._coreService=Y,this._decorationService=G,this._optionsService=V,this._themeService=B,this._cursorBlinkStateManager=new d.MutableDisposable,this._charAtlasDisposable=this.register(new d.MutableDisposable),this._observerDisposable=this.register(new d.MutableDisposable),this._model=new E.RenderModel,this._workCell=new p.CellData,this._workCell2=new p.CellData,this._rectangleRenderer=this.register(new d.MutableDisposable),this._glyphRenderer=this.register(new d.MutableDisposable),this._onChangeTextureAtlas=this.register(new w.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new w.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new w.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new w.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors((()=>this._handleColorChange()))),this._cellColorResolver=new _.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new R.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,V,this._themeService)],this.dimensions=(0,M.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(V.onOptionChange((()=>this._handleOptionsChanged()))),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const H={antialias:!1,depth:!1,preserveDrawingBuffer:U};if(this._gl=this._canvas.getContext("webgl2",H),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextlost",(z=>{console.log("webglcontextlost event received"),z.preventDefault(),this._contextRestorationTimeout=setTimeout((()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(z)}),3e3)}))),this.register((0,g.addDisposableDomListener)(this._canvas,"webglcontextrestored",(z=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,h.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,T.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((z,Z)=>this._setCanvasDevicePixelDimensions(z,Z))),this.register(this._coreBrowserService.onWindowChange((z=>{this._observerDisposable.value=(0,T.observeDevicePixelDimensions)(this._canvas,z,((Z,ie)=>this._setCanvasDevicePixelDimensions(Z,ie)))}))),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,d.toDisposable)((()=>{var z;for(const Z of this._renderLayers)Z.dispose();(z=this._canvas.parentElement)==null||z.removeChild(this._canvas),(0,h.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var D;return(D=this._charAtlas)==null?void 0:D.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(D,F){var W,$,Y,G;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const V of this._renderLayers)V.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`,(W=this._rectangleRenderer.value)==null||W.setDimensions(this.dimensions),($=this._rectangleRenderer.value)==null||$.handleResize(),(Y=this._glyphRenderer.value)==null||Y.setDimensions(this.dimensions),(G=this._glyphRenderer.value)==null||G.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var D;for(const F of this._renderLayers)F.handleBlur(this._terminal);(D=this._cursorBlinkStateManager.value)==null||D.pause(),this._requestRedrawViewport()}handleFocus(){var D;for(const F of this._renderLayers)F.handleFocus(this._terminal);(D=this._cursorBlinkStateManager.value)==null||D.resume(),this._requestRedrawViewport()}handleSelectionChanged(D,F,W){for(const $ of this._renderLayers)$.handleSelectionChanged(this._terminal,D,F,W);this._model.selection.update(this._core,D,F,W),this._requestRedrawViewport()}handleCursorMove(){var D;for(const F of this._renderLayers)F.handleCursorMove(this._terminal);(D=this._cursorBlinkStateManager.value)==null||D.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new j.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new x.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var F;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const D=(0,h.acquireTextureAtlas)(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._charAtlas!==D&&(this._onChangeTextureAtlas.fire(D.pages[0].canvas),this._charAtlasDisposable.value=(0,d.getDisposeArrayDisposable)([(0,w.forwardEvent)(D.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,w.forwardEvent)(D.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=D,this._charAtlas.warmUp(),(F=this._glyphRenderer.value)==null||F.setAtlas(this._charAtlas)}_clearModel(D){var F;this._model.clear(),D&&((F=this._glyphRenderer.value)==null||F.clear())}clearTextureAtlas(){var D;(D=this._charAtlas)==null||D.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var D;this._clearModel(!0);for(const F of this._renderLayers)F.reset(this._terminal);(D=this._cursorBlinkStateManager.value)==null||D.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(D){return-1}deregisterCharacterJoiner(D){return!1}renderRows(D,F){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const W of this._renderLayers)W.handleGridChanged(this._terminal,D,F);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(D,F),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new k.CursorBlinkStateManager((()=>{this._requestRedrawCursor()}),this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(D,F){const W=this._core;let $,Y,G,V,B,U,H,z,Z,ie,_e,ge,Q,K,te=this._workCell;D=I(D,W.rows-1,0),F=I(F,W.rows-1,0);const ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,we=ee-W.buffer.ydisp,ke=Math.min(this._terminal.buffer.active.cursorX,W.cols-1);let Ae=-1;const Me=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Je=!1;for(Y=D;Y<=F;Y++)for(G=Y+W.buffer.ydisp,V=W.buffer.lines.get(G),this._model.lineLengths[Y]=0,B=this._characterJoinerService.getJoinedCharacters(G),Q=0;Q<W.cols;Q++)if($=this._cellColorResolver.result.bg,V.loadCell(Q,te),Q===0&&($=this._cellColorResolver.result.bg),U=!1,H=Q,B.length>0&&Q===B[0][0]&&(U=!0,z=B.shift(),te=new L(te,V.translateToString(!0,z[0],z[1]),z[1]-z[0]),H=z[1]-1),Z=te.getChars(),ie=te.getCode(),ge=(Y*W.cols+Q)*E.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(te,Q,G,this.dimensions.device.cell.width),Me&&G===ee&&(Q===ke&&(this._model.cursor={x:ke,y:we,width:te.getWidth(),style:this._coreBrowserService.isFocused?W.options.cursorStyle||"block":W.options.cursorInactiveStyle,cursorWidth:W.options.cursorWidth,dpr:this._devicePixelRatio},Ae=ke+te.getWidth()-1),Q>=ke&&Q<=Ae&&(this._coreBrowserService.isFocused&&(W.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&W.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)),ie!==f.NULL_CELL_CODE&&(this._model.lineLengths[Y]=Q+1),(this._model.cells[ge]!==ie||this._model.cells[ge+E.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[ge+E.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[ge+E.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Je=!0,Z.length>1&&(ie|=E.COMBINED_CHAR_BIT_MASK),this._model.cells[ge]=ie,this._model.cells[ge+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[ge+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[ge+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,_e=te.getWidth(),this._glyphRenderer.value.updateCell(Q,Y,ie,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,Z,_e,$),U))for(te=this._workCell,Q++;Q<H;Q++)K=(Y*W.cols+Q)*E.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(Q,Y,f.NULL_CELL_CODE,0,0,0,f.NULL_CELL_CHAR,0,0),this._model.cells[K]=f.NULL_CELL_CODE,this._model.cells[K+E.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[K+E.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[K+E.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Je&&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(D,F){this._canvas.width===D&&this._canvas.height===F||(this._canvas.width=D,this._canvas.height=F,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const D=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:D,end:D})}}i.WebglRenderer=S;class L extends m.AttributeData{constructor(D,F,W){super(),this.content=0,this.combinedData="",this.fg=D.fg,this.bg=D.bg,this.combinedData=F,this._width=W}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(D){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function I(P,D,F=0){return Math.max(Math.min(P,D),F)}i.JoinedCellData=L},381:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const g=a(374);function _(h,k,T){const M=(0,g.throwIfFalsy)(h.createShader(k));if(h.shaderSource(M,T),h.compileShader(M),h.getShaderParameter(M,h.COMPILE_STATUS))return M;console.error(h.getShaderInfoLog(M)),h.deleteShader(M)}i.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),i.createProgram=function(h,k,T){const M=(0,g.throwIfFalsy)(h.createProgram());if(h.attachShader(M,(0,g.throwIfFalsy)(_(h,h.VERTEX_SHADER,k))),h.attachShader(M,(0,g.throwIfFalsy)(_(h,h.FRAGMENT_SHADER,T))),h.linkProgram(M),h.getProgramParameter(M,h.LINK_STATUS))return M;console.error(h.getProgramInfoLog(M)),h.deleteProgram(M)},i.createShader=_,i.expandFloat32Array=function(h,k){const T=Math.min(2*h.length,k),M=new Float32Array(T);for(let w=0;w<h.length;w++)M[w]=h[w];return M},i.GLTexture=class{constructor(h){this.texture=h,this.version=-1}}},592:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const g=a(627),_=a(237),h=a(374),k=a(859);class T extends k.Disposable{constructor(w,d,m,p,f,x,j,E){super(),this._container=d,this._alpha=f,this._coreBrowserService=x,this._optionsService=j,this._themeService=E,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-${m}-layer`),this._canvas.style.zIndex=p.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors((R=>{this._refreshCharAtlas(w,R),this.reset(w)}))),this.register((0,k.toDisposable)((()=>{this._canvas.remove()})))}_initCanvas(){this._ctx=(0,h.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(w){}handleFocus(w){}handleCursorMove(w){}handleGridChanged(w,d,m){}handleSelectionChanged(w,d,m,p=!1){}_setTransparency(w,d){if(d===this._alpha)return;const m=this._canvas;this._alpha=d,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,m),this._refreshCharAtlas(w,this._themeService.colors),this.handleGridChanged(w,0,w.rows-1)}_refreshCharAtlas(w,d){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,g.acquireTextureAtlas)(w,this._optionsService.rawOptions,d,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(w,d){this._deviceCellWidth=d.device.cell.width,this._deviceCellHeight=d.device.cell.height,this._deviceCharWidth=d.device.char.width,this._deviceCharHeight=d.device.char.height,this._deviceCharLeft=d.device.char.left,this._deviceCharTop=d.device.char.top,this._canvas.width=d.device.canvas.width,this._canvas.height=d.device.canvas.height,this._canvas.style.width=`${d.css.canvas.width}px`,this._canvas.style.height=`${d.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(w,this._themeService.colors)}_fillBottomLineAtCells(w,d,m=1){this._ctx.fillRect(w*this._deviceCellWidth,(d+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,m*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(w,d,m,p){this._alpha?this._ctx.clearRect(w*this._deviceCellWidth,d*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(w*this._deviceCellWidth,d*this._deviceCellHeight,m*this._deviceCellWidth,p*this._deviceCellHeight))}_fillCharTrueColor(w,d,m,p){this._ctx.font=this._getFont(w,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(m,p,d.getWidth()),this._ctx.fillText(d.getChars(),m*this._deviceCellWidth+this._deviceCharLeft,p*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(w,d,m){this._ctx.beginPath(),this._ctx.rect(w*this._deviceCellWidth,d*this._deviceCellHeight,m*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(w,d,m){return`${m?"italic":""} ${d?w.options.fontWeightBold:w.options.fontWeight} ${w.options.fontSize*this._coreBrowserService.dpr}px ${w.options.fontFamily}`}}i.BaseRenderLayer=T},733:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const g=a(197),_=a(237),h=a(592);class k extends h.BaseRenderLayer{constructor(M,w,d,m,p,f,x){super(d,M,"link",w,!0,p,f,x),this.register(m.onShowLinkUnderline((j=>this._handleShowLinkUnderline(j)))),this.register(m.onHideLinkUnderline((j=>this._handleHideLinkUnderline(j))))}resize(M,w){super.resize(M,w),this._state=void 0}reset(M){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const M=this._state.y2-this._state.y1-1;M>0&&this._clearCells(0,this._state.y1+1,this._state.cols,M),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(M){if(M.fg===_.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:M.fg!==void 0&&(0,g.is256Color)(M.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[M.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,M.y1===M.y2)this._fillBottomLineAtCells(M.x1,M.y1,M.x2-M.x1);else{this._fillBottomLineAtCells(M.x1,M.y1,M.cols-M.x1);for(let w=M.y1+1;w<M.y2;w++)this._fillBottomLineAtCells(0,w,M.cols);this._fillBottomLineAtCells(0,M.y2,M.x2)}this._state=M}_handleHideLinkUnderline(M){this._clearCurrentLink()}}i.LinkRenderLayer=k},820:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,g,_,h){a.addEventListener(g,_,h);let k=!1;return{dispose:()=>{k||(k=!0,a.removeEventListener(g,_,h))}}}},274:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const g=a(855),_=a(160),h=a(374);let k,T=0,M=0,w=!1,d=!1,m=!1,p=0;i.CellColorResolver=class{constructor(f,x,j,E,R,S){this._terminal=f,this._optionService=x,this._selectionRenderModel=j,this._decorationService=E,this._coreBrowserService=R,this._themeService=S,this.result={fg:0,bg:0,ext:0}}resolve(f,x,j,E){if(this.result.bg=f.bg,this.result.fg=f.fg,this.result.ext=268435456&f.bg?f.extended.ext:0,M=0,T=0,d=!1,w=!1,m=!1,k=this._themeService.colors,p=0,f.getCode()!==g.NULL_CELL_CODE&&f.extended.underlineStyle===4){const R=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));p=x*E%(2*Math.round(R))}if(this._decorationService.forEachDecorationAtCell(x,j,"bottom",(R=>{R.backgroundColorRGB&&(M=R.backgroundColorRGB.rgba>>8&16777215,d=!0),R.foregroundColorRGB&&(T=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),m=this._selectionRenderModel.isCellSelected(this._terminal,x,j),m){if(67108864&this.result.fg||(50331648&this.result.bg)!=0){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:M=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:M=(16777215&this.result.fg)<<8|255;break;default:M=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:M=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:M=(16777215&this.result.bg)<<8|255}M=_.rgba.blend(M,4294967040&(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else M=(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(d=!0,k.selectionForeground&&(T=k.selectionForeground.rgba>>8&16777215,w=!0),(0,h.treatGlyphAsBackgroundColor)(f.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)T=(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:T=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:T=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:T=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:T=(16777215&this.result.fg)<<8|255;break;default:T=this._themeService.colors.foreground.rgba}T=_.rgba.blend(T,4294967040&(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}w=!0}}this._decorationService.forEachDecorationAtCell(x,j,"top",(R=>{R.backgroundColorRGB&&(M=R.backgroundColorRGB.rgba>>8&16777215,d=!0),R.foregroundColorRGB&&(T=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),d&&(M=m?-16777216&f.bg&-134217729|M|50331648:-16777216&f.bg|M|50331648),w&&(T=-16777216&f.fg&-67108865|T|50331648),67108864&this.result.fg&&(d&&!w&&(T=(50331648&this.result.bg)==0?-134217728&this.result.fg|16777215&k.background.rgba>>8|50331648:-134217728&this.result.fg|67108863&this.result.bg,w=!0),!d&&w&&(M=(50331648&this.result.fg)==0?-67108864&this.result.bg|16777215&k.foreground.rgba>>8|50331648:-67108864&this.result.bg|67108863&this.result.fg,d=!0)),k=void 0,this.result.bg=d?M:this.result.bg,this.result.fg=w?T:this.result.fg,this.result.ext&=536870911,this.result.ext|=p<<29&3758096384}}},627:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const g=a(509),_=a(197),h=[];i.acquireTextureAtlas=function(k,T,M,w,d,m,p,f){const x=(0,_.generateConfig)(w,d,m,p,T,M,f);for(let R=0;R<h.length;R++){const S=h[R],L=S.ownedBy.indexOf(k);if(L>=0){if((0,_.configEquals)(S.config,x))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),h.splice(R,1)):S.ownedBy.splice(L,1);break}}for(let R=0;R<h.length;R++){const S=h[R];if((0,_.configEquals)(S.config,x))return S.ownedBy.push(k),S.atlas}const j=k._core,E={atlas:new g.TextureAtlas(document,x,j.unicodeService),config:x,ownedBy:[k]};return h.push(E),E.atlas},i.removeTerminalFromCache=function(k){for(let T=0;T<h.length;T++){const M=h[T].ownedBy.indexOf(k);if(M!==-1){h[T].ownedBy.length===1?(h[T].atlas.dispose(),h.splice(T,1)):h[T].ownedBy.splice(M,1);break}}}},197:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const g=a(160);i.generateConfig=function(_,h,k,T,M,w,d){const m={foreground:w.foreground,background:w.background,cursor:g.NULL_COLOR,cursorAccent:g.NULL_COLOR,selectionForeground:g.NULL_COLOR,selectionBackgroundTransparent:g.NULL_COLOR,selectionBackgroundOpaque:g.NULL_COLOR,selectionInactiveBackgroundTransparent:g.NULL_COLOR,selectionInactiveBackgroundOpaque:g.NULL_COLOR,ansi:w.ansi.slice(),contrastCache:w.contrastCache,halfContrastCache:w.halfContrastCache};return{customGlyphs:M.customGlyphs,devicePixelRatio:d,letterSpacing:M.letterSpacing,lineHeight:M.lineHeight,deviceCellWidth:_,deviceCellHeight:h,deviceCharWidth:k,deviceCharHeight:T,fontFamily:M.fontFamily,fontSize:M.fontSize,fontWeight:M.fontWeight,fontWeightBold:M.fontWeightBold,allowTransparency:M.allowTransparency,drawBoldTextInBrightColors:M.drawBoldTextInBrightColors,minimumContrastRatio:M.minimumContrastRatio,colors:m}},i.configEquals=function(_,h){for(let k=0;k<_.colors.ansi.length;k++)if(_.colors.ansi[k].rgba!==h.colors.ansi[k].rgba)return!1;return _.devicePixelRatio===h.devicePixelRatio&&_.customGlyphs===h.customGlyphs&&_.lineHeight===h.lineHeight&&_.letterSpacing===h.letterSpacing&&_.fontFamily===h.fontFamily&&_.fontSize===h.fontSize&&_.fontWeight===h.fontWeight&&_.fontWeightBold===h.fontWeightBold&&_.allowTransparency===h.allowTransparency&&_.deviceCharWidth===h.deviceCharWidth&&_.deviceCharHeight===h.deviceCharHeight&&_.drawBoldTextInBrightColors===h.drawBoldTextInBrightColors&&_.minimumContrastRatio===h.minimumContrastRatio&&_.colors.foreground.rgba===h.colors.foreground.rgba&&_.colors.background.rgba===h.colors.background.rgba},i.is256Color=function(_){return(50331648&_)==16777216||(50331648&_)==33554432}},237:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const g=a(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},457:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(a,g){this._renderCallback=a,this._coreBrowserService=g,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(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout((()=>{if(this._animationTimeRestarted){const g=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,g>0)return void this._restartInterval(g)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0})),this._blinkInterval=this._coreBrowserService.window.setInterval((()=>{if(this._animationTimeRestarted){const g=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(g)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._renderCallback(),this._animationFrame=void 0}))}),600)}),a)}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()}}},860:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tryDrawCustomChar=i.powerlineDefinitions=i.boxDrawingDefinitions=i.blockElementDefinitions=void 0;const g=a(374);i.blockElementDefinitions={"▀":[{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}]};const _={"░":[[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]]};i.boxDrawingDefinitions={"─":{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:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"║":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╒":{1:(w,d)=>`M.5,1 L.5,${.5-d} L1,${.5-d} M.5,${.5+d} L1,${.5+d}`},"╓":{1:(w,d)=>`M${.5-w},1 L${.5-w},.5 L1,.5 M${.5+w},.5 L${.5+w},1`},"╔":{1:(w,d)=>`M1,${.5-d} L${.5-w},${.5-d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1`},"╕":{1:(w,d)=>`M0,${.5-d} L.5,${.5-d} L.5,1 M0,${.5+d} L.5,${.5+d}`},"╖":{1:(w,d)=>`M${.5+w},1 L${.5+w},.5 L0,.5 M${.5-w},.5 L${.5-w},1`},"╗":{1:(w,d)=>`M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M0,${.5-d} L${.5+w},${.5-d} L${.5+w},1`},"╘":{1:(w,d)=>`M.5,0 L.5,${.5+d} L1,${.5+d} M.5,${.5-d} L1,${.5-d}`},"╙":{1:(w,d)=>`M1,.5 L${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╚":{1:(w,d)=>`M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0 M1,${.5+d} L${.5-w},${.5+d} L${.5-w},0`},"╛":{1:(w,d)=>`M0,${.5+d} L.5,${.5+d} L.5,0 M0,${.5-d} L.5,${.5-d}`},"╜":{1:(w,d)=>`M0,.5 L${.5+w},.5 L${.5+w},0 M${.5-w},.5 L${.5-w},0`},"╝":{1:(w,d)=>`M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M0,${.5+d} L${.5+w},${.5+d} L${.5+w},0`},"╞":{1:(w,d)=>`M.5,0 L.5,1 M.5,${.5-d} L1,${.5-d} M.5,${.5+d} L1,${.5+d}`},"╟":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1 M${.5+w},.5 L1,.5`},"╠":{1:(w,d)=>`M${.5-w},0 L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0`},"╡":{1:(w,d)=>`M.5,0 L.5,1 M0,${.5-d} L.5,${.5-d} M0,${.5+d} L.5,${.5+d}`},"╢":{1:(w,d)=>`M0,.5 L${.5-w},.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╣":{1:(w,d)=>`M${.5+w},0 L${.5+w},1 M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0`},"╤":{1:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d} M.5,${.5+d} L.5,1`},"╥":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},1 M${.5+w},.5 L${.5+w},1`},"╦":{1:(w,d)=>`M0,${.5-d} L1,${.5-d} M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1`},"╧":{1:(w,d)=>`M.5,0 L.5,${.5-d} M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"╨":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╩":{1:(w,d)=>`M0,${.5+d} L1,${.5+d} M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},0`},"╪":{1:(w,d)=>`M.5,0 L.5,1 M0,${.5-d} L1,${.5-d} M0,${.5+d} L1,${.5+d}`},"╫":{1:(w,d)=>`M0,.5 L1,.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╬":{1:(w,d)=>`M0,${.5+d} L${.5-w},${.5+d} L${.5-w},1 M1,${.5+d} L${.5+w},${.5+d} L${.5+w},1 M0,${.5-d} L${.5-w},${.5-d} L${.5-w},0 M1,${.5-d} L${.5+w},${.5-d} L${.5+w},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:(w,d)=>`M.5,1 L.5,${.5+d/.15*.5} C.5,${.5+d/.15*.5},.5,.5,1,.5`},"╮":{1:(w,d)=>`M.5,1 L.5,${.5+d/.15*.5} C.5,${.5+d/.15*.5},.5,.5,0,.5`},"╯":{1:(w,d)=>`M.5,0 L.5,${.5-d/.15*.5} C.5,${.5-d/.15*.5},.5,.5,0,.5`},"╰":{1:(w,d)=>`M.5,0 L.5,${.5-d/.15*.5} C.5,${.5-d/.15*.5},.5,.5,1,.5`}},i.powerlineDefinitions={"":{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}},i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.powerlineDefinitions[""]=i.powerlineDefinitions[""],i.tryDrawCustomChar=function(w,d,m,p,f,x,j,E){const R=i.blockElementDefinitions[d];if(R)return(function(P,D,F,W,$,Y){for(let G=0;G<D.length;G++){const V=D[G],B=$/8,U=Y/8;P.fillRect(F+V.x*B,W+V.y*U,V.w*B,V.h*U)}})(w,R,m,p,f,x),!0;const S=_[d];if(S)return(function(P,D,F,W,$,Y){let G=h.get(D);G||(G=new Map,h.set(D,G));const V=P.fillStyle;if(typeof V!="string")throw new Error(`Unexpected fillStyle type "${V}"`);let B=G.get(V);if(!B){const U=D[0].length,H=D.length,z=P.canvas.ownerDocument.createElement("canvas");z.width=U,z.height=H;const Z=(0,g.throwIfFalsy)(z.getContext("2d")),ie=new ImageData(U,H);let _e,ge,Q,K;if(V.startsWith("#"))_e=parseInt(V.slice(1,3),16),ge=parseInt(V.slice(3,5),16),Q=parseInt(V.slice(5,7),16),K=V.length>7&&parseInt(V.slice(7,9),16)||1;else{if(!V.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${V}" when drawing pattern glyph`);[_e,ge,Q,K]=V.substring(5,V.length-1).split(",").map((te=>parseFloat(te)))}for(let te=0;te<H;te++)for(let ee=0;ee<U;ee++)ie.data[4*(te*U+ee)]=_e,ie.data[4*(te*U+ee)+1]=ge,ie.data[4*(te*U+ee)+2]=Q,ie.data[4*(te*U+ee)+3]=D[te][ee]*(255*K);Z.putImageData(ie,0,0),B=(0,g.throwIfFalsy)(P.createPattern(z,null)),G.set(V,B)}P.fillStyle=B,P.fillRect(F,W,$,Y)})(w,S,m,p,f,x),!0;const L=i.boxDrawingDefinitions[d];if(L)return(function(P,D,F,W,$,Y,G){P.strokeStyle=P.fillStyle;for(const[V,B]of Object.entries(D)){let U;P.beginPath(),P.lineWidth=G*Number.parseInt(V),U=typeof B=="function"?B(.15,.15/Y*$):B;for(const H of U.split(" ")){const z=H[0],Z=T[z];if(!Z){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&Z(P,M(ie,$,Y,F,W,!0,G))}P.stroke(),P.closePath()}})(w,L,m,p,f,x,E),!0;const I=i.powerlineDefinitions[d];return!!I&&((function(P,D,F,W,$,Y,G,V){const B=new Path2D;B.rect(F,W,$,Y),P.clip(B),P.beginPath();const U=G/12;P.lineWidth=V*U;for(const H of D.d.split(" ")){const z=H[0],Z=T[z];if(!Z){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&Z(P,M(ie,$,Y,F,W,!1,V,(D.leftPadding??0)*(U/2),(D.rightPadding??0)*(U/2)))}D.type===1?(P.strokeStyle=P.fillStyle,P.stroke()):P.fill(),P.closePath()})(w,I,m,p,f,x,j,E),!0)};const h=new Map;function k(w,d,m=0){return Math.max(Math.min(w,d),m)}const T={C:(w,d)=>w.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]),L:(w,d)=>w.lineTo(d[0],d[1]),M:(w,d)=>w.moveTo(d[0],d[1])};function M(w,d,m,p,f,x,j,E=0,R=0){const S=w.map((L=>parseFloat(L)||parseInt(L)));if(S.length<2)throw new Error("Too few arguments for instruction");for(let L=0;L<S.length;L+=2)S[L]*=d-E*j-R*j,x&&S[L]!==0&&(S[L]=k(Math.round(S[L]+.5)-.5,d,0)),S[L]+=p+E*j;for(let L=1;L<S.length;L+=2)S[L]*=m,x&&S[L]!==0&&(S[L]=k(Math.round(S[L]+.5)-.5,m,0)),S[L]+=f;return S}},56:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const g=a(859);i.observeDevicePixelDimensions=function(_,h,k){let T=new h.ResizeObserver((M=>{const w=M.find((p=>p.target===_));if(!w)return;if(!("devicePixelContentBoxSize"in w))return T==null||T.disconnect(),void(T=void 0);const d=w.devicePixelContentBoxSize[0].inlineSize,m=w.devicePixelContentBoxSize[0].blockSize;d>0&&m>0&&k(d,m)}));try{T.observe(_,{box:["device-pixel-content-box"]})}catch{T.disconnect(),T=void 0}return(0,g.toDisposable)((()=>T==null?void 0:T.disconnect()))}},374:(b,i)=>{function a(_){return 57508<=_&&_<=57558}function g(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},i.isPowerlineGlyph=a,i.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},i.isEmoji=g,i.allowRescaling=function(_,h,k,T){return h===1&&k>Math.ceil(1.5*T)&&_!==void 0&&_>255&&!g(_)&&!a(_)&&!(function(M){return 57344<=M&&M<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return a(_)||(function(h){return 9472<=h&&h<=9631})(_)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(_,h,k=0){return(_-(2*Math.round(h)-k))%(2*Math.round(h))}},296:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class a{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(_,h,k,T=!1){if(this.selectionStart=h,this.selectionEnd=k,!h||!k||h[0]===k[0]&&h[1]===k[1])return void this.clear();const M=_.buffers.active.ydisp,w=h[1]-M,d=k[1]-M,m=Math.max(w,0),p=Math.min(d,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=T,this.viewportStartRow=w,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,this.startCol=h[0],this.endCol=k[0])}isCellSelected(_,h,k){return!!this.hasSelection&&(k-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&k>=this.viewportCappedStartRow&&h<this.endCol&&k<=this.viewportCappedEndRow:h<this.startCol&&k>=this.viewportCappedStartRow&&h>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&h>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},509:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const g=a(237),_=a(860),h=a(374),k=a(160),T=a(345),M=a(485),w=a(385),d=a(147),m=a(855),p={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}};let f;class x{get pages(){return this._pages}constructor(L,I,P){this._document=L,this._config=I,this._unicodeService=P,this._didWarmUp=!1,this._cacheMap=new M.FourKeyMap,this._cacheMapCombined=new M.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new d.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new T.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new T.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=R(L,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,h.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const L of this.pages)L.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const L=new w.IdleTaskQueue;for(let I=33;I<126;I++)L.enqueue((()=>{if(!this._cacheMap.get(I,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT)){const P=this._drawToCache(I,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT);this._cacheMap.set(I,m.DEFAULT_COLOR,m.DEFAULT_COLOR,m.DEFAULT_EXT,P)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const L of this._pages)L.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(x.maxAtlasPages&&this._pages.length>=Math.max(4,x.maxAtlasPages)){const I=this._pages.filter((G=>2*G.canvas.width<=(x.maxTextureSize||4096))).sort(((G,V)=>V.canvas.width!==G.canvas.width?V.canvas.width-G.canvas.width:V.percentageUsed-G.percentageUsed));let P=-1,D=0;for(let G=0;G<I.length;G++)if(I[G].canvas.width!==D)P=G,D=I[G].canvas.width;else if(G-P==3)break;const F=I.slice(P,P+4),W=F.map((G=>G.glyphs[0].texturePage)).sort(((G,V)=>G>V?1:-1)),$=this.pages.length-F.length,Y=this._mergePages(F,$);Y.version++;for(let G=W.length-1;G>=0;G--)this._deletePage(W[G]);this.pages.push(Y),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(Y.canvas)}const L=new j(this._document,this._textureSize);return this._pages.push(L),this._activePages.push(L),this._onAddTextureAtlasCanvas.fire(L.canvas),L}_mergePages(L,I){const P=2*L[0].canvas.width,D=new j(this._document,P,L);for(const[F,W]of L.entries()){const $=F*W.canvas.width%P,Y=Math.floor(F/2)*W.canvas.height;D.ctx.drawImage(W.canvas,$,Y);for(const V of W.glyphs)V.texturePage=I,V.sizeClipSpace.x=V.size.x/P,V.sizeClipSpace.y=V.size.y/P,V.texturePosition.x+=$,V.texturePosition.y+=Y,V.texturePositionClipSpace.x=V.texturePosition.x/P,V.texturePositionClipSpace.y=V.texturePosition.y/P;this._onRemoveTextureAtlasCanvas.fire(W.canvas);const G=this._activePages.indexOf(W);G!==-1&&this._activePages.splice(G,1)}return D}_deletePage(L){this._pages.splice(L,1);for(let I=L;I<this._pages.length;I++){const P=this._pages[I];for(const D of P.glyphs)D.texturePage--;P.version++}}getRasterizedGlyphCombinedChar(L,I,P,D,F){return this._getFromCacheMap(this._cacheMapCombined,L,I,P,D,F)}getRasterizedGlyph(L,I,P,D,F){return this._getFromCacheMap(this._cacheMap,L,I,P,D,F)}_getFromCacheMap(L,I,P,D,F,W=!1){return f=L.get(I,P,D,F),f||(f=this._drawToCache(I,P,D,F,W),L.set(I,P,D,F,f)),f}_getColorFromAnsiIndex(L){if(L>=this._config.colors.ansi.length)throw new Error("No color found for idx "+L);return this._config.colors.ansi[L]}_getBackgroundColor(L,I,P,D){if(this._config.allowTransparency)return k.NULL_COLOR;let F;switch(L){case 16777216:case 33554432:F=this._getColorFromAnsiIndex(I);break;case 50331648:const W=d.AttributeData.toColorRGB(I);F=k.channels.toColor(W[0],W[1],W[2]);break;default:F=P?k.color.opaque(this._config.colors.foreground):this._config.colors.background}return F}_getForegroundColor(L,I,P,D,F,W,$,Y,G,V){const B=this._getMinimumContrastColor(L,I,P,D,F,W,$,G,Y,V);if(B)return B;let U;switch(F){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&G&&W<8&&(W+=8),U=this._getColorFromAnsiIndex(W);break;case 50331648:const H=d.AttributeData.toColorRGB(W);U=k.channels.toColor(H[0],H[1],H[2]);break;default:U=$?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(U=k.color.opaque(U)),Y&&(U=k.color.multiplyOpacity(U,g.DIM_OPACITY)),U}_resolveBackgroundRgba(L,I,P){switch(L){case 16777216:case 33554432:return this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return P?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(L,I,P,D){switch(L){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&D&&I<8&&(I+=8),this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return P?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(L,I,P,D,F,W,$,Y,G,V){if(this._config.minimumContrastRatio===1||V)return;const B=this._getContrastCache(G),U=B.getColor(L,D);if(U!==void 0)return U||void 0;const H=this._resolveBackgroundRgba(I,P,$),z=this._resolveForegroundRgba(F,W,$,Y),Z=k.rgba.ensureContrastRatio(H,z,this._config.minimumContrastRatio/(G?2:1));if(!Z)return void B.setColor(L,D,null);const ie=k.channels.toColor(Z>>24&255,Z>>16&255,Z>>8&255);return B.setColor(L,D,ie),ie}_getContrastCache(L){return L?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(L,I,P,D,F=!1){const W=typeof L=="number"?String.fromCharCode(L):L,$=Math.min(this._config.deviceCellWidth*Math.max(W.length,2)+4,this._textureSize);this._tmpCanvas.width<$&&(this._tmpCanvas.width=$);const Y=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<Y&&(this._tmpCanvas.height=Y),this._tmpCtx.save(),this._workAttributeData.fg=P,this._workAttributeData.bg=I,this._workAttributeData.extended.ext=D,this._workAttributeData.isInvisible())return p;const G=!!this._workAttributeData.isBold(),V=!!this._workAttributeData.isInverse(),B=!!this._workAttributeData.isDim(),U=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),z=!!this._workAttributeData.isStrikethrough(),Z=!!this._workAttributeData.isOverline();let ie=this._workAttributeData.getFgColor(),_e=this._workAttributeData.getFgColorMode(),ge=this._workAttributeData.getBgColor(),Q=this._workAttributeData.getBgColorMode();if(V){const Se=ie;ie=ge,ge=Se;const be=_e;_e=Q,Q=be}const K=this._getBackgroundColor(Q,ge,V,B);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=K.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const te=G?this._config.fontWeightBold:this._config.fontWeight,ee=U?"italic":"";this._tmpCtx.font=`${ee} ${te} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=g.TEXT_BASELINE;const we=W.length===1&&(0,h.isPowerlineGlyph)(W.charCodeAt(0)),ke=W.length===1&&(0,h.isRestrictedPowerlineGlyph)(W.charCodeAt(0)),Ae=this._getForegroundColor(I,Q,ge,P,_e,ie,V,B,G,(0,h.treatGlyphAsBackgroundColor)(W.charCodeAt(0)));this._tmpCtx.fillStyle=Ae.css;const Me=ke?0:4;let Je=!1;this._config.customGlyphs!==!1&&(Je=(0,_.tryDrawCustomChar)(this._tmpCtx,W,Me,Me,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let it,Ie=!we;if(it=typeof L=="number"?this._unicodeService.wcwidth(L):this._unicodeService.getStringCellWidth(L),H){this._tmpCtx.save();const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=Se%2==1?.5:0;if(this._tmpCtx.lineWidth=Se,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ie=!1,this._tmpCtx.strokeStyle=`rgb(${d.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ie=!1;let Pe=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Pe<8&&(Pe+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Pe).css}this._tmpCtx.beginPath();const je=Me,pe=Math.ceil(Me+this._config.deviceCharHeight)-be-(F?2*Se:0),Xe=pe+Se,$e=pe+2*Se;let He=this._workAttributeData.getUnderlineVariantOffset();for(let Pe=0;Pe<it;Pe++){this._tmpCtx.save();const re=je+Pe*this._config.deviceCellWidth,fe=je+(Pe+1)*this._config.deviceCellWidth,Le=re+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(re,pe),this._tmpCtx.lineTo(fe,pe),this._tmpCtx.moveTo(re,$e),this._tmpCtx.lineTo(fe,$e);break;case 3:const Qe=Se<=1?$e:Math.ceil(Me+this._config.deviceCharHeight-Se/2)-be,at=Se<=1?pe:Math.ceil(Me+this._config.deviceCharHeight+Se/2)-be,ct=new Path2D;ct.rect(re,pe,this._config.deviceCellWidth,$e-pe),this._tmpCtx.clip(ct),this._tmpCtx.moveTo(re-this._config.deviceCellWidth/2,Xe),this._tmpCtx.bezierCurveTo(re-this._config.deviceCellWidth/2,at,re,at,re,Xe),this._tmpCtx.bezierCurveTo(re,Qe,Le,Qe,Le,Xe),this._tmpCtx.bezierCurveTo(Le,at,fe,at,fe,Xe),this._tmpCtx.bezierCurveTo(fe,Qe,fe+this._config.deviceCellWidth/2,Qe,fe+this._config.deviceCellWidth/2,Xe);break;case 4:const wt=He===0?0:He>=Se?2*Se-He:Se-He;He>=Se||wt===0?(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(re+wt,pe),this._tmpCtx.lineTo(fe,pe)):(this._tmpCtx.setLineDash([Math.round(Se),Math.round(Se)]),this._tmpCtx.moveTo(re,pe),this._tmpCtx.lineTo(re+wt,pe),this._tmpCtx.moveTo(re+wt+Se,pe),this._tmpCtx.lineTo(fe,pe)),He=(0,h.computeNextVariantOffset)(fe-re,Se,He);break;case 5:const Xt=.6,he=.3,nt=fe-re,et=Math.floor(Xt*nt),dt=Math.floor(he*nt),de=nt-et-dt;this._tmpCtx.setLineDash([et,dt,de]),this._tmpCtx.moveTo(re,pe),this._tmpCtx.lineTo(fe,pe);break;default:this._tmpCtx.moveTo(re,pe),this._tmpCtx.lineTo(fe,pe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Je&&this._config.fontSize>=12&&!this._config.allowTransparency&&W!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Pe=this._tmpCtx.measureText(W);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Pe&&Pe.actualBoundingBoxDescent>0){this._tmpCtx.save();const re=new Path2D;re.rect(je,pe-Math.ceil(Se/2),this._config.deviceCellWidth*it,$e-pe+Math.ceil(Se/2)),this._tmpCtx.clip(re),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=K.css,this._tmpCtx.strokeText(W,Me,Me+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(Z){const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),be=Se%2==1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Me,Me+be),this._tmpCtx.lineTo(Me+this._config.deviceCharWidth*it,Me+be),this._tmpCtx.stroke()}if(Je||this._tmpCtx.fillText(W,Me,Me+this._config.deviceCharHeight),W==="_"&&!this._config.allowTransparency){let Se=E(this._tmpCtx.getImageData(Me,Me,this._config.deviceCellWidth,this._config.deviceCellHeight),K,Ae,Ie);if(Se)for(let be=1;be<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=K.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(W,Me,Me+this._config.deviceCharHeight-be),Se=E(this._tmpCtx.getImageData(Me,Me,this._config.deviceCellWidth,this._config.deviceCellHeight),K,Ae,Ie),Se);be++);}if(z){const Se=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),be=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Se,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Me,Me+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.lineTo(Me+this._config.deviceCharWidth*it,Me+Math.floor(this._config.deviceCharHeight/2)-be),this._tmpCtx.stroke()}this._tmpCtx.restore();const ae=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let mt;if(mt=this._config.allowTransparency?(function(Se){for(let be=0;be<Se.data.length;be+=4)if(Se.data[be+3]>0)return!1;return!0})(ae):E(ae,K,Ae,Ie),mt)return p;const De=this._findGlyphBoundingBox(ae,this._workBoundingBox,$,ke,Je,Me);let Fe,Ze;for(;;){if(this._activePages.length===0){const Se=this._createNewPage();Fe=Se,Ze=Se.currentRow,Ze.height=De.size.y;break}Fe=this._activePages[this._activePages.length-1],Ze=Fe.currentRow;for(const Se of this._activePages)De.size.y<=Se.currentRow.height&&(Fe=Se,Ze=Se.currentRow);for(let Se=this._activePages.length-1;Se>=0;Se--)for(const be of this._activePages[Se].fixedRows)be.height<=Ze.height&&De.size.y<=be.height&&(Fe=this._activePages[Se],Ze=be);if(Ze.y+De.size.y>=Fe.canvas.height||Ze.height>De.size.y+2){let Se=!1;if(Fe.currentRow.y+Fe.currentRow.height+De.size.y>=Fe.canvas.height){let be;for(const je of this._activePages)if(je.currentRow.y+je.currentRow.height+De.size.y<je.canvas.height){be=je;break}if(be)Fe=be;else if(x.maxAtlasPages&&this._pages.length>=x.maxAtlasPages&&Ze.y+De.size.y<=Fe.canvas.height&&Ze.height>=De.size.y&&Ze.x+De.size.x<=Fe.canvas.width)Se=!0;else{const je=this._createNewPage();Fe=je,Ze=je.currentRow,Ze.height=De.size.y,Se=!0}}Se||(Fe.currentRow.height>0&&Fe.fixedRows.push(Fe.currentRow),Ze={x:0,y:Fe.currentRow.y+Fe.currentRow.height,height:De.size.y},Fe.fixedRows.push(Ze),Fe.currentRow={x:0,y:Ze.y+Ze.height,height:0})}if(Ze.x+De.size.x<=Fe.canvas.width)break;Ze===Fe.currentRow?(Ze.x=0,Ze.y+=Ze.height,Ze.height=0):Fe.fixedRows.splice(Fe.fixedRows.indexOf(Ze),1)}return De.texturePage=this._pages.indexOf(Fe),De.texturePosition.x=Ze.x,De.texturePosition.y=Ze.y,De.texturePositionClipSpace.x=Ze.x/Fe.canvas.width,De.texturePositionClipSpace.y=Ze.y/Fe.canvas.height,De.sizeClipSpace.x/=Fe.canvas.width,De.sizeClipSpace.y/=Fe.canvas.height,Ze.height=Math.max(Ze.height,De.size.y),Ze.x+=De.size.x,Fe.ctx.putImageData(ae,De.texturePosition.x-this._workBoundingBox.left,De.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,De.size.x,De.size.y),Fe.addGlyph(De),Fe.version++,De}_findGlyphBoundingBox(L,I,P,D,F,W){I.top=0;const $=D?this._config.deviceCellHeight:this._tmpCanvas.height,Y=D?this._config.deviceCellWidth:P;let G=!1;for(let V=0;V<$;V++){for(let B=0;B<Y;B++){const U=V*this._tmpCanvas.width*4+4*B+3;if(L.data[U]!==0){I.top=V,G=!0;break}}if(G)break}I.left=0,G=!1;for(let V=0;V<W+Y;V++){for(let B=0;B<$;B++){const U=B*this._tmpCanvas.width*4+4*V+3;if(L.data[U]!==0){I.left=V,G=!0;break}}if(G)break}I.right=Y,G=!1;for(let V=W+Y-1;V>=W;V--){for(let B=0;B<$;B++){const U=B*this._tmpCanvas.width*4+4*V+3;if(L.data[U]!==0){I.right=V,G=!0;break}}if(G)break}I.bottom=$,G=!1;for(let V=$-1;V>=0;V--){for(let B=0;B<Y;B++){const U=V*this._tmpCanvas.width*4+4*B+3;if(L.data[U]!==0){I.bottom=V,G=!0;break}}if(G)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:I.right-I.left+1,y:I.bottom-I.top+1},sizeClipSpace:{x:I.right-I.left+1,y:I.bottom-I.top+1},offset:{x:-I.left+W+(D||F?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-I.top+W+(D||F?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=x;class j{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(L){this._glyphs.push(L),this._usedPixels+=L.size.x*L.size.y}constructor(L,I,P){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],P)for(const D of P)this._glyphs.push(...D.glyphs),this._usedPixels+=D._usedPixels;this.canvas=R(L,I,I),this.ctx=(0,h.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}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 E(S,L,I,P){const D=L.rgba>>>24,F=L.rgba>>>16&255,W=L.rgba>>>8&255,$=I.rgba>>>24,Y=I.rgba>>>16&255,G=I.rgba>>>8&255,V=Math.floor((Math.abs(D-$)+Math.abs(F-Y)+Math.abs(W-G))/12);let B=!0;for(let U=0;U<S.data.length;U+=4)S.data[U]===D&&S.data[U+1]===F&&S.data[U+2]===W||P&&Math.abs(S.data[U]-D)+Math.abs(S.data[U+1]-F)+Math.abs(S.data[U+2]-W)<V?S.data[U+3]=0:B=!1;return B}function R(S,L,I){const P=S.createElement("canvas");return P.width=L,P.height=I,P}},160:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let a=0,g=0,_=0,h=0;var k,T,M,w,d;function m(f){const x=f.toString(16);return x.length<2?"0"+x:x}function p(f,x){return f<x?(x+.05)/(f+.05):(f+.05)/(x+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(x,j,E,R){return R!==void 0?`#${m(x)}${m(j)}${m(E)}${m(R)}`:`#${m(x)}${m(j)}${m(E)}`},f.toRgba=function(x,j,E,R=255){return(x<<24|j<<16|E<<8|R)>>>0},f.toColor=function(x,j,E,R){return{css:f.toCss(x,j,E,R),rgba:f.toRgba(x,j,E,R)}}})(k||(i.channels=k={})),(function(f){function x(j,E){return h=Math.round(255*E),[a,g,_]=d.toChannels(j.rgba),{css:k.toCss(a,g,_,h),rgba:k.toRgba(a,g,_,h)}}f.blend=function(j,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const R=E.rgba>>24&255,S=E.rgba>>16&255,L=E.rgba>>8&255,I=j.rgba>>24&255,P=j.rgba>>16&255,D=j.rgba>>8&255;return a=I+Math.round((R-I)*h),g=P+Math.round((S-P)*h),_=D+Math.round((L-D)*h),{css:k.toCss(a,g,_),rgba:k.toRgba(a,g,_)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,E,R){const S=d.ensureContrastRatio(j.rgba,E.rgba,R);if(S)return k.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const E=(255|j.rgba)>>>0;return[a,g,_]=d.toChannels(E),{css:k.toCss(a,g,_),rgba:E}},f.opacity=x,f.multiplyOpacity=function(j,E){return h=255&j.rgba,x(j,h*E/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(T||(i.color=T={})),(function(f){let x,j;try{const E=document.createElement("canvas");E.width=1,E.height=1;const R=E.getContext("2d",{willReadFrequently:!0});R&&(x=R,x.globalCompositeOperation="copy",j=x.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return a=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),k.toColor(a,g,_);case 5:return a=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),k.toColor(a,g,_,h);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const R=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return a=parseInt(R[1]),g=parseInt(R[2]),_=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),k.toColor(a,g,_,h);if(!x||!j)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=j,x.fillStyle=E,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[a,g,_,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(a,g,_,h),css:E}}})(M||(i.css=M={})),(function(f){function x(j,E,R){const S=j/255,L=E/255,I=R/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}f.relativeLuminance=function(j){return x(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=x})(w||(i.rgb=w={})),(function(f){function x(E,R,S){const L=E>>24&255,I=E>>16&255,P=E>>8&255;let D=R>>24&255,F=R>>16&255,W=R>>8&255,$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));for(;$<S&&(D>0||F>0||W>0);)D-=Math.max(0,Math.ceil(.1*D)),F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));return(D<<24|F<<16|W<<8|255)>>>0}function j(E,R,S){const L=E>>24&255,I=E>>16&255,P=E>>8&255;let D=R>>24&255,F=R>>16&255,W=R>>8&255,$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));for(;$<S&&(D<255||F<255||W<255);)D=Math.min(255,D+Math.ceil(.1*(255-D))),F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));return(D<<24|F<<16|W<<8|255)>>>0}f.blend=function(E,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,P=E>>24&255,D=E>>16&255,F=E>>8&255;return a=P+Math.round((S-P)*h),g=D+Math.round((L-D)*h),_=F+Math.round((I-F)*h),k.toRgba(a,g,_)},f.ensureContrastRatio=function(E,R,S){const L=w.relativeLuminance(E>>8),I=w.relativeLuminance(R>>8);if(p(L,I)<S){if(I<L){const F=x(E,R,S),W=p(L,w.relativeLuminance(F>>8));if(W<S){const $=j(E,R,S);return W>p(L,w.relativeLuminance($>>8))?F:$}return F}const P=j(E,R,S),D=p(L,w.relativeLuminance(P>>8));if(D<S){const F=x(E,R,S);return D>p(L,w.relativeLuminance(F>>8))?P:F}return P}},f.reduceLuminance=x,f.increaseLuminance=j,f.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(d||(i.rgba=d={})),i.toPaddedHex=m,i.contrastRatio=p},345:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===a)return void this._listeners.splice(g,1)}}})),this._event}fire(a,g){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,a,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,g){return a((_=>g.fire(_)))},i.runAndSubscribe=function(a,g){return g(void 0),a((_=>g(_)))}},859:(b,i)=>{function a(g){for(const _ of g)_.dispose();g.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},i.toDisposable=function(g){return{dispose:g}},i.disposeArray=a,i.getDisposeArrayDisposable=function(g){return{dispose:()=>a(g)}}},485:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,h,k){this._data[_]||(this._data[_]={}),this._data[_][h]=k}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(g,_,h,k,T){this._data.get(g,_)||this._data.set(g,_,new a),this._data.get(g,_).set(h,k,T)}get(g,_,h,k){var T;return(T=this._data.get(g,_))==null?void 0:T.get(h,k)}clear(){this._data.clear()}}},399:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const a=i.isNode?"node":navigator.userAgent,g=i.isNode?"node":navigator.platform;i.isFirefox=a.includes("Firefox"),i.isLegacyEdge=a.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(a),i.getSafariVersion=function(){if(!i.isSafari)return 0;const _=a.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),i.isIpad=g==="iPad",i.isIphone=g==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),i.isLinux=g.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(a)},385:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const g=a(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(T){this._tasks.push(T),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(T){this._idleCallback=void 0;let M=0,w=0,d=T.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(M=Date.now(),this._tasks[this._i]()||this._i++,M=Math.max(1,Date.now()-M),w=Math.max(M,w),m=T.timeRemaining(),1.5*w>m)return d-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-M))}ms`),void this._start();d=m}this.clear()}}class h extends _{_requestCallback(T){return setTimeout((()=>T(this._createDeadline(16))))}_cancelCallback(T){clearTimeout(T)}_createDeadline(T){const M=Date.now()+T;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:h,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(k){this._queue.clear(),this._queue.enqueue(k)}flush(){this._queue.flush()}}},147:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new g}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=a;class g{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,k=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=k}clone(){return new g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=g},782:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const g=a(133),_=a(855),h=a(147);class k extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(M){const w=new k;return w.setFromCharData(M),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(M){this.fg=M[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(M[_.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(M[_.CHAR_DATA_CHAR_INDEX].length===2){const d=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const m=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(d-55296)+m-56320+65536|M[_.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|M[_.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=M[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|M[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=k},855:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},133:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},i.utf32ToString=function(a,g=0,_=a.length){let h="";for(let k=g;k<_;++k){let T=a[k];T>65535?(T-=65536,h+=String.fromCharCode(55296+(T>>10))+String.fromCharCode(T%1024+56320)):h+=String.fromCharCode(T)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,g){const _=a.length;if(!_)return 0;let h=0,k=0;if(this._interim){const T=a.charCodeAt(k++);56320<=T&&T<=57343?g[h++]=1024*(this._interim-55296)+T-56320+65536:(g[h++]=this._interim,g[h++]=T),this._interim=0}for(let T=k;T<_;++T){const M=a.charCodeAt(T);if(55296<=M&&M<=56319){if(++T>=_)return this._interim=M,h;const w=a.charCodeAt(T);56320<=w&&w<=57343?g[h++]=1024*(M-55296)+w-56320+65536:(g[h++]=M,g[h++]=w)}else M!==65279&&(g[h++]=M)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,g){const _=a.length;if(!_)return 0;let h,k,T,M,w=0,d=0,m=0;if(this.interim[0]){let x=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let E,R=0;for(;(E=63&this.interim[++R])&&R<4;)j<<=6,j|=E;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;m<L;){if(m>=_)return 0;if(E=a[m++],(192&E)!=128){m--,x=!0;break}this.interim[R++]=E,j<<=6,j|=63&E}x||(S===2?j<128?m--:g[w++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(g[w++]=j):j<65536||j>1114111||(g[w++]=j)),this.interim.fill(0)}const p=_-4;let f=m;for(;f<_;){for(;!(!(f<p)||128&(h=a[f])||128&(k=a[f+1])||128&(T=a[f+2])||128&(M=a[f+3]));)g[w++]=h,g[w++]=k,g[w++]=T,g[w++]=M,f+=4;if(h=a[f++],h<128)g[w++]=h;else if((224&h)==192){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(d=(31&h)<<6|63&k,d<128){f--;continue}g[w++]=d}else if((240&h)==224){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,w;if(T=a[f++],(192&T)!=128){f--;continue}if(d=(15&h)<<12|(63&k)<<6|63&T,d<2048||d>=55296&&d<=57343||d===65279)continue;g[w++]=d}else if((248&h)==240){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,w;if(T=a[f++],(192&T)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,this.interim[2]=T,w;if(M=a[f++],(192&M)!=128){f--;continue}if(d=(7&h)<<18|(63&k)<<12|(63&T)<<6|63&M,d<65536||d>1114111)continue;g[w++]=d}}return w}}},776:function(b,i,a){var g=this&&this.__decorate||function(d,m,p,f){var x,j=arguments.length,E=j<3?m:f===null?f=Object.getOwnPropertyDescriptor(m,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,m,p,f);else for(var R=d.length-1;R>=0;R--)(x=d[R])&&(E=(j<3?x(E):j>3?x(m,p,E):x(m,p))||E);return j>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(d,m){return function(p,f){m(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=a(859),k=a(97),T={trace:k.LogLevelEnum.TRACE,debug:k.LogLevelEnum.DEBUG,info:k.LogLevelEnum.INFO,warn:k.LogLevelEnum.WARN,error:k.LogLevelEnum.ERROR,off:k.LogLevelEnum.OFF};let M,w=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=T[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let m=0;m<d.length;m++)typeof d[m]=="function"&&(d[m]=d[m]())}_log(d,m,p){this._evalLazyOptionalParams(p),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(d,...m){var p;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,d,m)}debug(d,...m){var p;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,d,m)}info(d,...m){var p;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,d,m)}warn(d,...m){var p;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,d,m)}error(d,...m){var p;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,d,m)}};i.LogService=w=g([_(0,k.IOptionsService)],w),i.setTraceLogger=function(d){M=d},i.traceCall=function(d,m,p){if(typeof p.value!="function")throw new Error("not supported");const f=p.value;p.value=function(...x){if(M.logLevel!==k.LogLevelEnum.TRACE)return f.apply(this,x);M.trace(`GlyphRenderer#${f.name}(${x.map((E=>JSON.stringify(E))).join(", ")})`);const j=f.apply(this,x);return M.trace(`GlyphRenderer#${f.name} return`,j),j}}},726:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",g="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[g]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);const h=function(k,T,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,d,m){d[a]===d?d[g].push({id:w,index:m}):(d[g]=[{id:w,index:m}],d[a]=d)})(h,k,M)};return h.toString=()=>_,i.serviceRegistry.set(_,h),h}},97:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const g=a(726);var _;i.IBufferService=(0,g.createDecorator)("BufferService"),i.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),i.ICoreService=(0,g.createDecorator)("CoreService"),i.ICharsetService=(0,g.createDecorator)("CharsetService"),i.IInstantiationService=(0,g.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(i.LogLevelEnum=_={})),i.ILogService=(0,g.createDecorator)("LogService"),i.IOptionsService=(0,g.createDecorator)("OptionsService"),i.IOscLinkService=(0,g.createDecorator)("OscLinkService"),i.IUnicodeService=(0,g.createDecorator)("UnicodeService"),i.IDecorationService=(0,g.createDecorator)("DecorationService")}},l={};function u(b){var i=l[b];if(i!==void 0)return i.exports;var a=l[b]={exports:{}};return s[b].call(a.exports,a,a.exports,u),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.WebglAddon=void 0;const i=u(345),a=u(859),g=u(399),_=u(666),h=u(776);class k extends a.Disposable{constructor(M){if(g.isSafari&&(0,g.getSafariVersion)()<16){const w={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",w))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=M,this._onChangeTextureAtlas=this.register(new i.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new i.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new i.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new i.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(M){const w=M._core;if(!M.element)return void this.register(w.onWillOpen((()=>this.activate(M))));this._terminal=M;const d=w.coreService,m=w.optionsService,p=w,f=p._renderService,x=p._characterJoinerService,j=p._charSizeService,E=p._coreBrowserService,R=p._decorationService,S=p._logService,L=p._themeService;(0,h.setTraceLogger)(S),this._renderer=this.register(new _.WebglRenderer(M,x,j,E,d,R,m,L,this._preserveDrawingBuffer)),this.register((0,i.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,i.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,i.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,i.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),f.setRenderer(this._renderer),this.register((0,a.toDisposable)((()=>{const I=this._terminal._core._renderService;I.setRenderer(this._terminal._core._createRenderer()),I.handleResize(M.cols,M.rows)})))}get textureAtlas(){var M;return(M=this._renderer)==null?void 0:M.textureAtlas}clearTextureAtlas(){var M;(M=this._renderer)==null||M.clearTextureAtlas()}}b.WebglAddon=k})(),y})()))})(Cu)),Cu.exports}var N1=L1(),Su={exports:{}},zp;function R1(){return zp||(zp=1,(function(t,e){(function(s,l){t.exports=l()})(globalThis,(()=>(()=>{var s={4567:function(b,i,a){var g=this&&this.__decorate||function(p,f,x,j){var E,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,x,j);else for(var L=p.length-1;L>=0;L--)(E=p[L])&&(S=(R<3?E(S):R>3?E(f,x,S):E(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},_=this&&this.__param||function(p,f){return function(x,j){f(x,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const h=a(9042),k=a(9924),T=a(844),M=a(4725),w=a(2585),d=a(3656);let m=i.AccessibilityManager=class extends T.Disposable{constructor(p,f,x,j){super(),this._terminal=p,this._coreBrowserService=x,this._renderService=j,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let E=0;E<this._terminal.rows;E++)this._rowElements[E]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[E]);if(this._topBoundaryFocusListener=E=>this._handleBoundaryFocus(E,0),this._bottomBoundaryFocusListener=E=>this._handleBoundaryFocus(E,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new k.TimeBasedDebouncer(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((E=>this._handleResize(E.rows)))),this.register(this._terminal.onRender((E=>this._refreshRows(E.start,E.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((E=>this._handleChar(E)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
122
|
-
`)))),this.register(this._terminal.onA11yTab((E=>this._handleTab(E)))),this.register(this._terminal.onKey((E=>this._handleKey(E.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,d.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,T.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(p){for(let f=0;f<p;f++)this._handleChar(" ")}_handleChar(p){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==p&&(this._charsToAnnounce+=p):this._charsToAnnounce+=p,p===`
|
|
123
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(p){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(p)||this._charsToConsume.push(p)}_refreshRows(p,f){this._liveRegionDebouncer.refresh(p,f,this._terminal.rows)}_renderRows(p,f){const x=this._terminal.buffer,j=x.lines.length.toString();for(let E=p;E<=f;E++){const R=x.lines.get(x.ydisp+E),S=[],L=(R==null?void 0:R.translateToString(!0,void 0,void 0,S))||"",I=(x.ydisp+E+1).toString(),P=this._rowElements[E];P&&(L.length===0?(P.innerText=" ",this._rowColumns.set(P,[0,1])):(P.textContent=L,this._rowColumns.set(P,S)),P.setAttribute("aria-posinset",I),P.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(p,f){const x=p.target,j=this._rowElements[f===0?1:this._rowElements.length-2];if(x.getAttribute("aria-posinset")===(f===0?"1":`${this._terminal.buffer.lines.length}`)||p.relatedTarget!==j)return;let E,R;if(f===0?(E=x,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(E=this._rowElements.shift(),R=x,this._rowContainer.removeChild(E)),E.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),f===0){const S=this._createAccessibilityTreeNode();this._rowElements.unshift(S),this._rowContainer.insertAdjacentElement("afterbegin",S)}else{const S=this._createAccessibilityTreeNode();this._rowElements.push(S),this._rowContainer.appendChild(S)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(f===0?-1:1),this._rowElements[f===0?1:this._rowElements.length-2].focus(),p.preventDefault(),p.stopImmediatePropagation()}_handleSelectionChange(){var L;if(this._rowElements.length===0)return;const p=document.getSelection();if(!p)return;if(p.isCollapsed)return void(this._rowContainer.contains(p.anchorNode)&&this._terminal.clearSelection());if(!p.anchorNode||!p.focusNode)return void console.error("anchorNode and/or focusNode are null");let f={node:p.anchorNode,offset:p.anchorOffset},x={node:p.focusNode,offset:p.focusOffset};if((f.node.compareDocumentPosition(x.node)&Node.DOCUMENT_POSITION_PRECEDING||f.node===x.node&&f.offset>x.offset)&&([f,x]=[x,f]),f.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(f={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(f.node))return;const j=this._rowElements.slice(-1)[0];if(x.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(x={node:j,offset:((L=j.textContent)==null?void 0:L.length)??0}),!this._rowContainer.contains(x.node))return;const E=({node:I,offset:P})=>{const D=I instanceof Text?I.parentNode:I;let F=parseInt(D==null?void 0:D.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const W=this._rowColumns.get(D);if(!W)return console.warn("columns is null. Race condition?"),null;let $=P<W.length?W[P]:W.slice(-1)[0]+1;return $>=this._terminal.cols&&(++F,$=0),{row:F,column:$}},R=E(f),S=E(x);if(R&&S){if(R.row>S.row||R.row===S.row&&R.column>=S.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(S.row-R.row)*this._terminal.cols-R.column+S.column)}}_handleResize(p){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let f=this._rowContainer.children.length;f<this._terminal.rows;f++)this._rowElements[f]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[f]);for(;this._rowElements.length>p;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const p=this._coreBrowserService.mainDocument.createElement("div");return p.setAttribute("role","listitem"),p.tabIndex=-1,this._refreshRowDimensions(p),p}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let p=0;p<this._terminal.rows;p++)this._refreshRowDimensions(this._rowElements[p])}}_refreshRowDimensions(p){p.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=m=g([_(1,w.IInstantiationService),_(2,M.ICoreBrowserService),_(3,M.IRenderService)],m)},3614:(b,i)=>{function a(k){return k.replace(/\r?\n/g,"\r")}function g(k,T){return T?"\x1B[200~"+k+"\x1B[201~":k}function _(k,T,M,w){k=g(k=a(k),M.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),M.triggerDataEvent(k,!0),T.value=""}function h(k,T,M){const w=M.getBoundingClientRect(),d=k.clientX-w.left-10,m=k.clientY-w.top-10;T.style.width="20px",T.style.height="20px",T.style.left=`${d}px`,T.style.top=`${m}px`,T.style.zIndex="1000",T.focus()}Object.defineProperty(i,"__esModule",{value:!0}),i.rightClickHandler=i.moveTextAreaUnderMouseCursor=i.paste=i.handlePasteEvent=i.copyHandler=i.bracketTextForPaste=i.prepareTextForTerminal=void 0,i.prepareTextForTerminal=a,i.bracketTextForPaste=g,i.copyHandler=function(k,T){k.clipboardData&&k.clipboardData.setData("text/plain",T.selectionText),k.preventDefault()},i.handlePasteEvent=function(k,T,M,w){k.stopPropagation(),k.clipboardData&&_(k.clipboardData.getData("text/plain"),T,M,w)},i.paste=_,i.moveTextAreaUnderMouseCursor=h,i.rightClickHandler=function(k,T,M,w,d){h(k,T,M),d&&w.rightClickSelect(k),T.value=w.selectionText,T.select()}},7239:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const g=a(1505);i.ColorContrastCache=class{constructor(){this._color=new g.TwoKeyMap,this._css=new g.TwoKeyMap}setCss(_,h,k){this._css.set(_,h,k)}getCss(_,h){return this._css.get(_,h)}setColor(_,h,k){this._color.set(_,h,k)}getColor(_,h){return this._color.get(_,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,g,_,h){a.addEventListener(g,_,h);let k=!1;return{dispose:()=>{k||(k=!0,a.removeEventListener(g,_,h))}}}},3551:function(b,i,a){var g=this&&this.__decorate||function(m,p,f,x){var j,E=arguments.length,R=E<3?p:x===null?x=Object.getOwnPropertyDescriptor(p,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,p,f,x);else for(var S=m.length-1;S>=0;S--)(j=m[S])&&(R=(E<3?j(R):E>3?j(p,f,R):j(p,f))||R);return E>3&&R&&Object.defineProperty(p,f,R),R},_=this&&this.__param||function(m,p){return function(f,x){p(f,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const h=a(3656),k=a(8460),T=a(844),M=a(2585),w=a(4725);let d=i.Linkifier=class extends T.Disposable{get currentLink(){return this._currentLink}constructor(m,p,f,x,j){super(),this._element=m,this._mouseService=p,this._renderService=f,this._bufferService=x,this._linkProviderService=j,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new k.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new k.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,T.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,T.toDisposable)((()=>{var E;this._lastMouseEvent=void 0,(E=this._activeProviderReplies)==null||E.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(m){this._lastMouseEvent=m;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);if(!p)return;this._isMouseOut=!1;const f=m.composedPath();for(let x=0;x<f.length;x++){const j=f[x];if(j.classList.contains("xterm"))break;if(j.classList.contains("xterm-hover"))return}this._lastBufferCell&&p.x===this._lastBufferCell.x&&p.y===this._lastBufferCell.y||(this._handleHover(p),this._lastBufferCell=p)}_handleHover(m){if(this._activeLine!==m.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(m,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,m)||(this._clearCurrentLink(),this._askForLink(m,!0))}_askForLink(m,p){var x,j;this._activeProviderReplies&&p||((x=this._activeProviderReplies)==null||x.forEach((E=>{E==null||E.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=m.y);let f=!1;for(const[E,R]of this._linkProviderService.linkProviders.entries())p?(j=this._activeProviderReplies)!=null&&j.get(E)&&(f=this._checkLinkProviderResult(E,m,f)):R.provideLinks(m.y,(S=>{var I,P;if(this._isMouseOut)return;const L=S==null?void 0:S.map((D=>({link:D})));(I=this._activeProviderReplies)==null||I.set(E,L),f=this._checkLinkProviderResult(E,m,f),((P=this._activeProviderReplies)==null?void 0:P.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(m.y,this._activeProviderReplies)}))}_removeIntersectingLinks(m,p){const f=new Set;for(let x=0;x<p.size;x++){const j=p.get(x);if(j)for(let E=0;E<j.length;E++){const R=j[E],S=R.link.range.start.y<m?0:R.link.range.start.x,L=R.link.range.end.y>m?this._bufferService.cols:R.link.range.end.x;for(let I=S;I<=L;I++){if(f.has(I)){j.splice(E--,1);break}f.add(I)}}}}_checkLinkProviderResult(m,p,f){var E;if(!this._activeProviderReplies)return f;const x=this._activeProviderReplies.get(m);let j=!1;for(let R=0;R<m;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(j=!0);if(!j&&x){const R=x.find((S=>this._linkAtPosition(S.link,p)));R&&(f=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!f)for(let R=0;R<this._activeProviderReplies.size;R++){const S=(E=this._activeProviderReplies.get(R))==null?void 0:E.find((L=>this._linkAtPosition(L.link,p)));if(S){f=!0,this._handleNewLink(S);break}}return f}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(m){if(!this._currentLink)return;const p=this._positionFromMouseEvent(m,this._element,this._mouseService);p&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,p)&&this._currentLink.link.activate(m,this._currentLink.link.text)}_clearCurrentLink(m,p){this._currentLink&&this._lastMouseEvent&&(!m||!p||this._currentLink.link.range.start.y>=m&&this._currentLink.link.range.end.y<=p)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,T.disposeArray)(this._linkCacheDisposables))}_handleNewLink(m){if(!this._lastMouseEvent)return;const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._linkAtPosition(m.link,p)&&(this._currentLink=m,this._currentLink.state={decorations:{underline:m.link.decorations===void 0||m.link.decorations.underline,pointerCursor:m.link.decorations===void 0||m.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,m.link,this._lastMouseEvent),m.link.decorations={},Object.defineProperties(m.link.decorations,{pointerCursor:{get:()=>{var f,x;return(x=(f=this._currentLink)==null?void 0:f.state)==null?void 0:x.decorations.pointerCursor},set:f=>{var x;(x=this._currentLink)!=null&&x.state&&this._currentLink.state.decorations.pointerCursor!==f&&(this._currentLink.state.decorations.pointerCursor=f,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",f))}},underline:{get:()=>{var f,x;return(x=(f=this._currentLink)==null?void 0:f.state)==null?void 0:x.decorations.underline},set:f=>{var x,j,E;(x=this._currentLink)!=null&&x.state&&((E=(j=this._currentLink)==null?void 0:j.state)==null?void 0:E.decorations.underline)!==f&&(this._currentLink.state.decorations.underline=f,this._currentLink.state.isHovered&&this._fireUnderlineEvent(m.link,f))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((f=>{if(!this._currentLink)return;const x=f.start===0?0:f.start+1+this._bufferService.buffer.ydisp,j=this._bufferService.buffer.ydisp+1+f.end;if(this._currentLink.link.range.start.y>=x&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(x,j),this._lastMouseEvent)){const E=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);E&&this._askForLink(E,!1)}}))))}_linkHover(m,p,f){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!0),this._currentLink.state.decorations.pointerCursor&&m.classList.add("xterm-cursor-pointer")),p.hover&&p.hover(f,p.text)}_fireUnderlineEvent(m,p){const f=m.range,x=this._bufferService.buffer.ydisp,j=this._createLinkUnderlineEvent(f.start.x-1,f.start.y-x-1,f.end.x,f.end.y-x-1,void 0);(p?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_linkLeave(m,p,f){var x;(x=this._currentLink)!=null&&x.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(p,!1),this._currentLink.state.decorations.pointerCursor&&m.classList.remove("xterm-cursor-pointer")),p.leave&&p.leave(f,p.text)}_linkAtPosition(m,p){const f=m.range.start.y*this._bufferService.cols+m.range.start.x,x=m.range.end.y*this._bufferService.cols+m.range.end.x,j=p.y*this._bufferService.cols+p.x;return f<=j&&j<=x}_positionFromMouseEvent(m,p,f){const x=f.getCoords(m,p,this._bufferService.cols,this._bufferService.rows);if(x)return{x:x[0],y:x[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(m,p,f,x,j){return{x1:m,y1:p,x2:f,y2:x,cols:this._bufferService.cols,fg:j}}};i.Linkifier=d=g([_(1,w.IMouseService),_(2,w.IRenderService),_(3,M.IBufferService),_(4,w.ILinkProviderService)],d)},9042:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.tooMuchOutput=i.promptLabel=void 0,i.promptLabel="Terminal input",i.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(b,i,a){var g=this&&this.__decorate||function(w,d,m,p){var f,x=arguments.length,j=x<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,m,p);else for(var E=w.length-1;E>=0;E--)(f=w[E])&&(j=(x<3?f(j):x>3?f(d,m,j):f(d,m))||j);return x>3&&j&&Object.defineProperty(d,m,j),j},_=this&&this.__param||function(w,d){return function(m,p){d(m,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const h=a(511),k=a(2585);let T=i.OscLinkProvider=class{constructor(w,d,m){this._bufferService=w,this._optionsService=d,this._oscLinkService=m}provideLinks(w,d){var L;const m=this._bufferService.buffer.lines.get(w-1);if(!m)return void d(void 0);const p=[],f=this._optionsService.rawOptions.linkHandler,x=new h.CellData,j=m.getTrimmedLength();let E=-1,R=-1,S=!1;for(let I=0;I<j;I++)if(R!==-1||m.hasContent(I)){if(m.loadCell(I,x),x.hasExtendedAttrs()&&x.extended.urlId){if(R===-1){R=I,E=x.extended.urlId;continue}S=x.extended.urlId!==E}else R!==-1&&(S=!0);if(S||R!==-1&&I===j-1){const P=(L=this._oscLinkService.getLinkData(E))==null?void 0:L.uri;if(P){const D={start:{x:R+1,y:w},end:{x:I+(S||I!==j-1?0:1),y:w}};let F=!1;if(!(f!=null&&f.allowNonHttpProtocols))try{const W=new URL(P);["http:","https:"].includes(W.protocol)||(F=!0)}catch{F=!0}F||p.push({text:P,range:D,activate:(W,$)=>f?f.activate(W,$,D):M(0,$),hover:(W,$)=>{var Y;return(Y=f==null?void 0:f.hover)==null?void 0:Y.call(f,W,$,D)},leave:(W,$)=>{var Y;return(Y=f==null?void 0:f.leave)==null?void 0:Y.call(f,W,$,D)}})}S=!1,x.hasExtendedAttrs()&&x.extended.urlId?(R=I,E=x.extended.urlId):(R=-1,E=-1)}}d(p)}};function M(w,d){if(confirm(`Do you want to navigate to ${d}?
|
|
124
|
-
|
|
125
|
-
WARNING: This link could potentially be dangerous`)){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=T=g([_(0,k.IBufferService),_(1,k.IOptionsService),_(2,k.IOscLinkService)],T)},6193:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(a,g){this._renderCallback=a,this._coreBrowserService=g,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,g,_){this._rowCount=_,a=a!==void 0?a:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g,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)return void this._runRefreshCallbacks();const a=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,g),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Terminal=void 0;const g=a(3614),_=a(3656),h=a(3551),k=a(9042),T=a(3730),M=a(1680),w=a(3107),d=a(5744),m=a(2950),p=a(1296),f=a(428),x=a(4269),j=a(5114),E=a(8934),R=a(3230),S=a(9312),L=a(4725),I=a(6731),P=a(8055),D=a(8969),F=a(8460),W=a(844),$=a(6114),Y=a(8437),G=a(2584),V=a(7399),B=a(5941),U=a(9074),H=a(2585),z=a(5435),Z=a(4567),ie=a(779);class _e extends D.CoreTerminal{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}constructor(Q={}){super(Q),this.browser=$,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new W.MutableDisposable),this._onCursorMove=this.register(new F.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new F.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new F.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new F.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new F.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new F.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new F.EventEmitter),this._onBlur=this.register(new F.EventEmitter),this._onA11yCharEmitter=this.register(new F.EventEmitter),this._onA11yTabEmitter=this.register(new F.EventEmitter),this._onWillOpen=this.register(new F.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(U.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(L.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(T.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((K,te)=>this.refresh(K,te)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((K=>this._reportWindowsOptions(K)))),this.register(this._inputHandler.onColor((K=>this._handleColorEvent(K)))),this.register((0,F.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,F.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,F.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((K=>this._afterResize(K.cols,K.rows)))),this.register((0,W.toDisposable)((()=>{var K,te;this._customKeyEventHandler=void 0,(te=(K=this.element)==null?void 0:K.parentNode)==null||te.removeChild(this.element)})))}_handleColorEvent(Q){if(this._themeService)for(const K of Q){let te,ee="";switch(K.index){case 256:te="foreground",ee="10";break;case 257:te="background",ee="11";break;case 258:te="cursor",ee="12";break;default:te="ansi",ee="4;"+K.index}switch(K.type){case 0:const we=P.color.toColorRGB(te==="ansi"?this._themeService.colors.ansi[K.index]:this._themeService.colors[te]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${ee};${(0,B.toRgbString)(we)}${G.C1_ESCAPED.ST}`);break;case 1:if(te==="ansi")this._themeService.modifyColors((ke=>ke.ansi[K.index]=P.channels.toColor(...K.color)));else{const ke=te;this._themeService.modifyColors((Ae=>Ae[ke]=P.channels.toColor(...K.color)))}break;case 2:this._themeService.restoreColor(K.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(Q){Q?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(Q){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var Q;return(Q=this.textarea)==null?void 0:Q.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const Q=this.buffer.ybase+this.buffer.y,K=this.buffer.lines.get(Q);if(!K)return;const te=Math.min(this.buffer.x,this.cols-1),ee=this._renderService.dimensions.css.cell.height,we=K.getWidth(te),ke=this._renderService.dimensions.css.cell.width*we,Ae=this.buffer.y*this._renderService.dimensions.css.cell.height,Me=te*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Me+"px",this.textarea.style.top=Ae+"px",this.textarea.style.width=ke+"px",this.textarea.style.height=ee+"px",this.textarea.style.lineHeight=ee+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",(K=>{this.hasSelection()&&(0,g.copyHandler)(K,this._selectionService)})));const Q=K=>(0,g.handlePasteEvent)(K,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",Q)),this.register((0,_.addDisposableDomListener)(this.element,"paste",Q)),$.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(K=>{K.button===2&&(0,g.rightClickHandler)(K,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(K=>{(0,g.rightClickHandler)(K,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),$.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(K=>{K.button===1&&(0,g.moveTextAreaUnderMouseCursor)(K,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",(Q=>this._keyUp(Q)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",(Q=>this._keyDown(Q)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",(Q=>this._keyPress(Q)),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",(Q=>this._compositionHelper.compositionupdate(Q)))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,_.addDisposableDomListener)(this.textarea,"input",(Q=>this._inputEvent(Q)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(Q){var te;if(!Q)throw new Error("Terminal requires a parent element.");if(Q.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((te=this.element)==null?void 0:te.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=Q.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"),Q.appendChild(this.element);const K=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),K.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,_.addDisposableDomListener)(this.screenElement,"mousemove",(ee=>this.updateCursorStyle(ee)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),K.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",k.promptLabel),$.isChromeOS||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._coreBrowserService=this.register(this._instantiationService.createInstance(j.CoreBrowserService,this.textarea,Q.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(L.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",(ee=>this._handleTextAreaFocus(ee)))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(f.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(L.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(L.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(x.CharacterJoinerService),this._instantiationService.setService(L.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(L.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ee=>this._onRender.fire(ee)))),this.onResize((ee=>this._renderService.resize(ee.cols,ee.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(m.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(E.MouseService),this._instantiationService.setService(L.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(K);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(M.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ee=>this.scrollLines(ee.amount,ee.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),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.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(S.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(L.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ee=>this.scrollLines(ee.amount,ee.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ee=>this._renderService.handleSelectionChanged(ee.start,ee.end,ee.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ee=>{this.textarea.value=ee,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ee=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,_.addDisposableDomListener)(this.element,"mousedown",(ee=>this._selectionService.handleMouseDown(ee)))),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(Z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ee=>this._handleScreenReaderModeOptionChange(ee)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ee=>{!this._overviewRulerRenderer&&ee&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(d.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Q=this,K=this.element;function te(ke){const Ae=Q._mouseService.getMouseReportCoords(ke,Q.screenElement);if(!Ae)return!1;let Me,Je;switch(ke.overrideType||ke.type){case"mousemove":Je=32,ke.buttons===void 0?(Me=3,ke.button!==void 0&&(Me=ke.button<3?ke.button:3)):Me=1&ke.buttons?0:4&ke.buttons?1:2&ke.buttons?2:3;break;case"mouseup":Je=0,Me=ke.button<3?ke.button:3;break;case"mousedown":Je=1,Me=ke.button<3?ke.button:3;break;case"wheel":if(Q._customWheelEventHandler&&Q._customWheelEventHandler(ke)===!1||Q.viewport.getLinesScrolled(ke)===0)return!1;Je=ke.deltaY<0?0:1,Me=4;break;default:return!1}return!(Je===void 0||Me===void 0||Me>4)&&Q.coreMouseService.triggerMouseEvent({col:Ae.col,row:Ae.row,x:Ae.x,y:Ae.y,button:Me,action:Je,ctrl:ke.ctrlKey,alt:ke.altKey,shift:ke.shiftKey})}const ee={mouseup:null,wheel:null,mousedrag:null,mousemove:null},we={mouseup:ke=>(te(ke),ke.buttons||(this._document.removeEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.removeEventListener("mousemove",ee.mousedrag)),this.cancel(ke)),wheel:ke=>(te(ke),this.cancel(ke,!0)),mousedrag:ke=>{ke.buttons&&te(ke)},mousemove:ke=>{ke.buttons||te(ke)}};this.register(this.coreMouseService.onProtocolChange((ke=>{ke?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ke)),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()),8&ke?ee.mousemove||(K.addEventListener("mousemove",we.mousemove),ee.mousemove=we.mousemove):(K.removeEventListener("mousemove",ee.mousemove),ee.mousemove=null),16&ke?ee.wheel||(K.addEventListener("wheel",we.wheel,{passive:!1}),ee.wheel=we.wheel):(K.removeEventListener("wheel",ee.wheel),ee.wheel=null),2&ke?ee.mouseup||(ee.mouseup=we.mouseup):(this._document.removeEventListener("mouseup",ee.mouseup),ee.mouseup=null),4&ke?ee.mousedrag||(ee.mousedrag=we.mousedrag):(this._document.removeEventListener("mousemove",ee.mousedrag),ee.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(K,"mousedown",(ke=>{if(ke.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ke))return te(ke),ee.mouseup&&this._document.addEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.addEventListener("mousemove",ee.mousedrag),this.cancel(ke)}))),this.register((0,_.addDisposableDomListener)(K,"wheel",(ke=>{if(!ee.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ke)===!1)return!1;if(!this.buffer.hasScrollback){const Ae=this.viewport.getLinesScrolled(ke);if(Ae===0)return;const Me=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ke.deltaY<0?"A":"B");let Je="";for(let it=0;it<Math.abs(Ae);it++)Je+=Me;return this.coreService.triggerDataEvent(Je,!0),this.cancel(ke,!0)}return this.viewport.handleWheel(ke)?this.cancel(ke):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(K,"touchstart",(ke=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ke),this.cancel(ke)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(K,"touchmove",(ke=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ke)?void 0:this.cancel(ke)}),{passive:!1}))}refresh(Q,K){var te;(te=this._renderService)==null||te.refreshRows(Q,K)}updateCursorStyle(Q){var K;(K=this._selectionService)!=null&&K.shouldColumnSelect(Q)?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(Q,K,te=0){var ee;te===1?(super.scrollLines(Q,K,te),this.refresh(0,this.rows-1)):(ee=this.viewport)==null||ee.scrollLines(Q)}paste(Q){(0,g.paste)(Q,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(Q){this._customKeyEventHandler=Q}attachCustomWheelEventHandler(Q){this._customWheelEventHandler=Q}registerLinkProvider(Q){return this._linkProviderService.registerLinkProvider(Q)}registerCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const K=this._characterJoinerService.register(Q);return this.refresh(0,this.rows-1),K}deregisterCharacterJoiner(Q){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(Q)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(Q){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+Q)}registerDecoration(Q){return this._decorationService.registerDecoration(Q)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(Q,K,te){this._selectionService.setSelection(Q,K,te)}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(){var Q;(Q=this._selectionService)==null||Q.clearSelection()}selectAll(){var Q;(Q=this._selectionService)==null||Q.selectAll()}selectLines(Q,K){var te;(te=this._selectionService)==null||te.selectLines(Q,K)}_keyDown(Q){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;const K=this.browser.isMac&&this.options.macOptionIsMeta&&Q.altKey;if(!K&&!this._compositionHelper.keydown(Q))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;K||Q.key!=="Dead"&&Q.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const te=(0,V.evaluateKeyboardEvent)(Q,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Q),te.type===3||te.type===2){const ee=this.rows-1;return this.scrollLines(te.type===2?-ee:ee),this.cancel(Q,!0)}return te.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Q)||(te.cancel&&this.cancel(Q,!0),!te.key||!!(Q.key&&!Q.ctrlKey&&!Q.altKey&&!Q.metaKey&&Q.key.length===1&&Q.key.charCodeAt(0)>=65&&Q.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(te.key!==G.C0.ETX&&te.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:te.key,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(te.key,!0),!this.optionsService.rawOptions.screenReaderMode||Q.altKey||Q.ctrlKey?this.cancel(Q,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Q,K){const te=Q.isMac&&!this.options.macOptionIsMeta&&K.altKey&&!K.ctrlKey&&!K.metaKey||Q.isWindows&&K.altKey&&K.ctrlKey&&!K.metaKey||Q.isWindows&&K.getModifierState("AltGraph");return K.type==="keypress"?te:te&&(!K.keyCode||K.keyCode>47)}_keyUp(Q){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1||((function(K){return K.keyCode===16||K.keyCode===17||K.keyCode===18})(Q)||this.focus(),this.updateCursorStyle(Q),this._keyPressHandled=!1)}_keyPress(Q){let K;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;if(this.cancel(Q),Q.charCode)K=Q.charCode;else if(Q.which===null||Q.which===void 0)K=Q.keyCode;else{if(Q.which===0||Q.charCode===0)return!1;K=Q.which}return!(!K||(Q.altKey||Q.ctrlKey||Q.metaKey)&&!this._isThirdLevelShift(this.browser,Q)||(K=String.fromCharCode(K),this._onKey.fire({key:K,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(K,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(Q){if(Q.data&&Q.inputType==="insertText"&&(!Q.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const K=Q.data;return this.coreService.triggerDataEvent(K,!0),this.cancel(Q),!0}return!1}resize(Q,K){Q!==this.cols||K!==this.rows?super.resize(Q,K):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Q,K){var te,ee;(te=this._charSizeService)==null||te.measure(),(ee=this.viewport)==null||ee.syncScrollArea(!0)}clear(){var Q;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 K=1;K<this.rows;K++)this.buffer.lines.push(this.buffer.getBlankLine(Y.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(Q=this.viewport)==null||Q.reset(),this.refresh(0,this.rows-1)}}reset(){var K,te;this.options.rows=this.rows,this.options.cols=this.cols;const Q=this._customKeyEventHandler;this._setup(),super.reset(),(K=this._selectionService)==null||K.reset(),this._decorationService.reset(),(te=this.viewport)==null||te.reset(),this._customKeyEventHandler=Q,this.refresh(0,this.rows-1)}clearTextureAtlas(){var Q;(Q=this._renderService)==null||Q.clearTextureAtlas()}_reportFocus(){var Q;(Q=this.element)!=null&&Q.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(Q){if(this._renderService)switch(Q){case z.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const K=this._renderService.dimensions.css.canvas.width.toFixed(0),te=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${te};${K}t`);break;case z.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ee=this._renderService.dimensions.css.cell.width.toFixed(0),we=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${we};${ee}t`)}}cancel(Q,K){if(this.options.cancelEvents||K)return Q.preventDefault(),Q.stopPropagation(),!1}}i.Terminal=_e},9924:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(a,g=1e3){this._renderCallback=a,this._debounceThresholdMS=g,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,g,_){this._rowCount=_,a=a!==void 0?a:0,g=g!==void 0?g:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,g):g;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const k=h-this._lastRefreshMs,T=this._debounceThresholdMS-k;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),T)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),g=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,g)}}},1680:function(b,i,a){var g=this&&this.__decorate||function(m,p,f,x){var j,E=arguments.length,R=E<3?p:x===null?x=Object.getOwnPropertyDescriptor(p,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,p,f,x);else for(var S=m.length-1;S>=0;S--)(j=m[S])&&(R=(E<3?j(R):E>3?j(p,f,R):j(p,f))||R);return E>3&&R&&Object.defineProperty(p,f,R),R},_=this&&this.__param||function(m,p){return function(f,x){p(f,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const h=a(3656),k=a(4725),T=a(8460),M=a(844),w=a(2585);let d=i.Viewport=class extends M.Disposable{constructor(m,p,f,x,j,E,R,S){super(),this._viewportElement=m,this._scrollArea=p,this._bufferService=f,this._optionsService=x,this._charSizeService=j,this._renderService=E,this._coreBrowserService=R,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new T.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((L=>this._renderDimensions=L))),this._handleThemeChange(S.colors),this.register(S.onChangeColors((L=>this._handleThemeChange(L)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(m){this._viewportElement.style.backgroundColor=m.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(m){if(m)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const p=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==p&&(this._lastRecordedBufferHeight=p,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const m=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==m&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=m),this._refreshAnimationFrame=null}syncScrollArea(m=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(m);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(m)}_handleScroll(m){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const p=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:p,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const m=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(m*(this._smoothScrollState.target-this._smoothScrollState.origin)),m<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(m,p){const f=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(p<0&&this._viewportElement.scrollTop!==0||p>0&&f<this._lastRecordedBufferHeight)||(m.cancelable&&m.preventDefault(),!1)}handleWheel(m){const p=this._getPixelsScrolled(m);return p!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+p:this._smoothScrollState.target+=p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}scrollLines(m){if(m!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const p=m*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+p,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!1})}_getPixelsScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_LINE?p*=this._currentRowHeight:m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._currentRowHeight*this._bufferService.rows),p}getBufferElements(m,p){var S;let f,x="";const j=[],E=p??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let L=m;L<E;L++){const I=R.get(L);if(!I)continue;const P=(S=R.get(L+1))==null?void 0:S.isWrapped;if(x+=I.translateToString(!P),!P||L===R.length-1){const D=document.createElement("div");D.textContent=x,j.push(D),x.length>0&&(f=D),x=""}}return{bufferElements:j,cursorElement:f}}getLinesScrolled(m){if(m.deltaY===0||m.shiftKey)return 0;let p=this._applyScrollModifier(m.deltaY,m);return m.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(p/=this._currentRowHeight+0,this._wheelPartialScroll+=p,p=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):m.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(p*=this._bufferService.rows),p}_applyScrollModifier(m,p){const f=this._optionsService.rawOptions.fastScrollModifier;return f==="alt"&&p.altKey||f==="ctrl"&&p.ctrlKey||f==="shift"&&p.shiftKey?m*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:m*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(m){this._lastTouchY=m.touches[0].pageY}handleTouchMove(m){const p=this._lastTouchY-m.touches[0].pageY;return this._lastTouchY=m.touches[0].pageY,p!==0&&(this._viewportElement.scrollTop+=p,this._bubbleScroll(m,p))}};i.Viewport=d=g([_(2,w.IBufferService),_(3,w.IOptionsService),_(4,k.ICharSizeService),_(5,k.IRenderService),_(6,k.ICoreBrowserService),_(7,k.IThemeService)],d)},3107:function(b,i,a){var g=this&&this.__decorate||function(w,d,m,p){var f,x=arguments.length,j=x<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,m,p);else for(var E=w.length-1;E>=0;E--)(f=w[E])&&(j=(x<3?f(j):x>3?f(d,m,j):f(d,m))||j);return x>3&&j&&Object.defineProperty(d,m,j),j},_=this&&this.__param||function(w,d){return function(m,p){d(m,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const h=a(4725),k=a(844),T=a(2585);let M=i.BufferDecorationRenderer=class extends k.Disposable{constructor(w,d,m,p,f){super(),this._screenElement=w,this._bufferService=d,this._coreBrowserService=m,this._decorationService=p,this._renderService=f,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((x=>this._removeDecoration(x)))),this.register((0,k.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var p;const d=this._coreBrowserService.mainDocument.createElement("div");d.classList.add("xterm-decoration"),d.classList.toggle("xterm-decoration-top-layer",((p=w==null?void 0:w.options)==null?void 0:p.layer)==="top"),d.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,d.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",d.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",d.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const m=w.options.x??0;return m&&m>this._bufferService.cols&&(d.style.display="none"),this._refreshXPosition(w,d),d}_refreshStyle(w){const d=w.marker.line-this._bufferService.buffers.active.ydisp;if(d<0||d>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let m=this._decorationElements.get(w);m||(m=this._createElement(w),w.element=m,this._decorationElements.set(w,m),this._container.appendChild(m),w.onDispose((()=>{this._decorationElements.delete(w),m.remove()}))),m.style.top=d*this._renderService.dimensions.css.cell.height+"px",m.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(m)}}_refreshXPosition(w,d=w.element){if(!d)return;const m=w.options.x??0;(w.options.anchor||"left")==="right"?d.style.right=m?m*this._renderService.dimensions.css.cell.width+"px":"":d.style.left=m?m*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var d;(d=this._decorationElements.get(w))==null||d.remove(),this._decorationElements.delete(w),w.dispose()}};i.BufferDecorationRenderer=M=g([_(1,T.IBufferService),_(2,h.ICoreBrowserService),_(3,T.IDecorationService),_(4,h.IRenderService)],M)},5871:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorZoneStore=void 0,i.ColorZoneStore=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(a){if(a.options.overviewRulerOptions){for(const g of this._zones)if(g.color===a.options.overviewRulerOptions.color&&g.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(g,a.marker.line))return;if(this._lineAdjacentToZone(g,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(g,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,g){return g>=a.startBufferLine&&g<=a.endBufferLine}_lineAdjacentToZone(a,g,_){return g>=a.startBufferLine-this._linePadding[_||"full"]&&g<=a.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(a,g){a.startBufferLine=Math.min(a.startBufferLine,g),a.endBufferLine=Math.max(a.endBufferLine,g)}}},5744:function(b,i,a){var g=this&&this.__decorate||function(f,x,j,E){var R,S=arguments.length,L=S<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,j):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,x,j,E);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(x,j,L):R(x,j))||L);return S>3&&L&&Object.defineProperty(x,j,L),L},_=this&&this.__param||function(f,x){return function(j,E){x(j,E,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const h=a(5871),k=a(4725),T=a(844),M=a(2585),w={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},m={full:0,left:0,center:0,right:0};let p=i.OverviewRulerRenderer=class extends T.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(f,x,j,E,R,S,L){var P;super(),this._viewportElement=f,this._screenElement=x,this._bufferService=j,this._decorationService=E,this._renderService=R,this._optionsService=S,this._coreBrowserService=L,this._colorZoneStore=new h.ColorZoneStore,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(),(P=this._viewportElement.parentElement)==null||P.insertBefore(this._canvas,this._viewportElement);const I=this._canvas.getContext("2d");if(!I)throw new Error("Ctx cannot be null");this._ctx=I,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,T.toDisposable)((()=>{var D;(D=this._canvas)==null||D.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){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())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const f=Math.floor(this._canvas.width/3),x=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=f,d.center=x,d.right=f,this._refreshDrawHeightConstants(),m.full=0,m.left=0,m.center=d.left,m.right=d.left+d.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const f=this._canvas.height/this._bufferService.buffer.lines.length,x=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowserService.dpr);w.left=x,w.center=x,w.right=x}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.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(const x of this._decorationService.decorations)this._colorZoneStore.addDecoration(x);this._ctx.lineWidth=1;const f=this._colorZoneStore.zones;for(const x of f)x.position!=="full"&&this._renderColorZone(x);for(const x of f)x.position==="full"&&this._renderColorZone(x);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(m[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-w[f.position||"full"]/2),d[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[f.position||"full"]))}_queueRefresh(f,x){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=x||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=p=g([_(2,M.IBufferService),_(3,M.IDecorationService),_(4,k.IRenderService),_(5,M.IOptionsService),_(6,k.ICoreBrowserService)],p)},2950:function(b,i,a){var g=this&&this.__decorate||function(w,d,m,p){var f,x=arguments.length,j=x<3?d:p===null?p=Object.getOwnPropertyDescriptor(d,m):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,d,m,p);else for(var E=w.length-1;E>=0;E--)(f=w[E])&&(j=(x<3?f(j):x>3?f(d,m,j):f(d,m))||j);return x>3&&j&&Object.defineProperty(d,m,j),j},_=this&&this.__param||function(w,d){return function(m,p){d(m,p,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const h=a(4725),k=a(2585),T=a(2584);let M=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,d,m,p,f,x){this._textarea=w,this._compositionView=d,this._bufferService=m,this._optionsService=p,this._coreService=f,this._renderService=x,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const d={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let m;this._isSendingComposition=!1,d.start+=this._dataAlreadySent.length,m=this._isComposing?this._textarea.value.substring(d.start,d.end):this._textarea.value.substring(d.start),m.length>0&&this._coreService.triggerDataEvent(m,!0)}}),0)}else{this._isSendingComposition=!1;const d=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(d,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const d=this._textarea.value,m=d.replace(w,"");this._dataAlreadySent=m,d.length>w.length?this._coreService.triggerDataEvent(m,!0):d.length<w.length?this._coreService.triggerDataEvent(`${T.C0.DEL}`,!0):d.length===w.length&&d!==w&&this._coreService.triggerDataEvent(d,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const d=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),m=this._renderService.dimensions.css.cell.height,p=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,f=d*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=f+"px",this._compositionView.style.top=p+"px",this._compositionView.style.height=m+"px",this._compositionView.style.lineHeight=m+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const x=this._compositionView.getBoundingClientRect();this._textarea.style.left=f+"px",this._textarea.style.top=p+"px",this._textarea.style.width=Math.max(x.width,1)+"px",this._textarea.style.height=Math.max(x.height,1)+"px",this._textarea.style.lineHeight=x.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=M=g([_(2,k.IBufferService),_(3,k.IOptionsService),_(4,k.ICoreService),_(5,h.IRenderService)],M)},9806:(b,i)=>{function a(g,_,h){const k=h.getBoundingClientRect(),T=g.getComputedStyle(h),M=parseInt(T.getPropertyValue("padding-left")),w=parseInt(T.getPropertyValue("padding-top"));return[_.clientX-k.left-M,_.clientY-k.top-w]}Object.defineProperty(i,"__esModule",{value:!0}),i.getCoords=i.getCoordsRelativeToElement=void 0,i.getCoordsRelativeToElement=a,i.getCoords=function(g,_,h,k,T,M,w,d,m){if(!M)return;const p=a(g,_,h);return p?(p[0]=Math.ceil((p[0]+(m?w/2:0))/w),p[1]=Math.ceil(p[1]/d),p[0]=Math.min(Math.max(p[0],1),k+(m?1:0)),p[1]=Math.min(Math.max(p[1],1),T),p):void 0}},9504:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const g=a(2584);function _(d,m,p,f){const x=d-h(d,p),j=m-h(m,p),E=Math.abs(x-j)-(function(R,S,L){let I=0;const P=R-h(R,L),D=S-h(S,L);for(let F=0;F<Math.abs(P-D);F++){const W=k(R,S)==="A"?-1:1,$=L.buffer.lines.get(P+W*F);$!=null&&$.isWrapped&&I++}return I})(d,m,p);return w(E,M(k(d,m),f))}function h(d,m){let p=0,f=m.buffer.lines.get(d),x=f==null?void 0:f.isWrapped;for(;x&&d>=0&&d<m.rows;)p++,f=m.buffer.lines.get(--d),x=f==null?void 0:f.isWrapped;return p}function k(d,m){return d>m?"A":"B"}function T(d,m,p,f,x,j){let E=d,R=m,S="";for(;E!==p||R!==f;)E+=x?1:-1,x&&E>j.cols-1?(S+=j.buffer.translateBufferLineToString(R,!1,d,E),E=0,d=0,R++):!x&&E<0&&(S+=j.buffer.translateBufferLineToString(R,!1,0,d+1),E=j.cols-1,d=E,R--);return S+j.buffer.translateBufferLineToString(R,!1,d,E)}function M(d,m){const p=m?"O":"[";return g.C0.ESC+p+d}function w(d,m){d=Math.floor(d);let p="";for(let f=0;f<d;f++)p+=m;return p}i.moveToCellSequence=function(d,m,p,f){const x=p.buffer.x,j=p.buffer.y;if(!p.buffer.hasScrollback)return(function(S,L,I,P,D,F){return _(L,P,D,F).length===0?"":w(T(S,L,S,L-h(L,D),!1,D).length,M("D",F))})(x,j,0,m,p,f)+_(j,m,p,f)+(function(S,L,I,P,D,F){let W;W=_(L,P,D,F).length>0?P-h(P,D):L;const $=P,Y=(function(G,V,B,U,H,z){let Z;return Z=_(B,U,H,z).length>0?U-h(U,H):V,G<B&&Z<=U||G>=B&&Z<U?"C":"D"})(S,L,I,P,D,F);return w(T(S,W,I,$,Y==="C",D).length,M(Y,F))})(x,j,d,m,p,f);let E;if(j===m)return E=x>d?"D":"C",w(Math.abs(x-d),M(E,f));E=j>m?"D":"C";const R=Math.abs(j-m);return w((function(S,L){return L.cols-S})(j>m?d:x,p)+(R-1)*p.cols+1+((j>m?x:d)-1),M(E,f))}},1296:function(b,i,a){var g=this&&this.__decorate||function(F,W,$,Y){var G,V=arguments.length,B=V<3?W:Y===null?Y=Object.getOwnPropertyDescriptor(W,$):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(F,W,$,Y);else for(var U=F.length-1;U>=0;U--)(G=F[U])&&(B=(V<3?G(B):V>3?G(W,$,B):G(W,$))||B);return V>3&&B&&Object.defineProperty(W,$,B),B},_=this&&this.__param||function(F,W){return function($,Y){W($,Y,F)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const h=a(3787),k=a(2550),T=a(2223),M=a(6171),w=a(6052),d=a(4725),m=a(8055),p=a(8460),f=a(844),x=a(2585),j="xterm-dom-renderer-owner-",E="xterm-rows",R="xterm-fg-",S="xterm-bg-",L="xterm-focus",I="xterm-selection";let P=1,D=i.DomRenderer=class extends f.Disposable{constructor(F,W,$,Y,G,V,B,U,H,z,Z,ie,_e){super(),this._terminal=F,this._document=W,this._element=$,this._screenElement=Y,this._viewportElement=G,this._helperContainer=V,this._linkifier2=B,this._charSizeService=H,this._optionsService=z,this._bufferService=Z,this._coreBrowserService=ie,this._themeService=_e,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new p.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(E),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(I),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,M.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((ge=>this._injectCss(ge)))),this._injectCss(this._themeService.colors),this._rowFactory=U.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(j+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ge=>this._handleLinkHover(ge)))),this.register(this._linkifier2.onHideLinkUnderline((ge=>this._handleLinkLeave(ge)))),this.register((0,f.toDisposable)((()=>{this._element.classList.remove(j+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new k.WidthCache(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(){const F=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*F,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*F),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/F),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/F),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(const $ of this._rowElements)$.style.width=`${this.dimensions.css.canvas.width}px`,$.style.height=`${this.dimensions.css.cell.height}px`,$.style.lineHeight=`${this.dimensions.css.cell.height}px`,$.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const W=`${this._terminalSelector} .${E} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=W,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(F){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let W=`${this._terminalSelector} .${E} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;W+=`${this._terminalSelector} .${E} .xterm-dim { color: ${m.color.multiplyOpacity(F.foreground,.5).css};}`,W+=`${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;}`;const $=`blink_underline_${this._terminalClass}`,Y=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;W+=`@keyframes ${$} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${Y} { 50% { box-shadow: none; }}`,W+=`@keyframes ${G} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,W+=`${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${E}.${L} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${E} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,W+=`${this._terminalSelector} .${I} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${I} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${I} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[V,B]of F.ansi.entries())W+=`${this._terminalSelector} .${R}${V} { color: ${B.css}; }${this._terminalSelector} .${R}${V}.xterm-dim { color: ${m.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${S}${V} { background-color: ${B.css}; }`;W+=`${this._terminalSelector} .${R}${T.INVERTED_DEFAULT_COLOR} { color: ${m.color.opaque(F.background).css}; }${this._terminalSelector} .${R}${T.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${m.color.multiplyOpacity(m.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${S}${T.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=W}_setDefaultSpacing(){const F=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${F}px`,this._rowFactory.defaultSpacing=F}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(F,W){for(let $=this._rowElements.length;$<=W;$++){const Y=this._document.createElement("div");this._rowContainer.appendChild(Y),this._rowElements.push(Y)}for(;this._rowElements.length>W;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,W){this._refreshRowElements(F,W),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(L),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(L),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,W,$){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,W,$),this.renderRows(0,this._bufferService.rows-1),!F||!W)return;this._selectionRenderModel.update(this._terminal,F,W,$);const Y=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,V=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(V>=this._bufferService.rows||B<0)return;const U=this._document.createDocumentFragment();if($){const H=F[0]>W[0];U.appendChild(this._createSelectionElement(V,H?W[0]:F[0],H?F[0]:W[0],B-V+1))}else{const H=Y===V?F[0]:0,z=V===G?W[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(V,H,z));const Z=B-V-1;if(U.appendChild(this._createSelectionElement(V+1,0,this._bufferService.cols,Z)),V!==B){const ie=G===B?W[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(B,0,ie))}}this._selectionContainer.appendChild(U)}_createSelectionElement(F,W,$,Y=1){const G=this._document.createElement("div"),V=W*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*($-W);return V+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-V),G.style.height=Y*this.dimensions.css.cell.height+"px",G.style.top=F*this.dimensions.css.cell.height+"px",G.style.left=`${V}px`,G.style.width=`${B}px`,G}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(const F of this._rowElements)F.replaceChildren()}renderRows(F,W){const $=this._bufferService.buffer,Y=$.ybase+$.y,G=Math.min($.x,this._bufferService.cols-1),V=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,U=this._optionsService.rawOptions.cursorInactiveStyle;for(let H=F;H<=W;H++){const z=H+$.ydisp,Z=this._rowElements[H],ie=$.lines.get(z);if(!Z||!ie)break;Z.replaceChildren(...this._rowFactory.createRow(ie,z,z===Y,B,U,G,V,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${j}${this._terminalClass}`}_handleLinkHover(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!0)}_handleLinkLeave(F){this._setCellUnderline(F.x1,F.x2,F.y1,F.y2,F.cols,!1)}_setCellUnderline(F,W,$,Y,G,V){$<0&&(F=0),Y<0&&(W=0);const B=this._bufferService.rows-1;$=Math.max(Math.min($,B),0),Y=Math.max(Math.min(Y,B),0),G=Math.min(G,this._bufferService.cols);const U=this._bufferService.buffer,H=U.ybase+U.y,z=Math.min(U.x,G-1),Z=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,_e=this._optionsService.rawOptions.cursorInactiveStyle;for(let ge=$;ge<=Y;++ge){const Q=ge+U.ydisp,K=this._rowElements[ge],te=U.lines.get(Q);if(!K||!te)break;K.replaceChildren(...this._rowFactory.createRow(te,Q,Q===H,ie,_e,z,Z,this.dimensions.css.cell.width,this._widthCache,V?ge===$?F:0:-1,V?(ge===Y?W:G)-1:-1))}}};i.DomRenderer=D=g([_(7,x.IInstantiationService),_(8,d.ICharSizeService),_(9,x.IOptionsService),_(10,x.IBufferService),_(11,d.ICoreBrowserService),_(12,d.IThemeService)],D)},3787:function(b,i,a){var g=this&&this.__decorate||function(E,R,S,L){var I,P=arguments.length,D=P<3?R:L===null?L=Object.getOwnPropertyDescriptor(R,S):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(E,R,S,L);else for(var F=E.length-1;F>=0;F--)(I=E[F])&&(D=(P<3?I(D):P>3?I(R,S,D):I(R,S))||D);return P>3&&D&&Object.defineProperty(R,S,D),D},_=this&&this.__param||function(E,R){return function(S,L){R(S,L,E)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const h=a(2223),k=a(643),T=a(511),M=a(2585),w=a(8055),d=a(4725),m=a(4269),p=a(6171),f=a(3734);let x=i.DomRendererRowFactory=class{constructor(E,R,S,L,I,P,D){this._document=E,this._characterJoinerService=R,this._optionsService=S,this._coreBrowserService=L,this._coreService=I,this._decorationService=P,this._themeService=D,this._workCell=new T.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(E,R,S){this._selectionStart=E,this._selectionEnd=R,this._columnSelectMode=S}createRow(E,R,S,L,I,P,D,F,W,$,Y){const G=[],V=this._characterJoinerService.getJoinedCharacters(R),B=this._themeService.colors;let U,H=E.getNoBgTrimmedLength();S&&H<P+1&&(H=P+1);let z=0,Z="",ie=0,_e=0,ge=0,Q=!1,K=0,te=!1,ee=0;const we=[],ke=$!==-1&&Y!==-1;for(let Ae=0;Ae<H;Ae++){E.loadCell(Ae,this._workCell);let Me=this._workCell.getWidth();if(Me===0)continue;let Je=!1,it=Ae,Ie=this._workCell;if(V.length>0&&Ae===V[0][0]){Je=!0;const fe=V.shift();Ie=new m.JoinedCellData(this._workCell,E.translateToString(!0,fe[0],fe[1]),fe[1]-fe[0]),it=fe[1]-1,Me=Ie.getWidth()}const ae=this._isCellInSelection(Ae,R),mt=S&&Ae===P,De=ke&&Ae>=$&&Ae<=Y;let Fe=!1;this._decorationService.forEachDecorationAtCell(Ae,R,void 0,(fe=>{Fe=!0}));let Ze=Ie.getChars()||k.WHITESPACE_CELL_CHAR;if(Ze===" "&&(Ie.isUnderline()||Ie.isOverline())&&(Ze=" "),ee=Me*F-W.get(Ze,Ie.isBold(),Ie.isItalic()),U){if(z&&(ae&&te||!ae&&!te&&Ie.bg===ie)&&(ae&&te&&B.selectionForeground||Ie.fg===_e)&&Ie.extended.ext===ge&&De===Q&&ee===K&&!mt&&!Je&&!Fe){Ie.isInvisible()?Z+=k.WHITESPACE_CELL_CHAR:Z+=Ze,z++;continue}z&&(U.textContent=Z),U=this._document.createElement("span"),z=0,Z=""}else U=this._document.createElement("span");if(ie=Ie.bg,_e=Ie.fg,ge=Ie.extended.ext,Q=De,K=ee,te=ae,Je&&P>=Ae&&P<=it&&(P=Ae),!this._coreService.isCursorHidden&&mt&&this._coreService.isCursorInitialized){if(we.push("xterm-cursor"),this._coreBrowserService.isFocused)D&&we.push("xterm-cursor-blink"),we.push(L==="bar"?"xterm-cursor-bar":L==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":we.push("xterm-cursor-outline");break;case"block":we.push("xterm-cursor-block");break;case"bar":we.push("xterm-cursor-bar");break;case"underline":we.push("xterm-cursor-underline")}}if(Ie.isBold()&&we.push("xterm-bold"),Ie.isItalic()&&we.push("xterm-italic"),Ie.isDim()&&we.push("xterm-dim"),Z=Ie.isInvisible()?k.WHITESPACE_CELL_CHAR:Ie.getChars()||k.WHITESPACE_CELL_CHAR,Ie.isUnderline()&&(we.push(`xterm-underline-${Ie.extended.underlineStyle}`),Z===" "&&(Z=" "),!Ie.isUnderlineColorDefault()))if(Ie.isUnderlineColorRGB())U.style.textDecorationColor=`rgb(${f.AttributeData.toColorRGB(Ie.getUnderlineColor()).join(",")})`;else{let fe=Ie.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ie.isBold()&&fe<8&&(fe+=8),U.style.textDecorationColor=B.ansi[fe].css}Ie.isOverline()&&(we.push("xterm-overline"),Z===" "&&(Z=" ")),Ie.isStrikethrough()&&we.push("xterm-strikethrough"),De&&(U.style.textDecoration="underline");let Se=Ie.getFgColor(),be=Ie.getFgColorMode(),je=Ie.getBgColor(),pe=Ie.getBgColorMode();const Xe=!!Ie.isInverse();if(Xe){const fe=Se;Se=je,je=fe;const Le=be;be=pe,pe=Le}let $e,He,Pe,re=!1;switch(this._decorationService.forEachDecorationAtCell(Ae,R,void 0,(fe=>{fe.options.layer!=="top"&&re||(fe.backgroundColorRGB&&(pe=50331648,je=fe.backgroundColorRGB.rgba>>8&16777215,$e=fe.backgroundColorRGB),fe.foregroundColorRGB&&(be=50331648,Se=fe.foregroundColorRGB.rgba>>8&16777215,He=fe.foregroundColorRGB),re=fe.options.layer==="top")})),!re&&ae&&($e=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,je=$e.rgba>>8&16777215,pe=50331648,re=!0,B.selectionForeground&&(be=50331648,Se=B.selectionForeground.rgba>>8&16777215,He=B.selectionForeground)),re&&we.push("xterm-decoration-top"),pe){case 16777216:case 33554432:Pe=B.ansi[je],we.push(`xterm-bg-${je}`);break;case 50331648:Pe=w.channels.toColor(je>>16,je>>8&255,255&je),this._addStyle(U,`background-color:#${j((je>>>0).toString(16),"0",6)}`);break;default:Xe?(Pe=B.foreground,we.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Pe=B.background}switch($e||Ie.isDim()&&($e=w.color.multiplyOpacity(Pe,.5)),be){case 16777216:case 33554432:Ie.isBold()&&Se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Se+=8),this._applyMinimumContrast(U,Pe,B.ansi[Se],Ie,$e,void 0)||we.push(`xterm-fg-${Se}`);break;case 50331648:const fe=w.channels.toColor(Se>>16&255,Se>>8&255,255&Se);this._applyMinimumContrast(U,Pe,fe,Ie,$e,He)||this._addStyle(U,`color:#${j(Se.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(U,Pe,B.foreground,Ie,$e,He)||Xe&&we.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}we.length&&(U.className=we.join(" "),we.length=0),mt||Je||Fe?U.textContent=Z:z++,ee!==this.defaultSpacing&&(U.style.letterSpacing=`${ee}px`),G.push(U),Ae=it}return U&&z&&(U.textContent=Z),G}_applyMinimumContrast(E,R,S,L,I,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,p.treatGlyphAsBackgroundColor)(L.getCode()))return!1;const D=this._getContrastCache(L);let F;if(I||P||(F=D.getColor(R.rgba,S.rgba)),F===void 0){const W=this._optionsService.rawOptions.minimumContrastRatio/(L.isDim()?2:1);F=w.color.ensureContrastRatio(I||R,P||S,W),D.setColor((I||R).rgba,(P||S).rgba,F??null)}return!!F&&(this._addStyle(E,`color:${F.css}`),!0)}_getContrastCache(E){return E.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(E,R){E.setAttribute("style",`${E.getAttribute("style")||""}${R};`)}_isCellInSelection(E,R){const S=this._selectionStart,L=this._selectionEnd;return!(!S||!L)&&(this._columnSelectMode?S[0]<=L[0]?E>=S[0]&&R>=S[1]&&E<L[0]&&R<=L[1]:E<S[0]&&R>=S[1]&&E>=L[0]&&R<=L[1]:R>S[1]&&R<L[1]||S[1]===L[1]&&R===S[1]&&E>=S[0]&&E<L[0]||S[1]<L[1]&&R===L[1]&&E<L[0]||S[1]<L[1]&&R===S[1]&&E>=S[0])}};function j(E,R,S){for(;E.length<S;)E=R+E;return E}i.DomRendererRowFactory=x=g([_(1,d.ICharacterJoinerService),_(2,M.IOptionsService),_(3,d.ICoreBrowserService),_(4,M.ICoreService),_(5,M.IDecorationService),_(6,d.IThemeService)],x)},2550:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(a,g){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.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";const _=a.createElement("span");_.classList.add("xterm-char-measure-element");const h=a.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const k=a.createElement("span");k.classList.add("xterm-char-measure-element"),k.style.fontStyle="italic";const T=a.createElement("span");T.classList.add("xterm-char-measure-element"),T.style.fontWeight="bold",T.style.fontStyle="italic",this._measureElements=[_,h,k,T],this._container.appendChild(_),this._container.appendChild(h),this._container.appendChild(k),this._container.appendChild(T),g.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(a,g,_,h){a===this._font&&g===this._fontSize&&_===this._weight&&h===this._weightBold||(this._font=a,this._fontSize=g,this._weight=_,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(a,g,_){let h=0;if(!g&&!_&&a.length===1&&(h=a.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const M=this._measure(a,0);return M>0&&(this._flat[h]=M),M}let k=a;g&&(k+="B"),_&&(k+="I");let T=this._holey.get(k);if(T===void 0){let M=0;g&&(M|=1),_&&(M|=2),T=this._measure(a,M),T>0&&this._holey.set(k,T)}return T}_measure(a,g){const _=this._measureElements[g];return _.textContent=a.repeat(32),_.offsetWidth/32}}},2223:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TEXT_BASELINE=i.DIM_OPACITY=i.INVERTED_DEFAULT_COLOR=void 0;const g=a(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=g.isFirefox||g.isLegacyEdge?"bottom":"ideographic"},6171:(b,i)=>{function a(_){return 57508<=_&&_<=57558}function g(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(i,"__esModule",{value:!0}),i.computeNextVariantOffset=i.createRenderDimensions=i.treatGlyphAsBackgroundColor=i.allowRescaling=i.isEmoji=i.isRestrictedPowerlineGlyph=i.isPowerlineGlyph=i.throwIfFalsy=void 0,i.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},i.isPowerlineGlyph=a,i.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},i.isEmoji=g,i.allowRescaling=function(_,h,k,T){return h===1&&k>Math.ceil(1.5*T)&&_!==void 0&&_>255&&!g(_)&&!a(_)&&!(function(M){return 57344<=M&&M<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return a(_)||(function(h){return 9472<=h&&h<=9631})(_)},i.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},i.computeNextVariantOffset=function(_,h,k=0){return(_-(2*Math.round(h)-k))%(2*Math.round(h))}},6052:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createSelectionRenderModel=void 0;class a{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(_,h,k,T=!1){if(this.selectionStart=h,this.selectionEnd=k,!h||!k||h[0]===k[0]&&h[1]===k[1])return void this.clear();const M=_.buffers.active.ydisp,w=h[1]-M,d=k[1]-M,m=Math.max(w,0),p=Math.min(d,_.rows-1);m>=_.rows||p<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=T,this.viewportStartRow=w,this.viewportEndRow=d,this.viewportCappedStartRow=m,this.viewportCappedEndRow=p,this.startCol=h[0],this.endCol=k[0])}isCellSelected(_,h,k){return!!this.hasSelection&&(k-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&k>=this.viewportCappedStartRow&&h<this.endCol&&k<=this.viewportCappedEndRow:h<this.startCol&&k>=this.viewportCappedStartRow&&h>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&h>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},456:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionModel=void 0,i.SelectionModel=class{constructor(a){this._bufferService=a,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.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()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,g=this.selectionEnd;return!(!a||!g)&&(a[1]>g[1]||a[1]===g[1]&&a[0]>g[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(b,i,a){var g=this&&this.__decorate||function(p,f,x,j){var E,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,x,j);else for(var L=p.length-1;L>=0;L--)(E=p[L])&&(S=(R<3?E(S):R>3?E(f,x,S):E(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},_=this&&this.__param||function(p,f){return function(x,j){f(x,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const h=a(2585),k=a(8460),T=a(844);let M=i.CharSizeService=class extends T.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(p,f,x){super(),this._optionsService=x,this.width=0,this.height=0,this._onCharSizeChange=this.register(new k.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new m(this._optionsService))}catch{this._measureStrategy=this.register(new d(p,f,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const p=this._measureStrategy.measure();p.width===this.width&&p.height===this.height||(this.width=p.width,this.height=p.height,this._onCharSizeChange.fire())}};i.CharSizeService=M=g([_(2,h.IOptionsService)],M);class w extends T.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(f,x){f!==void 0&&f>0&&x!==void 0&&x>0&&(this._result.width=f,this._result.height=x)}}class d extends w{constructor(f,x,j){super(),this._document=f,this._parentElement=x,this._optionsService=j,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}}class m extends w{constructor(f){super(),this._optionsService=f,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const x=this._ctx.measureText("W");if(!("width"in x&&"fontBoundingBoxAscent"in x&&"fontBoundingBoxDescent"in x))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const f=this._ctx.measureText("W");return this._validateAndSet(f.width,f.fontBoundingBoxAscent+f.fontBoundingBoxDescent),this._result}}},4269:function(b,i,a){var g=this&&this.__decorate||function(m,p,f,x){var j,E=arguments.length,R=E<3?p:x===null?x=Object.getOwnPropertyDescriptor(p,f):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(m,p,f,x);else for(var S=m.length-1;S>=0;S--)(j=m[S])&&(R=(E<3?j(R):E>3?j(p,f,R):j(p,f))||R);return E>3&&R&&Object.defineProperty(p,f,R),R},_=this&&this.__param||function(m,p){return function(f,x){p(f,x,m)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const h=a(3734),k=a(643),T=a(511),M=a(2585);class w extends h.AttributeData{constructor(p,f,x){super(),this.content=0,this.combinedData="",this.fg=p.fg,this.bg=p.bg,this.combinedData=f,this._width=x}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(p){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=w;let d=i.CharacterJoinerService=class hv{constructor(p){this._bufferService=p,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new T.CellData}register(p){const f={id:this._nextCharacterJoinerId++,handler:p};return this._characterJoiners.push(f),f.id}deregister(p){for(let f=0;f<this._characterJoiners.length;f++)if(this._characterJoiners[f].id===p)return this._characterJoiners.splice(f,1),!0;return!1}getJoinedCharacters(p){if(this._characterJoiners.length===0)return[];const f=this._bufferService.buffer.lines.get(p);if(!f||f.length===0)return[];const x=[],j=f.translateToString(!0);let E=0,R=0,S=0,L=f.getFg(0),I=f.getBg(0);for(let P=0;P<f.getTrimmedLength();P++)if(f.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==L||this._workCell.bg!==I){if(P-E>1){const D=this._getJoinedRanges(j,S,R,f,E);for(let F=0;F<D.length;F++)x.push(D[F])}E=P,S=R,L=this._workCell.fg,I=this._workCell.bg}R+=this._workCell.getChars().length||k.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-E>1){const P=this._getJoinedRanges(j,S,R,f,E);for(let D=0;D<P.length;D++)x.push(P[D])}return x}_getJoinedRanges(p,f,x,j,E){const R=p.substring(f,x);let S=[];try{S=this._characterJoiners[0].handler(R)}catch(L){console.error(L)}for(let L=1;L<this._characterJoiners.length;L++)try{const I=this._characterJoiners[L].handler(R);for(let P=0;P<I.length;P++)hv._mergeRanges(S,I[P])}catch(I){console.error(I)}return this._stringRangesToCellRanges(S,j,E),S}_stringRangesToCellRanges(p,f,x){let j=0,E=!1,R=0,S=p[j];if(S){for(let L=x;L<this._bufferService.cols;L++){const I=f.getWidth(L),P=f.getString(L).length||k.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!E&&S[0]<=R&&(S[0]=L,E=!0),S[1]<=R){if(S[1]=L,S=p[++j],!S)break;S[0]<=R?(S[0]=L,E=!0):E=!1}R+=P}}S&&(S[1]=this._bufferService.cols)}}static _mergeRanges(p,f){let x=!1;for(let j=0;j<p.length;j++){const E=p[j];if(x){if(f[1]<=E[0])return p[j-1][1]=f[1],p;if(f[1]<=E[1])return p[j-1][1]=Math.max(f[1],E[1]),p.splice(j,1),p;p.splice(j,1),j--}else{if(f[1]<=E[0])return p.splice(j,0,f),p;if(f[1]<=E[1])return E[0]=Math.min(f[0],E[0]),p;f[0]<E[1]&&(E[0]=Math.min(f[0],E[0]),x=!0)}}return x?p[p.length-1][1]=f[1]:p.push(f),p}};i.CharacterJoinerService=d=g([_(0,M.IBufferService)],d)},5114:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const g=a(844),_=a(8460),h=a(3656);class k extends g.Disposable{constructor(w,d,m){super(),this._textarea=w,this._window=d,this.mainDocument=m,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new T(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((p=>this._screenDprMonitor.setWindow(p)))),this.register((0,_.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,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}}i.CoreBrowserService=k;class T extends g.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new g.MutableDisposable),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,g.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.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)}}},779:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkProviderService=void 0;const g=a(844);class _ extends g.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,g.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(k){return this.linkProviders.push(k),{dispose:()=>{const T=this.linkProviders.indexOf(k);T!==-1&&this.linkProviders.splice(T,1)}}}}i.LinkProviderService=_},8934:function(b,i,a){var g=this&&this.__decorate||function(M,w,d,m){var p,f=arguments.length,x=f<3?w:m===null?m=Object.getOwnPropertyDescriptor(w,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(M,w,d,m);else for(var j=M.length-1;j>=0;j--)(p=M[j])&&(x=(f<3?p(x):f>3?p(w,d,x):p(w,d))||x);return f>3&&x&&Object.defineProperty(w,d,x),x},_=this&&this.__param||function(M,w){return function(d,m){w(d,m,M)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const h=a(4725),k=a(9806);let T=i.MouseService=class{constructor(M,w){this._renderService=M,this._charSizeService=w}getCoords(M,w,d,m,p){return(0,k.getCoords)(window,M,w,d,m,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,p)}getMouseReportCoords(M,w){const d=(0,k.getCoordsRelativeToElement)(window,M,w);if(this._charSizeService.hasValidSize)return d[0]=Math.min(Math.max(d[0],0),this._renderService.dimensions.css.canvas.width-1),d[1]=Math.min(Math.max(d[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(d[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(d[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(d[0]),y:Math.floor(d[1])}}};i.MouseService=T=g([_(0,h.IRenderService),_(1,h.ICharSizeService)],T)},3230:function(b,i,a){var g=this&&this.__decorate||function(p,f,x,j){var E,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,x,j);else for(var L=p.length-1;L>=0;L--)(E=p[L])&&(S=(R<3?E(S):R>3?E(f,x,S):E(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},_=this&&this.__param||function(p,f){return function(x,j){f(x,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const h=a(6193),k=a(4725),T=a(8460),M=a(844),w=a(7226),d=a(2585);let m=i.RenderService=class extends M.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(p,f,x,j,E,R,S,L){super(),this._rowCount=p,this._charSizeService=j,this._renderer=this.register(new M.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new M.MutableDisposable),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 T.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new T.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new T.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new T.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer(((I,P)=>this._renderRows(I,P)),S),this.register(this._renderDebouncer),this.register(S.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(R.onResize((()=>this._fullRefresh()))),this.register(R.buffers.onBufferActivate((()=>{var I;return(I=this._renderer.value)==null?void 0:I.clear()}))),this.register(x.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(E.onDecorationRegistered((()=>this._fullRefresh()))),this.register(E.onDecorationRemoved((()=>this._fullRefresh()))),this.register(x.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(x.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(L.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(S.window,f),this.register(S.onWindowChange((I=>this._registerIntersectionObserver(I,f))))}_registerIntersectionObserver(p,f){if("IntersectionObserver"in p){const x=new p.IntersectionObserver((j=>this._handleIntersectionChange(j[j.length-1])),{threshold:0});x.observe(f),this._observerDisposable.value=(0,M.toDisposable)((()=>x.disconnect()))}}_handleIntersectionChange(p){this._isPaused=p.isIntersecting===void 0?p.intersectionRatio===0:!p.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(p,f,x=!1){this._isPaused?this._needsFullRefresh=!0:(x||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(p,f,this._rowCount))}_renderRows(p,f){this._renderer.value&&(p=Math.min(p,this._rowCount-1),f=Math.min(f,this._rowCount-1),this._renderer.value.renderRows(p,f),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:p,end:f}),this._onRender.fire({start:p,end:f}),this._isNextRenderRedrawOnly=!0)}resize(p,f){this._rowCount=f,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(p){this._renderer.value=p,this._renderer.value&&(this._renderer.value.onRequestRedraw((f=>this.refreshRows(f.start,f.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(p){return this._renderDebouncer.addRefreshCallback(p)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var p,f;this._renderer.value&&((f=(p=this._renderer.value).clearTextureAtlas)==null||f.call(p),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(p,f){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var x;return(x=this._renderer.value)==null?void 0:x.handleResize(p,f)})):this._renderer.value.handleResize(p,f),this._fullRefresh())}handleCharSizeChanged(){var p;(p=this._renderer.value)==null||p.handleCharSizeChanged()}handleBlur(){var p;(p=this._renderer.value)==null||p.handleBlur()}handleFocus(){var p;(p=this._renderer.value)==null||p.handleFocus()}handleSelectionChanged(p,f,x){var j;this._selectionState.start=p,this._selectionState.end=f,this._selectionState.columnSelectMode=x,(j=this._renderer.value)==null||j.handleSelectionChanged(p,f,x)}handleCursorMove(){var p;(p=this._renderer.value)==null||p.handleCursorMove()}clear(){var p;(p=this._renderer.value)==null||p.clear()}};i.RenderService=m=g([_(2,d.IOptionsService),_(3,k.ICharSizeService),_(4,d.IDecorationService),_(5,d.IBufferService),_(6,k.ICoreBrowserService),_(7,k.IThemeService)],m)},9312:function(b,i,a){var g=this&&this.__decorate||function(S,L,I,P){var D,F=arguments.length,W=F<3?L:P===null?P=Object.getOwnPropertyDescriptor(L,I):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(S,L,I,P);else for(var $=S.length-1;$>=0;$--)(D=S[$])&&(W=(F<3?D(W):F>3?D(L,I,W):D(L,I))||W);return F>3&&W&&Object.defineProperty(L,I,W),W},_=this&&this.__param||function(S,L){return function(I,P){L(I,P,S)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const h=a(9806),k=a(9504),T=a(456),M=a(4725),w=a(8460),d=a(844),m=a(6114),p=a(4841),f=a(511),x=a(2585),j=" ",E=new RegExp(j,"g");let R=i.SelectionService=class extends d.Disposable{constructor(S,L,I,P,D,F,W,$,Y){super(),this._element=S,this._screenElement=L,this._linkifier=I,this._bufferService=P,this._coreService=D,this._mouseService=F,this._optionsService=W,this._renderService=$,this._coreBrowserService=Y,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new f.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((G=>this._handleTrim(G))),this.register(this._bufferService.buffers.onBufferActivate((G=>this._handleBufferActivate(G)))),this.enable(),this._model=new T.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,d.toDisposable)((()=>{this._removeMouseDownListeners()})))}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(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!S||!L||S[0]===L[0]&&S[1]===L[1])}get selectionText(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;if(!S||!L)return"";const I=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(S[0]===L[0])return"";const D=S[0]<L[0]?S[0]:L[0],F=S[0]<L[0]?L[0]:S[0];for(let W=S[1];W<=L[1];W++){const $=I.translateBufferLineToString(W,!0,D,F);P.push($)}}else{const D=S[1]===L[1]?L[0]:void 0;P.push(I.translateBufferLineToString(S[1],!0,S[0],D));for(let F=S[1]+1;F<=L[1]-1;F++){const W=I.lines.get(F),$=I.translateBufferLineToString(F,!0);W!=null&&W.isWrapped?P[P.length-1]+=$:P.push($)}if(S[1]!==L[1]){const F=I.lines.get(L[1]),W=I.translateBufferLineToString(L[1],!0,0,L[0]);F&&F.isWrapped?P[P.length-1]+=W:P.push(W)}}return P.map((D=>D.replace(E," "))).join(m.isWindows?`\r
|
|
126
|
-
`:`
|
|
127
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(S){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),m.isLinux&&S&&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(S){const L=this._getMouseBufferCoords(S),I=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(I&&P&&L)&&this._areCoordsInSelection(L,I,P)}isCellInSelection(S,L){const I=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!I||!P)&&this._areCoordsInSelection([S,L],I,P)}_areCoordsInSelection(S,L,I){return S[1]>L[1]&&S[1]<I[1]||L[1]===I[1]&&S[1]===L[1]&&S[0]>=L[0]&&S[0]<I[0]||L[1]<I[1]&&S[1]===I[1]&&S[0]<I[0]||L[1]<I[1]&&S[1]===L[1]&&S[0]>=L[0]}_selectWordAtCursor(S,L){var D,F;const I=(F=(D=this._linkifier.currentLink)==null?void 0:D.link)==null?void 0:F.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const P=this._getMouseBufferCoords(S);return!!P&&(this._selectWordAt(P,L),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(S,L){this._model.clearSelection(),S=Math.max(S,0),L=Math.min(L,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,S],this._model.selectionEnd=[this._bufferService.cols,L],this.refresh(),this._onSelectionChange.fire()}_handleTrim(S){this._model.handleTrim(S)&&this.refresh()}_getMouseBufferCoords(S){const L=this._mouseService.getCoords(S,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(L)return L[0]--,L[1]--,L[1]+=this._bufferService.buffer.ydisp,L}_getMouseEventScrollAmount(S){let L=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,S,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return L>=0&&L<=I?0:(L>I&&(L-=I),L=Math.min(Math.max(L,-50),50),L/=50,L/Math.abs(L)+Math.round(14*L))}shouldForceSelection(S){return m.isMac?S.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:S.shiftKey}handleMouseDown(S){if(this._mouseDownTimeStamp=S.timeStamp,(S.button!==2||!this.hasSelection)&&S.button===0){if(!this._enabled){if(!this.shouldForceSelection(S))return;S.stopPropagation()}S.preventDefault(),this._dragScrollAmount=0,this._enabled&&S.shiftKey?this._handleIncrementalClick(S):S.detail===1?this._handleSingleClick(S):S.detail===2?this._handleDoubleClick(S):S.detail===3&&this._handleTripleClick(S),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()),50)}_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(S){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(S))}_handleSingleClick(S){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(S)?3:0,this._model.selectionStart=this._getMouseBufferCoords(S),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const L=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);L&&L.length!==this._model.selectionStart[0]&&L.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(S){this._selectWordAtCursor(S,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(S){const L=this._getMouseBufferCoords(S);L&&(this._activeSelectionMode=2,this._selectLineAt(L[1]))}shouldColumnSelect(S){return S.altKey&&!(m.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(S){if(S.stopImmediatePropagation(),!this._model.selectionStart)return;const L=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(S),!this._model.selectionEnd)return void this.refresh(!0);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(S),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const I=this._bufferService.buffer;if(this._model.selectionEnd[1]<I.lines.length){const P=I.lines.get(this._model.selectionEnd[1]);P&&P.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}L&&L[0]===this._model.selectionEnd[0]&&L[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});const S=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(S.ydisp+this._bufferService.rows,S.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=S.ydisp),this.refresh()}}_handleMouseUp(S){const L=S.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&L<500&&S.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(S,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const P=(0,k.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const S=this._model.finalSelectionStart,L=this._model.finalSelectionEnd,I=!(!S||!L||S[0]===L[0]&&S[1]===L[1]);I?S&&L&&(this._oldSelectionStart&&this._oldSelectionEnd&&S[0]===this._oldSelectionStart[0]&&S[1]===this._oldSelectionStart[1]&&L[0]===this._oldSelectionEnd[0]&&L[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(S,L,I)):this._oldHasSelection&&this._fireOnSelectionChange(S,L,I)}_fireOnSelectionChange(S,L,I){this._oldSelectionStart=S,this._oldSelectionEnd=L,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(S){this.clearSelection(),this._trimListener.dispose(),this._trimListener=S.activeBuffer.lines.onTrim((L=>this._handleTrim(L)))}_convertViewportColToCharacterIndex(S,L){let I=L;for(let P=0;L>=P;P++){const D=S.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:D>1&&L!==P&&(I+=D-1)}return I}setSelection(S,L,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[S,L],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(S){this._isClickInSelection(S)||(this._selectWordAtCursor(S,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(S,L,I=!0,P=!0){if(S[0]>=this._bufferService.cols)return;const D=this._bufferService.buffer,F=D.lines.get(S[1]);if(!F)return;const W=D.translateBufferLineToString(S[1],!1);let $=this._convertViewportColToCharacterIndex(F,S[0]),Y=$;const G=S[0]-$;let V=0,B=0,U=0,H=0;if(W.charAt($)===" "){for(;$>0&&W.charAt($-1)===" ";)$--;for(;Y<W.length&&W.charAt(Y+1)===" ";)Y++}else{let ie=S[0],_e=S[0];F.getWidth(ie)===0&&(V++,ie--),F.getWidth(_e)===2&&(B++,_e++);const ge=F.getString(_e).length;for(ge>1&&(H+=ge-1,Y+=ge-1);ie>0&&$>0&&!this._isCharWordSeparator(F.loadCell(ie-1,this._workCell));){F.loadCell(ie-1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===0?(V++,ie--):Q>1&&(U+=Q-1,$-=Q-1),$--,ie--}for(;_e<F.length&&Y+1<W.length&&!this._isCharWordSeparator(F.loadCell(_e+1,this._workCell));){F.loadCell(_e+1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,_e++):Q>1&&(H+=Q-1,Y+=Q-1),Y++,_e++}}Y++;let z=$+G-V+U,Z=Math.min(this._bufferService.cols,Y-$+V+B-U-H);if(L||W.slice($,Y).trim()!==""){if(I&&z===0&&F.getCodePoint(0)!==32){const ie=D.lines.get(S[1]-1);if(ie&&F.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const _e=this._getWordAt([this._bufferService.cols-1,S[1]-1],!1,!0,!1);if(_e){const ge=this._bufferService.cols-_e.start;z-=ge,Z+=ge}}}if(P&&z+Z===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const ie=D.lines.get(S[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const _e=this._getWordAt([0,S[1]+1],!1,!1,!0);_e&&(Z+=_e.length)}}return{start:z,length:Z}}}_selectWordAt(S,L){const I=this._getWordAt(S,L);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,S[1]--;this._model.selectionStart=[I.start,S[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(S){const L=this._getWordAt(S,!0);if(L){let I=S[1];for(;L.start<0;)L.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;L.start+L.length>this._bufferService.cols;)L.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?L.start:L.start+L.length,I]}}_isCharWordSeparator(S){return S.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(S.getChars())>=0}_selectLineAt(S){const L=this._bufferService.buffer.getWrappedRangeForLine(S),I={start:{x:0,y:L.first},end:{x:this._bufferService.cols-1,y:L.last}};this._model.selectionStart=[0,L.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,p.getRangeLength)(I,this._bufferService.cols)}};i.SelectionService=R=g([_(3,x.IBufferService),_(4,x.ICoreService),_(5,M.IMouseService),_(6,x.IOptionsService),_(7,M.IRenderService),_(8,M.ICoreBrowserService)],R)},4725:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ILinkProviderService=i.IThemeService=i.ICharacterJoinerService=i.ISelectionService=i.IRenderService=i.IMouseService=i.ICoreBrowserService=i.ICharSizeService=void 0;const g=a(8343);i.ICharSizeService=(0,g.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,g.createDecorator)("CoreBrowserService"),i.IMouseService=(0,g.createDecorator)("MouseService"),i.IRenderService=(0,g.createDecorator)("RenderService"),i.ISelectionService=(0,g.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,g.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,g.createDecorator)("ThemeService"),i.ILinkProviderService=(0,g.createDecorator)("LinkProviderService")},6731:function(b,i,a){var g=this&&this.__decorate||function(R,S,L,I){var P,D=arguments.length,F=D<3?S:I===null?I=Object.getOwnPropertyDescriptor(S,L):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(R,S,L,I);else for(var W=R.length-1;W>=0;W--)(P=R[W])&&(F=(D<3?P(F):D>3?P(S,L,F):P(S,L))||F);return D>3&&F&&Object.defineProperty(S,L,F),F},_=this&&this.__param||function(R,S){return function(L,I){S(L,I,R)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const h=a(7239),k=a(8055),T=a(8460),M=a(844),w=a(2585),d=k.css.toColor("#ffffff"),m=k.css.toColor("#000000"),p=k.css.toColor("#ffffff"),f=k.css.toColor("#000000"),x={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};i.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[k.css.toColor("#2e3436"),k.css.toColor("#cc0000"),k.css.toColor("#4e9a06"),k.css.toColor("#c4a000"),k.css.toColor("#3465a4"),k.css.toColor("#75507b"),k.css.toColor("#06989a"),k.css.toColor("#d3d7cf"),k.css.toColor("#555753"),k.css.toColor("#ef2929"),k.css.toColor("#8ae234"),k.css.toColor("#fce94f"),k.css.toColor("#729fcf"),k.css.toColor("#ad7fa8"),k.css.toColor("#34e2e2"),k.css.toColor("#eeeeec")],S=[0,95,135,175,215,255];for(let L=0;L<216;L++){const I=S[L/36%6|0],P=S[L/6%6|0],D=S[L%6];R.push({css:k.channels.toCss(I,P,D),rgba:k.channels.toRgba(I,P,D)})}for(let L=0;L<24;L++){const I=8+10*L;R.push({css:k.channels.toCss(I,I,I),rgba:k.channels.toRgba(I,I,I)})}return R})());let j=i.ThemeService=class extends M.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new T.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:d,background:m,cursor:p,cursorAccent:f,selectionForeground:void 0,selectionBackgroundTransparent:x,selectionBackgroundOpaque:k.color.blend(m,x),selectionInactiveBackgroundTransparent:x,selectionInactiveBackgroundOpaque:k.color.blend(m,x),ansi:i.DEFAULT_ANSI_COLORS.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))))}_setTheme(R={}){const S=this._colors;if(S.foreground=E(R.foreground,d),S.background=E(R.background,m),S.cursor=E(R.cursor,p),S.cursorAccent=E(R.cursorAccent,f),S.selectionBackgroundTransparent=E(R.selectionBackground,x),S.selectionBackgroundOpaque=k.color.blend(S.background,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundTransparent=E(R.selectionInactiveBackground,S.selectionBackgroundTransparent),S.selectionInactiveBackgroundOpaque=k.color.blend(S.background,S.selectionInactiveBackgroundTransparent),S.selectionForeground=R.selectionForeground?E(R.selectionForeground,k.NULL_COLOR):void 0,S.selectionForeground===k.NULL_COLOR&&(S.selectionForeground=void 0),k.color.isOpaque(S.selectionBackgroundTransparent)&&(S.selectionBackgroundTransparent=k.color.opacity(S.selectionBackgroundTransparent,.3)),k.color.isOpaque(S.selectionInactiveBackgroundTransparent)&&(S.selectionInactiveBackgroundTransparent=k.color.opacity(S.selectionInactiveBackgroundTransparent,.3)),S.ansi=i.DEFAULT_ANSI_COLORS.slice(),S.ansi[0]=E(R.black,i.DEFAULT_ANSI_COLORS[0]),S.ansi[1]=E(R.red,i.DEFAULT_ANSI_COLORS[1]),S.ansi[2]=E(R.green,i.DEFAULT_ANSI_COLORS[2]),S.ansi[3]=E(R.yellow,i.DEFAULT_ANSI_COLORS[3]),S.ansi[4]=E(R.blue,i.DEFAULT_ANSI_COLORS[4]),S.ansi[5]=E(R.magenta,i.DEFAULT_ANSI_COLORS[5]),S.ansi[6]=E(R.cyan,i.DEFAULT_ANSI_COLORS[6]),S.ansi[7]=E(R.white,i.DEFAULT_ANSI_COLORS[7]),S.ansi[8]=E(R.brightBlack,i.DEFAULT_ANSI_COLORS[8]),S.ansi[9]=E(R.brightRed,i.DEFAULT_ANSI_COLORS[9]),S.ansi[10]=E(R.brightGreen,i.DEFAULT_ANSI_COLORS[10]),S.ansi[11]=E(R.brightYellow,i.DEFAULT_ANSI_COLORS[11]),S.ansi[12]=E(R.brightBlue,i.DEFAULT_ANSI_COLORS[12]),S.ansi[13]=E(R.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),S.ansi[14]=E(R.brightCyan,i.DEFAULT_ANSI_COLORS[14]),S.ansi[15]=E(R.brightWhite,i.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const L=Math.min(S.ansi.length-16,R.extendedAnsi.length);for(let I=0;I<L;I++)S.ansi[I+16]=E(R.extendedAnsi[I],i.DEFAULT_ANSI_COLORS[I+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let S=0;S<this._restoreColors.ansi.length;++S)this._colors.ansi[S]=this._restoreColors.ansi[S]}modifyColors(R){R(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()}}};function E(R,S){if(R!==void 0)try{return k.css.toColor(R)}catch{}return S}i.ThemeService=j=g([_(0,w.IOptionsService)],j)},6349:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const g=a(8460),_=a(844);class h extends _.Disposable{constructor(T){super(),this._maxLength=T,this.onDeleteEmitter=this.register(new g.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new g.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new g.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(T){if(this._maxLength===T)return;const M=new Array(T);for(let w=0;w<Math.min(T,this.length);w++)M[w]=this._array[this._getCyclicIndex(w)];this._array=M,this._maxLength=T,this._startIndex=0}get length(){return this._length}set length(T){if(T>this._length)for(let M=this._length;M<T;M++)this._array[M]=void 0;this._length=T}get(T){return this._array[this._getCyclicIndex(T)]}set(T,M){this._array[this._getCyclicIndex(T)]=M}push(T){this._array[this._getCyclicIndex(this._length)]=T,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(T,M,...w){if(M){for(let d=T;d<this._length-M;d++)this._array[this._getCyclicIndex(d)]=this._array[this._getCyclicIndex(d+M)];this._length-=M,this.onDeleteEmitter.fire({index:T,amount:M})}for(let d=this._length-1;d>=T;d--)this._array[this._getCyclicIndex(d+w.length)]=this._array[this._getCyclicIndex(d)];for(let d=0;d<w.length;d++)this._array[this._getCyclicIndex(T+d)]=w[d];if(w.length&&this.onInsertEmitter.fire({index:T,amount:w.length}),this._length+w.length>this._maxLength){const d=this._length+w.length-this._maxLength;this._startIndex+=d,this._length=this._maxLength,this.onTrimEmitter.fire(d)}else this._length+=w.length}trimStart(T){T>this._length&&(T=this._length),this._startIndex+=T,this._length-=T,this.onTrimEmitter.fire(T)}shiftElements(T,M,w){if(!(M<=0)){if(T<0||T>=this._length)throw new Error("start argument out of range");if(T+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let m=M-1;m>=0;m--)this.set(T+m+w,this.get(T+m));const d=T+M+w-this._length;if(d>0)for(this._length+=d;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let d=0;d<M;d++)this.set(T+d+w,this.get(T+d))}}_getCyclicIndex(T){return(this._startIndex+T)%this._maxLength}}i.CircularList=h},1439:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function a(g,_=5){if(typeof g!="object")return g;const h=Array.isArray(g)?[]:{};for(const k in g)h[k]=_<=1?g[k]:g[k]&&a(g[k],_-1);return h}},8055:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.contrastRatio=i.toPaddedHex=i.rgba=i.rgb=i.css=i.color=i.channels=i.NULL_COLOR=void 0;let a=0,g=0,_=0,h=0;var k,T,M,w,d;function m(f){const x=f.toString(16);return x.length<2?"0"+x:x}function p(f,x){return f<x?(x+.05)/(f+.05):(f+.05)/(x+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(f){f.toCss=function(x,j,E,R){return R!==void 0?`#${m(x)}${m(j)}${m(E)}${m(R)}`:`#${m(x)}${m(j)}${m(E)}`},f.toRgba=function(x,j,E,R=255){return(x<<24|j<<16|E<<8|R)>>>0},f.toColor=function(x,j,E,R){return{css:f.toCss(x,j,E,R),rgba:f.toRgba(x,j,E,R)}}})(k||(i.channels=k={})),(function(f){function x(j,E){return h=Math.round(255*E),[a,g,_]=d.toChannels(j.rgba),{css:k.toCss(a,g,_,h),rgba:k.toRgba(a,g,_,h)}}f.blend=function(j,E){if(h=(255&E.rgba)/255,h===1)return{css:E.css,rgba:E.rgba};const R=E.rgba>>24&255,S=E.rgba>>16&255,L=E.rgba>>8&255,I=j.rgba>>24&255,P=j.rgba>>16&255,D=j.rgba>>8&255;return a=I+Math.round((R-I)*h),g=P+Math.round((S-P)*h),_=D+Math.round((L-D)*h),{css:k.toCss(a,g,_),rgba:k.toRgba(a,g,_)}},f.isOpaque=function(j){return(255&j.rgba)==255},f.ensureContrastRatio=function(j,E,R){const S=d.ensureContrastRatio(j.rgba,E.rgba,R);if(S)return k.toColor(S>>24&255,S>>16&255,S>>8&255)},f.opaque=function(j){const E=(255|j.rgba)>>>0;return[a,g,_]=d.toChannels(E),{css:k.toCss(a,g,_),rgba:E}},f.opacity=x,f.multiplyOpacity=function(j,E){return h=255&j.rgba,x(j,h*E/255)},f.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(T||(i.color=T={})),(function(f){let x,j;try{const E=document.createElement("canvas");E.width=1,E.height=1;const R=E.getContext("2d",{willReadFrequently:!0});R&&(x=R,x.globalCompositeOperation="copy",j=x.createLinearGradient(0,0,1,1))}catch{}f.toColor=function(E){if(E.match(/#[\da-f]{3,8}/i))switch(E.length){case 4:return a=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),k.toColor(a,g,_);case 5:return a=parseInt(E.slice(1,2).repeat(2),16),g=parseInt(E.slice(2,3).repeat(2),16),_=parseInt(E.slice(3,4).repeat(2),16),h=parseInt(E.slice(4,5).repeat(2),16),k.toColor(a,g,_,h);case 7:return{css:E,rgba:(parseInt(E.slice(1),16)<<8|255)>>>0};case 9:return{css:E,rgba:parseInt(E.slice(1),16)>>>0}}const R=E.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return a=parseInt(R[1]),g=parseInt(R[2]),_=parseInt(R[3]),h=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),k.toColor(a,g,_,h);if(!x||!j)throw new Error("css.toColor: Unsupported css format");if(x.fillStyle=j,x.fillStyle=E,typeof x.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(x.fillRect(0,0,1,1),[a,g,_,h]=x.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(a,g,_,h),css:E}}})(M||(i.css=M={})),(function(f){function x(j,E,R){const S=j/255,L=E/255,I=R/255;return .2126*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))+.7152*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}f.relativeLuminance=function(j){return x(j>>16&255,j>>8&255,255&j)},f.relativeLuminance2=x})(w||(i.rgb=w={})),(function(f){function x(E,R,S){const L=E>>24&255,I=E>>16&255,P=E>>8&255;let D=R>>24&255,F=R>>16&255,W=R>>8&255,$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));for(;$<S&&(D>0||F>0||W>0);)D-=Math.max(0,Math.ceil(.1*D)),F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));return(D<<24|F<<16|W<<8|255)>>>0}function j(E,R,S){const L=E>>24&255,I=E>>16&255,P=E>>8&255;let D=R>>24&255,F=R>>16&255,W=R>>8&255,$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));for(;$<S&&(D<255||F<255||W<255);)D=Math.min(255,D+Math.ceil(.1*(255-D))),F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),$=p(w.relativeLuminance2(D,F,W),w.relativeLuminance2(L,I,P));return(D<<24|F<<16|W<<8|255)>>>0}f.blend=function(E,R){if(h=(255&R)/255,h===1)return R;const S=R>>24&255,L=R>>16&255,I=R>>8&255,P=E>>24&255,D=E>>16&255,F=E>>8&255;return a=P+Math.round((S-P)*h),g=D+Math.round((L-D)*h),_=F+Math.round((I-F)*h),k.toRgba(a,g,_)},f.ensureContrastRatio=function(E,R,S){const L=w.relativeLuminance(E>>8),I=w.relativeLuminance(R>>8);if(p(L,I)<S){if(I<L){const F=x(E,R,S),W=p(L,w.relativeLuminance(F>>8));if(W<S){const $=j(E,R,S);return W>p(L,w.relativeLuminance($>>8))?F:$}return F}const P=j(E,R,S),D=p(L,w.relativeLuminance(P>>8));if(D<S){const F=x(E,R,S);return D>p(L,w.relativeLuminance(F>>8))?P:F}return P}},f.reduceLuminance=x,f.increaseLuminance=j,f.toChannels=function(E){return[E>>24&255,E>>16&255,E>>8&255,255&E]}})(d||(i.rgba=d={})),i.toPaddedHex=m,i.contrastRatio=p},8969:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const g=a(844),_=a(2585),h=a(4348),k=a(7866),T=a(744),M=a(7302),w=a(6975),d=a(8460),m=a(1753),p=a(1480),f=a(7994),x=a(9282),j=a(5435),E=a(5981),R=a(2660);let S=!1;class L extends g.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new d.EventEmitter),this._onScroll.event((P=>{var D;(D=this._onScrollApi)==null||D.fire(P.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(P){for(const D in P)this.optionsService.options[D]=P[D]}constructor(P){super(),this._windowsWrappingHeuristics=this.register(new g.MutableDisposable),this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new d.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new M.OptionsService(P)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(T.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(k.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(m.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new j.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,d.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,d.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,d.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,d.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((D=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((D=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new E.WriteBuffer(((D,F)=>this._inputHandler.parse(D,F)))),this.register((0,d.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,D){this._writeBuffer.write(P,D)}writeSync(P,D){this._logService.logLevel<=_.LogLevelEnum.WARN&&!S&&(this._logService.warn("writeSync is unreliable and will be removed soon."),S=!0),this._writeBuffer.writeSync(P,D)}input(P,D=!0){this.coreService.triggerDataEvent(P,D)}resize(P,D){isNaN(P)||isNaN(D)||(P=Math.max(P,T.MINIMUM_COLS),D=Math.max(D,T.MINIMUM_ROWS),this._bufferService.resize(P,D))}scroll(P,D=!1){this._bufferService.scroll(P,D)}scrollLines(P,D,F){this._bufferService.scrollLines(P,D,F)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){const D=P-this._bufferService.buffer.ydisp;D!==0&&this.scrollLines(D)}registerEscHandler(P,D){return this._inputHandler.registerEscHandler(P,D)}registerDcsHandler(P,D){return this._inputHandler.registerDcsHandler(P,D)}registerCsiHandler(P,D){return this._inputHandler.registerCsiHandler(P,D)}registerOscHandler(P,D){return this._inputHandler.registerOscHandler(P,D)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1;const D=this.optionsService.rawOptions.windowsPty;D&&D.buildNumber!==void 0&&D.buildNumber!==void 0?P=D.backend==="conpty"&&D.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const P=[];P.push(this.onLineFeed(x.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,x.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,g.toDisposable)((()=>{for(const D of P)D.dispose()}))}}}i.CoreTerminal=L},8460:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.runAndSubscribe=i.forwardEvent=i.EventEmitter=void 0,i.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let g=0;g<this._listeners.length;g++)if(this._listeners[g]===a)return void this._listeners.splice(g,1)}}})),this._event}fire(a,g){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,a,g)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,g){return a((_=>g.fire(_)))},i.runAndSubscribe=function(a,g){return g(void 0),a((_=>g(_)))}},5435:function(b,i,a){var g=this&&this.__decorate||function(V,B,U,H){var z,Z=arguments.length,ie=Z<3?B:H===null?H=Object.getOwnPropertyDescriptor(B,U):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(V,B,U,H);else for(var _e=V.length-1;_e>=0;_e--)(z=V[_e])&&(ie=(Z<3?z(ie):Z>3?z(B,U,ie):z(B,U))||ie);return Z>3&&ie&&Object.defineProperty(B,U,ie),ie},_=this&&this.__param||function(V,B){return function(U,H){B(U,H,V)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const h=a(2584),k=a(7116),T=a(2015),M=a(844),w=a(482),d=a(8437),m=a(8460),p=a(643),f=a(511),x=a(3734),j=a(2585),E=a(1480),R=a(6242),S=a(6351),L=a(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function D(V,B){if(V>24)return B.setWinLines||!1;switch(V){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var F;(function(V){V[V.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",V[V.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(i.WindowsOptionsReportType=F={}));let W=0;class $ extends M.Disposable{getAttrData(){return this._curAttrData}constructor(B,U,H,z,Z,ie,_e,ge,Q=new T.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=U,this._coreService=H,this._logService=z,this._optionsService=Z,this._oscLinkService=ie,this._coreMouseService=_e,this._unicodeService=ge,this._parser=Q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new f.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new m.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new m.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new m.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new m.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new m.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new m.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new m.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new m.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new m.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new m.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new m.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new m.EventEmitter),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 Y(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((K=>this._activeBuffer=K.activeBuffer))),this._parser.setCsiHandlerFallback(((K,te)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(K),params:te.toArray()})})),this._parser.setEscHandlerFallback((K=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(K)})})),this._parser.setExecuteHandlerFallback((K=>{this._logService.debug("Unknown EXECUTE code: ",{code:K})})),this._parser.setOscHandlerFallback(((K,te,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:K,action:te,data:ee})})),this._parser.setDcsHandlerFallback(((K,te,ee)=>{te==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(K),action:te,payload:ee})})),this._parser.setPrintHandler(((K,te,ee)=>this.print(K,te,ee))),this._parser.registerCsiHandler({final:"@"},(K=>this.insertChars(K))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(K=>this.scrollLeft(K))),this._parser.registerCsiHandler({final:"A"},(K=>this.cursorUp(K))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(K=>this.scrollRight(K))),this._parser.registerCsiHandler({final:"B"},(K=>this.cursorDown(K))),this._parser.registerCsiHandler({final:"C"},(K=>this.cursorForward(K))),this._parser.registerCsiHandler({final:"D"},(K=>this.cursorBackward(K))),this._parser.registerCsiHandler({final:"E"},(K=>this.cursorNextLine(K))),this._parser.registerCsiHandler({final:"F"},(K=>this.cursorPrecedingLine(K))),this._parser.registerCsiHandler({final:"G"},(K=>this.cursorCharAbsolute(K))),this._parser.registerCsiHandler({final:"H"},(K=>this.cursorPosition(K))),this._parser.registerCsiHandler({final:"I"},(K=>this.cursorForwardTab(K))),this._parser.registerCsiHandler({final:"J"},(K=>this.eraseInDisplay(K,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(K=>this.eraseInDisplay(K,!0))),this._parser.registerCsiHandler({final:"K"},(K=>this.eraseInLine(K,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(K=>this.eraseInLine(K,!0))),this._parser.registerCsiHandler({final:"L"},(K=>this.insertLines(K))),this._parser.registerCsiHandler({final:"M"},(K=>this.deleteLines(K))),this._parser.registerCsiHandler({final:"P"},(K=>this.deleteChars(K))),this._parser.registerCsiHandler({final:"S"},(K=>this.scrollUp(K))),this._parser.registerCsiHandler({final:"T"},(K=>this.scrollDown(K))),this._parser.registerCsiHandler({final:"X"},(K=>this.eraseChars(K))),this._parser.registerCsiHandler({final:"Z"},(K=>this.cursorBackwardTab(K))),this._parser.registerCsiHandler({final:"`"},(K=>this.charPosAbsolute(K))),this._parser.registerCsiHandler({final:"a"},(K=>this.hPositionRelative(K))),this._parser.registerCsiHandler({final:"b"},(K=>this.repeatPrecedingCharacter(K))),this._parser.registerCsiHandler({final:"c"},(K=>this.sendDeviceAttributesPrimary(K))),this._parser.registerCsiHandler({prefix:">",final:"c"},(K=>this.sendDeviceAttributesSecondary(K))),this._parser.registerCsiHandler({final:"d"},(K=>this.linePosAbsolute(K))),this._parser.registerCsiHandler({final:"e"},(K=>this.vPositionRelative(K))),this._parser.registerCsiHandler({final:"f"},(K=>this.hVPosition(K))),this._parser.registerCsiHandler({final:"g"},(K=>this.tabClear(K))),this._parser.registerCsiHandler({final:"h"},(K=>this.setMode(K))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(K=>this.setModePrivate(K))),this._parser.registerCsiHandler({final:"l"},(K=>this.resetMode(K))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(K=>this.resetModePrivate(K))),this._parser.registerCsiHandler({final:"m"},(K=>this.charAttributes(K))),this._parser.registerCsiHandler({final:"n"},(K=>this.deviceStatus(K))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(K=>this.deviceStatusPrivate(K))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(K=>this.softReset(K))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(K=>this.setCursorStyle(K))),this._parser.registerCsiHandler({final:"r"},(K=>this.setScrollRegion(K))),this._parser.registerCsiHandler({final:"s"},(K=>this.saveCursor(K))),this._parser.registerCsiHandler({final:"t"},(K=>this.windowOptions(K))),this._parser.registerCsiHandler({final:"u"},(K=>this.restoreCursor(K))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(K=>this.insertColumns(K))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(K=>this.deleteColumns(K))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(K=>this.selectProtected(K))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(K=>this.requestMode(K,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(K=>this.requestMode(K,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((K=>(this.setTitle(K),this.setIconName(K),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((K=>this.setIconName(K)))),this._parser.registerOscHandler(2,new R.OscHandler((K=>this.setTitle(K)))),this._parser.registerOscHandler(4,new R.OscHandler((K=>this.setOrReportIndexedColor(K)))),this._parser.registerOscHandler(8,new R.OscHandler((K=>this.setHyperlink(K)))),this._parser.registerOscHandler(10,new R.OscHandler((K=>this.setOrReportFgColor(K)))),this._parser.registerOscHandler(11,new R.OscHandler((K=>this.setOrReportBgColor(K)))),this._parser.registerOscHandler(12,new R.OscHandler((K=>this.setOrReportCursorColor(K)))),this._parser.registerOscHandler(104,new R.OscHandler((K=>this.restoreIndexedColor(K)))),this._parser.registerOscHandler(110,new R.OscHandler((K=>this.restoreFgColor(K)))),this._parser.registerOscHandler(111,new R.OscHandler((K=>this.restoreBgColor(K)))),this._parser.registerOscHandler(112,new R.OscHandler((K=>this.restoreCursorColor(K)))),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(const K in k.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:K},(()=>this.selectCharset("("+K))),this._parser.registerEscHandler({intermediates:")",final:K},(()=>this.selectCharset(")"+K))),this._parser.registerEscHandler({intermediates:"*",final:K},(()=>this.selectCharset("*"+K))),this._parser.registerEscHandler({intermediates:"+",final:K},(()=>this.selectCharset("+"+K))),this._parser.registerEscHandler({intermediates:"-",final:K},(()=>this.selectCharset("-"+K))),this._parser.registerEscHandler({intermediates:".",final:K},(()=>this.selectCharset("."+K))),this._parser.registerEscHandler({intermediates:"/",final:K},(()=>this.selectCharset("/"+K)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((K=>(this._logService.error("Parsing error: ",K),K))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new S.DcsHandler(((K,te)=>this.requestStatusString(K,te))))}_preserveStack(B,U,H,z){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=H,this._parseStack.position=z}_logSlowResolvingAsync(B){this._logService.logLevel<=j.LogLevelEnum.WARN&&Promise.race([B,new Promise(((U,H)=>setTimeout((()=>H("#SLOW_TIMEOUT")),5e3)))]).catch((U=>{if(U!=="#SLOW_TIMEOUT")throw U;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,U){let H,z=this._activeBuffer.x,Z=this._activeBuffer.y,ie=0;const _e=this._parseStack.paused;if(_e){if(H=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,U))return this._logSlowResolvingAsync(H),H;z=this._parseStack.cursorStartX,Z=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>P&&(ie=this._parseStack.position+P)}if(this._logService.logLevel<=j.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(K=>String.fromCharCode(K))).join("")}"`),typeof B=="string"?B.split("").map((K=>K.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(B.length,P))),_e||this._dirtyRowTracker.clearRange(),B.length>P)for(let K=ie;K<B.length;K+=P){const te=K+P<B.length?K+P:B.length,ee=typeof B=="string"?this._stringDecoder.decode(B.substring(K,te),this._parseBuffer):this._utf8Decoder.decode(B.subarray(K,te),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,ee))return this._preserveStack(z,Z,ee,K),this._logSlowResolvingAsync(H),H}else if(!_e){const K=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,K))return this._preserveStack(z,Z,K,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===z&&this._activeBuffer.y===Z||this._onCursorMove.fire();const ge=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Q<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Q,this._bufferService.rows-1),Math.min(ge,this._bufferService.rows-1))}print(B,U,H){let z,Z;const ie=this._charsetService.charset,_e=this._optionsService.rawOptions.screenReaderMode,ge=this._bufferService.cols,Q=this._coreService.decPrivateModes.wraparound,K=this._coreService.modes.insertMode,te=this._curAttrData;let ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&H-U>0&&ee.getWidth(this._activeBuffer.x-1)===2&&ee.setCellFromCodepoint(this._activeBuffer.x-1,0,1,te);let we=this._parser.precedingJoinState;for(let ke=U;ke<H;++ke){if(z=B[ke],z<127&&ie){const it=ie[String.fromCharCode(z)];it&&(z=it.charCodeAt(0))}const Ae=this._unicodeService.charProperties(z,we);Z=E.UnicodeService.extractWidth(Ae);const Me=E.UnicodeService.extractShouldJoin(Ae),Je=Me?E.UnicodeService.extractWidth(we):0;if(we=Ae,_e&&this._onA11yChar.fire((0,w.stringFromCodePoint)(z)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-Je>ge){if(Q){const it=ee;let Ie=this._activeBuffer.x-Je;for(this._activeBuffer.x=Je,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),ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Je>0&&ee instanceof d.BufferLine&&ee.copyCellsFrom(it,Ie,0,Je,!1);Ie<ge;)it.setCellFromCodepoint(Ie++,0,1,te)}else if(this._activeBuffer.x=ge-1,Z===2)continue}if(Me&&this._activeBuffer.x){const it=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-it,z,Z);for(let Ie=Z-Je;--Ie>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}else if(K&&(ee.insertCells(this._activeBuffer.x,Z-Je,this._activeBuffer.getNullCell(te)),ee.getWidth(ge-1)===2&&ee.setCellFromCodepoint(ge-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,te)),ee.setCellFromCodepoint(this._activeBuffer.x++,z,Z,te),Z>0)for(;--Z;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,te)}this._parser.precedingJoinState=we,this._activeBuffer.x<ge&&H-U>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,te),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,U){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,U):this._parser.registerCsiHandler(B,(H=>!D(H.params[0],this._optionsService.rawOptions.windowOptions)||U(H)))}registerDcsHandler(B,U){return this._parser.registerDcsHandler(B,new S.DcsHandler(U))}registerEscHandler(B,U){return this._parser.registerEscHandler(B,U)}registerOscHandler(B,U){return this._parser.registerOscHandler(B,new R.OscHandler(U))}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(){var B;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&&((B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&B.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);U.hasWidth(this._activeBuffer.x)&&!U.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,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(B,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=B,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+U)}cursorUp(B){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const U=B.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=B.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=B.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const U=B.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,U,H,z=!1,Z=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);ie.replaceCells(U,H,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),z&&(ie.isWrapped=!1)}_resetBufferLine(B,U=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),H.isWrapped=!1)}eraseInDisplay(B,U=!1){let H;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);H<this._bufferService.rows;H++)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(H);break;case 1:for(H=this._activeBuffer.y,this._dirtyRowTracker.markDirty(H),this._eraseInBufferLine(H,0,this._activeBuffer.x+1,!0,U),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(H+1).isWrapped=!1);H--;)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(0);break;case 2:for(H=this._bufferService.rows,this._dirtyRowTracker.markDirty(H-1);H--;)this._resetBufferLine(H,U);this._dirtyRowTracker.markDirty(0);break;case 3:const z=this._activeBuffer.lines.length-this._bufferService.rows;z>0&&(this._activeBuffer.lines.trimStart(z),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-z,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-z,0),this._onScroll.fire(0))}return!0}eraseInLine(B,U=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,U);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,U);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,U)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let U=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y,z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,Z=this._bufferService.rows-1+this._activeBuffer.ybase-z+1;for(;U--;)this._activeBuffer.lines.splice(Z-1,1),this._activeBuffer.lines.splice(H,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(B){this._restrictCursor();let U=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=this._activeBuffer.ybase+this._activeBuffer.y;let z;for(z=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-z;U--;)this._activeBuffer.lines.splice(H,1),this._activeBuffer.lines.splice(z,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(B){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(B){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(B){let U=B.params[0]||1;for(;U--;)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(B){let U=B.params[0]||1;for(;U--;)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(d.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=B.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);z.deleteCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=B.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);z.insertCells(0,U,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=B.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);z.insertCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=B.params[0]||1;for(let H=this._activeBuffer.scrollTop;H<=this._activeBuffer.scrollBottom;++H){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+H);z.deleteCells(this._activeBuffer.x,U,this._activeBuffer.getNullCell(this._eraseAttrData())),z.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(B){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(B.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(B){const U=this._parser.precedingJoinState;if(!U)return!0;const H=B.params[0]||1,z=E.UnicodeService.extractWidth(U),Z=this._activeBuffer.x-z,ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),_e=new Uint32Array(ie.length*H);let ge=0;for(let K=0;K<ie.length;){const te=ie.codePointAt(K)||0;_e[ge++]=te,K+=te>65535?2:1}let Q=ge;for(let K=1;K<H;++K)_e.copyWithin(Q,0,ge),Q+=ge;return this.print(_e,0,Q),!0}sendDeviceAttributesPrimary(B){return B.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let U=0;U<B.length;U++)switch(B.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(B){for(let U=0;U<B.length;U++)switch(B.params[U]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,k.DEFAULT_CHARSET),this._charsetService.setgCharset(1,k.DEFAULT_CHARSET),this._charsetService.setgCharset(2,k.DEFAULT_CHARSET),this._charsetService.setgCharset(3,k.DEFAULT_CHARSET);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(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(B){for(let U=0;U<B.length;U++)switch(B.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(B){for(let U=0;U<B.length;U++)switch(B.params[U]){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:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),B.params[U]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(B,U){const H=this._coreService.decPrivateModes,{activeProtocol:z,activeEncoding:Z}=this._coreMouseService,ie=this._coreService,{buffers:_e,cols:ge}=this._bufferService,{active:Q,alt:K}=_e,te=this._optionsService.rawOptions,ee=Me=>Me?1:2,we=B.params[0];return ke=we,Ae=U?we===2?4:we===4?ee(ie.modes.insertMode):we===12?3:we===20?ee(te.convertEol):0:we===1?ee(H.applicationCursorKeys):we===3?te.windowOptions.setWinLines?ge===80?2:ge===132?1:0:0:we===6?ee(H.origin):we===7?ee(H.wraparound):we===8?3:we===9?ee(z==="X10"):we===12?ee(te.cursorBlink):we===25?ee(!ie.isCursorHidden):we===45?ee(H.reverseWraparound):we===66?ee(H.applicationKeypad):we===67?4:we===1e3?ee(z==="VT200"):we===1002?ee(z==="DRAG"):we===1003?ee(z==="ANY"):we===1004?ee(H.sendFocus):we===1005?4:we===1006?ee(Z==="SGR"):we===1015?4:we===1016?ee(Z==="SGR_PIXELS"):we===1048?1:we===47||we===1047||we===1049?ee(Q===K):we===2004?ee(H.bracketedPasteMode):0,ie.triggerDataEvent(`${h.C0.ESC}[${U?"":"?"}${ke};${Ae}$y`),!0;var ke,Ae}_updateAttrColor(B,U,H,z,Z){return U===2?(B|=50331648,B&=-16777216,B|=x.AttributeData.fromColorRGB([H,z,Z])):U===5&&(B&=-50331904,B|=33554432|255&H),B}_extractColor(B,U,H){const z=[0,0,-1,0,0,0];let Z=0,ie=0;do{if(z[ie+Z]=B.params[U+ie],B.hasSubParams(U+ie)){const _e=B.getSubParams(U+ie);let ge=0;do z[1]===5&&(Z=1),z[ie+ge+1+Z]=_e[ge];while(++ge<_e.length&&ge+ie+1+Z<z.length);break}if(z[1]===5&&ie+Z>=2||z[1]===2&&ie+Z>=5)break;z[1]&&(Z=1)}while(++ie+U<B.length&&ie+Z<z.length);for(let _e=2;_e<z.length;++_e)z[_e]===-1&&(z[_e]=0);switch(z[0]){case 38:H.fg=this._updateAttrColor(H.fg,z[1],z[3],z[4],z[5]);break;case 48:H.bg=this._updateAttrColor(H.bg,z[1],z[3],z[4],z[5]);break;case 58:H.extended=H.extended.clone(),H.extended.underlineColor=this._updateAttrColor(H.extended.underlineColor,z[1],z[3],z[4],z[5])}return ie}_processUnderline(B,U){U.extended=U.extended.clone(),(!~B||B>5)&&(B=1),U.extended.underlineStyle=B,U.fg|=268435456,B===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(B){B.fg=d.DEFAULT_ATTR_DATA.fg,B.bg=d.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=B.length;let H;const z=this._curAttrData;for(let Z=0;Z<U;Z++)H=B.params[Z],H>=30&&H<=37?(z.fg&=-50331904,z.fg|=16777216|H-30):H>=40&&H<=47?(z.bg&=-50331904,z.bg|=16777216|H-40):H>=90&&H<=97?(z.fg&=-50331904,z.fg|=16777224|H-90):H>=100&&H<=107?(z.bg&=-50331904,z.bg|=16777224|H-100):H===0?this._processSGR0(z):H===1?z.fg|=134217728:H===3?z.bg|=67108864:H===4?(z.fg|=268435456,this._processUnderline(B.hasSubParams(Z)?B.getSubParams(Z)[0]:1,z)):H===5?z.fg|=536870912:H===7?z.fg|=67108864:H===8?z.fg|=1073741824:H===9?z.fg|=2147483648:H===2?z.bg|=134217728:H===21?this._processUnderline(2,z):H===22?(z.fg&=-134217729,z.bg&=-134217729):H===23?z.bg&=-67108865:H===24?(z.fg&=-268435457,this._processUnderline(0,z)):H===25?z.fg&=-536870913:H===27?z.fg&=-67108865:H===28?z.fg&=-1073741825:H===29?z.fg&=2147483647:H===39?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):H===49?(z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?Z+=this._extractColor(B,Z,z):H===53?z.bg|=1073741824:H===55?z.bg&=-1073741825:H===59?(z.extended=z.extended.clone(),z.extended.underlineColor=-1,z.updateExtended()):H===100?(z.fg&=-67108864,z.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,z.bg&=-67108864,z.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${U};${H}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${U};${H}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.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(B){const U=B.params[0]||1;switch(U){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const H=U%2==1;return this._optionsService.options.cursorBlink=H,!0}setScrollRegion(B){const U=B.params[0]||1;let H;return(B.length<2||(H=B.params[1])>this._bufferService.rows||H===0)&&(H=this._bufferService.rows),H>U&&(this._activeBuffer.scrollTop=U-1,this._activeBuffer.scrollBottom=H-1,this._setCursor(0,0)),!0}windowOptions(B){if(!D(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:U!==2&&this._onRequestWindowsOptionsReport.fire(F.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(F.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:U!==0&&U!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),U!==0&&U!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:U!==0&&U!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),U!==0&&U!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){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(B){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(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const U=[],H=B.split(";");for(;H.length>1;){const z=H.shift(),Z=H.shift();if(/^\d+$/.exec(z)){const ie=parseInt(z);if(G(ie))if(Z==="?")U.push({type:0,index:ie});else{const _e=(0,L.parseColor)(Z);_e&&U.push({type:1,index:ie,color:_e})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(B){const U=B.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(B,U){this._getCurrentLinkId()&&this._finishHyperlink();const H=B.split(":");let z;const Z=H.findIndex((ie=>ie.startsWith("id=")));return Z!==-1&&(z=H[Z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:z,uri:U}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,U){const H=B.split(";");for(let z=0;z<H.length&&!(U>=this._specialColors.length);++z,++U)if(H[z]==="?")this._onColor.fire([{type:0,index:this._specialColors[U]}]);else{const Z=(0,L.parseColor)(H[z]);Z&&this._onColor.fire([{type:1,index:this._specialColors[U],color:Z}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const U=[],H=B.split(";");for(let z=0;z<H.length;++z)if(/^\d+$/.exec(H[z])){const Z=parseInt(H[z]);G(Z)&&U.push({type:2,index:Z})}return U.length&&this._onColor.fire(U),!0}restoreFgColor(B){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(B){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(B){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,k.DEFAULT_CHARSET),!0}selectCharset(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(I[B[0]],k.CHARSETS[B[1]]||k.DEFAULT_CHARSET),!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){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,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=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new f.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let U=0;U<this._bufferService.rows;++U){const H=this._activeBuffer.ybase+this._activeBuffer.y+U,z=this._activeBuffer.lines.get(H);z&&(z.fill(B),z.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,U){const H=this._bufferService.buffer,z=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${Z}${h.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[z.cursorStyle]-(z.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,U){this._dirtyRowTracker.markRangeDirty(B,U)}}i.InputHandler=$;let Y=class{constructor(V){this._bufferService=V,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(V){V<this.start?this.start=V:V>this.end&&(this.end=V)}markRangeDirty(V,B){V>B&&(W=V,V=B,B=W),V<this.start&&(this.start=V),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(V){return 0<=V&&V<256}Y=g([_(0,j.IBufferService)],Y)},844:(b,i)=>{function a(g){for(const _ of g)_.dispose();g.length=0}Object.defineProperty(i,"__esModule",{value:!0}),i.getDisposeArrayDisposable=i.disposeArray=i.toDisposable=i.MutableDisposable=i.Disposable=void 0,i.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const g of this._disposables)g.dispose();this._disposables.length=0}register(g){return this._disposables.push(g),g}unregister(g){const _=this._disposables.indexOf(g);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(g){var _;this._isDisposed||g===this._value||((_=this._value)==null||_.dispose(),this._value=g)}clear(){this.value=void 0}dispose(){var g;this._isDisposed=!0,(g=this._value)==null||g.dispose(),this._value=void 0}},i.toDisposable=function(g){return{dispose:g}},i.disposeArray=a,i.getDisposeArrayDisposable=function(g){return{dispose:()=>a(g)}}},1505:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,h,k){this._data[_]||(this._data[_]={}),this._data[_][h]=k}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(g,_,h,k,T){this._data.get(g,_)||this._data.set(g,_,new a),this._data.get(g,_).set(h,k,T)}get(g,_,h,k){var T;return(T=this._data.get(g,_))==null?void 0:T.get(h,k)}clear(){this._data.clear()}}},6114:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.isChromeOS=i.isLinux=i.isWindows=i.isIphone=i.isIpad=i.isMac=i.getSafariVersion=i.isSafari=i.isLegacyEdge=i.isFirefox=i.isNode=void 0,i.isNode=typeof process<"u"&&"title"in process;const a=i.isNode?"node":navigator.userAgent,g=i.isNode?"node":navigator.platform;i.isFirefox=a.includes("Firefox"),i.isLegacyEdge=a.includes("Edge"),i.isSafari=/^((?!chrome|android).)*safari/i.test(a),i.getSafariVersion=function(){if(!i.isSafari)return 0;const _=a.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},i.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(g),i.isIpad=g==="iPad",i.isIphone=g==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(g),i.isLinux=g.indexOf("Linux")>=0,i.isChromeOS=/\bCrOS\b/.test(a)},6106:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.SortedList=void 0;let a=0;i.SortedList=class{constructor(g){this._getKey=g,this._array=[]}clear(){this._array.length=0}insert(g){this._array.length!==0?(a=this._search(this._getKey(g)),this._array.splice(a,0,g)):this._array.push(g)}delete(g){if(this._array.length===0)return!1;const _=this._getKey(g);if(_===void 0||(a=this._search(_),a===-1)||this._getKey(this._array[a])!==_)return!1;do if(this._array[a]===g)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===_);return!1}*getKeyIterator(g){if(this._array.length!==0&&(a=this._search(g),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===g))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===g)}forEachByKey(g,_){if(this._array.length!==0&&(a=this._search(g),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===g))do _(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===g)}values(){return[...this._array].values()}_search(g){let _=0,h=this._array.length-1;for(;h>=_;){let k=_+h>>1;const T=this._getKey(this._array[k]);if(T>g)h=k-1;else{if(!(T<g)){for(;k>0&&this._getKey(this._array[k-1])===g;)k--;return k}_=k+1}}return _}}},7226:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DebouncedIdleTask=i.IdleTaskQueue=i.PriorityTaskQueue=void 0;const g=a(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(T){this._tasks.push(T),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(T){this._idleCallback=void 0;let M=0,w=0,d=T.timeRemaining(),m=0;for(;this._i<this._tasks.length;){if(M=Date.now(),this._tasks[this._i]()||this._i++,M=Math.max(1,Date.now()-M),w=Math.max(M,w),m=T.timeRemaining(),1.5*w>m)return d-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(d-M))}ms`),void this._start();d=m}this.clear()}}class h extends _{_requestCallback(T){return setTimeout((()=>T(this._createDeadline(16))))}_cancelCallback(T){clearTimeout(T)}_createDeadline(T){const M=Date.now()+T;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}i.PriorityTaskQueue=h,i.IdleTaskQueue=!g.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:h,i.DebouncedIdleTask=class{constructor(){this._queue=new i.IdleTaskQueue}set(k){this._queue.clear(),this._queue.enqueue(k)}flush(){this._queue.flush()}}},9282:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.updateWindowsModeWrappedState=void 0;const g=a(643);i.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),k=h==null?void 0:h.get(_.cols-1),T=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);T&&k&&(T.isWrapped=k[g.CHAR_DATA_CODE_INDEX]!==g.NULL_CELL_CODE&&k[g.CHAR_DATA_CODE_INDEX]!==g.WHITESPACE_CELL_CODE)}},3734:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ExtendedAttrs=i.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new g}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}i.AttributeData=a;class g{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,k=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=k}clone(){return new g(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=g},9092:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const g=a(6349),_=a(7226),h=a(3734),k=a(8437),T=a(4634),M=a(511),w=a(643),d=a(4863),m=a(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(p,f,x){this._hasScrollback=p,this._optionsService=f,this._bufferService=x,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=k.DEFAULT_ATTR_DATA.clone(),this.savedCharset=m.DEFAULT_CHARSET,this.markers=[],this._nullCell=M.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=M.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(p){return p?(this._nullCell.fg=p.fg,this._nullCell.bg=p.bg,this._nullCell.extended=p.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(p){return p?(this._whitespaceCell.fg=p.fg,this._whitespaceCell.bg=p.bg,this._whitespaceCell.extended=p.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(p,f){return new k.BufferLine(this._bufferService.cols,this.getNullCell(p),f)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const p=this.ybase+this.y-this.ydisp;return p>=0&&p<this._rows}_getCorrectBufferLength(p){if(!this._hasScrollback)return p;const f=p+this._optionsService.rawOptions.scrollback;return f>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:f}fillViewportRows(p){if(this.lines.length===0){p===void 0&&(p=k.DEFAULT_ATTR_DATA);let f=this._rows;for(;f--;)this.lines.push(this.getBlankLine(p))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new g.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(p,f){const x=this.getNullCell(k.DEFAULT_ATTR_DATA);let j=0;const E=this._getCorrectBufferLength(f);if(E>this.lines.maxLength&&(this.lines.maxLength=E),this.lines.length>0){if(this._cols<p)for(let S=0;S<this.lines.length;S++)j+=+this.lines.get(S).resize(p,x);let R=0;if(this._rows<f)for(let S=this._rows;S<f;S++)this.lines.length<f+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new k.BufferLine(p,x)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new k.BufferLine(p,x)));else for(let S=this._rows;S>f;S--)this.lines.length>f+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(E<this.lines.maxLength){const S=this.lines.length-E;S>0&&(this.lines.trimStart(S),this.ybase=Math.max(this.ybase-S,0),this.ydisp=Math.max(this.ydisp-S,0),this.savedY=Math.max(this.savedY-S,0)),this.lines.maxLength=E}this.x=Math.min(this.x,p-1),this.y=Math.min(this.y,f-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,p-1),this.scrollTop=0}if(this.scrollBottom=f-1,this._isReflowEnabled&&(this._reflow(p,f),this._cols>p))for(let R=0;R<this.lines.length;R++)j+=+this.lines.get(R).resize(p,x);this._cols=p,this._rows=f,this._memoryCleanupQueue.clear(),j>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let p=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,p=!1);let f=0;for(;this._memoryCleanupPosition<this.lines.length;)if(f+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),f>100)return!0;return p}get _isReflowEnabled(){const p=this._optionsService.rawOptions.windowsPty;return p&&p.buildNumber?this._hasScrollback&&p.backend==="conpty"&&p.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(p,f){this._cols!==p&&(p>this._cols?this._reflowLarger(p,f):this._reflowSmaller(p,f))}_reflowLarger(p,f){const x=(0,T.reflowLargerGetLinesToRemove)(this.lines,this._cols,p,this.ybase+this.y,this.getNullCell(k.DEFAULT_ATTR_DATA));if(x.length>0){const j=(0,T.reflowLargerCreateNewLayout)(this.lines,x);(0,T.reflowLargerApplyNewLayout)(this.lines,j.layout),this._reflowLargerAdjustViewport(p,f,j.countRemoved)}}_reflowLargerAdjustViewport(p,f,x){const j=this.getNullCell(k.DEFAULT_ATTR_DATA);let E=x;for(;E-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<f&&this.lines.push(new k.BufferLine(p,j))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-x,0)}_reflowSmaller(p,f){const x=this.getNullCell(k.DEFAULT_ATTR_DATA),j=[];let E=0;for(let R=this.lines.length-1;R>=0;R--){let S=this.lines.get(R);if(!S||!S.isWrapped&&S.getTrimmedLength()<=p)continue;const L=[S];for(;S.isWrapped&&R>0;)S=this.lines.get(--R),L.unshift(S);const I=this.ybase+this.y;if(I>=R&&I<R+L.length)continue;const P=L[L.length-1].getTrimmedLength(),D=(0,T.reflowSmallerGetNewLineLengths)(L,this._cols,p),F=D.length-L.length;let W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+F):Math.max(0,this.lines.length-this.lines.maxLength+F);const $=[];for(let H=0;H<F;H++){const z=this.getBlankLine(k.DEFAULT_ATTR_DATA,!0);$.push(z)}$.length>0&&(j.push({start:R+L.length+E,newLines:$}),E+=$.length),L.push(...$);let Y=D.length-1,G=D[Y];G===0&&(Y--,G=D[Y]);let V=L.length-F-1,B=P;for(;V>=0;){const H=Math.min(B,G);if(L[Y]===void 0)break;if(L[Y].copyCellsFrom(L[V],B-H,G-H,H,!0),G-=H,G===0&&(Y--,G=D[Y]),B-=H,B===0){V--;const z=Math.max(V,0);B=(0,T.getWrappedLineTrimmedLength)(L,z,this._cols)}}for(let H=0;H<L.length;H++)D[H]<p&&L[H].setCell(D[H],x);let U=F-W;for(;U-- >0;)this.ybase===0?this.y<f-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+E)-f&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+f-1)}if(j.length>0){const R=[],S=[];for(let Y=0;Y<this.lines.length;Y++)S.push(this.lines.get(Y));const L=this.lines.length;let I=L-1,P=0,D=j[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+E);let F=0;for(let Y=Math.min(this.lines.maxLength-1,L+E-1);Y>=0;Y--)if(D&&D.start>I+F){for(let G=D.newLines.length-1;G>=0;G--)this.lines.set(Y--,D.newLines[G]);Y++,R.push({index:I+1,amount:D.newLines.length}),F+=D.newLines.length,D=j[++P]}else this.lines.set(Y,S[I--]);let W=0;for(let Y=R.length-1;Y>=0;Y--)R[Y].index+=W,this.lines.onInsertEmitter.fire(R[Y]),W+=R[Y].amount;const $=Math.max(0,L+E-this.lines.maxLength);$>0&&this.lines.onTrimEmitter.fire($)}}translateBufferLineToString(p,f,x=0,j){const E=this.lines.get(p);return E?E.translateToString(f,x,j):""}getWrappedRangeForLine(p){let f=p,x=p;for(;f>0&&this.lines.get(f).isWrapped;)f--;for(;x+1<this.lines.length&&this.lines.get(x+1).isWrapped;)x++;return{first:f,last:x}}setupTabStops(p){for(p!=null?this.tabs[p]||(p=this.prevStop(p)):(this.tabs={},p=0);p<this._cols;p+=this._optionsService.rawOptions.tabStopWidth)this.tabs[p]=!0}prevStop(p){for(p==null&&(p=this.x);!this.tabs[--p]&&p>0;);return p>=this._cols?this._cols-1:p<0?0:p}nextStop(p){for(p==null&&(p=this.x);!this.tabs[++p]&&p<this._cols;);return p>=this._cols?this._cols-1:p<0?0:p}clearMarkers(p){this._isClearing=!0;for(let f=0;f<this.markers.length;f++)this.markers[f].line===p&&(this.markers[f].dispose(),this.markers.splice(f--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].dispose(),this.markers.splice(p--,1);this._isClearing=!1}addMarker(p){const f=new d.Marker(p);return this.markers.push(f),f.register(this.lines.onTrim((x=>{f.line-=x,f.line<0&&f.dispose()}))),f.register(this.lines.onInsert((x=>{f.line>=x.index&&(f.line+=x.amount)}))),f.register(this.lines.onDelete((x=>{f.line>=x.index&&f.line<x.index+x.amount&&f.dispose(),f.line>x.index&&(f.line-=x.amount)}))),f.register(f.onDispose((()=>this._removeMarker(f)))),f}_removeMarker(p){this._isClearing||this.markers.splice(this.markers.indexOf(p),1)}}},8437:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const g=a(3734),_=a(511),h=a(643),k=a(482);i.DEFAULT_ATTR_DATA=Object.freeze(new g.AttributeData);let T=0;class M{constructor(d,m,p=!1){this.isWrapped=p,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*d);const f=m||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let x=0;x<d;++x)this.setCell(x,f);this.length=d}get(d){const m=this._data[3*d+0],p=2097151&m;return[this._data[3*d+1],2097152&m?this._combined[d]:p?(0,k.stringFromCodePoint)(p):"",m>>22,2097152&m?this._combined[d].charCodeAt(this._combined[d].length-1):p]}set(d,m){this._data[3*d+1]=m[h.CHAR_DATA_ATTR_INDEX],m[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[d]=m[1],this._data[3*d+0]=2097152|d|m[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*d+0]=m[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|m[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(d){return this._data[3*d+0]>>22}hasWidth(d){return 12582912&this._data[3*d+0]}getFg(d){return this._data[3*d+1]}getBg(d){return this._data[3*d+2]}hasContent(d){return 4194303&this._data[3*d+0]}getCodePoint(d){const m=this._data[3*d+0];return 2097152&m?this._combined[d].charCodeAt(this._combined[d].length-1):2097151&m}isCombined(d){return 2097152&this._data[3*d+0]}getString(d){const m=this._data[3*d+0];return 2097152&m?this._combined[d]:2097151&m?(0,k.stringFromCodePoint)(2097151&m):""}isProtected(d){return 536870912&this._data[3*d+2]}loadCell(d,m){return T=3*d,m.content=this._data[T+0],m.fg=this._data[T+1],m.bg=this._data[T+2],2097152&m.content&&(m.combinedData=this._combined[d]),268435456&m.bg&&(m.extended=this._extendedAttrs[d]),m}setCell(d,m){2097152&m.content&&(this._combined[d]=m.combinedData),268435456&m.bg&&(this._extendedAttrs[d]=m.extended),this._data[3*d+0]=m.content,this._data[3*d+1]=m.fg,this._data[3*d+2]=m.bg}setCellFromCodepoint(d,m,p,f){268435456&f.bg&&(this._extendedAttrs[d]=f.extended),this._data[3*d+0]=m|p<<22,this._data[3*d+1]=f.fg,this._data[3*d+2]=f.bg}addCodepointToCell(d,m,p){let f=this._data[3*d+0];2097152&f?this._combined[d]+=(0,k.stringFromCodePoint)(m):2097151&f?(this._combined[d]=(0,k.stringFromCodePoint)(2097151&f)+(0,k.stringFromCodePoint)(m),f&=-2097152,f|=2097152):f=m|4194304,p&&(f&=-12582913,f|=p<<22),this._data[3*d+0]=f}insertCells(d,m,p){if((d%=this.length)&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),m<this.length-d){const f=new _.CellData;for(let x=this.length-d-m-1;x>=0;--x)this.setCell(d+m+x,this.loadCell(d+x,f));for(let x=0;x<m;++x)this.setCell(d+x,p)}else for(let f=d;f<this.length;++f)this.setCell(f,p);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,p)}deleteCells(d,m,p){if(d%=this.length,m<this.length-d){const f=new _.CellData;for(let x=0;x<this.length-d-m;++x)this.setCell(d+x,this.loadCell(d+m+x,f));for(let x=this.length-m;x<this.length;++x)this.setCell(x,p)}else for(let f=d;f<this.length;++f)this.setCell(f,p);d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),this.getWidth(d)!==0||this.hasContent(d)||this.setCellFromCodepoint(d,0,1,p)}replaceCells(d,m,p,f=!1){if(f)for(d&&this.getWidth(d-1)===2&&!this.isProtected(d-1)&&this.setCellFromCodepoint(d-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&!this.isProtected(m)&&this.setCellFromCodepoint(m,0,1,p);d<m&&d<this.length;)this.isProtected(d)||this.setCell(d,p),d++;else for(d&&this.getWidth(d-1)===2&&this.setCellFromCodepoint(d-1,0,1,p),m<this.length&&this.getWidth(m-1)===2&&this.setCellFromCodepoint(m,0,1,p);d<m&&d<this.length;)this.setCell(d++,p)}resize(d,m){if(d===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const p=3*d;if(d>this.length){if(this._data.buffer.byteLength>=4*p)this._data=new Uint32Array(this._data.buffer,0,p);else{const f=new Uint32Array(p);f.set(this._data),this._data=f}for(let f=this.length;f<d;++f)this.setCell(f,m)}else{this._data=this._data.subarray(0,p);const f=Object.keys(this._combined);for(let j=0;j<f.length;j++){const E=parseInt(f[j],10);E>=d&&delete this._combined[E]}const x=Object.keys(this._extendedAttrs);for(let j=0;j<x.length;j++){const E=parseInt(x[j],10);E>=d&&delete this._extendedAttrs[E]}}return this.length=d,4*p*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const d=new Uint32Array(this._data.length);return d.set(this._data),this._data=d,1}return 0}fill(d,m=!1){if(m)for(let p=0;p<this.length;++p)this.isProtected(p)||this.setCell(p,d);else{this._combined={},this._extendedAttrs={};for(let p=0;p<this.length;++p)this.setCell(p,d)}}copyFrom(d){this.length!==d.length?this._data=new Uint32Array(d._data):this._data.set(d._data),this.length=d.length,this._combined={};for(const m in d._combined)this._combined[m]=d._combined[m];this._extendedAttrs={};for(const m in d._extendedAttrs)this._extendedAttrs[m]=d._extendedAttrs[m];this.isWrapped=d.isWrapped}clone(){const d=new M(0);d._data=new Uint32Array(this._data),d.length=this.length;for(const m in this._combined)d._combined[m]=this._combined[m];for(const m in this._extendedAttrs)d._extendedAttrs[m]=this._extendedAttrs[m];return d.isWrapped=this.isWrapped,d}getTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0])return d+(this._data[3*d+0]>>22);return 0}getNoBgTrimmedLength(){for(let d=this.length-1;d>=0;--d)if(4194303&this._data[3*d+0]||50331648&this._data[3*d+2])return d+(this._data[3*d+0]>>22);return 0}copyCellsFrom(d,m,p,f,x){const j=d._data;if(x)for(let R=f-1;R>=0;R--){for(let S=0;S<3;S++)this._data[3*(p+R)+S]=j[3*(m+R)+S];268435456&j[3*(m+R)+2]&&(this._extendedAttrs[p+R]=d._extendedAttrs[m+R])}else for(let R=0;R<f;R++){for(let S=0;S<3;S++)this._data[3*(p+R)+S]=j[3*(m+R)+S];268435456&j[3*(m+R)+2]&&(this._extendedAttrs[p+R]=d._extendedAttrs[m+R])}const E=Object.keys(d._combined);for(let R=0;R<E.length;R++){const S=parseInt(E[R],10);S>=m&&(this._combined[S-m+p]=d._combined[S])}}translateToString(d,m,p,f){m=m??0,p=p??this.length,d&&(p=Math.min(p,this.getTrimmedLength())),f&&(f.length=0);let x="";for(;m<p;){const j=this._data[3*m+0],E=2097151&j,R=2097152&j?this._combined[m]:E?(0,k.stringFromCodePoint)(E):h.WHITESPACE_CELL_CHAR;if(x+=R,f)for(let S=0;S<R.length;++S)f.push(m);m+=j>>22||1}return f&&f.push(m),x}}i.BufferLine=M},4841:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(a,g){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return g*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(b,i)=>{function a(g,_,h){if(_===g.length-1)return g[_].getTrimmedLength();const k=!g[_].hasContent(h-1)&&g[_].getWidth(h-1)===1,T=g[_+1].getWidth(0)===2;return k&&T?h-1:h}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(g,_,h,k,T){const M=[];for(let w=0;w<g.length-1;w++){let d=w,m=g.get(++d);if(!m.isWrapped)continue;const p=[g.get(w)];for(;d<g.length&&m.isWrapped;)p.push(m),m=g.get(++d);if(k>=w&&k<d){w+=p.length-1;continue}let f=0,x=a(p,f,_),j=1,E=0;for(;j<p.length;){const S=a(p,j,_),L=S-E,I=h-x,P=Math.min(L,I);p[f].copyCellsFrom(p[j],E,x,P,!1),x+=P,x===h&&(f++,x=0),E+=P,E===S&&(j++,E=0),x===0&&f!==0&&p[f-1].getWidth(h-1)===2&&(p[f].copyCellsFrom(p[f-1],h-1,x++,1,!1),p[f-1].setCell(h-1,T))}p[f].replaceCells(x,h,T);let R=0;for(let S=p.length-1;S>0&&(S>f||p[S].getTrimmedLength()===0);S--)R++;R>0&&(M.push(w+p.length-R),M.push(R)),w+=p.length-1}return M},i.reflowLargerCreateNewLayout=function(g,_){const h=[];let k=0,T=_[k],M=0;for(let w=0;w<g.length;w++)if(T===w){const d=_[++k];g.onDeleteEmitter.fire({index:w-M,amount:d}),w+=d-1,M+=d,T=_[++k]}else h.push(w);return{layout:h,countRemoved:M}},i.reflowLargerApplyNewLayout=function(g,_){const h=[];for(let k=0;k<_.length;k++)h.push(g.get(_[k]));for(let k=0;k<h.length;k++)g.set(k,h[k]);g.length=_.length},i.reflowSmallerGetNewLineLengths=function(g,_,h){const k=[],T=g.map(((m,p)=>a(g,p,_))).reduce(((m,p)=>m+p));let M=0,w=0,d=0;for(;d<T;){if(T-d<h){k.push(T-d);break}M+=h;const m=a(g,w,_);M>m&&(M-=m,w++);const p=g[w].getWidth(M-1)===2;p&&M--;const f=p?h-1:h;k.push(f),d+=f}return k},i.getWrappedLineTrimmedLength=a},5295:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const g=a(8460),_=a(844),h=a(9092);class k extends _.Disposable{constructor(M,w){super(),this._optionsService=M,this._bufferService=w,this._onBufferActivate=this.register(new g.EventEmitter),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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.Buffer(!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(M){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(M),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(M,w){this._normal.resize(M,w),this._alt.resize(M,w),this.setupTabStops(M)}setupTabStops(M){this._normal.setupTabStops(M),this._alt.setupTabStops(M)}}i.BufferSet=k},511:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const g=a(482),_=a(643),h=a(3734);class k extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(M){const w=new k;return w.setFromCharData(M),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,g.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(M){this.fg=M[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(M[_.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(M[_.CHAR_DATA_CHAR_INDEX].length===2){const d=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=d&&d<=56319){const m=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=m&&m<=57343?this.content=1024*(d-55296)+m-56320+65536|M[_.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|M[_.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=M[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|M[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.CellData=k},643:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WHITESPACE_CELL_CODE=i.WHITESPACE_CELL_WIDTH=i.WHITESPACE_CELL_CHAR=i.NULL_CELL_CODE=i.NULL_CELL_WIDTH=i.NULL_CELL_CHAR=i.CHAR_DATA_CODE_INDEX=i.CHAR_DATA_WIDTH_INDEX=i.CHAR_DATA_CHAR_INDEX=i.CHAR_DATA_ATTR_INDEX=i.DEFAULT_EXT=i.DEFAULT_ATTR=i.DEFAULT_COLOR=void 0,i.DEFAULT_COLOR=0,i.DEFAULT_ATTR=256|i.DEFAULT_COLOR<<9,i.DEFAULT_EXT=0,i.CHAR_DATA_ATTR_INDEX=0,i.CHAR_DATA_CHAR_INDEX=1,i.CHAR_DATA_WIDTH_INDEX=2,i.CHAR_DATA_CODE_INDEX=3,i.NULL_CELL_CHAR="",i.NULL_CELL_WIDTH=1,i.NULL_CELL_CODE=0,i.WHITESPACE_CELL_CHAR=" ",i.WHITESPACE_CELL_WIDTH=1,i.WHITESPACE_CELL_CODE=32},4863:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Marker=void 0;const g=a(8460),_=a(844);class h{get id(){return this._id}constructor(T){this.line=T,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(T){return this._disposables.push(T),T}}i.Marker=h,h._nextId=1},7116:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DEFAULT_CHARSET=i.CHARSETS=void 0,i.CHARSETS={},i.DEFAULT_CHARSET=i.CHARSETS.B,i.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},i.CHARSETS.A={"#":"£"},i.CHARSETS.B=void 0,i.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},i.CHARSETS.C=i.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},i.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},i.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},i.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},i.CHARSETS.E=i.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},i.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},i.CHARSETS.H=i.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},i.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(b,i)=>{var a,g,_;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
|
|
128
|
-
`,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(a||(i.C0=a={})),(function(h){h.PAD="",h.HOP="",h.BPH="",h.NBH="",h.IND="",h.NEL="
",h.SSA="",h.ESA="",h.HTS="",h.HTJ="",h.VTS="",h.PLD="",h.PLU="",h.RI="",h.SS2="",h.SS3="",h.DCS="",h.PU1="",h.PU2="",h.STS="",h.CCH="",h.MW="",h.SPA="",h.EPA="",h.SOS="",h.SGCI="",h.SCI="",h.CSI="",h.ST="",h.OSC="",h.PM="",h.APC=""})(g||(i.C1=g={})),(function(h){h.ST=`${a.ESC}\\`})(_||(i.C1_ESCAPED=_={}))},7399:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const g=a(2584),_={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:["'",'"']};i.evaluateKeyboardEvent=function(h,k,T,M){const w={type:0,cancel:!1,key:void 0},d=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?w.key=k?g.C0.ESC+"OA":g.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?w.key=k?g.C0.ESC+"OD":g.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?w.key=k?g.C0.ESC+"OC":g.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(w.key=k?g.C0.ESC+"OB":g.C0.ESC+"[B");break;case 8:w.key=h.ctrlKey?"\b":g.C0.DEL,h.altKey&&(w.key=g.C0.ESC+w.key);break;case 9:if(h.shiftKey){w.key=g.C0.ESC+"[Z";break}w.key=g.C0.HT,w.cancel=!0;break;case 13:w.key=h.altKey?g.C0.ESC+g.C0.CR:g.C0.CR,w.cancel=!0;break;case 27:w.key=g.C0.ESC,h.altKey&&(w.key=g.C0.ESC+g.C0.ESC),w.cancel=!0;break;case 37:if(h.metaKey)break;d?(w.key=g.C0.ESC+"[1;"+(d+1)+"D",w.key===g.C0.ESC+"[1;3D"&&(w.key=g.C0.ESC+(T?"b":"[1;5D"))):w.key=k?g.C0.ESC+"OD":g.C0.ESC+"[D";break;case 39:if(h.metaKey)break;d?(w.key=g.C0.ESC+"[1;"+(d+1)+"C",w.key===g.C0.ESC+"[1;3C"&&(w.key=g.C0.ESC+(T?"f":"[1;5C"))):w.key=k?g.C0.ESC+"OC":g.C0.ESC+"[C";break;case 38:if(h.metaKey)break;d?(w.key=g.C0.ESC+"[1;"+(d+1)+"A",T||w.key!==g.C0.ESC+"[1;3A"||(w.key=g.C0.ESC+"[1;5A")):w.key=k?g.C0.ESC+"OA":g.C0.ESC+"[A";break;case 40:if(h.metaKey)break;d?(w.key=g.C0.ESC+"[1;"+(d+1)+"B",T||w.key!==g.C0.ESC+"[1;3B"||(w.key=g.C0.ESC+"[1;5B")):w.key=k?g.C0.ESC+"OB":g.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(w.key=g.C0.ESC+"[2~");break;case 46:w.key=d?g.C0.ESC+"[3;"+(d+1)+"~":g.C0.ESC+"[3~";break;case 36:w.key=d?g.C0.ESC+"[1;"+(d+1)+"H":k?g.C0.ESC+"OH":g.C0.ESC+"[H";break;case 35:w.key=d?g.C0.ESC+"[1;"+(d+1)+"F":k?g.C0.ESC+"OF":g.C0.ESC+"[F";break;case 33:h.shiftKey?w.type=2:h.ctrlKey?w.key=g.C0.ESC+"[5;"+(d+1)+"~":w.key=g.C0.ESC+"[5~";break;case 34:h.shiftKey?w.type=3:h.ctrlKey?w.key=g.C0.ESC+"[6;"+(d+1)+"~":w.key=g.C0.ESC+"[6~";break;case 112:w.key=d?g.C0.ESC+"[1;"+(d+1)+"P":g.C0.ESC+"OP";break;case 113:w.key=d?g.C0.ESC+"[1;"+(d+1)+"Q":g.C0.ESC+"OQ";break;case 114:w.key=d?g.C0.ESC+"[1;"+(d+1)+"R":g.C0.ESC+"OR";break;case 115:w.key=d?g.C0.ESC+"[1;"+(d+1)+"S":g.C0.ESC+"OS";break;case 116:w.key=d?g.C0.ESC+"[15;"+(d+1)+"~":g.C0.ESC+"[15~";break;case 117:w.key=d?g.C0.ESC+"[17;"+(d+1)+"~":g.C0.ESC+"[17~";break;case 118:w.key=d?g.C0.ESC+"[18;"+(d+1)+"~":g.C0.ESC+"[18~";break;case 119:w.key=d?g.C0.ESC+"[19;"+(d+1)+"~":g.C0.ESC+"[19~";break;case 120:w.key=d?g.C0.ESC+"[20;"+(d+1)+"~":g.C0.ESC+"[20~";break;case 121:w.key=d?g.C0.ESC+"[21;"+(d+1)+"~":g.C0.ESC+"[21~";break;case 122:w.key=d?g.C0.ESC+"[23;"+(d+1)+"~":g.C0.ESC+"[23~";break;case 123:w.key=d?g.C0.ESC+"[24;"+(d+1)+"~":g.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(T&&!M||!h.altKey||h.metaKey)!T||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?w.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(w.key=g.C0.US),h.key==="@"&&(w.key=g.C0.NUL)):h.keyCode===65&&(w.type=1);else{const m=_[h.keyCode],p=m==null?void 0:m[h.shiftKey?1:0];if(p)w.key=g.C0.ESC+p;else if(h.keyCode>=65&&h.keyCode<=90){const f=h.ctrlKey?h.keyCode-64:h.keyCode+32;let x=String.fromCharCode(f);h.shiftKey&&(x=x.toUpperCase()),w.key=g.C0.ESC+x}else if(h.keyCode===32)w.key=g.C0.ESC+(h.ctrlKey?g.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let f=h.code.slice(3,4);h.shiftKey||(f=f.toLowerCase()),w.key=g.C0.ESC+f,w.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?w.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?w.key=g.C0.NUL:h.keyCode>=51&&h.keyCode<=55?w.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?w.key=g.C0.DEL:h.keyCode===219?w.key=g.C0.ESC:h.keyCode===220?w.key=g.C0.FS:h.keyCode===221&&(w.key=g.C0.GS)}return w}},482:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Utf8ToUtf32=i.StringToUtf32=i.utf32ToString=i.stringFromCodePoint=void 0,i.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},i.utf32ToString=function(a,g=0,_=a.length){let h="";for(let k=g;k<_;++k){let T=a[k];T>65535?(T-=65536,h+=String.fromCharCode(55296+(T>>10))+String.fromCharCode(T%1024+56320)):h+=String.fromCharCode(T)}return h},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,g){const _=a.length;if(!_)return 0;let h=0,k=0;if(this._interim){const T=a.charCodeAt(k++);56320<=T&&T<=57343?g[h++]=1024*(this._interim-55296)+T-56320+65536:(g[h++]=this._interim,g[h++]=T),this._interim=0}for(let T=k;T<_;++T){const M=a.charCodeAt(T);if(55296<=M&&M<=56319){if(++T>=_)return this._interim=M,h;const w=a.charCodeAt(T);56320<=w&&w<=57343?g[h++]=1024*(M-55296)+w-56320+65536:(g[h++]=M,g[h++]=w)}else M!==65279&&(g[h++]=M)}return h}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,g){const _=a.length;if(!_)return 0;let h,k,T,M,w=0,d=0,m=0;if(this.interim[0]){let x=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let E,R=0;for(;(E=63&this.interim[++R])&&R<4;)j<<=6,j|=E;const S=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,L=S-R;for(;m<L;){if(m>=_)return 0;if(E=a[m++],(192&E)!=128){m--,x=!0;break}this.interim[R++]=E,j<<=6,j|=63&E}x||(S===2?j<128?m--:g[w++]=j:S===3?j<2048||j>=55296&&j<=57343||j===65279||(g[w++]=j):j<65536||j>1114111||(g[w++]=j)),this.interim.fill(0)}const p=_-4;let f=m;for(;f<_;){for(;!(!(f<p)||128&(h=a[f])||128&(k=a[f+1])||128&(T=a[f+2])||128&(M=a[f+3]));)g[w++]=h,g[w++]=k,g[w++]=T,g[w++]=M,f+=4;if(h=a[f++],h<128)g[w++]=h;else if((224&h)==192){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(d=(31&h)<<6|63&k,d<128){f--;continue}g[w++]=d}else if((240&h)==224){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,w;if(T=a[f++],(192&T)!=128){f--;continue}if(d=(15&h)<<12|(63&k)<<6|63&T,d<2048||d>=55296&&d<=57343||d===65279)continue;g[w++]=d}else if((248&h)==240){if(f>=_)return this.interim[0]=h,w;if(k=a[f++],(192&k)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,w;if(T=a[f++],(192&T)!=128){f--;continue}if(f>=_)return this.interim[0]=h,this.interim[1]=k,this.interim[2]=T,w;if(M=a[f++],(192&M)!=128){f--;continue}if(d=(7&h)<<18|(63&k)<<12|(63&T)<<6|63&M,d<65536||d>1114111)continue;g[w++]=d}}return w}}},225:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const g=a(1480),_=[[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]],h=[[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]];let k;i.UnicodeV6=class{constructor(){if(this.version="6",!k){k=new Uint8Array(65536),k.fill(1),k[0]=0,k.fill(0,1,32),k.fill(0,127,160),k.fill(2,4352,4448),k[9001]=2,k[9002]=2,k.fill(2,11904,42192),k[12351]=1,k.fill(2,44032,55204),k.fill(2,63744,64256),k.fill(2,65040,65050),k.fill(2,65072,65136),k.fill(2,65280,65377),k.fill(2,65504,65511);for(let T=0;T<_.length;++T)k.fill(0,_[T][0],_[T][1]+1)}}wcwidth(T){return T<32?0:T<127?1:T<65536?k[T]:(function(M,w){let d,m=0,p=w.length-1;if(M<w[0][0]||M>w[p][1])return!1;for(;p>=m;)if(d=m+p>>1,M>w[d][1])m=d+1;else{if(!(M<w[d][0]))return!0;p=d-1}return!1})(T,h)?0:T>=131072&&T<=196605||T>=196608&&T<=262141?2:1}charProperties(T,M){let w=this.wcwidth(T),d=w===0&&M!==0;if(d){const m=g.UnicodeService.extractWidth(M);m===0?d=!1:m>w&&(w=m)}return g.UnicodeService.createPropertyValue(0,w,d)}}},5981:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const g=a(8460),_=a(844);class h extends _.Disposable{constructor(T){super(),this._action=T,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(T,M){if(M!==void 0&&this._syncCalls>M)return void(this._syncCalls=0);if(this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const d=this._callbacks.shift();d&&d()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(T,M){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(M),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=T.length,this._writeBuffer.push(T),this._callbacks.push(M)}_innerWrite(T=0,M=!0){const w=T||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const d=this._writeBuffer[this._bufferOffset],m=this._action(d,M);if(m){const f=x=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,x))):this._innerWrite(w,x);return void m.catch((x=>(queueMicrotask((()=>{throw x})),Promise.resolve(!1)))).then(f)}const p=this._callbacks[this._bufferOffset];if(p&&p(),this._bufferOffset++,this._pendingData-=d.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(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()}}i.WriteBuffer=h},5941:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.toRgbString=i.parseColor=void 0;const a=/^([\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})$/,g=/^[\da-f]+$/;function _(h,k){const T=h.toString(16),M=T.length<2?"0"+T:T;switch(k){case 4:return T[0];case 8:return M;case 12:return(M+M).slice(0,3);default:return M+M}}i.parseColor=function(h){if(!h)return;let k=h.toLowerCase();if(k.indexOf("rgb:")===0){k=k.slice(4);const T=a.exec(k);if(T){const M=T[1]?15:T[4]?255:T[7]?4095:65535;return[Math.round(parseInt(T[1]||T[4]||T[7]||T[10],16)/M*255),Math.round(parseInt(T[2]||T[5]||T[8]||T[11],16)/M*255),Math.round(parseInt(T[3]||T[6]||T[9]||T[12],16)/M*255)]}}else if(k.indexOf("#")===0&&(k=k.slice(1),g.exec(k)&&[3,6,9,12].includes(k.length))){const T=k.length/3,M=[0,0,0];for(let w=0;w<3;++w){const d=parseInt(k.slice(T*w,T*w+T),16);M[w]=T===1?d<<4:T===2?d:T===3?d>>4:d>>8}return M}},i.toRgbString=function(h,k=16){const[T,M,w]=h;return`rgb:${_(T,k)}/${_(M,k)}/${_(w,k)}`}},5770:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.PAYLOAD_LIMIT=void 0,i.PAYLOAD_LIMIT=1e7},6351:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DcsHandler=i.DcsParser=void 0;const g=a(482),_=a(8742),h=a(5770),k=[];i.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=k,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=k}registerHandler(M,w){this._handlers[M]===void 0&&(this._handlers[M]=[]);const d=this._handlers[M];return d.push(w),{dispose:()=>{const m=d.indexOf(w);m!==-1&&d.splice(m,1)}}}clearHandler(M){this._handlers[M]&&delete this._handlers[M]}setHandlerFallback(M){this._handlerFb=M}reset(){if(this._active.length)for(let M=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;M>=0;--M)this._active[M].unhook(!1);this._stack.paused=!1,this._active=k,this._ident=0}hook(M,w){if(this.reset(),this._ident=M,this._active=this._handlers[M]||k,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(M,w,d){if(this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].put(M,w,d);else this._handlerFb(this._ident,"PUT",(0,g.utf32ToString)(M,w,d))}unhook(M,w=!0){if(this._active.length){let d=!1,m=this._active.length-1,p=!1;if(this._stack.paused&&(m=this._stack.loopPosition-1,d=w,p=this._stack.fallThrough,this._stack.paused=!1),!p&&d===!1){for(;m>=0&&(d=this._active[m].unhook(M),d!==!0);m--)if(d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!1,d;m--}for(;m>=0;m--)if(d=this._active[m].unhook(!1),d instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=m,this._stack.fallThrough=!0,d}else this._handlerFb(this._ident,"UNHOOK",M);this._active=k,this._ident=0}};const T=new _.Params;T.addParam(0),i.DcsHandler=class{constructor(M){this._handler=M,this._data="",this._params=T,this._hitLimit=!1}hook(M){this._params=M.length>1||M.params[0]?M.clone():T,this._data="",this._hitLimit=!1}put(M,w,d){this._hitLimit||(this._data+=(0,g.utf32ToString)(M,w,d),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(M){let w=!1;if(this._hitLimit)w=!1;else if(M&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((d=>(this._params=T,this._data="",this._hitLimit=!1,d)));return this._params=T,this._data="",this._hitLimit=!1,w}}},2015:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.EscapeSequenceParser=i.VT500_TRANSITION_TABLE=i.TransitionTable=void 0;const g=a(844),_=a(8742),h=a(6242),k=a(6351);class T{constructor(m){this.table=new Uint8Array(m)}setDefault(m,p){this.table.fill(m<<4|p)}add(m,p,f,x){this.table[p<<8|m]=f<<4|x}addMany(m,p,f,x){for(let j=0;j<m.length;j++)this.table[p<<8|m[j]]=f<<4|x}}i.TransitionTable=T;const M=160;i.VT500_TRANSITION_TABLE=(function(){const d=new T(4095),m=Array.apply(null,Array(256)).map(((R,S)=>S)),p=(R,S)=>m.slice(R,S),f=p(32,127),x=p(0,24);x.push(25),x.push.apply(x,p(28,32));const j=p(0,14);let E;for(E in d.setDefault(1,0),d.addMany(f,0,2,0),j)d.addMany([24,26,153,154],E,3,0),d.addMany(p(128,144),E,3,0),d.addMany(p(144,152),E,3,0),d.add(156,E,0,0),d.add(27,E,11,1),d.add(157,E,4,8),d.addMany([152,158,159],E,0,7),d.add(155,E,11,3),d.add(144,E,11,9);return d.addMany(x,0,3,0),d.addMany(x,1,3,1),d.add(127,1,0,1),d.addMany(x,8,0,8),d.addMany(x,3,3,3),d.add(127,3,0,3),d.addMany(x,4,3,4),d.add(127,4,0,4),d.addMany(x,6,3,6),d.addMany(x,5,3,5),d.add(127,5,0,5),d.addMany(x,2,3,2),d.add(127,2,0,2),d.add(93,1,4,8),d.addMany(f,8,5,8),d.add(127,8,5,8),d.addMany([156,27,24,26,7],8,6,0),d.addMany(p(28,32),8,0,8),d.addMany([88,94,95],1,0,7),d.addMany(f,7,0,7),d.addMany(x,7,0,7),d.add(156,7,0,0),d.add(127,7,0,7),d.add(91,1,11,3),d.addMany(p(64,127),3,7,0),d.addMany(p(48,60),3,8,4),d.addMany([60,61,62,63],3,9,4),d.addMany(p(48,60),4,8,4),d.addMany(p(64,127),4,7,0),d.addMany([60,61,62,63],4,0,6),d.addMany(p(32,64),6,0,6),d.add(127,6,0,6),d.addMany(p(64,127),6,0,0),d.addMany(p(32,48),3,9,5),d.addMany(p(32,48),5,9,5),d.addMany(p(48,64),5,0,6),d.addMany(p(64,127),5,7,0),d.addMany(p(32,48),4,9,5),d.addMany(p(32,48),1,9,2),d.addMany(p(32,48),2,9,2),d.addMany(p(48,127),2,10,0),d.addMany(p(48,80),1,10,0),d.addMany(p(81,88),1,10,0),d.addMany([89,90,92],1,10,0),d.addMany(p(96,127),1,10,0),d.add(80,1,11,9),d.addMany(x,9,0,9),d.add(127,9,0,9),d.addMany(p(28,32),9,0,9),d.addMany(p(32,48),9,9,12),d.addMany(p(48,60),9,8,10),d.addMany([60,61,62,63],9,9,10),d.addMany(x,11,0,11),d.addMany(p(32,128),11,0,11),d.addMany(p(28,32),11,0,11),d.addMany(x,10,0,10),d.add(127,10,0,10),d.addMany(p(28,32),10,0,10),d.addMany(p(48,60),10,8,10),d.addMany([60,61,62,63],10,0,11),d.addMany(p(32,48),10,9,12),d.addMany(x,12,0,12),d.add(127,12,0,12),d.addMany(p(28,32),12,0,12),d.addMany(p(32,48),12,9,12),d.addMany(p(48,64),12,0,11),d.addMany(p(64,127),12,12,13),d.addMany(p(64,127),10,12,13),d.addMany(p(64,127),9,12,13),d.addMany(x,13,13,13),d.addMany(f,13,13,13),d.add(127,13,0,13),d.addMany([27,156,24,26],13,14,0),d.add(M,0,2,0),d.add(M,8,5,8),d.add(M,6,0,6),d.add(M,11,0,11),d.add(M,13,13,13),d})();class w extends g.Disposable{constructor(m=i.VT500_TRANSITION_TABLE){super(),this._transitions=m,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(p,f,x)=>{},this._executeHandlerFb=p=>{},this._csiHandlerFb=(p,f)=>{},this._escHandlerFb=p=>{},this._errorHandlerFb=p=>p,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,g.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new k.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(m,p=[64,126]){let f=0;if(m.prefix){if(m.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=m.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(m.intermediates){if(m.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let j=0;j<m.intermediates.length;++j){const E=m.intermediates.charCodeAt(j);if(32>E||E>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=E}}if(m.final.length!==1)throw new Error("final must be a single byte");const x=m.final.charCodeAt(0);if(p[0]>x||x>p[1])throw new Error(`final must be in range ${p[0]} .. ${p[1]}`);return f<<=8,f|=x,f}identToString(m){const p=[];for(;m;)p.push(String.fromCharCode(255&m)),m>>=8;return p.reverse().join("")}setPrintHandler(m){this._printHandler=m}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(m,p){const f=this._identifier(m,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);const x=this._escHandlers[f];return x.push(p),{dispose:()=>{const j=x.indexOf(p);j!==-1&&x.splice(j,1)}}}clearEscHandler(m){this._escHandlers[this._identifier(m,[48,126])]&&delete this._escHandlers[this._identifier(m,[48,126])]}setEscHandlerFallback(m){this._escHandlerFb=m}setExecuteHandler(m,p){this._executeHandlers[m.charCodeAt(0)]=p}clearExecuteHandler(m){this._executeHandlers[m.charCodeAt(0)]&&delete this._executeHandlers[m.charCodeAt(0)]}setExecuteHandlerFallback(m){this._executeHandlerFb=m}registerCsiHandler(m,p){const f=this._identifier(m);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);const x=this._csiHandlers[f];return x.push(p),{dispose:()=>{const j=x.indexOf(p);j!==-1&&x.splice(j,1)}}}clearCsiHandler(m){this._csiHandlers[this._identifier(m)]&&delete this._csiHandlers[this._identifier(m)]}setCsiHandlerFallback(m){this._csiHandlerFb=m}registerDcsHandler(m,p){return this._dcsParser.registerHandler(this._identifier(m),p)}clearDcsHandler(m){this._dcsParser.clearHandler(this._identifier(m))}setDcsHandlerFallback(m){this._dcsParser.setHandlerFallback(m)}registerOscHandler(m,p){return this._oscParser.registerHandler(m,p)}clearOscHandler(m){this._oscParser.clearHandler(m)}setOscHandlerFallback(m){this._oscParser.setHandlerFallback(m)}setErrorHandler(m){this._errorHandler=m}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(m,p,f,x,j){this._parseStack.state=m,this._parseStack.handlers=p,this._parseStack.handlerPos=f,this._parseStack.transition=x,this._parseStack.chunkPos=j}parse(m,p,f){let x,j=0,E=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(f===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const S=this._parseStack.handlers;let L=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(f===!1&&L>-1){for(;L>=0&&(x=S[L](this._params),x!==!0);L--)if(x instanceof Promise)return this._parseStack.handlerPos=L,x}this._parseStack.handlers=[];break;case 4:if(f===!1&&L>-1){for(;L>=0&&(x=S[L](),x!==!0);L--)if(x instanceof Promise)return this._parseStack.handlerPos=L,x}this._parseStack.handlers=[];break;case 6:if(j=m[this._parseStack.chunkPos],x=this._dcsParser.unhook(j!==24&&j!==26,f),x)return x;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(j=m[this._parseStack.chunkPos],x=this._oscParser.end(j!==24&&j!==26,f),x)return x;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let S=R;S<p;++S){switch(j=m[S],E=this._transitions.table[this.currentState<<8|(j<160?j:M)],E>>4){case 2:for(let F=S+1;;++F){if(F>=p||(j=m[F])<32||j>126&&j<M){this._printHandler(m,S,F),S=F-1;break}if(++F>=p||(j=m[F])<32||j>126&&j<M){this._printHandler(m,S,F),S=F-1;break}if(++F>=p||(j=m[F])<32||j>126&&j<M){this._printHandler(m,S,F),S=F-1;break}if(++F>=p||(j=m[F])<32||j>126&&j<M){this._printHandler(m,S,F),S=F-1;break}}break;case 3:this._executeHandlers[j]?this._executeHandlers[j]():this._executeHandlerFb(j),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:S,code:j,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const L=this._csiHandlers[this._collect<<8|j];let I=L?L.length-1:-1;for(;I>=0&&(x=L[I](this._params),x!==!0);I--)if(x instanceof Promise)return this._preserveStack(3,L,I,E,S),x;I<0&&this._csiHandlerFb(this._collect<<8|j,this._params),this.precedingJoinState=0;break;case 8:do switch(j){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(j-48)}while(++S<p&&(j=m[S])>47&&j<60);S--;break;case 9:this._collect<<=8,this._collect|=j;break;case 10:const P=this._escHandlers[this._collect<<8|j];let D=P?P.length-1:-1;for(;D>=0&&(x=P[D](),x!==!0);D--)if(x instanceof Promise)return this._preserveStack(4,P,D,E,S),x;D<0&&this._escHandlerFb(this._collect<<8|j),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|j,this._params);break;case 13:for(let F=S+1;;++F)if(F>=p||(j=m[F])===24||j===26||j===27||j>127&&j<M){this._dcsParser.put(m,S,F),S=F-1;break}break;case 14:if(x=this._dcsParser.unhook(j!==24&&j!==26),x)return this._preserveStack(6,[],0,E,S),x;j===27&&(E|=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 F=S+1;;F++)if(F>=p||(j=m[F])<32||j>127&&j<M){this._oscParser.put(m,S,F),S=F-1;break}break;case 6:if(x=this._oscParser.end(j!==24&&j!==26),x)return this._preserveStack(5,[],0,E,S),x;j===27&&(E|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&E}}}i.EscapeSequenceParser=w},6242:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const g=a(5770),_=a(482),h=[];i.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(k,T){this._handlers[k]===void 0&&(this._handlers[k]=[]);const M=this._handlers[k];return M.push(T),{dispose:()=>{const w=M.indexOf(T);w!==-1&&M.splice(w,1)}}}clearHandler(k){this._handlers[k]&&delete this._handlers[k]}setHandlerFallback(k){this._handlerFb=k}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let k=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;k>=0;--k)this._active[k].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let k=this._active.length-1;k>=0;k--)this._active[k].start();else this._handlerFb(this._id,"START")}_put(k,T,M){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(k,T,M);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(k,T,M))}start(){this.reset(),this._state=1}put(k,T,M){if(this._state!==3){if(this._state===1)for(;T<M;){const w=k[T++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&M-T>0&&this._put(k,T,M)}}end(k,T=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let M=!1,w=this._active.length-1,d=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,M=T,d=this._stack.fallThrough,this._stack.paused=!1),!d&&M===!1){for(;w>=0&&(M=this._active[w].end(k),M!==!0);w--)if(M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,M;w--}for(;w>=0;w--)if(M=this._active[w].end(!1),M instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,M}else this._handlerFb(this._id,"END",k);this._active=h,this._id=-1,this._state=0}}},i.OscHandler=class{constructor(k){this._handler=k,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(k,T,M){this._hitLimit||(this._data+=(0,_.utf32ToString)(k,T,M),this._data.length>g.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(k){let T=!1;if(this._hitLimit)T=!1;else if(k&&(T=this._handler(this._data),T instanceof Promise))return T.then((M=>(this._data="",this._hitLimit=!1,M)));return this._data="",this._hitLimit=!1,T}}},8742:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const a=2147483647;class g{static fromArray(h){const k=new g;if(!h.length)return k;for(let T=Array.isArray(h[0])?1:0;T<h.length;++T){const M=h[T];if(Array.isArray(M))for(let w=0;w<M.length;++w)k.addSubParam(M[w]);else k.addParam(M)}return k}constructor(h=32,k=32){if(this.maxLength=h,this.maxSubParamsLength=k,k>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(k),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new g(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let k=0;k<this.length;++k){h.push(this.params[k]);const T=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-T>0&&h.push(Array.prototype.slice.call(this._subParams,T,M))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>a?a:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>a?a:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const k=this._subParamsIdx[h]>>8,T=255&this._subParamsIdx[h];return T-k>0?this._subParams.subarray(k,T):null}getSubParamsAll(){const h={};for(let k=0;k<this.length;++k){const T=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-T>0&&(h[k]=this._subParams.slice(T,M))}return h}addDigit(h){let k;if(this._rejectDigits||!(k=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const T=this._digitIsSub?this._subParams:this.params,M=T[k-1];T[k-1]=~M?Math.min(10*M+h,a):h}}i.Params=g},5741:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.AddonManager=void 0,i.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,g){const _={instance:g,dispose:g.dispose,isDisposed:!1};this._addons.push(_),g.dispose=()=>this._wrappedAddonDispose(_),g.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let g=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===a){g=_;break}if(g===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(g,1)}}},8771:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const g=a(3785),_=a(511);i.BufferApiView=class{constructor(h,k){this._buffer=h,this.type=k}init(h){return this._buffer=h,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(h){const k=this._buffer.lines.get(h);if(k)return new g.BufferLineApiView(k)}getNullCell(){return new _.CellData}}},3785:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const g=a(511);i.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new g.CellData)}translateToString(_,h,k){return this._line.translateToString(_,h,k)}}},8285:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const g=a(8771),_=a(8460),h=a(844);class k extends h.Disposable{constructor(M){super(),this._core=M,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new g.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new g.BufferApiView(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)}}i.BufferNamespaceApi=k},7975:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ParserApi=void 0,i.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,g){return this._core.registerCsiHandler(a,(_=>g(_.toArray())))}addCsiHandler(a,g){return this.registerCsiHandler(a,g)}registerDcsHandler(a,g){return this._core.registerDcsHandler(a,((_,h)=>g(_,h.toArray())))}addDcsHandler(a,g){return this.registerDcsHandler(a,g)}registerEscHandler(a,g){return this._core.registerEscHandler(a,g)}addEscHandler(a,g){return this.registerEscHandler(a,g)}registerOscHandler(a,g){return this._core.registerOscHandler(a,g)}addOscHandler(a,g){return this.registerOscHandler(a,g)}}},7090:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeApi=void 0,i.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(b,i,a){var g=this&&this.__decorate||function(d,m,p,f){var x,j=arguments.length,E=j<3?m:f===null?f=Object.getOwnPropertyDescriptor(m,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,m,p,f);else for(var R=d.length-1;R>=0;R--)(x=d[R])&&(E=(j<3?x(E):j>3?x(m,p,E):x(m,p))||E);return j>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(d,m){return function(p,f){m(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const h=a(8460),k=a(844),T=a(5295),M=a(2585);i.MINIMUM_COLS=2,i.MINIMUM_ROWS=1;let w=i.BufferService=class extends k.Disposable{get buffer(){return this.buffers.active}constructor(d){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(d.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(d.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new T.BufferSet(d,this))}resize(d,m){this.cols=d,this.rows=m,this.buffers.resize(d,m),this._onResize.fire({cols:d,rows:m})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(d,m=!1){const p=this.buffer;let f;f=this._cachedBlankLine,f&&f.length===this.cols&&f.getFg(0)===d.fg&&f.getBg(0)===d.bg||(f=p.getBlankLine(d,m),this._cachedBlankLine=f),f.isWrapped=m;const x=p.ybase+p.scrollTop,j=p.ybase+p.scrollBottom;if(p.scrollTop===0){const E=p.lines.isFull;j===p.lines.length-1?E?p.lines.recycle().copyFrom(f):p.lines.push(f.clone()):p.lines.splice(j+1,0,f.clone()),E?this.isUserScrolling&&(p.ydisp=Math.max(p.ydisp-1,0)):(p.ybase++,this.isUserScrolling||p.ydisp++)}else{const E=j-x+1;p.lines.shiftElements(x+1,E-1,-1),p.lines.set(j,f.clone())}this.isUserScrolling||(p.ydisp=p.ybase),this._onScroll.fire(p.ydisp)}scrollLines(d,m,p){const f=this.buffer;if(d<0){if(f.ydisp===0)return;this.isUserScrolling=!0}else d+f.ydisp>=f.ybase&&(this.isUserScrolling=!1);const x=f.ydisp;f.ydisp=Math.max(Math.min(f.ydisp+d,f.ybase),0),x!==f.ydisp&&(m||this._onScroll.fire(f.ydisp))}};i.BufferService=w=g([_(0,M.IOptionsService)],w)},7994:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CharsetService=void 0,i.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,g){this._charsets[a]=g,this.glevel===a&&(this.charset=g)}}},1753:function(b,i,a){var g=this&&this.__decorate||function(f,x,j,E){var R,S=arguments.length,L=S<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,j):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(f,x,j,E);else for(var I=f.length-1;I>=0;I--)(R=f[I])&&(L=(S<3?R(L):S>3?R(x,j,L):R(x,j))||L);return S>3&&L&&Object.defineProperty(x,j,L),L},_=this&&this.__param||function(f,x){return function(j,E){x(j,E,f)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const h=a(2585),k=a(8460),T=a(844),M={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:f=>f.button!==4&&f.action===1&&(f.ctrl=!1,f.alt=!1,f.shift=!1,!0)},VT200:{events:19,restrict:f=>f.action!==32},DRAG:{events:23,restrict:f=>f.action!==32||f.button!==3},ANY:{events:31,restrict:f=>!0}};function w(f,x){let j=(f.ctrl?16:0)|(f.shift?4:0)|(f.alt?8:0);return f.button===4?(j|=64,j|=f.action):(j|=3&f.button,4&f.button&&(j|=64),8&f.button&&(j|=128),f.action===32?j|=32:f.action!==0||x||(j|=3)),j}const d=String.fromCharCode,m={DEFAULT:f=>{const x=[w(f,!1)+32,f.col+32,f.row+32];return x[0]>255||x[1]>255||x[2]>255?"":`\x1B[M${d(x[0])}${d(x[1])}${d(x[2])}`},SGR:f=>{const x=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${w(f,!0)};${f.col};${f.row}${x}`},SGR_PIXELS:f=>{const x=f.action===0&&f.button!==4?"m":"M";return`\x1B[<${w(f,!0)};${f.x};${f.y}${x}`}};let p=i.CoreMouseService=class extends T.Disposable{constructor(f,x){super(),this._bufferService=f,this._coreService=x,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new k.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const j of Object.keys(M))this.addProtocol(j,M[j]);for(const j of Object.keys(m))this.addEncoding(j,m[j]);this.reset()}addProtocol(f,x){this._protocols[f]=x}addEncoding(f,x){this._encodings[f]=x}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(f){if(!this._protocols[f])throw new Error(`unknown protocol "${f}"`);this._activeProtocol=f,this._onProtocolChange.fire(this._protocols[f].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(f){if(!this._encodings[f])throw new Error(`unknown encoding "${f}"`);this._activeEncoding=f}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(f){if(f.col<0||f.col>=this._bufferService.cols||f.row<0||f.row>=this._bufferService.rows||f.button===4&&f.action===32||f.button===3&&f.action!==32||f.button!==4&&(f.action===2||f.action===3)||(f.col++,f.row++,f.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,f,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(f))return!1;const x=this._encodings[this._activeEncoding](f);return x&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(x):this._coreService.triggerDataEvent(x,!0)),this._lastEvent=f,!0}explainEvents(f){return{down:!!(1&f),up:!!(2&f),drag:!!(4&f),move:!!(8&f),wheel:!!(16&f)}}_equalEvents(f,x,j){if(j){if(f.x!==x.x||f.y!==x.y)return!1}else if(f.col!==x.col||f.row!==x.row)return!1;return f.button===x.button&&f.action===x.action&&f.ctrl===x.ctrl&&f.alt===x.alt&&f.shift===x.shift}};i.CoreMouseService=p=g([_(0,h.IBufferService),_(1,h.ICoreService)],p)},6975:function(b,i,a){var g=this&&this.__decorate||function(p,f,x,j){var E,R=arguments.length,S=R<3?f:j===null?j=Object.getOwnPropertyDescriptor(f,x):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(p,f,x,j);else for(var L=p.length-1;L>=0;L--)(E=p[L])&&(S=(R<3?E(S):R>3?E(f,x,S):E(f,x))||S);return R>3&&S&&Object.defineProperty(f,x,S),S},_=this&&this.__param||function(p,f){return function(x,j){f(x,j,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const h=a(1439),k=a(8460),T=a(844),M=a(2585),w=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let m=i.CoreService=class extends T.Disposable{constructor(p,f,x){super(),this._bufferService=p,this._logService=f,this._optionsService=x,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new k.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new k.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new k.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new k.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(d)}reset(){this.modes=(0,h.clone)(w),this.decPrivateModes=(0,h.clone)(d)}triggerDataEvent(p,f=!1){if(this._optionsService.rawOptions.disableStdin)return;const x=this._bufferService.buffer;f&&this._optionsService.rawOptions.scrollOnUserInput&&x.ybase!==x.ydisp&&this._onRequestScrollToBottom.fire(),f&&this._onUserInput.fire(),this._logService.debug(`sending data "${p}"`,(()=>p.split("").map((j=>j.charCodeAt(0))))),this._onData.fire(p)}triggerBinaryEvent(p){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${p}"`,(()=>p.split("").map((f=>f.charCodeAt(0))))),this._onBinary.fire(p))}};i.CoreService=m=g([_(0,M.IBufferService),_(1,M.ILogService),_(2,M.IOptionsService)],m)},9074:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const g=a(8055),_=a(8460),h=a(844),k=a(6106);let T=0,M=0;class w extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new k.SortedList((p=>p==null?void 0:p.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(p){if(p.marker.isDisposed)return;const f=new d(p);if(f){const x=f.marker.onDispose((()=>f.dispose()));f.onDispose((()=>{f&&(this._decorations.delete(f)&&this._onDecorationRemoved.fire(f),x.dispose())})),this._decorations.insert(f),this._onDecorationRegistered.fire(f)}return f}reset(){for(const p of this._decorations.values())p.dispose();this._decorations.clear()}*getDecorationsAtCell(p,f,x){let j=0,E=0;for(const R of this._decorations.getKeyIterator(f))j=R.options.x??0,E=j+(R.options.width??1),p>=j&&p<E&&(!x||(R.options.layer??"bottom")===x)&&(yield R)}forEachDecorationAtCell(p,f,x,j){this._decorations.forEachByKey(f,(E=>{T=E.options.x??0,M=T+(E.options.width??1),p>=T&&p<M&&(!x||(E.options.layer??"bottom")===x)&&j(E)}))}}i.DecorationService=w;class d extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=g.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=g.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(p){super(),this.options=p,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=p.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.InstantiationService=i.ServiceCollection=void 0;const g=a(2585),_=a(8343);class h{constructor(...T){this._entries=new Map;for(const[M,w]of T)this.set(M,w)}set(T,M){const w=this._entries.get(T);return this._entries.set(T,M),w}forEach(T){for(const[M,w]of this._entries.entries())T(M,w)}has(T){return this._entries.has(T)}get(T){return this._entries.get(T)}}i.ServiceCollection=h,i.InstantiationService=class{constructor(){this._services=new h,this._services.set(g.IInstantiationService,this)}setService(k,T){this._services.set(k,T)}getService(k){return this._services.get(k)}createInstance(k,...T){const M=(0,_.getServiceDependencies)(k).sort(((m,p)=>m.index-p.index)),w=[];for(const m of M){const p=this._services.get(m.id);if(!p)throw new Error(`[createInstance] ${k.name} depends on UNKNOWN service ${m.id}.`);w.push(p)}const d=M.length>0?M[0].index:T.length;if(T.length!==d)throw new Error(`[createInstance] First service dependency of ${k.name} at position ${d+1} conflicts with ${T.length} static arguments`);return new k(...T,...w)}}},7866:function(b,i,a){var g=this&&this.__decorate||function(d,m,p,f){var x,j=arguments.length,E=j<3?m:f===null?f=Object.getOwnPropertyDescriptor(m,p):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(d,m,p,f);else for(var R=d.length-1;R>=0;R--)(x=d[R])&&(E=(j<3?x(E):j>3?x(m,p,E):x(m,p))||E);return j>3&&E&&Object.defineProperty(m,p,E),E},_=this&&this.__param||function(d,m){return function(p,f){m(p,f,d)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const h=a(844),k=a(2585),T={trace:k.LogLevelEnum.TRACE,debug:k.LogLevelEnum.DEBUG,info:k.LogLevelEnum.INFO,warn:k.LogLevelEnum.WARN,error:k.LogLevelEnum.ERROR,off:k.LogLevelEnum.OFF};let M,w=i.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(d){super(),this._optionsService=d,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=T[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(d){for(let m=0;m<d.length;m++)typeof d[m]=="function"&&(d[m]=d[m]())}_log(d,m,p){this._evalLazyOptionalParams(p),d.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+m,...p)}trace(d,...m){var p;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.trace.bind(this._optionsService.options.logger))??console.log,d,m)}debug(d,...m){var p;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.debug.bind(this._optionsService.options.logger))??console.log,d,m)}info(d,...m){var p;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.info.bind(this._optionsService.options.logger))??console.info,d,m)}warn(d,...m){var p;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.warn.bind(this._optionsService.options.logger))??console.warn,d,m)}error(d,...m){var p;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((p=this._optionsService.options.logger)==null?void 0:p.error.bind(this._optionsService.options.logger))??console.error,d,m)}};i.LogService=w=g([_(0,k.IOptionsService)],w),i.setTraceLogger=function(d){M=d},i.traceCall=function(d,m,p){if(typeof p.value!="function")throw new Error("not supported");const f=p.value;p.value=function(...x){if(M.logLevel!==k.LogLevelEnum.TRACE)return f.apply(this,x);M.trace(`GlyphRenderer#${f.name}(${x.map((E=>JSON.stringify(E))).join(", ")})`);const j=f.apply(this,x);return M.trace(`GlyphRenderer#${f.name} return`,j),j}}},7302:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const g=a(8460),_=a(844),h=a(6114);i.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const k=["normal","bold","100","200","300","400","500","600","700","800","900"];class T extends _.Disposable{constructor(w){super(),this._onOptionChange=this.register(new g.EventEmitter),this.onOptionChange=this._onOptionChange.event;const d={...i.DEFAULT_OPTIONS};for(const m in w)if(m in d)try{const p=w[m];d[m]=this._sanitizeAndValidateOption(m,p)}catch(p){console.error(p)}this.rawOptions=d,this.options={...d},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,d){return this.onOptionChange((m=>{m===w&&d(this.rawOptions[w])}))}onMultipleOptionChange(w,d){return this.onOptionChange((m=>{w.indexOf(m)!==-1&&d()}))}_setupOptions(){const w=m=>{if(!(m in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);return this.rawOptions[m]},d=(m,p)=>{if(!(m in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${m}"`);p=this._sanitizeAndValidateOption(m,p),this.rawOptions[m]!==p&&(this.rawOptions[m]=p,this._onOptionChange.fire(m))};for(const m in this.rawOptions){const p={get:w.bind(this,m),set:d.bind(this,m)};Object.defineProperty(this.options,m,p)}}_sanitizeAndValidateOption(w,d){switch(w){case"cursorStyle":if(d||(d=i.DEFAULT_OPTIONS[w]),!(function(m){return m==="block"||m==="underline"||m==="bar"})(d))throw new Error(`"${d}" is not a valid value for ${w}`);break;case"wordSeparator":d||(d=i.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof d=="number"&&1<=d&&d<=1e3)break;d=k.includes(d)?d:i.DEFAULT_OPTIONS[w];break;case"cursorWidth":d=Math.floor(d);case"lineHeight":case"tabStopWidth":if(d<1)throw new Error(`${w} cannot be less than 1, value: ${d}`);break;case"minimumContrastRatio":d=Math.max(1,Math.min(21,Math.round(10*d)/10));break;case"scrollback":if((d=Math.min(d,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${d}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(d<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${d}`);break;case"rows":case"cols":if(!d&&d!==0)throw new Error(`${w} must be numeric, value: ${d}`);break;case"windowsPty":d=d??{}}return d}}i.OptionsService=T},2660:function(b,i,a){var g=this&&this.__decorate||function(T,M,w,d){var m,p=arguments.length,f=p<3?M:d===null?d=Object.getOwnPropertyDescriptor(M,w):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(T,M,w,d);else for(var x=T.length-1;x>=0;x--)(m=T[x])&&(f=(p<3?m(f):p>3?m(M,w,f):m(M,w))||f);return p>3&&f&&Object.defineProperty(M,w,f),f},_=this&&this.__param||function(T,M){return function(w,d){M(w,d,T)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const h=a(2585);let k=i.OscLinkService=class{constructor(T){this._bufferService=T,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(T){const M=this._bufferService.buffer;if(T.id===void 0){const x=M.addMarker(M.ybase+M.y),j={data:T,id:this._nextId++,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(j,x))),this._dataByLinkId.set(j.id,j),j.id}const w=T,d=this._getEntryIdKey(w),m=this._entriesWithId.get(d);if(m)return this.addLineToLink(m.id,M.ybase+M.y),m.id;const p=M.addMarker(M.ybase+M.y),f={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[p]};return p.onDispose((()=>this._removeMarkerFromLink(f,p))),this._entriesWithId.set(f.key,f),this._dataByLinkId.set(f.id,f),f.id}addLineToLink(T,M){const w=this._dataByLinkId.get(T);if(w&&w.lines.every((d=>d.line!==M))){const d=this._bufferService.buffer.addMarker(M);w.lines.push(d),d.onDispose((()=>this._removeMarkerFromLink(w,d)))}}getLinkData(T){var M;return(M=this._dataByLinkId.get(T))==null?void 0:M.data}_getEntryIdKey(T){return`${T.id};;${T.uri}`}_removeMarkerFromLink(T,M){const w=T.lines.indexOf(M);w!==-1&&(T.lines.splice(w,1),T.lines.length===0&&(T.data.id!==void 0&&this._entriesWithId.delete(T.key),this._dataByLinkId.delete(T.id)))}};i.OscLinkService=k=g([_(0,h.IBufferService)],k)},8343:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",g="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[g]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);const h=function(k,T,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,d,m){d[a]===d?d[g].push({id:w,index:m}):(d[g]=[{id:w,index:m}],d[a]=d)})(h,k,M)};return h.toString=()=>_,i.serviceRegistry.set(_,h),h}},2585:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.IDecorationService=i.IUnicodeService=i.IOscLinkService=i.IOptionsService=i.ILogService=i.LogLevelEnum=i.IInstantiationService=i.ICharsetService=i.ICoreService=i.ICoreMouseService=i.IBufferService=void 0;const g=a(8343);var _;i.IBufferService=(0,g.createDecorator)("BufferService"),i.ICoreMouseService=(0,g.createDecorator)("CoreMouseService"),i.ICoreService=(0,g.createDecorator)("CoreService"),i.ICharsetService=(0,g.createDecorator)("CharsetService"),i.IInstantiationService=(0,g.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(i.LogLevelEnum=_={})),i.ILogService=(0,g.createDecorator)("LogService"),i.IOptionsService=(0,g.createDecorator)("OptionsService"),i.IOscLinkService=(0,g.createDecorator)("OscLinkService"),i.IUnicodeService=(0,g.createDecorator)("UnicodeService"),i.IDecorationService=(0,g.createDecorator)("DecorationService")},1480:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const g=a(8460),_=a(225);class h{static extractShouldJoin(T){return(1&T)!=0}static extractWidth(T){return T>>1&3}static extractCharKind(T){return T>>3}static createPropertyValue(T,M,w=!1){return(16777215&T)<<3|(3&M)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new g.EventEmitter,this.onChange=this._onChange.event;const T=new _.UnicodeV6;this.register(T),this._active=T.version,this._activeProvider=T}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 M=0,w=0;const d=T.length;for(let m=0;m<d;++m){let p=T.charCodeAt(m);if(55296<=p&&p<=56319){if(++m>=d)return M+this.wcwidth(p);const j=T.charCodeAt(m);56320<=j&&j<=57343?p=1024*(p-55296)+j-56320+65536:M+=this.wcwidth(j)}const f=this.charProperties(p,w);let x=h.extractWidth(f);h.extractShouldJoin(f)&&(x-=h.extractWidth(w)),M+=x,w=f}return M}charProperties(T,M){return this._activeProvider.charProperties(T,M)}}i.UnicodeService=h}},l={};function u(b){var i=l[b];if(i!==void 0)return i.exports;var a=l[b]={exports:{}};return s[b].call(a.exports,a,a.exports,u),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;const i=u(9042),a=u(3236),g=u(844),_=u(5741),h=u(8285),k=u(7975),T=u(7090),M=["cols","rows"];class w extends g.Disposable{constructor(m){super(),this._core=this.register(new a.Terminal(m)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const p=x=>this._core.options[x],f=(x,j)=>{this._checkReadonlyOptions(x),this._core.options[x]=j};for(const x in this._core.options){const j={get:p.bind(this,x),set:f.bind(this,x)};Object.defineProperty(this._publicOptions,x,j)}}_checkReadonlyOptions(m){if(M.includes(m))throw new Error(`Option "${m}" 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 k.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new T.UnicodeApi(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 h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const m=this._core.coreService.decPrivateModes;let p="none";switch(this._core.coreMouseService.activeProtocol){case"X10":p="x10";break;case"VT200":p="vt200";break;case"DRAG":p="drag";break;case"ANY":p="any"}return{applicationCursorKeysMode:m.applicationCursorKeys,applicationKeypadMode:m.applicationKeypad,bracketedPasteMode:m.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:p,originMode:m.origin,reverseWraparoundMode:m.reverseWraparound,sendFocusMode:m.sendFocus,wraparoundMode:m.wraparound}}get options(){return this._publicOptions}set options(m){for(const p in m)this._publicOptions[p]=m[p]}blur(){this._core.blur()}focus(){this._core.focus()}input(m,p=!0){this._core.input(m,p)}resize(m,p){this._verifyIntegers(m,p),this._core.resize(m,p)}open(m){this._core.open(m)}attachCustomKeyEventHandler(m){this._core.attachCustomKeyEventHandler(m)}attachCustomWheelEventHandler(m){this._core.attachCustomWheelEventHandler(m)}registerLinkProvider(m){return this._core.registerLinkProvider(m)}registerCharacterJoiner(m){return this._checkProposedApi(),this._core.registerCharacterJoiner(m)}deregisterCharacterJoiner(m){this._checkProposedApi(),this._core.deregisterCharacterJoiner(m)}registerMarker(m=0){return this._verifyIntegers(m),this._core.registerMarker(m)}registerDecoration(m){return this._checkProposedApi(),this._verifyPositiveIntegers(m.x??0,m.width??0,m.height??0),this._core.registerDecoration(m)}hasSelection(){return this._core.hasSelection()}select(m,p,f){this._verifyIntegers(m,p,f),this._core.select(m,p,f)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(m,p){this._verifyIntegers(m,p),this._core.selectLines(m,p)}dispose(){super.dispose()}scrollLines(m){this._verifyIntegers(m),this._core.scrollLines(m)}scrollPages(m){this._verifyIntegers(m),this._core.scrollPages(m)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(m){this._verifyIntegers(m),this._core.scrollToLine(m)}clear(){this._core.clear()}write(m,p){this._core.write(m,p)}writeln(m,p){this._core.write(m),this._core.write(`\r
|
|
129
|
-
`,p)}paste(m){this._core.paste(m)}refresh(m,p){this._verifyIntegers(m,p),this._core.refresh(m,p)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(m){this._addonManager.loadAddon(this,m)}static get strings(){return i}_verifyIntegers(...m){for(const p of m)if(p===1/0||isNaN(p)||p%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...m){for(const p of m)if(p&&(p===1/0||isNaN(p)||p%1!=0||p<0))throw new Error("This API only accepts positive integers")}}b.Terminal=w})(),y})()))})(Su)),Su.exports}var M1=R1();function A1(t){return t.toLowerCase().startsWith("win")}function I1(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const j1=8,D1=100,P1=80,qp=6,Vp=.02,O1=.95,B1=50;function F1(t,e){return Math.hypot(t,e)>j1}function H1(t,e){const s=t[t.length-1];if(s===void 0||e-s.t>P1)return 0;const l=t.filter(b=>s.t-b.t<=D1),u=l[0];if(u===void 0||l.length<2||s.t===u.t)return 0;const y=(u.y-s.y)/(s.t-u.t);return Math.max(-qp,Math.min(qp,y))}function U1(t,e){if(Math.abs(t)<Vp)return{delta:0,velocity:0};const s=Math.max(0,Math.min(B1,e)),l=t*O1**(s/16);return{delta:t*s,velocity:Math.abs(l)<Vp?0:l}}function $1(t){const e=Math.trunc(t);return{pixels:e,rest:t-e}}const W1=60;function z1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const Kp={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},Gp={dark:1,light:4.5};function fv({terminalId:t,connection:e,active:s,theme:l,autoFocus:u=!0,pasteOnCtrlV:y=!1}){const b=N.useRef(null),i=N.useRef(null),a=N.useRef(null),g=N.useRef(l);return g.current=l,N.useEffect(()=>{const _=b.current;if(_===null)return;const h=new M1.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:Kp[g.current],minimumContrastRatio:Gp[g.current]});i.current=h;const k=new x1.FitAddon;a.current=k,h.loadAddon(k),h.loadAddon(new T1.WebLinksAddon),h.open(_);let T=!1;const M=()=>{if(!(T||z1()!=="webgl")){T=!0;try{const te=new N1.WebglAddon;te.onContextLoss(()=>te.dispose()),h.loadAddon(te)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let w={cols:0,rows:0},d;const m=()=>_.clientWidth>0&&_.clientHeight>0,p=te=>{const{cols:ee,rows:we}=h;ee<=0||we<=0||!te&&ee===w.cols&&we===w.rows||(w={cols:ee,rows:we},e.send({type:"resize",terminalId:t,cols:ee,rows:we}))};let f={atBottom:!0,line:0},x=!1;const j=()=>{if(x||!m())return;const te=h.buffer.active;f={atBottom:te.viewportY>=te.baseY,line:te.viewportY}},E=()=>{const te=h.buffer.active;if(te.baseY===0)return;const ee=f.atBottom?te.baseY:Math.min(f.line,te.baseY);h.scrollToLine(ee>0?ee-1:ee+1),h.scrollToLine(ee)},R=h.onRender(j),S=h.onScroll(j);let L=m();const I=()=>{if(m()){try{k.fit()}catch{return}x&&(E(),x=!1),h.cols>0&&h.rows>0&&M(),p(!1)}},P=()=>{window.clearTimeout(d),d=window.setTimeout(I,W1)},D=new ResizeObserver(()=>{const te=m();x=!0,te&&!L&&E(),L=te,P()});D.observe(_),window.addEventListener("resize",P);let F=null,W=0,$=0;const Y=(te,ee,we)=>{const ke=h.element;if(ke===void 0)return;const Ae=$1($+te);$=Ae.rest,Ae.pixels!==0&&ke.dispatchEvent(new WheelEvent("wheel",{deltaY:Ae.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:ee,clientY:we,bubbles:!0,cancelable:!0}))},G=()=>{window.cancelAnimationFrame(W),W=0},V=(te,ee,we)=>{let ke=te,Ae=performance.now();const Me=Je=>{if(!m()){W=0;return}const it=U1(ke,Je-Ae);Ae=Je,Y(it.delta,ee,we),ke=it.velocity,W=ke===0?0:window.requestAnimationFrame(Me)};W=window.requestAnimationFrame(Me)},B=(te,ee)=>{for(let we=0;we<te.length;we++){const ke=te.item(we);if(ke!==null&&ke.identifier===ee)return ke}return null},U=te=>{G(),$=0;const ee=te.touches.length===1?te.touches.item(0):null;F=ee===null?null:{id:ee.identifier,startX:ee.clientX,startY:ee.clientY,lastX:ee.clientX,lastY:ee.clientY,moving:!1,samples:[{t:te.timeStamp,y:ee.clientY}]}},H=te=>{if(te.stopPropagation(),F===null)return;const ee=B(te.touches,F.id);if(ee===null)return;if(!F.moving){if(!F1(ee.clientX-F.startX,ee.clientY-F.startY))return;F.moving=!0}te.cancelable&&te.preventDefault();const we=F.lastY-ee.clientY;F.lastX=ee.clientX,F.lastY=ee.clientY,F.samples.push({t:te.timeStamp,y:ee.clientY}),F.samples.length>32&&F.samples.shift(),Y(we,ee.clientX,ee.clientY)},z=te=>{if(F===null||B(te.changedTouches,F.id)===null)return;const ee=F;if(F=null,!ee.moving)return;const we=H1(ee.samples,te.timeStamp);we!==0&&V(we,ee.lastX,ee.lastY)},Z=()=>{F=null};_.addEventListener("touchstart",U,{capture:!0,passive:!0}),_.addEventListener("touchmove",H,{capture:!0,passive:!1}),_.addEventListener("touchend",z,{capture:!0,passive:!0}),_.addEventListener("touchcancel",Z,{capture:!0,passive:!0});const ie=()=>{if(!(document.visibilityState!=="visible"||!m())){try{k.fit()}catch{return}p(!0)}};window.addEventListener("focus",ie),document.addEventListener("visibilitychange",ie),y&&h.attachCustomKeyEventHandler(te=>!I1(te));const _e=h.onData(te=>{e.send({type:"input",terminalId:t,data:te})}),ge=e.onMessage(te=>{switch(te.type){case"terminal.output":te.terminalId===t&&h.write(te.data);break;case"terminal.replay":if(te.terminalId!==t)break;h.reset(),te.truncated&&h.write(`\x1B[90m-- ${v("terminal.replayTruncated")} --\x1B[0m\r
|
|
130
|
-
`),h.write(te.data);break;case"terminal.exit":if(te.terminalId!==t)break;h.write(`\r
|
|
131
|
-
\x1B[90m-- ${v("terminal.exited",{code:te.exitCode})} --\x1B[0m\r
|
|
132
|
-
`);break}}),Q=()=>{if(m())try{k.fit()}catch{}const te=h.cols>0?h.cols:80,ee=h.rows>0?h.rows:24;w={cols:te,rows:ee},e.send({type:"terminal.attach",terminalId:t,cols:te,rows:ee})};Q();const K=e.onReopen(Q);return()=>{window.clearTimeout(d),window.removeEventListener("resize",P),window.removeEventListener("focus",ie),document.removeEventListener("visibilitychange",ie),D.disconnect(),G(),_.removeEventListener("touchstart",U,{capture:!0}),_.removeEventListener("touchmove",H,{capture:!0}),_.removeEventListener("touchend",z,{capture:!0}),_.removeEventListener("touchcancel",Z,{capture:!0}),R.dispose(),S.dispose(),_e.dispose(),ge(),K(),e.send({type:"terminal.detach",terminalId:t}),h.dispose(),i.current=null,a.current=null}},[t,e,y]),N.useEffect(()=>{const _=i.current;_!==null&&(_.options.theme=Kp[l],_.options.minimumContrastRatio=Gp[l])},[l]),N.useEffect(()=>{if(!s)return;const _=i.current,h=a.current;if(_===null||h===null)return;const k=window.setTimeout(()=>{const T=b.current;if(!(T===null||T.clientWidth===0||T.clientHeight===0)){try{h.fit()}catch{return}u&&_.focus(),_.cols>0&&_.rows>0&&e.send({type:"resize",terminalId:t,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(k)},[s,u,t,e]),o.jsx("div",{className:`terminal-surface${s?"":" terminal-surface-hidden"}`,ref:b})}function q1(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M1.5 8s2.4-4.5 6.5-4.5S14.5 8 14.5 8s-2.4 4.5-6.5 4.5S1.5 8 1.5 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M2.5 13.5l11-11",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function Ca({title:t,onHide:e,confirmText:s}){const[l,u]=N.useState(!1);return o.jsxs("span",{className:"section-hide",children:[o.jsx("button",{className:"icon-button",onClick:y=>{y.stopPropagation(),s===null?e():u(!0)},title:t,"aria-label":t,children:o.jsx(q1,{})}),l&&s!==null&&o.jsxs("span",{className:"section-hide-confirm",role:"alert",children:[o.jsx("span",{children:s}),o.jsx("button",{className:"link-button",onClick:()=>{u(!1),e()},children:v("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:v("common.cancel")})]})]})}const V1=typeof navigator<"u"&&A1(navigator.platform);function K1({connection:t,shells:e,activeShellId:s,cwd:l,shellName:u,theme:y,onSelect:b,onOpen:i,onCloseShell:a,onCollapse:g,onHide:_,hideCount:h=0}){const k=u??v("console.name"),T=e.find(M=>M.terminalId===s)??e[0]??null;return o.jsxs("section",{className:"console-pane",children:[o.jsxs("header",{className:"console-header",children:[o.jsxs("div",{className:"strip-tabs",children:[e.map((M,w)=>o.jsxs("div",{className:`strip-tab${M.terminalId===(T==null?void 0:T.terminalId)?" is-active":""}${M.alive?"":" is-dead"}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>b(M.terminalId),title:M.alive?v("console.tab.title",{shell:M.label.length>0?M.label:k,number:w+1,cwd:l}):v("console.tab.exited",{code:M.exitCode??"?"}),children:v("console.tab.label",{number:w+1})}),o.jsx("button",{className:"strip-tab-close",onClick:()=>a(M.terminalId),title:v("console.tab.close"),children:"×"})]},M.terminalId)),u!==null&&o.jsx("button",{className:"strip-tab-new",onClick:i,title:v("console.openAnother",{shell:k,cwd:l}),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button",onClick:g,title:v("console.collapse"),children:"▾"}),_!==void 0&&o.jsx(Ca,{title:v("settings.hide.console"),onHide:_,confirmText:h===0?null:v("settings.panels.consoleConfirm",{count:h})})]}),o.jsx("div",{className:"console-body",children:e.length===0?o.jsx("div",{className:"console-empty",children:u===null?o.jsx("p",{className:"panel-note",children:v("console.noShell")}):o.jsx("button",{className:"link-button",onClick:i,children:v("console.openIn",{shell:k,cwd:l})})}):o.jsx("div",{className:"terminal-stack",children:e.map(M=>o.jsx(fv,{terminalId:M.terminalId,connection:t,active:M.terminalId===(T==null?void 0:T.terminalId),theme:y,pasteOnCtrlV:V1},M.terminalId))})})]})}function G1(t){return t.cwd===null||!t.shellAvailable||t.shellCwds.includes(t.cwd)?null:t.cwd}const Y1=.75,X1=.9,Q1=.7;function er(t){if(t<1e3)return String(t);if(t<1e6){const e=t/1e3;return`${e<100?Mi(e,1):Math.round(e)}k`}return`${Mi(t/1e6,2)}M`}function J1({usage:t,source:e,instructionsFile:s,fallbackWindow:l=null,compact:u=!1,statusLineState:y=null,onConfigure:b,compactAction:i=null}){const{lastRequestTokens:a,contextWindow:g}=t;if(b!==void 0&&y!==null&&fk(e,{state:y}))return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:pk(y),children:[o.jsx("span",{className:"meter-label",children:v("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:v("meter.unmeasured")}),o.jsx("button",{className:"link-button",onClick:b,children:v("meter.configure")})]});if(e===null)return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:v("meter.noTokensTitle"),children:[o.jsx("span",{className:"meter-label",children:v("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:v("meter.noTokens")})]});if(!hk(e,t)){const M=gk(s,e,t.compacted===!0),w=dk(e,t,l);return o.jsxs("div",{className:`meter meter-idle${u?" meter-compact":""}`,title:M,children:[o.jsx("span",{className:"meter-label",children:v("meter.label")}),o.jsx("span",{className:`meter-bar${u?" meter-bar-inline":""}`}),o.jsxs("span",{className:"meter-value",children:[v("meter.unmeasured"),w!==null&&o.jsxs("span",{className:"meter-dim",children:[" / ",er(w)]})]})]})}const _=g!==null&&g>0?Math.min(a/g,1):null,h=_===null?"unknown":_>=X1?"danger":_>=Y1?"warn":"ok",k=g===null?"":` / ${er(g)}${t.contextWindowEstimated?"+":""}`,T=mk(e,t);if(u){const M=[t.lastModel===null?null:t.lastModel,T,_===null?v("meter.unknownModelShort"):v("meter.windowPercent",{percent:Math.round(_*100)}),v("meter.output",{tokens:er(t.lastOutputTokens)}),e==="status-line"?v("meter.responses",{count:t.assistantMessages}):v("meter.sessionTotals",{output:er(t.totalOutputTokens),cache:er(t.totalCacheReadTokens),count:t.assistantMessages})].filter(d=>d!==null).join(" · "),w=i!==null&&_!==null&&_>=Q1;return o.jsxs("div",{className:"meter meter-compact",title:M,children:[o.jsx("span",{className:"meter-label",children:v("meter.label")}),_!==null&&o.jsx("span",{className:"meter-bar meter-bar-inline",children:o.jsx("span",{className:`meter-fill meter-fill-${h}`,style:{width:`${_*100}%`}})}),o.jsxs("span",{className:"meter-value",children:[er(a),k.length>0&&o.jsx("span",{className:"meter-dim",children:k})]}),w&&i!==null&&o.jsx("button",{className:"icon-button meter-compact-button",onClick:i.onCompact,disabled:i.blockedReason!==null,title:i.blockedReason??v("meter.compactTitle",{command:i.command}),children:v("meter.compact")})]})}return o.jsxs("div",{className:"meter",children:[o.jsxs("div",{className:"meter-row",children:[o.jsx("span",{className:"meter-label",children:v("meter.label")}),o.jsxs("span",{className:"meter-value",children:[er(a),g!==null&&o.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:T!==null?v("meter.modelWithOrigin",{model:t.lastModel,origin:T}):t.lastModel,children:[" ","/ ",er(g),t.contextWindowEstimated&&"+"]})]})]}),_!==null?o.jsx("div",{className:"meter-bar",title:v("meter.windowPercent",{percent:Math.round(_*100)}),children:o.jsx("div",{className:`meter-fill meter-fill-${h}`,style:{width:`${_*100}%`}})}):o.jsx("div",{className:"meter-note",title:t.lastModel??void 0,children:v("meter.unknownModel")}),o.jsxs("div",{className:"meter-row meter-row-dim",children:[o.jsx("span",{title:v("meter.lastResponseTitle"),children:v("meter.output",{tokens:er(t.lastOutputTokens)})}),o.jsx("span",{title:v("meter.sessionTitle"),children:v("meter.sessionTotals",{output:er(t.totalOutputTokens),cache:er(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const Z1=75,Sa=90,eS=3e4;function tS(t){return t>=Sa?"danger":t>=Z1?"warn":"ok"}function xu(t,e){return t.minutes===e.minutes?t.id.localeCompare(e.id):t.minutes===null?1:e.minutes===null?-1:t.minutes-e.minutes}function nS(t,e){const s=Ub(t,e).sort(xu);if(s.length===0)return null;const l=new Map;for(const g of s){const _=g.minutes===null?`id:${g.id}`:`m:${g.minutes}`,h=l.get(_);(h===void 0||g.usedPercent>h.usedPercent)&&l.set(_,g)}const u=[...l.values()].sort(xu),y=u[0];if(y===void 0)return null;const b=u.find(g=>g.usedPercent>=Sa),i=y.usedPercent<Sa&&b!==void 0?b:y;let a=u.slice(0,2);return a.includes(i)||(a=[y,i]),{shown:a.sort(xu),priorityId:i.id,all:s}}function pv(t){const{minutes:e}=t;return e===null?v("plan.window.quota"):e===zs.fiveHours?v("plan.window.fiveHours"):e===zs.day?v("plan.window.day"):e===zs.week?v("plan.window.week"):Math.abs(e-zs.month)<=zs.day?v("plan.window.month"):e%zs.day===0?v("plan.window.days",{value:e/zs.day}):v("plan.window.hours",{value:Math.max(1,Math.round(e/60))})}function mv(t){const e=t>=100?Math.round(t):Math.min(99,Math.round(t));return dC(e)}function rS(t,e){return t.resetsAt===null?null:Md(t.resetsAt-e)}function sS(t,e){return t-e<1440*60*1e3?Ii(t):t-e<10080*60*1e3?uC(t):`${Rd(t)} ${Ii(t)}`}function iS(t,e){const s=t.all.map(u=>{const y=v("plan.used",{percent:mv(u.usedPercent)}),b=u.resetsAt===null?v("plan.noReset"):v("plan.resetsIn",{time:Md(u.resetsAt-e),at:sS(u.resetsAt,e)});return`${pv(u)}: ${y} · ${b}`}),l=Math.max(...t.all.map(u=>u.observedAt));return s.push(v("plan.observed",{when:qn(l,e)})),s.join(`
|
|
133
|
-
`)}const oS={missing:"plan.setup.missing","other-command":"plan.setup.otherCommand",disabled:"plan.setup.disabled",unreadable:"plan.setup.unreadable"};function lS(t){return t===null?"hidden":t==="active"?"waiting":"configure"}function aS(t){return v(t==="active"?"plan.noDataTitle":oS[t])}function cS({windows:t,setupState:e,onConfigure:s}){const[l,u]=N.useState(()=>Date.now());N.useEffect(()=>{u(Date.now());const b=window.setInterval(()=>u(Date.now()),eS);return()=>window.clearInterval(b)},[t]);const y=nS(t,l);if(y===null){const b=lS(e);return b==="hidden"||e===null||b==="configure"&&s===void 0?null:o.jsxs("div",{className:"meter meter-idle meter-compact plan-meter",title:aS(e),children:[o.jsx("span",{className:"meter-label",children:v("plan.label")}),b==="configure"?o.jsx("button",{className:"link-button",onClick:s,children:v("meter.configure")}):o.jsx("span",{className:"meter-value",children:v("plan.noData")})]})}return o.jsx("div",{className:"meter meter-compact plan-meter",title:iS(y,l),children:y.shown.map(b=>{const i=tS(b.usedPercent),a=rS(b,l),g=b.id===y.priorityId;return o.jsxs("span",{className:`plan-window ${g?"plan-window-priority":"plan-window-extra"}`,children:[o.jsx("span",{className:"meter-label plan-label",children:pv(b)}),o.jsx("span",{className:"meter-bar meter-bar-inline plan-bar",children:o.jsx("span",{className:`meter-fill meter-fill-${i}`,style:{width:`${Math.min(b.usedPercent,100)}%`}})}),o.jsxs("span",{className:"meter-value",children:[o.jsx("span",{className:b.usedPercent>=Sa?"plan-danger":void 0,children:mv(b.usedPercent)}),a!==null&&o.jsxs("span",{className:"meter-dim",children:[" · ",a]})]})]},b.id)})})}const Eu=["s","m","l"],gv="m",uS="agent-workbench.thread-font",dS="agent-workbench.notes-font",hS="s",fS={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function Yp(t){return v(fS[t])}function vv(t){const e=Eu.indexOf(t);return Eu[(e+1)%Eu.length]??gv}function pS(t){return t==="s"||t==="m"||t==="l"?t:null}function xa(t){return v("threadFont.title",{current:Yp(t),next:Yp(vv(t))})}const mS=300,gS=200,vS=2,_S=mS+gS,_v=vS*_S,wS=200;function wv(t){return Math.max(wS,t)}function bS(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=wv(t.clientHeight)}function yS(t,e,s){return t<0&&e<=wv(s)}function kS(t,e){return Math.max(0,e-t)}function CS(t,e){return t===null||e.length===0||e[0]===t?!1:e.includes(t)}const SS=52,xS=10;function ES(t){return t.filter(e=>e.role==="user"&&e.parts.some(s=>s.kind==="text"||s.kind==="image")).map(e=>e.eventId)}function TS(t,e){for(let s=t-1;s>=0;s-=1){const l=e(s);if(l!==null&&l<-8)return s}return null}function LS(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function Xp(t,e){return Math.max(0,t+e-SS)}function NS(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=xS?"give-up":"load"}const RS=1;function MS(t,e){for(const s of t){const l=e(s);if(!(l===null||l.bottom<=RS))return{eventId:s,offset:l.top,lastId:t[t.length-1]??null}}return null}function AS(t,e,s,l){const u=e.indexOf(t.eventId);if(u===-1)return null;for(let y=u;y<e.length;y+=1){const b=e[y],i=b===void 0?null:s(b);if(i!==null)return Math.max(0,l+i.top-(y===u?t.offset:0))}return null}function IS(t,e){if(e===null)return 0;const s=t.lastIndexOf(e);return s===-1?0:t.length-1-s}const bv=80;function jS(t){return t.distanceFromEnd<=bv?!0:t.wasAtEnd&&t.scrollTop>=t.previousScrollTop}const Qp=2,DS=4;function PS(t,e,s,l=DS){const u=e.right-e.left,y=e.bottom-e.top;if(u<=0||y<=0)return 0;const b=t.right-Qp,i=b-u,a=t.top+Qp,g=a+y;return b<=s.left-l||i>=s.right+l||g<=s.top-l||a>=s.bottom+l?0:Math.ceil(b-(s.left-l))}function yv(t,e){return t.questionCards?t.cliOpen?e!==null&&V0(e,t.launchedAt)?"closed":null:"no-cli":"unsupported"}function OS(t,e,s){var y;const l=[...e].filter(([,b])=>b.terminalId===s),u=[];for(let b=t.length-1;b>=0&&l.length>0;b-=1)for(const i of((y=t[b])==null?void 0:y.parts)??[]){if(i.kind!=="question"||i.questions.length!==1)continue;const a=i.questions[0];if(a===void 0)continue;const g=l.findIndex(([,T])=>q0(T.item,a)),[_]=g===-1?[]:l.splice(g,1);if(_===void 0)continue;const[h,k]=_;u.push({liveId:h,toolUseId:i.toolUseId,selections:k.selections,failure:k.failure})}return u}function kv({agents:t,preselected:e,anchor:s,label:l=v("agentMenu.openWith"),onPick:u,onClose:y}){const b=N.useMemo(()=>td(t),[t]),[i,a]=N.useState(()=>kk(b,e)),[g,_]=N.useState(null),h=N.useRef(null),k=N.useRef([]);return N.useLayoutEffect(()=>{const T=h.current;if(T===null)return;const M=s.getBoundingClientRect(),w=T.getBoundingClientRect();_(Fg({left:M.left,top:M.top,bottom:M.bottom},{width:w.width,height:w.height},{width:window.innerWidth,height:window.innerHeight}))},[s]),N.useEffect(()=>{var T;(T=k.current[i])==null||T.focus()},[i,g]),N.useEffect(()=>{const T=d=>{if(!(d.altKey||d.ctrlKey||d.metaKey)){if(d.key==="Escape"){d.preventDefault(),d.stopPropagation(),y(),s.focus();return}if(d.key==="ArrowDown"||d.key==="ArrowUp"){d.preventDefault(),d.stopPropagation(),a(m=>Ck(m,d.key==="ArrowDown"?1:-1,b.length));return}if(d.key==="Enter"){d.preventDefault(),d.stopPropagation();const m=b[i];m!==void 0&&u(m.id);return}d.key==="Tab"&&y()}},M=d=>{var p;const m=d.target;m instanceof Node&&((p=h.current)!=null&&p.contains(m)||s.contains(m))||y()},w=d=>{Hg(d.target,s,h.current)&&y()};return window.addEventListener("keydown",T,!0),document.addEventListener("pointerdown",M,!0),window.addEventListener("scroll",w,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("keydown",T,!0),document.removeEventListener("pointerdown",M,!0),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",y)}},[i,s,b,y,u]),Ad.createPortal(o.jsx("div",{ref:h,className:"agent-menu",role:"menu","aria-label":l,style:g===null?{left:0,top:0,visibility:"hidden"}:{left:`${g.left}px`,top:`${g.top}px`},children:b.map((T,M)=>o.jsxs("button",{ref:w=>{k.current[M]=w},className:`agent-menu-item${M===i?" agent-menu-item-active":""}`,role:"menuitem",tabIndex:M===i?0:-1,onMouseEnter:()=>a(M),onClick:()=>u(T.id),children:[o.jsx("span",{className:"agent-menu-label",children:T.label}),T.version!==null&&o.jsx("span",{className:"agent-menu-version",children:T.version})]},T.id))}),document.body)}function BS(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M2.5 5h11M10.5 2l3 3-3 3M13.5 11h-11M5.5 8l-3 3 3 3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}function Cv({targets:t,className:e,text:s,label:l,blockedReason:u=null,title:y=Nd(),onPick:b}){const[i,a]=N.useState(!1),g=N.useRef(null),_=N.useCallback(()=>a(!1),[]),h=N.useCallback(k=>{a(!1),b(k)},[b]);return t.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:g,className:e,onClick:()=>a(k=>!k),disabled:u!==null,"aria-haspopup":"menu","aria-expanded":i,"aria-label":l,title:u??y,children:s}),i&&g.current!==null&&o.jsx(kv,{agents:t,preselected:null,anchor:g.current,label:v("continue.menuLabel"),onPick:h,onClose:_})]})}function Sv(t){switch(t.notice){case"compacted":return t.detail==="auto"?v("thread.notice.compactedAuto"):v("thread.notice.compacted");case"interrupted":return v("thread.notice.interrupted");case"error":return t.detail.length>0?v("thread.notice.error",{detail:t.detail}):v("thread.notice.errorNoDetail")}}const xv="agent-workbench.locale",Ev="auto";function FS(t){return t==="auto"||Rg(t)?t:null}function Tv(t){const e=t.trim().replace(/_/g,"-").toLowerCase();if(e.length===0)return null;const s=Td.find(y=>y.toLowerCase()===e);if(s!==void 0)return s;const[l="",...u]=e.split("-");return l==="zh"?u.includes("hant")||u.some(b=>b==="tw"||b==="hk"||b==="mo")?null:Tu("zh-CN"):Tu(l==="pt"?"pt-BR":l)}function Tu(t){return Rg(t)?t:null}function Lv(t,e){if(t!=="auto")return t;for(const s of e){const l=Tv(s);if(l!==null)return l}return"en"}function Nv(t,e){for(const s of e)if(Tv(s)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([s]).length>0)return s}catch{}return Ay(t)}let Ea=Ev;const od=new Set;function Id(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function HS(){return Lv("auto",Id())}async function Rv(t){const e=Id(),s=Lv(t,e);await Ag(s,Nv(s,e))}async function US(){Ea=Dt(xv,Ev,FS);try{await Rv(Ea)}catch{await Ag("en",Nv("en",Id()))}document.documentElement.lang=ed(),Mg(()=>{document.documentElement.lang=ed()})}async function $S(t){await Rv(t),Ea=t,Tt(xv,t);for(const e of od)e()}function WS(t){return od.add(t),()=>od.delete(t)}function zS(){return Ea}function Vo(){return N.useSyncExternalStore(Mg,ed)}function qS(){return N.useSyncExternalStore(WS,zS)}const Mv=String.raw`https?:\/\/[^\s<>"'\`]+`,VS=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${Mv})`].join("|")),KS=/^(https?:|mailto:)/i,GS=new RegExp(Mv);function YS(t){const e=GS.exec(t);if(e===null||e.index===void 0)return null;const s=Av(e[0]);return{index:e.index,length:s.length,href:s}}function da(t,e){let s=0;for(const l of t)l===e&&(s+=1);return s}function Av(t){let e=t;for(;;){const s=e.slice(-1);if(s.length===0)return e;if(".,;:!?".includes(s)){e=e.slice(0,-1);continue}if(s===")"&&da(e,"(")<da(e,")")){e=e.slice(0,-1);continue}if(s==="]"&&da(e,"[")<da(e,"]")){e=e.slice(0,-1);continue}return e}}function XS(t){const e=VS.exec(t);if(e===null||e.index===void 0)return null;const s=e[0],l=e.index,u=(b,i=s.length)=>({index:l,length:i,token:b});if(s.startsWith("`"))return u({kind:"code",text:s.slice(1,-1)});if(s.startsWith("**")||s.startsWith("__"))return u({kind:"strong",text:s.slice(2,-2)});if(s.startsWith("~~"))return u({kind:"del",text:s.slice(2,-2)});if(s.startsWith("*"))return u({kind:"em",text:s.slice(1,-1)});if(s.startsWith("[")){const b=s.indexOf("]("),i=s.slice(1,b),a=s.slice(b+2,-1);return KS.test(a)?u({kind:"link",label:i,href:a}):u({kind:"plain",text:s})}const y=Av(s);return u({kind:"link",label:y,href:y},y.length)}function Mo(t,e,s){if(e.length===0)return[t];const l=t.toLowerCase(),u=e.toLowerCase(),y=[];let b=0,i=l.indexOf(u),a=0;for(;i!==-1;)i>b&&y.push(t.slice(b,i)),y.push(o.jsx("mark",{children:t.slice(i,i+e.length)},`${s}-m${a++}`)),b=i+e.length,i=l.indexOf(u,b);return b<t.length&&y.push(t.slice(b)),y}const QS=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function JS(t,e){const s=QS.exec(t);if(s===null)return null;const l=s[2]??"",u=e(l);return u===null?null:{label:s[1]??"",href:l,open:u}}function Pr(t,e,s,l){const u=[];let y=t,b=0;for(;y.length>0;){const i=XS(y);if(i===null){u.push(...Mo(y,e,`${s}-${b++}`));break}i.index>0&&u.push(...Mo(y.slice(0,i.index),e,`${s}-${b++}`));const a=`${s}-i${b++}`,{token:g}=i;switch(g.kind){case"code":{const _=l.code===void 0?null:l.code(g.text);u.push(_===null?o.jsx("code",{children:g.text},a):o.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:_.folder?v("thread.openFolder",{path:g.text}):v("thread.openInFiles",{path:g.text}),onClick:_.open,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),_.open())},children:g.text},a));break}case"strong":u.push(o.jsx("strong",{children:Pr(g.text,e,a,l)},a));break;case"del":u.push(o.jsx("del",{children:Pr(g.text,e,a,l)},a));break;case"em":u.push(o.jsx("em",{children:Pr(g.text,e,a,l)},a));break;case"link":u.push(o.jsx("a",{href:g.href,target:"_blank",rel:"noreferrer noopener",children:Mo(g.label,e,a)},a));break;default:{const _=l.local===void 0?null:JS(g.text,l.local);if(_!==null){u.push(o.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:Mo(_.label,e,a)},a));break}u.push(o.jsx("span",{children:Mo(g.text,e,a)},a));break}}y=y.slice(i.index+i.length)}return u}function ZS({code:t,language:e}){const[s,l]=N.useState(null),[u,y]=N.useState(!1),b=N.useRef(null);N.useEffect(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);const i=()=>{navigator.clipboard.writeText(t).then(()=>{y(!0),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>y(!1),1200)}).catch(()=>y(!1))};return N.useEffect(()=>{let a=!0;return pr(async()=>{const{highlightCode:g}=await import("./highlight-BsYn5BK8.js");return{highlightCode:g}},[]).then(({highlightCode:g})=>{a&&l(g(t,e))}).catch(()=>{a&&l(null)}),()=>{a=!1}},[t,e]),o.jsxs("div",{className:"md-code-wrap",children:[o.jsx("pre",{className:"md-code hljs",children:s===null?o.jsx("code",{children:t}):o.jsx("code",{dangerouslySetInnerHTML:{__html:s}})}),o.jsxs("div",{className:"md-code-tools","data-search-skip":"",children:[e!==null&&o.jsx("span",{className:"md-code-lang",children:e}),o.jsx("button",{className:"md-code-copy",onClick:i,title:v(u?"common.copied":"common.copyCode"),"aria-label":v("common.copyCode"),children:u?"✓":"⧉"})]})]})}const Jp=/^(#{1,6})\s+(.*)$/,Lu=/^\s{0,3}[-*+]\s+(.*)$/,Ao=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,ha=/^>\s?(.*)$/,Nu=/^\s*```(\S*)\s*$/,Zp=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Ru=/^\s*\|.*\|\s*$/,ex=/^\s*\|[\s:|-]+\|\s*$/;function em(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(e=>e.trim())}function jd({text:t,needle:e="",localLink:s,codeLink:l}){var a,g;const u={local:s,code:l},y=t.split(`
|
|
134
|
-
`),b=[];let i=0;for(;i<y.length;){const _=y[i]??"",h=`b${i}`,k=Nu.exec(_);if(k!==null){const w=(k[1]??"").length>0?k[1]:null,d=[];for(i+=1;i<y.length&&!Nu.test(y[i]??"");)d.push(y[i]??""),i+=1;i+=1,b.push({key:h,node:o.jsx(ZS,{code:d.join(`
|
|
135
|
-
`),language:w},h)});continue}if(_.trim().length===0){i+=1;continue}if(Zp.test(_)){b.push({key:h,node:o.jsx("hr",{className:"md-rule"},h)}),i+=1;continue}const T=Jp.exec(_);if(T!==null){const w=Math.min((T[1]??"#").length,6);b.push({key:h,node:o.jsx("p",{className:`md-heading md-h${w}`,children:Pr(T[2]??"",e,h,u)},h)}),i+=1;continue}if(Ru.test(_)&&ex.test(y[i+1]??"")){const w=em(_);i+=2;const d=[];for(;i<y.length&&Ru.test(y[i]??"");)d.push(em(y[i]??"")),i+=1;b.push({key:h,node:o.jsx("div",{className:"md-table-wrap",children:o.jsxs("table",{className:"md-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:w.map((m,p)=>o.jsx("th",{children:Pr(m,e,`${h}-h${p}`,u)},p))})}),o.jsx("tbody",{children:d.map((m,p)=>o.jsx("tr",{children:m.map((f,x)=>o.jsx("td",{children:Pr(f,e,`${h}-${p}-${x}`,u)},x))},p))})]})},h)});continue}if(ha.test(_)){const w=[];for(;i<y.length&&ha.test(y[i]??"");)w.push(((a=ha.exec(y[i]??""))==null?void 0:a[1])??""),i+=1;b.push({key:h,node:o.jsx("blockquote",{className:"md-quote",children:Pr(w.join(`
|
|
136
|
-
`),e,h,u)},h)});continue}if(Lu.test(_)||Ao.test(_)){const w=Ao.test(_),d=w?Number(((g=Ao.exec(_))==null?void 0:g[1])??"1"):1,m=[];for(;i<y.length;){const f=y[i]??"",x=Lu.exec(f),j=Ao.exec(f);if(w&&j!==null)m.push(j[2]??"");else if(!w&&x!==null)m.push(x[1]??"");else if(m.length>0&&/^\s{2,}\S/.test(f)&&x===null&&j===null)m[m.length-1]=`${m[m.length-1]??""} ${f.trim()}`;else break;i+=1}const p=m.map((f,x)=>o.jsx("li",{children:Pr(f,e,`${h}-l${x}`,u)},x));b.push({key:h,node:w?o.jsx("ol",{className:"md-list",start:d===1?void 0:d,children:p},h):o.jsx("ul",{className:"md-list",children:p},h)});continue}const M=[];for(;i<y.length;){const w=y[i]??"";if(w.trim().length===0||Nu.test(w)||Jp.test(w)||Lu.test(w)||Ao.test(w)||ha.test(w)||Zp.test(w)||Ru.test(w))break;M.push(w),i+=1}b.push({key:h,node:o.jsx("p",{className:"md-paragraph",children:Pr(M.join(`
|
|
137
|
-
`),e,h,u)},h)})}return o.jsx("div",{className:"md",children:b.map(_=>_.node)})}const Iv=[{key:"shell",names:["Bash","PowerShell","BashOutput","KillShell","shell_command","bash"],run:"tools.run.shell"},{key:"read",names:["Read","NotebookRead","read"],run:"tools.run.read"},{key:"find",names:["Glob","Grep","LS","grep","glob","list"],run:"tools.run.find"},{key:"edit",names:["Edit","Write","NotebookEdit","MultiEdit","apply_patch","edit","write"],run:"tools.run.edit"},{key:"web",names:["WebSearch","WebFetch","ToolSearch","webfetch","websearch","codesearch"],run:"tools.run.web"},{key:"agent",names:["Task","Agent","task"],run:"tools.run.agent"},{key:"todo",names:["TodoWrite","update_plan","todowrite","todoread"],run:"tools.run.todo"}];function Mu(t){const e=Iv.find(s=>s.names.includes(t));return e===void 0?{key:`name:${t}`,known:!1}:{key:e.key,known:!0}}function tx(t,e,s){const l=Iv.find(u=>u.key===t);return l===void 0?v("tools.run.callsTo",{count:e,name:s}):v(l.run,{count:e})}const Au={model:null,effort:null,contextWindow:null},nx=200,rx=2e4,sx={},ix={},tm=[],nm=[],ox=15e3,lx=2e4;function ld(t,e,s){return`${t}:${s}:${e}`}function ax(t,e){const[s,l]=N.useState([]),[u,y]=N.useState(gu),[b,i]=N.useState(Au),[a,g]=N.useState("waiting"),[_,h]=N.useState(!1),[k,T]=N.useState(!1),[M,w]=N.useState({}),[d,m]=N.useState(null),[p,f]=N.useState(null),[x,j]=N.useState(!1),[E,R]=N.useState(tm),[S,L]=N.useState(nm),[I,P]=N.useState(null),D=N.useRef(new Map),F=N.useRef(new Map),[W,$]=N.useState(!1),Y=N.useRef(null),G=N.useRef(null),[V,B]=N.useState(!1),U=N.useRef(null),H=N.useRef(null),z=N.useCallback(()=>{Y.current=null,G.current!==null&&window.clearTimeout(G.current),G.current=null,$(!1)},[]),Z=N.useCallback(()=>{U.current=null,H.current!==null&&window.clearTimeout(H.current),H.current=null,B(!1)},[]),[ie,_e]=N.useState({}),[ge,Q]=N.useState({}),K=(e===null?void 0:ie[e])??sx,te=(e===null?void 0:ge[e])??ix,ee=N.useRef(new Set),we=N.useRef(new Map),ke=N.useRef(new Set),Ae=N.useCallback((be,je,pe)=>{Q(Xe=>({...Xe,[be]:{...Xe[be]??{},[je]:pe}}))},[]),Me=N.useCallback(be=>{Q(je=>{let pe=!1;const Xe={};for(const[$e,He]of Object.entries(je))if(be in He){const Pe={...He};delete Pe[be],Xe[$e]=Pe,pe=!0}else Xe[$e]=He;return pe?Xe:je})},[]),Je=N.useCallback((be,je)=>{Q(pe=>{const Xe=pe[be];if(Xe===void 0||!(je in Xe))return pe;const $e={...Xe};return delete $e[je],{...pe,[be]:$e}})},[]),it=N.useCallback((be,je,pe)=>{const Xe=we.current.get(je);Xe!==void 0&&window.clearTimeout(Xe);const $e=window.setTimeout(()=>{we.current.delete(je),!ke.current.has(je)&&(pe&&D.current.get(be)!==je||(_e(He=>{const Pe=He[be];if(Pe===void 0||!(je in Pe))return He;const re={...Pe};return delete re[je],{...He,[be]:re}}),Ae(be,je,v("conversation.answerUnconfirmed"))))},rx);we.current.set(je,$e)},[Ae]);N.useEffect(()=>{for(const be of s)for(const je of be.parts){if(je.kind!=="tool-result")continue;ke.current.add(je.toolUseId);const pe=we.current.get(je.toolUseId);pe!==void 0&&(window.clearTimeout(pe),we.current.delete(je.toolUseId)),Me(je.toolUseId)}},[s,Me]),N.useEffect(()=>{if(!(e===null||F.current.size===0))for(const{liveId:be,toolUseId:je,selections:pe,failure:Xe}of OS(s,F.current,e))F.current.delete(be),pe!==null&&(_e($e=>{const He=$e[e]??{};return je in He?$e:{...$e,[e]:{...He,[je]:pe}}}),ke.current.has(je)||it(e,je,!1)),Xe!==null&&Ae(e,je,Xe)},[s,e,it,Ae]),N.useEffect(()=>{const be=we.current;return()=>{for(const je of be.values())window.clearTimeout(je);be.clear()}},[]);const Ie=N.useRef(null);N.useEffect(()=>{if(e===null){l([]),y(gu),i(Au),g("waiting"),h(!1),Ie.current=null;return}l([]),y(gu),i(Au),g("waiting"),h(!1),T(!1),w({}),m(null),f(null),j(!1),R(tm),L(nm),P(null),z(),Z(),ee.current.clear(),Ie.current=null;const be=t.onMessage(pe=>{var Xe;if(pe.type==="conversation.reset"||pe.type==="conversation.liveQuestion"){const $e=pe.type==="conversation.reset"?pe.liveQuestion:pe.question;$e===null?D.current.delete(pe.terminalId):D.current.set(pe.terminalId,$e.toolUseId)}switch(pe.type){case"conversation.reset":if(pe.terminalId!==e)break;P(pe.liveQuestion),l(pe.events),y(pe.usage),i(pe.defaults),m(pe.permissionMode),f(pe.waitingFor),j(pe.openToolCall),R(pe.subagents),L(pe.queue),g(pe.state),h(pe.hasMore),T(!1),Ie.current=((Xe=pe.events[0])==null?void 0:Xe.eventId)??null;break;case"conversation.append":{if(pe.terminalId!==e)break;l($e=>{var re;const He=new Set($e.map(fe=>fe.eventId)),Pe=pe.events.filter(fe=>!He.has(fe.eventId));return Pe.length===0?$e:(Ie.current===null&&(Ie.current=((re=Pe[0])==null?void 0:re.eventId)??null),[...$e,...Pe])}),y(pe.usage),pe.permissionMode!==null&&m(pe.permissionMode),pe.queue!==void 0&&L(pe.queue),g("live");break}case"conversation.page":{if(pe.terminalId!==e)break;l($e=>{var re;const He=new Set($e.map(fe=>fe.eventId)),Pe=pe.events.filter(fe=>!He.has(fe.eventId));return Pe.length===0?$e:(Ie.current=((re=Pe[0])==null?void 0:re.eventId)??Ie.current,[...Pe,...$e])}),h(pe.hasMore),T(!1);break}case"conversation.turns":{if(pe.terminalId!==e)break;const $e=new Map(pe.turns.map(He=>[He.eventId,He.durationMs]));l(He=>He.map(Pe=>{const re=$e.get(Pe.eventId);return re===void 0?Pe:{...Pe,durationMs:re}}));break}case"conversation.parts":{if(pe.terminalId!==e)break;const $e=new Map(pe.updates.map(He=>[He.eventId,He.parts]));l(He=>He.map(Pe=>{const re=$e.get(Pe.eventId);return re===void 0?Pe:{...Pe,parts:re}}));break}case"conversation.imageData":{if(pe.terminalId!==e)break;const $e=ld(pe.eventId,pe.index,pe.source);w(He=>({...He,[$e]:pe.data===null?null:`data:${pe.mediaType};base64,${pe.data}`}));break}case"conversation.state":if(pe.terminalId!==e)break;g(pe.state);break;case"conversation.mode":if(pe.terminalId!==e)break;m(pe.mode);break;case"conversation.waiting":if(pe.terminalId!==e)break;f(pe.waitingFor);break;case"conversation.toolCall":if(pe.terminalId!==e)break;j(pe.open);break;case"conversation.subagents":if(pe.terminalId!==e)break;R(pe.subagents);break;case"conversation.queue":if(pe.terminalId!==e)break;L(pe.queue);break;case"conversation.liveQuestion":if(pe.terminalId!==e)break;P(pe.question);break;case"agent.forceSent":pe.requestId===Y.current&&!pe.sent&&z();break;case"agent.queueEdited":pe.requestId===U.current&&Z();break;case"error":{if(pe.requestId!==void 0&&pe.requestId===Y.current){z();break}if(pe.requestId!==void 0&&pe.requestId===U.current){Z();break}if(pe.code!=="answer-failed"||e===null)break;const $e=At(pe.text);for(const[He,Pe]of we.current){window.clearTimeout(Pe),we.current.delete(He),_e(fe=>{const Le=fe[e];if(Le===void 0||!(He in Le))return fe;const Qe={...Le};return delete Qe[He],{...fe,[e]:Qe}}),Ae(e,He,$e);const re=F.current.get(He);re!==void 0&&F.current.set(He,{...re,selections:null,failure:$e})}break}}});t.send({type:"conversation.subscribe",terminalId:e});const je=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:e})});return()=>{be(),je(),t.send({type:"conversation.unsubscribe",terminalId:e})}},[t,e,Ae,z,Z]),N.useEffect(()=>{W&&S.every(be=>be.forced===!0)&&z()},[W,S,z]),N.useEffect(()=>()=>{G.current!==null&&window.clearTimeout(G.current),H.current!==null&&window.clearTimeout(H.current)},[]);const ae=N.useCallback(()=>{if(e===null||Y.current!==null)return;const be=crypto.randomUUID();Y.current=be,$(!0),G.current!==null&&window.clearTimeout(G.current),G.current=window.setTimeout(z,ox),t.send({type:"agent.forceSend",terminalId:e,requestId:be})},[t,e,z]),mt=N.useCallback(()=>{if(e===null||U.current!==null)return;const be=crypto.randomUUID();U.current=be,B(!0),H.current!==null&&window.clearTimeout(H.current),H.current=window.setTimeout(Z,lx),t.send({type:"agent.editQueue",terminalId:e,requestId:be})},[t,e,Z]),De=N.useCallback(()=>{const be=Ie.current;e===null||be===null||k||(T(!0),t.send({type:"conversation.loadMore",terminalId:e,beforeEventId:be,limit:nx}))},[t,e,k]),Fe=N.useCallback((be,je,pe)=>{if(e===null)return;const Xe=ld(be,je,pe);ee.current.has(Xe)||(ee.current.add(Xe),t.send({type:"conversation.image",terminalId:e,eventId:be,index:je,source:pe}))},[t,e]),Ze=N.useCallback((be,je)=>{if(e===null)return;_e(Xe=>{const $e=Xe[e]??{};return be in $e?Xe:{...Xe,[e]:{...$e,[be]:je}}}),Je(e,be);const pe=(I==null?void 0:I.toolUseId)===be?I.questions[0]:void 0;pe!==void 0&&F.current.set(be,{terminalId:e,item:pe,selections:je,failure:null}),t.send({type:"agent.answer",terminalId:e,toolUseId:be,selections:je}),it(e,be,pe!==void 0)},[t,e,Je,I,it]),Se=N.useCallback(be=>{e!==null&&t.send({type:"agent.mode",terminalId:e,mode:be})},[t,e]);return{events:s,usage:u,defaults:b,state:a,permissionMode:d,waitingFor:p,openToolCall:x,subagents:E,queue:S,forceSend:ae,forcing:W,editQueue:mt,editingQueue:V,hasMore:_,loadingMore:k,loadMore:De,images:M,requestImage:Fe,answer:Ze,answered:K,answerFailed:te,setPermissionMode:Se,liveQuestion:I}}function cx(t){return t.role!=="user"||t.parts.some(e=>e.kind==="tool-result"||e.kind==="notice")?!1:t.parts.some(e=>e.kind==="text"||e.kind==="image")}const ux=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function dx(t){try{const s=JSON.parse(t),l=s.file_path??s.notebook_path;if(typeof l=="string"&&l.length>0)return l}catch{}const e=/"(?:file_path|notebook_path)"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(t);if(e===null||e[1]===void 0)return null;try{return JSON.parse(`"${e[1]}"`)}catch{return null}}function hx(t,e){const s=y=>y.replace(/\\/g,"/").replace(/\/+$/,""),l=s(t),u=s(e);return l.length>0&&u.toLowerCase().startsWith(`${l.toLowerCase()}/`)?e.slice(l.length+1):e}function fx(t,e,s){const l=t.findIndex(y=>y.eventId===e);if(l===-1)return[];const u=[];for(const y of t.slice(l))for(const b of y.parts){if(b.kind!=="tool-call"||!ux.has(b.name))continue;const i=dx(b.input);if(i===null)continue;const a=hx(s,i);u.includes(a)||u.push(a)}return u}function px(t,e=6,s=400){if(t===void 0)return"";const l=t.parts.flatMap(b=>b.kind==="text"?[b.text]:[]).join(`
|
|
138
|
-
`).trim();let y=l.split(`
|
|
139
|
-
`).slice(0,e).join(`
|
|
140
|
-
`);return y.length>s&&(y=y.slice(0,s)),y.length<l.length?`${y.trimEnd()}…`:y}function Iu(t){return t.scrollHeight-t.scrollTop-t.clientHeight>bv}const rm=5;function fa(t){return!Array.isArray(t)}function sm(t){const e=[];for(const s of t.parts){if(s.kind!=="tool-call")return null;e.push(s.name)}return e.length>0?e:null}function mx(t){const e=[];let s=0;for(;s<t.length;){const l=t[s];if(l===void 0)break;const u=sm(l),y=u===null?null:Mu(u[0]??"");if(!(u!==null&&y!==null&&u.every(_=>Mu(_).key===y.key))||u===null||y===null){e.push({kind:"card",card:l}),s+=1;continue}const i=[l];let a=u.length,g=s+1;for(;g<t.length;){const _=t[g];if(_===void 0)break;const h=sm(_);if(h===null||!h.every(k=>Mu(k).key===y.key))break;i.push(_),a+=h.length,g+=1}if(a<2){e.push({kind:"card",card:l}),s+=1;continue}e.push({kind:"tools",id:`tools-${l.event.eventId}`,summary:tx(y.key,a,u[0]??""),at:l.event.at,cards:i}),s=g}return e}function gx(t){switch(t.kind){case"text":return t.text;case"tool-call":return`${t.name} ${t.input}`;case"tool-result":return t.text;case"question":return t.questions.map(e=>`${e.question} ${e.options.map(s=>s.label).join(" ")}`).join(`
|
|
141
|
-
`);case"notice":return Sv(t);case"thinking":case"image":return""}}function im(t,e){const s=[];for(const l of t.parts)if(s.push(gx(l)),l.kind==="tool-call"){const u=e.get(l.toolUseId);u!==void 0&&s.push(u.text)}return s.join(`
|
|
142
|
-
`)}function gs(t,e){if(e.length===0)return o.jsx(o.Fragment,{children:t});const s=t.toLowerCase(),l=e.toLowerCase(),u=[];let y=0,b=s.indexOf(l),i=0;for(;b!==-1;)b>y&&u.push(o.jsx("span",{children:t.slice(y,b)},i++)),u.push(o.jsx("mark",{children:t.slice(b,b+e.length)},i++)),y=b+e.length,b=s.indexOf(l,y);return y<t.length&&u.push(o.jsx("span",{children:t.slice(y)},i++)),o.jsx(o.Fragment,{children:u})}function jv(t,e){const s=[];let l=t,u=0;for(;l.length>0;){const y=YS(l);if(y===null){s.push(o.jsx("span",{children:gs(l,e)},u++));break}y.index>0&&s.push(o.jsx("span",{children:gs(l.slice(0,y.index),e)},u++)),s.push(o.jsx("a",{href:y.href,target:"_blank",rel:"noreferrer noopener",children:gs(y.href,e)},u++)),l=l.slice(y.index+y.length)}return o.jsx(o.Fragment,{children:s})}const Dv=N.createContext(null);function vx({view:t,terminalId:e,onRewind:s,rewindBlocked:l=!1,questionsAnswerable:u,contextWindowSource:y,instructionsFile:b,onGoToCli:i,cliPresence:a,cliLaunchedAt:g,exitCode:_,onWakeCli:h,waking:k,discovering:T=!1,toolCallNotice:M=null,serverClosed:w=null,statusLineState:d=null,onConfigureStatusLine:m,threadFont:p,continueTargets:f=[],continueBlockedReason:x=null,onContinue:j,searchRequest:E=null,onSearchRequestApplied:R,activity:S=null,receipt:L=null,clock:I=null,takeNotice:P,fileLinks:D=null,forceSendAvailable:F=!1,queueEditAvailable:W=!1,planWindows:$=[],planSetupState:Y=null,onConfigurePlanLimits:G,compactAction:V=null,scheduled:B=Ex,onCancelScheduled:U,onSendScheduledNow:H}){const{events:z,usage:Z,defaults:ie,state:_e,waitingFor:ge,subagents:Q,queue:K,forceSend:te,forcing:ee,editQueue:we,editingQueue:ke,hasMore:Ae,loadingMore:Me,loadMore:Je,images:it,requestImage:Ie,answer:ae,answered:mt,answerFailed:De,liveQuestion:Fe}=t,Ze=Vo(),[Se,be]=N.useState(""),[je,pe]=N.useState(0),[Xe,$e]=N.useState(null);N.useEffect(()=>{E!==null&&(be(E.query),R==null||R(E.seq))},[E,R]);const He=N.useRef(null),Pe=N.useRef(new Map),re=N.useRef(!0),[fe,Le]=N.useState(!1),[Qe,at]=N.useState(0),ct=N.useRef(e),wt=N.useRef(new Map),Xt=N.useRef(null),he=N.useRef(P);he.current=P;const[nt,et]=N.useState(!1),dt=N.useRef(null),[de,Ke]=N.useState(!1),[ft,ye]=N.useState(!1),ht=N.useRef(null),Rt=N.useMemo(()=>new Set(K.flatMap(me=>me.eventId===void 0?[]:[me.eventId])),[K]),vt=N.useMemo(()=>Rt.size===0?z:z.filter(me=>!Rt.has(me.eventId)),[z,Rt]),Ye=N.useMemo(()=>ES(vt),[vt]),{cards:ot,results:bt}=N.useMemo(()=>{const me=new Map,Oe=new Set;for(const yt of vt)for(const pt of yt.parts)pt.kind==="tool-result"?me.set(pt.toolUseId,pt):(pt.kind==="tool-call"||pt.kind==="question")&&Oe.add(pt.toolUseId);const lt=[];for(const yt of vt){const pt=yt.parts.filter(Jt=>Jt.kind!=="thinking"&&!(Jt.kind==="tool-result"&&Oe.has(Jt.toolUseId)));pt.length!==0&<.push({event:yt,parts:pt})}return{cards:lt,results:me}},[vt]),un=N.useRef([]);un.current=N.useMemo(()=>ot.map(me=>me.event.eventId),[ot]);const Cn=N.useCallback(me=>{const Oe=me.getBoundingClientRect().top;return lt=>{const yt=Pe.current.get(lt);if(yt===void 0)return null;const pt=yt.getBoundingClientRect();return pt.height<=0?null:{top:pt.top-Oe,bottom:pt.bottom-Oe}}},[]),Or=N.useMemo(()=>mx(ot),[ot,Ze]),Mt=Se.trim(),on=N.useMemo(()=>{if(Mt.length===0)return[];const me=Mt.toLowerCase();return ot.filter(Oe=>im(Oe,bt).toLowerCase().includes(me)).map(Oe=>Oe.event.eventId)},[ot,bt,Mt,Ze]);N.useEffect(()=>{pe(0)},[Mt]);const Oi=N.useMemo(()=>new Set(on),[on]),_r=on[je]??null;N.useEffect(()=>{var me;_r!==null&&((me=Pe.current.get(_r))==null||me.scrollIntoView({block:"center"}))},[_r]);const _s=N.useMemo(()=>({questionCards:u,cliOpen:a==="live",launchedAt:g}),[u,a,g]);N.useLayoutEffect(()=>{var lt,yt;const me=ct.current;ct.current=e;const Oe=He.current;if(me!==null&&me!==e){if(Xt.current===null){const pt=Oe===null||re.current?null:MS(un.current,Cn(Oe));pt===null?wt.current.delete(me):wt.current.set(me,pt)}(lt=he.current)==null||lt.call(he,me)}e!==null&&me!==e&&((yt=he.current)==null?void 0:yt.call(he,e))===!0&&wt.current.delete(e),Xt.current=e===null?null:wt.current.get(e)??null,re.current=!0,Le(!1),at(0),ht.current=null,ye(!1),Ke(!1),et(!1)},[e,Cn]),N.useEffect(()=>()=>{dt.current!==null&&window.clearTimeout(dt.current)},[]);const qt=N.useCallback(()=>{const me=He.current;if(me===null)return;const Oe=Iu(me);Le(Oe),Oe||at(0)},[]),Vn=N.useCallback(me=>{const Oe=me.getBoundingClientRect().top,lt=pt=>{const Jt=Ye[pt],Dn=Jt===void 0?void 0:Pe.current.get(Jt);return Dn===void 0?null:Dn.getBoundingClientRect().top-Oe},yt=TS(Ye.length,lt);return yt===null?null:lt(yt)},[Ye]),wr=N.useCallback(()=>{const me=He.current;me!==null&&Ke(LS({awayFromEnd:Iu(me),ownAbove:Vn(me)!==null,hasMore:Ae}))},[Vn,Ae]),Xs=N.useRef(null),br=N.useRef(0),yr=N.useRef(0);N.useLayoutEffect(()=>{const me=Xs.current,Oe=z.map(yt=>yt.eventId);Xs.current=Oe[0]??null;const lt=He.current;lt===null||!CS(me,Oe)||(lt.scrollTop=kS(br.current,lt.scrollHeight))},[z]),N.useLayoutEffect(()=>{const me=He.current,Oe=Xt.current;if(me!==null&&Oe!==null&&ot.length>0){Xt.current=null;const lt=un.current,yt=Mt.length>0?null:AS(Oe,lt,Cn(me),me.scrollTop);yt!==null&&(me.scrollTop=yt,re.current=!Iu(me),re.current||(at(IS(lt,Oe.lastId)),et(!0),dt.current!==null&&window.clearTimeout(dt.current),dt.current=window.setTimeout(()=>{dt.current=null,et(!1)},_v)))}me!==null&&re.current&&Mt.length===0&&(me.scrollTop=me.scrollHeight),qt()},[ot,K.length,Fe==null?void 0:Fe.toolUseId,B.length,Mt,qt,Cn]);const nr=N.useCallback(()=>{const me=He.current;me===null||!re.current||Mt.length>0||(me.scrollTop=me.scrollHeight,qt())},[Mt,qt]);N.useEffect(()=>{const me=He.current;if(me===null)return;me.addEventListener("load",nr,!0);const Oe=typeof ResizeObserver>"u"?null:new ResizeObserver(nr);return Oe==null||Oe.observe(me),()=>{me.removeEventListener("load",nr,!0),Oe==null||Oe.disconnect()}},[nr]),N.useLayoutEffect(()=>{const me=ht.current,Oe=He.current;if(me===null||Oe===null)return;const lt=Vn(Oe),yt=NS({found:lt!==null,hasMore:Ae,loading:Me,pagesRequested:me.pages});if(yt!=="wait"){if(yt==="load"){me.pages+=1,Je();return}ht.current=null,ye(!1),lt!==null&&(re.current=!1,Oe.scrollTop=Xp(Oe.scrollTop,lt))}},[ot,Ae,Me,ft,Vn,Je]),N.useLayoutEffect(()=>{wr()},[ot,wr]);const Br=N.useRef(null),Fr=N.useRef(null),Hr=N.useRef(new Map),Nt=N.useCallback(()=>{const me=new Map;for(const Oe of[Br.current,Fr.current]){if(Oe===null)continue;const lt=Oe.getBoundingClientRect();for(const yt of[lt.top+1,(lt.top+lt.bottom)/2,lt.bottom-1]){const pt=document.elementsFromPoint(lt.left+1,yt).map(Pn=>Pn.closest(".turn")).find(Pn=>Pn!==null),Jt=(pt==null?void 0:pt.querySelector(":scope > .turn-actions"))??null;if(pt==null||Jt===null)continue;const Dn=PS(pt.getBoundingClientRect(),Jt.getBoundingClientRect(),lt);Dn>0&&me.set(pt,Math.max(me.get(pt)??0,Dn))}}for(const Oe of Hr.current.keys())me.has(Oe)||Oe.style.removeProperty("--turn-actions-shift");for(const[Oe,lt]of me)Hr.current.get(Oe)!==lt&&Oe.style.setProperty("--turn-actions-shift",`${lt}px`);Hr.current=me},[]);N.useLayoutEffect(()=>{const me=He.current;me!==null&&(br.current=me.scrollHeight-me.scrollTop,yr.current=me.scrollTop,Nt())});const Qs=N.useRef(null),rr=N.useCallback(()=>{var Oe;const me=((Oe=z[0])==null?void 0:Oe.eventId)??null;me===null||Qs.current===me||(Qs.current=me,Je())},[z,Je]),Ur=N.useRef(null);N.useEffect(()=>{var yt;const me=((yt=ot[ot.length-1])==null?void 0:yt.event.eventId)??null,Oe=Ur.current;if(Ur.current=me,Oe===null||me===Oe||re.current&&Mt.length===0)return;const lt=ot.findIndex(pt=>pt.event.eventId===Oe);lt!==-1&&at(pt=>pt+(ot.length-1-lt))},[ot,Mt]);const kr=N.useCallback(()=>{const me=He.current;if(me===null)return;re.current=jS({wasAtEnd:re.current,distanceFromEnd:me.scrollHeight-me.scrollTop-me.clientHeight,scrollTop:me.scrollTop,previousScrollTop:yr.current}),qt(),wr(),Nt();const Oe=bS({scrollTop:me.scrollTop,previousScrollTop:yr.current,clientHeight:me.clientHeight,hasMore:Ae,loading:Me,searching:Mt.length>0});yr.current=me.scrollTop,br.current=me.scrollHeight-me.scrollTop,Oe&&rr()},[qt,wr,Nt,Ae,Me,rr,Mt]),Bi=N.useCallback(me=>{const Oe=He.current;Oe===null||!Ae||Me||Mt.length>0||yS(me.deltaY,Oe.scrollTop,Oe.clientHeight)&&rr()},[Ae,Me,rr,Mt]),Js=N.useCallback(()=>{const me=He.current;me!==null&&(me.scrollTop=me.scrollHeight,re.current=!0,Le(!1),at(0),ht.current=null,ye(!1),Ke(!1))},[]),$r=N.useCallback(()=>{const me=He.current;if(me===null)return;const Oe=Vn(me);if(Oe!==null){re.current=!1,me.scrollTop=Xp(me.scrollTop,Oe);return}ht.current===null&&(ht.current={pages:0},ye(!0))},[Vn]),wn=N.useCallback((me,Oe)=>{Oe===null?Pe.current.delete(me):Pe.current.set(me,Oe)},[]),Wr=N.useCallback(me=>{const Oe=im(me,bt);navigator.clipboard.writeText(Oe).then(()=>{$e(me.event.eventId),window.setTimeout(()=>$e(null),1200)}).catch(()=>$e(null))},[bt,Ze]),Qt=me=>{on.length!==0&&pe(Oe=>(Oe+me+on.length)%on.length)};return o.jsx(Dv.Provider,{value:D,children:o.jsxs("div",{className:"conversation-pane",children:[o.jsxs("div",{className:"conversation-search",children:[o.jsx("input",{className:"conversation-search-input",type:"search",placeholder:v("thread.search.placeholder"),value:Se,onChange:me=>be(me.target.value),onKeyDown:me=>{me.key==="Enter"&&Qt(me.shiftKey?-1:1),me.stopPropagation()},spellCheck:!1}),Mt.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:on.length===0?v("thread.search.none"):`${je+1}/${on.length}`}),o.jsx("button",{className:"icon-button",onClick:()=>Qt(-1),disabled:on.length===0,title:v("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>Qt(1),disabled:on.length===0,title:v("thread.search.next"),children:"↓"})]}),o.jsx("span",{className:"conversation-spacer"}),j!==void 0&&o.jsx(Cv,{targets:f,className:"icon-button conversation-continue",text:o.jsxs(o.Fragment,{children:[o.jsx(BS,{}),o.jsx("span",{children:v("thread.continueCli")})]}),label:Nd(),blockedReason:x,onPick:j}),p!==void 0&&o.jsx("button",{className:"icon-button thread-font-button",onClick:p.cycle,title:xa(p.size),"aria-label":xa(p.size),children:o.jsxs("span",{"aria-hidden":"true",children:["a",o.jsx("span",{className:"thread-font-big",children:"A"})]})}),o.jsxs("div",{className:"thread-meters",children:[o.jsx(cS,{windows:$,setupState:Y,onConfigure:G}),o.jsx(J1,{usage:Z,source:y,instructionsFile:b,fallbackWindow:ie.contextWindow,compact:!0,statusLineState:d,onConfigure:m,compactAction:V})]})]}),o.jsxs("div",{className:"conversation-scroll-frame",children:[o.jsxs("div",{className:"conversation-scroll",ref:He,onScroll:kr,onWheel:Bi,children:[Ae&&o.jsxs("button",{className:`conversation-more${Me?" conversation-more-loading":""}`,onClick:Je,disabled:Me,"aria-busy":Me,children:[Me&&o.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),v(Me?"thread.loadingMore":"thread.loadEarlier")]}),ot.length===0&&o.jsxs("p",{className:"conversation-empty",children:[_e==="unavailable"?v("thread.empty.unavailable"):_e==="no-transcript"?Ik():v(_e==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),_e==="waiting"&&T&&o.jsxs(o.Fragment,{children:[o.jsx("br",{}),jk()]})]}),Or.map(me=>{if(me.kind==="card")return o.jsx(om,{card:me.card,results:bt,needle:Mt,isMatch:me.card.event.eventId===_r,copied:Xe===me.card.event.eventId,images:it,onRequestImage:Ie,onCopy:()=>Wr(me.card),onRewind:s,rewindBlocked:l,register:wn,answered:mt,answerFailed:De,questionTab:_s,onAnswer:ae},me.card.event.eventId);const Oe=me.cards.some(lt=>Oi.has(lt.event.eventId));return o.jsx(Nx,{summary:me.summary,at:me.at,open:Oe,children:me.cards.map(lt=>o.jsx(om,{card:lt,results:bt,needle:Mt,isMatch:lt.event.eventId===_r,copied:Xe===lt.event.eventId,images:it,onRequestImage:Ie,onCopy:()=>Wr(lt),onRewind:s,rewindBlocked:l,register:wn,answered:mt,answerFailed:De,questionTab:_s,onAnswer:ae},lt.event.eventId))},me.id)}),a==="live"&&Fe!==null&&o.jsx("article",{className:"turn turn-assistant turn-live-question",children:o.jsx(Pv,{part:Fe,answeredAt:mt[Fe.toolUseId]??null,failure:De[Fe.toolUseId]??null,lock:yv(_s,null),onAnswer:ae,needle:Mt})}),a==="live"&&K.length>0&&o.jsx(xx,{queue:K,canForce:F&&K.some(me=>me.forced!==!0),forceBlocked:ge!==null,forcing:ee,onForce:te,canEdit:W&&K.every(me=>me.forced!==!0),editing:ke,onEdit:we}),B.length>0&&o.jsx(Lx,{messages:B,onCancel:U,onSendNow:H})]}),fe&&(de||ft)&&o.jsx("button",{ref:Br,className:`conversation-jump conversation-jump-own${ft?" is-seeking":""}`,onClick:$r,disabled:ft,"aria-busy":ft,title:v("thread.jumpToOwn"),"aria-label":v("thread.jumpToOwn"),children:o.jsx("span",{"aria-hidden":"true",children:"↑"})}),fe&&o.jsxs("button",{ref:Fr,className:`conversation-jump${Qe>0?" has-unseen":""}${nt?" is-hinting":""}`,onClick:Js,title:Qe>0?v("thread.jumpToEndNew",{count:Qe}):v("thread.jumpToEnd"),"aria-label":Qe>0?v("thread.jumpToEndNew",{count:Qe}):v("thread.jumpToEnd"),children:[o.jsx("span",{"aria-hidden":"true",children:"↓"}),Qe>0&&o.jsx("span",{className:"conversation-jump-count",children:Qe>99?"99+":Qe}),nt&&o.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:Qe>0?v("thread.jumpToEndNew",{count:Qe}):v("thread.jumpToEnd")})]})]}),o.jsx(wx,{live:a==="live"&&w===null,activity:S,waitingFor:ge,receipt:L,events:z,clock:I,subagents:Q}),w!==null&&(w.state==="relaunching"||a==="live")?o.jsx(kx,{text:w.text,relaunching:w.state==="relaunching",onRelaunch:h}):a==="live"?ge===null&&M!==null?o.jsx(Sx,{notice:M,onGoToCli:i}):o.jsx(Cx,{waitingFor:ge,questionsAnswerable:u,liveQuestion:Fe!==null,onGoToCli:i}):o.jsx(yx,{presence:a,exitCode:_,waking:k,onWake:h})]})})}const _x=1e3;function wx({live:t,activity:e,waitingFor:s,receipt:l,events:u,clock:y,subagents:b}){const[,i]=N.useState(0),a=Date.now(),g=l1({live:t,activity:e,waitingFor:s,receipt:l,events:u,clock:y,now:a}),_=t?b:[],h=g!==null||_.length>0;return N.useEffect(()=>{if(!h)return;const k=window.setInterval(()=>i(T=>T+1),_x);return()=>window.clearInterval(k)},[h]),h?o.jsxs("div",{className:"thread-status",children:[g!==null&&o.jsxs("div",{className:`thread-status-row thread-status-${g.kind}`,children:[o.jsx(bx,{kind:g.kind}),o.jsx("span",{className:"thread-status-text",children:a1(g,a)})]}),_.length>0&&o.jsxs("div",{className:"thread-status-row thread-status-subagents",children:[o.jsxs("span",{className:"tab-working thread-status-subagent-mark","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}),o.jsx("span",{className:"thread-status-text",children:c1(_,a)})]})]}):null}function bx({kind:t}){return t==="working"?o.jsxs("span",{className:"tab-working","aria-hidden":"true",children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):t==="sending"?o.jsx("span",{className:"thread-status-sending-dot","aria-hidden":"true"}):o.jsx("span",{className:"thread-status-check","aria-hidden":"true",children:"✓"})}function yx({presence:t,exitCode:e,waking:s,onWake:l}){const u=t==="sleeping"?v("thread.wake.sleeping"):e===null?v("thread.wake.exited"):v("thread.wake.exitedWithCode",{code:e});return o.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[o.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),o.jsx("span",{children:u}),o.jsx("button",{className:"primary-button primary-button-small",onClick:l,disabled:s,children:v(s?"thread.wake.opening":"thread.wake.open")})]})}function kx({text:t,relaunching:e,onRelaunch:s}){return o.jsxs("div",{className:"conversation-waiting conversation-wake",role:"status",children:[o.jsx("span",{className:"conversation-wake-dot","aria-hidden":"true"}),o.jsx("span",{children:t}),o.jsx("button",{className:"primary-button primary-button-small",onClick:s,disabled:e,children:e?Fk():Bk()})]})}function Cx({waitingFor:t,questionsAnswerable:e,liveQuestion:s,onGoToCli:l}){if(t===null)return null;const u=s&&e?v("agent.waiting.question"):Wg(t,e);return o.jsxs("div",{className:"conversation-waiting",role:"status",children:[o.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),o.jsx("span",{children:u}),o.jsx("button",{className:"link-button",onClick:l,children:v("thread.goToCli")})]})}function Sx({notice:t,onGoToCli:e}){return o.jsxs("div",{className:"conversation-waiting",role:"status",children:[o.jsx("span",{className:"conversation-waiting-dot","aria-hidden":"true"}),o.jsx("span",{children:t}),o.jsx("button",{className:"link-button",onClick:e,children:v("thread.goToCli")})]})}function om({card:t,results:e,needle:s,isMatch:l,copied:u,images:y,onRequestImage:b,onCopy:i,onRewind:a,rewindBlocked:g=!1,register:_,answered:h,answerFailed:k,questionTab:T,onAnswer:M}){const{event:w}=t,d=w.role==="user",m=yv(T,w.at),p=f=>{const x=h[f.toolUseId];return x!==void 0?x:e.has(f.toolUseId)?[]:null};return o.jsxs("article",{ref:f=>_(w.eventId,f),className:`turn turn-${w.role}${l?" turn-match":""}`,children:[o.jsxs("div",{className:"turn-actions",children:[o.jsx("button",{className:"icon-button",onClick:i,title:v("thread.copyMessage"),children:u?"✓":"⧉"}),d&&a!==void 0&&cx(w)&&o.jsx("button",{className:"icon-button",onClick:()=>a(w.eventId),disabled:g,title:v(g?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),t.parts.map((f,x)=>o.jsx(Mx,{part:f,eventId:w.eventId,mine:d,result:f.kind==="tool-call"?e.get(f.toolUseId)??null:null,needle:s,images:y,onRequestImage:b,answeredAt:f.kind==="question"?p(f):null,failure:f.kind==="question"?k[f.toolUseId]??null:null,questionLock:m,onAnswer:M},x)),o.jsx(Rx,{event:w,mine:d})]})}function xx({queue:t,canForce:e,forceBlocked:s,forcing:l,onForce:u,canEdit:y,editing:b,onEdit:i}){return o.jsxs("div",{className:"queued-prompts",children:[t.map(a=>o.jsxs("article",{className:`turn turn-user turn-pending${a.forced===!0?" turn-pending-forced":""}`,children:[a.text.length>0&&o.jsx(Dd,{text:a.text,truncated:a.truncated,needle:""}),a.images>0&&o.jsx("div",{className:"turn-pending-images",children:v("thread.queue.images",{count:a.images})}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:v("thread.turn.you")}),a.at>0&&o.jsx("span",{children:Ii(a.at)}),o.jsx("span",{className:"turn-pending-state",title:a.forced===!0?v("thread.queue.forcedTitle"):v("thread.queue.labelTitle"),children:a.forced===!0?v("thread.queue.forced"):v("thread.queue.label")}),y&&o.jsx("button",{className:"queued-edit",onClick:i,disabled:b||l||s,"aria-busy":b,title:s?v("thread.queue.forceBlocked"):v("thread.queue.editTitle",{count:t.length}),children:v(b?"thread.queue.editing":"thread.queue.edit")})]})]},a.id)),e&&o.jsx("div",{className:"queued-prompts-actions",children:o.jsx("button",{className:"queued-force",onClick:u,disabled:l||s||b,"aria-busy":l,title:v(s?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:v(l?"thread.queue.forcing":"thread.queue.forceSend")})})]})}const Ex=[],Tx=3e4;function Lx({messages:t,onCancel:e,onSendNow:s}){const[l,u]=N.useState(()=>Date.now());return N.useEffect(()=>{const y=window.setInterval(()=>u(Date.now()),Tx);return()=>window.clearInterval(y)},[]),o.jsx("div",{className:"scheduled-prompts",children:t.map(y=>{const b=y.state==="failed",i=GC(y);return o.jsxs("article",{className:`turn turn-user turn-pending turn-scheduled${b?" turn-scheduled-failed":""}`,children:[o.jsx(Dd,{text:y.text,truncated:!1,needle:""}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:v("thread.turn.you")}),o.jsx("span",{className:`turn-scheduled-state${b?" is-failed":""}`,role:b?"alert":void 0,children:zC(y,l)}),o.jsxs("span",{className:"turn-scheduled-actions",children:[s!==void 0&&y.state!=="paused"&&o.jsx("button",{className:"queued-edit",onClick:()=>s(y.id),disabled:!i,title:v("scheduled.thread.sendNowTitle"),children:v("scheduled.thread.sendNow")}),e!==void 0&&o.jsx("button",{className:"queued-edit",onClick:()=>e(y.id),disabled:!i,title:v("scheduled.thread.cancelTitle"),children:v("scheduled.thread.cancel")})]})]})]},y.id)})})}function Nx({summary:t,at:e,open:s,children:l}){const u=e>0?Ii(e):"";return o.jsxs("details",{className:"tool-group",open:s,children:[o.jsxs("summary",{className:"tool-group-summary",children:[o.jsx("span",{className:"tool-group-chevron","aria-hidden":"true",children:"▸"}),o.jsx("span",{className:"tool-group-count",children:t}),u.length>0&&o.jsx("span",{className:"tool-group-time",children:u})]}),o.jsx("div",{className:"tool-group-body",children:l})]})}function Rx({event:t,mine:e}){const s=t.at>0?Ii(t.at):"",l=[];return t.durationMs!==null&&l.push(cC(t.durationMs)),t.effort!==null&&l.push(v("thread.turn.effort",{effort:t.effort})),o.jsxs("div",{className:"turn-meta",children:[e&&o.jsx("span",{className:"turn-who",children:v("thread.turn.you")}),s.length>0&&o.jsx("span",{children:s}),t.queued&&o.jsx("span",{className:"turn-queued",title:v("thread.turn.queuedTitle"),children:v("thread.turn.queued")}),l.map(u=>o.jsx("span",{className:"turn-meta-bit",children:u},u))]})}function Mx({part:t,eventId:e,mine:s,result:l,needle:u,images:y,onRequestImage:b,answeredAt:i,failure:a,questionLock:g,onAnswer:_}){const h=N.useContext(Dv);switch(t.kind){case"text":return s?o.jsx(Dd,{text:t.text,truncated:t.truncated,needle:u}):o.jsxs("div",{className:"part-text",children:[o.jsx(jd,{text:t.text,needle:u,codeLink:h==null?void 0:h.code,localLink:h==null?void 0:h.link}),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",v("thread.truncated")]})]});case"image":return o.jsx(Ix,{eventId:e,index:t.index,source:t.source,src:y[ld(e,t.index,t.source)],onRequest:b});case"thinking":return null;case"notice":return o.jsx("div",{className:`turn-notice turn-notice-${t.notice}`,children:gs(Sv(t),u)});case"question":return o.jsx(Pv,{part:t,answeredAt:i,failure:a,lock:g,onAnswer:_,needle:u});case"tool-call":{const k=u.length>0&&`${t.name} ${t.input} ${(l==null?void 0:l.text)??""}`.toLowerCase().includes(u.toLowerCase());return o.jsxs("details",{className:"tool",open:k,children:[o.jsxs("summary",{className:"tool-summary",children:[o.jsx("span",{className:"tool-name",children:t.name}),l!==null&&l.isError&&o.jsx("span",{className:"tool-error",children:v("thread.tool.error")}),l!==null&&l.imageCount>0&&o.jsx("span",{className:"tool-images",children:v("thread.tool.images",{count:l.imageCount})})]}),o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:v("thread.tool.input")}),o.jsxs("pre",{className:"tool-pre",children:[gs(t.input,u),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",v("thread.truncated")]})]})]}),l!==null&&o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:v("thread.tool.result")}),o.jsxs("pre",{className:`tool-pre${l.isError?" tool-pre-error":""}`,children:[l.text.length>0?gs(l.text,u):l.imageCount>0?v("thread.tool.imagesNotSent",{count:l.imageCount}):v("thread.tool.noOutput"),l.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",v("thread.truncated")]})]})]})]})}case"tool-result":return o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:v("thread.tool.orphanResult")}),o.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:gs(t.text,u)})]})}}function Pv({part:t,answeredAt:e,failure:s,lock:l,onAnswer:u,needle:y}){var j;const[b,i]=N.useState(()=>t.questions.map(()=>[])),[a,g]=N.useState(null),[_,h]=N.useState(""),k=e!==null,T=k||l!==null,M=e??b,w=t.questions.length===1&&((j=t.questions[0])==null?void 0:j.multiSelect)===!1,d=M.every(E=>fa(E)?E.text.trim().length>0:E.length>0),m=E=>E===void 0||fa(E)?[]:E,p=(E,R)=>{if(T)return;const S=t.questions[E];if(S!==void 0){if(w){u(t.toolUseId,[[R]]);return}g(L=>L===E?null:L),i(L=>L.map((I,P)=>{if(P!==E)return I;const D=m(I);return S.multiSelect?D.includes(R)?D.filter(F=>F!==R):[...D,R]:[R]}))}},f=E=>{const R=_.trim();if(R.length===0||T)return;const S={kind:"free",text:R};if(w){u(t.toolUseId,[S]);return}i(L=>L.map((I,P)=>P===E?S:I)),g(null),h("")},x=E=>{if(T)return;const R=M[E];h(R!==void 0&&fa(R)?R.text:""),g(E)};return o.jsxs("div",{className:`question${k?" question-done":""}`,children:[t.questions.map((E,R)=>{const S=M[R],L=S!==void 0&&fa(S)?S.text:null;return o.jsxs("div",{className:"question-item",children:[o.jsxs("div",{className:"question-head",children:[E.header.length>0&&o.jsx("span",{className:"question-header",children:E.header}),o.jsx("span",{className:"question-text",children:gs(E.question,y)}),E.multiSelect&&o.jsx("span",{className:"question-hint",children:v("thread.question.multi")})]}),o.jsxs("div",{className:"question-options",children:[E.options.map((I,P)=>{const D=m(S).includes(P);return o.jsxs("button",{type:"button",className:`question-option${D?" question-option-picked":""}`,disabled:T,onClick:()=>p(R,P),children:[o.jsx("span",{className:"question-option-label",children:I.label}),I.description.length>0&&o.jsx("span",{className:"question-option-desc",children:I.description})]},P)}),a===R&&!T?o.jsxs("div",{className:"question-write",children:[o.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:v("thread.question.placeholder"),onChange:I=>h(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),f(R)),I.key==="Escape"&&g(null),I.stopPropagation()}}),o.jsxs("div",{className:"question-write-actions",children:[o.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>f(R),children:v(w?"thread.question.send":"thread.question.useText")}),o.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>g(null),children:v("common.cancel")})]})]}):o.jsxs("button",{type:"button",className:`question-option question-option-write${L!==null?" question-option-picked":""}`,disabled:T,onClick:()=>x(R),children:[o.jsx("span",{className:"question-option-label",children:L!==null?L:v("thread.question.writeOther")}),L===null&&o.jsx("span",{className:"question-option-desc",children:v("thread.question.writeOtherHint")})]})]})]},R)}),o.jsxs("div",{className:"question-foot",children:[s!==null&&l===null&&o.jsx("span",{className:"question-failed",children:s}),k?o.jsx("span",{className:"question-sent",children:v("thread.question.answered")}):l==="unsupported"?o.jsx("span",{className:"question-note",children:v("thread.question.answerInCli")}):l==="no-cli"?o.jsx("span",{className:"question-note",children:v("thread.question.noCli")}):l==="closed"?o.jsx("span",{className:"question-note",children:v("thread.question.closed")}):o.jsxs(o.Fragment,{children:[!w&&o.jsx("button",{type:"button",className:"question-send",disabled:!d,onClick:()=>u(t.toolUseId,b),children:v("thread.question.sendAnswers")}),o.jsx("span",{className:"question-note",children:v(w?"thread.question.pickOne":"thread.question.pickEach")})]})]})]})}function Dd({text:t,truncated:e,needle:s}){const l=tC(t,e),u=l.length===1?l[0]:void 0;if(u!==void 0&&u.kind==="text")return o.jsx(lm,{text:t,truncated:e,needle:s});const y=l.length-1;return o.jsx("div",{className:"part-own",children:l.map((b,i)=>b.kind==="text"?o.jsx(lm,{text:b.text,truncated:e&&i===y,needle:s},i):o.jsx(Ax,{number:b.number,text:b.text,complete:b.complete,needle:s},i))})}function Ax({number:t,text:e,complete:s,needle:l}){const[u,y]=N.useState(!1),b=l.length>0&&e.toLowerCase().includes(l.toLowerCase()),i=u||b;return o.jsxs("div",{className:`thread-pasted${i?" thread-pasted-open":""}`,children:[o.jsxs("button",{className:"thread-pasted-toggle",onClick:()=>y(a=>!a),"aria-expanded":i,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),v("thread.pasted",{number:t,count:Bo(e)}),!s&&o.jsxs("span",{className:"part-truncated",children:[" ",v("thread.truncated")]}),o.jsx("span",{className:"chip-chevron",children:i?"▾":"▸"})]}),i&&o.jsx("div",{className:"thread-pasted-text part-mine",children:jv(e,l)})]})}function lm({text:t,truncated:e,needle:s}){const[l,u]=N.useState(!1),y=t.split(`
|
|
143
|
-
`),b=s.length>0&&t.toLowerCase().includes(s.toLowerCase()),i=y.length>=rm&&!b,a=i&&!l?y.slice(0,rm-1).join(`
|
|
144
|
-
`):t;return o.jsxs("div",{className:"part-text part-mine",children:[jv(a,s),e&&o.jsxs("span",{className:"part-truncated",children:[" ",v("thread.truncated")]}),i&&o.jsx("button",{className:"fold-toggle",onClick:()=>u(g=>!g),children:l?v("thread.fold.less"):v("thread.fold.more",{count:y.length})})]})}function Ix({eventId:t,index:e,source:s,src:l,onRequest:u}){const[y,b]=N.useState(!1);return N.useEffect(()=>{l===void 0&&u(t,e,s)},[l,t,e,s,u]),l===void 0?o.jsx("div",{className:"conversation-image-placeholder",children:v("thread.image.loading")}):l===null?o.jsx("div",{className:"conversation-image-placeholder",children:v("thread.image.gone")}):o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"conversation-image",src:l,alt:v("thread.image.alt"),onClick:()=>b(!0),title:v("thread.image.openTitle")}),y&&o.jsx(Qg,{src:l,caption:v("thread.image.alt"),onClose:()=>b(!1)})]})}function am({connection:t,title:e,confirmLabel:s,confirmTitle:l,onChoose:u,onClose:y}){const[b,i]=N.useState(null),[a,g]=N.useState(null),[_,h]=N.useState(!1),[k,T]=N.useState(""),M=N.useRef(null),w=N.useRef(null);N.useEffect(()=>{const f=t.onMessage(x=>{if(x.type==="picker.listing"){M.current=x.listing.pickerId,i(x.listing),g(null),h(!1),T("");return}x.type==="error"&&x.code==="picker-failed"&&g(At(x.text))});return t.send({type:"picker.open"}),()=>{f();const x=M.current;x!==null&&t.send({type:"picker.close",pickerId:x})}},[t]),N.useEffect(()=>{const f=x=>{x.key==="Escape"&&(x.preventDefault(),x.stopPropagation(),y())};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[y]),N.useEffect(()=>{var f;_&&((f=w.current)==null||f.focus())},[_]);const d=N.useCallback(f=>{const x=M.current;x!==null&&t.send({type:"picker.enter",pickerId:x,name:f})},[t]),m=N.useCallback(f=>{const x=M.current;x!==null&&t.send({type:"picker.root",pickerId:x,rootIndex:f})},[t]),p=N.useCallback(()=>{const f=M.current,x=k.trim();f===null||x.length===0||t.send({type:"picker.create",pickerId:f,name:x})},[t,k]);return o.jsx("div",{className:"modal-backdrop",onClick:y,children:o.jsxs("div",{className:"modal picker-modal",role:"dialog","aria-label":e,onClick:f=>f.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:e}),o.jsx("button",{className:"icon-button",onClick:y,title:v("common.close"),children:"×"})]}),b===null?o.jsx("p",{className:"panel-note",children:v("picker.loading")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"picker-roots",children:b.roots.map((f,x)=>o.jsx("button",{className:"picker-root",onClick:()=>m(x),title:v("picker.goTo",{root:f}),children:f},f))}),o.jsx("p",{className:"picker-path",title:b.path,children:b.path}),o.jsxs("div",{className:"picker-list",children:[b.canGoUp&&o.jsxs("button",{className:"picker-entry picker-up",onClick:()=>d(".."),children:["‹ ",v("picker.up")]}),b.entries.length===0&&!b.canGoUp&&o.jsx("p",{className:"panel-note",children:v("picker.empty")}),b.entries.map(f=>o.jsx("button",{className:"picker-entry",onClick:()=>d(f),children:f},f)),b.truncated&&o.jsx("p",{className:"panel-note",children:v("picker.truncated")})]}),a!==null&&o.jsx("p",{className:"picker-problem",children:a}),o.jsxs("footer",{className:"picker-footer",children:[_?o.jsxs("div",{className:"picker-create",children:[o.jsx("input",{ref:w,className:"picker-create-input",value:k,placeholder:v("picker.newFolderName"),onChange:f=>T(f.target.value),onKeyDown:f=>{f.key==="Enter"&&p(),f.key==="Escape"&&(f.stopPropagation(),h(!1)),f.stopPropagation()},spellCheck:!1}),o.jsx("button",{className:"primary-button primary-button-small",onClick:p,children:v("picker.create")}),o.jsx("button",{className:"link-button",onClick:()=>h(!1),children:v("common.cancel")})]}):o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>h(!0),children:v("picker.createHere")}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"picker-open",onClick:()=>u(b.pickerId,b.path),title:l(b.path),children:s})]})]})]})})}function jx(t,e){return yd(t)&&e!==null&&e.sessions>0}function Dx(){return v("search.mode.titles")}function Px(){return v("search.mode.conversations")}function Ox(){return v("search.mode.conversationsTitle")}function Bx(t){return v(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function Fx(){return v("search.tooShort",{min:yg})}function Hx(t){return[...t.trim()].length<yg}function Ux(){return v("search.off")}function $x(t){const e=new Map;for(const s of t){const l=`${s.agent}:${s.sessionId}`;let u=e.get(l);u===void 0&&(u={key:l,agent:s.agent,sessionId:s.sessionId,title:s.title,titleHit:null,hits:[],lastAt:null},e.set(l,u)),s.eventId===null?u.titleHit=s:u.hits.push(s),s.at!==null&&(u.lastAt=Math.max(u.lastAt??0,s.at))}return[...e.values()]}const Wx=40;function Ov(t,e=Wx){const s=t.matchStart+t.matchLength;let l=t.snippet.slice(0,t.matchStart);if(l.length>e){let u=l.length-e;const y=l.charCodeAt(u);y>=56320&&y<=57343&&(u+=1),l=`…${l.slice(u)}`}return{before:l,match:t.snippet.slice(t.matchStart,s),after:t.snippet.slice(s)}}function zx(t){return t.role==="user"?v("search.role.user"):t.role==="assistant"?v("search.role.assistant"):v("search.role.title")}function Bv(t){return Ov(t).match.trim()}function qx(t){const e=t.hits[0]??t.titleHit;return e===null?"":Bv(e)}const ad=t=>v("search.sessions",{count:t});function Vx(t,e){return{query:e.query,hits:t===null?[...e.hits]:[...t.hits,...e.hits],sessionsScanned:e.sessionsScanned,sessionsTotal:e.sessionsTotal,truncated:null}}function Kx(t){const{result:e}=t;if(t.searching&&t.error===null){if(e===null)return v("search.status.searching");const l={count:e.sessionsTotal,scanned:e.sessionsScanned};return e.hits.length===0?v("search.status.progress",l):v("search.status.progressFound",{...l,found:cm(e)})}if(t.error!==null)return t.error;if(e===null)return null;const s=e.hits.length===0?v("search.status.none"):cm(e);if(e.truncated===null&&e.hits.length===0&&e.sessionsScanned>0)return v("search.status.noneIn",{sessions:ad(e.sessionsScanned)});if(e.truncated==="results")return v("search.status.truncatedResults",{found:s});if(e.truncated==="time"){const l=Math.max(0,e.sessionsTotal-e.sessionsScanned);return v("search.status.truncatedTime",{found:s,seconds:Math.round($b/1e3),left:ad(l)})}return v("search.status.done",{found:s})}function cm(t){const e=new Set(t.hits.map(s=>`${s.agent}:${s.sessionId}`)).size;return v("search.found",{hits:v("search.hits",{count:t.hits.length}),sessions:ad(e)})}function Gx(t,e){const s=e.terminals.find(l=>l.kind==="agent"&&l.agent===t.agent&&l.sessionId===t.sessionId);if(s!==void 0)return{kind:"activate",terminalId:s.terminalId};for(const l of e.projects){const u=l.sessions.find(y=>y.agent===t.agent&&y.sessionId===t.sessionId);if(u!==void 0)return va(u)&&l.cwdExists&&e.canResume(u.agent)?{kind:"resume",cwd:Eg(u.cwd,l.cwd,e.platform),session:u}:{kind:"copy"}}return{kind:"copy"}}const Yx=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function cn(t,e,s){const l=Ig(t,e),u=[];let y=0;for(const b of l.matchAll(Yx)){const i=b.index??0;i>y&&u.push(ga(l.slice(y,i),e));const a=b[1];if(a===void 0)u.push(N.createElement("br",{key:u.length}));else{const g=ga(b[2]??"",e);u.push(N.createElement(a,{key:u.length},g))}y=i+b[0].length}return y<l.length&&u.push(ga(l.slice(y),e)),u.length===1?u[0]:u}const um="0.9.0",dm="agent-workbench.support-notice",Xx=3e4;function Qx(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function Jx(t,e){return t!==e}function Zx(){return[{keys:"Alt + T",description:v("shortcuts.app.newTab")},{keys:"Alt + W",description:v("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:v("shortcuts.app.switchTab")},{keys:"Alt + P",description:v("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:v("shortcuts.app.previousTab")}]}function eE({agent:t,onClose:e}){return N.useEffect(()=>{const s=l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[e]),o.jsx("div",{className:"modal-backdrop",onClick:e,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":v("shortcuts.ariaLabel"),onClick:s=>s.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:v("shortcuts.title")}),o.jsx("button",{className:"icon-button",onClick:e,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("h3",{className:"modal-section",children:v("shortcuts.section.app")}),o.jsx(ju,{shortcuts:Zx()}),o.jsx("h3",{className:"modal-section",children:v("shortcuts.section.composer")}),o.jsx(ju,{shortcuts:uk(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("shortcuts.section.cli")}),o.jsx("p",{className:"modal-hint",children:cn("shortcuts.cliHint")}),o.jsx(ju,{shortcuts:vs[t.id].shortcuts}),vs[t.id].shortcutsNote!==null&&o.jsx("p",{className:"modal-hint",children:vs[t.id].shortcutsNote})]}),o.jsx("p",{className:"modal-hint",children:cn("shortcuts.browserReserved")}),o.jsx("p",{className:"modal-hint",children:cn("shortcuts.altNumber")}),o.jsxs("p",{className:"modal-hint support-hint",children:[o.jsx("span",{"aria-hidden":"true",children:"☕"})," ",v("support.notice")," ",o.jsx("a",{href:Tg,target:"_blank",rel:"noreferrer noopener",children:v("support.link")})]})]})]})})}function ju({shortcuts:t}){return o.jsx("dl",{className:"shortcut-list",children:t.map(e=>o.jsxs("div",{className:"shortcut-row",children:[o.jsx("dt",{children:o.jsx("kbd",{children:e.keys})}),o.jsx("dd",{children:e.description})]},e.keys))})}const tE=1e3,nE=5e3;function hm({info:t,agentLabel:e,purpose:s="status",onRefresh:l,onClose:u}){const[y,b]=N.useState(null),[i,a]=N.useState(!1),g=N.useRef(null),_=N.useRef(null);N.useEffect(()=>{const m=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),u())};return window.addEventListener("keydown",m,!0),()=>window.removeEventListener("keydown",m,!0)},[u]),N.useEffect(()=>{a(!1)},[t]),N.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current),_.current!==null&&window.clearTimeout(_.current)},[]);const h=(m,p)=>{navigator.clipboard.writeText(p).then(()=>{b(m),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(null),tE)}).catch(()=>b(null))},k=()=>{a(!0),l(),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>a(!1),nE)},T=t.state==="active",M=v("statusLine.title",{agent:e}),w=s==="plan-limits",d=ik(t,e);return o.jsx("div",{className:"modal-backdrop",onClick:u,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":M,onClick:m=>m.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:M}),o.jsx("button",{className:"icon-button",onClick:u,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${T?" status-line-state-active":""}`,children:rk(t.state)}),o.jsx("p",{className:"modal-hint",children:v(w?"statusLine.planBenefit":"statusLine.benefit")}),w&&o.jsx("p",{className:"modal-hint",children:v("statusLine.planReplaces")}),o.jsx("h3",{className:"modal-section",children:v("statusLine.lineSection")}),t.fragment===null?o.jsx("p",{className:"modal-hint",children:w?v("statusLine.planNoFragment"):sk()}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:cn("statusLine.mergeHint")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:t.fragment}),o.jsx("button",{className:"link-button",onClick:()=>h("line",t.fragment??""),title:v("statusLine.copyTitle"),children:y==="line"?o.jsxs(o.Fragment,{children:["✓ ",v("statusLine.copied")]}):v("statusLine.copy")})]}),d!==null&&o.jsx("p",{className:"modal-hint",children:o.jsx("button",{className:"link-button",onClick:()=>h("prompt",d),title:v("statusLine.copyPromptTitle"),children:y==="prompt"?o.jsxs(o.Fragment,{children:["✓ ",v("statusLine.promptCopied")]}):v("statusLine.copyPrompt")})})]}),o.jsx("h3",{className:"modal-section",children:v("statusLine.whereSection")}),o.jsx("p",{className:"status-line-path",children:t.settingsPath}),o.jsx("p",{className:"modal-hint",children:v("statusLine.whereHint")}),o.jsx("h3",{className:"modal-section",children:v("statusLine.scriptSection")}),o.jsx("p",{className:"modal-hint",children:v(w?"statusLine.planScriptHint":"statusLine.scriptHint")}),o.jsx("p",{className:"status-line-path",children:t.scriptPath}),o.jsx("p",{className:"modal-hint",children:cn("statusLine.runsEverywhere")}),o.jsxs("div",{className:"status-line-actions",children:[o.jsx("button",{className:"primary-button",onClick:k,disabled:i,children:v(i?"statusLine.checking":"statusLine.check")}),o.jsx("span",{className:"modal-hint",children:v("statusLine.checkHint")})]})]})]})})}function rE(){const[t,e]=N.useState(()=>Jx(Dt(dm,null,Qx),um));return N.useEffect(()=>{if(!t)return;Tt(dm,um);const s=window.setTimeout(()=>e(!1),Xx);return()=>window.clearTimeout(s)},[t]),t?o.jsxs("div",{className:"banner banner-support",role:"status",children:[o.jsx("span",{children:v("support.notice")}),o.jsx("a",{className:"banner-support-link",href:Tg,target:"_blank",rel:"noreferrer noopener",onClick:()=>e(!1),children:v("support.link")}),o.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>e(!1),children:v("support.dismiss")})]}):null}function cd({agent:t,agents:e}){return o.jsx("span",{className:"agent-badge",title:zo(t,e),children:Wy(t)})}function ud(){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),o.jsx("circle",{cx:"6",cy:"19",r:"2.2"}),o.jsx("circle",{cx:"18",cy:"7",r:"2.2"}),o.jsx("path",{d:"M6 7.2v9.6"}),o.jsx("path",{d:"M18 9.2c0 4.3-5.5 4-10.4 7.8"})]})}const sE=500,fm=10;function iE(t){const e=N.useRef(null),s=N.useRef(null),l=N.useRef(!1),u=N.useRef(t);u.current=t;const y=N.useCallback(()=>{e.current!==null&&window.clearTimeout(e.current),e.current=null,s.current=null},[]),b=N.useCallback(_=>{_.pointerType==="mouse"||_.button!==0||(y(),l.current=!1,s.current={x:_.clientX,y:_.clientY},e.current=window.setTimeout(()=>{e.current=null,l.current=!0,u.current()},sE))},[y]),i=N.useCallback(_=>{const h=s.current;h!==null&&(Math.abs(_.clientX-h.x)>fm||Math.abs(_.clientY-h.y)>fm)&&y()},[y]),a=N.useCallback(_=>{(l.current||e.current!==null)&&_.preventDefault()},[]),g=N.useCallback(_=>{l.current&&(l.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:b,onPointerMove:i,onPointerUp:y,onPointerCancel:y,onContextMenu:a,onClickCapture:g}}function oE({onLongPress:t,...e}){const s=iE(t);return o.jsx("button",{...e,...s})}function Pd({className:t,text:e,title:s,disabled:l,offerAgentChoice:u,agents:y,agent:b,onOpen:i}){var M;const[a,g]=N.useState(!1),_=N.useRef(null),h=N.useCallback(()=>g(!1),[]),k=N.useCallback(w=>{g(!1),i(w)},[i]);if(!u)return o.jsx("button",{className:t,onClick:()=>i(),disabled:l,title:s,children:e});const T=((M=y.find(w=>w.id===b))==null?void 0:M.label)??null;return o.jsxs("span",{className:"split-button",children:[o.jsx("button",{className:`${t} split-button-main`,onClick:()=>i(b??void 0),disabled:l,title:T===null?s:v("agentMenu.titleWithAgent",{title:s,label:T}),children:e}),o.jsx("button",{ref:_,className:`${t} split-button-arrow`,onClick:()=>g(w=>!w),disabled:l,"aria-haspopup":"menu","aria-expanded":a,title:v("agentMenu.chooseTitle"),children:"▾"}),a&&_.current!==null&&o.jsx(kv,{agents:y,preselected:b,anchor:_.current,onPick:k,onClose:h})]})}function lE(t){const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()}function Fv(t,e,s,l){const u=new Set;for(const y of t)for(const b of y.sessions)b.agent===e&&(b.archived||b.updatedAt<s&&(l.has(b.sessionId)||u.add(b.sessionId)));return[...u]}function aE(t,e,s,l){const u=[];for(const i of t)for(const a of i.sessions)u.includes(a.agent)||u.push(a.agent);const y=l,b=i=>{const a=y.indexOf(i);return a===-1?l.length:a};return u.sort((i,a)=>b(i)-b(a)).map(i=>({agent:i,count:Fv(t,i,e,s).length})).filter(i=>i.count>0)}function Hv(t,e){const s=new Set;let l=0;for(const u of t.sessions)if(!u.archived){if(e.has(u.sessionId)){l+=1;continue}s.add(u.sessionId)}return{sessionIds:[...s],blocked:l}}function cE(t){const{sessionIds:e,blocked:s}=t;if(e.length===0)return v("archive.allBlocked",{count:s});const l=v("archive.confirm",{count:e.length});return s===0?l:v("archive.withBlocked",{confirm:l,blocked:v("archive.blockedStays",{count:s})})}const pm=12;function uE(t){let e=2166136261;for(let s=0;s<t.length;s+=1)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0}function Ys(t){const e=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${uE(e)%pm*(360/pm)} var(--project-color-s) var(--project-color-l))`}function ji(){return v("vault.name")}function dE(){return v("vault.privacy")}function hE(){return v("vault.archived")}function fE(){return v("vault.mark.copy")}function mm(){return v("vault.mark.copyTitle")}function pE(){return v("vault.mark.partial")}function mE(){return v("vault.mark.partialTitle")}function Uv(t){return v("vault.sessions",{count:t})}function Od(t){return t==="measuring"||t==="writing"||t==="moving"}function gE(t){const e=t.progress;switch(t.state){case"measuring":return e===null?v("vault.state.measuring"):v("vault.state.measuringProgress",{done:e.done,total:e.total});case"writing":return e===null?v("vault.state.writing"):v("vault.state.writingProgress",{done:e.done,total:e.total});case"moving":return v("vault.state.moving");default:return t.enabled?v("vault.state.on"):v("vault.state.off")}}function vE(t){if(t===null||!t.enabled)return null;const e=[ji(),Uv(t.sessions)];return t.state==="writing"?e.push(t.progress===null?v("vault.line.copying"):v("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?e.push(v("vault.line.moving")):t.state==="measuring"?e.push(v("vault.line.measuring")):e.push(t.lastPassAt===null?v("vault.line.neverCopied"):qn(t.lastPassAt)),t.pending>0&&e.push(v("vault.line.pending",{count:t.pending})),e.join(" · ")}function _E(t){return t===null?ji():t.enabled?v("vault.button.on"):v("vault.button.off")}function wE(t){return t.enabled?"enabled":Od(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function bE(t,e){return Od(t.state)?v("vault.busy"):e?null:v("vault.indexNotReady")}function yE(t){return Od(t.state)?v("vault.busy"):null}function kE(t){return v("vault.previousDir",{dir:t})}function CE(t){const e=[];return t.skippedEmpty>0&&e.push(v("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&e.push(v("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&e.push(t.failureReasons.length>0?v("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(At).join("; ")}):v("vault.note.failed",{count:t.failed})),e.length===0?null:v("vault.note.notCopied",{parts:e.join(" · ")})}function SE(t,e){const s=t.byAgent.map(y=>({agent:y.agent,label:zo(y.agent,e),sessions:y.sessions,bytes:y.eventBytes+y.imageBytes,images:y.images,imageBytes:y.imageBytes,skippedArchived:y.skippedArchived,note:CE(y)})),l=s.reduce((y,b)=>({sessions:y.sessions+b.sessions,bytes:y.bytes+b.bytes,images:y.images+b.images,skippedArchived:y.skippedArchived+b.skippedArchived}),{sessions:0,bytes:t.memoryBytes,images:0,skippedArchived:0}),u=qn(t.measuredAt);return{rows:s,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:l,summary:u.length>0?v("vault.measure.summary",{when:u,duration:Fo(t.durationMs)}):v("vault.measure.summaryNoWhen",{duration:Fo(t.durationMs)})}}function xE(t){const e=t.storage==="vault";return{copy:e,partial:e&&t.partial}}function EE(t){switch(t){case"exporting":return v("vault.export.exporting");case"done":return v("vault.export.done");default:return v("vault.export.idle")}}const TE=1e3;function gm({hit:t}){const{before:e,match:s,after:l}=Ov(t);return o.jsxs(o.Fragment,{children:[e,o.jsx("mark",{children:s}),l]})}function LE({project:t,openSessionIds:e,onConfirm:s,onCancel:l}){const u=Hv(t,e);return o.jsxs("div",{className:"project-archive-confirm",role:"group",children:[o.jsx("span",{className:"archive-history-text",children:cE(u)}),u.sessionIds.length>0&&o.jsx("button",{className:"link-button",onClick:s,children:v("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:l,children:u.sessionIds.length>0?v("common.cancel"):v("common.close")})]})}function Du(t){if(t.cwd.length===0)return t.fallbackName;const e=t.cwd.split(/[\\/]/).filter(s=>s.length>0);return e[e.length-1]??t.cwd}function vm({out:t}){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"2.5",y:"3.5",width:"19",height:"5",rx:"1.2"}),o.jsx("path",{d:"M4.5 8.5v10a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-10"}),t?o.jsx("path",{d:"M12 18.5v-6M9.2 15.3 12 12.5l2.8 2.8"}):o.jsx("path",{d:"M10 12.5h4"})]})}function NE(){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M8 6.5V4.5a1.5 1.5 0 0 1 1.5-1.5h9A1.5 1.5 0 0 1 20 4.5v11a1.5 1.5 0 0 1-1.5 1.5H17"}),o.jsx("rect",{x:"4",y:"7",width:"12",height:"14",rx:"1.5"}),o.jsx("path",{d:"M7.5 12h5M7.5 15.5h5"})]})}function RE({done:t}){return o.jsx("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t?o.jsx("path",{d:"M5 12.5l4.5 4.5L19 7.5"}):o.jsxs(o.Fragment,{children:[o.jsx("path",{d:"M14 3H7a1.5 1.5 0 0 0-1.5 1.5v15A1.5 1.5 0 0 0 7 21h10a1.5 1.5 0 0 0 1.5-1.5V7.5z"}),o.jsx("path",{d:"M12 10.5v6.5M9.2 14.2 12 17l2.8-2.8"})]})})}function ME({candidates:t,agents:e,onArchiveAgent:s,onClose:l,anchorRef:u}){const[y,b]=N.useState(null),i=N.useRef(null);return N.useEffect(()=>{const a=h=>{var k,T;return h instanceof Node&&(((k=i.current)==null?void 0:k.contains(h))===!0||((T=u.current)==null?void 0:T.contains(h))===!0)},g=h=>{h.key!=="Escape"||!a(document.activeElement)||(h.preventDefault(),h.stopPropagation(),l())},_=h=>{a(h.target)||l()};return window.addEventListener("keydown",g,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",g,!0),document.removeEventListener("pointerdown",_,!0)}},[u,l]),o.jsxs("div",{ref:i,className:"archive-history",role:"region","aria-label":v("sidebar.history.region"),children:[o.jsxs("div",{className:"archive-history-header",children:[o.jsx("span",{children:v("sidebar.history.heading")}),o.jsx("button",{className:"icon-button",onClick:l,title:v("common.closeEsc"),children:"×"})]}),t.map(({agent:a,count:g})=>{const _=zo(a,e);return y===a?o.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[o.jsx("span",{className:"archive-history-text",children:v("sidebar.history.confirm",{count:g,label:_})}),o.jsx("button",{className:"link-button",onClick:()=>s(a),children:v("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:()=>b(null),children:v("common.cancel")})]},a):o.jsxs("div",{className:"archive-history-row",children:[o.jsxs("span",{className:"archive-history-text",children:[o.jsx("span",{className:"archive-history-agent",children:_}),o.jsx("span",{className:"archive-history-count",children:v("sidebar.history.count",{count:g})})]}),o.jsx("button",{className:"link-button",onClick:()=>b(a),children:v("sidebar.action.archive")})]},a)})]})}function AE({projects:t,indexStatus:e,disabled:s,openSessionIds:l,openBlocked:u,onOpenProject:y,agents:b,offerAgentChoice:i,agentForProject:a,onOpenSession:g,canResume:_,platform:h,onRefresh:k,onArchive:T,onHide:M,width:w,onNewProject:d,vault:m,onOpenVault:p,onOpenVaultSession:f,onExportProject:x,exporting:j,lastExported:E,onContinueSession:R,globalSearch:S,onOpenSearchHit:L,onNewWorktree:I,onReopenWorktree:P}){const[D,F]=N.useState(new Set),[W,$]=N.useState(null);N.useEffect(()=>{const he=E===null?0:E.at+TE-Date.now();if(E===null||he<=0)return;$(E.projectKey);const nt=window.setTimeout(()=>$(null),he);return()=>window.clearTimeout(nt)},[E]);const Y=he=>j.has(he)?"exporting":W===he?"done":"idle",G=vE(m),[V,B]=N.useState(""),[U,H]=N.useState(!1),[z,Z]=N.useState(new Set),[ie,_e]=N.useState("titles"),ge=S===null?"titles":ie,[Q,K]=N.useState(!1),te=S!==null&&ge==="conversations"&&V.trim().length>0&&(Q||S.submitted!==null),ee=(S==null?void 0:S.result)??null,we=N.useMemo(()=>te&&ee!==null?$x(ee.hits):[],[te,ee]),ke=he=>{_e(he),K(!1),S==null||S.clear()},Ae=()=>{if(S!==null){if(Hx(V)){K(!0),S.clear();return}K(!1),S.search(V.trim(),U)}},Me=(S==null?void 0:S.submitted)??null,Je=S==null?void 0:S.search;N.useEffect(()=>{ge!=="conversations"||Me===null||Je===void 0||Me.includeArchived!==U&&Je(Me.query,U)},[ge,Me,Je,U]);const it=N.useMemo(()=>t.reduce((he,nt)=>he+nt.sessions.filter(et=>et.archived).length,0),[t]),Ie=N.useMemo(()=>{const he=ge==="titles"?V.trim().toLowerCase():"";return t.map(nt=>{const et=U?nt.sessions:nt.sessions.filter(Ke=>!Ke.archived);if(et.length===0)return null;if(he.length===0)return{...nt,sessions:et};if(Du(nt).toLowerCase().includes(he)||nt.cwd.toLowerCase().includes(he))return{...nt,sessions:et};const de=et.filter(Ke=>mr(Ke.title,Ke.titleSource).toLowerCase().includes(he));return de.length>0?{...nt,sessions:de}:null}).filter(nt=>nt!==null)},[t,V,U,ge]),ae=ge==="titles"&&V.trim().length>0,mt=he=>he.archived||!l.has(he.sessionId),[De,Fe]=N.useState(!1),Ze=N.useRef(null),Se=lE(Date.now()),be=N.useMemo(()=>b.map(he=>he.id),[b]),je=N.useMemo(()=>aE(t,Se,l,be),[t,Se,l,be]),[pe,Xe]=N.useState(null);N.useEffect(()=>{je.length===0&&Fe(!1)},[je.length]);const $e=N.useCallback(()=>Fe(!1),[]),He=he=>{const nt=Fv(t,he,Se,l);nt.length>0&&(T(nt,!0),Xe({what:zo(he,b),sessionIds:nt})),Fe(!1)},[Pe,re]=N.useState(null),fe=he=>{const nt=Hv(he,l);nt.sessionIds.length>0&&(T(nt.sessionIds,!0),Xe({what:Du(he),sessionIds:nt.sessionIds})),re(null)},Le=()=>{pe!==null&&T(pe.sessionIds,!1),Xe(null)},Qe=he=>{Z(nt=>{const et=new Set(nt);return et.has(he)?et.delete(he):et.add(he),et})},at=N.useMemo(()=>{const he=[];for(const nt of Ie)for(const et of nt.sessions)z.has(et.sessionId)&&he.push(et);return he},[Ie,z]),ct=he=>{const nt=at.filter(et=>he?mt(et):!0).map(et=>et.sessionId);nt.length>0&&T(nt,he),Z(new Set)},wt=he=>{F(nt=>{const et=new Set(nt);return et.has(he)?et.delete(he):et.add(he),et})},Xt=e.state==="scanning";return o.jsxs("aside",{className:"sidebar",style:{width:`${w}px`},children:[o.jsxs("div",{className:"sidebar-header",children:[o.jsx("input",{className:"sidebar-filter",type:"search",placeholder:Bx(ge),value:V,onChange:he=>{B(he.target.value),ge==="conversations"&&(K(!1),he.target.value.trim().length===0&&(S==null||S.clear()))},onKeyDown:he=>{ge!=="conversations"||he.key!=="Enter"||(he.preventDefault(),Ae())},spellCheck:!1}),o.jsx("button",{className:"icon-button",onClick:d,title:v("sidebar.newProject"),disabled:s,children:"+"}),o.jsx("button",{className:"icon-button",onClick:k,title:v("sidebar.reindex"),disabled:Xt,children:"⟳"}),o.jsx("button",{className:`icon-button${(m==null?void 0:m.enabled)===!0?" icon-button-on":""}`,onClick:p,title:_E(m),"aria-label":ji(),children:o.jsx(NE,{})}),o.jsx("button",{className:"icon-button",onClick:M,title:v("sidebar.hide"),children:"«"})]}),S!==null&&o.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":v("sidebar.searchMode.label"),children:[o.jsx("button",{className:`sidebar-search-mode-option${ge==="titles"?" is-on":""}`,"aria-pressed":ge==="titles",onClick:()=>ke("titles"),title:v("sidebar.searchMode.titlesTitle"),children:Dx()}),o.jsx("button",{className:`sidebar-search-mode-option${ge==="conversations"?" is-on":""}`,"aria-pressed":ge==="conversations",onClick:()=>ke("conversations"),title:Ox(),children:Px()})]}),Xt&&o.jsx("div",{className:"sidebar-progress",children:v("sidebar.indexing",{scanned:e.scannedFiles,total:e.totalFiles})}),(it>0||je.length>0)&&o.jsxs("div",{className:"sidebar-archive-bar",children:[it>0&&o.jsx("button",{className:`sidebar-archived-toggle${U?" is-on":""}`,onClick:()=>H(he=>!he),title:v("sidebar.archived.toggleTitle"),children:U?v("sidebar.archived.hide",{count:it}):v("sidebar.archived.show",{count:it})}),je.length>0&&o.jsx("button",{ref:Ze,className:`link-button sidebar-archive-history${De?" is-on":""}`,onClick:()=>Fe(he=>!he),"aria-expanded":De,title:v("sidebar.history.buttonTitle"),children:v("sidebar.history.button")})]}),De&&je.length>0&&o.jsx(ME,{candidates:je,agents:b,onArchiveAgent:He,onClose:$e,anchorRef:Ze}),pe!==null&&!De&&o.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[o.jsx("span",{className:"archive-history-text",children:v("sidebar.undo.text",{count:pe.sessionIds.length,what:pe.what})}),o.jsx("button",{className:"link-button",onClick:Le,children:v("sidebar.action.undo")}),o.jsx("button",{className:"icon-button",onClick:()=>Xe(null),title:v("sidebar.undo.dismissTitle"),children:"×"})]}),G!==null&&o.jsx("button",{className:`sidebar-vault-line${(m==null?void 0:m.lastError)!=null?" is-problem":""}`,onClick:p,title:(m==null?void 0:m.lastError)!=null?v("sidebar.vaultLine.lastError",{error:At(m.lastError)}):v("sidebar.vaultLine.title"),children:G}),o.jsxs("div",{className:"sidebar-scroll",children:[te&&S!==null&&o.jsxs("div",{className:"search-results",children:[!S.vaultEnabled&&o.jsx("p",{className:"search-note",children:Ux()}),o.jsx("p",{className:`search-status${S.error!==null?" is-problem":""}`,role:"status",children:Q?Fx():Kx(S)}),!Q&&we.map(he=>{const nt=he.hits[0]??he.titleHit;return nt===null?null:o.jsxs("div",{className:"search-group",children:[o.jsxs("button",{className:"search-group-title",onClick:()=>L(nt,qx(he)),title:mr(he.title),children:[o.jsx(cd,{agent:he.agent,agents:b}),he.titleHit!==null?o.jsx(gm,{hit:he.titleHit}):mr(he.title)]}),he.hits.map(et=>o.jsxs("button",{className:"search-hit",onClick:()=>L(et,Bv(et)),children:[o.jsx("span",{className:"search-hit-snippet",children:o.jsx(gm,{hit:et})}),o.jsxs("span",{className:"search-hit-meta",children:[zx(et),et.at!==null?` · ${qn(et.at)}`:""]})]},et.eventId??"titulo"))]},he.key)})]}),!te&&Ie.length===0&&!Xt&&o.jsx("p",{className:"sidebar-empty",children:t.length===0?v("sidebar.empty.noProjects"):v("sidebar.empty.noMatch")}),!te&&Ie.map(he=>{const nt=D.has(he.key)||ae,et=!s&&he.cwdExists,dt=u(he.cwd);return o.jsxs("div",{className:"project",children:[o.jsxs("div",{className:"project-row",children:[o.jsxs("button",{className:"project-toggle",onClick:()=>wt(he.key),title:he.cwd.length>0?he.cwd:he.fallbackName,children:[o.jsx("span",{className:`chevron${nt?" chevron-open":""}`,children:"›"}),o.jsx("span",{className:"project-swatch",style:{background:Ys(he.cwd)},"aria-hidden":"true"}),o.jsx("span",{className:"project-name",children:Du(he)}),o.jsx("span",{className:"project-count",children:he.sessions.length})]}),o.jsxs("span",{className:"project-actions",children:[I!==null&&he.isGitRepo&&he.cwdExists&&o.jsx("button",{className:"icon-button project-action",onClick:()=>I(he),disabled:s,title:v("worktree.new"),"aria-label":v("worktree.new"),children:o.jsx(ud,{})}),x!==null&&o.jsx("button",{className:`icon-button project-action${Y(he.key)!=="idle"?" project-action-busy":""}`,onClick:()=>x(he.key),disabled:Y(he.key)==="exporting",title:EE(Y(he.key)),"aria-label":v("sidebar.project.export"),children:o.jsx(RE,{done:Y(he.key)==="done"})}),o.jsx("button",{className:`icon-button project-action${Pe===he.key?" project-action-busy":""}`,onClick:()=>re(de=>de===he.key?null:he.key),title:v("sidebar.project.archiveTitle"),"aria-label":v("sidebar.project.archive"),"aria-expanded":Pe===he.key,children:o.jsx(vm,{out:!1})})]}),o.jsx(Pd,{className:"icon-button",text:"+",title:dt?zg():he.cwdExists?v("sidebar.project.newSession"):v("sidebar.project.folderGone"),disabled:!et||dt,offerAgentChoice:i,agents:b,agent:i?a(he):null,onOpen:de=>y(he.cwd,de)})]}),!he.cwdExists&&o.jsx("div",{className:"project-missing",title:he.cwd,children:v("sidebar.project.missing")}),Pe===he.key&&o.jsx(LE,{project:he,openSessionIds:l,onConfirm:()=>fe(he),onCancel:()=>re(null)}),nt&&o.jsx("ul",{className:"session-list",children:he.sessions.map(de=>{var ot;const Ke=z.has(de.sessionId),ft=!mt(de),ye=Mk(de.agent,b,i),ht=xE(de),Rt=va(de)&&_(de.agent),vt=de.worktree!==null&&!de.worktree.exists,Ye=ht.copy?f!==null:et&&Rt&&!vt;return o.jsxs("li",{className:`session-row${de.archived?" session-archived":""}${Ke?" session-selected":""}`,children:[o.jsxs(oE,{className:"session-item",onLongPress:()=>Qe(de.sessionId),onClick:bt=>{if(bt.ctrlKey||bt.metaKey){Qe(de.sessionId);return}if(ht.copy){f==null||f(de);return}va(de)&&(de.archived&&T([de.sessionId],!1),g(Eg(de.cwd,he.cwd,h),de))},disabled:!Ye,title:ht.copy?`${mr(de.title,de.titleSource)}
|
|
145
|
-
${f===null?v("remote.onlyOnHost"):mm()}`:ye.unavailableTitle??mr(de.title,de.titleSource),children:[o.jsxs("span",{className:"session-title",children:[ye.badge&&o.jsx(cd,{agent:de.agent,agents:b}),ht.copy&&o.jsx("span",{className:"session-vault-mark",title:mm(),children:fE()}),ht.partial&&o.jsx("span",{className:"session-partial-mark",title:mE(),children:pE()}),de.worktree!==null&&o.jsxs("span",{className:`session-branch${vt?" session-branch-gone":""}`,title:vt?v("worktree.sidebar.removedTitle"):v("worktree.sidebar.branchTitle",{branch:de.worktree.branch}),children:[de.worktree.branch,vt&&o.jsx("span",{className:"session-branch-note",children:v("worktree.sidebar.removed")})]}),mr(de.title,de.titleSource)]}),o.jsx("span",{className:"session-meta",children:qn(de.updatedAt)})]}),o.jsx(Cv,{targets:Ug(b,de.agent,de.partial,vt),className:"icon-button session-continue",text:"↪",title:Nd(vt),onPick:bt=>R(de,bt)}),vt&&((ot=de.worktree)==null?void 0:ot.reopenable)===!0&&et&&va(de)&&_(de.agent)&&o.jsx("button",{className:"icon-button session-action session-reopen",onClick:()=>P(de,he),title:v("worktree.sidebar.reopenTitle"),"aria-label":v("worktree.sidebar.reopen"),children:o.jsx(ud,{})}),o.jsx("button",{className:"icon-button session-action",onClick:()=>T([de.sessionId],!de.archived),disabled:ft,title:de.archived?v("sidebar.session.restore"):v(ft?"sidebar.session.blocked":"sidebar.session.archive"),children:o.jsx(vm,{out:de.archived})})]},`${de.agent}:${de.sessionId}`)})})]},he.key)})]}),at.length>0&&o.jsxs("div",{className:"sidebar-selection",children:[o.jsx("span",{children:v("sidebar.selection.count",{count:at.length})}),at.some(he=>!he.archived)&&o.jsx("button",{className:"link-button",onClick:()=>ct(!0),children:v("sidebar.action.archive")}),at.some(he=>he.archived)&&o.jsx("button",{className:"link-button",onClick:()=>ct(!1),children:v("sidebar.action.restore")}),o.jsx("button",{className:"link-button",onClick:()=>Z(new Set),children:v("common.cancel")})]})]})}function dd({x:t,y:e,items:s,onClose:l,anchor:u=null}){const y=N.useRef(null),[b,i]=N.useState({left:t,top:e});return N.useLayoutEffect(()=>{const a=y.current;if(a===null)return;const{width:g,height:_}=a.getBoundingClientRect();i({left:Math.max(4,Math.min(t,window.innerWidth-g-4)),top:Math.max(4,Math.min(e,window.innerHeight-_-4))})},[t,e]),N.useEffect(()=>{const a=_=>{_.key==="Escape"&&(_.stopPropagation(),l())},g=_=>{var k;const h=_.target;h instanceof Node&&((k=y.current)!=null&&k.contains(h)||u!=null&&u.contains(h))||l()};return window.addEventListener("keydown",a,!0),window.addEventListener("pointerdown",g,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("keydown",a,!0),window.removeEventListener("pointerdown",g,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[u,l]),o.jsx("div",{ref:y,className:"context-menu",style:{left:`${b.left}px`,top:`${b.top}px`},onPointerDown:a=>a.stopPropagation(),children:s.map(a=>o.jsxs("button",{className:"context-menu-item",lang:a.lang,role:a.checked===void 0?void 0:"menuitemradio","aria-checked":a.checked,onClick:()=>{a.onSelect(),l()},children:[a.checked!==void 0&&o.jsx("span",{className:"context-menu-check","aria-hidden":"true",children:a.checked?"✓":""}),a.label]},a.label))})}function $v({listLabel:t,docs:e,active:s,tooltipOf:l,labelOf:u=a=>a.title,onShowList:y,onSelect:b,onClose:i}){return o.jsxs("div",{className:"panel-subhead doc-strip",children:[o.jsx("button",{className:`doc-strip-list${s===null?" is-active":""}`,onClick:y,title:v("docs.backToList"),children:s===null?t:`← ${t}`}),o.jsx("div",{className:"strip-tabs doc-tabs",children:e.map(a=>o.jsxs("div",{className:`strip-tab${a.key===s?" is-active":""}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>b(a.key),title:l(a),children:u(a)}),o.jsx("button",{className:"strip-tab-close",onClick:()=>i(a.key),title:v("docs.tab.close"),children:"×"})]},a.key))})]})}const IE={added:"+",removed:"-",context:" ",hunk:"",meta:""};function Wv({diff:t}){return t.binary?o.jsx("p",{className:"panel-note",children:v("diff.binary")}):t.lines.length===0?o.jsx("p",{className:"panel-note",children:t.message===null?v("diff.noChanges"):At(t.message)}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx(zv,{lines:t.lines}),t.truncated&&o.jsx("p",{className:"panel-note",children:v("diff.truncated")})]})}function zv({lines:t}){return o.jsx("div",{className:"diff",children:t.map((e,s)=>o.jsxs("div",{className:`diff-line diff-line-${e.kind}`,children:[o.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.oldLine??""}),o.jsx("span",{className:"diff-num","aria-hidden":"true",children:e.newLine??""}),o.jsx("span",{className:"diff-marker","aria-hidden":"true",children:IE[e.kind]}),o.jsx("span",{className:"diff-text",children:e.text})]},s))})}function _m(t){let e="";for(let s=0;s<t.length;s++){const l=t[s]??"",u=l.toLowerCase();e+=u.length===l.length?u:l}return e}function jE(t,e){if(e.length===0)return[];const s=_m(t),l=_m(e),u=[];let y=s.indexOf(l);for(;y!==-1;)u.push(y),y=s.indexOf(l,y+l.length);return u}function wm(t,e,s){for(let y=0;y<t.length;y++){const b=t[y]??0;if(s==="start"?e<b:e<=b){const i=y===0?0:t[y-1]??0;return{node:y,offset:e-i}}}const l=Math.max(0,t.length-1),u=l===0?0:t[l-1]??0;return{node:l,offset:(t[l]??0)-u}}function DE(t,e,s){return e===0?0:(t+s+e)%e}function PE(t){return/\.(md|markdown)$/i.test(t)}function OE(t,e){var y;const s=((y=e.split("#")[0])==null?void 0:y.split("?")[0])??"";if(s.length===0)return null;let l;try{l=decodeURIComponent(s)}catch{return null}if(/^[a-z][a-z0-9+.-]*:/i.test(l)||l.startsWith("/")||l.startsWith("\\"))return null;const u=t.split("/").slice(0,-1);for(const b of l.replace(/\\/g,"/").split("/")){if(b.includes(":"))return null;if(!(b===""||b===".")){if(b===".."){if(u.length===0)return null;u.pop();continue}u.push(b)}}return u.length===0?null:u.join("/")}function BE({text:t,language:e}){const[s,l]=N.useState(null);N.useEffect(()=>{if(e===null){l(null);return}let y=!1;return pr(async()=>{const{highlightCode:b}=await import("./highlight-BsYn5BK8.js");return{highlightCode:b}},[]).then(({highlightCode:b})=>{y||l(b(t,e))}).catch(()=>{y||l(null)}),()=>{y=!0,l(null)}},[t,e]);const u=N.useMemo(()=>t.split(`
|
|
146
|
-
`).length,[t]);return o.jsxs("div",{className:"preview",children:[o.jsx("div",{className:"preview-gutter","aria-hidden":"true","data-search-skip":"",children:Array.from({length:u},(y,b)=>o.jsx("span",{children:b+1},b))}),s!==null?o.jsx("pre",{className:"preview-code hljs",dangerouslySetInnerHTML:{__html:s}}):o.jsx("pre",{className:"preview-code",children:t})]})}function bm({onInsert:t,onOpenWithSystem:e}){const[s,l]=N.useState(!1),u=N.useRef(null);N.useEffect(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]);const y=()=>{t==null||t(),l(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!1),1200)};return o.jsxs("div",{className:"preview-actions",children:[t!==void 0&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:y,children:v(s?"files.pathInserted":"files.preview.insertPath")}),e!==null&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:e,children:v("files.menu.openWithSystem")})]})}const hd="doc-search",fd="doc-search-current";function pd(){const t=CSS.highlights,e=window.Highlight;return t===void 0||typeof e!="function"?null:t}function ym(t){const e=window.Highlight;return new e(...t)}function km(){const t=pd();t==null||t.delete(hd),t==null||t.delete(fd)}function FE(t,e){if(e===null)return;const s=t.getBoundingClientRect(),l=e.getBoundingClientRect();(s.top<l.top+16||s.bottom>l.bottom-16)&&(e.scrollTop+=s.top-l.top-l.height/3),(s.left<l.left||s.right>l.right)&&(e.scrollLeft+=s.left-l.left-48)}function HE(t,e,s,l){const[u,y]=N.useState(0),[b,i]=N.useState(0),[a,g]=N.useState(0),_=N.useRef([]);N.useEffect(()=>{const k=t.current;if(k===null||s.length===0)return;let T=0;const M=new MutationObserver(()=>{T===0&&(T=window.requestAnimationFrame(()=>{T=0,g(w=>w+1)}))});return M.observe(k,{childList:!0,subtree:!0,characterData:!0}),()=>{M.disconnect(),T!==0&&window.cancelAnimationFrame(T)}},[t,s,l]),N.useEffect(()=>{const k=t.current;if(_.current=[],k===null||s.length===0){km(),y(0),i(0);return}const T=[],M=[];let w="";const d=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,{acceptNode:p=>{var f;return(f=p.parentElement)!=null&&f.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let p=d.nextNode();p!==null;p=d.nextNode()){const f=p;T.push(f),w+=f.data,M.push(w.length)}_.current=jE(w,s).map(p=>{const f=wm(M,p,"start"),x=wm(M,p+s.length,"end"),j=document.createRange();return j.setStart(T[f.node],f.offset),j.setEnd(T[x.node],x.offset),j}),y(_.current.length),i(p=>p<_.current.length?p:0);const m=pd();return m!==null&&_.current.length>0?m.set(hd,ym(_.current)):m==null||m.delete(hd),km},[t,s,a,l]),N.useEffect(()=>{i(0)},[s]),N.useEffect(()=>{const k=_.current[b],T=pd();if(k===void 0){T==null||T.delete(fd);return}T==null||T.set(fd,ym([k])),FE(k,e.current)},[b,u,a,l,s,e]);const h=N.useCallback(k=>i(T=>DE(T,u,k)),[u]);return{count:u,index:b,step:h}}function qv({doc:t,content:e,readingText:s,truncatedText:l,onReload:u,onModeChange:y,onOpenWithSystem:b,onInsert:i,onOpenLink:a,initialScroll:g,onScrollChange:_,editor:h=null,insertButton:k}){const[T,M]=N.useState(""),w=N.useRef(null),d=N.useRef(null),m=(e==null?void 0:e.loaded)??null,p=m===null?"":m.kind==="file"?m.preview.text:m.plan.text,f=m!==null&&m.kind==="file"&&m.preview.binary,x=m!==null&&(m.kind==="file"?m.preview.truncated:m.plan.truncated),j=m!==null&&(m.kind==="plan"||m.preview.language==="markdown"||PE(m.preview.path)),E=j&&(t.mode??"formatted")==="formatted",R=m!==null&&m.kind==="file"?m.preview.language:"markdown",S=T.trim(),L=HE(d,w,S,`${E?"f":"s"}:${p.length}:${p.slice(0,64)}`),I=N.useRef(!1);N.useLayoutEffect(()=>{I.current||m===null||(I.current=!0,g!==void 0&&w.current!==null&&(w.current.scrollTop=g))},[m,g]);const P=a===void 0||m===null||m.kind!=="file"?void 0:Y=>{const G=OE(t.key,Y);return G===null?null:()=>a(G)},D=m!==null&&!f,F=(h==null?void 0:h.edit)??null;if(h!==null&&F!==null)return o.jsx(UE,{title:t.title,editor:h,insertButton:k});const W=m!==null&&m.kind==="file"&&m.preview.editable===!0,$=v(W?"docs.edit.title":x?"docs.edit.tooLarge":"docs.edit.unsafe");return o.jsxs("div",{className:"panel-body doc-viewer",children:[o.jsxs("div",{className:"doc-toolbar",children:[o.jsx("input",{className:"conversation-search-input",type:"search",placeholder:v("docs.search.placeholder"),value:T,disabled:!D,onChange:Y=>M(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&L.step(Y.shiftKey?-1:1),Y.key==="Escape"&&M(""),Y.stopPropagation()},spellCheck:!1}),S.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:L.count===0?v("thread.search.none"):`${L.index+1}/${L.count}`}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(-1),disabled:L.count===0,title:v("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>L.step(1),disabled:L.count===0,title:v("thread.search.next"),children:"↓"})]}),j&&o.jsxs("div",{className:"doc-mode",role:"group","aria-label":v("docs.mode.label"),children:[o.jsx("button",{className:E?"is-active":"","aria-pressed":E,onClick:()=>y("formatted"),children:v("docs.mode.formatted")}),o.jsx("button",{className:E?"":"is-active","aria-pressed":!E,onClick:()=>y("source"),children:v("docs.mode.source")})]}),h!==null&&m!==null&&m.kind==="file"&&!f&&o.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:h.begin,disabled:!W,title:$,children:h.justSaved?v("docs.edit.saved"):v("docs.edit.button")}),k,o.jsx("button",{className:"icon-button",onClick:u,disabled:(e==null?void 0:e.loading)===!0,title:v("docs.reload"),children:"⟳"})]}),(e==null?void 0:e.failed)===!0&&m!==null&&o.jsx("p",{className:"panel-note doc-note",children:v("docs.reloadFailed")}),m===null?o.jsx("p",{className:"panel-note",children:(e==null?void 0:e.failed)===!0?v("docs.failed"):s}):f?o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:v("files.preview.binary")}),o.jsx(bm,{onInsert:i,onOpenWithSystem:b})]}):o.jsxs("div",{className:"panel-scroll",ref:w,onScroll:Y=>_(Y.currentTarget.scrollTop),children:[o.jsx("div",{ref:d,className:E?"plan-body":"doc-source",children:E?o.jsx(jd,{text:p,localLink:P}):o.jsx(BE,{text:p,language:R})}),x&&o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:l}),m.kind==="file"&&o.jsx(bm,{onInsert:i,onOpenWithSystem:b})]})]})]})}function UE({title:t,editor:e,insertButton:s}){const[l,u]=N.useState(!1),y=e.edit;if(y===null)return o.jsx(o.Fragment,{});const b=y.text!==y.opened,i=y.conflict,a=b&&!y.saving&&i===null,g=y.saving?v("docs.edit.saving"):v(b?"docs.edit.unsaved":"docs.edit.noChanges"),_=()=>{e.unsaved?u(!0):e.discard()};return o.jsxs("div",{className:"panel-body doc-viewer",children:[o.jsxs("div",{className:"doc-toolbar",children:[o.jsxs("span",{className:"doc-edit-status",title:t,children:[v("docs.edit.editing",{name:t}),o.jsxs("span",{className:"doc-edit-state",children:[" · ",g]})]}),o.jsx("button",{className:"link-button",onClick:_,disabled:y.saving,children:v("docs.edit.cancel")}),o.jsx("button",{className:"primary-button primary-button-small",onClick:e.save,disabled:!a,title:v("docs.edit.saveTitle"),children:v("docs.edit.save")}),s,o.jsx("button",{className:"icon-button",disabled:!0,title:v("docs.reload"),children:"⟳"})]}),y.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:v("docs.edit.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.confirmClose,children:v("docs.edit.discardAndClose")}),o.jsx("button",{className:"link-button",onClick:e.keepEditing,children:v("docs.edit.keepEditing")})]}),l&&!y.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:v("docs.edit.discardConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:v("docs.edit.discard")}),o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:v("docs.edit.keepEditing")})]}),i!==null&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:i.next===null?v("docs.edit.gone"):v("docs.edit.conflict")}),i.next!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:e.adopt,children:v("docs.edit.adopt")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:v("docs.edit.discardMine")})]}),y.failure!==null&&o.jsx("div",{className:"composer-problem doc-edit-bar",children:o.jsx("span",{children:y.failure.kind==="lost"?v("docs.edit.lost"):At(y.failure.text)})}),y.pending!==null&&o.jsxs("div",{className:"doc-changes",children:[o.jsxs("div",{className:"doc-changes-head",children:[o.jsx("span",{children:v("docs.edit.pending")}),o.jsx("button",{className:"link-button",onClick:e.dismissPending,children:v("docs.edit.pendingDone")})]}),o.jsx("div",{className:"doc-changes-body",children:o.jsx(zv,{lines:y.pending})})]}),o.jsx("textarea",{className:"doc-editor",value:y.text,readOnly:i!==null||y.saving,spellCheck:!1,autoFocus:!0,"aria-label":v("docs.edit.editing",{name:t}),onChange:h=>e.change(h.target.value),onKeyDown:h=>{(h.ctrlKey||h.metaKey)&&!h.altKey&&h.key.toLowerCase()==="s"&&(h.preventDefault(),a&&e.save()),h.stopPropagation()}})]})}function Bd(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M1.5 3.5h4l1.2 1.6h7.8v7.4a1 1 0 0 1-1 1h-12a1 1 0 0 1-1-1V3.5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function $E(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"5.5",y:"1.5",width:"9",height:"10",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M10.5 13.2v.3a1 1 0 0 1-1 1h-7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h.3",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function WE({open:t}){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("path",{d:"M1.4 8S3.8 3.9 8 3.9 14.6 8 14.6 8 12.2 12.1 8 12.1 1.4 8 1.4 8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),!t&&o.jsx("path",{d:"M2.6 13.4L13.4 2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function zE(){return o.jsxs("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:[o.jsx("rect",{x:"1.5",y:"10",width:"13",height:"4.5",rx:"1.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),o.jsx("path",{d:"M8 1.5v6.2M5.4 5.3L8 7.9l2.6-2.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function qE(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M3 8.5l3.2 3.2L13 4.8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function Vv({className:t,title:e,doneTitle:s,icon:l,onAction:u}){const[y,b]=N.useState(!1),i=N.useRef(null);N.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const a=g=>{g.stopPropagation(),u(),b(!0),i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>b(!1),1200)};return o.jsx("button",{className:y?`${t} tree-action-done`:t,onClick:a,title:y?s:e,children:y?o.jsx(qE,{}):l})}function VE({className:t,title:e,onCopy:s}){return o.jsx(Vv,{className:t,title:e,doneTitle:v("common.copied"),icon:o.jsx($E,{}),onAction:s})}function Ho({className:t,title:e,onInsert:s}){return o.jsx(Vv,{className:t,title:e,doneTitle:v("files.pathInserted"),icon:o.jsx(zE,{}),onAction:s})}function KE({view:t,cwd:e,platform:s,onInsert:l,onInsertPath:u,onReveal:y,docs:b}){const{listings:i,loading:a,refresh:g,query:_,setQuery:h,showHidden:k,toggleHidden:T}=t,M=Vo(),[w,d]=N.useState(null),m=s==="win32"?"\\":"/",p=N.useCallback($=>{const Y=$.split("/").join(m);return e.length===0?Y:e.endsWith(m)?`${e}${Y}`:`${e}${m}${Y}`},[e,m]),f=N.useCallback($=>{navigator.clipboard.writeText($).catch(()=>{})},[]),x=N.useCallback($=>u(`"${p($)}"`),[p,u]),j=N.useCallback(($,Y)=>{$.preventDefault(),$.stopPropagation(),d({x:$.clientX,y:$.clientY,items:[{label:v("files.menu.copyAbsolute"),onSelect:()=>f(p(Y))},{label:v("files.menu.copyRelative"),onSelect:()=>f(Y)},...l===void 0?[]:[{label:v("files.menu.insertMention"),onSelect:()=>l(`@${Y}`)}],...y===null?[]:[{label:v("files.menu.openWithSystem"),onSelect:()=>y(Y)}]]})},[p,f,l,y,M]),E=b.active===null?null:b.docs.find($=>$.key===b.active)??null,R=E===null?void 0:b.content(E.key),S=E!==null&&R===void 0;N.useEffect(()=>{S&&E!==null&&b.reload(E.key)},[S,E==null?void 0:E.key]);const L=N.useCallback($=>b.open({key:$,title:$.split("/").pop()??$}),[b]),I=N.useMemo(()=>({...t,openFile:L}),[t,L]),P=$=>{var G;const Y=(G=b.content($.key))==null?void 0:G.loaded;return(Y==null?void 0:Y.kind)==="file"?`${$.key} · ${vn(Y.preview.sizeBytes)}`:$.key},D=b.docs.length>0?o.jsx($v,{listLabel:v("panel.tab.files"),docs:b.docs,active:b.active,tooltipOf:P,labelOf:$=>b.unsaved($.key)?`${$.title} •`:$.title,onShowList:b.showList,onSelect:b.select,onClose:b.requestClose}):null;if(E!==null)return o.jsxs("div",{className:"panel-body",children:[D,o.jsx(qv,{doc:E,content:R,readingText:v("files.readingFile"),truncatedText:v("files.preview.truncated"),onReload:()=>b.reload(E.key),onModeChange:$=>b.setMode(E.key,$),onOpenWithSystem:y===null?null:()=>y(E.key),onInsert:()=>x(E.key),onOpenLink:L,initialScroll:b.scrollOf(E.key),onScrollChange:$=>b.rememberScroll(E.key,$),editor:b.editorFor(E.key),insertButton:o.jsx(Ho,{className:"icon-button",title:v("files.insertPath",{name:E.title}),onInsert:()=>x(E.key)})},E.key),w!==null&&o.jsx(dd,{x:w.x,y:w.y,items:w.items,onClose:()=>d(null)})]});const F=i.get(""),W=_.trim();return o.jsxs("div",{className:"panel-body",children:[D,o.jsxs("div",{className:"panel-subhead",children:[o.jsx("span",{className:"panel-subhead-title",title:e,children:e.split(/[\\/]/).filter($=>$.length>0).pop()??e}),o.jsx(Ho,{className:"icon-button",title:v("files.insertFolderPath"),onInsert:()=>x("")}),o.jsx("button",{className:k?"icon-button icon-button-on":"icon-button",onClick:T,title:v(k?"files.hidden.hide":"files.hidden.show"),children:o.jsx(WE,{open:k})}),y!==null&&o.jsx("button",{className:"icon-button",onClick:()=>y(""),title:v("files.revealFolder"),children:o.jsx(Bd,{})}),o.jsx("button",{className:"icon-button",onClick:g,title:v("files.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"tree-search",children:[o.jsx("input",{className:"tree-search-input",value:_,placeholder:v("files.search.placeholder"),onChange:$=>h($.target.value),onKeyDown:$=>{$.key==="Escape"&&_.length>0&&($.stopPropagation(),h(""))}}),_.length>0&&o.jsx("button",{className:"tree-search-clear",onClick:()=>h(""),title:v("files.search.clear"),children:"×"})]}),o.jsx("div",{className:"panel-scroll",children:W.length>0?o.jsx(GE,{view:I,onContextMenu:j,onReveal:y,onInsertPath:x}):F===void 0?o.jsx("p",{className:"panel-note",children:a.has("")?v("files.readingDir"):v("files.readDirFailed")}):o.jsx(Kv,{path:"",depth:0,view:I,onContextMenu:j,onReveal:y,onInsertPath:x})}),w!==null&&o.jsx(dd,{x:w.x,y:w.y,items:w.items,onClose:()=>d(null)})]})}function GE({view:t,onContextMenu:e,onReveal:s,onInsertPath:l}){const{results:u,searching:y,openFile:b,toggleDirectory:i}=t;return u===null?o.jsx("p",{className:"panel-note",children:v(y?"files.search.searching":"files.search.prompt")}):u.entries.length===0?o.jsx("p",{className:"panel-note",children:v("files.search.none")}):o.jsxs("ul",{className:"tree tree-results",children:[u.entries.map(a=>o.jsx("li",{children:o.jsxs("div",{className:"tree-item",children:[o.jsxs("button",{className:`tree-row tree-row-${a.kind}${a.hidden===void 0?"":" tree-row-hidden"}`,onClick:()=>a.kind==="dir"?i(a.path):b(a.path),onContextMenu:g=>e(g,a.path,a.kind),title:a.path,children:[o.jsx("span",{className:"tree-chevron",children:a.kind==="dir"?"›":""}),o.jsxs("span",{className:"tree-result",children:[o.jsx("span",{className:"tree-name",children:a.name}),o.jsx("span",{className:"tree-result-path",children:a.path})]}),a.kind==="file"&&o.jsx("span",{className:"tree-size",children:vn(a.sizeBytes)})]}),o.jsx(Ho,{className:"tree-action",title:v("files.insertPath",{name:a.name}),onInsert:()=>l(a.path)}),a.kind==="dir"&&s!==null&&o.jsx("button",{className:"tree-action",onClick:()=>s(a.path),title:v("files.reveal",{name:a.name}),children:o.jsx(Bd,{})})]})},a.path)),u.truncated&&o.jsx("li",{className:"tree-hidden",title:v("files.search.moreTitle"),children:v("files.search.more")})]})}function Kv({path:t,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:y}){const{listings:b,loading:i}=s,a=b.get(t);return a===void 0?i.has(t)?o.jsx("div",{className:"tree-loading",children:v("files.loading")}):null:o.jsxs("ul",{className:"tree",children:[a.entries.map(g=>o.jsx(YE,{entry:g,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:y},g.path)),a.entries.length===0&&o.jsx("li",{className:"tree-empty",style:{paddingLeft:`${e*12+8}px`},children:a.hiddenCount>0?v("files.allHidden"):v("files.empty")}),(a.truncated||a.hiddenCount>0)&&a.entries.length>0&&o.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${e*12+8}px`},title:v("files.hiddenTitle"),children:a.truncated?v("files.moreEntries"):v("files.hiddenCount",{count:a.hiddenCount})})]})}function YE({entry:t,depth:e,view:s,onContextMenu:l,onReveal:u,onInsertPath:y}){const{expanded:b,toggleDirectory:i,openFile:a}=s,g=t.kind==="dir"&&b.has(t.path);return o.jsxs("li",{children:[o.jsxs("div",{className:"tree-item",children:[o.jsxs("button",{className:`tree-row tree-row-${t.kind}${t.hidden===void 0?"":" tree-row-hidden"}`,style:{paddingLeft:`${e*12+6}px`},onClick:()=>t.kind==="dir"?i(t.path):a(t.path),onContextMenu:_=>l(_,t.path,t.kind),title:t.hidden===void 0?t.path:`${t.path}
|
|
147
|
-
${t.hidden==="ignored"?v("files.row.ignored"):v("files.row.alwaysHidden")}`,children:[o.jsx("span",{className:`tree-chevron${g?" tree-chevron-open":""}`,children:t.kind==="dir"?"›":""}),o.jsx("span",{className:"tree-name",children:t.name}),t.kind==="file"&&o.jsx("span",{className:"tree-size",children:vn(t.sizeBytes)})]}),o.jsx(Ho,{className:"tree-action",title:v("files.insertPath",{name:t.name}),onInsert:()=>y(t.path)}),t.kind==="dir"&&u!==null&&o.jsx("button",{className:"tree-action",onClick:()=>u(t.path),title:v("files.reveal",{name:t.name}),children:o.jsx(Bd,{})})]}),g&&o.jsx(Kv,{path:t.path,depth:e+1,view:s,onContextMenu:l,onReveal:u,onInsertPath:y})]})}const Gv={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},Yv={added:"git.kind.added",modified:"git.kind.modified",deleted:"git.kind.deleted",renamed:"git.kind.renamed",copied:"git.kind.copied","type-changed":"git.kind.typeChanged",untracked:"git.kind.untracked",conflict:"git.kind.conflict"};function Ta(t){const e=t.endsWith("/"),s=e?t.slice(0,-1):t,l=s.lastIndexOf("/"),u=l===-1?s:s.slice(l+1);return{dir:l===-1?"":s.slice(0,l+1),name:e?`${u}/`:u,isDirectory:e}}function XE({view:t,onBack:e,onOpenDiff:s,onCloseDiff:l,onRequestReview:u}){const{state:y}=t;if(t.diff!==null){const i=t.diff;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:l,children:["← ",t.branch]}),o.jsx("span",{className:"panel-subhead-title",title:i.path,children:Ta(i.path).name})]}),i.message!==null?o.jsx("p",{className:"panel-note",children:i.message}):i.diff===null?o.jsx("p",{className:"panel-note",children:v("git.readingDiff")}):o.jsx(Wv,{diff:i.diff})]})}const b=y.phase==="ready"?y.changes:null;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:e,children:["← ",v("git.backToChanges")]}),o.jsx("span",{className:"panel-subhead-title",title:b===null?t.branch:v("worktree.changes.title",{branch:b.branch,base:b.base}),children:b===null?t.branch:v("worktree.changes.title",{branch:b.branch,base:b.base})}),u!==null&&b!==null&&b.commitCount>0&&o.jsx("button",{className:"link-button",onClick:u,title:v("worktree.actions.reviewTitle"),children:v("worktree.actions.review")})]}),o.jsxs("div",{className:"panel-scroll",children:[y.phase==="loading"&&o.jsx("p",{className:"panel-note",children:v("worktree.changes.loading")}),y.phase==="failed"&&o.jsx("p",{className:"panel-note",children:y.message}),b!==null&&o.jsxs(o.Fragment,{children:[b.uncommitted>0&&o.jsx("p",{className:"panel-note",children:v("worktree.changes.uncommitted",{count:b.uncommitted})}),b.commitCount===0&&b.files.length===0&&o.jsx("p",{className:"panel-note",children:v("worktree.changes.empty",{base:b.base})}),b.commits.length>0&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",children:[v("worktree.changes.commits"),o.jsx("span",{className:"git-group-count",children:b.commitCount})]}),o.jsx("ul",{className:"git-list worktree-commits",children:b.commits.map(i=>o.jsxs("li",{className:"worktree-commit",title:`${Rd(i.at)} ${Ii(i.at)}`,children:[o.jsx("span",{className:"worktree-commit-sha",children:i.sha}),o.jsx("span",{className:"worktree-commit-subject",children:i.subject}),o.jsx("span",{className:"worktree-commit-when",children:qn(i.at)})]},i.sha))}),b.commitCount>b.commits.length&&o.jsx("p",{className:"panel-note",children:v("worktree.changes.more",{count:b.commitCount-b.commits.length})})]}),b.files.length>0&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",children:[v("worktree.changes.files"),o.jsx("span",{className:"git-group-count",children:b.fileCount})]}),o.jsx("ul",{className:"git-list",children:b.files.map(i=>{const{dir:a,name:g}=Ta(i.path);return o.jsx("li",{children:o.jsxs("button",{className:"git-item",onClick:()=>s(i.path),title:i.oldPath!==null?`${i.oldPath} → ${i.path}`:i.path,children:[o.jsx("span",{className:`git-badge git-badge-${i.kind}`,title:v(Yv[i.kind]),children:Gv[i.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:g}),a.length>0&&o.jsx("span",{className:"git-path-dir",children:a})]})]})},i.path)})}),b.fileCount>b.files.length&&o.jsx("p",{className:"panel-note",children:v("worktree.changes.more",{count:b.fileCount-b.files.length})})]})]})]})]})}function Xv(t,e,s){const l=t.worktree;if(l===null||l.branch===null)return null;if(l.linked)return l.branch;const u=vr(l.mainCwd,s);return e.some(b=>{var i;return b.terminalId!==t.terminalId&&((i=b.worktree)==null?void 0:i.linked)===!0&&vr(b.worktree.mainCwd,s)===u})?l.branch:null}function QE(t,e){const s=t.worktree;return s===null||e===null?null:s.linked?v("worktree.tab.linkedTitle",{branch:e,main:s.mainCwd}):v("worktree.tab.mainTitle",{branch:e})}function Vs(t){return Xu(t)}const JE={empty:"worktree.branch.empty","too-long":"worktree.branch.tooLong",characters:"worktree.branch.characters","starts-with-dash":"worktree.branch.startsWithDash",slashes:"worktree.branch.slashes",dots:"worktree.branch.dots",lock:"worktree.branch.lock",reserved:"worktree.branch.reserved"};function ZE(t){return v(JE[t])}function eT(t,e,s,l){if(e.length===0)return null;const u=r0(e);if(u!==null)return ZE(u);const y=t.branches.find(b=>b.name===e);return s==="new"&&y!==void 0?v("worktree.create.branchExists"):s==="existing"&&(y==null?void 0:y.checkedOut)===!0?v("worktree.create.branchInUse"):t.branches.some(b=>b.name===l)?null:v("worktree.create.baseMissing")}function Qv(t,e){return`${t.parentDir}${t.separator}${ug(e)}`}const tT=t=>/[\s"]/.test(t)?`"${t}"`:t;function nT(t,e,s,l){const u=tT(Qv(t,e));return l==="new"?`git worktree add -b ${e} ${u} ${s}`:`git worktree add ${u} ${e}`}function pa(t){return v("worktree.copy.summary",{count:t.files,size:vn(t.bytes)})}function rT(t){const e=[];return t.changes!==null&&t.changes>0&&e.push(v("worktree.rows.changes",{count:t.changes})),t.ahead!==null&&t.ahead>0&&e.push(v("worktree.rows.ahead",{count:t.ahead})),t.integrated===!0&&e.push(v("worktree.rows.integrated")),e.length===0&&t.changes===0&&e.push(v("worktree.rows.clean")),e}function sT(t){return[...t].sort((e,s)=>e.isMain!==s.isMain?e.isMain?-1:1:(e.branch??e.path).localeCompare(s.branch??s.path))}function Cm(t,e){const s=_n(t.map(l=>l.split("/").pop()??l));return e>t.length?`${s}…`:s}function iT(t){var s,l;const e=[];if(t.behind!==null&&t.behind>0&&t.base!==null){const u=[v("worktree.rows.behind",{base:t.base,count:t.behind})];((s=t.merge)==null?void 0:s.state)==="clean"&&u.push(v("worktree.rows.mergeClean")),((l=t.merge)==null?void 0:l.state)==="conflicts"&&u.push(v("worktree.rows.mergeConflicts",{count:t.merge.fileCount,list:Cm(t.merge.files,t.merge.fileCount)})),e.push(u.join(" · "))}for(const u of t.overlaps)e.push(v("worktree.rows.overlap",{branch:u.branch,list:Cm(u.files,u.fileCount)}));return e}const Sm={working:"worktree.review.stateWorking",pending:"worktree.review.statePending",ready:"worktree.review.stateReady",changes:"worktree.review.stateChanges",none:"worktree.review.stateNone"};function Jv(t,e){const s=t.state==="done"?Sm[t.verdict??"none"]:Sm[t.state],l=v(s,{agent:e});return t.stale?v("worktree.review.stale",{text:l}):l}function oT(t){return t!==null&&t.state==="done"}function lT(t){const e=t.id!==null&&!t.isMain&&t.behind!==null,s=(t.ahead??0)>0;return{viewChanges:e&&s,review:e&&(s||(t.changes??0)>0),sendReview:e&&oT(t.review),catchUp:e&&t.base!==null&&(t.behind??0)>0,integrate:e&&t.base!==null&&s}}function aT(t){return t.base===null?null:t.ahead===0?v("worktree.integrate.blockerNothing",{base:t.base}):t.behind!==null&&t.behind>0?v("worktree.integrate.blockerBehind",{base:t.base}):null}function cT(t){switch(t.blocker){case"nothing":return v("worktree.integrate.blockerNothing",{base:t.base});case"behind":return v("worktree.integrate.blockerBehind",{base:t.base});case"no-base-folder":return v("worktree.integrate.blockerNoBase",{base:t.base});case"local-changes":return v("worktree.integrate.blockerLocal",{base:t.base,count:t.localConflicts.length,list:_n(t.localConflicts)});case null:return null}}function uT(t,e){var l;const s=((l=t.readOnlyLaunch)==null?void 0:l.guard)??null;return s==="cli"?v("worktree.review.guardCli",{agent:e}):s==="tools"?v("worktree.review.guardTools",{agent:e}):v("worktree.review.guardNone",{agent:e})}function dT(t){return t.filter(e=>e.available).map(e=>{var s;return{id:e.id,guard:((s=e.capabilities.readOnlyLaunch)==null?void 0:s.guard)??null}})}function hT(t){return t.ahead===null?null:t.ahead===0?v("worktree.rows.integrated"):v("worktree.rows.notIntegrated",{count:t.ahead})}function fT(t){switch(t.blocker){case"checked-out":return v("worktree.deleteBranch.checkedOut",{branch:t.branch});case"not-integrated":return t.ahead===null?v("worktree.deleteBranch.noBase",{base:t.base}):v("worktree.deleteBranch.notIntegrated",{count:t.ahead,base:t.base});case null:return null}}function Ko(t,e){var s;return((s=t.untracked)==null?void 0:s.stamp)!=null&&e!==null&&t.untracked.stamp===e}function pT(t,e=null){return t.uncommittedCount>0&&!Ko(t,e)?"uncommitted":t.inUse===!0?"in-use":t.conflicts.length>0?"conflicts":null}function Zv(t,e=null){switch(pT(t,e)){case"uncommitted":return"ask-commit";case"in-use":return"retry";case"conflicts":return"ask-notes";case null:return"remove"}}function mT(t,e){var s;return t.uncommittedCount>0&&((s=t.untracked)==null?void 0:s.stamp)!=null&&!Ko(t,e)}const gT={"nested-repo":"worktree.remove.untrackedNestedRepo","too-many":"worktree.remove.untrackedTooMany",copied:"worktree.remove.untrackedCopied"};function vT(t,e){const s=t.untracked;return t.uncommittedCount===0||s===null?null:s.blocked!==null?v(gT[s.blocked],{max:o0}):Ko(t,e)?v("worktree.remove.untrackedAccepted"):v("worktree.remove.untracked",{count:s.files,size:vn(s.bytes)})}function _T(t){if(t.holders.length===0)return v("worktree.remove.inUse");const e=[];for(const l of t.holders){const u=l.name.toLowerCase().replace(/\.exe$/,""),y=l.description!==null&&l.description.toLowerCase()!==u?l.description:null,b=e.find(i=>i.exe.toLowerCase()===l.name.toLowerCase()&&i.program===y);b!==void 0?b.pids.push(l.pid):e.push({exe:l.name,program:y,pids:[l.pid]})}const s=_n(e.map(({exe:l,program:u,pids:y})=>{const b={exe:l,pids:_n(y.map(String))};return u===null?v("worktree.remove.holderExe",b):v("worktree.remove.holder",{...b,program:u})}));return v("worktree.remove.inUseBy",{count:e.length,list:s})}function wT(t){return`${_n(t.uncommitted)}${t.uncommittedCount>t.uncommitted.length?"…":""}`}function bT(t){const{branch:e}=t;return t.deletesBranch?t.branchUnused?v("worktree.remove.deletesUnusedBranch",{branch:e}):v("worktree.remove.deletesBranch",{branch:e}):t.createdBranch?v("worktree.remove.keepsBranch",{branch:e}):v("worktree.remove.keepsExistingBranch",{branch:e})}const yT=[{stage:"conflict",title:"git.group.conflict",hint:"git.group.conflictHint"},{stage:"staged",title:"git.group.staged",hint:"git.group.stagedHint"},{stage:"unstaged",title:"git.group.unstaged",hint:"git.group.unstagedHint"},{stage:"untracked",title:"git.group.untracked",hint:"git.group.untrackedHint"}];function kT({status:t}){return o.jsxs("div",{className:"git-headline",children:[o.jsx("span",{className:"git-branch",title:t.repoRoot,children:t.branch??(t.head!==null?v("git.detachedAt",{head:t.head}):v("git.detached"))}),t.upstream!==null&&o.jsx("span",{className:"git-upstream",title:v("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&o.jsxs("span",{className:"git-ab",title:v("git.aheadBehindTitle"),children:[t.ahead>0&&o.jsxs("span",{className:"git-ahead",children:["↑",t.ahead]}),t.behind>0&&o.jsxs("span",{className:"git-behind",children:["↓",t.behind]})]})]})}function CT(t){const e=t.review;return e===null||e.state!=="done"||e.stale?"":e.verdict==="ready"?" git-worktree-review-ready":e.verdict==="changes"?" git-worktree-review-changes":""}function ST({row:t,worktrees:e}){const s=rT(t),l=iT(t),u=t.id,y=u!==null&&!t.isMain?{...t,id:u}:null,b=lT(t),i=aT(t),a=t.review;return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:t.path,children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch??v("git.worktrees.detached"),t.isMain&&o.jsx("span",{className:"git-worktree-main",children:v("worktree.rows.main")}),t.isCurrent&&o.jsx("span",{className:"git-worktree-main",children:v("worktree.rows.current")})]}),s.length>0&&o.jsx("span",{className:"git-worktree-state",children:s.join(" · ")}),l.map(g=>o.jsx("span",{className:"git-worktree-team",children:g},g)),a!==null&&o.jsxs("span",{className:`git-worktree-review${CT(t)}`,children:[Jv(a,e.agentLabel(a.agent)),a.terminalId!==null&&o.jsx("button",{className:"link-button",onClick:()=>{a.terminalId!==null&&e.onShowReviewer(a.terminalId)},title:v("worktree.actions.showReviewerTitle"),children:v("worktree.actions.showReviewer")})]}),o.jsx("span",{className:"git-worktree-path",children:t.path}),o.jsxs("span",{className:"git-worktree-actions",children:[!t.isCurrent&&o.jsx("button",{className:"link-button",onClick:()=>e.onOpen(t),title:v("worktree.rows.openTitle"),children:v("worktree.rows.open")}),y!==null&&b.viewChanges&&o.jsx("button",{className:"link-button",onClick:()=>e.onViewChanges(y),title:v("worktree.actions.viewChangesTitle"),children:v("worktree.actions.viewChanges")}),y!==null&&b.review&&o.jsx("button",{className:"link-button",onClick:()=>e.onRequestReview(y),title:v("worktree.actions.reviewTitle"),children:v("worktree.actions.review")}),y!==null&&b.sendReview&&o.jsx("button",{className:"link-button",onClick:()=>e.onSendReview(y),title:v("worktree.actions.sendReviewTitle"),children:v("worktree.actions.sendReview")}),y!==null&&b.catchUp&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onCatchUp(y),title:v("worktree.actions.catchUpTitle",{base:t.base}),children:v("worktree.actions.catchUp")}),y!==null&&b.integrate&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onIntegrate(y),disabled:i!==null,title:i??v("worktree.actions.integrateTitle",{base:t.base}),children:v("worktree.actions.integrate",{base:t.base})}),y!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onRemove(y),title:v("worktree.rows.removeTitle"),children:v("worktree.rows.remove")})]})]})})}function xT({kept:t,worktrees:e}){const s=hT(t);return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:v("worktree.rows.keptTitle"),children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch,o.jsx("span",{className:"git-worktree-main",children:v("worktree.rows.kept")})]}),s!==null&&o.jsx("span",{className:"git-worktree-state",children:s}),o.jsx("span",{className:"git-worktree-actions",children:o.jsx("button",{className:"link-button",onClick:()=>e.onDeleteBranch(t),title:v("worktree.rows.deleteBranchTitle"),children:v("worktree.rows.deleteBranch")})})]})})}function ET({view:t,worktrees:e}){const{status:s,diff:l,loadingDiff:u,openDiff:y,closeDiff:b,refresh:i}=t;if(e.changes!==null){const _=e.changes,h=e.rows.find(k=>k.id===_.worktreeId)??null;return o.jsx(XE,{view:_,onBack:e.onCloseChanges,onOpenDiff:e.onOpenChangeDiff,onCloseDiff:e.onCloseChangeDiff,onRequestReview:h===null||h.id===null?null:()=>e.onRequestReview({...h,id:_.worktreeId})})}if(l!==null||u)return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:b,children:["← ",v("git.backToChanges")]}),l!==null&&o.jsxs("span",{className:"panel-subhead-title",title:l.path,children:[Ta(l.path).name,l.staged&&o.jsxs("span",{className:"panel-tagline",children:[" ",v("git.stagedTag")]})]})]}),u?o.jsx("p",{className:"panel-note",children:v("git.readingDiff")}):l!==null&&o.jsx(Wv,{diff:l})]});if(s.state!=="ready")return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:s.message===null?v("git.unknownState"):At(s.message)})});const a=sT(e.rows).filter(_=>!(_.isCurrent&&_.isMain)),g=a.some(_=>!_.isMain)||e.kept.length>0;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx(kT,{status:s}),o.jsx("button",{className:"icon-button",onClick:e.onNew,title:v("worktree.new"),"aria-label":v("worktree.new"),children:o.jsx(ud,{})}),o.jsx("button",{className:"icon-button",onClick:i,title:v("git.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&o.jsx("p",{className:"panel-note",children:v("git.clean")}),yT.map(_=>{const h=s.changes.filter(k=>k.stage===_.stage);return h.length===0?null:o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:v(_.hint),children:[v(_.title),o.jsx("span",{className:"git-group-count",children:h.length})]}),o.jsx("ul",{className:"git-list",children:h.map(k=>{const{dir:T,name:M,isDirectory:w}=Ta(k.path),d=k.oldPath!==null?`${k.oldPath} → ${k.path}`:w?v("git.newFolderTitle",{path:k.path}):k.path,m=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`git-badge git-badge-${k.kind}`,title:v(Yv[k.kind]),children:Gv[k.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:M}),T.length>0&&o.jsx("span",{className:"git-path-dir",children:T})]})]});return o.jsx("li",{children:w?o.jsx("div",{className:"git-item git-item-static",title:d,children:m}):o.jsx("button",{className:"git-item",onClick:()=>y(k.path,k.stage==="staged"),title:d,children:m})},`${_.stage}:${k.path}`)})})]},_.stage)}),s.truncated&&o.jsx("p",{className:"panel-note",children:cn("git.truncated")}),g&&o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:v("worktree.rows.headingTitle"),children:[v("worktree.rows.heading"),o.jsx("span",{className:"git-group-count",children:a.length+e.kept.length})]}),o.jsxs("ul",{className:"git-list",children:[a.map(_=>o.jsx(ST,{row:_,worktrees:e},_.path)),e.kept.map(_=>o.jsx(xT,{kept:_,worktrees:e},_.id))]})]})]})]})}const TT={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},LT={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function Aa(t){return t.brokenBlock||t.problem!==null}function NT(t){return t.problem==="outside"?v("memory.problem.outside"):t.problem==="encoding"?v("memory.problem.encoding"):t.brokenBlock?v("memory.problem.brokenBlock"):null}function RT(t){const e=t.files.filter(s=>!Aa(s));return t.installed?{instructionFiles:e.filter(s=>s.hasBlock||s.exists).map(s=>s.name),gitMode:t.git.kind==="error"||t.git.kind==="repo"&&!t.git.ignored?"version":"ignore",importNative:!1,copyFromMainWorktree:!1}:{...Sb(t),instructionFiles:e.map(s=>s.name)}}function MT(t){const e=t.files.filter(u=>u.hasBlock&&!u.blockCurrent),s=t.files.filter(u=>u.exists&&!u.hasBlock&&!Aa(u)),l=u=>_n(u.map(y=>y.name));return e.length===0?s.length===0?null:v("memory.update.missing",{files:l(s)}):s.length===0?v("memory.update.outdated",{count:e.length,files:l(e)}):v("memory.update.outdatedAndMissing",{count:e.length,outdated:l(e),missing:l(s)})}function AT(t){const e=t.replace(/^\uFEFF/,"").replace(/\r\n/g,`
|
|
148
|
-
`),s=/^---\n[\s\S]*?\n---(?:\n|$)/.exec(e);return s===null?e:e.slice(s[0].length)}function IT(t){return t.split(/`([^`]+)`/).map((e,s)=>s%2===1?o.jsx("code",{children:e},s):e)}function jT({view:t}){var d;const{status:e,open:s,loading:l,error:u,closeNote:y,openNote:b}=t,[i,a]=N.useState(null),[g,_]=N.useState(!1),h=(e==null?void 0:e.cwd)??null;N.useEffect(()=>{a(null),_(!1)},[h]),N.useEffect(()=>{t.lastResult!==null&&(a(null),_(!1))},[t.lastResult]);const k=N.useCallback(m=>{if(e===null)return null;let p=m.replace(/^\.\//,"");try{p=decodeURIComponent(p)}catch{return null}return p===ya||e.notes.some(x=>x.name===p)?()=>b(p):null},[e,b]);if(e===null)return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:u??v("memory.loading")})});if(s!==null||l!==null){const m=(s==null?void 0:s.name)??l??"",p=m===ya?v("memory.index"):((d=e.notes.find(f=>f.name===m))==null?void 0:d.title)??m;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx("button",{className:"link-button",onClick:y,children:v("memory.back")}),o.jsx("span",{className:"panel-subhead-title",title:m,children:p})]}),s===null?o.jsx("p",{className:"panel-note",children:v("memory.note.loading")}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx("div",{className:"plan-body",children:o.jsx(jd,{text:AT(s.text),localLink:k})}),s.truncated&&o.jsx("p",{className:"panel-note",children:v("memory.note.truncated")})]})]})}const T=i??RT(e),M=e.installed?MT(e):null,w=!e.installed||g||t.planned!==null;return o.jsxs("div",{className:"panel-body",children:[o.jsx(DT,{reach:e.reach,onAdjust:e.installed&&!w&&M===null&&e.reach.some(m=>!m.reaches)?()=>_(!0):null}),o.jsxs("div",{className:"panel-scroll",children:[(u??t.lastResult)!==null&&o.jsxs("div",{className:`memory-message${u!==null?" memory-message-error":""}`,children:[o.jsx("span",{children:u??t.lastResult}),o.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:v("common.dismissNotice"),children:"×"})]}),e.git.kind==="error"&&o.jsxs("div",{className:"memory-warning",children:[o.jsx("p",{className:"memory-warning-line",children:cn("memory.git.errorWarning")}),o.jsx("pre",{className:"memory-git-message",children:At(e.git.message)})]}),e.files.filter(Aa).map(m=>o.jsx("p",{className:"memory-warning",children:m.problem==="outside"?cn("memory.problem.outsideWarning",{file:m.name}):m.problem==="encoding"?cn("memory.problem.encodingWarning",{file:m.name}):cn("memory.problem.brokenBlockWarning",{file:m.name})},m.name)),!e.installed&&o.jsxs("div",{className:"memory-intro",children:[o.jsx("p",{children:v("memory.intro.what")}),o.jsx("p",{children:cn("memory.intro.where")})]}),e.installed&&M!==null&&!w&&o.jsxs("div",{className:"memory-callout",children:[o.jsx("span",{children:M}),o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>_(!0),children:v("memory.update.button")})]}),w&&(t.planned===null?o.jsx(PT,{status:e,options:T,busy:t.busy,onChange:a,onPlan:()=>{a(T),t.requestPlan(T)},onCancel:e.installed?()=>{_(!1),a(null)}:null}):o.jsx(OT,{changes:t.planned,busy:t.busy,confirmLabel:e.installed?v("memory.plan.update"):v("memory.plan.install"),onConfirm:t.install,onCancel:t.cancelPlan})),e.installed&&e.native.pending>0&&!w&&o.jsxs("div",{className:"memory-callout",children:[o.jsx("span",{children:v("memory.native.pending",{count:e.native.pending})}),o.jsx("button",{className:"primary-button primary-button-small",disabled:t.busy!==null,onClick:t.importNative,children:t.busy==="import"?v("memory.native.importing"):v("memory.native.import",{count:e.native.pending})})]}),e.installed&&o.jsx(BT,{notes:e.notes,indexExists:e.indexExists,onOpen:b}),e.globalFragments.length>0&&o.jsx(FT,{fragments:e.globalFragments})]})]})}function DT({reach:t,onAdjust:e}){return o.jsxs("div",{className:"memory-reach",children:[t.map(s=>o.jsxs("span",{className:`memory-reach-item${s.reaches?" memory-reach-on":""}`,title:v("memory.reach.title",{label:s.label,via:At(s.via)}),children:[o.jsx("span",{className:"memory-reach-mark","aria-hidden":"true",children:s.reaches?"✓":"—"}),s.label,o.jsx("span",{className:"visually-hidden",children:s.reaches?v("memory.reach.reaches",{via:At(s.via)}):v("memory.reach.doesNotReach",{via:At(s.via)})})]},s.agent)),e!==null&&o.jsx("button",{className:"link-button memory-reach-adjust",onClick:e,title:v("memory.reach.adjustTitle"),children:v("memory.reach.adjust")})]})}function PT({status:t,options:e,busy:s,onChange:l,onPlan:u,onCancel:y}){const{git:b}=t,i=b.kind==="repo"?b.worktree:null,a=b.kind==="error"&&e.gitMode==="ignore",g=(_,h)=>{const k=new Set(e.instructionFiles);h?k.add(_):k.delete(_),l({...e,instructionFiles:xd.filter(T=>k.has(T))})};return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:v("memory.form.files")}),t.files.map(_=>o.jsxs("label",{className:"memory-option",title:NT(_)??void 0,children:[o.jsx("input",{type:"checkbox",checked:e.instructionFiles.includes(_.name),disabled:Aa(_),onChange:h=>g(_.name,h.target.checked)}),o.jsx("code",{children:_.name}),o.jsx("span",{className:"memory-option-hint",children:_n(LT[_.name])})]},_.name)),b.kind==="repo"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:"Git"}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="ignore",onChange:()=>l({...e,gitMode:"ignore"})}),v("memory.git.ignore"),o.jsx("span",{className:"memory-option-hint",children:v("memory.git.ignoreHint")})]}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),v("memory.git.version"),o.jsx("span",{className:"memory-option-hint",children:v("memory.git.versionHint")})]}),b.ignored&&e.gitMode==="version"&&o.jsx("p",{className:"memory-warning",children:cn("memory.git.alreadyIgnored")})]}),b.kind==="error"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:"Git"}),o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"radio",name:"memory-git-mode",checked:e.gitMode==="version",onChange:()=>l({...e,gitMode:"version"})}),cn("memory.git.dontTouch"),o.jsx("span",{className:"memory-option-hint",children:v("memory.git.errorHint")})]})]}),(t.native.pending>0||(i==null?void 0:i.mainHasMemory)===!0)&&o.jsx("p",{className:"memory-section-label",children:v("memory.form.existingNotes")}),t.native.pending>0&&o.jsxs("label",{className:"memory-option",children:[o.jsx("input",{type:"checkbox",checked:e.importNative,onChange:_=>l({...e,importNative:_.target.checked})}),v("memory.form.importNative",{count:t.native.pending})]}),(i==null?void 0:i.mainHasMemory)===!0&&o.jsxs("label",{className:"memory-option",title:i.mainPath,children:[o.jsx("input",{type:"checkbox",checked:e.copyFromMainWorktree,onChange:_=>l({...e,copyFromMainWorktree:_.target.checked})}),v("memory.form.copyFromMain")]}),o.jsxs("div",{className:"memory-actions",children:[o.jsx("button",{className:"primary-button primary-button-small",disabled:s!==null||e.instructionFiles.length===0||a,onClick:u,title:e.instructionFiles.length===0?v("memory.form.noFiles"):a?v("memory.git.blocked"):void 0,children:v(s==="plan"?"memory.form.planning":"memory.form.preview")}),y!==null&&o.jsx("button",{className:"link-button",onClick:y,disabled:s!==null,children:v("common.cancel")})]})]})}function OT({changes:t,busy:e,confirmLabel:s,onConfirm:l,onCancel:u}){const y=e==="install";return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:v("memory.plan.changes")}),t.length===0?o.jsx("p",{className:"memory-empty",children:v("memory.plan.nothing")}):o.jsx("ul",{className:"memory-change-list",children:t.map((b,i)=>o.jsxs("li",{className:"memory-change",children:[o.jsxs("div",{className:"memory-change-head",children:[o.jsx("code",{className:"memory-change-file",children:b.file}),o.jsx("span",{className:"memory-option-hint",children:v(TT[b.action])})]}),b.copiedFrom!==null&&o.jsx("p",{className:"memory-option-hint",children:v("memory.plan.copiedFrom",{path:b.copiedFrom})}),b.preview.length>0&&o.jsx("pre",{className:"memory-preview",children:b.preview})]},`${b.file}-${i}`))}),o.jsxs("div",{className:"memory-actions",children:[t.length>0&&o.jsx("button",{className:"primary-button primary-button-small",disabled:e!==null,onClick:l,children:y?v("memory.plan.writing"):s}),o.jsx("button",{className:"link-button",onClick:u,disabled:y,children:t.length===0?v("memory.plan.back"):v("common.cancel")})]})]})}function BT({notes:t,indexExists:e,onOpen:s}){return o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:v("memory.list.notes")}),o.jsxs("ul",{className:"plan-list",children:[e&&o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(ya),children:[o.jsx("span",{className:"plan-name",children:v("memory.index")}),o.jsx("span",{className:"plan-meta",children:ya})]})}),t.map(l=>o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(l.name),title:l.name,children:[o.jsx("span",{className:"plan-name",children:l.title}),l.description.length>0&&o.jsx("span",{className:"memory-note-description",children:l.description}),o.jsxs("span",{className:"plan-meta",children:[qn(l.modifiedAt)," · ",vn(l.sizeBytes)]})]})},l.name))]}),t.length===0&&o.jsx("p",{className:"memory-empty",children:v("memory.list.empty")})]})}function FT({fragments:t}){const e=N.useCallback(s=>{navigator.clipboard.writeText(s).catch(()=>{})},[]);return o.jsxs("details",{className:"memory-global",children:[o.jsx("summary",{className:"memory-global-summary",children:v("memory.global.title")}),o.jsx("p",{className:"memory-empty",children:cn("memory.global.intro")}),t.map(s=>o.jsxs("div",{className:"memory-fragment",children:[o.jsxs("div",{className:"memory-change-head",children:[o.jsx("span",{className:"memory-fragment-label",children:s.label}),o.jsx("code",{className:"memory-fragment-target",title:s.target,children:s.target})]}),o.jsxs("div",{className:"memory-fragment-body",children:[o.jsx("pre",{className:"memory-preview",children:s.text}),o.jsx(VE,{className:"icon-button",title:v("memory.global.copy"),onCopy:()=>e(s.text)})]}),o.jsx("p",{className:"memory-fragment-note",children:IT(At(s.note))})]},s.agent))]})}function HT(t){for(const e of t.split(`
|
|
149
|
-
`,40)){const s=/^#{1,3}\s+(.+)$/.exec(e.trim());if(s!==null)return(s[1]??"").trim()}return null}function UT({view:t,docs:e,onInsertPath:s}){const{plans:l}=t,u=e.active===null?null:e.docs.find(g=>g.key===e.active)??null,y=u===null?void 0:e.content(u.key),b=u!==null&&y===void 0&&t.listFor!==null&&t.listFor===e.terminalId;N.useEffect(()=>{b&&u!==null&&e.reload(u.key)},[b,u==null?void 0:u.key]);const i=g=>{var h;const _=(h=e.content(g.key))==null?void 0:h.loaded;return(_==null?void 0:_.kind)==="plan"?HT(_.plan.text)??g.title:g.title},a=g=>{var h;const _=((h=l.find(k=>k.fileName===g.key))==null?void 0:h.path)??"";return _.length>0?_:i(g)};return o.jsxs("div",{className:"panel-body",children:[e.docs.length>0&&o.jsx($v,{listLabel:v("panel.tab.plans"),docs:e.docs,active:e.active,tooltipOf:a,labelOf:i,onShowList:e.showList,onSelect:e.select,onClose:e.close}),u!==null?o.jsx(qv,{doc:u,content:y,readingText:v("plans.loading"),truncatedText:v("plans.truncated"),onReload:()=>e.reload(u.key),onModeChange:g=>e.setMode(u.key,g),onOpenWithSystem:null,initialScroll:e.scrollOf(u.key),onScrollChange:g=>e.rememberScroll(u.key,g)},u.key):o.jsx("div",{className:"panel-scroll",children:l.length===0?o.jsx("p",{className:"panel-note",children:cn("plans.empty")}):o.jsx("ul",{className:"plan-list",children:[...l].reverse().map(g=>o.jsx($T,{plan:g,onOpen:()=>e.open({key:g.fileName,title:g.title}),onInsertPath:s},g.fileName))})})]})}function $T({plan:t,onOpen:e,onInsertPath:s}){const l=t.path.length>0?t.path:null;return t.exists?o.jsxs("li",{className:"plan-item",children:[o.jsxs("button",{className:"plan-row",onClick:e,title:l??void 0,children:[o.jsx("span",{className:"plan-name",children:t.title}),l!==null&&o.jsx("span",{className:"plan-path",children:l}),o.jsxs("span",{className:"plan-meta",children:[qn(t.modifiedAt)," · ",vn(t.sizeBytes)]})]}),t.absolutePath.length>0&&o.jsx(Ho,{className:"tree-action plan-action",title:v("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>s(`"${t.absolutePath}"`)})]}):o.jsxs("li",{className:"plan-row plan-row-missing",title:l??v("plans.missingTitle"),children:[o.jsx("span",{className:"plan-name",children:t.title}),l!==null&&o.jsx("span",{className:"plan-path",children:l}),o.jsx("span",{className:"plan-meta",children:v("plans.missing")})]})}const WT=[{id:"cli",labelKey:"panel.tab.cli"},{id:"git",labelKey:"panel.tab.git"},{id:"files",labelKey:"panel.tab.files"},{id:"plans",labelKey:"panel.tab.plans"},{id:"memory",labelKey:"panel.tab.memory"}];function e_(t){return t.state!=="ready"?0:new Set(t.changes.map(e=>e.path)).size}function zT({tab:t,plansAvailable:e,hiddenTabs:s,hidden:l,onTabChange:u,title:y,cwd:b,colorCwd:i,platform:a,cli:g,cliUnseen:_,expanded:h,onToggleExpanded:k,git:T,worktrees:M,files:w,plans:d,documents:m,memory:p,onInsert:f,onInsertPath:x,onReveal:j,onHide:E}){var L;const R=e_(T.status),S=((L=p.status)==null?void 0:L.installed)===!0?p.status.notes.length:0;return o.jsxs("section",{className:`side-panel${l?" side-panel-hidden":""}`,"aria-hidden":l,children:[o.jsxs("header",{className:"side-panel-header",children:[o.jsx("button",{className:"icon-button",onClick:E,title:v("panel.hide"),children:"»"}),b.length>0&&o.jsx("span",{className:"project-swatch",style:{background:Ys(i)}}),o.jsx("span",{className:"side-panel-title",title:b,children:y}),o.jsx("button",{className:"icon-button",onClick:k,title:v(h?"panel.restoreWidth":"panel.widen"),children:h?"⇥":"⇤"})]}),o.jsx("nav",{className:"side-panel-tabs",children:lk(WT,e,s).map(I=>o.jsxs("button",{className:`side-panel-tab${I.id===t?" side-panel-tab-active":""}`,onClick:()=>u(I.id),title:v(I.labelKey),children:[o.jsx("span",{className:"side-panel-tab-label",children:v(I.labelKey)}),I.id==="git"&&R>0&&o.jsx("span",{className:"side-panel-badge",children:R}),I.id==="plans"&&d.plans.length>0&&o.jsx("span",{className:"side-panel-badge",children:d.plans.length}),I.id==="memory"&&S>0&&o.jsx("span",{className:"side-panel-badge",children:S}),I.id==="cli"&&_&&t!=="cli"&&o.jsx("span",{className:"side-panel-dot",title:v("panel.cliUnseen")})]},I.id))}),o.jsxs("div",{className:"side-panel-body",children:[o.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:g}),t==="git"&&o.jsx(ET,{view:T,worktrees:M}),t==="plans"&&o.jsx(UT,{view:d,docs:m.plans,onInsertPath:x}),t==="memory"&&o.jsx(jT,{view:p}),t==="files"&&o.jsx(KE,{view:w,cwd:b,platform:a,onInsert:f,onInsertPath:x,onReveal:j,docs:m.files})]})]})}function t_({messages:t}){return o.jsx("span",{className:`tab-scheduled${VC(t)?" tab-scheduled-failed":""}`,"aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 24 24",width:"11",height:"11",children:[o.jsx("circle",{cx:"12",cy:"12",r:"8.5",fill:"none",stroke:"currentColor",strokeWidth:"2.4"}),o.jsx("path",{d:"M12 7.5V12l3 2",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function qT(t,e,s,l=null){const u=e===void 0||e.length===0?t:`${t} — ${e}`;return l===null?`${u}
|
|
150
|
-
${s}`:`${u}
|
|
151
|
-
${l}
|
|
152
|
-
${s}`}function VT(t,e){const s=[QE(t,e),t.review?v("worktree.tab.reviewTitle"):null].filter(l=>l!==null);return s.length===0?null:s.join(`
|
|
153
|
-
`)}function KT({placement:t}){return o.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
|
|
154
|
-
${v("tabs.state.opening")}`,style:{"--tab-project-color":Ys(t.pending.cwd)},children:[o.jsx("span",{className:"tab-opening","aria-label":v("tabs.aria.opening"),children:o.jsx("i",{})}),o.jsx("span",{className:"tab-label",children:t.label})]})}function Fd({terminal:t,activity:e,statusLine:s}){if(!t.alive){const l=t.sleeping;return o.jsx("span",{className:`tab-dot${l?" tab-dot-sleeping":" tab-dot-dead"}`,title:v(l?"tabs.dot.sleeping":"tabs.dot.exited")})}return e==="waiting"?o.jsx("span",{className:"tab-bang",title:v("tabs.dot.waiting"),children:"!"}):e==="busy"?o.jsxs("span",{className:"tab-working",title:v("tabs.dot.busy"),"aria-label":v("tabs.aria.working"),children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):o.jsx("span",{className:"tab-dot",title:vk(e,s)})}function Uo(t){var u;if(t.label.length>0)return t.label;const e=((u=t.worktree)==null?void 0:u.linked)===!0?t.worktree.mainCwd:t.cwd,s=e.split(/[\\/]/).filter(y=>y.length>0),l=s[s.length-1]??e;return t.resumed?`${l} ↩`:l}function GT(t){return t.alive?v("tabs.state.alive"):t.sleeping?v("tabs.state.sleeping"):v("tabs.state.exited",{code:t.exitCode??"?"})}function YT({terminals:t,activeTerminalId:e,activity:s,attention:l,canOpen:u,onSelect:y,onClose:b,onRename:i,onReorder:a,onNew:g,agents:_,offerAgentChoice:h,newTabAgent:k,pendingOpens:T,platform:M,newTabBlockedTitle:w,sessionTitles:d,scheduled:m}){const[p,f]=N.useState(null),[x,j]=N.useState(""),[E,R]=N.useState(null),S=N.useRef(null);N.useEffect(()=>{var $;p!==null&&(($=S.current)==null||$.select())},[p]);const L=$=>{f($.terminalId),j($.label.length>0?$.label:Uo($))},I=()=>{p!==null&&i(p,x.trim()),f(null)},P=$=>{if(E===null||E===$)return;const Y=t.map(B=>B.terminalId),G=Y.indexOf(E),V=Y.indexOf($);G===-1||V===-1||(Y.splice(V,0,...Y.splice(G,1)),a(Y),R(null))},D=Wk(t,T,M),F=new Map;for(const $ of D){const Y=F.get($.index);Y===void 0?F.set($.index,[$]):Y.push($)}const W=$=>(F.get($)??[]).map(Y=>o.jsx(KT,{placement:Y},`pending:${Y.pending.requestId}`));return o.jsxs("div",{className:"tab-bar",children:[t.map(($,Y)=>{var Z;const G=$.terminalId===e,V=$.terminalId===p,B=Xv($,t,M),U=(m==null?void 0:m.get($.terminalId))??[],H=rv(U),z=[VT($,B),H].filter(ie=>ie!==null);return o.jsxs(Ew.Fragment,{children:[W(Y),o.jsx("div",{className:`tab${G?" tab-active":""}${$.alive||$.sleeping?"":" tab-dead"}${(l==null?void 0:l.has($.terminalId))===!0?" tab-attention":""}`,draggable:!V,onDragStart:()=>R($.terminalId),onDragOver:ie=>ie.preventDefault(),onDrop:()=>P($.terminalId),onDragEnd:()=>R(null),onClick:()=>y($.terminalId),onDoubleClick:()=>L($),title:qT($.cwd,d.get($.terminalId),GT($),z.length===0?null:z.join(`
|
|
155
|
-
`)),style:{"--tab-project-color":Ys(Vs($))},children:V?o.jsx("input",{ref:S,className:"tab-input",value:x,onChange:ie=>j(ie.target.value),onBlur:I,onKeyDown:ie=>{ie.key==="Enter"&&I(),ie.key==="Escape"&&f(null),ie.stopPropagation()},onClick:ie=>ie.stopPropagation()}):o.jsxs(o.Fragment,{children:[o.jsx(Fd,{terminal:$,activity:s.get($.terminalId),statusLine:((Z=_.find(ie=>ie.id===$.agent))==null?void 0:Z.statusLine)??null}),o.jsxs("span",{className:"tab-label",children:[$.agent!==null&&Rk(h,$.agent)&&o.jsx(cd,{agent:$.agent,agents:_}),$.review&&o.jsx("span",{className:"tab-review",children:v("worktree.tab.review")}),B!==null&&o.jsx("span",{className:"tab-branch",children:B}),U.length>0&&o.jsx(t_,{messages:U}),Uo($)]}),o.jsx("button",{className:"tab-close",onClick:ie=>{ie.stopPropagation(),b($.terminalId)},title:v("tabs.close"),children:"×"})]})})]},$.terminalId)}),W(t.length),o.jsx(Pd,{className:"tab-new",text:"+",title:w??v("tabs.new"),disabled:!u||w!==null,offerAgentChoice:h,agents:_,agent:k,onOpen:g})]})}function XT(t,e,s){const[l,u]=N.useState(!1);return N.useEffect(()=>{if(u(!1),!(e===null||s))return t.onMessage(y=>{y.type==="terminal.output"&&y.terminalId===e&&u(!0)})},[t,e,s]),l&&!s}const QT=200,xm="agent-workbench.files.hidden";function JT(t,e){const[s,l]=N.useState(new Map),[u,y]=N.useState(new Set),[b,i]=N.useState(new Set),[a,g]=N.useState(""),[_,h]=N.useState(null),[k,T]=N.useState(!1),[M,w]=N.useState(()=>Dt(xm,!1,E=>E==="true"?!0:E==="false"?!1:null)),d=N.useRef(new Set),m=N.useRef(M);m.current=M;const p=N.useCallback(E=>{e===null||d.current.has(E)||(d.current.add(E),i(R=>new Set(R).add(E)),t.send({type:"files.list",terminalId:e,path:E,includeHidden:m.current}))},[t,e]);N.useEffect(()=>{if(l(new Map),y(new Set),i(new Set),g(""),h(null),T(!1),d.current=new Set,e===null)return;const E=t.onMessage(S=>{switch(S.type){case"files.listing":{if(S.terminalId!==e)break;const{listing:L}=S;d.current.delete(L.path),l(I=>new Map(I).set(L.path,L)),i(I=>{const P=new Set(I);return P.delete(L.path),P});break}case"files.results":if(S.terminalId!==e)break;h(S.result),T(!1);break;case"error":d.current=new Set,i(new Set),T(!1);break}});t.send({type:"files.list",terminalId:e,path:"",includeHidden:m.current}),d.current.add(""),i(new Set([""]));const R=t.onReopen(()=>{d.current=new Set,t.send({type:"files.list",terminalId:e,path:"",includeHidden:m.current})});return()=>{E(),R()}},[t,e]),N.useEffect(()=>{const E=a.trim();if(e===null||E.length===0){h(null),T(!1);return}T(!0);const R=window.setTimeout(()=>{t.send({type:"files.search",terminalId:e,query:E,includeHidden:m.current})},QT);return()=>window.clearTimeout(R)},[t,e,a,M]);const f=N.useCallback(E=>{y(R=>{const S=new Set(R);return S.has(E)?S.delete(E):(S.add(E),p(E)),S})},[p]),x=N.useCallback(()=>{if(e===null)return;d.current=new Set;const E=["",...u];for(const R of E)d.current.add(R),t.send({type:"files.list",terminalId:e,path:R,includeHidden:m.current});i(new Set(E))},[t,e,u]),j=N.useCallback(()=>{w(E=>{const R=!E;if(m.current=R,Tt(xm,String(R)),e!==null){d.current=new Set;const S=["",...u];for(const L of S)d.current.add(L),t.send({type:"files.list",terminalId:e,path:L,includeHidden:R});i(new Set(S))}return R})},[t,e,u]);return{listings:s,expanded:u,loading:b,query:a,setQuery:g,results:_,searching:k,showHidden:M,toggleHidden:j,toggleDirectory:f,refresh:x}}function ZT(t){const[e,s]=N.useState(!1),[l,u]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),g=N.useRef(null);N.useEffect(()=>{const k=t.onMessage(M=>{switch(M.type){case"search.progress":if(g.current===null||M.searchId!==g.current)break;u(w=>Vx(w,M.progress));break;case"search.results":if(g.current===null||M.searchId!==g.current)break;g.current=null,u(M.result),b(null),s(!1);break;case"error":if(M.code!=="search-failed"||g.current===null||M.requestId!==g.current)break;g.current=null,M.detail!==void 0&&console.error("[servidor]",M.detail),u(null),b(At(M.text)),s(!1);break}}),T=t.onReopen(()=>{g.current!==null&&(g.current=null,s(!1),b(v("searchHook.connectionLost")))});return()=>{k(),T()}},[t]);const _=N.useCallback((k,T)=>{const M=crypto.randomUUID();g.current=M,a({query:k,includeArchived:T}),s(!0),b(null),u(null),t.send({type:"search.global",searchId:M,query:k,includeArchived:T})},[t]),h=N.useCallback(()=>{const k=g.current;g.current=null,k!==null&&t.send({type:"search.cancel",searchId:k}),a(null),s(!1),u(null),b(null)},[t]);return{searching:e,result:l,error:y,submitted:i,search:_,clear:h}}function eL(t,e){const[s,l]=N.useState([]),[u,y]=N.useState(null);return N.useEffect(()=>{if(l([]),y(null),e!==null)return t.onMessage(b=>{switch(b.type){case"conversation.plans":if(b.terminalId!==e)break;l(b.plans),y(e);break}})},[t,e]),{plans:s,listFor:u}}const n_=8,r_=1024,tL=300,nL=["file","plan"],La={docs:[],active:null,recent:[]},$o={};function Na(t,e){return[...t.filter(s=>s!==e),e]}function rL(t,e,s=new Set){const l=t.docs.find(b=>b.key===e.key);if(l!==void 0)return{docs:l.title===e.title?t.docs:t.docs.map(i=>i.key===e.key?{...i,title:e.title}:i),active:e.key,recent:Na(t.recent,e.key)};let u=[...t.docs,{key:e.key,title:e.title}],y=Na(t.recent,e.key);for(;u.length>n_;){const b=y.find(i=>i!==e.key&&!s.has(i));if(b===void 0)break;u=u.filter(i=>i.key!==b),y=y.filter(i=>i!==b)}return{docs:u,active:e.key,recent:y}}function Em(t,e){return t.docs.some(s=>s.key===e)?{...t,active:e,recent:Na(t.recent,e)}:t}function sL(t){return t.active===null?t:{...t,active:null}}function iL(t,e){const s=t.docs.findIndex(b=>b.key===e);if(s===-1)return t;const l=t.docs.filter(b=>b.key!==e),u=t.recent.filter(b=>b!==e);if(t.active!==e)return{docs:l,active:t.active,recent:u};const y=l[s]??l[s-1]??null;return{docs:l,active:y===null?null:y.key,recent:y===null?u:Na(u,y.key)}}function oL(t,e,s){return{...t,docs:t.docs.map(l=>l.key===e?{...l,mode:s}:l)}}function Pu(t,e,s){var l;return((l=t[e])==null?void 0:l[s])??La}function lL(t,e,s,l){const u=t[e]??{file:La,plan:La};return{...t,[e]:{...u,[s]:l}}}function aL(t,e){if(e.length===0)return t;const s=new Set(e),l=Object.keys(t).filter(y=>!s.has(y));if(l.length===0)return t;const u={...t};for(const y of l)delete u[y];return u}function ps(t,e,s){return`${t}\0${e}\0${s}`}function cL(t){const e=new Set;for(const[s,l]of Object.entries(t))for(const u of nL)for(const y of l[u].docs)e.add(ps(s,u,y.key));return e}function uL(t){return JSON.stringify(t)}function Ra(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function dL(t){const e=Ra(t);if(e===null)return null;const{key:s,title:l,mode:u}=e;if(typeof s!="string"||s.length===0||s.length>r_||typeof l!="string"||l.length>tL)return null;const y={key:s,title:l};return u==="formatted"||u==="source"?{...y,mode:u}:y}function Tm(t){const e=Ra(t);if(e===null||!Array.isArray(e.docs))return La;const s=[];for(const i of e.docs){const a=dL(i);if(a!==null&&!s.some(g=>g.key===a.key)&&s.push(a),s.length===n_)break}const l=s.map(i=>i.key),u=typeof e.active=="string"&&l.includes(e.active)?e.active:null,y=Array.isArray(e.recent)?e.recent.filter(i=>typeof i=="string"&&l.includes(i)):[],b=[...l.filter(i=>!y.includes(i)),...new Set(y)];return{docs:s,active:u,recent:b}}function hL(t){let e;try{e=JSON.parse(t)}catch{return $o}const s=Ra(e);if(s===null)return $o;const l={};for(const[u,y]of Object.entries(s)){const b=Ra(y);if(b===null||u.length===0||u.length>r_)continue;const i=Tm(b.file),a=Tm(b.plan);i.docs.length===0&&a.docs.length===0||(l[u]={file:i,plan:a})}return l}const Lm=1,fL=25e4,s_={kind:"hunk",text:"…",oldLine:null,newLine:null};function md(t){return t.replace(/\r\n?/g,`
|
|
156
|
-
`)}function Nm(t){const e=md(t).split(`
|
|
157
|
-
`);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function pL(t,e){const s=Nm(t),l=Nm(e);let u=0;for(;u<s.length&&u<l.length&&s[u]===l[u];)u+=1;let y=s.length,b=l.length;for(;y>u&&b>u&&s[y-1]===l[b-1];)y-=1,b-=1;if(u===y&&u===b)return[];const i=[];for(let a=0;a<u;a+=1)i.push(gd(s,a,a));mL(s,l,u,y,u,b,i);for(let a=y,g=b;a<s.length;a+=1,g+=1)i.push(gd(s,a,g));return gL(i)}function gd(t,e,s){return{kind:"context",text:t[e]??"",oldLine:e+1,newLine:s+1}}function Ou(t,e){return{kind:"removed",text:t[e]??"",oldLine:e+1,newLine:null}}function Bu(t,e){return{kind:"added",text:t[e]??"",oldLine:null,newLine:e+1}}function mL(t,e,s,l,u,y,b){const i=l-s,a=y-u;if(i===0||a===0||i*a>fL){for(let M=s;M<l;M+=1)b.push(Ou(t,M));for(let M=u;M<y;M+=1)b.push(Bu(e,M));return}const g=a+1,_=new Uint32Array((i+1)*g),h=(M,w)=>_[M*g+w]??0;for(let M=i-1;M>=0;M-=1)for(let w=a-1;w>=0;w-=1)_[M*g+w]=t[s+M]===e[u+w]?h(M+1,w+1)+1:Math.max(h(M+1,w),h(M,w+1));let k=0,T=0;for(;k<i&&T<a;)t[s+k]===e[u+T]?(b.push(gd(t,s+k,u+T)),k+=1,T+=1):h(k+1,T)>=h(k,T+1)?(b.push(Ou(t,s+k)),k+=1):(b.push(Bu(e,u+T)),T+=1);for(;k<i;k+=1)b.push(Ou(t,s+k));for(;T<a;T+=1)b.push(Bu(e,u+T))}function gL(t){const e=t.map(u=>u.kind!=="context"),s=[];let l=-1;return t.forEach((u,y)=>{let b=!1;for(let i=-Lm;i<=Lm&&!b;i+=1)b=e[y+i]===!0;b&&(l!==-1&&y>l+1&&s.push(s_),s.push(u),l=y)}),s}const i_="agent-workbench.docTabs",vL=1600;function _L(){try{const t=window.sessionStorage.getItem(i_);return t===null?$o:hL(t)}catch{return $o}}function Fu(t){return t!==void 0&&(t.text!==t.opened||t.conflict!==null||t.pending!==null)}function wL(t,e,s,l){const[u,y]=N.useState(_L),[b,i]=N.useState(new Map),[a,g]=N.useState(new Map),[_,h]=N.useState(new Set),k=N.useRef(b);k.current=b;const T=N.useRef(a);T.current=a;const M=N.useRef(new Map),w=N.useRef(new Map),d=N.useRef(new Map);N.useEffect(()=>{y(E=>aL(E,e.map(R=>R.terminalId)))},[e]),N.useEffect(()=>{const E=cL(u);for(const R of[...M.current.keys()])E.has(R)||M.current.delete(R);i(R=>{const S=[...R.keys()].filter(I=>!E.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L}),g(R=>{const S=[...R.keys()].filter(I=>!E.has(I));if(S.length===0)return R;const L=new Map(R);for(const I of S)L.delete(I);return L})},[u]),N.useEffect(()=>{try{window.sessionStorage.setItem(i_,uL(u))}catch{}},[u]);const m=N.useMemo(()=>[...a.values()].some(Fu),[a]);N.useEffect(()=>{if(!m)return;const E=R=>{R.preventDefault(),R.returnValue=""};return window.addEventListener("beforeunload",E),()=>window.removeEventListener("beforeunload",E)},[m]),N.useEffect(()=>{const E=d.current;return()=>{for(const R of E.values())window.clearTimeout(R)}},[]);const p=N.useCallback((E,R,S)=>{const L=ps(E,R,S);i(I=>{var P;return new Map(I).set(L,{loaded:((P=I.get(L))==null?void 0:P.loaded)??null,loading:!0,failed:!1})}),R==="file"?t.send({type:"files.read",terminalId:E,path:S}):t.send({type:"plans.read",terminalId:E,fileName:S})},[t]),f=N.useCallback((E,R)=>{g(S=>{const L=S.get(E);if(L===void 0)return S;const I=new Map(S),P=R(L);return P===null?I.delete(E):I.set(E,P),I})},[]),x=N.useCallback(E=>{h(S=>new Set(S).add(E));const R=d.current.get(E);R!==void 0&&window.clearTimeout(R),d.current.set(E,window.setTimeout(()=>{d.current.delete(E),h(S=>{if(!S.has(E))return S;const L=new Set(S);return L.delete(E),L})},vL))},[]);N.useEffect(()=>{const E=(L,I)=>i(P=>P.has(L)?new Map(P).set(L,{loaded:I,loading:!1,failed:!1}):P),R=t.onMessage(L=>{switch(L.type){case"files.preview":E(ps(L.terminalId,"file",L.preview.path),{kind:"file",preview:L.preview});break;case"plans.content":E(ps(L.terminalId,"plan",L.plan.fileName),{kind:"plan",plan:L.plan});break;case"files.saved":{const I=w.current.get(L.requestId);if(I===void 0)break;w.current.delete(L.requestId);const{id:P}=I,{preview:D}=L;if(D!==null&&E(P,{kind:"file",preview:D}),L.outcome==="saved")f(P,()=>null),x(P);else{const F=D!==null&&D.editable===!0?D:null;f(P,W=>({...W,saving:!1,conflict:{next:F}}))}break}case"error":{const I=L.requestId===void 0?void 0:w.current.get(L.requestId);if(I!==void 0&&L.requestId!==void 0){w.current.delete(L.requestId),f(I.id,P=>({...P,saving:!1,failure:{kind:"server",text:L.text}}));break}i(P=>{if(![...P.values()].some(F=>F.loading))return P;const D=new Map;for(const[F,W]of P)D.set(F,W.loading?{...W,loading:!1,failed:!0}:W);return D});break}}}),S=t.onReopen(()=>{for(const[L,I]of k.current){if(!I.loading)continue;const[P,D,F]=L.split("\0");P===void 0||F===void 0||(D==="file"&&t.send({type:"files.read",terminalId:P,path:F}),D==="plan"&&t.send({type:"plans.read",terminalId:P,fileName:F}))}for(const[L,I]of w.current){if(!I.sent){I.sent=!0;continue}w.current.delete(L),f(I.id,P=>({...P,saving:!1,failure:{kind:"lost"}}))}});return()=>{R(),S()}},[t,f,x]);const j=N.useCallback(E=>{const R=s,S=R===null?Pu($o,"",E):Pu(u,R,E),L=$=>R===null?null:ps(R,E,$),I=$=>{R!==null&&y(Y=>lL(Y,R,E,$(Pu(Y,R,E))))},P=$=>{const Y=L($);return Y!==null&&Fu(a.get(Y))},D=()=>new Set(S.docs.filter($=>P($.key)).map($=>$.key)),F=$=>I(Y=>iL(Y,$)),W=$=>{const Y=L($);if(E!=="file"||!l||R===null||Y===null)return null;const G=a.get(Y)??null;return{edit:G,unsaved:Fu(G??void 0),justSaved:_.has(Y),begin:()=>{var H;const V=(H=b.get(Y))==null?void 0:H.loaded;if((V==null?void 0:V.kind)!=="file"||V.preview.editable!==!0||V.preview.hash===void 0)return;const{hash:B}=V.preview,U=md(V.preview.text);g(z=>z.has(Y)?z:new Map(z).set(Y,{opened:U,baseHash:B,text:U,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:V=>f(Y,B=>B.conflict!==null?B:{...B,text:V,failure:null}),save:()=>{const V=T.current.get(Y);if(V===void 0||V.saving||V.conflict!==null||V.text===V.opened)return;const B=crypto.randomUUID(),U=t.send({type:"files.write",terminalId:R,requestId:B,path:$,text:V.text,baseHash:V.baseHash});w.current.set(B,{id:Y,sent:U}),f(Y,H=>({...H,saving:!0,failure:null}))},discard:()=>{const V=T.current.get(Y);f(Y,()=>null),V!==void 0&&V.conflict!==null&&V.conflict.next===null&&p(R,E,$)},adopt:()=>f(Y,V=>{var Z;const B=((Z=V.conflict)==null?void 0:Z.next)??null;if(B===null||B.hash===void 0)return V;const U=pL(V.opened,V.text),H=U.length===0?V.pending:V.pending===null?U:[...V.pending,s_,...U],z=md(B.text);return{...V,opened:z,baseHash:B.hash,text:z,failure:null,conflict:null,pending:H,closing:!1}}),dismissPending:()=>f(Y,V=>({...V,pending:null})),confirmClose:()=>{f(Y,()=>null),F($)},keepEditing:()=>f(Y,V=>({...V,closing:!1}))}};return{terminalId:R,docs:S.docs,active:S.active,open:$=>{if(R===null)return;const Y=D();I(G=>rL(G,$,Y)),p(R,E,$.key)},select:$=>I(Y=>Em(Y,$)),showList:()=>I(sL),close:F,requestClose:$=>{const Y=L($);if(Y===null||!P($)){F($);return}I(G=>Em(G,$)),f(Y,G=>({...G,closing:!0}))},setMode:($,Y)=>I(G=>oL(G,$,Y)),content:$=>R===null?void 0:b.get(ps(R,E,$)),reload:$=>{R!==null&&p(R,E,$)},rememberScroll:($,Y)=>{R!==null&&M.current.set(ps(R,E,$),Y)},scrollOf:$=>R===null?void 0:M.current.get(ps(R,E,$)),editorFor:W,unsaved:P}},[s,u,b,a,_,l,t,p,f]);return N.useMemo(()=>({files:j("file"),plans:j("plan")}),[j])}const bL=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,yL=/[\n\r\t*?<>|"`]/,kL=/\.[A-Za-z0-9_-]{1,12}$/,o_=t=>t.replace(/\\/g,"/"),CL=t=>t.replace(/\/+$/,"");function Rm(t,e){const s=CL(o_(e.cwd));return s.length===0?null:(e.platform==="win32"?t.toLowerCase().startsWith(`${s.toLowerCase()}/`):t.startsWith(`${s}/`))?t.slice(s.length+1):null}function Hd(t,e){let s=t.trim();const l=/^(["'])(.*)\1$/.exec(s);if(l!==null&&(s=(l[2]??"").trim()),s.startsWith("@")&&(s=s.slice(1)),s.length===0||s.length>uy||yL.test(s)||s.includes("://")||s.startsWith("~")||s.startsWith("-")||(s=o_(s.replace(bL,"")).replace(/[.,;:]+$/,""),s.length===0))return null;const u=e.platform==="win32";if(/^[A-Za-z]:\//.test(s)||s.startsWith("//")){const a=u?Rm(s,e):null;if(a===null)return null;s=a}else if(s.startsWith("/")){const a=u?null:Rm(s,e);if(a===null)return null;s=a}const y=s.endsWith("/"),b=[];for(const a of s.split("/"))if(!(a===""||a===".")){if(a===".."){if(b.length===0)return null;b.pop();continue}if(a.includes(":")||a!==a.trim())return null;b.push(a)}const i=b[b.length-1];return i===void 0||b.length===1&&!kL.test(i)&&!y?null:b.join("/")}function l_(t,e){var u;const s=((u=t.split("#")[0])==null?void 0:u.split("?")[0])??"";if(s.length===0)return null;let l;try{l=decodeURIComponent(s)}catch{return null}return/^[a-z][a-z0-9+.-]+:/i.test(l)?null:Hd(l,e)}const SL=/`([^`\n]+)`/g,xL=/\]\(([^)\s]+)\)/g;function EL(t,e){const s=new Set;for(const l of t.matchAll(SL)){const u=Hd(l[1]??"",e);u!==null&&s.add(u)}for(const l of t.matchAll(xL)){const u=l_(l[1]??"",e);u!==null&&s.add(u)}return[...s]}function TL(t,e,s){return t.filter(l=>(e.get(l)??null)===null&&!s.has(l))}function LL(t,e,s,l=[]){const u=new Set(s),y=new Set(l),b=new Map(t);for(const i of e)b.set(i,u.has(i)?"file":y.has(i)?"directory":null);return b}const NL=1e3;function RL(t){const{connection:e,enabled:s,terminalId:l,cwd:u,platform:y,events:b,liveTerminalIds:i,onOpen:a,onOpenFolder:g}=t,_=N.useRef(new Map),h=N.useRef(new Map),k=N.useRef(0),[T,M]=N.useState(0),[w,d]=N.useState(0),m=N.useMemo(()=>({cwd:u,platform:y}),[u,y]);return N.useEffect(()=>{const p=e.onMessage(x=>{if(x.type!=="files.checked")return;const j=h.current.get(x.requestId);if(j===void 0)return;h.current.delete(x.requestId);const E=_.current.get(j.terminalId);if(E!==void 0){for(const R of j.paths)E.pending.delete(R);E.known=LL(E.known,j.paths,x.existing,x.directories),M(R=>R+1)}}),f=e.onReopen(()=>{h.current.clear();for(const x of _.current.values())x.pending.clear(),x.scanned=new WeakSet;d(x=>x+1)});return()=>{p(),f()}},[e]),N.useEffect(()=>{const p=new Set(i);for(const f of[..._.current.keys()])p.has(f)||_.current.delete(f)},[i]),N.useEffect(()=>{if(!s||l===null||u.length===0)return;let p=_.current.get(l);p===void 0&&(p={known:new Map,pending:new Set,scanned:new WeakSet},_.current.set(l,p));const f=new Set;for(const j of b)if(!p.scanned.has(j)&&(p.scanned.add(j),j.role==="assistant")){for(const E of j.parts)if(E.kind==="text")for(const R of EL(E.text,m))f.add(R)}const x=TL([...f],p.known,p.pending).slice(0,NL);for(let j=0;j<x.length;j+=up){const E=x.slice(j,j+up);k.current+=1;const R=`files-${k.current}`;h.current.set(R,{terminalId:l,paths:E});for(const S of E)p.pending.add(S);e.send({type:"files.check",terminalId:l,requestId:R,paths:E})}},[e,s,l,u,m,b,w]),N.useMemo(()=>{var x;if(!s||l===null)return null;const p=(x=_.current.get(l))==null?void 0:x.known,f=j=>{if(j===null)return null;const E=(p==null?void 0:p.get(j))??null;return E==="file"?{open:()=>a(j),folder:!1}:E==="directory"&&g!==null?{open:()=>g(j),folder:!0}:null};return{code:j=>f(Hd(j,m)),link:j=>{var E;return((E=f(l_(j,m)))==null?void 0:E.open)??null}}},[s,l,m,a,g,T])}function ML(t,e){const[s,l]=N.useState(mu),[u,y]=N.useState(null),[b,i]=N.useState(!1);N.useEffect(()=>{if(e===null){l(mu),y(null);return}l(mu),y(null),i(!1);const h=t.onMessage(T=>{switch(T.type){case"git.status":T.terminalId===e&&l(T.status);break;case"git.diff":if(T.terminalId!==e)break;y(T.diff),i(!1);break;case"error":i(!1);break}});t.send({type:"git.subscribe",terminalId:e});const k=t.onReopen(()=>{t.send({type:"git.subscribe",terminalId:e})});return()=>{h(),k(),t.send({type:"git.unsubscribe",terminalId:e})}},[t,e]);const a=N.useCallback((h,k)=>{e!==null&&(i(!0),y(null),t.send({type:"git.diff",terminalId:e,path:h,staged:k}))},[t,e]),g=N.useCallback(()=>{y(null),i(!1)},[]),_=N.useCallback(()=>{e!==null&&t.send({type:"git.refresh",terminalId:e})},[t,e]);return{status:s,diff:u,loadingDiff:b,openDiff:a,closeDiff:g,refresh:_}}const vd=new Set;function AL(t){return t!==void 0&&vd.has(t)}function IL(t){return t.length===0?v("memory.result.nothingChanged"):v("memory.result.installed",{count:t.length})}function jL(t,e){const s=t.length===0?v("memory.result.nothingImported"):v("memory.result.imported",{count:t.length});return e.length===0?s:v("memory.result.withSkipped",{result:s,skipped:v("memory.result.skipped",{count:e.length,files:e.join(", ")})})}function DL(t,e){const[s,l]=N.useState(null),[u,y]=N.useState(null),[b,i]=N.useState(null),[a,g]=N.useState(null),[_,h]=N.useState(null),[k,T]=N.useState(null),[M,w]=N.useState(null),d=N.useRef(new Map),m=N.useRef(new Set),p=N.useRef(null),f=N.useRef(!1),x=N.useCallback(W=>{const $=`memory-${crypto.randomUUID()}`;return d.current.set($,W),m.current.add($),vd.add($),$},[]),j=N.useCallback(W=>{for(const[$,Y]of d.current)Y===W&&d.current.delete($)},[]);N.useEffect(()=>{l(null),y(null),i(null),g(null),h(null),T(null),w(null),d.current.clear();for(const B of m.current)vd.delete(B);if(m.current.clear(),p.current=null,f.current=!1,e===null)return;const W=(B,U)=>B===void 0||d.current.get(B)!==U?!1:(d.current.delete(B),!0),$=t.onMessage(B=>{switch(B.type){case"memory.status":if(B.terminalId!==e)break;l(B.status),f.current&&(f.current=!1,w(null));break;case"memory.planned":if(B.terminalId!==e||!W(B.requestId,"plan"))break;g(B.changes),h(null);break;case"memory.installed":if(B.terminalId!==e||!W(B.requestId,"install"))break;p.current=null,g(null),h(null),T(IL(B.applied));break;case"memory.imported":if(B.terminalId!==e||!W(B.requestId,"import"))break;h(null),T(jL(B.copied,B.skipped));break;case"memory.content":if(B.terminalId!==e||!W(B.requestId,"read"))break;y(B.note),i(null);break;case"error":{const U=B.requestId,H=U===void 0?void 0:d.current.get(U);if(U===void 0||H===void 0)break;d.current.delete(U),H==="read"?i(null):H!=="subscribe"&&h(null),w(At(B.text)),f.current=H==="subscribe";break}}}),Y=t.onStatus(B=>{if(B!=="reconnecting"&&B!=="failed")return;const U=new Set(d.current.values());d.current.clear(),h(null),i(null),(U.has("install")||U.has("import"))&&(p.current=null,g(null),w(v("memory.error.connectionLost")))}),G=()=>{t.send({type:"memory.subscribe",terminalId:e,requestId:x("subscribe")})};G();const V=t.onReopen(G);return()=>{$(),Y(),V(),t.send({type:"memory.unsubscribe",terminalId:e})}},[t,e,x]);const E=N.useCallback(()=>{f.current=!1,w(null),T(null)},[]),R=N.useCallback(W=>{e!==null&&(j("read"),E(),i(W),y(null),t.send({type:"memory.read",terminalId:e,name:W,requestId:x("read")}))},[t,e,E,j,x]),S=N.useCallback(()=>{j("read"),y(null),i(null)},[j]),L=N.useCallback(W=>{e!==null&&(E(),p.current=W,g(null),h("plan"),t.send({type:"memory.plan",terminalId:e,options:W,requestId:x("plan")}))},[t,e,E,x]),I=N.useCallback(()=>{const W=p.current;e===null||W===null||(E(),h("install"),t.send({type:"memory.install",terminalId:e,options:W,requestId:x("install")}))},[t,e,E,x]),P=N.useCallback(()=>{e!==null&&(E(),h("import"),t.send({type:"memory.import",terminalId:e,requestId:x("import")}))},[t,e,E,x]),D=N.useCallback(()=>{j("plan"),p.current=null,g(null)},[j]),F=N.useCallback(()=>{f.current=!1,w(null),T(null)},[]);return{status:s,open:u,loading:b,planned:a,busy:_,lastResult:k,error:M,openNote:R,closeNote:S,requestPlan:L,install:I,importNative:P,cancelPlan:D,dismissMessage:F}}function PL(t){const[e,s]=N.useState([]),[l,u]=N.useState({}),[y,b]=N.useState(null),i=N.useRef(new Set);N.useEffect(()=>{const d=t.onMessage(p=>{switch(p.type){case"notes.list":s(p.notes);break;case"notes.imageData":i.current.add(p.imageId),u(f=>({...f,[p.imageId]:p.data===null?null:`data:${p.mediaType};base64,${p.data}`}));break;case"error":p.code==="notes-failed"&&b(At(p.text));break}}),m=t.onReopen(()=>{i.current.clear()});return()=>{d(),m()}},[t]);const a=N.useCallback(d=>{i.current.has(d)||(i.current.add(d),t.send({type:"notes.image",imageId:d}))},[t]),g=N.useCallback(()=>{const d=crypto.randomUUID(),m=Date.now();return s(p=>[...p,{noteId:d,text:"",images:[],createdAt:m,updatedAt:m}]),t.send({type:"notes.create",noteId:d}),d},[t]),_=N.useCallback((d,m)=>{s(p=>p.map(f=>f.noteId===d?{...f,text:m,updatedAt:Date.now()}:f)),t.send({type:"notes.update",noteId:d,text:m})},[t]),h=N.useCallback(d=>{s(m=>m.filter(p=>p.noteId!==d)),t.send({type:"notes.delete",noteId:d})},[t]),k=N.useCallback((d,m)=>{const p=e.find(x=>x.noteId===d);if(p!==void 0&&p.images.length>=lp){b(v("notes.tooManyImages",{count:lp}));return}if(m.size>qs){b(v("notes.imageTooBig",{name:m.name||v("notes.imageFallbackName"),size:Math.round(m.size/1024/1024),max:qs/1024/1024}));return}const f=new FileReader;f.onload=()=>{const x=f.result;if(typeof x!="string")return;const j=x.indexOf(",");j!==-1&&t.send({type:"notes.addImage",noteId:d,image:{mediaType:m.type,data:x.slice(j+1)}})},f.onerror=()=>b(v("notes.readFailed")),f.readAsDataURL(m)},[t,e]),T=N.useCallback((d,m)=>{s(p=>p.map(f=>f.noteId===d?{...f,images:f.images.filter(x=>x.imageId!==m)}:f)),t.send({type:"notes.removeImage",noteId:d,imageId:m})},[t]),M=N.useCallback((d,m)=>{t.send({type:"notes.send",noteId:d,terminalId:m})},[t]),w=N.useCallback(()=>b(null),[]);return{notes:e,images:l,problem:y,requestImage:a,create:g,updateText:_,remove:h,addImage:k,removeImage:T,sendToAgent:M,dismissProblem:w}}function OL(t){const[e,s]=N.useState([]);return N.useEffect(()=>t.onMessage(l=>{l.type==="plan.limits"&&s(l.limits)}),[t]),e}const a_="agent-workbench.theme",Hu=["system","light","dark"],BL={system:"theme.system",light:"theme.light",dark:"theme.dark"};function Mm(t){return v("theme.title",{theme:v(BL[t])})}const Am={system:"◐",light:"☀",dark:"☾"};function FL(){return Dt(a_,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function HL(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function UL(){const[t,e]=N.useState(FL),[s,l]=N.useState(HL);N.useEffect(()=>{const b=window.matchMedia("(prefers-color-scheme: dark)"),i=a=>l(a.matches);return b.addEventListener("change",i),()=>b.removeEventListener("change",i)},[]);const u=t==="system"?s?"dark":"light":t;N.useEffect(()=>{document.documentElement.dataset.theme=u,document.documentElement.style.colorScheme=u},[u]);const y=N.useCallback(()=>{e(b=>{const i=Hu[(Hu.indexOf(b)+1)%Hu.length]??"system";return Tt(a_,i),i})},[]);return{preference:t,resolved:u,cycle:y}}const Im="agent-workbench.terminalTheme";function $L(t){return t==="dark"||t==="follow"?t:null}function WL(t,e){return t==="follow"?e:"dark"}function zL(t){const[e,s]=N.useState(()=>Dt(Im,"dark",$L)),l=WL(e,t);N.useEffect(()=>{document.documentElement.dataset.terminalTheme=l},[l]);const u=N.useCallback(y=>{Tt(Im,y),s(y)},[]);return{preference:e,resolved:l,setPreference:u}}const qL=1500;function VL(t,e){return t===void 0||t===e?null:e==="waiting"?"attention":e==="idle"&&t==="busy"?"done":null}function KL(t,e){const s={now:[],later:[],cancel:[]};for(const[l,u]of e){const y=t.get(l);if(y===u)continue;s.cancel.push(l);const b=VL(y,u);b==="attention"?s.now.push(l):b==="done"&&s.later.push(l)}for(const l of t.keys())e.has(l)||s.cancel.push(l);return s}const jm="agent-workbench.phone-chime";function GL(t){return t==="system"||t==="page"?t:null}function YL(t){return`agentworkbench://chime?source=${t}`}function XL(t,e,s,l){return t?e==="page"?Ia:null:s?Go(l):null}const Dm="agent-workbench.sound";function QL(t){return t==="on"?!0:t==="off"?!1:null}function JL(t){return v(t?"sound.on":"sound.off")}function ZL(t,e){return t&&e>0}const e5={done:[{frequency:880,at:0,duration:.18},{frequency:659.25,at:.14,duration:.28}],attention:[{frequency:659.25,at:0,duration:.18},{frequency:987.77,at:.14,duration:.28}]},c_=.02,Ia=.8,u_=.2,Pm="agent-workbench.sound-volume";function Go(t){return Math.min(Ia,Math.max(c_,t))}function t5(t){if(t.trim().length===0)return null;const e=Number(t);return Number.isFinite(e)?Go(e):null}function n5(t){return Math.round(Go(t)/Ia*100)}class r5{constructor(){Wt(this,"context",null);Wt(this,"volume",u_)}unlock(){typeof window>"u"||typeof window.AudioContext!="function"||(this.context??(this.context=new window.AudioContext),this.context.state==="suspended"&&this.context.resume().catch(()=>{}))}get ready(){var e;return((e=this.context)==null?void 0:e.state)==="running"}play(e){const s=this.context;if(s===null||s.state!=="running")return;const l=s.currentTime+.01;for(const u of e5[e]){const y=s.createOscillator(),b=s.createGain();y.type="sine",y.frequency.value=u.frequency;const i=l+u.at;b.gain.setValueAtTime(1e-4,i),b.gain.exponentialRampToValueAtTime(Go(this.volume),i+.012),b.gain.exponentialRampToValueAtTime(1e-4,i+u.duration),y.connect(b),b.connect(s.destination),y.start(i),y.stop(i+u.duration+.02)}}}const Uu="agent-workbench.notify";function s5(t){return t==="on"?!0:t==="off"?!1:null}function i5(t,e,s){return t&&e==="granted"&&!s}function o5(t,e){return v(e==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function l5(t,e){return t==="attention"?v("notify.attention",{tab:e}):v("notify.done",{tab:e})}function Om(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(e=>e.length>0).pop()??t.cwd}function Po(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function a5(){if(Po()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return Po()}}function c5(){return document.visibilityState==="visible"&&document.hasFocus()}function u5(t){try{const e=new Notification("Agent Workbench",{body:l5(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});e.onclick=()=>{window.focus(),t.onClick(),e.close()}}catch{}}function d5(t,e){const[s,l]=N.useState(()=>Dt(Dm,!0,QL)),u=N.useRef(s);u.current=s;const[y,b]=N.useState(()=>Dt(Pm,u_,t5)),i=N.useRef(y);i.current=y;const[a]=N.useState(()=>typeof navigator<"u"&&ev(navigator.userAgent)),[g,_]=N.useState(()=>Dt(jm,"system",GL)),h=N.useRef(g);h.current=g;const[k,T]=N.useState(()=>Po()),[M,w]=N.useState(()=>Dt(Uu,!1,s5)),d=N.useRef(M);d.current=M;const m=N.useRef(e);m.current=e;const p=N.useCallback((U,H)=>{i5(d.current,Po(),c5())&&u5({chime:U,terminalId:H,tabName:m.current.nameOf(H),onClick:()=>m.current.activate(H)})},[]),f=N.useRef(null),x=N.useRef(new Map),j=N.useRef(new Map),[E,R]=N.useState(()=>new Set),S=N.useRef(new Map),L=N.useRef(new Set),I=N.useCallback(U=>L.current.delete(U),[]),P=N.useCallback(U=>{L.current.add(U);const H=S.current,z=H.get(U);z!==void 0&&window.clearTimeout(z),R(Z=>Z.has(U)?Z:new Set(Z).add(U)),H.set(U,window.setTimeout(()=>{H.delete(U),R(Z=>{if(!Z.has(U))return Z;const ie=new Set(Z);return ie.delete(U),ie})},_v))},[]),D=N.useCallback(U=>{const H=f.current,z=XL(a,h.current,u.current,i.current);H===null||z===null||(H.volume=z,H.play(U))},[a]);N.useEffect(()=>{const U=new r5;U.volume=i.current,f.current=U;const H=()=>{U.unlock(),U.ready&&(window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H))};return window.addEventListener("pointerdown",H),window.addEventListener("keydown",H),()=>{window.removeEventListener("pointerdown",H),window.removeEventListener("keydown",H),f.current=null}},[]),N.useEffect(()=>{const U=KL(x.current,t);x.current=new Map(t);const H=j.current;for(const z of U.cancel){const Z=H.get(z);Z!==void 0&&(window.clearTimeout(Z),H.delete(z))}U.now.length>0&&D("attention");for(const z of U.now)p("attention",z),P(z);for(const z of U.later)H.set(z,window.setTimeout(()=>{H.delete(z),D("done"),p("done",z),P(z)},qL))},[t,p,D,P]),N.useEffect(()=>{const U=j.current,H=S.current;return()=>{for(const z of U.values())window.clearTimeout(z);U.clear();for(const z of H.values())window.clearTimeout(z);H.clear()}},[]);const F=N.useCallback(()=>{var U,H;l(z=>{const Z=!z;return Tt(Dm,Z?"on":"off"),Z}),u.current||((U=f.current)==null||U.unlock(),(H=f.current)==null||H.play("done"))},[]),W=N.useCallback(U=>{const H=Go(U);b(H),Tt(Pm,String(H)),f.current!==null&&(f.current.volume=H)},[]),$=N.useCallback(()=>{var U,H;u.current&&((U=f.current)==null||U.unlock(),(H=f.current)==null||H.play("done"))},[]),Y=N.useCallback(()=>{if(d.current&&Po()==="granted"){w(!1),Tt(Uu,"off");return}a5().then(U=>{T(U),U==="granted"&&(w(!0),Tt(Uu,"on"))})},[]),G={supported:k!=="unsupported",enabled:M&&k==="granted",permission:k,toggle:Y},V=N.useCallback(U=>{var H;_(U),h.current=U,Tt(jm,U),window.location.href=YL(U),U==="page"&&((H=f.current)==null||H.unlock(),D("done"))},[D]);return{enabled:s,toggle:F,volume:y,setVolume:W,previewVolume:$,notify:G,phoneChime:a?{source:g,setSource:V}:null,attention:E,takeNotice:I}}function d_(t,e,s){const[l,u]=N.useState(()=>Dt(t,e,pS));N.useLayoutEffect(()=>{document.documentElement.dataset[s]=l},[s,l]);const y=N.useCallback(()=>{u(b=>{const i=vv(b);return Tt(t,i),i})},[t]);return{size:l,cycle:y}}function h5(){return d_(uS,gv,"threadFont")}function f5(){return d_(dS,hS,"notesFont")}function p5(t,e){const[s,l]=N.useState(()=>new Map),[u,y]=N.useState(()=>new Map),b=N.useCallback((a,g,_,h)=>{l(k=>new Map(k).set(a,{requestId:g,terminalId:a,afterEventId:_,phase:"sending",queued:h,sentAt:Date.now(),deliveredAt:null}))},[]);N.useEffect(()=>{const a=t.onMessage(_=>{_.type==="agent.submitted"&&l(h=>o1(h,_,Date.now()))}),g=t.onReopen(()=>l(_=>i1(_,Date.now())));return()=>{a(),g()}},[t]);const i=N.useRef(new Map);return N.useLayoutEffect(()=>{const a=i.current;if(a===e)return;i.current=e;const g=Date.now();y(_=>s1(a,e,_,g))},[e]),{track:b,receipts:s,clocks:u}}const m5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function h_({sound:t}){return o.jsxs("span",{className:"sound-control",children:[o.jsx("button",{className:`icon-button${ZL(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:JL(t.enabled),"aria-pressed":t.enabled,children:"♪"}),t.enabled&&o.jsx("div",{className:"sound-volume",children:o.jsxs("div",{className:"sound-volume-box",children:[o.jsx("input",{className:"sound-volume-slider",type:"range",min:c_,max:Ia,step:.01,value:t.volume,onChange:e=>t.setVolume(Number(e.target.value)),onPointerUp:t.previewVolume,onKeyUp:e=>{m5.has(e.key)&&t.previewVolume()},title:v("sound.volume"),"aria-label":v("sound.volume")}),o.jsxs("span",{className:"sound-volume-value",children:[n5(t.volume),"%"]})]})})]})}function f_({notify:t}){return t.supported?o.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:o5(t.enabled,t.permission),"aria-pressed":t.enabled,children:o.jsx(g5,{})}):null}function g5(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M4 11V7a4 4 0 0 1 8 0v4l1.2 1.5H2.8L4 11zM6.6 14a1.5 1.5 0 0 0 2.8 0",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function v5(t){const[e,s]=N.useState(null),[l,u]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(!1),[g,_]=N.useState(null);N.useEffect(()=>{const x=t.onMessage(E=>{switch(E.type){case"remote.status":s(E.status),E.status.pairingActive||(u(null),b(null));break;case"remote.pairing.code":u(E.pairing),b(null);break;case"remote.phone.pairing":b(E.pairing),u(null);break;case"error":if(E.code!=="remote-failed")break;_(At(E.text)),E.detail!==void 0&&console.error("[servidor]",E.detail);break}}),j=t.onReopen(()=>{u(null),b(null),a(!1)});return()=>{x(),j()}},[t]);const h=N.useCallback(x=>{_(null),t.send({type:"remote.configure",enabled:x})},[t]),k=N.useCallback(x=>{_(null),t.send({type:"remote.configure",port:x})},[t]),T=N.useCallback(()=>{_(null),t.send({type:"remote.pairing.start"})},[t]),M=N.useCallback(()=>{u(null),t.send({type:"remote.pairing.cancel"})},[t]),w=N.useCallback(()=>{_(null),a(!0),t.send({type:"remote.phone.start"})},[t]),d=N.useCallback(()=>{b(null),a(!1),t.send({type:"remote.phone.cancel"})},[t]),m=N.useCallback((x,j)=>{_(null),t.send({type:"remote.device.rename",deviceId:x,label:j})},[t]),p=N.useCallback(x=>{_(null),t.send({type:"remote.device.revoke",deviceId:x})},[t]),f=N.useCallback(()=>_(null),[]);return{status:e,pairing:l,phonePairing:y,phoneStarted:i,problem:g,setEnabled:h,setPort:k,startPairing:T,cancelPairing:M,startPhonePairing:w,cancelPhonePairing:d,renameDevice:m,revokeDevice:p,dismissProblem:f}}const _5="USER";function w5(t,e){const s=t.sshUser.length>0?t.sshUser:_5,l=/\s/.test(s)?`"${s}@${e}"`:`${s}@${e}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${l}`}function p_(t){return`http://localhost:${t}`}function b5(t,e){return`${p_(t)}/?${Qb}=${e}`}function Bm(t){return t[0]??"localhost"}function _d(t,e){switch(t){case"off":return v("remote.state.off");case"active":return v("remote.state.active",{port:e});case"restart-needed":return v("remote.state.restartNeeded");case"port-busy":return v("remote.state.portBusy",{port:e})}}function y5(t){const e=t.trim();if(!/^\d{1,5}$/.test(e))return null;const s=Number(e);return Zb(s)?s:null}function k5(){return v("remote.portInvalid",{min:Cg,max:Sg})}function Fm(t,e){return Math.max(0,Math.ceil((t-e)/1e3))}function Hm(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function C5(t,e=Date.now()){return t.connected?v("remote.device.connected"):t.lastSeenAt===null?v("remote.device.never"):v("remote.device.lastSeen",{when:qn(t.lastSeenAt,e)})}function S5(t,e=Date.now()){return v("remote.device.paired",{when:qn(t.createdAt,e)})}function x5(t){switch(t){case"powershell-admin":return v("remote.phone.authorize.admin");case"powershell":return v("remote.phone.authorize.powershell");case"terminal":return v("remote.phone.authorize.terminal")}}function E5(){return[{platform:"win32",label:"Windows",hint:v("remote.ssh.windows"),command:["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Start-Service sshd","Set-Service -Name sshd -StartupType Automatic"].join(`
|
|
158
|
-
`)},{platform:"darwin",label:"macOS",hint:v("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:v("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
|
|
159
|
-
`)}]}function T5(t){return t==="win32"||t==="darwin"?t:"linux"}function ma(t){return t!==null&&t.state==="active"}function Um(t){return t!==null&&t.state==="active"&&t.devices.length>0}const Pi=function(t,e){let u=t;const y=Do[e];let b=null,i=0,a=null;const g=[],_={},h=function(R,S){i=u*4+17,b=(function(L){const I=new Array(L);for(let P=0;P<L;P+=1){I[P]=new Array(L);for(let D=0;D<L;D+=1)I[P][D]=null}return I})(i),k(0,0),k(i-7,0),k(0,i-7),w(),M(),m(R,S),u>=7&&d(R),a==null&&(a=x(u,y,g)),p(a,S)},k=function(R,S){for(let L=-1;L<=7;L+=1)if(!(R+L<=-1||i<=R+L))for(let I=-1;I<=7;I+=1)S+I<=-1||i<=S+I||(0<=L&&L<=6&&(I==0||I==6)||0<=I&&I<=6&&(L==0||L==6)||2<=L&&L<=4&&2<=I&&I<=4?b[R+L][S+I]=!0:b[R+L][S+I]=!1)},T=function(){let R=0,S=0;for(let L=0;L<8;L+=1){h(!0,L);const I=fs.getLostPoint(_);(L==0||R>I)&&(R=I,S=L)}return S},M=function(){for(let R=8;R<i-8;R+=1)b[R][6]==null&&(b[R][6]=R%2==0);for(let R=8;R<i-8;R+=1)b[6][R]==null&&(b[6][R]=R%2==0)},w=function(){const R=fs.getPatternPosition(u);for(let S=0;S<R.length;S+=1)for(let L=0;L<R.length;L+=1){const I=R[S],P=R[L];if(b[I][P]==null)for(let D=-2;D<=2;D+=1)for(let F=-2;F<=2;F+=1)D==-2||D==2||F==-2||F==2||D==0&&F==0?b[I+D][P+F]=!0:b[I+D][P+F]=!1}},d=function(R){const S=fs.getBCHTypeNumber(u);for(let L=0;L<18;L+=1){const I=!R&&(S>>L&1)==1;b[Math.floor(L/3)][L%3+i-8-3]=I}for(let L=0;L<18;L+=1){const I=!R&&(S>>L&1)==1;b[L%3+i-8-3][Math.floor(L/3)]=I}},m=function(R,S){const L=y<<3|S,I=fs.getBCHTypeInfo(L);for(let P=0;P<15;P+=1){const D=!R&&(I>>P&1)==1;P<6?b[P][8]=D:P<8?b[P+1][8]=D:b[i-15+P][8]=D}for(let P=0;P<15;P+=1){const D=!R&&(I>>P&1)==1;P<8?b[8][i-P-1]=D:P<9?b[8][15-P-1+1]=D:b[8][15-P-1]=D}b[i-8][8]=!R},p=function(R,S){let L=-1,I=i-1,P=7,D=0;const F=fs.getMaskFunction(S);for(let W=i-1;W>0;W-=2)for(W==6&&(W-=1);;){for(let $=0;$<2;$+=1)if(b[I][W-$]==null){let Y=!1;D<R.length&&(Y=(R[D]>>>P&1)==1),F(I,W-$)&&(Y=!Y),b[I][W-$]=Y,P-=1,P==-1&&(D+=1,P=7)}if(I+=L,I<0||i<=I){I-=L,L=-L;break}}},f=function(R,S){let L=0,I=0,P=0;const D=new Array(S.length),F=new Array(S.length);for(let G=0;G<S.length;G+=1){const V=S[G].dataCount,B=S[G].totalCount-V;I=Math.max(I,V),P=Math.max(P,B),D[G]=new Array(V);for(let Z=0;Z<D[G].length;Z+=1)D[G][Z]=255&R.getBuffer()[Z+L];L+=V;const U=fs.getErrorCorrectPolynomial(B),z=Wo(D[G],U.getLength()-1).mod(U);F[G]=new Array(U.getLength()-1);for(let Z=0;Z<F[G].length;Z+=1){const ie=Z+z.getLength()-F[G].length;F[G][Z]=ie>=0?z.getAt(ie):0}}let W=0;for(let G=0;G<S.length;G+=1)W+=S[G].totalCount;const $=new Array(W);let Y=0;for(let G=0;G<I;G+=1)for(let V=0;V<S.length;V+=1)G<D[V].length&&($[Y]=D[V][G],Y+=1);for(let G=0;G<P;G+=1)for(let V=0;V<S.length;V+=1)G<F[V].length&&($[Y]=F[V][G],Y+=1);return $},x=function(R,S,L){const I=$m.getRSBlocks(R,S),P=Wm();for(let F=0;F<L.length;F+=1){const W=L[F];P.put(W.getMode(),4),P.put(W.getLength(),fs.getLengthInBits(W.getMode(),R)),W.write(P)}let D=0;for(let F=0;F<I.length;F+=1)D+=I[F].dataCount;if(P.getLengthInBits()>D*8)throw"code length overflow. ("+P.getLengthInBits()+">"+D*8+")";for(P.getLengthInBits()+4<=D*8&&P.put(0,4);P.getLengthInBits()%8!=0;)P.putBit(!1);for(;!(P.getLengthInBits()>=D*8||(P.put(236,8),P.getLengthInBits()>=D*8));)P.put(17,8);return f(P,I)};_.addData=function(R,S){S=S||"Byte";let L=null;switch(S){case"Numeric":L=L5(R);break;case"Alphanumeric":L=N5(R);break;case"Byte":L=R5(R);break;case"Kanji":L=M5(R);break;default:throw"mode:"+S}g.push(L),a=null},_.isDark=function(R,S){if(R<0||i<=R||S<0||i<=S)throw R+","+S;return b[R][S]},_.getModuleCount=function(){return i},_.make=function(){if(u<1){let R=1;for(;R<40;R++){const S=$m.getRSBlocks(R,y),L=Wm();for(let P=0;P<g.length;P++){const D=g[P];L.put(D.getMode(),4),L.put(D.getLength(),fs.getLengthInBits(D.getMode(),R)),D.write(L)}let I=0;for(let P=0;P<S.length;P++)I+=S[P].dataCount;if(L.getLengthInBits()<=I*8)break}u=R}h(!1,T())},_.createTableTag=function(R,S){R=R||2,S=typeof S>"u"?R*4:S;let L="";L+='<table style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: "+S+"px;",L+='">',L+="<tbody>";for(let I=0;I<_.getModuleCount();I+=1){L+="<tr>";for(let P=0;P<_.getModuleCount();P+=1)L+='<td style="',L+=" border-width: 0px; border-style: none;",L+=" border-collapse: collapse;",L+=" padding: 0px; margin: 0px;",L+=" width: "+R+"px;",L+=" height: "+R+"px;",L+=" background-color: ",L+=_.isDark(I,P)?"#000000":"#ffffff",L+=";",L+='"/>';L+="</tr>"}return L+="</tbody>",L+="</table>",L},_.createSvgTag=function(R,S,L,I){let P={};typeof arguments[0]=="object"&&(P=arguments[0],R=P.cellSize,S=P.margin,L=P.alt,I=P.title),R=R||2,S=typeof S>"u"?R*4:S,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-description":null,I=typeof I=="string"?{text:I}:I||{},I.text=I.text||null,I.id=I.text?I.id||"qrcode-title":null;const D=_.getModuleCount()*R+S*2;let F,W,$,Y,G="",V;for(V="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",G+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',G+=P.scalable?"":' width="'+D+'px" height="'+D+'px"',G+=' viewBox="0 0 '+D+" "+D+'" ',G+=' preserveAspectRatio="xMinYMin meet"',G+=I.text||L.text?' role="img" aria-labelledby="'+j([I.id,L.id].join(" ").trim())+'"':"",G+=">",G+=I.text?'<title id="'+j(I.id)+'">'+j(I.text)+"</title>":"",G+=L.text?'<description id="'+j(L.id)+'">'+j(L.text)+"</description>":"",G+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',G+='<path d="',$=0;$<_.getModuleCount();$+=1)for(Y=$*R+S,F=0;F<_.getModuleCount();F+=1)_.isDark($,F)&&(W=F*R+S,G+="M"+W+","+Y+V);return G+='" stroke="transparent" fill="black"/>',G+="</svg>",G},_.createDataURL=function(R,S){R=R||2,S=typeof S>"u"?R*4:S;const L=_.getModuleCount()*R+S*2,I=S,P=L-S;return D5(L,L,function(D,F){if(I<=D&&D<P&&I<=F&&F<P){const W=Math.floor((D-I)/R),$=Math.floor((F-I)/R);return _.isDark($,W)?0:1}else return 1})},_.createImgTag=function(R,S,L){R=R||2,S=typeof S>"u"?R*4:S;const I=_.getModuleCount()*R+S*2;let P="";return P+="<img",P+=' src="',P+=_.createDataURL(R,S),P+='"',P+=' width="',P+=I,P+='"',P+=' height="',P+=I,P+='"',L&&(P+=' alt="',P+=j(L),P+='"'),P+="/>",P};const j=function(R){let S="";for(let L=0;L<R.length;L+=1){const I=R.charAt(L);switch(I){case"<":S+="<";break;case">":S+=">";break;case"&":S+="&";break;case'"':S+=""";break;default:S+=I;break}}return S},E=function(R){R=typeof R>"u"?2:R;const L=_.getModuleCount()*1+R*2,I=R,P=L-R;let D,F,W,$,Y;const G={"██":"█","█ ":"▀"," █":"▄"," ":" "},V={"██":"▀","█ ":"▀"," █":" "," ":" "};let B="";for(D=0;D<L;D+=2){for(W=Math.floor((D-I)/1),$=Math.floor((D+1-I)/1),F=0;F<L;F+=1)Y="█",I<=F&&F<P&&I<=D&&D<P&&_.isDark(W,Math.floor((F-I)/1))&&(Y=" "),I<=F&&F<P&&I<=D+1&&D+1<P&&_.isDark($,Math.floor((F-I)/1))?Y+=" ":Y+="█",B+=R<1&&D+1>=P?V[Y]:G[Y];B+=`
|
|
160
|
-
`}return L%2&&R>0?B.substring(0,B.length-L-1)+Array(L+1).join("▀"):B.substring(0,B.length-1)};return _.createASCII=function(R,S){if(R=R||1,R<2)return E(S);R-=1,S=typeof S>"u"?R*2:S;const L=_.getModuleCount()*R+S*2,I=S,P=L-S;let D,F,W,$;const Y=Array(R+1).join("██"),G=Array(R+1).join(" ");let V="",B="";for(D=0;D<L;D+=1){for(W=Math.floor((D-I)/R),B="",F=0;F<L;F+=1)$=1,I<=F&&F<P&&I<=D&&D<P&&_.isDark(W,Math.floor((F-I)/R))&&($=0),B+=$?Y:G;for(W=0;W<R;W+=1)V+=B+`
|
|
161
|
-
`}return V.substring(0,V.length-1)},_.renderTo2dContext=function(R,S){S=S||2;const L=_.getModuleCount();for(let I=0;I<L;I++)for(let P=0;P<L;P++)R.fillStyle=_.isDark(I,P)?"black":"white",R.fillRect(P*S,I*S,S,S)},_};Pi.stringToBytes=function(t){const e=[];for(let s=0;s<t.length;s+=1){const l=t.charCodeAt(s);e.push(l&255)}return e};Pi.createStringToBytes=function(t,e){const s=(function(){const u=I5(t),y=function(){const a=u.read();if(a==-1)throw"eof";return a};let b=0;const i={};for(;;){const a=u.read();if(a==-1)break;const g=y(),_=y(),h=y(),k=String.fromCharCode(a<<8|g),T=_<<8|h;i[k]=T,b+=1}if(b!=e)throw b+" != "+e;return i})(),l=63;return function(u){const y=[];for(let b=0;b<u.length;b+=1){const i=u.charCodeAt(b);if(i<128)y.push(i);else{const a=s[u.charAt(b)];typeof a=="number"?(a&255)==a?y.push(a):(y.push(a>>>8),y.push(a&255)):y.push(l)}}return y}};const mn={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Do={L:1,M:0,Q:3,H:2},hs={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},fs=(function(){const t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],e=1335,s=7973,l=21522,u={},y=function(b){let i=0;for(;b!=0;)i+=1,b>>>=1;return i};return u.getBCHTypeInfo=function(b){let i=b<<10;for(;y(i)-y(e)>=0;)i^=e<<y(i)-y(e);return(b<<10|i)^l},u.getBCHTypeNumber=function(b){let i=b<<12;for(;y(i)-y(s)>=0;)i^=s<<y(i)-y(s);return b<<12|i},u.getPatternPosition=function(b){return t[b-1]},u.getMaskFunction=function(b){switch(b){case hs.PATTERN000:return function(i,a){return(i+a)%2==0};case hs.PATTERN001:return function(i,a){return i%2==0};case hs.PATTERN010:return function(i,a){return a%3==0};case hs.PATTERN011:return function(i,a){return(i+a)%3==0};case hs.PATTERN100:return function(i,a){return(Math.floor(i/2)+Math.floor(a/3))%2==0};case hs.PATTERN101:return function(i,a){return i*a%2+i*a%3==0};case hs.PATTERN110:return function(i,a){return(i*a%2+i*a%3)%2==0};case hs.PATTERN111:return function(i,a){return(i*a%3+(i+a)%2)%2==0};default:throw"bad maskPattern:"+b}},u.getErrorCorrectPolynomial=function(b){let i=Wo([1],0);for(let a=0;a<b;a+=1)i=i.multiply(Wo([1,ms.gexp(a)],0));return i},u.getLengthInBits=function(b,i){if(1<=i&&i<10)switch(b){case mn.MODE_NUMBER:return 10;case mn.MODE_ALPHA_NUM:return 9;case mn.MODE_8BIT_BYTE:return 8;case mn.MODE_KANJI:return 8;default:throw"mode:"+b}else if(i<27)switch(b){case mn.MODE_NUMBER:return 12;case mn.MODE_ALPHA_NUM:return 11;case mn.MODE_8BIT_BYTE:return 16;case mn.MODE_KANJI:return 10;default:throw"mode:"+b}else if(i<41)switch(b){case mn.MODE_NUMBER:return 14;case mn.MODE_ALPHA_NUM:return 13;case mn.MODE_8BIT_BYTE:return 16;case mn.MODE_KANJI:return 12;default:throw"mode:"+b}else throw"type:"+i},u.getLostPoint=function(b){const i=b.getModuleCount();let a=0;for(let h=0;h<i;h+=1)for(let k=0;k<i;k+=1){let T=0;const M=b.isDark(h,k);for(let w=-1;w<=1;w+=1)if(!(h+w<0||i<=h+w))for(let d=-1;d<=1;d+=1)k+d<0||i<=k+d||w==0&&d==0||M==b.isDark(h+w,k+d)&&(T+=1);T>5&&(a+=3+T-5)}for(let h=0;h<i-1;h+=1)for(let k=0;k<i-1;k+=1){let T=0;b.isDark(h,k)&&(T+=1),b.isDark(h+1,k)&&(T+=1),b.isDark(h,k+1)&&(T+=1),b.isDark(h+1,k+1)&&(T+=1),(T==0||T==4)&&(a+=3)}for(let h=0;h<i;h+=1)for(let k=0;k<i-6;k+=1)b.isDark(h,k)&&!b.isDark(h,k+1)&&b.isDark(h,k+2)&&b.isDark(h,k+3)&&b.isDark(h,k+4)&&!b.isDark(h,k+5)&&b.isDark(h,k+6)&&(a+=40);for(let h=0;h<i;h+=1)for(let k=0;k<i-6;k+=1)b.isDark(k,h)&&!b.isDark(k+1,h)&&b.isDark(k+2,h)&&b.isDark(k+3,h)&&b.isDark(k+4,h)&&!b.isDark(k+5,h)&&b.isDark(k+6,h)&&(a+=40);let g=0;for(let h=0;h<i;h+=1)for(let k=0;k<i;k+=1)b.isDark(k,h)&&(g+=1);const _=Math.abs(100*g/i/i-50)/5;return a+=_*10,a},u})(),ms=(function(){const t=new Array(256),e=new Array(256);for(let l=0;l<8;l+=1)t[l]=1<<l;for(let l=8;l<256;l+=1)t[l]=t[l-4]^t[l-5]^t[l-6]^t[l-8];for(let l=0;l<255;l+=1)e[t[l]]=l;const s={};return s.glog=function(l){if(l<1)throw"glog("+l+")";return e[l]},s.gexp=function(l){for(;l<0;)l+=255;for(;l>=256;)l-=255;return t[l]},s})(),Wo=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;const s=(function(){let u=0;for(;u<t.length&&t[u]==0;)u+=1;const y=new Array(t.length-u+e);for(let b=0;b<t.length-u;b+=1)y[b]=t[b+u];return y})(),l={};return l.getAt=function(u){return s[u]},l.getLength=function(){return s.length},l.multiply=function(u){const y=new Array(l.getLength()+u.getLength()-1);for(let b=0;b<l.getLength();b+=1)for(let i=0;i<u.getLength();i+=1)y[b+i]^=ms.gexp(ms.glog(l.getAt(b))+ms.glog(u.getAt(i)));return Wo(y,0)},l.mod=function(u){if(l.getLength()-u.getLength()<0)return l;const y=ms.glog(l.getAt(0))-ms.glog(u.getAt(0)),b=new Array(l.getLength());for(let i=0;i<l.getLength();i+=1)b[i]=l.getAt(i);for(let i=0;i<u.getLength();i+=1)b[i]^=ms.gexp(ms.glog(u.getAt(i))+y);return Wo(b,0).mod(u)},l},$m=(function(){const t=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12,7,37,13],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],e=function(u,y){const b={};return b.totalCount=u,b.dataCount=y,b},s={},l=function(u,y){switch(y){case Do.L:return t[(u-1)*4+0];case Do.M:return t[(u-1)*4+1];case Do.Q:return t[(u-1)*4+2];case Do.H:return t[(u-1)*4+3];default:return}};return s.getRSBlocks=function(u,y){const b=l(u,y);if(typeof b>"u")throw"bad rs block @ typeNumber:"+u+"/errorCorrectionLevel:"+y;const i=b.length/3,a=[];for(let g=0;g<i;g+=1){const _=b[g*3+0],h=b[g*3+1],k=b[g*3+2];for(let T=0;T<_;T+=1)a.push(e(h,k))}return a},s})(),Wm=function(){const t=[];let e=0;const s={};return s.getBuffer=function(){return t},s.getAt=function(l){const u=Math.floor(l/8);return(t[u]>>>7-l%8&1)==1},s.put=function(l,u){for(let y=0;y<u;y+=1)s.putBit((l>>>u-y-1&1)==1)},s.getLengthInBits=function(){return e},s.putBit=function(l){const u=Math.floor(e/8);t.length<=u&&t.push(0),l&&(t[u]|=128>>>e%8),e+=1},s},L5=function(t){const e=mn.MODE_NUMBER,s=t,l={};l.getMode=function(){return e},l.getLength=function(b){return s.length},l.write=function(b){const i=s;let a=0;for(;a+2<i.length;)b.put(u(i.substring(a,a+3)),10),a+=3;a<i.length&&(i.length-a==1?b.put(u(i.substring(a,a+1)),4):i.length-a==2&&b.put(u(i.substring(a,a+2)),7))};const u=function(b){let i=0;for(let a=0;a<b.length;a+=1)i=i*10+y(b.charAt(a));return i},y=function(b){if("0"<=b&&b<="9")return b.charCodeAt(0)-48;throw"illegal char :"+b};return l},N5=function(t){const e=mn.MODE_ALPHA_NUM,s=t,l={};l.getMode=function(){return e},l.getLength=function(y){return s.length},l.write=function(y){const b=s;let i=0;for(;i+1<b.length;)y.put(u(b.charAt(i))*45+u(b.charAt(i+1)),11),i+=2;i<b.length&&y.put(u(b.charAt(i)),6)};const u=function(y){if("0"<=y&&y<="9")return y.charCodeAt(0)-48;if("A"<=y&&y<="Z")return y.charCodeAt(0)-65+10;switch(y){case" ":return 36;case"$":return 37;case"%":return 38;case"*":return 39;case"+":return 40;case"-":return 41;case".":return 42;case"/":return 43;case":":return 44;default:throw"illegal char :"+y}};return l},R5=function(t){const e=mn.MODE_8BIT_BYTE,s=Pi.stringToBytes(t),l={};return l.getMode=function(){return e},l.getLength=function(u){return s.length},l.write=function(u){for(let y=0;y<s.length;y+=1)u.put(s[y],8)},l},M5=function(t){const e=mn.MODE_KANJI,s=Pi.stringToBytes;(function(y,b){const i=s(y);if(i.length!=2||(i[0]<<8|i[1])!=b)throw"sjis not supported."})("友",38726);const l=s(t),u={};return u.getMode=function(){return e},u.getLength=function(y){return~~(l.length/2)},u.write=function(y){const b=l;let i=0;for(;i+1<b.length;){let a=(255&b[i])<<8|255&b[i+1];if(33088<=a&&a<=40956)a-=33088;else if(57408<=a&&a<=60351)a-=49472;else throw"illegal char at "+(i+1)+"/"+a;a=(a>>>8&255)*192+(a&255),y.put(a,13),i+=2}if(i<b.length)throw"illegal char at "+(i+1)},u},m_=function(){const t=[],e={};return e.writeByte=function(s){t.push(s&255)},e.writeShort=function(s){e.writeByte(s),e.writeByte(s>>>8)},e.writeBytes=function(s,l,u){l=l||0,u=u||s.length;for(let y=0;y<u;y+=1)e.writeByte(s[y+l])},e.writeString=function(s){for(let l=0;l<s.length;l+=1)e.writeByte(s.charCodeAt(l))},e.toByteArray=function(){return t},e.toString=function(){let s="";s+="[";for(let l=0;l<t.length;l+=1)l>0&&(s+=","),s+=t[l];return s+="]",s},e},A5=function(){let t=0,e=0,s=0,l="";const u={},y=function(i){l+=String.fromCharCode(b(i&63))},b=function(i){if(i<0)throw"n:"+i;if(i<26)return 65+i;if(i<52)return 97+(i-26);if(i<62)return 48+(i-52);if(i==62)return 43;if(i==63)return 47;throw"n:"+i};return u.writeByte=function(i){for(t=t<<8|i&255,e+=8,s+=1;e>=6;)y(t>>>e-6),e-=6},u.flush=function(){if(e>0&&(y(t<<6-e),t=0,e=0),s%3!=0){const i=3-s%3;for(let a=0;a<i;a+=1)l+="="}},u.toString=function(){return l},u},I5=function(t){const e=t;let s=0,l=0,u=0;const y={};y.read=function(){for(;u<8;){if(s>=e.length){if(u==0)return-1;throw"unexpected end of file./"+u}const a=e.charAt(s);if(s+=1,a=="=")return u=0,-1;if(a.match(/^\s$/))continue;l=l<<6|b(a.charCodeAt(0)),u+=6}const i=l>>>u-8&255;return u-=8,i};const b=function(i){if(65<=i&&i<=90)return i-65;if(97<=i&&i<=122)return i-97+26;if(48<=i&&i<=57)return i-48+52;if(i==43)return 62;if(i==47)return 63;throw"c:"+i};return y},j5=function(t,e){const s=t,l=e,u=new Array(t*e),y={};y.setPixel=function(g,_,h){u[_*s+g]=h},y.write=function(g){g.writeString("GIF87a"),g.writeShort(s),g.writeShort(l),g.writeByte(128),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(0),g.writeByte(255),g.writeByte(255),g.writeByte(255),g.writeString(","),g.writeShort(0),g.writeShort(0),g.writeShort(s),g.writeShort(l),g.writeByte(0);const _=2,h=i(_);g.writeByte(_);let k=0;for(;h.length-k>255;)g.writeByte(255),g.writeBytes(h,k,255),k+=255;g.writeByte(h.length-k),g.writeBytes(h,k,h.length-k),g.writeByte(0),g.writeString(";")};const b=function(g){const _=g;let h=0,k=0;const T={};return T.write=function(M,w){if(M>>>w)throw"length over";for(;h+w>=8;)_.writeByte(255&(M<<h|k)),w-=8-h,M>>>=8-h,k=0,h=0;k=M<<h|k,h=h+w},T.flush=function(){h>0&&_.writeByte(k)},T},i=function(g){const _=1<<g,h=(1<<g)+1;let k=g+1;const T=a();for(let p=0;p<_;p+=1)T.add(String.fromCharCode(p));T.add(String.fromCharCode(_)),T.add(String.fromCharCode(h));const M=m_(),w=b(M);w.write(_,k);let d=0,m=String.fromCharCode(u[d]);for(d+=1;d<u.length;){const p=String.fromCharCode(u[d]);d+=1,T.contains(m+p)?m=m+p:(w.write(T.indexOf(m),k),T.size()<4095&&(T.size()==1<<k&&(k+=1),T.add(m+p)),m=p)}return w.write(T.indexOf(m),k),w.write(h,k),w.flush(),M.toByteArray()},a=function(){const g={};let _=0;const h={};return h.add=function(k){if(h.contains(k))throw"dup key:"+k;g[k]=_,_+=1},h.size=function(){return _},h.indexOf=function(k){return g[k]},h.contains=function(k){return typeof g[k]<"u"},h};return y},D5=function(t,e,s){const l=j5(t,e);for(let i=0;i<e;i+=1)for(let a=0;a<t;a+=1)l.setPixel(a,i,s(a,i));const u=m_();l.write(u);const y=A5(),b=u.toByteArray();for(let i=0;i<b.length;i+=1)y.writeByte(b[i]);return y.flush(),"data:image/gif;base64,"+y};Pi.stringToBytes;const Io=4;function P5(t){const e=Pi(0,"M");e.addData(t,"Byte"),e.make();const s=e.getModuleCount();let l="";for(let u=0;u<s;u++){let y=0;for(;y<s;){if(!e.isDark(u,y)){y++;continue}const b=y;for(;y<s&&e.isDark(u,y);)y++;l+=`M${b} ${u}h${y-b}v1h-${y-b}z`}}return{size:s,path:l}}const O5=1e3,B5=4e3;function F5({status:t,pairing:e,phonePairing:s,phoneStarted:l,problem:u,platform:y,onSetEnabled:b,onSetPort:i,onStartPairing:a,onCancelPairing:g,onStartPhonePairing:_,onCancelPhonePairing:h,onRenameDevice:k,onRevokeDevice:T,onDismissProblem:M,onClose:w}){const[d,m]=N.useState(()=>Bm(t.hostNames)),[p,f]=N.useState(String(t.port)),[x,j]=N.useState(null),E=N.useRef(null),[R,S]=N.useState(()=>Date.now()),L=()=>{e!==null&&g(),l&&h(),w()},I=N.useRef(L);I.current=L,N.useEffect(()=>{const B=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),I.current())};return window.addEventListener("keydown",B,!0),()=>window.removeEventListener("keydown",B,!0)},[]),N.useEffect(()=>{if(e===null&&s===null)return;S(Date.now());const B=window.setInterval(()=>S(Date.now()),1e3);return()=>window.clearInterval(B)},[e,s]),N.useEffect(()=>()=>{E.current!==null&&window.clearTimeout(E.current)},[]);const P=N.useRef(null),D=s!==null;N.useEffect(()=>{var U;if(!D)return;const B=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(U=P.current)==null||U.scrollIntoView({block:"center",behavior:B?"auto":"smooth"})},[D]),N.useEffect(()=>{f(String(t.port))},[t.port]),N.useEffect(()=>{t.hostNames.includes(d)||m(Bm(t.hostNames))},[t.hostNames,d]);const F=(B,U)=>{navigator.clipboard.writeText(U).then(()=>{j(B),E.current!==null&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>j(null),O5)}).catch(()=>j(null))},W=y5(p),$=W!==null&&W!==t.port,Y=w5(t,d),G=v("remote.title"),V=e===null?null:b5(t.port,e.code);return o.jsx("div",{className:"modal-backdrop",onClick:L,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":G,onClick:B=>B.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:G}),o.jsx("button",{className:"icon-button",onClick:L,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${t.state==="active"?" status-line-state-active":""}`,children:_d(t.state,t.port)}),o.jsx("p",{className:"modal-hint",children:v("remote.intro")}),o.jsx("div",{className:"vault-actions",children:t.enabled?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>b(!1),children:v("remote.turnOff")}),o.jsx("span",{className:"modal-hint",children:v("remote.turnOffHint")})]}):o.jsx("button",{className:"primary-button",onClick:()=>b(!0),children:v("remote.turnOn")})}),o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:v("remote.port")}),o.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:p,onChange:B=>f(B.target.value),onKeyDown:B=>{B.key==="Enter"&&$&&W!==null&&i(W)}}),o.jsx("button",{className:"link-button",onClick:()=>W!==null&&i(W),disabled:!$,children:v("remote.portSave")}),W===null&&o.jsx("span",{className:"modal-hint remote-port-invalid",children:k5()})]}),o.jsx("p",{className:"modal-hint",children:v("remote.restartHint")}),u!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:u}),o.jsx("button",{className:"icon-button",onClick:M,title:v("common.close"),children:"×"})]}),o.jsx("h3",{className:"modal-section",children:v("remote.step.host")}),o.jsx("p",{className:"modal-hint",children:v("remote.step.hostHint")}),E5().map(B=>o.jsxs("details",{className:"remote-os",open:B.platform===T5(y),children:[o.jsx("summary",{className:"remote-os-summary",children:B.label}),o.jsx("p",{className:"modal-hint",children:B.hint}),B.command!==null&&o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:B.command}),o.jsx("button",{className:"link-button",onClick:()=>F("ssh",B.command??""),children:x==="ssh"?o.jsxs(o.Fragment,{children:["✓ ",v("remote.copied")]}):v("remote.copy")})]})]},B.platform)),o.jsx("h3",{className:"modal-section",children:v("remote.step.tunnel")}),o.jsx("p",{className:"modal-hint",children:v("remote.step.tunnelHint")}),t.hostNames.length>1&&o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-host-select",children:v("remote.address")}),o.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:d,onChange:B=>m(B.target.value),children:t.hostNames.map(B=>o.jsx("option",{value:B,children:B},B))})]}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:Y}),o.jsx("button",{className:"link-button",onClick:()=>F("command",Y),children:x==="command"?o.jsxs(o.Fragment,{children:["✓ ",v("remote.copied")]}):v("remote.copy")})]}),o.jsxs("details",{className:"remote-os",children:[o.jsx("summary",{className:"remote-os-summary",children:v("remote.trouble")}),o.jsxs("ul",{className:"remote-trouble",children:[o.jsx("li",{className:"modal-hint",children:v("remote.trouble.network")}),o.jsx("li",{className:"modal-hint",children:v("remote.vpnHint")}),t.sshUser.length>0&&o.jsx("li",{className:"modal-hint",children:v("remote.userHint",{user:t.sshUser})})]})]}),o.jsx("h3",{className:"modal-section",children:v("remote.step.pair")}),e===null||V===null?o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:a,disabled:!ma(t),children:v("remote.pair.start")}),!ma(t)&&o.jsx("span",{className:"modal-hint",children:v("remote.pair.needsActive")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("remote.pair.open")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:V}),o.jsx("button",{className:"link-button",onClick:()=>F("pairing",V),children:x==="pairing"?o.jsxs(o.Fragment,{children:["✓ ",v("remote.copied")]}):v("remote.copy")})]}),o.jsxs("p",{className:"modal-hint",children:[v("remote.pair.expires",{time:Hm(Fm(e.expiresAt,R))})," ",v("remote.pair.after",{url:p_(t.port)})]}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:g,children:v("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:v("remote.phone.title")}),s===null?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("remote.phone.hint")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:_,disabled:!ma(t),children:v("remote.phone.start")}),!ma(t)&&o.jsx("span",{className:"modal-hint",children:v("remote.pair.needsActive")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:x5(s.shell)}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre remote-phone-command",children:s.authorizeCommand}),o.jsx("button",{className:"link-button",onClick:()=>F("phone",s.authorizeCommand),children:x==="phone"?o.jsxs(o.Fragment,{children:["✓ ",v("remote.copied")]}):v("remote.copy")})]}),o.jsx("p",{className:"modal-hint",children:v("remote.phone.authorizeOnce")}),o.jsx("p",{className:"modal-hint",children:v("remote.phone.scan")}),o.jsx("div",{ref:P,children:o.jsx(H5,{payload:s.payload})}),o.jsx("p",{className:"modal-hint",children:v("remote.phone.secret")}),o.jsx("p",{className:"modal-hint",children:v("remote.pair.expires",{time:Hm(Fm(s.expiresAt,R))})}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:h,children:v("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:v("remote.devices")}),t.devices.length===0?o.jsx("p",{className:"modal-hint",children:v("remote.devices.empty")}):o.jsx("ul",{className:"remote-devices",children:t.devices.map(B=>o.jsx(U5,{device:B,onRename:U=>k(B.id,U),onRevoke:()=>T(B.id)},B.id))})]})]})})}function H5({payload:t}){const e=P5(t),s=e.size+Io*2;return o.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-Io} ${-Io} ${s} ${s}`,role:"img","aria-label":v("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[o.jsx("rect",{x:-Io,y:-Io,width:s,height:s,fill:"#fff"}),o.jsx("path",{d:e.path,fill:"#000"})]})}function U5({device:t,onRename:e,onRevoke:s}){const[l,u]=N.useState(!1),[y,b]=N.useState(t.label),[i,a]=N.useState(!1),g=N.useRef(null);N.useEffect(()=>()=>{g.current!==null&&window.clearTimeout(g.current)},[]);const _=()=>{u(!1);const k=y.trim();k.length>0&&k!==t.label&&e(k)},h=()=>{if(i){s();return}a(!0),g.current=window.setTimeout(()=>a(!1),B5)};return o.jsxs("li",{className:"remote-device",children:[o.jsxs("div",{className:"remote-device-main",children:[l?o.jsx("input",{className:"remote-device-input",value:y,autoFocus:!0,onChange:k=>b(k.target.value),onBlur:_,onKeyDown:k=>{k.key==="Enter"&&_()}}):o.jsx("button",{className:"remote-device-label",onClick:()=>{b(t.label),u(!0)},title:v("remote.device.rename"),children:t.label}),o.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:C5(t)}),o.jsx("span",{className:"remote-device-paired",children:S5(t)})]}),o.jsx("button",{className:`link-button${i?" remote-device-confirm":""}`,onClick:h,children:v(i?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const $u="agent-workbench.notes-open",zm="agent-workbench.notes-active",qm="agent-workbench.notes-height",Wu=160,$5=300;function W5(t){return t.text.trim().length===0?t.images.length>0?v("notes.imageOnly"):v("notes.untitled"):Ib(t)}function z5({notes:t,onSendNote:e,sendTargetCwd:s,onNoteToComposer:l,composerTarget:u,fill:y,onHide:b}){const[i,a]=N.useState(()=>Dt($u,!1,G=>G==="true")),g=i||y,[_,h]=N.useState(()=>Dt(qm,$5,G=>{const V=Number.parseInt(G,10);return Number.isFinite(V)?Math.max(V,Wu):null})),[k,T]=N.useState(()=>Dt(zm,null,G=>G)),[M,w]=N.useState(null),[d,m]=N.useState(null),[p,f]=N.useState(0),x=f5(),j=N.useMemo(()=>t.notes.length===0?null:t.notes.find(G=>G.noteId===k)??t.notes[t.notes.length-1]??null,[t.notes,k]),E=N.useCallback(G=>{T(G),Tt(zm,G),w(null)},[]),R=N.useCallback(()=>{a(G=>{const V=!G;return Tt($u,String(V)),V})},[]),S=N.useCallback(()=>{const G=t.create();E(G),g||(a(!0),Tt($u,"true")),f(V=>V+1)},[t,g,E]),L=N.useCallback(G=>{if(G.text.trim().length===0&&G.images.length===0){t.remove(G.noteId);return}E(G.noteId),w(G.noteId)},[t,E]),I=N.useCallback(()=>{M!==null&&t.remove(M),w(null)},[M,t]),P=N.useRef(null),D=N.useCallback(G=>{const V=G.currentTarget.parentElement,B=V===null?_:Math.round(V.getBoundingClientRect().height);P.current={startY:G.clientY,startHeight:B},G.currentTarget.setPointerCapture(G.pointerId),G.preventDefault()},[_]),F=N.useCallback(G=>{const V=P.current;if(V===null)return;const B=Math.max(Wu,Math.floor(window.innerHeight*.8));h(Math.min(B,Math.max(Wu,V.startHeight+V.startY-G.clientY)))},[]),W=N.useCallback(G=>{P.current!==null&&(P.current=null,G.currentTarget.releasePointerCapture(G.pointerId),Tt(qm,String(_)))},[_]);N.useEffect(()=>{if(d===null)return;const G=V=>{V.key==="Escape"&&(V.stopPropagation(),m(null))};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[d]);const $=d===null?void 0:t.images[d],Y=t.notes.length;return o.jsxs("section",{className:`notes${g?" notes-open":""}${y?" notes-fill":""}`,style:g&&!y?{height:`${_}px`}:void 0,children:[g&&!y&&o.jsx("div",{className:"notes-resize",onPointerDown:D,onPointerMove:F,onPointerUp:W,onPointerCancel:W,title:v("notes.resize")}),g?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"notes-header",children:[o.jsxs("div",{className:"strip-tabs",role:"tablist",children:[t.notes.map(G=>{const V=G.noteId===(j==null?void 0:j.noteId),B=W5(G);return o.jsxs("div",{className:`strip-tab${V?" is-active":""}`,role:"tab","aria-selected":V,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>E(G.noteId),title:B,children:B}),o.jsx("button",{className:"strip-tab-close",onClick:()=>L(G),title:v("notes.closeNote"),children:"×"})]},G.noteId)}),o.jsx("button",{className:"strip-tab-new",onClick:S,title:v("notes.new"),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button thread-font-button",onClick:x.cycle,title:xa(x.size),"aria-label":xa(x.size),children:o.jsxs("span",{"aria-hidden":"true",children:["a",o.jsx("span",{className:"thread-font-big",children:"A"})]})}),!y&&o.jsx("button",{className:"icon-button",onClick:R,title:v("notes.collapse"),children:"▾"}),b!==void 0&&o.jsx(Ca,{title:v("settings.hide.notes"),onHide:b,confirmText:null})]}),o.jsx("div",{className:"notes-body",children:Y===0||j===null?o.jsx("p",{className:"notes-empty",children:cn("notes.empty")}):o.jsx(K5,{note:j,notes:t,closing:M===j.noteId,focusRequest:p,onConfirmClose:I,onCancelClose:()=>w(null),onOpenImage:m,onSend:e===null?null:()=>e(j.noteId),sendTargetCwd:s,onToComposer:l===null?null:()=>l(j.noteId),composerTarget:u},j.noteId)})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:R,title:v("notes.expand"),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:v("notes.name")}),Y>0&&o.jsx("span",{className:"strip-collapsed-count",children:Y})]}),b!==void 0&&o.jsx(Ca,{title:v("settings.hide.notes"),onHide:b,confirmText:null})]}),d!==null&&o.jsx("div",{className:"notes-lightbox",onClick:()=>m(null),title:v("notes.lightboxClose"),children:typeof $=="string"?o.jsx("img",{src:$,alt:v("notes.imageAlt")}):o.jsx("span",{className:"notes-lightbox-missing",children:v("notes.imageUnavailable")})})]})}function q5(){return o.jsx("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.jsx("path",{d:"M20 11.5 11.7 19.8a5 5 0 0 1-7.1-7.1l8.6-8.6a3.4 3.4 0 0 1 4.8 4.8l-8.5 8.5a1.8 1.8 0 0 1-2.5-2.5l7.9-7.9"})})}function V5(){return o.jsxs("svg",{viewBox:"0 0 24 24",width:"15",height:"15",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M21.5 2.5 11 13"}),o.jsx("path",{d:"M21.5 2.5 15 21.5l-4-8.5-8.5-4z"})]})}function K5({note:t,notes:e,closing:s,focusRequest:l,onConfirmClose:u,onCancelClose:y,onOpenImage:b,onSend:i,sendTargetCwd:a,onToComposer:g,composerTarget:_}){const h=N.useRef(null),[k,T]=N.useState(!1),M=t.text.trim().length===0&&t.images.length===0,w=PC(t.images,e.images);N.useEffect(()=>{var p;l>0&&((p=h.current)==null||p.focus())},[l]);const d=N.useCallback(p=>{const f=Array.from(p).filter(x=>x.type.startsWith("image/"));for(const x of f)e.addImage(t.noteId,x);return f.length>0},[e,t.noteId]),m=N.useCallback(p=>{p.clipboardData!==null&&d(p.clipboardData.files)&&p.preventDefault()},[d]);return o.jsxs("div",{className:`note-editor${k?" note-editor-dragging":""}`,onDragOver:p=>{Array.from(p.dataTransfer.types).includes("Files")&&(p.preventDefault(),T(!0))},onDragLeave:()=>T(!1),onDrop:p=>{p.preventDefault(),T(!1),d(p.dataTransfer.files)},children:[s&&o.jsxs("div",{className:"note-closing",children:[o.jsx("span",{children:v("notes.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:u,children:v("common.close")}),o.jsx("button",{className:"link-button",onClick:y,children:v("common.cancel")})]}),e.problem!==null&&o.jsxs("div",{className:"composer-problem",children:[o.jsx("span",{children:e.problem}),o.jsx("button",{className:"icon-button",onClick:e.dismissProblem,title:v("common.close"),children:"×"})]}),o.jsx("textarea",{ref:h,className:"note-input",value:t.text,placeholder:v("notes.placeholder"),onChange:p=>e.updateText(t.noteId,p.target.value),onPaste:m,spellCheck:!1}),t.images.length>0&&o.jsx("div",{className:"note-images",children:t.images.map(p=>o.jsx(G5,{image:p,src:e.images[p.imageId],onRequest:e.requestImage,onOpen:()=>b(p.imageId),onRemove:()=>e.removeImage(t.noteId,p.imageId)},p.imageId))}),o.jsxs("div",{className:"note-footer",children:[o.jsx("span",{className:"note-meta",children:qn(t.updatedAt)}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"link-button note-to-composer",onClick:()=>g==null?void 0:g(),disabled:g===null||M||!w,title:wk(g===null?null:_??"",M,w),children:v("notes.toComposer")}),o.jsx("button",{className:"icon-button",onClick:()=>i==null?void 0:i(),disabled:i===null||M,title:_k(i!==null,a,M),children:o.jsx(V5,{})}),o.jsxs("label",{className:"icon-button note-attach",title:v("notes.attach"),children:[o.jsx(q5,{}),o.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:p=>{p.target.files!==null&&d(p.target.files),p.target.value=""}})]})]})]})}function G5({image:t,src:e,onRequest:s,onOpen:l,onRemove:u}){return N.useEffect(()=>{e===void 0&&s(t.imageId)},[e,t.imageId,s]),o.jsxs("figure",{className:"chip chip-image note-thumb",title:vn(t.bytes),children:[typeof e=="string"?o.jsx("img",{src:e,alt:v("notes.imageAlt"),onClick:l}):o.jsx("span",{className:"note-thumb-placeholder",children:e===null?v("notes.thumbMissing"):"…"}),o.jsx("button",{className:"chip-remove",onClick:u,title:v("notes.removeImage"),children:"×"})]})}function g_(){const t=Vo(),e=qS(),[s,l]=N.useState(null),u=N.useCallback(()=>l(null),[]),y=N.useRef(null),b=g=>{$S(g).catch(()=>{})},i=[{label:v("header.locale.auto",{name:bu[HS()]}),checked:e==="auto",onSelect:()=>b("auto")},...Td.map(g=>({label:bu[g],lang:g,checked:e===g,onSelect:()=>b(g)}))],a=bu[t];return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:y,className:"icon-button locale-button",onClick:g=>{const _=g.currentTarget.getBoundingClientRect();l(h=>h===null?{x:_.left,y:_.bottom+4}:null)},title:e==="auto"?v("header.locale.titleAuto",{name:a}):v("header.locale.title",{name:a}),"aria-haspopup":"menu","aria-expanded":s!==null,children:Ry[t]}),s!==null&&o.jsx(dd,{x:s.x,y:s.y,items:i,onClose:u,anchor:y.current})]})}function Y5({onKey:t}){return o.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":v("narrow.keys.label"),children:NC.map(e=>o.jsx("button",{className:"narrow-key",onPointerDown:s=>s.preventDefault(),onClick:()=>t(e.data),title:v(e.titleKey),children:e.label},e.id))})}function X5({banners:t,status:e,statusLabel:s,terminals:l,activeTerminalId:u,activity:y,agents:b,offerAgentChoice:i,newTabAgent:a,platform:g,canOpen:_,newTabBlockedTitle:h,onSelectTab:k,onCloseTab:T,scheduled:M,onRenameTab:w,onNewTab:d,drawer:m,drawerOpen:p,onDrawerChange:f,menu:x,view:j,views:E,onViewChange:R,badges:S,chat:L,panel:I,notes:P,console:D,onTerminalKey:F}){const[W,$]=N.useState(null),Y=l.find(H=>H.terminalId===u)??null,G=H=>{var z;return((z=b.find(Z=>Z.id===H.agent))==null?void 0:z.statusLine)??null};N.useEffect(()=>{if(!p&&W===null)return;const H=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),W!==null?$(null):f(!1))};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[p,W,f]);const V=N.useRef({sheet:W,drawerOpen:p,view:j,onDrawerChange:f,onViewChange:R});V.current={sheet:W,drawerOpen:p,view:j,onDrawerChange:f,onViewChange:R},N.useEffect(()=>{const H=window;return H[Dp]=()=>{const z=V.current;switch(jC({dialogOpen:document.querySelector(".modal-backdrop")!==null,sheetOpen:z.sheet!==null,drawerOpen:z.drawerOpen,view:z.view})){case"close-dialog":return window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape",bubbles:!0,cancelable:!0})),!0;case"close-sheet":return $(null),!0;case"close-drawer":return z.onDrawerChange(!1),!0;case"show-chat":return z.onViewChange("chat"),!0;case null:return!1}},()=>{delete H[Dp]}},[]);const B=N.useRef(null);N.useEffect(()=>{var H;(H=B.current)==null||H.scrollIntoView({block:"nearest",inline:"nearest"})},[j]);const U=H=>{const z=H==="git"?S.changes:H==="plans"?S.plans:H==="memory"?S.memory:0;return z>0?o.jsx("span",{className:"side-panel-badge",children:z}):H==="cli"&&S.cliUnseen&&j!=="cli"?o.jsx("span",{className:"narrow-view-dot",title:v("panel.cliUnseen")}):null};return o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"app-header narrow-header",children:[o.jsx("button",{className:"icon-button narrow-icon",onClick:()=>f(!0),title:v("narrow.projects"),"aria-label":v("narrow.projects"),children:"☰"}),o.jsxs("button",{className:"narrow-current",onClick:()=>$("tabs"),title:v("narrow.tabs.open"),children:[Y===null?o.jsx("span",{className:"app-name",children:"Agent Workbench"}):o.jsxs(o.Fragment,{children:[o.jsx(Fd,{terminal:Y,activity:y.get(Y.terminalId),statusLine:G(Y)}),o.jsx("span",{className:"project-swatch",style:{background:Ys(Vs(Y))}}),o.jsx("span",{className:"narrow-current-label",children:Uo(Y)})]}),o.jsx("span",{className:"narrow-caret","aria-hidden":"true",children:"▾"})]}),e!=="open"&&o.jsx("span",{className:`status status-${e}`,children:s}),o.jsx("button",{className:"icon-button narrow-icon",onClick:()=>$("menu"),title:v("narrow.more"),"aria-label":v("narrow.more"),children:"⋮"})]}),t,o.jsxs("div",{className:"narrow-body",children:[o.jsx("nav",{className:"narrow-views",role:"tablist",children:E.map(H=>o.jsxs("button",{ref:H===j?B:null,role:"tab","aria-selected":H===j,className:`narrow-view-tab${H===j?" narrow-view-active":""}`,onClick:()=>R(H),children:[o.jsx("span",{children:v(xC(H))}),U(H)]},H))}),o.jsxs("div",{className:"narrow-stack",children:[o.jsx("main",{className:`workspace narrow-pane${j==="chat"?"":" narrow-pane-veiled"}`,children:L}),I,o.jsx("div",{className:`narrow-pane${j==="notes"?"":" narrow-pane-hidden"}`,children:P}),o.jsx("div",{className:`narrow-pane${j==="console"?"":" narrow-pane-hidden"}`,children:D})]}),F!==null&&o.jsx(Y5,{onKey:F})]}),p&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>f(!1),children:o.jsx("div",{className:"narrow-drawer",onClick:H=>H.stopPropagation(),children:m})}),W==="tabs"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":v("narrow.tabs.open"),onClick:H=>H.stopPropagation(),children:[o.jsx(Q5,{terminals:l,platform:g,activeTerminalId:u,activity:y,statusLineOf:G,onSelect:H=>{k(H),$(null)},onClose:T,onRename:w,scheduled:M}),o.jsx(Pd,{className:"narrow-sheet-new",text:v("narrow.tabs.new"),title:h??v("narrow.tabs.new"),disabled:!_||h!==null,offerAgentChoice:i,agents:b,agent:a,onOpen:H=>{d(H),$(null)}})]})}),W==="menu"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":v("narrow.more"),onClick:H=>H.stopPropagation(),children:o.jsx(Z5,{menu:x,status:e,statusLabel:s,onClose:()=>$(null)})})})]})}function Q5({terminals:t,platform:e,activeTerminalId:s,activity:l,statusLineOf:u,onSelect:y,onClose:b,onRename:i,scheduled:a}){const[g,_]=N.useState(null),[h,k]=N.useState(""),T=N.useRef(null);N.useEffect(()=>{var w;g!==null&&((w=T.current)==null||w.select())},[g]);const M=()=>{g!==null&&i(g,h.trim()),_(null)};return t.length===0?o.jsx("p",{className:"narrow-sheet-empty",children:v("narrow.tabs.none")}):o.jsx("ul",{className:"narrow-tabs",children:t.map(w=>{var p;const d=g===w.terminalId,m=Xv(w,t,e);return o.jsxs("li",{className:`narrow-tab-row${w.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":Ys(Vs(w))},children:[d?o.jsx("input",{ref:T,className:"narrow-tab-input",value:h,onChange:f=>k(f.target.value),onBlur:M,onKeyDown:f=>{f.key==="Enter"&&M(),f.key==="Escape"&&(f.stopPropagation(),_(null))}}):o.jsxs("button",{className:"narrow-tab-select",onClick:()=>y(w.terminalId),children:[o.jsx(Fd,{terminal:w,activity:l.get(w.terminalId),statusLine:u(w)}),w.review&&o.jsx("span",{className:"tab-review",title:v("worktree.tab.reviewTitle"),children:v("worktree.tab.review")}),m!==null&&o.jsx("span",{className:"tab-branch",children:m}),(((p=a==null?void 0:a.get(w.terminalId))==null?void 0:p.length)??0)>0&&o.jsx("span",{title:rv((a==null?void 0:a.get(w.terminalId))??[])??void 0,children:o.jsx(t_,{messages:(a==null?void 0:a.get(w.terminalId))??[]})}),o.jsx("span",{className:"narrow-tab-label",children:Uo(w)})]}),o.jsx("button",{className:"icon-button",onClick:()=>{_(w.terminalId),k(w.label.length>0?w.label:Uo(w))},title:v("narrow.tabs.rename"),children:"✎"}),o.jsx("button",{className:"icon-button",onClick:()=>b(w.terminalId),title:v("narrow.tabs.close"),children:"×"})]},w.terminalId)})})}function J5({choice:t}){const e=[{source:"system",label:v("narrow.menu.chimeSystem")},{source:"page",label:v("narrow.menu.chimePage")}];return o.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":v("narrow.menu.sound"),children:e.map(({source:s,label:l})=>o.jsx("button",{className:`narrow-chime-option${t.source===s?" is-on":""}`,"aria-pressed":t.source===s,onClick:()=>t.setSource(s),children:l},s))})}function Z5({menu:t,status:e,statusLabel:s,onClose:l}){return o.jsxs("div",{className:"narrow-menu",children:[o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.connection")}),o.jsx("span",{className:`status status-${e}`,children:s}),ev(navigator.userAgent)&&o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"link-button",href:IC,onClick:l,children:v("narrow.menu.phoneAppDisconnect")}),o.jsx("a",{className:"link-button",href:AC,onClick:l,children:v("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.folder")}),o.jsx("span",{className:"narrow-menu-value",title:t.cwd,children:t.cwd})]}),t.cliVersion!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.cli")}),o.jsx("span",{className:"narrow-menu-value",title:t.cliVersion,children:t.cliVersion})]}),t.remoteClient&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("app.header.remoteBadge")}),o.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:v("app.header.remoteBadgeTitle")})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.theme")}),o.jsx("button",{className:"icon-button",onClick:t.onCycleTheme,title:t.themeTitle,children:t.themeIcon})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.language")}),o.jsx(g_,{})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.sound")}),t.sound.phoneChime===null?o.jsx(h_,{sound:t.sound}):o.jsx(J5,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.notifications")}),o.jsx(f_,{notify:t.sound.notify})]}),t.remote!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("app.header.remoteAccess")}),o.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var u;l(),(u=t.remote)==null||u.onOpen()},title:t.remote.title,children:"⇄"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("narrow.menu.shortcuts")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onShortcuts()},title:v("app.header.shortcuts"),children:"?"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:v("settings.title")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onSettings()},title:v("settings.open"),"aria-label":v("settings.open"),children:"⚙"})]})]})}function e2(){const t=window.location.search,e=new URLSearchParams(t).get(Yu),s=e!==null&&e.length>0?e:null,l=TC(t);return s===null&&l===null?{token:s,tab:l}:(window.history.replaceState(null,"",`${window.location.pathname}${LC(t,[Yu,Jg])}`),{token:s,tab:l})}const v_=e2(),Vm=v_.token,t2=v_.tab,zu=new Set;function n2(t){const[e,s]=N.useState(null),[l,u]=N.useState(null),[y,b]=N.useState(zu),[i,a]=N.useState(null);N.useEffect(()=>{const d=t.onMessage(p=>{switch(p.type){case"vault.status":s(p.status);break;case"vault.exported":b(f=>{if(!f.has(p.projectKey))return f;const x=new Set(f);return x.delete(p.projectKey),x}),a({projectKey:p.projectKey,sessions:p.sessions,at:Date.now()});break;case"error":if(p.code!=="vault-failed")break;u(At(p.text)),p.detail!==void 0&&console.error("[servidor]",p.detail),b(zu);break}}),m=t.onReopen(()=>b(zu));return()=>{d(),m()}},[t]);const g=N.useCallback(()=>{u(null),t.send({type:"vault.measure"})},[t]),_=N.useCallback(d=>{u(null),t.send({type:"vault.enable",enabled:d})},[t]),h=N.useCallback(d=>{u(null),t.send({type:"vault.setDir",pickerId:d})},[t]),k=N.useCallback(d=>{u(null),b(m=>new Set(m).add(d)),t.send({type:"vault.exportProject",projectKey:d})},[t]),T=N.useCallback((d,m)=>{u(null),t.send({type:"vault.openSession",agent:d,sessionId:m})},[t]),M=N.useCallback(()=>{u(null),t.send({type:"vault.reveal"})},[t]),w=N.useCallback(()=>u(null),[]);return{status:e,problem:l,exporting:y,lastExported:i,measure:g,setEnabled:_,chooseDir:h,exportProject:k,openSession:T,reveal:M,dismissProblem:w}}function r2(t){return v("summary.outdatedServer",{server:t,page:Ri})}function s2(t){const[e,...s]=t;if(e===void 0||e.missingMessage===null)return null;const l=At(e.missingMessage);return s.length===0?l:`${l}
|
|
162
|
-
${v("summary.alsoWorksWith",{names:s.map(u=>u.label).join(", ")})}`}function i2(t){const e=t.version??"?";return e.toLowerCase().includes(t.label.toLowerCase())?e:`${t.label} ${e}`}function o2(t,e,s=Ri){var b,i;if(e&&s<Ri)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:r2(s),environmentNotice:null};if(e&&s>Ri)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:v("summary.newerServer",{server:s,page:Ri}),environmentNotice:null};const l=t.filter(a=>a.available);let u=null;l.length===1?u=((b=l[0])==null?void 0:b.version)??null:l.length>1&&(u=l.map(i2).join(" · "));const y=e&&l.length===0;return{cliAvailable:!e||l.length>0,cliVersion:u,cliMissingMessage:y?s2(t):null,environmentNotice:((i=t.find(a=>a.environmentNotice!==null))==null?void 0:i.environmentNotice)??null}}const l2=500,a2=8e3;class c2{constructor(){Wt(this,"socket",null);Wt(this,"status","connecting");Wt(this,"attempt",0);Wt(this,"closedByUs",!1);Wt(this,"hasConnectedOnce",!1);Wt(this,"reconnectTimer");Wt(this,"messageHandlers",new Set);Wt(this,"statusHandlers",new Set);Wt(this,"reopenHandlers",new Set);Wt(this,"outbox",[])}getStatus(){return this.status}onMessage(e){return this.messageHandlers.add(e),()=>this.messageHandlers.delete(e)}onStatus(e){return this.statusHandlers.add(e),()=>this.statusHandlers.delete(e)}onReopen(e){return this.reopenHandlers.add(e),()=>this.reopenHandlers.delete(e)}connect(){if(this.socket!==null)return;const e=new URL(cy,window.location.href);e.protocol=window.location.protocol==="https:"?"wss:":"ws:",Vm!==null&&e.searchParams.set(Yu,Vm);const s=new WebSocket(e);this.socket=s,s.onopen=()=>{for(this.attempt=0,this.setStatus("open");this.outbox.length>0;){const l=this.outbox.shift();l!==void 0&&s.send(pp(l))}if(this.hasConnectedOnce)for(const l of this.reopenHandlers)l();this.hasConnectedOnce=!0},s.onmessage=l=>{const u=vy(l.data);if(u===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const y of this.messageHandlers)y(u)},s.onclose=l=>{if(this.socket=null,!this.closedByUs){if(l.code===Jb){this.setStatus("revoked");return}this.setStatus("reconnecting"),this.scheduleReconnect()}},s.onerror=()=>{}}send(e){return this.socket!==null&&this.socket.readyState===WebSocket.OPEN?(this.socket.send(pp(e)),!0):(e.type!=="input"&&e.type!=="resize"&&this.outbox.push(e),!1)}close(){var e;this.closedByUs=!0,window.clearTimeout(this.reconnectTimer),(e=this.socket)==null||e.close(),this.socket=null}setStatus(e){if(this.status!==e){this.status=e;for(const s of this.statusHandlers)s(e)}}scheduleReconnect(){if(this.attempt+=1,!this.hasConnectedOnce&&this.attempt>4){this.setStatus("failed");return}const e=Math.min(l2*2**(this.attempt-1),a2);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),e)}}const __=new Set;function u2(t){return t!==void 0&&__.has(t)}function zn(){const t=crypto.randomUUID();return __.add(t),t}function w_(t,e){return t.reason==="requested"&&e!==null&&(t.requestId===void 0||t.requestId===e)}const Km={rows:[],kept:[]};function d2(t,e,s){const[l,u]=N.useState(Km);return N.useEffect(()=>{if(u(Km),e===null)return;const y=()=>{t.send({type:"worktree.status",terminalId:e})},b=t.onMessage(a=>{a.type==="worktree.rows"&&a.terminalId===e&&u({rows:a.rows,kept:a.kept??[]}),a.type==="worktree.changed"&&y()}),i=t.onReopen(y);return()=>{b(),i()}},[t,e]),N.useEffect(()=>{e!==null&&s>0&&t.send({type:"worktree.status",terminalId:e})},[t,e,s]),l}function h2(t,e,s){const[l,u]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),g=N.useRef(null),_=N.useRef(null),h=N.useRef(null),k=N.useRef(null),T=N.useRef(null);N.useEffect(()=>t.onMessage($=>{switch($.type){case"worktree.inspected":if($.requestId!==g.current)break;u(Y=>Y===null?null:{...Y,state:{phase:"ready",inspection:$.inspection}});break;case"terminal.opened":if($.requestId===g.current){g.current=null,u(null);const Y=_.current;_.current=null,Y==null||Y()}break;case"worktree.removePlan":if($.requestId!==h.current)break;b(Y=>Y===null?null:{...Y,state:{phase:"ready",plan:$.plan}});break;case"worktree.removed":if($.requestId!==h.current)break;h.current=null,b(Y=>Y===null?null:{...Y,state:{phase:"done",outcome:$.outcome}});break;case"worktree.deleteBranchPlan":if($.requestId!==T.current)break;a(Y=>Y===null?null:{...Y,state:{phase:"ready",plan:$.plan}});break;case"worktree.branchDeleted":if($.requestId!==T.current)break;T.current=null,a(Y=>Y===null?null:{...Y,state:{phase:"done"}});break;case"composer.prefill":w_($,k.current)&&(k.current=null,s($.terminalId));break;case"error":{const Y=At($.text);$.requestId!==void 0&&$.requestId===g.current&&(g.current=null,u(G=>{if(G===null)return null;const V=G.state.phase==="loading"?null:G.state.inspection;return{...G,state:{phase:"failed",inspection:V,message:Y}}})),$.requestId!==void 0&&$.requestId===h.current&&(h.current=null,b(G=>{if(G===null)return null;const V=G.state.phase==="ready"||G.state.phase==="removing"?G.state.plan:null;return{...G,state:{phase:"failed",plan:V,message:Y}}})),$.requestId!==void 0&&$.requestId===T.current&&(T.current=null,a(G=>{if(G===null)return null;const V=G.state.phase==="ready"||G.state.phase==="deleting"?G.state.plan:null;return{...G,state:{phase:"failed",plan:V,message:Y}}})),$.requestId!==void 0&&$.requestId===k.current&&(k.current=null);break}}}),[t,s]);const M=N.useCallback(($,Y,G,V)=>{const B=zn();g.current=B,_.current=V??null,u({source:$,projectCwd:Y,projectName:G,state:{phase:"loading"}}),t.send({type:"worktree.inspect",requestId:B,source:$})},[t]),w=N.useCallback($=>{if(l===null||l.state.phase!=="ready"&&l.state.phase!=="failed")return;const{inspection:Y}=l.state;if(Y===null)return;const G=zn();g.current=G,u({...l,state:{phase:"creating",inspection:Y}}),e(G,{cwd:l.projectCwd,label:$.branch,agent:$.agent??null}),t.send({type:"worktree.create",requestId:G,source:l.source,branch:$.branch,base:$.base,mode:$.mode,copyNotes:$.copyNotes,...$.agent!==void 0?{agent:$.agent}:{}})},[t,l,e]),d=N.useCallback(()=>{(l==null?void 0:l.state.phase)!=="creating"&&(g.current=null,_.current=null),u(null)},[l]),m=N.useCallback($=>{const Y=zn();h.current=Y,t.send({type:"worktree.planRemove",requestId:Y,worktreeId:$})},[t]),p=N.useCallback(($,Y)=>{b({worktreeId:$,branch:Y,state:{phase:"loading"},acceptedFiles:null}),m($)},[m]),f=N.useCallback(($,Y,G,V)=>{const B=zn();h.current=B,b({...$,acceptedFiles:V,state:{phase:"removing",plan:Y}});const U=Ko(Y,V)?V:null;t.send({type:"worktree.remove",requestId:B,worktreeId:$.worktreeId,discardConflicts:G,...U!==null?{discardUntracked:U}:{}})},[t]),x=N.useCallback($=>{y===null||y.state.phase!=="ready"||f(y,y.state.plan,$,y.acceptedFiles)},[y,f]),j=N.useCallback(()=>{var G;if(y===null||y.state.phase!=="ready")return;const{plan:$}=y.state,Y=((G=$.untracked)==null?void 0:G.stamp)??null;Y!==null&&(Zv($,Y)==="remove"?f(y,$,!1,Y):b({...y,acceptedFiles:Y}))},[y,f]),E=N.useCallback($=>{if(y===null)return;const Y=crypto.randomUUID();k.current=Y,e(Y,null),t.send({type:$,requestId:Y,worktreeId:y.worktreeId}),h.current=null,b(null)},[t,e,y]),R=N.useCallback(()=>E("worktree.askNotes"),[E]),S=N.useCallback(()=>E("worktree.askCommit"),[E]),L=N.useCallback(()=>{y!==null&&(b({...y,state:{phase:"loading"}}),m(y.worktreeId))},[m,y]),I=N.useCallback(()=>{h.current=null,b(null)},[]),P=N.useCallback(($,Y,G,V)=>{const B=crypto.randomUUID();e(B,{cwd:G,label:V,agent:$}),t.send({type:"worktree.reopen",requestId:B,agent:$,sessionId:Y})},[t,e]),D=N.useCallback(($,Y)=>{const G=zn();T.current=G,a({worktreeId:$,branch:Y,state:{phase:"loading"}}),t.send({type:"worktree.planDeleteBranch",requestId:G,worktreeId:$})},[t]),F=N.useCallback(()=>{if(i===null||i.state.phase!=="ready"||i.state.plan.blocker!==null)return;const $=zn();T.current=$,a({...i,state:{phase:"deleting",plan:i.state.plan}}),t.send({type:"worktree.deleteBranch",requestId:$,worktreeId:i.worktreeId})},[t,i]),W=N.useCallback(()=>{T.current=null,a(null)},[]);return{create:l,openCreate:M,submitCreate:w,closeCreate:d,remove:y,openRemove:p,confirmRemove:x,discardFiles:j,askNotes:R,askCommit:S,retryRemove:L,closeRemove:I,reopen:P,deleteBranch:i,openDeleteBranch:D,confirmDeleteBranch:F,closeDeleteBranch:W}}function f2(t,e,s){const[l,u]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),g=N.useRef(null),_=N.useRef(null),h=N.useRef(null),k=N.useRef(null),T=N.useRef(null);N.useEffect(()=>t.onMessage(P=>{switch(P.type){case"worktree.branchChanges":if(P.requestId!==g.current)break;g.current=null,u(D=>D===null?null:{...D,state:{phase:"ready",changes:P.changes}});break;case"worktree.branchDiff":if(P.requestId!==_.current)break;_.current=null,u(D=>D===null||D.diff===null?D:{...D,diff:{...D.diff,diff:P.diff}});break;case"worktree.reviewPlan":if(P.requestId!==h.current)break;h.current=null,b(D=>D===null?null:{...D,state:{phase:"ready",plan:P.plan}});break;case"terminal.opened":P.requestId!==void 0&&P.requestId===h.current&&(h.current=null,b(null));break;case"worktree.integratePlan":if(P.requestId!==k.current)break;k.current=null,a(D=>D===null?null:{...D,state:{phase:"ready",plan:P.plan}});break;case"worktree.integrated":if(P.requestId!==k.current)break;k.current=null,a(D=>{if(D===null)return null;const F=D.state.phase==="integrating"?D.state.plan:null;return F===null?D:{...D,state:{phase:"done",plan:F,outcome:P.outcome}}});break;case"composer.prefill":w_(P,T.current)&&(T.current=null,s(P.terminalId));break;case"error":{const{requestId:D}=P;if(D===void 0)break;const F=At(P.text);D===g.current&&(g.current=null,u(W=>W===null?null:{...W,state:{phase:"failed",message:F}})),D===_.current&&(_.current=null,u(W=>W===null||W.diff===null?W:{...W,diff:{...W.diff,message:F}})),D===h.current&&(h.current=null,b(W=>{if(W===null)return null;const $=W.state.phase==="loading"||W.state.phase==="failed"?null:W.state.plan;return{...W,state:{phase:"failed",plan:$,message:F}}})),D===k.current&&(k.current=null,a(W=>{if(W===null)return null;const $=W.state.phase==="ready"||W.state.phase==="integrating"?W.state.plan:null;return{...W,state:{phase:"failed",plan:$,message:F}}})),D===T.current&&(T.current=null);break}}}),[t,s]);const M=N.useCallback((P,D)=>{const F=zn();g.current=F,_.current=null,u({worktreeId:P,branch:D,state:{phase:"loading"},diff:null}),t.send({type:"worktree.changes",requestId:F,worktreeId:P})},[t]),w=N.useCallback(P=>{if(l===null)return;const D=zn();_.current=D,u({...l,diff:{path:P,diff:null,message:null}}),t.send({type:"worktree.changesDiff",requestId:D,worktreeId:l.worktreeId,path:P})},[t,l]),d=N.useCallback(()=>{_.current=null,u(P=>P===null?null:{...P,diff:null})},[]),m=N.useCallback(()=>{g.current=null,_.current=null,u(null)},[]),p=N.useCallback((P,D,F)=>{const W=zn();h.current=W,b({worktreeId:P,branch:D,projectCwd:F,state:{phase:"loading"}}),t.send({type:"worktree.planReview",requestId:W,worktreeId:P})},[t]),f=N.useCallback(P=>{if(y===null||y.state.phase!=="ready"&&y.state.phase!=="failed")return;const{plan:D}=y.state;if(D===null)return;const F=zn();h.current=F,b({...y,state:{phase:"requesting",plan:D}});const W=y.projectCwd.split(/[\\/]/).filter($=>$.length>0).pop()??y.projectCwd;e(F,{cwd:y.projectCwd,label:W,agent:P}),t.send({type:"worktree.requestReview",requestId:F,worktreeId:y.worktreeId,agent:P})},[t,e,y]),x=N.useCallback(()=>{(y==null?void 0:y.state.phase)!=="requesting"&&(h.current=null),b(null)},[y]),j=N.useCallback((P,D)=>{const F=zn();k.current=F,a({worktreeId:P,branch:D,state:{phase:"loading"}}),t.send({type:"worktree.planIntegrate",requestId:F,worktreeId:P})},[t]),E=N.useCallback(()=>{if(i===null||i.state.phase!=="ready")return;const P=zn();k.current=P;const{plan:D}=i.state;a({...i,state:{phase:"integrating",plan:D}}),t.send({type:"worktree.integrate",requestId:P,worktreeId:i.worktreeId,...D.branchCommit!==null?{branchCommit:D.branchCommit}:{}})},[t,i]),R=N.useCallback(()=>{k.current=null,a(null)},[]),S=N.useCallback((P,D)=>{const F=crypto.randomUUID();T.current=F,e(F,null),t.send({type:P,requestId:F,worktreeId:D})},[t,e]),L=N.useCallback(P=>S("worktree.sendReview",P),[S]),I=N.useCallback(P=>S("worktree.catchUp",P),[S]);return{changes:l,openChanges:M,openChangeDiff:w,closeChangeDiff:d,closeChanges:m,review:y,openReview:p,submitReview:f,closeReview:x,integrate:i,openIntegrate:j,confirmIntegrate:E,closeIntegrate:R,sendReview:L,catchUp:I}}const wd="agent-workbench.activeTab";function p2(){try{return window.sessionStorage.getItem(wd)}catch{return null}}const m2={state:"idle",scannedFiles:0,totalFiles:0};function g2(t,e,s){const l=new Map(s?[]:t.map(u=>[u.key,u]));for(const u of e)l.set(u.key,u);return[...l.values()].sort((u,y)=>y.lastActivityAt-u.lastActivityAt)}function v2(){const t=N.useMemo(()=>new c2,[]),e=N.useMemo(()=>new aC({send:(de,Ke)=>t.send({type:"composer.draft",terminalId:de,draft:Ke}),connected:()=>t.getStatus()==="open",setTimer:(de,Ke)=>window.setTimeout(de,Ke),clearTimer:de=>window.clearTimeout(de),newId:()=>crypto.randomUUID()}),[t]),[s,l]=N.useState("connecting"),[u,y]=N.useState([]),[b,i]=N.useState(null),[a,g]=N.useState(!1),[_,h]=N.useState(Ri),[k,T]=N.useState(""),[M,w]=N.useState(""),[d,m]=N.useState(null),[p,f]=N.useState(!1),[x,j]=N.useState(!1),[E,R]=N.useState(!1),[S,L]=N.useState([]),[I,P]=N.useState([]),[D,F]=N.useState(m2),[W,$]=N.useState(p2);N.useEffect(()=>{try{W===null?window.sessionStorage.removeItem(wd):window.sessionStorage.setItem(wd,W)}catch{}},[W]);const[Y,G]=N.useState(new Set),[V,B]=N.useState(new Map),[U,H]=N.useState(new Map),z=N.useRef(new Map),Z=N.useRef(new Map),[ie,_e]=N.useState(new Set),[ge,Q]=N.useState(null),[K,te]=N.useState([]),[ee,we]=N.useState(new Map),[ke,Ae]=N.useState([]),Me=N.useRef(1),[Je,it]=N.useState(new Map),Ie=N.useRef(new Set),ae=N.useRef(new Map),mt=N.useRef(new Map),De=N.useCallback(de=>{const Ke=mt.current.get(de);Ke!==void 0&&(clearTimeout(Ke),mt.current.delete(de)),te(ft=>ft.some(ye=>ye.requestId===de)?ft.filter(ye=>ye.requestId!==de):ft)},[]),Fe=N.useCallback(()=>{for(const de of mt.current.values())clearTimeout(de);mt.current.clear(),te(de=>de.length===0?de:[])},[]);N.useEffect(()=>{const de=t.onStatus(ye=>{l(ye),ye==="failed"&&Q({message:v("workspace.connectFailed"),at:Date.now()})}),Ke=t.onMessage(ye=>{switch(ye.type){case"agents":y(ye.agents),i(ye.defaultAgent);break;case"hello":y(ye.agents),i(ye.defaultAgent),g(!0),h(ye.protocolVersion),T(ye.platform),w(ye.defaultCwd),m(ye.shellName),f(ye.remoteClient),j(ye.fileCheck),R(ye.fileWrite);break;case"terminal.list":{L(ye.terminals),e.retain(ye.terminals.map(Ye=>Ye.terminalId));const ht=Hk(Z.current,ye.terminals),Rt=ht.finished.length>0||[...ht.phases].some(([Ye,ot])=>Z.current.get(Ye)!==ot);Z.current=ht.phases,Rt&&_e(new Set(ht.phases.keys())),G(Ye=>{if(Ye.size===0)return Ye;const ot=new Set(Ye);for(const bt of Ye){if(ht.phases.has(bt))continue;const un=ye.terminals.find(Cn=>Cn.terminalId===bt);(un===void 0||un.alive)&&ot.delete(bt)}return ot.size===Ye.size?Ye:ot}),H(Ye=>{if(Ye.size===0)return Ye;const ot=new Map([...Ye].filter(([bt])=>ye.terminals.some(un=>un.terminalId===bt)));return ot.size===Ye.size?Ye:(z.current=ot,ot)});const vt=ye.terminals.filter(Ye=>Ye.kind==="agent");$(Ye=>{var ot;return Ye!==null&&vt.some(bt=>bt.terminalId===Ye)?Ye:((ot=vt[0])==null?void 0:ot.terminalId)??null}),we(Ye=>{if(Ye.size===0)return Ye;const ot=new Map(Ye);for(const bt of Ye.keys())ye.terminals.some(un=>un.terminalId===bt)||ot.delete(bt);return ot.size===Ye.size?Ye:ot}),it(Ye=>{if(Ye.size===0)return Ye;const ot=new Map([...Ye].filter(([bt])=>ye.terminals.some(un=>un.terminalId===bt)));return ot.size===Ye.size?Ye:ot});break}case"session.continued":we(ht=>new Map(ht).set(ye.terminalId,{sourceAgent:ye.source.agent,includedTurns:ye.includedTurns,totalTurns:ye.totalTurns,totalTurnsIsMinimum:ye.totalTurnsIsMinimum,delivery:ye.delivery,prefillReason:null}));break;case"composer.prefill":{const ht=Me.current;Me.current+=1,Ae(vt=>[...vt,{id:ht,terminalId:ye.terminalId,text:ye.text,pasted:ye.pasted??[],focus:ye.reason==="queue-edit"||ye.reason==="unscheduled"}]);const{reason:Rt}=ye;if(Rt==="returned-by-cli"||Rt==="stopped-early"){it(vt=>vt.get(ye.terminalId)===Rt?vt:new Map(vt).set(ye.terminalId,Rt));break}if(Rt==="rewound"||Rt==="requested"||Rt==="queue-edit"||Rt==="unscheduled")break;we(vt=>{const Ye=vt.get(ye.terminalId);return Ye===void 0?vt:new Map(vt).set(ye.terminalId,{...Ye,delivery:"prefilled",prefillReason:Rt})});break}case"composer.drafts":e.restore(ye.drafts);break;case"terminal.opened":{De(ye.requestId),Ie.current.delete(ye.requestId)&&ye.terminal.kind==="agent"&&$(ye.terminal.terminalId);const ht=ae.current.get(ye.requestId);ht!==void 0&&(ae.current.delete(ye.requestId),ht(ye.terminal));break}case"terminal.activity":B(ht=>ht.get(ye.terminalId)===ye.activity?ht:new Map(ht).set(ye.terminalId,ye.activity)),H(ht=>{const Rt=ye.offlineReason??null;if((ht.get(ye.terminalId)??null)===Rt)return ht;const vt=new Map(ht);return Rt===null?vt.delete(ye.terminalId):vt.set(ye.terminalId,Rt),z.current=vt,vt});break;case"index.status":F(ye.status);break;case"index.projects":P(ht=>g2(ht,ye.projects,ye.replace));break;case"error":if(u2(ye.requestId)){ye.detail!==void 0&&console.error("[servidor]",ye.detail),ye.requestId!==void 0&&(Ie.current.delete(ye.requestId),ae.current.delete(ye.requestId),De(ye.requestId));break}if(AL(ye.requestId)){ye.detail!==void 0&&console.error("[servidor]",ye.detail);break}if(ye.code==="vault-failed"||ye.code==="search-failed"||ye.code==="remote-failed"||ye.code==="settings-failed"||ye.code==="rewind-failed")break;Q({message:At(ye.text),at:Date.now()}),G(ht=>ht.size===0?ht:new Set),Z.current.size>0&&(Z.current=new Map,_e(new Set)),ye.detail!==void 0&&console.error("[servidor]",ye.detail),ye.requestId!==void 0&&(Ie.current.delete(ye.requestId),ae.current.delete(ye.requestId),De(ye.requestId));break}}),ft=t.onReopen(()=>{Fe(),G(ye=>ye.size===0?ye:new Set),Z.current.size>0&&(Z.current=new Map,_e(new Set))});return t.connect(),()=>{de(),Ke(),ft(),t.close()}},[t,e,De,Fe]),N.useEffect(()=>{const de=t.onReopen(()=>e.reconnected()),Ke=()=>e.flushAll(),ft=()=>{document.visibilityState==="hidden"&&e.flushAll()};return window.addEventListener("pagehide",Ke),document.addEventListener("visibilitychange",ft),()=>{de(),window.removeEventListener("pagehide",Ke),document.removeEventListener("visibilitychange",ft)}},[t,e]),N.useEffect(()=>Fe,[Fe]);const Ze=N.useCallback(de=>{const Ke=crypto.randomUUID();Ie.current.add(Ke),de.onOpened!==void 0&&ae.current.set(Ke,de.onOpened),te(ye=>[...ye,{requestId:Ke,cwd:de.cwd,agent:de.agent??null,label:de.label??"",at:Date.now()}]);const ft=setTimeout(()=>De(Ke),Sp);mt.current.set(Ke,ft),t.send({type:"terminal.open",requestId:Ke,cwd:de.cwd,...de.resumeSessionId!==void 0?{resumeSessionId:de.resumeSessionId}:{},...de.label!==void 0?{label:de.label}:{},...de.agent!==void 0?{agent:de.agent}:{}})},[t,De]),Se=N.useCallback(de=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:de,kind:"shell"})},[t]),be=N.useCallback(de=>t.send({type:"terminal.close",terminalId:de}),[t]),je=N.useCallback(de=>{G(Ke=>new Set(Ke).add(de)),z.current.get(de)==="server-closed"&&(Z.current=new Map(Z.current).set(de,"waiting-exit"),_e(new Set(Z.current.keys()))),t.send({type:"terminal.wake",terminalId:de})},[t]),pe=N.useCallback((de,Ke)=>t.send({type:"terminal.rename",terminalId:de,label:Ke}),[t]),Xe=N.useCallback(de=>t.send({type:"tabs.reorder",terminalIds:de}),[t]),$e=N.useCallback((de,Ke)=>t.send({type:"session.archive",sessionIds:de,archived:Ke}),[t]),He=N.useCallback((de,Ke,ft)=>{const ye=crypto.randomUUID();Ie.current.add(ye),t.send({type:"session.continue",requestId:ye,agent:de.agent,sessionId:de.sessionId,target:Ke,label:ft})},[t]),Pe=N.useCallback((de,Ke)=>{if(Ie.current.add(de),Ke===null)return;te(ye=>[...ye,{requestId:de,...Ke,at:Date.now()}]);const ft=setTimeout(()=>De(de),Sp);mt.current.set(de,ft)},[De]),re=N.useCallback(de=>{we(Ke=>{if(!Ke.has(de))return Ke;const ft=new Map(Ke);return ft.delete(de),ft})},[]),fe=N.useCallback(de=>{it(Ke=>{if(!Ke.has(de))return Ke;const ft=new Map(Ke);return ft.delete(de),ft})},[]),Le=N.useCallback(de=>{Ae(Ke=>Ke.some(ft=>ft.id===de)?Ke.filter(ft=>ft.id!==de):Ke)},[]),Qe=N.useCallback(()=>t.send({type:"index.refresh"}),[t]),at=N.useCallback(()=>t.send({type:"agents.refresh"}),[t]),ct=N.useCallback(()=>Q(null),[]),wt=N.useMemo(()=>S.filter(de=>de.kind==="agent"),[S]),Xt=N.useMemo(()=>S.filter(de=>de.kind==="shell"),[S]),he=Vo(),nt=N.useMemo(()=>o2(u,a,_),[u,a,_,he]),et=N.useCallback(de=>{var Ke;return(de===null||(Ke=u.find(ft=>ft.id===de))==null?void 0:Ke.capabilities)??ag},[u]),dt=N.useMemo(()=>yd(u),[u]);return{connection:t,status:s,agents:u,defaultAgent:b,capabilitiesFor:et,offerAgentChoice:dt,cliAvailable:nt.cliAvailable,cliVersion:nt.cliVersion,cliMissingMessage:nt.cliMissingMessage,platform:k,defaultCwd:M,environmentNotice:nt.environmentNotice,shellName:d,remoteClient:p,fileCheck:x,fileWrite:E,terminals:wt,shells:Xt,pendingOpens:K,activeTerminalId:W,projects:I,indexStatus:D,error:ge,dismissError:ct,setActiveTerminal:$,openTerminal:Ze,openShell:Se,closeTerminal:be,wakeTerminal:je,waking:Y,activity:V,offlineReasons:U,relaunching:ie,renameTerminal:pe,reorderTabs:Xe,refreshIndex:Qe,refreshAgents:at,archiveSessions:$e,continueSession:He,expectTab:Pe,handoffs:ee,dismissHandoff:re,returnedMessages:Je,dismissReturned:fe,prefills:ke,prefillApplied:Le,drafts:e}}function _2({dialog:t,agents:e,offerAgentChoice:s,agent:l,onSubmit:u,onClose:y}){const{state:b}=t,i=b.phase==="loading"?null:b.inspection,[a,g]=N.useState("new"),[_,h]=N.useState(""),[k,T]=N.useState(""),[M,w]=N.useState(""),[d,m]=N.useState(l),[p,f]=N.useState(!0);N.useEffect(()=>{const F=W=>{W.key==="Escape"&&(W.preventDefault(),W.stopPropagation(),y())};return window.addEventListener("keydown",F,!0),()=>window.removeEventListener("keydown",F,!0)},[y]),N.useEffect(()=>{var F;i===null||M.length>0||w(i.currentBranch??((F=i.branches[0])==null?void 0:F.name)??"")},[i,M]);const x=N.useMemo(()=>(i==null?void 0:i.branches.filter(F=>!F.checkedOut).map(F=>F.name))??[],[i]);N.useEffect(()=>{k.length===0&&x[0]!==void 0&&T(x[0])},[k,x]);const j=e.filter(F=>F.available),E=a==="new"?_.trim():k,R=a==="new"?M:(i==null?void 0:i.currentBranch)??M,S=i===null?null:eT(i,E,a,R),L=b.phase==="creating",I=i!==null&&!L&&E.length>0&&S===null,P=()=>{I&&u({branch:E,base:R,mode:a,copyNotes:p,...s&&d!==null?{agent:d}:{}})},D=v("worktree.create.title");return o.jsx("div",{className:"modal-backdrop",onClick:y,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":D,onClick:F=>F.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:D}),o.jsx("button",{className:"icon-button",onClick:y,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"modal-hint",children:v("worktree.create.intro",{project:t.projectName})}),b.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:v("worktree.create.loading")}),i!==null&&o.jsxs("form",{className:"worktree-form",onSubmit:F=>{F.preventDefault(),P()},children:[o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:v("worktree.create.branch")}),a==="new"?o.jsx("input",{className:"worktree-input",value:_,onChange:F=>h(F.target.value),placeholder:v("worktree.create.branchPlaceholder"),spellCheck:!1,autoFocus:!0,disabled:L}):o.jsx("select",{className:"worktree-input",value:k,onChange:F=>T(F.target.value),disabled:L||x.length===0,children:x.map(F=>o.jsx("option",{value:F,children:F},F))})]}),o.jsxs("div",{className:"worktree-modes",role:"radiogroup",children:[o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:a==="new",onChange:()=>g("new"),disabled:L}),o.jsx("span",{children:v("worktree.create.modeNew")}),o.jsx("select",{className:"worktree-input worktree-base",value:M,onChange:F=>w(F.target.value),disabled:L||a!=="new",children:i.branches.map(F=>o.jsx("option",{value:F.name,children:F.name},F.name))})]}),o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:a==="existing",onChange:()=>g("existing"),disabled:L||x.length===0}),o.jsx("span",{children:v("worktree.create.modeExisting")})]}),x.length===0&&o.jsx("p",{className:"modal-hint",children:v("worktree.create.noFreeBranch")})]}),s&&j.length>1&&o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:v("worktree.create.agent")}),o.jsx("select",{className:"worktree-input",value:d??"",onChange:F=>{var W;return m(((W=j.find($=>$.id===F.target.value))==null?void 0:W.id)??null)},disabled:L,children:j.map(F=>o.jsx("option",{value:F.id,children:F.label},F.id))})]}),S!==null&&o.jsx("p",{className:"worktree-problem",children:S}),o.jsx("h3",{className:"modal-section",children:v("worktree.create.copySection")}),i.notes.files===0?o.jsx("p",{className:"modal-hint",children:v("worktree.create.copyNone")}):o.jsxs("label",{className:"worktree-check",children:[o.jsx("input",{type:"checkbox",checked:p,onChange:F=>f(F.target.checked),disabled:L}),o.jsxs("span",{children:[v("worktree.create.copyNotes"),o.jsxs("span",{className:"modal-hint",children:[" ",i.notes.overCap?v("worktree.create.overCap",{summary:pa(i.notes)}):v("worktree.create.copyList",{summary:pa(i.notes),list:_n(i.notes.sample)})]})]})]}),i.include!==null&&o.jsx("p",{className:"modal-hint",children:i.include.overCap?v("worktree.create.includeOverCap",{summary:pa(i.include)}):v("worktree.create.include",{summary:pa(i.include)})}),i.mainChanges>0&&o.jsx("p",{className:"worktree-warning",children:v("worktree.create.mainChanges",{count:i.mainChanges})}),E.length>0&&S===null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("worktree.create.folder")}),o.jsx("p",{className:"worktree-path",children:Qv(i,E)}),o.jsx("h3",{className:"modal-section",children:v("worktree.create.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:nT(i,E,R,a)})]}),b.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:b.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{type:"button",className:"link-button",onClick:y,children:v("common.cancel")}),o.jsx("button",{type:"submit",className:"primary-button",disabled:!I,children:v(L?"worktree.create.creating":"worktree.create.submit")})]})]}),b.phase==="failed"&&i===null&&o.jsx("p",{className:"worktree-problem",children:b.message})]})]})})}function w2({dialog:t,onConfirm:e,onClose:s}){const{state:l}=t;N.useEffect(()=>{const a=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),s())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s]);const u=l.phase==="ready"||l.phase==="deleting"||l.phase==="failed"?l.plan:null,y=u===null?null:fT(u),b=l.phase==="deleting",i=v("worktree.deleteBranch.title",{branch:t.branch});return o.jsx("div",{className:"modal-backdrop",onClick:s,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":i,onClick:a=>a.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:i}),o.jsx("button",{className:"icon-button",onClick:s,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[l.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:v("worktree.deleteBranch.loading")}),l.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("worktree.deleteBranch.done",{branch:t.branch})}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:s,children:v("common.close")})})]}),u!==null&&o.jsxs(o.Fragment,{children:[y!==null?o.jsx("p",{className:"worktree-problem",children:y}):o.jsx("p",{className:"modal-hint",children:v("worktree.deleteBranch.intro",{base:u.base})}),o.jsx("h3",{className:"modal-section",children:v("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:u.folder}),o.jsx("h3",{className:"modal-section",children:v("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:u.command}),l.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:l.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:s,children:v("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:e,disabled:b||y!==null||l.phase==="failed",children:v(b?"worktree.deleteBranch.deleting":"worktree.deleteBranch.submit")})]})]}),l.phase==="failed"&&u===null&&o.jsx("p",{className:"worktree-problem",children:l.message})]})]})})}function b_({returning:t,merging:e,resolved:s}){const[l,u]=N.useState(!1),y=s.length>0?o.jsx("p",{className:"modal-hint",children:v("worktree.notes.resolved",{count:s.length,list:_n(s)})}):null;if(t.length===0)return y;const b=new Set(e);return o.jsxs(o.Fragment,{children:[y,o.jsxs("p",{className:"modal-hint",children:[v("worktree.notes.back",{count:t.length})," ",b.size>0&&o.jsxs(o.Fragment,{children:[v("worktree.notes.merged",{count:b.size})," "]}),o.jsx("button",{className:"link-button worktree-notes-toggle",onClick:()=>u(!l),"aria-expanded":l,children:v(l?"worktree.notes.hide":"worktree.notes.show")})]}),l&&o.jsx("ul",{className:"worktree-notes-list",children:t.map(i=>o.jsxs("li",{children:[i,b.has(i)&&o.jsx("span",{className:"worktree-notes-mark",children:v("worktree.notes.mergedMark")})]},i))})]})}function b2({dialog:t,agentLabel:e,onConfirm:s,onRemove:l,onClose:u}){const{state:y}=t;N.useEffect(()=>{const _=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),u())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[u]);const b=y.phase==="loading"?null:y.plan,i=b===null?null:cT(b),a=y.phase==="integrating",g=b===null?v("worktree.integrate.titleLoading",{branch:t.branch}):v("worktree.integrate.title",{branch:b.branch,base:b.base});return o.jsx("div",{className:"modal-backdrop",onClick:u,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":g,onClick:_=>_.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:g}),o.jsx("button",{className:"icon-button",onClick:u,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[y.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.loading")}),y.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.done",{base:y.outcome.base,count:y.outcome.commits})}),y.outcome.notes!==void 0&&y.outcome.notes.returned>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.notes.returned",{count:y.outcome.notes.returned})}),y.outcome.notes!==void 0&&y.outcome.notes.stayed.length>0&&o.jsx("p",{className:"worktree-warning",children:v("worktree.integrate.notesStayed",{list:_n(y.outcome.notes.stayed)})}),o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.doneOthers",{base:y.outcome.base})}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:u,children:v("common.close")}),o.jsx("button",{className:"primary-button",onClick:l,title:v("worktree.integrate.removeTitle"),children:v("worktree.integrate.remove")})]})]}),b!==null&&y.phase!=="done"&&o.jsxs(o.Fragment,{children:[i!==null?o.jsx("p",{className:"worktree-problem",children:i}):o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.intro",{base:b.base,count:b.ahead})}),b.fileCount>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.files",{count:b.fileCount,list:`${_n(b.files)}${b.fileCount>b.files.length?"…":""}`})}),b.notes!==null&&o.jsx(b_,{returning:b.notes.returning,merging:b.notes.merging,resolved:b.notes.resolved}),b.notes!==null&&b.notes.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:v("worktree.integrate.notesStay",{list:_n(b.notes.conflicts)})}),o.jsx("p",{className:b.review===null||b.review.state==="done"&&b.review.verdict==="ready"&&!b.review.stale?"modal-hint":"worktree-warning",children:b.review===null?v("worktree.integrate.noReview"):Jv(b.review,e(b.review.agent))}),b.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.integrate.tabs",{list:_n(b.tabs.map(_=>_.label))})}),b.branchUncommitted>0&&o.jsx("p",{className:"worktree-warning",children:v("worktree.integrate.branchUncommitted",{count:b.branchUncommitted})}),b.command!==null&&b.baseFolder!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:b.baseFolder}),o.jsx("h3",{className:"modal-section",children:v("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:b.command})]}),y.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:y.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:u,children:v("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:s,disabled:a||i!==null||y.phase==="failed",children:v(a?"worktree.integrate.integrating":"worktree.integrate.submit")})]})]}),y.phase==="failed"&&b===null&&o.jsx("p",{className:"worktree-problem",children:y.message})]})]})})}function y2({dialog:t,onConfirm:e,onDiscardFiles:s,onAskNotes:l,onAskCommit:u,onRetry:y,onClose:b,scheduledCountFor:i}){var f;const{state:a,acceptedFiles:g}=t;N.useEffect(()=>{const x=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),b())};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[b]);const _=a.phase==="ready"||a.phase==="removing"||a.phase==="failed"?a.plan:null,h=a.phase==="removing",k=a.phase==="failed",T=_===null||k?null:Zv(_,g),M=_!==null&&!k&&mT(_,g),w=_===null?null:vT(_,g),d=_===null||i===void 0?0:i(_.tabs.map(x=>x.terminalId)),m=v("worktree.remove.title",{branch:t.branch}),p=k?{label:v("worktree.remove.retry"),hint:void 0,run:y}:T==="ask-commit"&&_!==null?{label:v("worktree.remove.askCommit",{count:((f=_.untracked)==null?void 0:f.stamp)!=null&&_.untracked.files>0?_.untracked.files:_.uncommittedCount}),hint:v("worktree.remove.askTitle"),run:u}:T==="retry"?{label:v("worktree.remove.retry"),hint:void 0,run:y}:T==="ask-notes"?{label:v("worktree.remove.askNotes"),hint:v("worktree.remove.askTitle"),run:l}:T==="remove"?{label:v("worktree.remove.submit"),hint:void 0,run:()=>e(!1)}:null;return o.jsx("div",{className:"modal-backdrop",onClick:b,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":m,onClick:x=>x.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:m}),o.jsx("button",{className:"icon-button",onClick:b,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[a.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:v("worktree.remove.loading")}),a.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("worktree.remove.done")}),a.outcome.returned>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.notes.returned",{count:a.outcome.returned})}),a.outcome.discarded>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.remove.doneDiscarded",{count:a.outcome.discarded})}),a.outcome.discardedFiles>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.remove.doneDiscardedFiles",{count:a.outcome.discardedFiles})}),a.outcome.branchDeleted&&o.jsx("p",{className:"modal-hint",children:v("worktree.remove.doneBranch")}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:b,children:v("common.close")})})]}),_!==null&&a.phase!=="done"&&o.jsxs(o.Fragment,{children:[_.uncommittedCount>0&&o.jsxs("p",{className:Ko(_,g)?"worktree-warning":"worktree-problem",children:[w??v("worktree.remove.uncommitted",{count:_.uncommittedCount})," ",o.jsx("span",{className:"worktree-files",children:wT(_)})]}),_.inUse===!0&&o.jsx("p",{className:"worktree-problem",children:_T(_)}),_.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:v("worktree.remove.conflicts",{list:_n(_.conflicts)})}),o.jsx("p",{className:"modal-hint",children:bT(_)}),o.jsx(b_,{returning:_.returning,merging:_.merging,resolved:_.resolved}),_.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.remove.tabs",{list:_n(_.tabs.map(x=>x.label))})}),d>0&&o.jsx("p",{className:"worktree-warning",children:v("scheduled.worktree.cancels",{count:d})}),_.commands.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("worktree.remove.commands")}),o.jsx("pre",{className:"tool-pre worktree-command",children:_.commands.join(`
|
|
163
|
-
`)})]})]}),k&&o.jsx("p",{className:"worktree-problem",children:a.message}),a.phase!=="loading"&&a.phase!=="done"&&o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:b,children:v("common.cancel")}),M&&o.jsx("button",{className:"link-button",onClick:s,disabled:h,children:v("worktree.remove.discardFiles")}),T==="ask-notes"&&o.jsx("button",{className:"link-button",onClick:()=>e(!0),disabled:h,children:v("worktree.remove.discard")}),p!==null&&o.jsx("button",{className:"primary-button",onClick:p.run,title:p.hint,disabled:h,children:h?v("worktree.remove.removing"):p.label})]})]})]})})}function k2({dialog:t,agents:e,onSubmit:s,onClose:l}){var m;const{state:u}=t,y=u.phase==="loading"?null:u.plan,b=N.useMemo(()=>dT(e),[e]),i=y===null?null:h0(y.author,b),[a,g]=N.useState(null),_=a??i,h=e.find(p=>p.id===_)??null,k=p=>{var f;return((f=e.find(x=>x.id===p))==null?void 0:f.label)??p};N.useEffect(()=>{const p=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),l())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[l]);const T=u.phase==="requesting",M=y!==null&&y.ahead===0&&y.uncommitted===0,w=y!==null&&h!==null&&!T&&!M,d=v("worktree.review.title",{branch:t.branch});return o.jsx("div",{className:"modal-backdrop",onClick:l,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":d,onClick:p=>p.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:d}),o.jsx("button",{className:"icon-button",onClick:l,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[u.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:v("worktree.review.loading")}),y!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:v("worktree.review.intro",{base:y.base})}),M?o.jsx("p",{className:"worktree-problem",children:v("worktree.review.nothing",{base:y.base})}):o.jsxs(o.Fragment,{children:[b.length>1?o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:v("worktree.review.reviewer")}),o.jsx("select",{className:"worktree-input",value:_??"",onChange:p=>{var f;return g(((f=b.find(x=>x.id===p.target.value))==null?void 0:f.id)??null)},disabled:T,children:b.map(p=>o.jsx("option",{value:p.id,children:k(p.id)},p.id))})]}):h!==null&&o.jsx("p",{className:"modal-hint",children:v("worktree.review.sameCli",{agent:h.label})}),y.author!==null&&b.length>1&&o.jsx("p",{className:"modal-hint",children:v("worktree.review.author",{agent:k(y.author)})}),h!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:((m=h.capabilities.readOnlyLaunch)==null?void 0:m.guard)==="cli"?"modal-hint":"worktree-warning",children:uT(h.capabilities,h.label)}),o.jsx("p",{className:"modal-hint",children:h.capabilities.readySignal?v("worktree.review.deliverySent"):v("worktree.review.deliveryPrefill")})]}),y.branchBusy&&o.jsx("p",{className:"worktree-warning",children:v("worktree.review.branchBusy")}),y.uncommitted>0&&o.jsx("p",{className:"modal-hint",children:v("worktree.review.uncommitted",{count:y.uncommitted})}),o.jsx("p",{className:"modal-hint",children:v("worktree.review.quota")}),o.jsx("h3",{className:"modal-section",children:v("worktree.review.prompt")}),o.jsx("pre",{className:"tool-pre worktree-command worktree-prompt",children:y.prompt})]}),u.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:u.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:l,children:v("common.cancel")}),o.jsx("button",{className:"primary-button",disabled:!w,onClick:()=>{w&&_!==null&&s(_)},children:v(T?"worktree.review.requesting":"worktree.review.submit")})]})]}),u.phase==="failed"&&y===null&&o.jsx("p",{className:"worktree-problem",children:u.message})]})]})})}const Ud=["git","files","plans","memory","console","notes"],Gm="agent-workbench.hiddenPanels";function C2(t){return Ud.includes(t)}const S2=new Set(["memory"]),x2="none";function E2(t){return new Set(t.split(",").map(e=>e.trim()).filter(C2))}function T2(t){const e=Ud.filter(s=>t.has(s));return e.length===0?x2:e.join(",")}function L2(t,e,s){const l=new Set(t);return s?l.delete(e):l.add(e),l}function N2(){const[t,e]=N.useState(()=>Dt(Gm,S2,E2)),s=N.useCallback((u,y)=>{e(b=>{const i=L2(b,u,y);return Tt(Gm,T2(i)),i})},[]),l=N.useCallback(u=>!t.has(u),[t]);return{hidden:t,isVisible:l,setVisible:s}}const R2={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},M2={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function A2(t,e,s){const l=t.filter(u=>u!==e);return s?[...l,e]:l}function I2(t,e){return t.length===e.length&&t.every(s=>e.includes(s))}function j2({onClose:t,terminalTheme:e,panels:s,consoleCount:l,onHideConsole:u,appSettings:y,agents:b,remoteClient:i,onOpenVault:a,onOpenRemote:g,onConfigureStatusLine:_}){const[h,k]=N.useState(!1),T=y.status,M=T!==null&&!i,[w,d]=N.useState(null),[m,p]=N.useState(null),[f,x]=N.useState(null);N.useEffect(()=>{d(null),p(null),x(null)},[T,y.problem]);const j=w??(T==null?void 0:T.consoleShell)??"auto",E=m??(T==null?void 0:T.disabledAgents)??[],R=f??(T==null?void 0:T.scheduledMessages)??!1;N.useEffect(()=>{const D=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),t())};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[t]);const S=(D,F)=>{if(D==="console"&&!F&&l>0){k(!0);return}s.setVisible(D,F)},L=(T==null?void 0:T.consoleShells.find(D=>D.id!=="git-bash"&&D.id!=="zsh"))??null,I=T!==null&&!I2(T.disabledAgents,T.disabledAtStart),P=T===null?[]:[{id:"auto",label:L===null?v("settings.console.auto"):v("settings.console.autoWith",{shell:L.label})},...T.consoleShells];return o.jsx("div",{className:"modal-backdrop",onClick:t,children:o.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":v("settings.title"),onClick:D=>D.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:v("settings.title")}),o.jsx("button",{className:"icon-button",onClick:t,title:v("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body settings-body",children:[o.jsx("h3",{className:"modal-section",children:v("settings.section.appearance")}),o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{className:"settings-label",children:v("settings.language")}),o.jsx(g_,{})]}),o.jsxs("div",{className:"settings-row settings-row-top",children:[o.jsx("span",{className:"settings-label",children:v("settings.terminalTheme")}),o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":v("settings.terminalTheme"),children:[["dark","follow"].map(D=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"terminal-theme",checked:e.preference===D,onChange:()=>e.setPreference(D)}),v(M2[D])]},D)),o.jsx("p",{className:"modal-hint",children:v("settings.terminalTheme.hint")})]})]}),o.jsx("h3",{className:"modal-section",children:v("settings.section.panels")}),o.jsx("div",{className:"settings-panels",children:Ud.map(D=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:s.isVisible(D),onChange:F=>S(D,F.target.checked)}),v(R2[D])]},D))}),h&&o.jsxs("div",{className:"settings-confirm",role:"alert",children:[o.jsx("span",{children:v("settings.panels.consoleConfirm",{count:l})}),o.jsx("button",{className:"link-button",onClick:()=>{k(!1),u()},children:v("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>k(!1),children:v("common.cancel")})]}),o.jsx("p",{className:"modal-hint",children:v("settings.panels.cliAlways")}),T===null?o.jsx("p",{className:"modal-hint",children:v("settings.oldServer")}):o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("settings.section.console")}),T.consoleShells.length===0?o.jsx("p",{className:"modal-hint",children:v("console.noShell")}):o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":v("settings.section.console"),children:[P.map(D=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"console-shell",checked:j===D.id,disabled:!M,onChange:()=>{d(D.id),y.setConsoleShell(D.id)}}),D.label]},D.id)),o.jsx("p",{className:"modal-hint",children:v("settings.console.hint")})]}),o.jsx("h3",{className:"modal-section",children:v("settings.section.clis")}),o.jsx("ul",{className:"settings-clis",children:b.map(D=>{const F=E.includes(D.id),W=T.disabledAtStart.includes(D.id),$=D.available||W;return o.jsxs("li",{className:"settings-cli",children:[$?o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:!F,disabled:!M,onChange:Y=>{const G=A2(E,D.id,!Y.target.checked);p(G),y.setDisabledAgents(G)}}),o.jsx("span",{className:"settings-cli-name",children:D.label})]}):o.jsx("span",{className:"settings-cli-name settings-cli-missing",children:D.label}),o.jsx("span",{className:"settings-cli-detail",children:D.available?D.version??"":v(W?"settings.cli.disabled":"settings.cli.notInstalled")}),!$&&o.jsx("a",{className:"link-button",href:D.installUrl,target:"_blank",rel:"noreferrer noopener",children:v("settings.cli.install")})]},D.id)})}),o.jsx("p",{className:"modal-hint",children:v("settings.cli.hint")}),I&&o.jsx("p",{className:"settings-restart",children:v("settings.cli.restart")}),o.jsx("h3",{className:"modal-section",children:v("settings.section.scheduled")}),o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:R,disabled:!M,onChange:D=>{x(D.target.checked),y.setScheduledMessages(D.target.checked)}}),v("settings.scheduled.enable")]}),o.jsx("p",{className:"modal-hint",children:v("settings.scheduled.hint")}),R&&ok(b,E).map(D=>o.jsxs("p",{className:"modal-hint",children:[v("settings.scheduled.needsStatusLine",{agent:D.label})," ",o.jsx("button",{className:"link-button",onClick:()=>_(D.id),children:v("meter.configure")})]},D.id)),i&&o.jsx("p",{className:"modal-hint",children:v("settings.hostOnly")}),y.problem!==null&&o.jsxs("p",{className:"settings-problem",role:"alert",children:[y.problem,o.jsx("button",{className:"link-button",onClick:y.dismissProblem,children:v("common.close")})]})]}),(a!==null||g!==null)&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("settings.section.more")}),o.jsxs("div",{className:"settings-row settings-more",children:[a!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:a,children:v("settings.more.open",{name:ji()})}),g!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:v("settings.more.open",{name:v("app.header.remoteAccess")})})]})]})]})]})})}function D2(t){const[e,s]=N.useState(null),[l,u]=N.useState(null);N.useEffect(()=>t.onMessage(g=>{switch(g.type){case"settings.status":s(g.settings),u(null);break;case"error":if(g.code!=="settings-failed")break;u(At(g.text)),g.detail!==void 0&&console.error("[servidor]",g.detail);break}}),[t]);const y=N.useCallback(g=>t.send({type:"settings.update",consoleShell:g}),[t]),b=N.useCallback(g=>t.send({type:"settings.update",disabledAgents:g}),[t]),i=N.useCallback(g=>t.send({type:"settings.update",scheduledMessages:g}),[t]),a=N.useCallback(()=>u(null),[]);return{status:e,problem:l,setConsoleShell:y,setDisabledAgents:b,setScheduledMessages:i,dismissProblem:a}}function P2(t){const[e,s]=N.useState(null);N.useEffect(()=>t.onMessage(b=>{b.type==="schedule.list"&&s(b.messages)}),[t]);const l=N.useCallback((b,i,a)=>t.send({type:"schedule.create",requestId:iv(),terminalId:b,text:i,sendAt:a}),[t]),u=N.useCallback(b=>void t.send({type:"schedule.cancel",id:b}),[t]),y=N.useCallback(b=>void t.send({type:"schedule.sendNow",id:b}),[t]);return{messages:e,schedule:l,cancel:u,sendNow:y}}function O2({warning:t,onConfirm:e,onClose:s}){N.useEffect(()=>{const u=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),s())};return window.addEventListener("keydown",u,!0),()=>window.removeEventListener("keydown",u,!0)},[s]);const l=v("scheduled.close.title");return o.jsx("div",{className:"modal-backdrop",onClick:s,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":l,onClick:u=>u.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:l}),o.jsx("button",{className:"icon-button",onClick:s,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"modal-hint",children:t}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:s,autoFocus:!0,children:v("scheduled.close.keep")}),o.jsx("button",{className:"primary-button",onClick:e,children:v("scheduled.close.confirm")})]})]})]})})}function B2({status:t,agents:e,indexReady:s,problem:l,covered:u,onMeasure:y,onSetEnabled:b,onChangeDir:i,onReveal:a,onDismissProblem:g,onClose:_}){return N.useEffect(()=>{if(u)return;const h=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),_())};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[u,_]),o.jsx("div",{className:"modal-backdrop",onClick:_,children:o.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":ji(),onClick:h=>h.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:ji()}),t!==null&&o.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:gE(t)}),o.jsx("button",{className:"icon-button",onClick:_,title:v("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"vault-lead",children:dE()}),o.jsx("p",{className:"modal-hint",children:hE()}),t===null?o.jsx("p",{className:"modal-hint",children:v("vault.dialog.waiting")}):o.jsx(F2,{status:t,agents:e,indexReady:s,onMeasure:y,onSetEnabled:b,onChangeDir:i,onReveal:a}),l!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:l}),o.jsx("button",{className:"icon-button",onClick:g,title:v("common.dismissNotice"),children:"×"})]})]})]})})}function F2({status:t,agents:e,indexReady:s,onMeasure:l,onSetEnabled:u,onChangeDir:y,onReveal:b}){const i=bE(t,s),a=yE(t),g=wE(t),_=t.measurement===null?null:SE(t.measurement,e),h=t.progress;return o.jsxs(o.Fragment,{children:[t.enabled&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("vault.dialog.inFolder")}),o.jsxs("p",{className:"vault-summary",children:[Uv(t.sessions)," · ",vn(t.bytes),t.lastPassAt!==null&&o.jsxs(o.Fragment,{children:[" · ",v("vault.dialog.lastPass",{when:qn(t.lastPassAt)})]}),t.pending>0&&o.jsxs(o.Fragment,{children:[" · ",v("vault.dialog.pendingCalm",{count:t.pending})]})]})]}),h!==null&&h.total>0&&o.jsx("progress",{className:"vault-progress",value:h.done,max:h.total}),o.jsx("h3",{className:"modal-section",children:v("vault.dialog.sizeSection")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button vault-measure",onClick:l,disabled:i!==null,title:i??v("vault.dialog.measureTitle"),children:t.state==="measuring"?v("vault.state.measuring"):v(_===null?"vault.dialog.measure":"vault.dialog.measureAgain")}),_!==null&&o.jsx("span",{className:"modal-hint",children:_.summary})]}),_!==null&&o.jsx("div",{className:"vault-table-wrap",children:o.jsxs("table",{className:"vault-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"CLI"}),o.jsx("th",{children:v("vault.dialog.table.sessions")}),o.jsx("th",{children:v("vault.dialog.table.size")}),o.jsx("th",{children:v("vault.dialog.table.images")}),o.jsx("th",{title:v("vault.dialog.table.archivedTitle"),children:v("vault.dialog.table.archived")})]})}),o.jsxs("tbody",{children:[_.rows.map(k=>o.jsxs("tr",{children:[o.jsxs("td",{children:[k.label,k.note!==null&&o.jsx("span",{className:"vault-table-note",children:k.note})]}),o.jsx("td",{children:k.sessions}),o.jsx("td",{children:vn(k.bytes)}),o.jsx("td",{title:k.images>0?vn(k.imageBytes):void 0,children:k.images}),o.jsx("td",{children:k.skippedArchived})]},k.agent)),o.jsxs("tr",{children:[o.jsx("td",{children:v("vault.dialog.table.memory",{count:_.memoryProjects})}),o.jsx("td",{}),o.jsx("td",{children:vn(_.memoryBytes)}),o.jsx("td",{}),o.jsx("td",{})]})]}),o.jsx("tfoot",{children:o.jsxs("tr",{children:[o.jsx("td",{children:v("vault.dialog.table.total")}),o.jsx("td",{children:_.total.sessions}),o.jsx("td",{children:vn(_.total.bytes)}),o.jsx("td",{children:_.total.images}),o.jsx("td",{children:_.total.skippedArchived})]})})]})}),o.jsxs("div",{className:"vault-actions vault-switch",children:[g==="enabled"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>u(!1),children:v("vault.dialog.turnOff")}),o.jsx("span",{className:"modal-hint",children:v("vault.dialog.turnOffHint")})]}),(g==="measured"||g==="existing")&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",onClick:()=>u(!0),title:v(g==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:v("vault.dialog.activate")}),o.jsx("span",{className:"modal-hint",children:v(g==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),g==="needs-measure"&&o.jsx("span",{className:"modal-hint",children:v("vault.dialog.needsMeasure",{activate:v("vault.dialog.activate")})})]}),o.jsx("h3",{className:"modal-section",children:v("vault.dialog.folderSection")}),o.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&o.jsx("p",{className:"modal-hint",children:v("vault.dialog.defaultDir")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button",onClick:y,disabled:a!==null,title:a??v("vault.dialog.changeDirTitle"),children:v("vault.dialog.changeDir")}),b!==null&&o.jsx("button",{className:"link-button",onClick:b,title:v("vault.dialog.openFolderTitle"),children:v("vault.dialog.openFolder")})]}),t.previousDir!==null&&o.jsx("p",{className:"modal-hint",children:kE(t.previousDir)}),t.lastError!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("vault.dialog.lastError")}),o.jsx("p",{className:"vault-error",children:At(t.lastError)})]})]})}function H2({preview:t,files:e,running:s,error:l,onConfirm:u,onClose:y}){N.useEffect(()=>{const i=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),y())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[y]);const b=v("rewind.title");return o.jsx("div",{className:"modal-backdrop",onClick:y,children:o.jsxs("div",{className:"modal rewind-dialog",role:"dialog","aria-label":b,onClick:i=>i.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:b}),o.jsx("button",{className:"icon-button",onClick:y,title:v("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[t.length>0&&o.jsx("blockquote",{className:"rewind-quote",children:t}),o.jsx("p",{className:"modal-hint",children:v("rewind.intro")}),e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:v("rewind.filesSection")}),o.jsx("ul",{className:"rewind-files",children:e.map(i=>o.jsx("li",{children:i},i))}),o.jsx("p",{className:"modal-hint",children:v("rewind.filesHint")})]}),l!==null&&o.jsx("p",{className:"rewind-error",children:l}),o.jsxs("div",{className:"rewind-actions",children:[e.length>0?o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation-and-code"),children:v("rewind.undoAll")}),o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation"),children:v("rewind.undoConversation")})]}):o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>u("conversation"),children:v("rewind.undo")}),o.jsx("button",{className:"link-button",onClick:y,children:v("common.cancel")}),s&&o.jsx("span",{className:"modal-hint",children:v("rewind.running")})]})]})]})})}function U2(t){const[e,s]=N.useState(null),l=N.useRef(null),u=N.useRef(null),y=N.useCallback(g=>{l.current=g,s(g)},[]);N.useEffect(()=>t.onMessage(g=>{const _=u.current;if(_!==null){if(g.type==="agent.rewound"&&g.requestId===_){u.current=null,y(null);return}if(g.type==="error"&&g.requestId===_){u.current=null;const h=l.current;h!==null&&y({...h,phase:"failed",error:At(g.text)})}}}),[t,y]);const b=N.useCallback((g,_)=>{u.current=null,y({terminalId:g,eventId:_,phase:"confirm",error:null})},[y]),i=N.useCallback(g=>{const _=l.current;if(_===null||_.phase==="running")return;const h=crypto.randomUUID();u.current=h,t.send({type:"agent.rewind",terminalId:_.terminalId,eventId:_.eventId,restore:g,requestId:h}),y({..._,phase:"running",error:null})},[t,y]),a=N.useCallback(()=>{u.current=null,y(null)},[y]);return{state:e,open:b,confirm:i,close:a}}const Ym={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},Xm=320,$2=1400,W2=640,Qm=200,Jm=560,z2=270,q2=120,V2=720,K2=260,Zm="agent-workbench.panel-width",eg="agent-workbench.panel-visible",tg="agent-workbench.panel-tab",qu="agent-workbench.panel-expanded",Vu="agent-workbench.sidebar-visible",ng="agent-workbench.sidebar-width",Ku="agent-workbench.console-visible",rg="agent-workbench.console-height",sg="agent-workbench.marker-notice-dismissed",ig="agent-workbench.hidden-hint-shown";function G2(){var oo,pl,ml;const t=Vo(),e=v2(),{connection:s,status:l,agents:u,defaultAgent:y,capabilitiesFor:b,offerAgentChoice:i,cliAvailable:a,cliVersion:g,cliMissingMessage:_,platform:h,defaultCwd:k,environmentNotice:T,shellName:M,terminals:w,archiveSessions:d,shells:m,pendingOpens:p,activeTerminalId:f,projects:x,indexStatus:j,error:E,dismissError:R,setActiveTerminal:S,openTerminal:L,openShell:I,closeTerminal:P,wakeTerminal:D,waking:F,activity:W,offlineReasons:$,relaunching:Y,renameTerminal:G,reorderTabs:V,refreshIndex:B,refreshAgents:U,continueSession:H,expectTab:z,handoffs:Z,dismissHandoff:ie,returnedMessages:_e,dismissReturned:ge,prefills:Q,prefillApplied:K,drafts:te,remoteClient:ee,fileCheck:we,fileWrite:ke}=e,Ae=UL(),Me=zL(Ae.resolved),Je=N.useMemo(()=>({nameOf:X=>Om(w.find(ve=>ve.terminalId===X)),activate:S}),[w,S]),it=d5(W,Je),Ie=h5(),ae=w.find(X=>X.terminalId===f)??null,mt=N.useCallback(X=>{X!==f&&R(),S(X)},[f,R,S]),De=(ae==null?void 0:ae.agent)??null,Fe=b(De),Ze=(ae==null?void 0:ae.review)===!0,Se=N.useMemo(()=>Gy(Fe,Ze),[Fe,Ze]),be=u.find(X=>X.id===De)??null,je=N.useMemo(()=>{if(ae===null||De===null)return null;for(const X of x){const ve=X.sessions.find(tt=>tt.agent===De&&tt.sessionId===ae.sessionId);if(ve!==void 0)return mr(ve.title,ve.titleSource)}return null},[ae,De,x,t]),pe=N.useMemo(()=>zy(w,x.flatMap(X=>X.sessions)),[w,x]),Xe=(be==null?void 0:be.statusLine)??null,$e=OL(s),He=N.useMemo(()=>{var X;return De===null?[]:((X=$e.find(ve=>ve.agent===De))==null?void 0:X.windows)??[]},[$e,De]),Pe=(be==null?void 0:be.planLimitsSetup)??null,re=(ae==null?void 0:ae.cwd)??k,fe=N.useMemo(()=>i?yk(w,re,h,u,y):null,[i,w,re,h,u,y]),Le=N.useMemo(()=>xp(p,re,h),[p,re,h]),Qe=Le?zg():null,at=PL(s),ct=n2(s),[wt,Xt]=N.useState(!1),he=v5(s),[nt,et]=N.useState(!1),dt=f1(),de=N2(),[Ke,ft]=N.useState(!1),ye=N.useCallback(()=>ft(!1),[]),[ht,Rt]=N.useState(()=>Dt(Ip,"chat",yC)),vt=N.useMemo(()=>kC({hasTab:ae!==null,plansAvailable:Se.plansAvailable,hidden:de.hidden}),[ae,Se.plansAvailable,de.hidden]),Ye=CC(ht,vt),ot=N.useCallback(X=>{Rt(X),Tt(Ip,X)},[]),bt=N.useRef(t2);N.useEffect(()=>{if(bt.current!==null)return s.onMessage(X=>{if(X.type!=="terminal.list"||bt.current===null)return;const ve=bt.current;bt.current=null,X.terminals.some(tt=>tt.terminalId===ve&&tt.kind==="agent")&&S(ve)})},[s,S]);const un=ZT(s),Cn=jx(u,ct.status),[Or,Mt]=N.useState(null),on=N.useRef(0),Oi=N.useCallback(X=>{Mt(ve=>ve!==null&&ve.seq===X?null:ve)},[]),_r=(X,ve)=>{const tt=Gx(X,{projects:x,terminals:w,platform:h,canResume:Kt=>bp(u,Kt)}),Et=()=>{ve.length!==0&&(on.current+=1,Mt({query:ve,seq:on.current}))};switch(tt.kind){case"activate":mt(tt.terminalId),Et();break;case"resume":tt.session.archived&&d([tt.session.sessionId],!1),L({cwd:tt.cwd,resumeSessionId:tt.session.sessionId,agent:tt.session.agent,label:mr(tt.session.title,tt.session.titleSource)}),Et();break;case"copy":ct.openSession(X.agent,X.sessionId);break}},_s=N.useMemo(()=>new Set(w.map(X=>X.sessionId).filter(X=>X.length>0)),[w]),[qt,Vn]=N.useState(()=>Dt(eg,!0,X=>X==="true")),[wr,Xs]=N.useState(()=>Dt(tg,"cli",X=>X==="git"||X==="files"||X==="cli"||X==="plans"||X==="memory"?X:X==="conversation"?"cli":null)),[br,yr]=N.useState(()=>Dt(Zm,W2,X=>{const ve=Number.parseInt(X,10);return Number.isFinite(ve)?Math.max(ve,Xm):null})),[nr,Br]=N.useState(()=>Dt(qu,!1,X=>X==="true")),[Fr,Hr]=N.useState(()=>Dt(Vu,!0,X=>X==="true")),[Nt,Qs]=N.useState(()=>Dt(ng,z2,X=>{const ve=Number.parseInt(X,10);return Number.isFinite(ve)?Math.min(Jm,Math.max(Qm,ve)):null})),[rr,Ur]=N.useState(()=>Dt(Ku,!1,X=>X==="true")),[kr,Bi]=N.useState(()=>Dt(rg,K2,X=>{const ve=Number.parseInt(X,10);return Number.isFinite(ve)?ve:null})),[Js,$r]=N.useState(()=>Dt(sg,!0,X=>X!=="true")),[wn,Wr]=N.useState(!1),Qt=D2(s),me=P2(s),Oe=((oo=Qt.status)==null?void 0:oo.scheduledMessages)===!0&&me.messages!==null,lt=N.useMemo(()=>{const X=new Map;for(const ve of w){const tt=qC(me.messages,ve.terminalId);tt.length>0&&X.set(ve.terminalId,tt)}return X},[me.messages,w]),[yt,pt]=N.useState(null),Jt=N.useCallback(X=>{const ve=KC(lt.get(X)??[]);ve===null?P(X):pt({terminalId:X,warning:ve})},[lt,P]),[Dn,Pn]=N.useState(!1),zr=Qt.status!==null?Qt.status.shellName:M,[Zs,Fi]=N.useState(null),[ws,sr]=N.useState(null),ir=u.find(X=>X.id===ws)??null;N.useEffect(()=>{ws!==null&&((ir==null?void 0:ir.statusLine)??null)===null&&sr(null)},[ws,ir]);const[Hi,kt]=N.useState(!1);N.useEffect(()=>{Pe===null&&kt(!1)},[Pe]);const[ei,Cr]=N.useState(null),or=qt&&ae!==null,qr=ak(wr,Se.plansAvailable,de.hidden),Ui=rr&&de.isVisible("console"),Sr=ae!==null?qt||Ui:qt,bs=nr&&ae!==null,Rn=N.useMemo(()=>ae===null?[]:m.filter(X=>X.cwd===ae.cwd),[m,ae]),[lr,Kn]=N.useState(null),bn=Rn.find(X=>X.terminalId===lr)??Rn[0]??null,ar=Ye==="cli"?f:Ye==="console"?(bn==null?void 0:bn.terminalId)??null:null,ys=N.useCallback(X=>{ar!==null&&s.send({type:"input",terminalId:ar,data:X})},[s,ar]),xt=ax(s,f),$i=p5(s,W),Wi=dt?ae!==null:or,ks=dt?Ye==="files":or&&qr==="files",zi=ML(s,Wi?f:null),Cs=d2(s,(dt?Ye==="git":or&&qr==="git")?f:null,zi.status.updatedAt),It=h2(s,z,S),Ut=f2(s,z,S),{closeChanges:Vr}=Ut;N.useEffect(()=>Vr(),[f,Vr]);const On=X=>X.split(/[\\/]/).filter(ve=>ve.length>0).pop()??X,xr=X=>{var ve;return((ve=u.find(tt=>tt.id===X))==null?void 0:ve.label)??X},ti={rows:Cs.rows,kept:Cs.kept,onDeleteBranch:X=>It.openDeleteBranch(X.id,X.branch),onNew:()=>{if(ae===null)return;const X=Vs(ae);It.openCreate({kind:"terminal",terminalId:ae.terminalId},X,On(X))},onOpen:X=>{const ve=vr(X.path,h),tt=w.find(Et=>vr(Et.cwd,h)===ve&&!Et.review);tt!==void 0?mt(tt.terminalId):L({cwd:X.path})},onRemove:X=>It.openRemove(X.id,X.branch??On(X.path)),changes:Ut.changes,onViewChanges:X=>Ut.openChanges(X.id,X.branch??On(X.path)),onOpenChangeDiff:Ut.openChangeDiff,onCloseChangeDiff:Ut.closeChangeDiff,onCloseChanges:Ut.closeChanges,onRequestReview:X=>Ut.openReview(X.id,X.branch??On(X.path),ae===null?X.path:Vs(ae)),onSendReview:X=>Ut.sendReview(X.id),onShowReviewer:X=>mt(X),onCatchUp:X=>Ut.catchUp(X.id),onIntegrate:X=>Ut.openIntegrate(X.id,X.branch??On(X.path)),agentLabel:xr},Da=(()=>{var Et;const X=It.create;if(X===null)return null;const{source:ve}=X;if(ve.kind==="terminal")return((Et=w.find(Kt=>Kt.terminalId===ve.terminalId))==null?void 0:Et.agent)??y;const tt=x.find(Kt=>Kt.key===ve.projectKey);return tt===void 0?y:yp(w,tt,h,u,y)})(),Pa=JT(s,ks?f:null),ni=eL(s,f),Ss=wL(s,w,f,ke),xs=DL(s,Wi?f:null),Yo=dt?Ye==="cli":or&&qr==="cli",Gn=xt.usage.lastModel,ri=Vy(xt.events,xt.usage.lastEffort,(ae==null?void 0:ae.launchedAt)??null),Es=Gn??xt.defaults.model,qi=ri??xt.defaults.effort,si=Gn===null&&Es!==null,ii=ri===null&&qi!==null,Vi=XT(s,f,Yo),Vt=f===null?null:W.get(f)??null,Er=Dk(Fe,xt.openToolCall,(be==null?void 0:be.label)??null,(ae==null?void 0:ae.alive)??!1,Vt),Ts=Pk({offlineReason:f===null?null:$.get(f)??null,alive:(ae==null?void 0:ae.alive)??!1,relaunching:f!==null&&Y.has(f)}),Tr=Ts===null?null:Ok((be==null?void 0:be.label)??null),Oa=Tr??Er??Uk(Fe,xt.waitingFor,(ae==null?void 0:ae.alive)??!1),Ki=!lg(Fe,Vt),Gi=N.useMemo(()=>Ug(u,De),[u,De]),Kr=ae!==null&&Ak(De,ae.sessionId,Fe),Mn=f===null?null:Z.get(f)??null,Xo=Mn===null?null:{text:xk(zo(Mn.sourceAgent,u),Mn.includedTurns,Mn.totalTurns,Mn.totalTurnsIsMinimum),status:Mn.prefillReason!==null?Nk(Mn.prefillReason):Mn.delivery==="sending"&&xt.events.length===0?Ek():null},Qo=f===null?void 0:_e.get(f),Ba=Xo??(Qo===void 0?null:{text:Qo==="stopped-early"?Lk():Tk((be==null?void 0:be.label)??null),status:null}),Jo=N.useCallback(X=>{ie(X),ge(X)},[ie,ge]),cr=N.useCallback(()=>{Vn(X=>{const ve=!X;return Tt(eg,String(ve)),ve})},[]),Zo=N.useCallback(()=>{Hr(X=>{const ve=!X;return Tt(Vu,String(ve)),ve})},[]),Yi=N.useCallback(()=>{dt||(Hr(!1),Tt(Vu,"false"))},[dt]),Fa=N.useCallback(()=>{Ur(X=>{const ve=!X;return Tt(Ku,String(ve)),ve})},[]),Xi=N.useCallback(X=>{Xs(X),Tt(tg,X)},[]),Ha=N.useCallback(()=>{Br(X=>{const ve=!X;return Tt(qu,String(ve)),ve})},[]),Ls=U2(s),{open:el}=Ls,Ua=N.useCallback(X=>{f!==null&&el(f,X)},[el,f]),$a=N.useCallback(X=>{f!==null&&s.send({type:"input",terminalId:f,data:`${X} `})},[s,f]),oi=N.useRef(null),Qi=N.useCallback(X=>{var ve;return(ve=oi.current)==null?void 0:ve.call(oi,X,!dt)},[dt]),li=N.useRef(null),tl=X=>{if(Ss.files.open({key:X,title:X.split("/").pop()??X}),dt){ot("files");return}or||cr(),Xi("files")},nl=N.useRef(tl);nl.current=tl;const rl=N.useCallback(X=>nl.current(X),[]),Wa=N.useMemo(()=>w.map(X=>X.terminalId),[w]),sl=N.useCallback(X=>{f!==null&&s.send({type:"files.reveal",terminalId:f,path:X})},[s,f]),za=RL({connection:s,enabled:we&&de.isVisible("files"),terminalId:f,cwd:(ae==null?void 0:ae.cwd)??"",platform:h,events:xt.events,liveTerminalIds:Wa,onOpen:rl,onOpenFolder:ee?null:sl}),Ji=N.useCallback(X=>{f!==null&&s.send({type:"agent.submit",terminalId:f,text:X,images:[],keepDraft:!0})},[s,f]),ai=Uy(De),qa=N.useMemo(()=>{if(ai===null||ae===null)return null;const X=ae.alive?Vt==="busy"||Vt==="waiting"?v("meter.compactBusy"):null:v("meter.compactNoCli");return{command:ai,blockedReason:X,onCompact:()=>Ji(ai)}},[ai,ae,Vt,Ji,t]),Va=N.useCallback(()=>{Ur(!0),Tt(Ku,"true");const X=G1({cwd:(ae==null?void 0:ae.cwd)??null,shellCwds:m.map(ve=>ve.cwd),shellAvailable:zr!==null});X!==null&&I(X)},[ae,m,zr,I]),Ns=N.useCallback(X=>{if(X==="console")for(const ve of m)P(ve.terminalId);de.setVisible(X,!1),!Dt(ig,!1,ve=>ve==="true")&&(Tt(ig,"true"),Fi(X))},[m,P,de]),Rs=N.useCallback(()=>{for(const X of m)P(X.terminalId);de.setVisible("console",!1)},[m,P,de]),il=N.useRef(new Set);N.useEffect(()=>{const X=Rn.filter(tt=>!il.current.has(tt.terminalId));for(const tt of Rn)il.current.add(tt.terminalId);const ve=X[X.length-1];ve!==void 0&&Kn(ve.terminalId)},[Rn]);const ol=N.useCallback(()=>{ae!==null&&I(ae.cwd)},[ae,I]),ll=wa({min:Xm,max:$2,value:br,measure:N.useCallback(X=>window.innerWidth-X.clientX,[]),onChange:yr,onCommit:N.useCallback(X=>Tt(Zm,String(X)),[]),onStart:N.useCallback(()=>{Br(!1),Tt(qu,"false")},[])}),al=wa({min:Qm,max:Jm,value:Nt,measure:N.useCallback(X=>X.clientX,[]),onChange:Qs,onCommit:N.useCallback(X=>Tt(ng,String(X)),[])}),Zi=N.useRef(0),cl=wa({min:q2,max:V2,value:kr,measure:N.useCallback(X=>Math.round(Zi.current-X.clientY),[]),onChange:Bi,onCommit:N.useCallback(X=>Tt(rg,String(X)),[]),onStart:N.useCallback(X=>{const ve=X.currentTarget.nextElementSibling;Zi.current=ve===null?window.innerHeight:X.clientY+ve.getBoundingClientRect().height},[])}),Gr=N.useCallback(()=>{$r(!1),Tt(sg,"true")},[]),eo=N.useCallback(X=>{if(w.length===0)return;const tt=(w.findIndex(Kt=>Kt.terminalId===f)+X+w.length)%w.length,Et=w[tt];Et!==void 0&&mt(Et.terminalId)},[w,f,mt]),ul=N.useRef(null),to=N.useRef(null);N.useEffect(()=>{f!==to.current&&(ul.current=to.current,to.current=f)},[f]);const no=N.useCallback(()=>{const X=ul.current;X===null||X===f||w.some(ve=>ve.terminalId===X)&&mt(X)},[f,w,mt]);N.useEffect(()=>{const X=ve=>{if(ve.key!=="Tab"||!ve.shiftKey||ve.altKey||ve.ctrlKey||ve.metaKey)return;const tt=document.activeElement;tt instanceof Element&&tt.closest(".xterm")!==null||(ve.preventDefault(),ve.stopPropagation(),no())};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[no]),N.useEffect(()=>{const X=ve=>{if(!ve.altKey||ve.ctrlKey||ve.metaKey)return;const tt=ve.key.toLowerCase();if(tt==="t"){a&&k.length>0&&!Le&&(ve.preventDefault(),ve.stopPropagation(),L({cwd:(ae==null?void 0:ae.cwd)??k}));return}if(tt==="w"){f!==null&&(ve.preventDefault(),ve.stopPropagation(),Jt(f));return}if(tt==="p"){ve.preventDefault(),ve.stopPropagation(),cr();return}if(tt==="arrowright"||tt==="pagedown"){ve.preventDefault(),ve.stopPropagation(),eo(1);return}(tt==="arrowleft"||tt==="pageup")&&(ve.preventDefault(),ve.stopPropagation(),eo(-1))};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[ae,f,a,Jt,eo,k,Le,L,cr]);const dl=ae===null?v("app.panel.name"):ae.label.length>0?ae.label:ae.cwd.split(/[\\/]/).filter(X=>X.length>0).pop()??ae.cwd,Yr=o.jsx(AE,{projects:x,indexStatus:j,disabled:!a,onOpenProject:(X,ve)=>{ye(),L({cwd:X,...ve!==void 0?{agent:ve}:{},onOpened:Yi})},agents:u,offerAgentChoice:i,agentForProject:X=>yp(w,X,h,u,y),onOpenSession:(X,ve)=>{ye(),L({cwd:X,resumeSessionId:ve.sessionId,agent:ve.agent,label:mr(ve.title,ve.titleSource)})},canResume:X=>bp(u,X),platform:h,onRefresh:B,openSessionIds:_s,openBlocked:X=>xp(p,X,h),onArchive:d,onHide:dt?ye:Zo,width:Nt,onNewProject:()=>{ye(),Cr("project")},vault:ct.status,onOpenVault:()=>{ye(),Xt(!0)},onOpenVaultSession:ee?null:X=>ct.openSession(X.agent,X.sessionId),onExportProject:ee?null:ct.exportProject,exporting:ct.exporting,lastExported:ct.lastExported,onNewWorktree:X=>{ye(),It.openCreate({kind:"project",projectKey:X.key},X.cwd,On(X.cwd),Yi)},onReopenWorktree:(X,ve)=>{var tt;ye(),It.reopen(X.agent,X.sessionId,ve.cwd,((tt=X.worktree)==null?void 0:tt.branch)??"")},onContinueSession:(X,ve)=>{ye(),H({agent:X.agent,sessionId:X.sessionId},ve,Cp(mr(X.title,X.titleSource)))},globalSearch:Cn?{...un,vaultEnabled:((pl=ct.status)==null?void 0:pl.enabled)===!0}:null,onOpenSearchHit:(X,ve)=>{ye(),_r(X,ve)}}),Xr=o.jsx("div",{className:"chat-stack",children:w.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:v("app.empty.noTabs")}),o.jsx("p",{className:"empty-hint",children:v("app.empty.hint")}),a&&k.length>0&&o.jsx("button",{className:"primary-button",onClick:()=>L({cwd:k}),disabled:Le,title:Qe??void 0,children:Le?v("app.empty.opening"):v("app.empty.newSession",{cwd:k})})]}):o.jsx(vx,{view:xt,terminalId:f,threadFont:Ie,fileLinks:za,onRewind:Se.rewind&&(ae==null?void 0:ae.alive)===!0?Ua:void 0,rewindBlocked:Vt!=="idle",forceSendAvailable:Se.forceSend&&(ae==null?void 0:ae.alive)===!0,queueEditAvailable:Se.editQueue&&(ae==null?void 0:ae.alive)===!0,questionsAnswerable:Se.questionsAnswerable,contextWindowSource:Se.contextWindowSource,instructionsFile:Ky(De),onGoToCli:()=>{if(dt){ot("cli");return}or||cr(),Xi("cli")},cliPresence:ae===null||ae.alive?"live":ae.sleeping?"sleeping":"exited",cliLaunchedAt:(ae==null?void 0:ae.launchedAt)??null,exitCode:(ae==null?void 0:ae.exitCode)??null,waking:f!==null&&F.has(f),onWakeCli:()=>{f!==null&&D(f)},discovering:Kr,continueTargets:Gi,continueBlockedReason:Sk((ae==null?void 0:ae.sessionId)??"",Kr,xt.events.length>0),onContinue:ae===null||De===null?void 0:X=>H({agent:De,sessionId:ae.sessionId},X,Cp(je??ae.label)),searchRequest:Or,onSearchRequestApplied:Oi,toolCallNotice:Er,serverClosed:Ts===null||Tr===null?null:{state:Ts,text:Tr},statusLineState:(Xe==null?void 0:Xe.state)??null,onConfigureStatusLine:Xe===null||be===null?void 0:()=>sr(be.id),activity:Vt,receipt:f===null?null:$i.receipts.get(f)??null,clock:f===null?null:$i.clocks.get(f)??null,takeNotice:it.takeNotice,planWindows:He,planSetupState:(Pe==null?void 0:Pe.state)??null,onConfigurePlanLimits:Pe===null?void 0:()=>kt(!0),compactAction:qa,scheduled:f===null?void 0:lt.get(f),onCancelScheduled:me.cancel,onSendScheduledNow:Oe?me.sendNow:void 0})}),hl=o.jsx(o.Fragment,{children:ae!==null&&o.jsx(k1,{connection:s,drafts:te,terminalId:f,alive:ae.alive,sleeping:ae.sleeping,projectColor:Ys(Vs(ae)),activity:W.get(ae.terminalId),imagesAllowed:Se.imagesAllowed,blockedReason:Oa,prefills:Q,onPrefillApplied:K,notice:Ba,onDismissNotice:f===null?void 0:()=>Jo(f),onSubmitted:(X,ve,tt)=>{Jo(X);const{events:Et}=xt,Kt=X===f?Et[Et.length-1]:void 0;$i.track(X,ve,(Kt==null?void 0:Kt.eventId)??null,tt)},fontSize:Ie.size,insertRef:oi,noteInsertRef:li,onEditQueue:Se.editQueue&&ae.alive&&xt.queue.length>0&&xt.queue.every(X=>X.forced!==!0)&&xt.waitingFor===null&&!xt.editingQueue?xt.editQueue:void 0,onSchedule:Oe&&Se.scheduledSend?me.schedule:void 0,leading:Se.modeCycle===null?void 0:o.jsx(Gk,{mode:xt.permissionMode,cycle:Se.modeCycle,disabled:!ae.alive,waitingFor:xt.waitingFor,statusKnown:Ki,onChange:xt.setPermissionMode}),controls:Se.models===null&&Se.efforts===null?void 0:o.jsx(Kk,{models:Se.models,efforts:Se.efforts,model:Es,effort:qi,modelProvisional:si,effortProvisional:ii,savesChoice:qy(De),effortCommandName:Hy(De),disabled:!ae.alive,onCommand:Ji})})}),Ms=ae===null?null:o.jsx(zT,{tab:dt?jp(Ye)??qr:qr,plansAvailable:Se.plansAvailable,hiddenTabs:de.hidden,hidden:dt?jp(Ye)===null:!qt,onTabChange:dt?ot:Xi,title:dl,cwd:ae.cwd,colorCwd:Vs(ae),platform:h,cli:o.jsx("div",{className:"terminal-stack",children:w.map(X=>o.jsx(fv,{terminalId:X.terminalId,connection:s,active:X.terminalId===f,theme:Me.resolved,autoFocus:!1},X.terminalId))}),cliUnseen:Vi,expanded:nr,onToggleExpanded:Ha,git:zi,worktrees:ti,files:Pa,plans:ni,documents:Ss,memory:xs,onInsert:Se.fileMentions&&ae.alive?$a:void 0,onInsertPath:Qi,onReveal:ee?null:sl,onHide:cr}),fl=ae===null?null:o.jsx(K1,{connection:s,shells:Rn,activeShellId:(bn==null?void 0:bn.terminalId)??null,cwd:ae.cwd,shellName:zr,theme:Me.resolved,onSelect:Kn,onOpen:ol,onCloseShell:P,onCollapse:dt?()=>ot("chat"):Fa,onHide:dt?void 0:()=>Ns("console"),hideCount:m.length}),ro=de.isVisible("notes")?o.jsx(z5,{notes:at,fill:dt||ae===null,onHide:dt?void 0:()=>Ns("notes"),onSendNote:ae===null||!Se.noteSendable?null:X=>{const ve=ae.cwd;L({cwd:ve,...ae.agent!==null?{agent:ae.agent}:{},onOpened:tt=>{s.send({type:"notes.send",noteId:X,terminalId:tt.terminalId}),dt&&ot("chat")}})},sendTargetCwd:(ae==null?void 0:ae.cwd)??null,onNoteToComposer:ae===null?null:X=>{var Et;const ve=at.notes.find(Kt=>Kt.noteId===X);if(ve===void 0)return;const tt=DC(ve.images,at.images,Kt=>`${v("notes.imageOnly")} ${Kt+1}`);(Et=li.current)==null||Et.call(li,ve.text,tt,!dt),dt&&ot("chat")},composerTarget:ae===null?null:Om(ae)}):null,so=ae===null||!de.isVisible("console")?null:o.jsx(o.Fragment,{children:Ui?o.jsxs(o.Fragment,{children:[qt&&o.jsx("div",{className:"hdivider",...cl,title:v("app.divider.consoleHeight")}),o.jsx("div",{className:"console-slot",style:qt?{height:`${kr}px`}:{flex:"1 1 auto"},children:fl})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:Va,title:zr===null?v("console.openAnyIn",{cwd:ae.cwd}):v("console.openIn",{shell:zr,cwd:ae.cwd}),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:zr??v("console.name")}),Rn.length>0&&o.jsx("span",{className:"strip-collapsed-count",children:Rn.length})]}),o.jsx(Ca,{title:v("settings.hide.console"),onHide:()=>Ns("console"),confirmText:m.length===0?null:v("settings.panels.consoleConfirm",{count:m.length})})]})}),ci=o.jsxs(o.Fragment,{children:[l==="revoked"&&o.jsx("div",{className:"banner banner-error",children:v("app.banner.revoked")}),Zs!==null&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:v("settings.hiddenHint",{name:v(Zs==="console"?"console.name":"notes.name")})}),o.jsx("button",{className:"banner-close",onClick:()=>Fi(null),title:v("common.gotIt"),children:"×"})]}),!a&&_!==null&&o.jsx("div",{className:"banner banner-error banner-lines",children:_}),T==="child-session-marker"&&Js&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:cn("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),o.jsx("button",{className:"banner-close",onClick:Gr,title:v("common.gotIt"),children:"×"})]}),E!==null&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:E.message}),o.jsx("button",{className:"banner-close",onClick:R,title:v("common.close"),children:"×"})]}),ct.problem!==null&&!wt&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:ct.problem}),o.jsx("button",{className:"banner-close",onClick:ct.dismissProblem,title:v("common.close"),children:"×"})]}),o.jsx(rE,{})]}),Qr=Ls.state,io=o.jsxs(o.Fragment,{children:[Qr!==null&&o.jsx(H2,{preview:px(xt.events.find(X=>X.eventId===Qr.eventId)),files:fx(xt.events,Qr.eventId,(ae==null?void 0:ae.cwd)??""),running:Qr.phase==="running",error:Qr.error,onConfirm:Ls.confirm,onClose:Ls.close}),ir!==null&&ir.statusLine!==null&&o.jsx(hm,{info:ir.statusLine,agentLabel:ir.label,onRefresh:U,onClose:()=>sr(null)}),Hi&&Pe!==null&&be!==null&&o.jsx(hm,{info:Pe,agentLabel:be.label,purpose:"plan-limits",onRefresh:U,onClose:()=>kt(!1)}),It.create!==null&&o.jsx(_2,{dialog:It.create,agents:u,offerAgentChoice:i,agent:Da,onSubmit:It.submitCreate,onClose:It.closeCreate}),It.remove!==null&&o.jsx(y2,{dialog:It.remove,onConfirm:It.confirmRemove,onDiscardFiles:It.discardFiles,onAskNotes:It.askNotes,onAskCommit:It.askCommit,onRetry:It.retryRemove,onClose:It.closeRemove,scheduledCountFor:X=>X.reduce((ve,tt)=>ve+(lt.get(tt)??[]).filter(Et=>Et.state!=="failed").length,0)}),yt!==null&&o.jsx(O2,{warning:yt.warning,onConfirm:()=>{P(yt.terminalId),pt(null)},onClose:()=>pt(null)}),Ut.review!==null&&o.jsx(k2,{dialog:Ut.review,agents:u,onSubmit:Ut.submitReview,onClose:Ut.closeReview}),Ut.integrate!==null&&o.jsx(b2,{dialog:Ut.integrate,agentLabel:xr,onConfirm:Ut.confirmIntegrate,onRemove:()=>{const X=Ut.integrate;Ut.closeIntegrate(),X!==null&&It.openRemove(X.worktreeId,X.branch)},onClose:Ut.closeIntegrate}),It.deleteBranch!==null&&o.jsx(w2,{dialog:It.deleteBranch,onConfirm:It.confirmDeleteBranch,onClose:It.closeDeleteBranch}),Dn&&o.jsx(j2,{onClose:()=>Pn(!1),terminalTheme:Me,panels:de,consoleCount:dt?0:m.length,onHideConsole:Rs,appSettings:Qt,agents:u,remoteClient:ee,onOpenVault:()=>{Pn(!1),Xt(!0)},onOpenRemote:he.status!==null&&!ee?()=>{Pn(!1),et(!0)}:null,onConfigureStatusLine:X=>{Pn(!1),sr(X)}}),wn&&o.jsx(eE,{agent:ck(De,u,y),onClose:()=>Wr(!1)}),ei==="project"&&o.jsx(am,{connection:s,title:v("app.picker.project.title"),confirmLabel:v("app.picker.project.confirm"),confirmTitle:X=>v("app.picker.project.confirmTitle",{path:X}),onChoose:(X,ve)=>{Cr(null),L({cwd:ve,onOpened:Yi})},onClose:()=>Cr(null)}),wt&&o.jsx(B2,{status:ct.status,agents:u,indexReady:j.state==="ready",problem:ct.problem,covered:ei==="vault",onMeasure:ct.measure,onSetEnabled:ct.setEnabled,onChangeDir:()=>Cr("vault"),onReveal:ee?null:ct.reveal,onDismissProblem:ct.dismissProblem,onClose:()=>Xt(!1)}),nt&&he.status!==null&&!ee&&o.jsx(F5,{status:he.status,pairing:he.pairing,phonePairing:he.phonePairing,phoneStarted:he.phoneStarted,problem:he.problem,platform:h,onSetEnabled:he.setEnabled,onSetPort:he.setPort,onStartPairing:he.startPairing,onCancelPairing:he.cancelPairing,onStartPhonePairing:he.startPhonePairing,onCancelPhonePairing:he.cancelPhonePairing,onRenameDevice:he.renameDevice,onRevokeDevice:he.revokeDevice,onDismissProblem:he.dismissProblem,onClose:()=>et(!1)}),ei==="vault"&&o.jsx(am,{connection:s,title:v("app.picker.vault.title"),confirmLabel:v("app.picker.vault.confirm"),confirmTitle:X=>v("app.picker.vault.confirmTitle",{path:X}),onChoose:X=>{ct.chooseDir(X),Cr(null)},onClose:()=>Cr(null)})]});return dt?o.jsxs("div",{className:"app app-narrow",children:[o.jsx(X5,{banners:ci,status:l,statusLabel:v(Ym[l]),terminals:w,activeTerminalId:f,activity:W,agents:u,offerAgentChoice:i,newTabAgent:fe,platform:h,canOpen:a&&k.length>0,newTabBlockedTitle:Qe,onSelectTab:mt,onCloseTab:Jt,scheduled:lt,onRenameTab:G,onNewTab:X=>L({cwd:re,...X!==void 0?{agent:X}:{}}),drawer:Yr,drawerOpen:Ke,onDrawerChange:ft,menu:{cwd:(ae==null?void 0:ae.cwd)??null,cliVersion:g,themeIcon:Am[Ae.preference],themeTitle:Mm(Ae.preference),onCycleTheme:Ae.cycle,sound:it,remote:he.status!==null&&!ee?{title:`${v("app.header.remoteAccess")} — ${_d(he.status.state,he.status.port)}`,active:Um(he.status),onOpen:()=>et(!0)}:null,remoteClient:ee,onShortcuts:()=>Wr(!0),onSettings:()=>Pn(!0)},view:Ye,views:vt,onViewChange:ot,badges:{changes:e_(zi.status),plans:ni.plans.length,memory:((ml=xs.status)==null?void 0:ml.installed)===!0?xs.status.notes.length:0,cliUnseen:Vi},chat:o.jsxs(o.Fragment,{children:[Xr,hl]}),panel:Ms,notes:ro,console:fl,onTerminalKey:ar===null?null:ys}),io]}):o.jsxs("div",{className:"app",children:[o.jsxs("header",{className:"app-header",children:[o.jsx("span",{className:"app-name",children:"Agent Workbench"}),o.jsx("span",{className:`status status-${l}`,children:v(Ym[l])}),ae!==null&&o.jsx("span",{className:"meta",title:ae.cwd,children:ae.cwd}),o.jsx("span",{className:"header-spacer"}),g!==null&&o.jsx("span",{className:"meta meta-dim",children:v("app.header.cliVersion",{version:g})}),o.jsx("button",{className:"icon-button",onClick:Ae.cycle,title:Mm(Ae.preference),children:Am[Ae.preference]}),o.jsx(h_,{sound:it}),o.jsx(f_,{notify:it.notify}),he.status!==null&&!ee&&o.jsx("button",{className:`icon-button${Um(he.status)?" icon-button-on":""}`,onClick:()=>et(!0),title:`${v("app.header.remoteAccess")} — ${_d(he.status.state,he.status.port)}`,children:"⇄"}),ee&&o.jsx("span",{className:"remote-badge",title:v("app.header.remoteBadgeTitle"),children:v("app.header.remoteBadge")}),o.jsx("button",{className:"icon-button",onClick:()=>Pn(!0),title:v("settings.open"),"aria-label":v("settings.open"),children:"⚙"}),o.jsx("button",{className:"icon-button",onClick:()=>Wr(!0),title:v("app.header.shortcuts"),children:"?"})]}),ci,o.jsxs("div",{className:"app-body",children:[!Fr&&o.jsxs("button",{className:"panel-peek panel-peek-left",onClick:Zo,title:v("app.sidebar.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"»"}),o.jsx("span",{className:"panel-peek-label",children:v("app.sidebar.name")})]}),Fr&&Yr,Fr&&o.jsx("div",{className:"divider",...al,title:v("app.divider.width")}),o.jsxs("main",{className:`workspace${bs&&Sr?" workspace-narrow":""}`,children:[o.jsx(YT,{terminals:w,activeTerminalId:f,activity:W,attention:it.attention,canOpen:a&&k.length>0,onSelect:mt,onClose:Jt,scheduled:lt,onRename:G,onReorder:V,onNew:X=>L({cwd:re,...X!==void 0?{agent:X}:{}}),agents:u,offerAgentChoice:i,newTabAgent:fe,pendingOpens:p,platform:h,newTabBlockedTitle:Qe,sessionTitles:pe}),Xr,hl]}),o.jsxs(o.Fragment,{children:[!Sr&&o.jsxs("button",{className:"panel-peek",onClick:cr,title:v("app.panel.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"«"}),o.jsx("span",{className:"panel-peek-label",children:v("app.panel.name")})]}),Sr&&o.jsx("div",{className:"divider",...ll,title:v("app.divider.width")}),o.jsxs("div",{className:`panel-slot${Sr?"":" panel-slot-collapsed"}${Sr&&bs?" panel-slot-expanded":""}`,style:Sr&&!bs?{width:`${br}px`}:void 0,children:[ae!==null&&o.jsxs(o.Fragment,{children:[Ms,so]}),ro]})]})]}),io]})}const y_=document.getElementById("root");if(y_===null)throw new Error("Falta el contenedor #root.");const Y2=xw.createRoot(y_);US().then(()=>Y2.render(o.jsx(G2,{})));export{vw as g};
|