agent-workbench 0.9.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,163 +0,0 @@
1
- var Mw=Object.defineProperty;var Aw=(t,e,s)=>e in t?Mw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var Ut=(t,e,s)=>Aw(t,typeof e!="symbol"?e+"":e,s);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const y of c)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(c){const y={};return c.integrity&&(y.integrity=c.integrity),c.referrerPolicy&&(y.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?y.credentials="include":c.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function l(c){if(c.ep)return;c.ep=!0;const y=s(c);fetch(c.href,y)}})();function Iw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vu={exports:{}},jo={},_u={exports:{}},vt={};/**
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 Zf;function jw(){if(Zf)return vt;Zf=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=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"),f=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),d=Symbol.iterator;function k(H){return H===null||typeof H!="object"?null:(H=d&&H[d]||H["@@iterator"],typeof H=="function"?H:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,w={};function h(H,z,Z){this.props=H,this.context=z,this.refs=w,this.updater=Z||E}h.prototype.isReactComponent={},h.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")},h.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function v(){}v.prototype=h.prototype;function g(H,z,Z){this.props=H,this.context=z,this.refs=w,this.updater=Z||E}var p=g.prototype=new v;p.constructor=g,M(p,h.prototype),p.isPureReactComponent=!0;var S=Array.isArray,j=Object.prototype.hasOwnProperty,L={current:null},R={key:!0,ref:!0,__self:!0,__source:!0};function x(H,z,Z){var ie,ye={},_e=null,Q=null;if(z!=null)for(ie in z.ref!==void 0&&(Q=z.ref),z.key!==void 0&&(_e=""+z.key),z)j.call(z,ie)&&!R.hasOwnProperty(ie)&&(ye[ie]=z[ie]);var Y=arguments.length-2;if(Y===1)ye.children=Z;else if(1<Y){for(var ne=Array(Y),ee=0;ee<Y;ee++)ne[ee]=arguments[ee+2];ye.children=ne}if(H&&H.defaultProps)for(ie in Y=H.defaultProps,Y)ye[ie]===void 0&&(ye[ie]=Y[ie]);return{$$typeof:t,type:H,key:_e,ref:Q,props:ye,_owner:L.current}}function T(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 O(H){var z={"=":"=0",":":"=2"};return"$"+H.replace(/[=:]/g,function(Z){return z[Z]})}var P=/\/+/g;function F(H,z){return typeof H=="object"&&H!==null&&H.key!=null?O(""+H.key):z.toString(36)}function W(H,z,Z,ie,ye){var _e=typeof H;(_e==="undefined"||_e==="boolean")&&(H=null);var Q=!1;if(H===null)Q=!0;else switch(_e){case"string":case"number":Q=!0;break;case"object":switch(H.$$typeof){case t:case e:Q=!0}}if(Q)return Q=H,ye=ye(Q),H=ie===""?"."+F(Q,0):ie,S(ye)?(Z="",H!=null&&(Z=H.replace(P,"$&/")+"/"),W(ye,z,Z,"",function(ee){return ee})):ye!=null&&(I(ye)&&(ye=T(ye,Z+(!ye.key||Q&&Q.key===ye.key?"":(""+ye.key).replace(P,"$&/")+"/")+H)),z.push(ye)),1;if(Q=0,ie=ie===""?".":ie+":",S(H))for(var Y=0;Y<H.length;Y++){_e=H[Y];var ne=ie+F(_e,Y);Q+=W(_e,z,Z,ne,ye)}else if(ne=k(H),typeof ne=="function")for(H=ne.call(H),Y=0;!(_e=H.next()).done;)_e=_e.value,ne=ie+F(_e,Y++),Q+=W(_e,z,Z,ne,ye);else if(_e==="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=[],ye=0;return W(H,ie,"","",function(_e){return z.call(Z,_e,ye++)}),ie}function K(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},q={transition:null},D={ReactCurrentDispatcher:G,ReactCurrentBatchConfig:q,ReactCurrentOwner:L};function U(){throw Error("act(...) is not supported in production builds of React.")}return vt.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}},vt.Component=h,vt.Fragment=s,vt.Profiler=c,vt.PureComponent=g,vt.StrictMode=l,vt.Suspense=a,vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,vt.act=U,vt.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),ye=H.key,_e=H.ref,Q=H._owner;if(z!=null){if(z.ref!==void 0&&(_e=z.ref,Q=L.current),z.key!==void 0&&(ye=""+z.key),H.type&&H.type.defaultProps)var Y=H.type.defaultProps;for(ne in z)j.call(z,ne)&&!R.hasOwnProperty(ne)&&(ie[ne]=z[ne]===void 0&&Y!==void 0?Y[ne]:z[ne])}var ne=arguments.length-2;if(ne===1)ie.children=Z;else if(1<ne){Y=Array(ne);for(var ee=0;ee<ne;ee++)Y[ee]=arguments[ee+2];ie.children=Y}return{$$typeof:t,type:H.type,key:ye,ref:_e,props:ie,_owner:Q}},vt.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},vt.createElement=x,vt.createFactory=function(H){var z=x.bind(null,H);return z.type=H,z},vt.createRef=function(){return{current:null}},vt.forwardRef=function(H){return{$$typeof:i,render:H}},vt.isValidElement=I,vt.lazy=function(H){return{$$typeof:_,_payload:{_status:-1,_result:H},_init:K}},vt.memo=function(H,z){return{$$typeof:f,type:H,compare:z===void 0?null:z}},vt.startTransition=function(H){var z=q.transition;q.transition={};try{H()}finally{q.transition=z}},vt.unstable_act=U,vt.useCallback=function(H,z){return G.current.useCallback(H,z)},vt.useContext=function(H){return G.current.useContext(H)},vt.useDebugValue=function(){},vt.useDeferredValue=function(H){return G.current.useDeferredValue(H)},vt.useEffect=function(H,z){return G.current.useEffect(H,z)},vt.useId=function(){return G.current.useId()},vt.useImperativeHandle=function(H,z,Z){return G.current.useImperativeHandle(H,z,Z)},vt.useInsertionEffect=function(H,z){return G.current.useInsertionEffect(H,z)},vt.useLayoutEffect=function(H,z){return G.current.useLayoutEffect(H,z)},vt.useMemo=function(H,z){return G.current.useMemo(H,z)},vt.useReducer=function(H,z,Z){return G.current.useReducer(H,z,Z)},vt.useRef=function(H){return G.current.useRef(H)},vt.useState=function(H){return G.current.useState(H)},vt.useSyncExternalStore=function(H,z,Z){return G.current.useSyncExternalStore(H,z,Z)},vt.useTransition=function(){return G.current.useTransition()},vt.version="18.3.1",vt}var ep;function jd(){return ep||(ep=1,_u.exports=jw()),_u.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 tp;function Dw(){if(tp)return jo;tp=1;var t=jd(),e=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,c=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,f){var _,d={},k=null,E=null;f!==void 0&&(k=""+f),a.key!==void 0&&(k=""+a.key),a.ref!==void 0&&(E=a.ref);for(_ in a)l.call(a,_)&&!y.hasOwnProperty(_)&&(d[_]=a[_]);if(i&&i.defaultProps)for(_ in a=i.defaultProps,a)d[_]===void 0&&(d[_]=a[_]);return{$$typeof:e,type:i,key:k,ref:E,props:d,_owner:c.current}}return jo.Fragment=s,jo.jsx=b,jo.jsxs=b,jo}var np;function Pw(){return np||(np=1,vu.exports=Dw()),vu.exports}var o=Pw(),va={},wu={exports:{}},On={},bu={exports:{}},yu={};/**
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 rp;function Ow(){return rp||(rp=1,(function(t){function e(q,D){var U=q.length;q.push(D);e:for(;0<U;){var H=U-1>>>1,z=q[H];if(0<c(z,D))q[H]=D,q[U]=z,U=H;else break e}}function s(q){return q.length===0?null:q[0]}function l(q){if(q.length===0)return null;var D=q[0],U=q.pop();if(U!==D){q[0]=U;e:for(var H=0,z=q.length,Z=z>>>1;H<Z;){var ie=2*(H+1)-1,ye=q[ie],_e=ie+1,Q=q[_e];if(0>c(ye,U))_e<z&&0>c(Q,ye)?(q[H]=Q,q[_e]=U,H=_e):(q[H]=ye,q[ie]=U,H=ie);else if(_e<z&&0>c(Q,U))q[H]=Q,q[_e]=U,H=_e;else break e}}return D}function c(q,D){var U=q.sortIndex-D.sortIndex;return U!==0?U:q.id-D.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=[],f=[],_=1,d=null,k=3,E=!1,M=!1,w=!1,h=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function p(q){for(var D=s(f);D!==null;){if(D.callback===null)l(f);else if(D.startTime<=q)l(f),D.sortIndex=D.expirationTime,e(a,D);else break;D=s(f)}}function S(q){if(w=!1,p(q),!M)if(s(a)!==null)M=!0,K(j);else{var D=s(f);D!==null&&G(S,D.startTime-q)}}function j(q,D){M=!1,w&&(w=!1,v(x),x=-1),E=!0;var U=k;try{for(p(D),d=s(a);d!==null&&(!(d.expirationTime>D)||q&&!O());){var H=d.callback;if(typeof H=="function"){d.callback=null,k=d.priorityLevel;var z=H(d.expirationTime<=D);D=t.unstable_now(),typeof z=="function"?d.callback=z:d===s(a)&&l(a),p(D)}else l(a);d=s(a)}if(d!==null)var Z=!0;else{var ie=s(f);ie!==null&&G(S,ie.startTime-D),Z=!1}return Z}finally{d=null,k=U,E=!1}}var L=!1,R=null,x=-1,T=5,I=-1;function O(){return!(t.unstable_now()-I<T)}function P(){if(R!==null){var q=t.unstable_now();I=q;var D=!0;try{D=R(!0,q)}finally{D?F():(L=!1,R=null)}}else L=!1}var F;if(typeof g=="function")F=function(){g(P)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,$=W.port2;W.port1.onmessage=P,F=function(){$.postMessage(null)}}else F=function(){h(P,0)};function K(q){R=q,L||(L=!0,F())}function G(q,D){x=h(function(){q(t.unstable_now())},D)}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(q){q.callback=null},t.unstable_continueExecution=function(){M||E||(M=!0,K(j))},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return k},t.unstable_getFirstCallbackNode=function(){return s(a)},t.unstable_next=function(q){switch(k){case 1:case 2:case 3:var D=3;break;default:D=k}var U=k;k=D;try{return q()}finally{k=U}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,D){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var U=k;k=q;try{return D()}finally{k=U}},t.unstable_scheduleCallback=function(q,D,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,q){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,q={id:_++,callback:D,priorityLevel:q,startTime:U,expirationTime:z,sortIndex:-1},U>H?(q.sortIndex=U,e(f,q),s(a)===null&&q===s(f)&&(w?(v(x),x=-1):w=!0,G(S,U-H))):(q.sortIndex=z,e(a,q),M||E||(M=!0,K(j))),q},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(q){var D=k;return function(){var U=k;k=D;try{return q.apply(this,arguments)}finally{k=U}}}})(yu)),yu}var sp;function Bw(){return sp||(sp=1,bu.exports=Ow()),bu.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 ip;function Fw(){if(ip)return On;ip=1;var t=jd(),e=Bw();function s(n){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+n,u=1;u<arguments.length;u++)r+="&args[]="+encodeURIComponent(arguments[u]);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,c={};function y(n,r){b(n,r),b(n+"Capture",r)}function b(n,r){for(c[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,f=/^[: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]*$/,_={},d={};function k(n){return a.call(d,n)?!0:a.call(_,n)?!1:f.test(n)?d[n]=!0:(_[n]=!0,!1)}function E(n,r,u,C){if(u!==null&&u.type===0)return!1;switch(typeof r){case"function":case"symbol":return!0;case"boolean":return C?!1:u!==null?!u.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function M(n,r,u,C){if(r===null||typeof r>"u"||E(n,r,u,C))return!0;if(C)return!1;if(u!==null)switch(u.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,u,C,A,B,V){this.acceptsBooleans=r===2||r===3||r===4,this.attributeName=C,this.attributeNamespace=A,this.mustUseProperty=u,this.propertyName=n,this.type=r,this.sanitizeURL=B,this.removeEmptyString=V}var h={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){h[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];h[r]=new w(r,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){h[n]=new w(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){h[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){h[n]=new w(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){h[n]=new w(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){h[n]=new w(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){h[n]=new w(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){h[n]=new w(n,5,!1,n.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function g(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(v,g);h[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(v,g);h[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(v,g);h[r]=new w(r,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){h[n]=new w(n,1,!1,n.toLowerCase(),null,!1,!1)}),h.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){h[n]=new w(n,1,!1,n.toLowerCase(),null,!0,!0)});function p(n,r,u,C){var A=h.hasOwnProperty(r)?h[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,u,A,C)&&(u=null),C||A===null?k(r)&&(u===null?n.removeAttribute(r):n.setAttribute(r,""+u)):A.mustUseProperty?n[A.propertyName]=u===null?A.type===3?!1:"":u:(r=A.attributeName,C=A.attributeNamespace,u===null?n.removeAttribute(r):(A=A.type,u=A===3||A===4&&u===!0?"":""+u,C?n.setAttributeNS(C,r,u):n.setAttribute(r,u))))}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,j=Symbol.for("react.element"),L=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),O=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),G=Symbol.for("react.offscreen"),q=Symbol.iterator;function D(n){return n===null||typeof n!="object"?null:(n=q&&n[q]||n["@@iterator"],typeof n=="function"?n:null)}var U=Object.assign,H;function z(n){if(H===void 0)try{throw Error()}catch(u){var r=u.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 u=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(he){var C=he}Reflect.construct(n,[],r)}else{try{r.call()}catch(he){C=he}n.call(r.prototype)}else{try{throw Error()}catch(he){C=he}n()}}catch(he){if(he&&C&&typeof he.stack=="string"){for(var A=he.stack.split(`
35
- `),B=C.stack.split(`
36
- `),V=A.length-1,J=B.length-1;1<=V&&0<=J&&A[V]!==B[J];)J--;for(;1<=V&&0<=J;V--,J--)if(A[V]!==B[J]){if(V!==1||J!==1)do if(V--,J--,0>J||A[V]!==B[J]){var re=`
37
- `+A[V].replace(" at new "," at ");return n.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",n.displayName)),re}while(1<=V&&0<=J);break}}}finally{Z=!1,Error.prepareStackTrace=u}return(n=n?n.displayName||n.name:"")?z(n):""}function ye(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 _e(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 L:return"Portal";case T:return"Profiler";case x:return"StrictMode";case F:return"Suspense";case W:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case O:return(n.displayName||"Context")+".Consumer";case I:return(n._context.displayName||"Context")+".Provider";case P: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:_e(n.type)||"Memo";case K:r=n._payload,n=n._init;try{return _e(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 _e(r);case 8:return r===x?"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 Y(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ne(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function ee(n){var r=ne(n)?"checked":"value",u=Object.getOwnPropertyDescriptor(n.constructor.prototype,r),C=""+n[r];if(!n.hasOwnProperty(r)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var A=u.get,B=u.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return A.call(this)},set:function(V){C=""+V,B.call(this,V)}}),Object.defineProperty(n,r,{enumerable:u.enumerable}),{getValue:function(){return C},setValue:function(V){C=""+V},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function be(n){n._valueTracker||(n._valueTracker=ee(n))}function me(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var u=r.getValue(),C="";return n&&(C=ne(n)?n.checked?"true":"false":n.value),n=C,n!==u?(r.setValue(n),!0):!1}function Be(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 ze(n,r){var u=r.checked;return U({},r,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??n._wrapperState.initialChecked})}function Qe(n,r){var u=r.defaultValue==null?"":r.defaultValue,C=r.checked!=null?r.checked:r.defaultChecked;u=Y(r.value!=null?r.value:u),n._wrapperState={initialChecked:C,initialValue:u,controlled:r.type==="checkbox"||r.type==="radio"?r.checked!=null:r.value!=null}}function dt(n,r){r=r.checked,r!=null&&p(n,"checked",r,!1)}function Ie(n,r){dt(n,r);var u=Y(r.value),C=r.type;if(u!=null)C==="number"?(u===0&&n.value===""||n.value!=u)&&(n.value=""+u):n.value!==""+u&&(n.value=""+u);else if(C==="submit"||C==="reset"){n.removeAttribute("value");return}r.hasOwnProperty("value")?xt(n,r.type,u):r.hasOwnProperty("defaultValue")&&xt(n,r.type,Y(r.defaultValue)),r.checked==null&&r.defaultChecked!=null&&(n.defaultChecked=!!r.defaultChecked)}function at(n,r,u){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,u||r===n.value||(n.value=r),n.defaultValue=r}u=n.name,u!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,u!==""&&(n.name=u)}function xt(n,r,u){(r!=="number"||Be(n.ownerDocument)!==n)&&(u==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+u&&(n.defaultValue=""+u))}var oe=Array.isArray;function je(n,r,u,C){if(n=n.options,r){r={};for(var A=0;A<u.length;A++)r["$"+u[A]]=!0;for(u=0;u<n.length;u++)A=r.hasOwnProperty("$"+n[u].value),n[u].selected!==A&&(n[u].selected=A),A&&C&&(n[u].defaultSelected=!0)}else{for(u=""+Y(u),r=null,A=0;A<n.length;A++){if(n[A].value===u){n[A].selected=!0,C&&(n[A].defaultSelected=!0);return}r!==null||n[A].disabled||(r=n[A])}r!==null&&(r.selected=!0)}}function Ae(n,r){if(r.dangerouslySetInnerHTML!=null)throw Error(s(91));return U({},r,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Le(n,r){var u=r.value;if(u==null){if(u=r.children,r=r.defaultValue,u!=null){if(r!=null)throw Error(s(92));if(oe(u)){if(1<u.length)throw Error(s(93));u=u[0]}r=u}r==null&&(r=""),u=r}n._wrapperState={initialValue:Y(u)}}function nt(n,r){var u=Y(r.value),C=Y(r.defaultValue);u!=null&&(u=""+u,u!==n.value&&(n.value=u),r.defaultValue==null&&n.defaultValue!==u&&(n.defaultValue=u)),C!=null&&(n.defaultValue=""+C)}function Fe(n){var r=n.textContent;r===n._wrapperState.initialValue&&r!==""&&r!==null&&(n.value=r)}function Ke(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 mt(n,r){return n==null||n==="http://www.w3.org/1999/xhtml"?Ke(r):n==="http://www.w3.org/2000/svg"&&r==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var _t,Et=(function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(r,u,C,A){MSApp.execUnsafeLocalFunction(function(){return n(r,u,C,A)})}:n})(function(n,r){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=r;else{for(_t=_t||document.createElement("div"),_t.innerHTML="<svg>"+r.valueOf().toString()+"</svg>",r=_t.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;r.firstChild;)n.appendChild(r.firstChild)}});function ft(n,r){if(r){var u=n.firstChild;if(u&&u===n.lastChild&&u.nodeType===3){u.nodeValue=r;return}}n.textContent=r}var ct={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},Ge=["Webkit","ms","Moz","O"];Object.keys(ct).forEach(function(n){Ge.forEach(function(r){r=r+n.charAt(0).toUpperCase()+n.substring(1),ct[r]=ct[n]})});function yt(n,r,u){return r==null||typeof r=="boolean"||r===""?"":u||typeof r!="number"||r===0||ct.hasOwnProperty(n)&&ct[n]?(""+r).trim():r+"px"}function Bt(n,r){n=n.style;for(var u in r)if(r.hasOwnProperty(u)){var C=u.indexOf("--")===0,A=yt(u,r[u],C);u==="float"&&(u="cssFloat"),C?n.setProperty(u,A):n[u]=A}}var Wt=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 Ne(n,r){if(r){if(Wt[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 He(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 de=null;function lt(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var fe=null,Ce=null,$e=null;function rt(n){if(n=wo(n)){if(typeof fe!="function")throw Error(s(280));var r=n.stateNode;r&&(r=Al(r),fe(n.stateNode,n.type,r))}}function ke(n){Ce?$e?$e.push(n):$e=[n]:Ce=n}function gt(){if(Ce){var n=Ce,r=$e;if($e=Ce=null,rt(n),r)for(n=0;n<r.length;n++)rt(r[n])}}function we(n,r){return n(r)}function Ue(){}var se=!1;function te(n,r,u){if(se)return n(r,u);se=!0;try{return we(n,r,u)}finally{se=!1,(Ce!==null||$e!==null)&&(Ue(),gt())}}function ve(n,r){var u=n.stateNode;if(u===null)return null;var C=Al(u);if(C===null)return null;u=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(u&&typeof u!="function")throw Error(s(231,r,typeof u));return u}var st=!1;if(i)try{var We={};Object.defineProperty(We,"passive",{get:function(){st=!0}}),window.addEventListener("test",We,We),window.removeEventListener("test",We,We)}catch{st=!1}function De(n,r,u,C,A,B,V,J,re){var he=Array.prototype.slice.call(arguments,3);try{r.apply(u,he)}catch(Se){this.onError(Se)}}var Je=!1,Dt=null,Yt=!1,Zn=null,Jt={onError:function(n){Je=!0,Dt=n}};function er(n,r,u,C,A,B,V,J,re){Je=!1,Dt=null,De.apply(Jt,arguments)}function Vr(n,r,u,C,A,B,V,J,re){if(er.apply(this,arguments),Je){if(Je){var he=Dt;Je=!1,Dt=null}else throw Error(s(198));Yt||(Yt=!0,Zn=he)}}function Rn(n){var r=n,u=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(u=r.return),n=r.return;while(n)}return r.tag===3?u:null}function Zs(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 $t(n){if(Rn(n)!==n)throw Error(s(188))}function en(n){var r=n.alternate;if(!r){if(r=Rn(n),r===null)throw Error(s(188));return r!==n?null:n}for(var u=n,C=r;;){var A=u.return;if(A===null)break;var B=A.alternate;if(B===null){if(C=A.return,C!==null){u=C;continue}break}if(A.child===B.child){for(B=A.child;B;){if(B===u)return $t(A),n;if(B===C)return $t(A),r;B=B.sibling}throw Error(s(188))}if(u.return!==C.return)u=A,C=B;else{for(var V=!1,J=A.child;J;){if(J===u){V=!0,u=A,C=B;break}if(J===C){V=!0,C=A,u=B;break}J=J.sibling}if(!V){for(J=B.child;J;){if(J===u){V=!0,u=B,C=A;break}if(J===C){V=!0,C=B,u=A;break}J=J.sibling}if(!V)throw Error(s(189))}}if(u.alternate!==C)throw Error(s(190))}if(u.tag!==3)throw Error(s(188));return u.stateNode.current===u?n:r}function ei(n){return n=en(n),n!==null?hr(n):null}function hr(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var r=hr(n);if(r!==null)return r;n=n.sibling}return null}var Gr=e.unstable_scheduleCallback,$n=e.unstable_cancelCallback,fr=e.unstable_shouldYield,Lr=e.unstable_requestPaint,At=e.unstable_now,Nr=e.unstable_getCurrentPriorityLevel,tr=e.unstable_ImmediatePriority,pr=e.unstable_UserBlockingPriority,Rr=e.unstable_NormalPriority,ti=e.unstable_LowPriority,Mr=e.unstable_IdlePriority,nr=null,Cn=null;function Yr(n){if(Cn&&typeof Cn.onCommitFiberRoot=="function")try{Cn.onCommitFiberRoot(nr,n,void 0,(n.current.flags&128)===128)}catch{}}var pn=Math.clz32?Math.clz32:Xr,$i=Math.log,Ss=Math.LN2;function Xr(n){return n>>>=0,n===0?32:31-($i(n)/Ss|0)|0}var Bn=64,mr=4194304;function xn(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 zn(n,r){var u=n.pendingLanes;if(u===0)return 0;var C=0,A=n.suspendedLanes,B=n.pingedLanes,V=u&268435455;if(V!==0){var J=V&~A;J!==0?C=xn(J):(B&=V,B!==0&&(C=xn(B)))}else V=u&~A,V!==0?C=xn(V):B!==0&&(C=xn(B));if(C===0)return 0;if(r!==0&&r!==C&&(r&A)===0&&(A=C&-C,B=r&-r,A>=B||A===16&&(B&4194240)!==0))return r;if((C&4)!==0&&(C|=u&16),r=n.entangledLanes,r!==0)for(n=n.entanglements,r&=C;0<r;)u=31-pn(r),A=1<<u,C|=n[u],r&=~A;return C}function pe(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 Pe(n,r){for(var u=n.suspendedLanes,C=n.pingedLanes,A=n.expirationTimes,B=n.pendingLanes;0<B;){var V=31-pn(B),J=1<<V,re=A[V];re===-1?((J&u)===0||(J&C)!==0)&&(A[V]=pe(J,r)):re<=r&&(n.expiredLanes|=J),B&=~J}}function ut(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function wt(){var n=Bn;return Bn<<=1,(Bn&4194240)===0&&(Bn=64),n}function pt(n){for(var r=[],u=0;31>u;u++)r.push(n);return r}function sn(n,r,u){n.pendingLanes|=r,r!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,r=31-pn(r),n[r]=u}function gr(n,r){var u=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<u;){var A=31-pn(u),B=1<<A;r[A]=0,C[A]=-1,n[A]=-1,u&=~B}}function rr(n,r){var u=n.entangledLanes|=r;for(n=n.entanglements;u;){var C=31-pn(u),A=1<<C;A&r|n[C]&r&&(n[C]|=r),u&=~A}}var kt=0;function sr(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var nl,Es,ni,Ar,Ir,jr=!1,Ts=[],Sn=null,qn=null,cn=null,Ls=new Map,Qr=new Map,En=[],ri="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 rl(n,r){switch(n){case"focusin":case"focusout":Sn=null;break;case"dragenter":case"dragleave":qn=null;break;case"mouseover":case"mouseout":cn=null;break;case"pointerover":case"pointerout":Ls.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qr.delete(r.pointerId)}}function Ct(n,r,u,C,A,B){return n===null||n.nativeEvent!==B?(n={blockedOn:r,domEventName:u,eventSystemFlags:C,nativeEvent:B,targetContainers:[A]},r!==null&&(r=wo(r),r!==null&&Es(r)),n):(n.eventSystemFlags|=C,r=n.targetContainers,A!==null&&r.indexOf(A)===-1&&r.push(A),n)}function zi(n,r,u,C,A){switch(r){case"focusin":return Sn=Ct(Sn,n,r,u,C,A),!0;case"dragenter":return qn=Ct(qn,n,r,u,C,A),!0;case"mouseover":return cn=Ct(cn,n,r,u,C,A),!0;case"pointerover":var B=A.pointerId;return Ls.set(B,Ct(Ls.get(B)||null,n,r,u,C,A)),!0;case"gotpointercapture":return B=A.pointerId,Qr.set(B,Ct(Qr.get(B)||null,n,r,u,C,A)),!0}return!1}function qi(n){var r=Ps(n.target);if(r!==null){var u=Rn(r);if(u!==null){if(r=u.tag,r===13){if(r=Zs(u),r!==null){n.blockedOn=r,Ir(n.priority,function(){ni(u)});return}}else if(r===3&&u.stateNode.current.memoizedState.isDehydrated){n.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}n.blockedOn=null}function si(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var u=Ki(n.domEventName,n.eventSystemFlags,r[0],n.nativeEvent);if(u===null){u=n.nativeEvent;var C=new u.constructor(u.type,u);de=C,u.target.dispatchEvent(C),de=null}else return r=wo(u),r!==null&&Es(r),n.blockedOn=u,!1;r.shift()}return!0}function ii(n,r,u){si(n)&&u.delete(r)}function sh(){jr=!1,Sn!==null&&si(Sn)&&(Sn=null),qn!==null&&si(qn)&&(qn=null),cn!==null&&si(cn)&&(cn=null),Ls.forEach(ii),Qr.forEach(ii)}function Dr(n,r){n.blockedOn===r&&(n.blockedOn=null,jr||(jr=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sh)))}function Nt(n){function r(A){return Dr(A,n)}if(0<Ts.length){Dr(Ts[0],n);for(var u=1;u<Ts.length;u++){var C=Ts[u];C.blockedOn===n&&(C.blockedOn=null)}}for(Sn!==null&&Dr(Sn,n),qn!==null&&Dr(qn,n),cn!==null&&Dr(cn,n),Ls.forEach(r),Qr.forEach(r),u=0;u<En.length;u++)C=En[u],C.blockedOn===n&&(C.blockedOn=null);for(;0<En.length&&(u=En[0],u.blockedOn===null);)qi(u),u.blockedOn===null&&En.shift()}var It=S.ReactCurrentBatchConfig,Ns=!0;function Pr(n,r,u,C){var A=kt,B=It.transition;It.transition=null;try{kt=1,oi(n,r,u,C)}finally{kt=A,It.transition=B}}function sl(n,r,u,C){var A=kt,B=It.transition;It.transition=null;try{kt=4,oi(n,r,u,C)}finally{kt=A,It.transition=B}}function oi(n,r,u,C){if(Ns){var A=Ki(n,r,u,C);if(A===null)lc(n,r,C,Rs,u),rl(n,C);else if(zi(A,n,r,u,C))C.stopPropagation();else if(rl(n,C),r&4&&-1<ri.indexOf(n)){for(;A!==null;){var B=wo(A);if(B!==null&&nl(B),B=Ki(n,r,u,C),B===null&&lc(n,r,C,Rs,u),B===A)break;A=B}A!==null&&C.stopPropagation()}else lc(n,r,C,null,u)}}var Rs=null;function Ki(n,r,u,C){if(Rs=null,n=lt(C),n=Ps(n),n!==null)if(r=Rn(n),r===null)n=null;else if(u=r.tag,u===13){if(n=Zs(r),n!==null)return n;n=null}else if(u===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null);return Rs=n,null}function li(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(Nr()){case tr:return 1;case pr:return 4;case Rr:case ti:return 16;case Mr:return 536870912;default:return 16}default:return 16}}var vr=null,Vi=null,ai=null;function il(){if(ai)return ai;var n,r=Vi,u=r.length,C,A="value"in vr?vr.value:vr.textContent,B=A.length;for(n=0;n<u&&r[n]===A[n];n++);var V=u-n;for(C=1;C<=V&&r[u-C]===A[B-C];C++);return ai=A.slice(n,1<C?1-C:void 0)}function Ms(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 As(){return!0}function ci(){return!1}function Tn(n){function r(u,C,A,B,V){this._reactName=u,this._targetInst=A,this.type=C,this.nativeEvent=B,this.target=V,this.currentTarget=null;for(var J in n)n.hasOwnProperty(J)&&(u=n[J],this[J]=u?u(B):B[J]);return this.isDefaultPrevented=(B.defaultPrevented!=null?B.defaultPrevented:B.returnValue===!1)?As:ci,this.isPropagationStopped=ci,this}return U(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=As)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=As)},persist:function(){},isPersistent:As}),r}var Or={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ui=Tn(Or),Jr=U({},Or,{view:0,detail:0}),ol=Tn(Jr),Gi,Yi,Zr,Mn=U({},Jr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:to,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!==Zr&&(Zr&&n.type==="mousemove"?(Gi=n.screenX-Zr.screenX,Yi=n.screenY-Zr.screenY):Yi=Gi=0,Zr=n),Gi)},movementY:function(n){return"movementY"in n?n.movementY:Yi}}),Xi=Tn(Mn),Qi=U({},Mn,{dataTransfer:0}),Ji=Tn(Qi),qa=U({},Jr,{relatedTarget:0}),Zi=Tn(qa),Ka=U({},Or,{animationName:0,elapsedTime:0,pseudoElement:0}),ll=Tn(Ka),_r=U({},Or,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Va=Tn(_r),al=U({},Or,{data:0}),cl=Tn(al),ul={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},es={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"},dl={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function eo(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=dl[n])?!!r[n]:!1}function to(){return eo}var no=U({},Jr,{key:function(n){if(n.key){var r=ul[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Ms(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?es[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:to,charCode:function(n){return n.type==="keypress"?Ms(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ms(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Ga=Tn(no),di=U({},Mn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ro=Tn(di),Ya=U({},Jr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:to}),Xa=Tn(Ya),hi=U({},Or,{propertyName:0,elapsedTime:0,pseudoElement:0}),Qa=Tn(hi),fi=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}),hl=Tn(fi),fl=[9,13,27,32],so=i&&"CompositionEvent"in window,Is=null;i&&"documentMode"in document&&(Is=document.documentMode);var pl=i&&"TextEvent"in window&&!Is,ml=i&&(!so||Is&&8<Is&&11>=Is),pi=" ",js=!1;function gl(n,r){switch(n){case"keyup":return fl.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vl(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wr=!1;function Ja(n,r){switch(n){case"compositionend":return vl(r);case"keypress":return r.which!==32?null:(js=!0,pi);case"textInput":return n=r.data,n===pi&&js?null:n;default:return null}}function _l(n,r){if(wr)return n==="compositionend"||!so&&gl(n,r)?(n=il(),ai=Vi=vr=null,wr=!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 ml&&r.locale!=="ko"?null:r.data;default:return null}}var Za={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 wl(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!Za[n.type]:r==="textarea"}function bl(n,r,u,C){ke(C),r=Nl(r,"onChange"),0<r.length&&(u=new ui("onChange","change",null,u,C),n.push({event:u,listeners:r}))}var ts=null,Ds=null;function ec(n){ph(n,0)}function ns(n){var r=bi(n);if(me(r))return n}function yl(n,r){if(n==="change")return r}var mi=!1;if(i){var gi;if(i){var io="oninput"in document;if(!io){var oo=document.createElement("div");oo.setAttribute("oninput","return;"),io=typeof oo.oninput=="function"}gi=io}else gi=!1;mi=gi&&(!document.documentMode||9<document.documentMode)}function lo(){ts&&(ts.detachEvent("onpropertychange",ao),Ds=ts=null)}function ao(n){if(n.propertyName==="value"&&ns(Ds)){var r=[];bl(r,Ds,n,lt(n)),te(ec,r)}}function kl(n,r,u){n==="focusin"?(lo(),ts=r,Ds=u,ts.attachEvent("onpropertychange",ao)):n==="focusout"&&lo()}function Cl(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ns(Ds)}function xl(n,r){if(n==="click")return ns(r)}function tc(n,r){if(n==="input"||n==="change")return ns(r)}function Sl(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var un=typeof Object.is=="function"?Object.is:Sl;function rs(n,r){if(un(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var u=Object.keys(n),C=Object.keys(r);if(u.length!==C.length)return!1;for(C=0;C<u.length;C++){var A=u[C];if(!a.call(r,A)||!un(n[A],r[A]))return!1}return!0}function co(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function uo(n,r){var u=co(n);n=0;for(var C;u;){if(u.nodeType===3){if(C=n+u.textContent.length,n<=r&&C>=r)return{node:u,offset:r-n};n=C}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=co(u)}}function ho(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?ho(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function fo(){for(var n=window,r=Be();r instanceof n.HTMLIFrameElement;){try{var u=typeof r.contentWindow.location.href=="string"}catch{u=!1}if(u)n=r.contentWindow;else break;r=Be(n.document)}return r}function X(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 ge(n){var r=fo(),u=n.focusedElem,C=n.selectionRange;if(r!==u&&u&&u.ownerDocument&&ho(u.ownerDocument.documentElement,u)){if(C!==null&&X(u)){if(r=C.start,n=C.end,n===void 0&&(n=r),"selectionStart"in u)u.selectionStart=r,u.selectionEnd=Math.min(n,u.value.length);else if(n=(r=u.ownerDocument||document)&&r.defaultView||window,n.getSelection){n=n.getSelection();var A=u.textContent.length,B=Math.min(C.start,A);C=C.end===void 0?B:Math.min(C.end,A),!n.extend&&B>C&&(A=C,C=B,B=A),A=uo(u,B);var V=uo(u,C);A&&V&&(n.rangeCount!==1||n.anchorNode!==A.node||n.anchorOffset!==A.offset||n.focusNode!==V.node||n.focusOffset!==V.offset)&&(r=r.createRange(),r.setStart(A.node,A.offset),n.removeAllRanges(),B>C?(n.addRange(r),n.extend(V.node,V.offset)):(r.setEnd(V.node,V.offset),n.addRange(r)))}}for(r=[],n=u;n=n.parentNode;)n.nodeType===1&&r.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<r.length;u++)n=r[u],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var et=i&&"documentMode"in document&&11>=document.documentMode,Pt=null,tn=null,po=null,nc=!1;function ih(n,r,u){var C=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;nc||Pt==null||Pt!==Be(C)||(C=Pt,"selectionStart"in C&&X(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}),po&&rs(po,C)||(po=C,C=Nl(tn,"onSelect"),0<C.length&&(r=new ui("onSelect","select",null,r,u),n.push({event:r,listeners:C}),r.target=Pt)))}function El(n,r){var u={};return u[n.toLowerCase()]=r.toLowerCase(),u["Webkit"+n]="webkit"+r,u["Moz"+n]="moz"+r,u}var vi={animationend:El("Animation","AnimationEnd"),animationiteration:El("Animation","AnimationIteration"),animationstart:El("Animation","AnimationStart"),transitionend:El("Transition","TransitionEnd")},rc={},oh={};i&&(oh=document.createElement("div").style,"AnimationEvent"in window||(delete vi.animationend.animation,delete vi.animationiteration.animation,delete vi.animationstart.animation),"TransitionEvent"in window||delete vi.transitionend.transition);function Tl(n){if(rc[n])return rc[n];if(!vi[n])return n;var r=vi[n],u;for(u in r)if(r.hasOwnProperty(u)&&u in oh)return rc[n]=r[u];return n}var lh=Tl("animationend"),ah=Tl("animationiteration"),ch=Tl("animationstart"),uh=Tl("transitionend"),dh=new Map,hh="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 ss(n,r){dh.set(n,r),y(r,[n])}for(var sc=0;sc<hh.length;sc++){var ic=hh[sc],H_=ic.toLowerCase(),U_=ic[0].toUpperCase()+ic.slice(1);ss(H_,"on"+U_)}ss(lh,"onAnimationEnd"),ss(ah,"onAnimationIteration"),ss(ch,"onAnimationStart"),ss("dblclick","onDoubleClick"),ss("focusin","onFocus"),ss("focusout","onBlur"),ss(uh,"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 mo="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(" "),W_=new Set("cancel close invalid load scroll toggle".split(" ").concat(mo));function fh(n,r,u){var C=n.type||"unknown-event";n.currentTarget=u,Vr(C,r,void 0,n),n.currentTarget=null}function ph(n,r){r=(r&4)!==0;for(var u=0;u<n.length;u++){var C=n[u],A=C.event;C=C.listeners;e:{var B=void 0;if(r)for(var V=C.length-1;0<=V;V--){var J=C[V],re=J.instance,he=J.currentTarget;if(J=J.listener,re!==B&&A.isPropagationStopped())break e;fh(A,J,he),B=re}else for(V=0;V<C.length;V++){if(J=C[V],re=J.instance,he=J.currentTarget,J=J.listener,re!==B&&A.isPropagationStopped())break e;fh(A,J,he),B=re}}}if(Yt)throw n=Zn,Yt=!1,Zn=null,n}function Ft(n,r){var u=r[fc];u===void 0&&(u=r[fc]=new Set);var C=n+"__bubble";u.has(C)||(mh(r,n,2,!1),u.add(C))}function oc(n,r,u){var C=0;r&&(C|=4),mh(u,n,C,r)}var Ll="_reactListening"+Math.random().toString(36).slice(2);function go(n){if(!n[Ll]){n[Ll]=!0,l.forEach(function(u){u!=="selectionchange"&&(W_.has(u)||oc(u,!1,n),oc(u,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Ll]||(r[Ll]=!0,oc("selectionchange",!1,r))}}function mh(n,r,u,C){switch(li(r)){case 1:var A=Pr;break;case 4:A=sl;break;default:A=oi}u=A.bind(null,r,u,n),A=void 0,!st||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(A=!0),C?A!==void 0?n.addEventListener(r,u,{capture:!0,passive:A}):n.addEventListener(r,u,!0):A!==void 0?n.addEventListener(r,u,{passive:A}):n.addEventListener(r,u,!1)}function lc(n,r,u,C,A){var B=C;if((r&1)===0&&(r&2)===0&&C!==null)e:for(;;){if(C===null)return;var V=C.tag;if(V===3||V===4){var J=C.stateNode.containerInfo;if(J===A||J.nodeType===8&&J.parentNode===A)break;if(V===4)for(V=C.return;V!==null;){var re=V.tag;if((re===3||re===4)&&(re=V.stateNode.containerInfo,re===A||re.nodeType===8&&re.parentNode===A))return;V=V.return}for(;J!==null;){if(V=Ps(J),V===null)return;if(re=V.tag,re===5||re===6){C=B=V;continue e}J=J.parentNode}}C=C.return}te(function(){var he=B,Se=lt(u),Ee=[];e:{var xe=dh.get(n);if(xe!==void 0){var qe=ui,Ye=n;switch(n){case"keypress":if(Ms(u)===0)break e;case"keydown":case"keyup":qe=Ga;break;case"focusin":Ye="focus",qe=Zi;break;case"focusout":Ye="blur",qe=Zi;break;case"beforeblur":case"afterblur":qe=Zi;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":qe=Xi;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":qe=Ji;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":qe=Xa;break;case lh:case ah:case ch:qe=ll;break;case uh:qe=Qa;break;case"scroll":qe=ol;break;case"wheel":qe=hl;break;case"copy":case"cut":case"paste":qe=Va;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":qe=ro}var Ze=(r&4)!==0,Xt=!Ze&&n==="scroll",ce=Ze?xe!==null?xe+"Capture":null:xe;Ze=[];for(var le=he,ue;le!==null;){ue=le;var Me=ue.stateNode;if(ue.tag===5&&Me!==null&&(ue=Me,ce!==null&&(Me=ve(le,ce),Me!=null&&Ze.push(vo(le,Me,ue)))),Xt)break;le=le.return}0<Ze.length&&(xe=new qe(xe,Ye,null,u,Se),Ee.push({event:xe,listeners:Ze}))}}if((r&7)===0){e:{if(xe=n==="mouseover"||n==="pointerover",qe=n==="mouseout"||n==="pointerout",xe&&u!==de&&(Ye=u.relatedTarget||u.fromElement)&&(Ps(Ye)||Ye[Br]))break e;if((qe||xe)&&(xe=Se.window===Se?Se:(xe=Se.ownerDocument)?xe.defaultView||xe.parentWindow:window,qe?(Ye=u.relatedTarget||u.toElement,qe=he,Ye=Ye?Ps(Ye):null,Ye!==null&&(Xt=Rn(Ye),Ye!==Xt||Ye.tag!==5&&Ye.tag!==6)&&(Ye=null)):(qe=null,Ye=he),qe!==Ye)){if(Ze=Xi,Me="onMouseLeave",ce="onMouseEnter",le="mouse",(n==="pointerout"||n==="pointerover")&&(Ze=ro,Me="onPointerLeave",ce="onPointerEnter",le="pointer"),Xt=qe==null?xe:bi(qe),ue=Ye==null?xe:bi(Ye),xe=new Ze(Me,le+"leave",qe,u,Se),xe.target=Xt,xe.relatedTarget=ue,Me=null,Ps(Se)===he&&(Ze=new Ze(ce,le+"enter",Ye,u,Se),Ze.target=ue,Ze.relatedTarget=Xt,Me=Ze),Xt=Me,qe&&Ye)t:{for(Ze=qe,ce=Ye,le=0,ue=Ze;ue;ue=_i(ue))le++;for(ue=0,Me=ce;Me;Me=_i(Me))ue++;for(;0<le-ue;)Ze=_i(Ze),le--;for(;0<ue-le;)ce=_i(ce),ue--;for(;le--;){if(Ze===ce||ce!==null&&Ze===ce.alternate)break t;Ze=_i(Ze),ce=_i(ce)}Ze=null}else Ze=null;qe!==null&&gh(Ee,xe,qe,Ze,!1),Ye!==null&&Xt!==null&&gh(Ee,Xt,Ye,Ze,!0)}}e:{if(xe=he?bi(he):window,qe=xe.nodeName&&xe.nodeName.toLowerCase(),qe==="select"||qe==="input"&&xe.type==="file")var tt=yl;else if(wl(xe))if(mi)tt=tc;else{tt=Cl;var it=kl}else(qe=xe.nodeName)&&qe.toLowerCase()==="input"&&(xe.type==="checkbox"||xe.type==="radio")&&(tt=xl);if(tt&&(tt=tt(n,he))){bl(Ee,tt,u,Se);break e}it&&it(n,xe,he),n==="focusout"&&(it=xe._wrapperState)&&it.controlled&&xe.type==="number"&&xt(xe,"number",xe.value)}switch(it=he?bi(he):window,n){case"focusin":(wl(it)||it.contentEditable==="true")&&(Pt=it,tn=he,po=null);break;case"focusout":po=tn=Pt=null;break;case"mousedown":nc=!0;break;case"contextmenu":case"mouseup":case"dragend":nc=!1,ih(Ee,u,Se);break;case"selectionchange":if(et)break;case"keydown":case"keyup":ih(Ee,u,Se)}var ot;if(so)e:{switch(n){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else wr?gl(n,u)&&(ht="onCompositionEnd"):n==="keydown"&&u.keyCode===229&&(ht="onCompositionStart");ht&&(ml&&u.locale!=="ko"&&(wr||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&wr&&(ot=il()):(vr=Se,Vi="value"in vr?vr.value:vr.textContent,wr=!0)),it=Nl(he,ht),0<it.length&&(ht=new cl(ht,n,null,u,Se),Ee.push({event:ht,listeners:it}),ot?ht.data=ot:(ot=vl(u),ot!==null&&(ht.data=ot)))),(ot=pl?Ja(n,u):_l(n,u))&&(he=Nl(he,"onBeforeInput"),0<he.length&&(Se=new cl("onBeforeInput","beforeinput",null,u,Se),Ee.push({event:Se,listeners:he}),Se.data=ot))}ph(Ee,r)})}function vo(n,r,u){return{instance:n,listener:r,currentTarget:u}}function Nl(n,r){for(var u=r+"Capture",C=[];n!==null;){var A=n,B=A.stateNode;A.tag===5&&B!==null&&(A=B,B=ve(n,u),B!=null&&C.unshift(vo(n,B,A)),B=ve(n,r),B!=null&&C.push(vo(n,B,A))),n=n.return}return C}function _i(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function gh(n,r,u,C,A){for(var B=r._reactName,V=[];u!==null&&u!==C;){var J=u,re=J.alternate,he=J.stateNode;if(re!==null&&re===C)break;J.tag===5&&he!==null&&(J=he,A?(re=ve(u,B),re!=null&&V.unshift(vo(u,re,J))):A||(re=ve(u,B),re!=null&&V.push(vo(u,re,J)))),u=u.return}V.length!==0&&n.push({event:r,listeners:V})}var $_=/\r\n?/g,z_=/\u0000|\uFFFD/g;function vh(n){return(typeof n=="string"?n:""+n).replace($_,`
38
- `).replace(z_,"")}function Rl(n,r,u){if(r=vh(r),vh(n)!==r&&u)throw Error(s(425))}function Ml(){}var ac=null,cc=null;function uc(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 dc=typeof setTimeout=="function"?setTimeout:void 0,q_=typeof clearTimeout=="function"?clearTimeout:void 0,_h=typeof Promise=="function"?Promise:void 0,K_=typeof queueMicrotask=="function"?queueMicrotask:typeof _h<"u"?function(n){return _h.resolve(null).then(n).catch(V_)}:dc;function V_(n){setTimeout(function(){throw n})}function hc(n,r){var u=r,C=0;do{var A=u.nextSibling;if(n.removeChild(u),A&&A.nodeType===8)if(u=A.data,u==="/$"){if(C===0){n.removeChild(A),Nt(r);return}C--}else u!=="$"&&u!=="$?"&&u!=="$!"||C++;u=A}while(u);Nt(r)}function is(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 wh(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var u=n.data;if(u==="$"||u==="$!"||u==="$?"){if(r===0)return n;r--}else u==="/$"&&r++}n=n.previousSibling}return null}var wi=Math.random().toString(36).slice(2),br="__reactFiber$"+wi,_o="__reactProps$"+wi,Br="__reactContainer$"+wi,fc="__reactEvents$"+wi,G_="__reactListeners$"+wi,Y_="__reactHandles$"+wi;function Ps(n){var r=n[br];if(r)return r;for(var u=n.parentNode;u;){if(r=u[Br]||u[br]){if(u=r.alternate,r.child!==null||u!==null&&u.child!==null)for(n=wh(n);n!==null;){if(u=n[br])return u;n=wh(n)}return r}n=u,u=n.parentNode}return null}function wo(n){return n=n[br]||n[Br],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function bi(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(s(33))}function Al(n){return n[_o]||null}var pc=[],yi=-1;function os(n){return{current:n}}function Ht(n){0>yi||(n.current=pc[yi],pc[yi]=null,yi--)}function Ot(n,r){yi++,pc[yi]=n.current,n.current=r}var ls={},mn=os(ls),An=os(!1),Os=ls;function ki(n,r){var u=n.type.contextTypes;if(!u)return ls;var C=n.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===r)return C.__reactInternalMemoizedMaskedChildContext;var A={},B;for(B in u)A[B]=r[B];return C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=A),A}function In(n){return n=n.childContextTypes,n!=null}function Il(){Ht(An),Ht(mn)}function bh(n,r,u){if(mn.current!==ls)throw Error(s(168));Ot(mn,r),Ot(An,u)}function yh(n,r,u){var C=n.stateNode;if(r=r.childContextTypes,typeof C.getChildContext!="function")return u;C=C.getChildContext();for(var A in C)if(!(A in r))throw Error(s(108,Q(n)||"Unknown",A));return U({},u,C)}function jl(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ls,Os=mn.current,Ot(mn,n),Ot(An,An.current),!0}function kh(n,r,u){var C=n.stateNode;if(!C)throw Error(s(169));u?(n=yh(n,r,Os),C.__reactInternalMemoizedMergedChildContext=n,Ht(An),Ht(mn),Ot(mn,n)):Ht(An),Ot(An,u)}var Fr=null,Dl=!1,mc=!1;function Ch(n){Fr===null?Fr=[n]:Fr.push(n)}function X_(n){Dl=!0,Ch(n)}function as(){if(!mc&&Fr!==null){mc=!0;var n=0,r=kt;try{var u=Fr;for(kt=1;n<u.length;n++){var C=u[n];do C=C(!0);while(C!==null)}Fr=null,Dl=!1}catch(A){throw Fr!==null&&(Fr=Fr.slice(n+1)),Gr(tr,as),A}finally{kt=r,mc=!1}}return null}var Ci=[],xi=0,Pl=null,Ol=0,Kn=[],Vn=0,Bs=null,Hr=1,Ur="";function Fs(n,r){Ci[xi++]=Ol,Ci[xi++]=Pl,Pl=n,Ol=r}function xh(n,r,u){Kn[Vn++]=Hr,Kn[Vn++]=Ur,Kn[Vn++]=Bs,Bs=n;var C=Hr;n=Ur;var A=32-pn(C)-1;C&=~(1<<A),u+=1;var B=32-pn(r)+A;if(30<B){var V=A-A%5;B=(C&(1<<V)-1).toString(32),C>>=V,A-=V,Hr=1<<32-pn(r)+A|u<<A|C,Ur=B+n}else Hr=1<<B|u<<A|C,Ur=n}function gc(n){n.return!==null&&(Fs(n,1),xh(n,1,0))}function vc(n){for(;n===Pl;)Pl=Ci[--xi],Ci[xi]=null,Ol=Ci[--xi],Ci[xi]=null;for(;n===Bs;)Bs=Kn[--Vn],Kn[Vn]=null,Ur=Kn[--Vn],Kn[Vn]=null,Hr=Kn[--Vn],Kn[Vn]=null}var Fn=null,Hn=null,zt=!1,ir=null;function Sh(n,r){var u=Qn(5,null,null,0);u.elementType="DELETED",u.stateNode=r,u.return=n,r=n.deletions,r===null?(n.deletions=[u],n.flags|=16):r.push(u)}function Eh(n,r){switch(n.tag){case 5:var u=n.type;return r=r.nodeType!==1||u.toLowerCase()!==r.nodeName.toLowerCase()?null:r,r!==null?(n.stateNode=r,Fn=n,Hn=is(r.firstChild),!0):!1;case 6:return r=n.pendingProps===""||r.nodeType!==3?null:r,r!==null?(n.stateNode=r,Fn=n,Hn=null,!0):!1;case 13:return r=r.nodeType!==8?null:r,r!==null?(u=Bs!==null?{id:Hr,overflow:Ur}:null,n.memoizedState={dehydrated:r,treeContext:u,retryLane:1073741824},u=Qn(18,null,null,0),u.stateNode=r,u.return=n,n.child=u,Fn=n,Hn=null,!0):!1;default:return!1}}function _c(n){return(n.mode&1)!==0&&(n.flags&128)===0}function wc(n){if(zt){var r=Hn;if(r){var u=r;if(!Eh(n,r)){if(_c(n))throw Error(s(418));r=is(u.nextSibling);var C=Fn;r&&Eh(n,r)?Sh(C,u):(n.flags=n.flags&-4097|2,zt=!1,Fn=n)}}else{if(_c(n))throw Error(s(418));n.flags=n.flags&-4097|2,zt=!1,Fn=n}}}function Th(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;Fn=n}function Bl(n){if(n!==Fn)return!1;if(!zt)return Th(n),zt=!0,!1;var r;if((r=n.tag!==3)&&!(r=n.tag!==5)&&(r=n.type,r=r!=="head"&&r!=="body"&&!uc(n.type,n.memoizedProps)),r&&(r=Hn)){if(_c(n))throw Lh(),Error(s(418));for(;r;)Sh(n,r),r=is(r.nextSibling)}if(Th(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 u=n.data;if(u==="/$"){if(r===0){Hn=is(n.nextSibling);break e}r--}else u!=="$"&&u!=="$!"&&u!=="$?"||r++}n=n.nextSibling}Hn=null}}else Hn=Fn?is(n.stateNode.nextSibling):null;return!0}function Lh(){for(var n=Hn;n;)n=is(n.nextSibling)}function Si(){Hn=Fn=null,zt=!1}function bc(n){ir===null?ir=[n]:ir.push(n)}var Q_=S.ReactCurrentBatchConfig;function bo(n,r,u){if(n=u.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(s(309));var C=u.stateNode}if(!C)throw Error(s(147,n));var A=C,B=""+n;return r!==null&&r.ref!==null&&typeof r.ref=="function"&&r.ref._stringRef===B?r.ref:(r=function(V){var J=A.refs;V===null?delete J[B]:J[B]=V},r._stringRef=B,r)}if(typeof n!="string")throw Error(s(284));if(!u._owner)throw Error(s(290,n))}return n}function Fl(n,r){throw n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n))}function Nh(n){var r=n._init;return r(n._payload)}function Rh(n){function r(ce,le){if(n){var ue=ce.deletions;ue===null?(ce.deletions=[le],ce.flags|=16):ue.push(le)}}function u(ce,le){if(!n)return null;for(;le!==null;)r(ce,le),le=le.sibling;return null}function C(ce,le){for(ce=new Map;le!==null;)le.key!==null?ce.set(le.key,le):ce.set(le.index,le),le=le.sibling;return ce}function A(ce,le){return ce=gs(ce,le),ce.index=0,ce.sibling=null,ce}function B(ce,le,ue){return ce.index=ue,n?(ue=ce.alternate,ue!==null?(ue=ue.index,ue<le?(ce.flags|=2,le):ue):(ce.flags|=2,le)):(ce.flags|=1048576,le)}function V(ce){return n&&ce.alternate===null&&(ce.flags|=2),ce}function J(ce,le,ue,Me){return le===null||le.tag!==6?(le=du(ue,ce.mode,Me),le.return=ce,le):(le=A(le,ue),le.return=ce,le)}function re(ce,le,ue,Me){var tt=ue.type;return tt===R?Se(ce,le,ue.props.children,Me,ue.key):le!==null&&(le.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===K&&Nh(tt)===le.type)?(Me=A(le,ue.props),Me.ref=bo(ce,le,ue),Me.return=ce,Me):(Me=ca(ue.type,ue.key,ue.props,null,ce.mode,Me),Me.ref=bo(ce,le,ue),Me.return=ce,Me)}function he(ce,le,ue,Me){return le===null||le.tag!==4||le.stateNode.containerInfo!==ue.containerInfo||le.stateNode.implementation!==ue.implementation?(le=hu(ue,ce.mode,Me),le.return=ce,le):(le=A(le,ue.children||[]),le.return=ce,le)}function Se(ce,le,ue,Me,tt){return le===null||le.tag!==7?(le=Vs(ue,ce.mode,Me,tt),le.return=ce,le):(le=A(le,ue),le.return=ce,le)}function Ee(ce,le,ue){if(typeof le=="string"&&le!==""||typeof le=="number")return le=du(""+le,ce.mode,ue),le.return=ce,le;if(typeof le=="object"&&le!==null){switch(le.$$typeof){case j:return ue=ca(le.type,le.key,le.props,null,ce.mode,ue),ue.ref=bo(ce,null,le),ue.return=ce,ue;case L:return le=hu(le,ce.mode,ue),le.return=ce,le;case K:var Me=le._init;return Ee(ce,Me(le._payload),ue)}if(oe(le)||D(le))return le=Vs(le,ce.mode,ue,null),le.return=ce,le;Fl(ce,le)}return null}function xe(ce,le,ue,Me){var tt=le!==null?le.key:null;if(typeof ue=="string"&&ue!==""||typeof ue=="number")return tt!==null?null:J(ce,le,""+ue,Me);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case j:return ue.key===tt?re(ce,le,ue,Me):null;case L:return ue.key===tt?he(ce,le,ue,Me):null;case K:return tt=ue._init,xe(ce,le,tt(ue._payload),Me)}if(oe(ue)||D(ue))return tt!==null?null:Se(ce,le,ue,Me,null);Fl(ce,ue)}return null}function qe(ce,le,ue,Me,tt){if(typeof Me=="string"&&Me!==""||typeof Me=="number")return ce=ce.get(ue)||null,J(le,ce,""+Me,tt);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case j:return ce=ce.get(Me.key===null?ue:Me.key)||null,re(le,ce,Me,tt);case L:return ce=ce.get(Me.key===null?ue:Me.key)||null,he(le,ce,Me,tt);case K:var it=Me._init;return qe(ce,le,ue,it(Me._payload),tt)}if(oe(Me)||D(Me))return ce=ce.get(ue)||null,Se(le,ce,Me,tt,null);Fl(le,Me)}return null}function Ye(ce,le,ue,Me){for(var tt=null,it=null,ot=le,ht=le=0,an=null;ot!==null&&ht<ue.length;ht++){ot.index>ht?(an=ot,ot=null):an=ot.sibling;var Tt=xe(ce,ot,ue[ht],Me);if(Tt===null){ot===null&&(ot=an);break}n&&ot&&Tt.alternate===null&&r(ce,ot),le=B(Tt,le,ht),it===null?tt=Tt:it.sibling=Tt,it=Tt,ot=an}if(ht===ue.length)return u(ce,ot),zt&&Fs(ce,ht),tt;if(ot===null){for(;ht<ue.length;ht++)ot=Ee(ce,ue[ht],Me),ot!==null&&(le=B(ot,le,ht),it===null?tt=ot:it.sibling=ot,it=ot);return zt&&Fs(ce,ht),tt}for(ot=C(ce,ot);ht<ue.length;ht++)an=qe(ot,ce,ht,ue[ht],Me),an!==null&&(n&&an.alternate!==null&&ot.delete(an.key===null?ht:an.key),le=B(an,le,ht),it===null?tt=an:it.sibling=an,it=an);return n&&ot.forEach(function(vs){return r(ce,vs)}),zt&&Fs(ce,ht),tt}function Ze(ce,le,ue,Me){var tt=D(ue);if(typeof tt!="function")throw Error(s(150));if(ue=tt.call(ue),ue==null)throw Error(s(151));for(var it=tt=null,ot=le,ht=le=0,an=null,Tt=ue.next();ot!==null&&!Tt.done;ht++,Tt=ue.next()){ot.index>ht?(an=ot,ot=null):an=ot.sibling;var vs=xe(ce,ot,Tt.value,Me);if(vs===null){ot===null&&(ot=an);break}n&&ot&&vs.alternate===null&&r(ce,ot),le=B(vs,le,ht),it===null?tt=vs:it.sibling=vs,it=vs,ot=an}if(Tt.done)return u(ce,ot),zt&&Fs(ce,ht),tt;if(ot===null){for(;!Tt.done;ht++,Tt=ue.next())Tt=Ee(ce,Tt.value,Me),Tt!==null&&(le=B(Tt,le,ht),it===null?tt=Tt:it.sibling=Tt,it=Tt);return zt&&Fs(ce,ht),tt}for(ot=C(ce,ot);!Tt.done;ht++,Tt=ue.next())Tt=qe(ot,ce,ht,Tt.value,Me),Tt!==null&&(n&&Tt.alternate!==null&&ot.delete(Tt.key===null?ht:Tt.key),le=B(Tt,le,ht),it===null?tt=Tt:it.sibling=Tt,it=Tt);return n&&ot.forEach(function(Rw){return r(ce,Rw)}),zt&&Fs(ce,ht),tt}function Xt(ce,le,ue,Me){if(typeof ue=="object"&&ue!==null&&ue.type===R&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case j:e:{for(var tt=ue.key,it=le;it!==null;){if(it.key===tt){if(tt=ue.type,tt===R){if(it.tag===7){u(ce,it.sibling),le=A(it,ue.props.children),le.return=ce,ce=le;break e}}else if(it.elementType===tt||typeof tt=="object"&&tt!==null&&tt.$$typeof===K&&Nh(tt)===it.type){u(ce,it.sibling),le=A(it,ue.props),le.ref=bo(ce,it,ue),le.return=ce,ce=le;break e}u(ce,it);break}else r(ce,it);it=it.sibling}ue.type===R?(le=Vs(ue.props.children,ce.mode,Me,ue.key),le.return=ce,ce=le):(Me=ca(ue.type,ue.key,ue.props,null,ce.mode,Me),Me.ref=bo(ce,le,ue),Me.return=ce,ce=Me)}return V(ce);case L:e:{for(it=ue.key;le!==null;){if(le.key===it)if(le.tag===4&&le.stateNode.containerInfo===ue.containerInfo&&le.stateNode.implementation===ue.implementation){u(ce,le.sibling),le=A(le,ue.children||[]),le.return=ce,ce=le;break e}else{u(ce,le);break}else r(ce,le);le=le.sibling}le=hu(ue,ce.mode,Me),le.return=ce,ce=le}return V(ce);case K:return it=ue._init,Xt(ce,le,it(ue._payload),Me)}if(oe(ue))return Ye(ce,le,ue,Me);if(D(ue))return Ze(ce,le,ue,Me);Fl(ce,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,le!==null&&le.tag===6?(u(ce,le.sibling),le=A(le,ue),le.return=ce,ce=le):(u(ce,le),le=du(ue,ce.mode,Me),le.return=ce,ce=le),V(ce)):u(ce,le)}return Xt}var Ei=Rh(!0),Mh=Rh(!1),Hl=os(null),Ul=null,Ti=null,yc=null;function kc(){yc=Ti=Ul=null}function Cc(n){var r=Hl.current;Ht(Hl),n._currentValue=r}function xc(n,r,u){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===u)break;n=n.return}}function Li(n,r){Ul=n,yc=Ti=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&r)!==0&&(jn=!0),n.firstContext=null)}function Gn(n){var r=n._currentValue;if(yc!==n)if(n={context:n,memoizedValue:r,next:null},Ti===null){if(Ul===null)throw Error(s(308));Ti=n,Ul.dependencies={lanes:0,firstContext:n}}else Ti=Ti.next=n;return r}var Hs=null;function Sc(n){Hs===null?Hs=[n]:Hs.push(n)}function Ah(n,r,u,C){var A=r.interleaved;return A===null?(u.next=u,Sc(r)):(u.next=A.next,A.next=u),r.interleaved=u,Wr(n,C)}function Wr(n,r){n.lanes|=r;var u=n.alternate;for(u!==null&&(u.lanes|=r),u=n,n=n.return;n!==null;)n.childLanes|=r,u=n.alternate,u!==null&&(u.childLanes|=r),u=n,n=n.return;return u.tag===3?u.stateNode:null}var cs=!1;function Ec(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ih(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 $r(n,r){return{eventTime:n,lane:r,tag:0,payload:null,callback:null,next:null}}function us(n,r,u){var C=n.updateQueue;if(C===null)return null;if(C=C.shared,(St&2)!==0){var A=C.pending;return A===null?r.next=r:(r.next=A.next,A.next=r),C.pending=r,Wr(n,u)}return A=C.interleaved,A===null?(r.next=r,Sc(C)):(r.next=A.next,A.next=r),C.interleaved=r,Wr(n,u)}function Wl(n,r,u){if(r=r.updateQueue,r!==null&&(r=r.shared,(u&4194240)!==0)){var C=r.lanes;C&=n.pendingLanes,u|=C,r.lanes=u,rr(n,u)}}function jh(n,r){var u=n.updateQueue,C=n.alternate;if(C!==null&&(C=C.updateQueue,u===C)){var A=null,B=null;if(u=u.firstBaseUpdate,u!==null){do{var V={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};B===null?A=B=V:B=B.next=V,u=u.next}while(u!==null);B===null?A=B=r:B=B.next=r}else A=B=r;u={baseState:C.baseState,firstBaseUpdate:A,lastBaseUpdate:B,shared:C.shared,effects:C.effects},n.updateQueue=u;return}n=u.lastBaseUpdate,n===null?u.firstBaseUpdate=r:n.next=r,u.lastBaseUpdate=r}function $l(n,r,u,C){var A=n.updateQueue;cs=!1;var B=A.firstBaseUpdate,V=A.lastBaseUpdate,J=A.shared.pending;if(J!==null){A.shared.pending=null;var re=J,he=re.next;re.next=null,V===null?B=he:V.next=he,V=re;var Se=n.alternate;Se!==null&&(Se=Se.updateQueue,J=Se.lastBaseUpdate,J!==V&&(J===null?Se.firstBaseUpdate=he:J.next=he,Se.lastBaseUpdate=re))}if(B!==null){var Ee=A.baseState;V=0,Se=he=re=null,J=B;do{var xe=J.lane,qe=J.eventTime;if((C&xe)===xe){Se!==null&&(Se=Se.next={eventTime:qe,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Ye=n,Ze=J;switch(xe=r,qe=u,Ze.tag){case 1:if(Ye=Ze.payload,typeof Ye=="function"){Ee=Ye.call(qe,Ee,xe);break e}Ee=Ye;break e;case 3:Ye.flags=Ye.flags&-65537|128;case 0:if(Ye=Ze.payload,xe=typeof Ye=="function"?Ye.call(qe,Ee,xe):Ye,xe==null)break e;Ee=U({},Ee,xe);break e;case 2:cs=!0}}J.callback!==null&&J.lane!==0&&(n.flags|=64,xe=A.effects,xe===null?A.effects=[J]:xe.push(J))}else qe={eventTime:qe,lane:xe,tag:J.tag,payload:J.payload,callback:J.callback,next:null},Se===null?(he=Se=qe,re=Ee):Se=Se.next=qe,V|=xe;if(J=J.next,J===null){if(J=A.shared.pending,J===null)break;xe=J,J=xe.next,xe.next=null,A.lastBaseUpdate=xe,A.shared.pending=null}}while(!0);if(Se===null&&(re=Ee),A.baseState=re,A.firstBaseUpdate=he,A.lastBaseUpdate=Se,r=A.shared.interleaved,r!==null){A=r;do V|=A.lane,A=A.next;while(A!==r)}else B===null&&(A.shared.lanes=0);$s|=V,n.lanes=V,n.memoizedState=Ee}}function Dh(n,r,u){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=u,typeof A!="function")throw Error(s(191,A));A.call(C)}}}var yo={},yr=os(yo),ko=os(yo),Co=os(yo);function Us(n){if(n===yo)throw Error(s(174));return n}function Tc(n,r){switch(Ot(Co,r),Ot(ko,n),Ot(yr,yo),n=r.nodeType,n){case 9:case 11:r=(r=r.documentElement)?r.namespaceURI:mt(null,"");break;default:n=n===8?r.parentNode:r,r=n.namespaceURI||null,n=n.tagName,r=mt(r,n)}Ht(yr),Ot(yr,r)}function Ni(){Ht(yr),Ht(ko),Ht(Co)}function Ph(n){Us(Co.current);var r=Us(yr.current),u=mt(r,n.type);r!==u&&(Ot(ko,n),Ot(yr,u))}function Lc(n){ko.current===n&&(Ht(yr),Ht(ko))}var qt=os(0);function zl(n){for(var r=n;r!==null;){if(r.tag===13){var u=r.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.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 Nc=[];function Rc(){for(var n=0;n<Nc.length;n++)Nc[n]._workInProgressVersionPrimary=null;Nc.length=0}var ql=S.ReactCurrentDispatcher,Mc=S.ReactCurrentBatchConfig,Ws=0,Kt=null,nn=null,on=null,Kl=!1,xo=!1,So=0,J_=0;function gn(){throw Error(s(321))}function Ac(n,r){if(r===null)return!1;for(var u=0;u<r.length&&u<n.length;u++)if(!un(n[u],r[u]))return!1;return!0}function Ic(n,r,u,C,A,B){if(Ws=B,Kt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,ql.current=n===null||n.memoizedState===null?nw:rw,n=u(C,A),xo){B=0;do{if(xo=!1,So=0,25<=B)throw Error(s(301));B+=1,on=nn=null,r.updateQueue=null,ql.current=sw,n=u(C,A)}while(xo)}if(ql.current=Yl,r=nn!==null&&nn.next!==null,Ws=0,on=nn=Kt=null,Kl=!1,r)throw Error(s(300));return n}function jc(){var n=So!==0;return So=0,n}function kr(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return on===null?Kt.memoizedState=on=n:on=on.next=n,on}function Yn(){if(nn===null){var n=Kt.alternate;n=n!==null?n.memoizedState:null}else n=nn.next;var r=on===null?Kt.memoizedState:on.next;if(r!==null)on=r,nn=n;else{if(n===null)throw Error(s(310));nn=n,n={memoizedState:nn.memoizedState,baseState:nn.baseState,baseQueue:nn.baseQueue,queue:nn.queue,next:null},on===null?Kt.memoizedState=on=n:on=on.next=n}return on}function Eo(n,r){return typeof r=="function"?r(n):r}function Dc(n){var r=Yn(),u=r.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=n;var C=nn,A=C.baseQueue,B=u.pending;if(B!==null){if(A!==null){var V=A.next;A.next=B.next,B.next=V}C.baseQueue=A=B,u.pending=null}if(A!==null){B=A.next,C=C.baseState;var J=V=null,re=null,he=B;do{var Se=he.lane;if((Ws&Se)===Se)re!==null&&(re=re.next={lane:0,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null}),C=he.hasEagerState?he.eagerState:n(C,he.action);else{var Ee={lane:Se,action:he.action,hasEagerState:he.hasEagerState,eagerState:he.eagerState,next:null};re===null?(J=re=Ee,V=C):re=re.next=Ee,Kt.lanes|=Se,$s|=Se}he=he.next}while(he!==null&&he!==B);re===null?V=C:re.next=J,un(C,r.memoizedState)||(jn=!0),r.memoizedState=C,r.baseState=V,r.baseQueue=re,u.lastRenderedState=C}if(n=u.interleaved,n!==null){A=n;do B=A.lane,Kt.lanes|=B,$s|=B,A=A.next;while(A!==n)}else A===null&&(u.lanes=0);return[r.memoizedState,u.dispatch]}function Pc(n){var r=Yn(),u=r.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=n;var C=u.dispatch,A=u.pending,B=r.memoizedState;if(A!==null){u.pending=null;var V=A=A.next;do B=n(B,V.action),V=V.next;while(V!==A);un(B,r.memoizedState)||(jn=!0),r.memoizedState=B,r.baseQueue===null&&(r.baseState=B),u.lastRenderedState=B}return[B,C]}function Oh(){}function Bh(n,r){var u=Kt,C=Yn(),A=r(),B=!un(C.memoizedState,A);if(B&&(C.memoizedState=A,jn=!0),C=C.queue,Oc(Uh.bind(null,u,C,n),[n]),C.getSnapshot!==r||B||on!==null&&on.memoizedState.tag&1){if(u.flags|=2048,To(9,Hh.bind(null,u,C,A,r),void 0,null),ln===null)throw Error(s(349));(Ws&30)!==0||Fh(u,r,A)}return A}function Fh(n,r,u){n.flags|=16384,n={getSnapshot:r,value:u},r=Kt.updateQueue,r===null?(r={lastEffect:null,stores:null},Kt.updateQueue=r,r.stores=[n]):(u=r.stores,u===null?r.stores=[n]:u.push(n))}function Hh(n,r,u,C){r.value=u,r.getSnapshot=C,Wh(r)&&$h(n)}function Uh(n,r,u){return u(function(){Wh(r)&&$h(n)})}function Wh(n){var r=n.getSnapshot;n=n.value;try{var u=r();return!un(n,u)}catch{return!0}}function $h(n){var r=Wr(n,1);r!==null&&cr(r,n,1,-1)}function zh(n){var r=kr();return typeof n=="function"&&(n=n()),r.memoizedState=r.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},r.queue=n,n=n.dispatch=tw.bind(null,Kt,n),[r.memoizedState,n]}function To(n,r,u,C){return n={tag:n,create:r,destroy:u,deps:C,next:null},r=Kt.updateQueue,r===null?(r={lastEffect:null,stores:null},Kt.updateQueue=r,r.lastEffect=n.next=n):(u=r.lastEffect,u===null?r.lastEffect=n.next=n:(C=u.next,u.next=n,n.next=C,r.lastEffect=n)),n}function qh(){return Yn().memoizedState}function Vl(n,r,u,C){var A=kr();Kt.flags|=n,A.memoizedState=To(1|r,u,void 0,C===void 0?null:C)}function Gl(n,r,u,C){var A=Yn();C=C===void 0?null:C;var B=void 0;if(nn!==null){var V=nn.memoizedState;if(B=V.destroy,C!==null&&Ac(C,V.deps)){A.memoizedState=To(r,u,B,C);return}}Kt.flags|=n,A.memoizedState=To(1|r,u,B,C)}function Kh(n,r){return Vl(8390656,8,n,r)}function Oc(n,r){return Gl(2048,8,n,r)}function Vh(n,r){return Gl(4,2,n,r)}function Gh(n,r){return Gl(4,4,n,r)}function Yh(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 Xh(n,r,u){return u=u!=null?u.concat([n]):null,Gl(4,4,Yh.bind(null,r,n),u)}function Bc(){}function Qh(n,r){var u=Yn();r=r===void 0?null:r;var C=u.memoizedState;return C!==null&&r!==null&&Ac(r,C[1])?C[0]:(u.memoizedState=[n,r],n)}function Jh(n,r){var u=Yn();r=r===void 0?null:r;var C=u.memoizedState;return C!==null&&r!==null&&Ac(r,C[1])?C[0]:(n=n(),u.memoizedState=[n,r],n)}function Zh(n,r,u){return(Ws&21)===0?(n.baseState&&(n.baseState=!1,jn=!0),n.memoizedState=u):(un(u,r)||(u=wt(),Kt.lanes|=u,$s|=u,n.baseState=!0),r)}function Z_(n,r){var u=kt;kt=u!==0&&4>u?u:4,n(!0);var C=Mc.transition;Mc.transition={};try{n(!1),r()}finally{kt=u,Mc.transition=C}}function ef(){return Yn().memoizedState}function ew(n,r,u){var C=ps(n);if(u={lane:C,action:u,hasEagerState:!1,eagerState:null,next:null},tf(n))nf(r,u);else if(u=Ah(n,r,u,C),u!==null){var A=Nn();cr(u,n,C,A),rf(u,r,C)}}function tw(n,r,u){var C=ps(n),A={lane:C,action:u,hasEagerState:!1,eagerState:null,next:null};if(tf(n))nf(r,A);else{var B=n.alternate;if(n.lanes===0&&(B===null||B.lanes===0)&&(B=r.lastRenderedReducer,B!==null))try{var V=r.lastRenderedState,J=B(V,u);if(A.hasEagerState=!0,A.eagerState=J,un(J,V)){var re=r.interleaved;re===null?(A.next=A,Sc(r)):(A.next=re.next,re.next=A),r.interleaved=A;return}}catch{}finally{}u=Ah(n,r,A,C),u!==null&&(A=Nn(),cr(u,n,C,A),rf(u,r,C))}}function tf(n){var r=n.alternate;return n===Kt||r!==null&&r===Kt}function nf(n,r){xo=Kl=!0;var u=n.pending;u===null?r.next=r:(r.next=u.next,u.next=r),n.pending=r}function rf(n,r,u){if((u&4194240)!==0){var C=r.lanes;C&=n.pendingLanes,u|=C,r.lanes=u,rr(n,u)}}var Yl={readContext:Gn,useCallback:gn,useContext:gn,useEffect:gn,useImperativeHandle:gn,useInsertionEffect:gn,useLayoutEffect:gn,useMemo:gn,useReducer:gn,useRef:gn,useState:gn,useDebugValue:gn,useDeferredValue:gn,useTransition:gn,useMutableSource:gn,useSyncExternalStore:gn,useId:gn,unstable_isNewReconciler:!1},nw={readContext:Gn,useCallback:function(n,r){return kr().memoizedState=[n,r===void 0?null:r],n},useContext:Gn,useEffect:Kh,useImperativeHandle:function(n,r,u){return u=u!=null?u.concat([n]):null,Vl(4194308,4,Yh.bind(null,r,n),u)},useLayoutEffect:function(n,r){return Vl(4194308,4,n,r)},useInsertionEffect:function(n,r){return Vl(4,2,n,r)},useMemo:function(n,r){var u=kr();return r=r===void 0?null:r,n=n(),u.memoizedState=[n,r],n},useReducer:function(n,r,u){var C=kr();return r=u!==void 0?u(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=ew.bind(null,Kt,n),[C.memoizedState,n]},useRef:function(n){var r=kr();return n={current:n},r.memoizedState=n},useState:zh,useDebugValue:Bc,useDeferredValue:function(n){return kr().memoizedState=n},useTransition:function(){var n=zh(!1),r=n[0];return n=Z_.bind(null,n[1]),kr().memoizedState=n,[r,n]},useMutableSource:function(){},useSyncExternalStore:function(n,r,u){var C=Kt,A=kr();if(zt){if(u===void 0)throw Error(s(407));u=u()}else{if(u=r(),ln===null)throw Error(s(349));(Ws&30)!==0||Fh(C,r,u)}A.memoizedState=u;var B={value:u,getSnapshot:r};return A.queue=B,Kh(Uh.bind(null,C,B,n),[n]),C.flags|=2048,To(9,Hh.bind(null,C,B,u,r),void 0,null),u},useId:function(){var n=kr(),r=ln.identifierPrefix;if(zt){var u=Ur,C=Hr;u=(C&~(1<<32-pn(C)-1)).toString(32)+u,r=":"+r+"R"+u,u=So++,0<u&&(r+="H"+u.toString(32)),r+=":"}else u=J_++,r=":"+r+"r"+u.toString(32)+":";return n.memoizedState=r},unstable_isNewReconciler:!1},rw={readContext:Gn,useCallback:Qh,useContext:Gn,useEffect:Oc,useImperativeHandle:Xh,useInsertionEffect:Vh,useLayoutEffect:Gh,useMemo:Jh,useReducer:Dc,useRef:qh,useState:function(){return Dc(Eo)},useDebugValue:Bc,useDeferredValue:function(n){var r=Yn();return Zh(r,nn.memoizedState,n)},useTransition:function(){var n=Dc(Eo)[0],r=Yn().memoizedState;return[n,r]},useMutableSource:Oh,useSyncExternalStore:Bh,useId:ef,unstable_isNewReconciler:!1},sw={readContext:Gn,useCallback:Qh,useContext:Gn,useEffect:Oc,useImperativeHandle:Xh,useInsertionEffect:Vh,useLayoutEffect:Gh,useMemo:Jh,useReducer:Pc,useRef:qh,useState:function(){return Pc(Eo)},useDebugValue:Bc,useDeferredValue:function(n){var r=Yn();return nn===null?r.memoizedState=n:Zh(r,nn.memoizedState,n)},useTransition:function(){var n=Pc(Eo)[0],r=Yn().memoizedState;return[n,r]},useMutableSource:Oh,useSyncExternalStore:Bh,useId:ef,unstable_isNewReconciler:!1};function or(n,r){if(n&&n.defaultProps){r=U({},r),n=n.defaultProps;for(var u in n)r[u]===void 0&&(r[u]=n[u]);return r}return r}function Fc(n,r,u,C){r=n.memoizedState,u=u(C,r),u=u==null?r:U({},r,u),n.memoizedState=u,n.lanes===0&&(n.updateQueue.baseState=u)}var Xl={isMounted:function(n){return(n=n._reactInternals)?Rn(n)===n:!1},enqueueSetState:function(n,r,u){n=n._reactInternals;var C=Nn(),A=ps(n),B=$r(C,A);B.payload=r,u!=null&&(B.callback=u),r=us(n,B,A),r!==null&&(cr(r,n,A,C),Wl(r,n,A))},enqueueReplaceState:function(n,r,u){n=n._reactInternals;var C=Nn(),A=ps(n),B=$r(C,A);B.tag=1,B.payload=r,u!=null&&(B.callback=u),r=us(n,B,A),r!==null&&(cr(r,n,A,C),Wl(r,n,A))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var u=Nn(),C=ps(n),A=$r(u,C);A.tag=2,r!=null&&(A.callback=r),r=us(n,A,C),r!==null&&(cr(r,n,C,u),Wl(r,n,C))}};function sf(n,r,u,C,A,B,V){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(C,B,V):r.prototype&&r.prototype.isPureReactComponent?!rs(u,C)||!rs(A,B):!0}function of(n,r,u){var C=!1,A=ls,B=r.contextType;return typeof B=="object"&&B!==null?B=Gn(B):(A=In(r)?Os:mn.current,C=r.contextTypes,B=(C=C!=null)?ki(n,A):ls),r=new r(u,B),n.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,r.updater=Xl,n.stateNode=r,r._reactInternals=n,C&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=A,n.__reactInternalMemoizedMaskedChildContext=B),r}function lf(n,r,u,C){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(u,C),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(u,C),r.state!==n&&Xl.enqueueReplaceState(r,r.state,null)}function Hc(n,r,u,C){var A=n.stateNode;A.props=u,A.state=n.memoizedState,A.refs={},Ec(n);var B=r.contextType;typeof B=="object"&&B!==null?A.context=Gn(B):(B=In(r)?Os:mn.current,A.context=ki(n,B)),A.state=n.memoizedState,B=r.getDerivedStateFromProps,typeof B=="function"&&(Fc(n,r,B,u),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&&Xl.enqueueReplaceState(A,A.state,null),$l(n,u,A,C),A.state=n.memoizedState),typeof A.componentDidMount=="function"&&(n.flags|=4194308)}function Ri(n,r){try{var u="",C=r;do u+=ye(C),C=C.return;while(C);var A=u}catch(B){A=`
39
- Error generating stack: `+B.message+`
40
- `+B.stack}return{value:n,source:r,stack:A,digest:null}}function Uc(n,r,u){return{value:n,source:null,stack:u??null,digest:r??null}}function Wc(n,r){try{console.error(r.value)}catch(u){setTimeout(function(){throw u})}}var iw=typeof WeakMap=="function"?WeakMap:Map;function af(n,r,u){u=$r(-1,u),u.tag=3,u.payload={element:null};var C=r.value;return u.callback=function(){ra||(ra=!0,ru=C),Wc(n,r)},u}function cf(n,r,u){u=$r(-1,u),u.tag=3;var C=n.type.getDerivedStateFromError;if(typeof C=="function"){var A=r.value;u.payload=function(){return C(A)},u.callback=function(){Wc(n,r)}}var B=n.stateNode;return B!==null&&typeof B.componentDidCatch=="function"&&(u.callback=function(){Wc(n,r),typeof C!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var V=r.stack;this.componentDidCatch(r.value,{componentStack:V!==null?V:""})}),u}function uf(n,r,u){var C=n.pingCache;if(C===null){C=n.pingCache=new iw;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(u)||(A.add(u),n=ww.bind(null,n,r,u),r.then(n,n))}function df(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 hf(n,r,u,C,A){return(n.mode&1)===0?(n===r?n.flags|=65536:(n.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(r=$r(-1,1),r.tag=2,us(u,r,1))),u.lanes|=1),n):(n.flags|=65536,n.lanes=A,n)}var ow=S.ReactCurrentOwner,jn=!1;function Ln(n,r,u,C){r.child=n===null?Mh(r,null,u,C):Ei(r,n.child,u,C)}function ff(n,r,u,C,A){u=u.render;var B=r.ref;return Li(r,A),C=Ic(n,r,u,C,B,A),u=jc(),n!==null&&!jn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,zr(n,r,A)):(zt&&u&&gc(r),r.flags|=1,Ln(n,r,C,A),r.child)}function pf(n,r,u,C,A){if(n===null){var B=u.type;return typeof B=="function"&&!uu(B)&&B.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(r.tag=15,r.type=B,mf(n,r,B,C,A)):(n=ca(u.type,null,C,r,r.mode,A),n.ref=r.ref,n.return=r,r.child=n)}if(B=n.child,(n.lanes&A)===0){var V=B.memoizedProps;if(u=u.compare,u=u!==null?u:rs,u(V,C)&&n.ref===r.ref)return zr(n,r,A)}return r.flags|=1,n=gs(B,C),n.ref=r.ref,n.return=r,r.child=n}function mf(n,r,u,C,A){if(n!==null){var B=n.memoizedProps;if(rs(B,C)&&n.ref===r.ref)if(jn=!1,r.pendingProps=C=B,(n.lanes&A)!==0)(n.flags&131072)!==0&&(jn=!0);else return r.lanes=n.lanes,zr(n,r,A)}return $c(n,r,u,C,A)}function gf(n,r,u){var C=r.pendingProps,A=C.children,B=n!==null?n.memoizedState:null;if(C.mode==="hidden")if((r.mode&1)===0)r.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ot(Ai,Un),Un|=u;else{if((u&1073741824)===0)return n=B!==null?B.baseLanes|u:u,r.lanes=r.childLanes=1073741824,r.memoizedState={baseLanes:n,cachePool:null,transitions:null},r.updateQueue=null,Ot(Ai,Un),Un|=n,null;r.memoizedState={baseLanes:0,cachePool:null,transitions:null},C=B!==null?B.baseLanes:u,Ot(Ai,Un),Un|=C}else B!==null?(C=B.baseLanes|u,r.memoizedState=null):C=u,Ot(Ai,Un),Un|=C;return Ln(n,r,A,u),r.child}function vf(n,r){var u=r.ref;(n===null&&u!==null||n!==null&&n.ref!==u)&&(r.flags|=512,r.flags|=2097152)}function $c(n,r,u,C,A){var B=In(u)?Os:mn.current;return B=ki(r,B),Li(r,A),u=Ic(n,r,u,C,B,A),C=jc(),n!==null&&!jn?(r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~A,zr(n,r,A)):(zt&&C&&gc(r),r.flags|=1,Ln(n,r,u,A),r.child)}function _f(n,r,u,C,A){if(In(u)){var B=!0;jl(r)}else B=!1;if(Li(r,A),r.stateNode===null)Jl(n,r),of(r,u,C),Hc(r,u,C,A),C=!0;else if(n===null){var V=r.stateNode,J=r.memoizedProps;V.props=J;var re=V.context,he=u.contextType;typeof he=="object"&&he!==null?he=Gn(he):(he=In(u)?Os:mn.current,he=ki(r,he));var Se=u.getDerivedStateFromProps,Ee=typeof Se=="function"||typeof V.getSnapshotBeforeUpdate=="function";Ee||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(J!==C||re!==he)&&lf(r,V,C,he),cs=!1;var xe=r.memoizedState;V.state=xe,$l(r,C,V,A),re=r.memoizedState,J!==C||xe!==re||An.current||cs?(typeof Se=="function"&&(Fc(r,u,Se,C),re=r.memoizedState),(J=cs||sf(r,u,J,C,xe,re,he))?(Ee||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(r.flags|=4194308)):(typeof V.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=C,r.memoizedState=re),V.props=C,V.state=re,V.context=he,C=J):(typeof V.componentDidMount=="function"&&(r.flags|=4194308),C=!1)}else{V=r.stateNode,Ih(n,r),J=r.memoizedProps,he=r.type===r.elementType?J:or(r.type,J),V.props=he,Ee=r.pendingProps,xe=V.context,re=u.contextType,typeof re=="object"&&re!==null?re=Gn(re):(re=In(u)?Os:mn.current,re=ki(r,re));var qe=u.getDerivedStateFromProps;(Se=typeof qe=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(J!==Ee||xe!==re)&&lf(r,V,C,re),cs=!1,xe=r.memoizedState,V.state=xe,$l(r,C,V,A);var Ye=r.memoizedState;J!==Ee||xe!==Ye||An.current||cs?(typeof qe=="function"&&(Fc(r,u,qe,C),Ye=r.memoizedState),(he=cs||sf(r,u,he,C,xe,Ye,re)||!1)?(Se||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(C,Ye,re),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(C,Ye,re)),typeof V.componentDidUpdate=="function"&&(r.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof V.componentDidUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(r.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(r.flags|=1024),r.memoizedProps=C,r.memoizedState=Ye),V.props=C,V.state=Ye,V.context=re,C=he):(typeof V.componentDidUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(r.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||J===n.memoizedProps&&xe===n.memoizedState||(r.flags|=1024),C=!1)}return zc(n,r,u,C,B,A)}function zc(n,r,u,C,A,B){vf(n,r);var V=(r.flags&128)!==0;if(!C&&!V)return A&&kh(r,u,!1),zr(n,r,B);C=r.stateNode,ow.current=r;var J=V&&typeof u.getDerivedStateFromError!="function"?null:C.render();return r.flags|=1,n!==null&&V?(r.child=Ei(r,n.child,null,B),r.child=Ei(r,null,J,B)):Ln(n,r,J,B),r.memoizedState=C.state,A&&kh(r,u,!0),r.child}function wf(n){var r=n.stateNode;r.pendingContext?bh(n,r.pendingContext,r.pendingContext!==r.context):r.context&&bh(n,r.context,!1),Tc(n,r.containerInfo)}function bf(n,r,u,C,A){return Si(),bc(A),r.flags|=256,Ln(n,r,u,C),r.child}var qc={dehydrated:null,treeContext:null,retryLane:0};function Kc(n){return{baseLanes:n,cachePool:null,transitions:null}}function yf(n,r,u){var C=r.pendingProps,A=qt.current,B=!1,V=(r.flags&128)!==0,J;if((J=V)||(J=n!==null&&n.memoizedState===null?!1:(A&2)!==0),J?(B=!0,r.flags&=-129):(n===null||n.memoizedState!==null)&&(A|=1),Ot(qt,A&1),n===null)return wc(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):(V=C.children,n=C.fallback,B?(C=r.mode,B=r.child,V={mode:"hidden",children:V},(C&1)===0&&B!==null?(B.childLanes=0,B.pendingProps=V):B=ua(V,C,0,null),n=Vs(n,C,u,null),B.return=r,n.return=r,B.sibling=n,r.child=B,r.child.memoizedState=Kc(u),r.memoizedState=qc,n):Vc(r,V));if(A=n.memoizedState,A!==null&&(J=A.dehydrated,J!==null))return lw(n,r,V,C,J,A,u);if(B){B=C.fallback,V=r.mode,A=n.child,J=A.sibling;var re={mode:"hidden",children:C.children};return(V&1)===0&&r.child!==A?(C=r.child,C.childLanes=0,C.pendingProps=re,r.deletions=null):(C=gs(A,re),C.subtreeFlags=A.subtreeFlags&14680064),J!==null?B=gs(J,B):(B=Vs(B,V,u,null),B.flags|=2),B.return=r,C.return=r,C.sibling=B,r.child=C,C=B,B=r.child,V=n.child.memoizedState,V=V===null?Kc(u):{baseLanes:V.baseLanes|u,cachePool:null,transitions:V.transitions},B.memoizedState=V,B.childLanes=n.childLanes&~u,r.memoizedState=qc,C}return B=n.child,n=B.sibling,C=gs(B,{mode:"visible",children:C.children}),(r.mode&1)===0&&(C.lanes=u),C.return=r,C.sibling=null,n!==null&&(u=r.deletions,u===null?(r.deletions=[n],r.flags|=16):u.push(n)),r.child=C,r.memoizedState=null,C}function Vc(n,r){return r=ua({mode:"visible",children:r},n.mode,0,null),r.return=n,n.child=r}function Ql(n,r,u,C){return C!==null&&bc(C),Ei(r,n.child,null,u),n=Vc(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function lw(n,r,u,C,A,B,V){if(u)return r.flags&256?(r.flags&=-257,C=Uc(Error(s(422))),Ql(n,r,V,C)):r.memoizedState!==null?(r.child=n.child,r.flags|=128,null):(B=C.fallback,A=r.mode,C=ua({mode:"visible",children:C.children},A,0,null),B=Vs(B,A,V,null),B.flags|=2,C.return=r,B.return=r,C.sibling=B,r.child=C,(r.mode&1)!==0&&Ei(r,n.child,null,V),r.child.memoizedState=Kc(V),r.memoizedState=qc,B);if((r.mode&1)===0)return Ql(n,r,V,null);if(A.data==="$!"){if(C=A.nextSibling&&A.nextSibling.dataset,C)var J=C.dgst;return C=J,B=Error(s(419)),C=Uc(B,C,void 0),Ql(n,r,V,C)}if(J=(V&n.childLanes)!==0,jn||J){if(C=ln,C!==null){switch(V&-V){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|V))!==0?0:A,A!==0&&A!==B.retryLane&&(B.retryLane=A,Wr(n,A),cr(C,n,A,-1))}return cu(),C=Uc(Error(s(421))),Ql(n,r,V,C)}return A.data==="$?"?(r.flags|=128,r.child=n.child,r=bw.bind(null,n),A._reactRetry=r,null):(n=B.treeContext,Hn=is(A.nextSibling),Fn=r,zt=!0,ir=null,n!==null&&(Kn[Vn++]=Hr,Kn[Vn++]=Ur,Kn[Vn++]=Bs,Hr=n.id,Ur=n.overflow,Bs=r),r=Vc(r,C.children),r.flags|=4096,r)}function kf(n,r,u){n.lanes|=r;var C=n.alternate;C!==null&&(C.lanes|=r),xc(n.return,r,u)}function Gc(n,r,u,C,A){var B=n.memoizedState;B===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:C,tail:u,tailMode:A}:(B.isBackwards=r,B.rendering=null,B.renderingStartTime=0,B.last=C,B.tail=u,B.tailMode=A)}function Cf(n,r,u){var C=r.pendingProps,A=C.revealOrder,B=C.tail;if(Ln(n,r,C.children,u),C=qt.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&&kf(n,u,r);else if(n.tag===19)kf(n,u,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(Ot(qt,C),(r.mode&1)===0)r.memoizedState=null;else switch(A){case"forwards":for(u=r.child,A=null;u!==null;)n=u.alternate,n!==null&&zl(n)===null&&(A=u),u=u.sibling;u=A,u===null?(A=r.child,r.child=null):(A=u.sibling,u.sibling=null),Gc(r,!1,A,u,B);break;case"backwards":for(u=null,A=r.child,r.child=null;A!==null;){if(n=A.alternate,n!==null&&zl(n)===null){r.child=A;break}n=A.sibling,A.sibling=u,u=A,A=n}Gc(r,!0,u,null,B);break;case"together":Gc(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function Jl(n,r){(r.mode&1)===0&&n!==null&&(n.alternate=null,r.alternate=null,r.flags|=2)}function zr(n,r,u){if(n!==null&&(r.dependencies=n.dependencies),$s|=r.lanes,(u&r.childLanes)===0)return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,u=gs(n,n.pendingProps),r.child=u,u.return=r;n.sibling!==null;)n=n.sibling,u=u.sibling=gs(n,n.pendingProps),u.return=r;u.sibling=null}return r.child}function aw(n,r,u){switch(r.tag){case 3:wf(r),Si();break;case 5:Ph(r);break;case 1:In(r.type)&&jl(r);break;case 4:Tc(r,r.stateNode.containerInfo);break;case 10:var C=r.type._context,A=r.memoizedProps.value;Ot(Hl,C._currentValue),C._currentValue=A;break;case 13:if(C=r.memoizedState,C!==null)return C.dehydrated!==null?(Ot(qt,qt.current&1),r.flags|=128,null):(u&r.child.childLanes)!==0?yf(n,r,u):(Ot(qt,qt.current&1),n=zr(n,r,u),n!==null?n.sibling:null);Ot(qt,qt.current&1);break;case 19:if(C=(u&r.childLanes)!==0,(n.flags&128)!==0){if(C)return Cf(n,r,u);r.flags|=128}if(A=r.memoizedState,A!==null&&(A.rendering=null,A.tail=null,A.lastEffect=null),Ot(qt,qt.current),C)break;return null;case 22:case 23:return r.lanes=0,gf(n,r,u)}return zr(n,r,u)}var xf,Yc,Sf,Ef;xf=function(n,r){for(var u=r.child;u!==null;){if(u.tag===5||u.tag===6)n.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===r)break;for(;u.sibling===null;){if(u.return===null||u.return===r)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Yc=function(){},Sf=function(n,r,u,C){var A=n.memoizedProps;if(A!==C){n=r.stateNode,Us(yr.current);var B=null;switch(u){case"input":A=ze(n,A),C=ze(n,C),B=[];break;case"select":A=U({},A,{value:void 0}),C=U({},C,{value:void 0}),B=[];break;case"textarea":A=Ae(n,A),C=Ae(n,C),B=[];break;default:typeof A.onClick!="function"&&typeof C.onClick=="function"&&(n.onclick=Ml)}Ne(u,C);var V;u=null;for(he in A)if(!C.hasOwnProperty(he)&&A.hasOwnProperty(he)&&A[he]!=null)if(he==="style"){var J=A[he];for(V in J)J.hasOwnProperty(V)&&(u||(u={}),u[V]="")}else he!=="dangerouslySetInnerHTML"&&he!=="children"&&he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&he!=="autoFocus"&&(c.hasOwnProperty(he)?B||(B=[]):(B=B||[]).push(he,null));for(he in C){var re=C[he];if(J=A!=null?A[he]:void 0,C.hasOwnProperty(he)&&re!==J&&(re!=null||J!=null))if(he==="style")if(J){for(V in J)!J.hasOwnProperty(V)||re&&re.hasOwnProperty(V)||(u||(u={}),u[V]="");for(V in re)re.hasOwnProperty(V)&&J[V]!==re[V]&&(u||(u={}),u[V]=re[V])}else u||(B||(B=[]),B.push(he,u)),u=re;else he==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,J=J?J.__html:void 0,re!=null&&J!==re&&(B=B||[]).push(he,re)):he==="children"?typeof re!="string"&&typeof re!="number"||(B=B||[]).push(he,""+re):he!=="suppressContentEditableWarning"&&he!=="suppressHydrationWarning"&&(c.hasOwnProperty(he)?(re!=null&&he==="onScroll"&&Ft("scroll",n),B||J===re||(B=[])):(B=B||[]).push(he,re))}u&&(B=B||[]).push("style",u);var he=B;(r.updateQueue=he)&&(r.flags|=4)}},Ef=function(n,r,u,C){u!==C&&(r.flags|=4)};function Lo(n,r){if(!zt)switch(n.tailMode){case"hidden":r=n.tail;for(var u=null;r!==null;)r.alternate!==null&&(u=r),r=r.sibling;u===null?n.tail=null:u.sibling=null;break;case"collapsed":u=n.tail;for(var C=null;u!==null;)u.alternate!==null&&(C=u),u=u.sibling;C===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:C.sibling=null}}function vn(n){var r=n.alternate!==null&&n.alternate.child===n.child,u=0,C=0;if(r)for(var A=n.child;A!==null;)u|=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;)u|=A.lanes|A.childLanes,C|=A.subtreeFlags,C|=A.flags,A.return=n,A=A.sibling;return n.subtreeFlags|=C,n.childLanes=u,r}function cw(n,r,u){var C=r.pendingProps;switch(vc(r),r.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vn(r),null;case 1:return In(r.type)&&Il(),vn(r),null;case 3:return C=r.stateNode,Ni(),Ht(An),Ht(mn),Rc(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(n===null||n.child===null)&&(Bl(r)?r.flags|=4:n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,ir!==null&&(ou(ir),ir=null))),Yc(n,r),vn(r),null;case 5:Lc(r);var A=Us(Co.current);if(u=r.type,n!==null&&r.stateNode!=null)Sf(n,r,u,C,A),n.ref!==r.ref&&(r.flags|=512,r.flags|=2097152);else{if(!C){if(r.stateNode===null)throw Error(s(166));return vn(r),null}if(n=Us(yr.current),Bl(r)){C=r.stateNode,u=r.type;var B=r.memoizedProps;switch(C[br]=r,C[_o]=B,n=(r.mode&1)!==0,u){case"dialog":Ft("cancel",C),Ft("close",C);break;case"iframe":case"object":case"embed":Ft("load",C);break;case"video":case"audio":for(A=0;A<mo.length;A++)Ft(mo[A],C);break;case"source":Ft("error",C);break;case"img":case"image":case"link":Ft("error",C),Ft("load",C);break;case"details":Ft("toggle",C);break;case"input":Qe(C,B),Ft("invalid",C);break;case"select":C._wrapperState={wasMultiple:!!B.multiple},Ft("invalid",C);break;case"textarea":Le(C,B),Ft("invalid",C)}Ne(u,B),A=null;for(var V in B)if(B.hasOwnProperty(V)){var J=B[V];V==="children"?typeof J=="string"?C.textContent!==J&&(B.suppressHydrationWarning!==!0&&Rl(C.textContent,J,n),A=["children",J]):typeof J=="number"&&C.textContent!==""+J&&(B.suppressHydrationWarning!==!0&&Rl(C.textContent,J,n),A=["children",""+J]):c.hasOwnProperty(V)&&J!=null&&V==="onScroll"&&Ft("scroll",C)}switch(u){case"input":be(C),at(C,B,!0);break;case"textarea":be(C),Fe(C);break;case"select":case"option":break;default:typeof B.onClick=="function"&&(C.onclick=Ml)}C=A,r.updateQueue=C,C!==null&&(r.flags|=4)}else{V=A.nodeType===9?A:A.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Ke(u)),n==="http://www.w3.org/1999/xhtml"?u==="script"?(n=V.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof C.is=="string"?n=V.createElement(u,{is:C.is}):(n=V.createElement(u),u==="select"&&(V=n,C.multiple?V.multiple=!0:C.size&&(V.size=C.size))):n=V.createElementNS(n,u),n[br]=r,n[_o]=C,xf(n,r,!1,!1),r.stateNode=n;e:{switch(V=He(u,C),u){case"dialog":Ft("cancel",n),Ft("close",n),A=C;break;case"iframe":case"object":case"embed":Ft("load",n),A=C;break;case"video":case"audio":for(A=0;A<mo.length;A++)Ft(mo[A],n);A=C;break;case"source":Ft("error",n),A=C;break;case"img":case"image":case"link":Ft("error",n),Ft("load",n),A=C;break;case"details":Ft("toggle",n),A=C;break;case"input":Qe(n,C),A=ze(n,C),Ft("invalid",n);break;case"option":A=C;break;case"select":n._wrapperState={wasMultiple:!!C.multiple},A=U({},C,{value:void 0}),Ft("invalid",n);break;case"textarea":Le(n,C),A=Ae(n,C),Ft("invalid",n);break;default:A=C}Ne(u,A),J=A;for(B in J)if(J.hasOwnProperty(B)){var re=J[B];B==="style"?Bt(n,re):B==="dangerouslySetInnerHTML"?(re=re?re.__html:void 0,re!=null&&Et(n,re)):B==="children"?typeof re=="string"?(u!=="textarea"||re!=="")&&ft(n,re):typeof re=="number"&&ft(n,""+re):B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&B!=="autoFocus"&&(c.hasOwnProperty(B)?re!=null&&B==="onScroll"&&Ft("scroll",n):re!=null&&p(n,B,re,V))}switch(u){case"input":be(n),at(n,C,!1);break;case"textarea":be(n),Fe(n);break;case"option":C.value!=null&&n.setAttribute("value",""+Y(C.value));break;case"select":n.multiple=!!C.multiple,B=C.value,B!=null?je(n,!!C.multiple,B,!1):C.defaultValue!=null&&je(n,!!C.multiple,C.defaultValue,!0);break;default:typeof A.onClick=="function"&&(n.onclick=Ml)}switch(u){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 vn(r),null;case 6:if(n&&r.stateNode!=null)Ef(n,r,n.memoizedProps,C);else{if(typeof C!="string"&&r.stateNode===null)throw Error(s(166));if(u=Us(Co.current),Us(yr.current),Bl(r)){if(C=r.stateNode,u=r.memoizedProps,C[br]=r,(B=C.nodeValue!==u)&&(n=Fn,n!==null))switch(n.tag){case 3:Rl(C.nodeValue,u,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Rl(C.nodeValue,u,(n.mode&1)!==0)}B&&(r.flags|=4)}else C=(u.nodeType===9?u:u.ownerDocument).createTextNode(C),C[br]=r,r.stateNode=C}return vn(r),null;case 13:if(Ht(qt),C=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(zt&&Hn!==null&&(r.mode&1)!==0&&(r.flags&128)===0)Lh(),Si(),r.flags|=98560,B=!1;else if(B=Bl(r),C!==null&&C.dehydrated!==null){if(n===null){if(!B)throw Error(s(318));if(B=r.memoizedState,B=B!==null?B.dehydrated:null,!B)throw Error(s(317));B[br]=r}else Si(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;vn(r),B=!1}else ir!==null&&(ou(ir),ir=null),B=!0;if(!B)return r.flags&65536?r:null}return(r.flags&128)!==0?(r.lanes=u,r):(C=C!==null,C!==(n!==null&&n.memoizedState!==null)&&C&&(r.child.flags|=8192,(r.mode&1)!==0&&(n===null||(qt.current&1)!==0?rn===0&&(rn=3):cu())),r.updateQueue!==null&&(r.flags|=4),vn(r),null);case 4:return Ni(),Yc(n,r),n===null&&go(r.stateNode.containerInfo),vn(r),null;case 10:return Cc(r.type._context),vn(r),null;case 17:return In(r.type)&&Il(),vn(r),null;case 19:if(Ht(qt),B=r.memoizedState,B===null)return vn(r),null;if(C=(r.flags&128)!==0,V=B.rendering,V===null)if(C)Lo(B,!1);else{if(rn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(V=zl(n),V!==null){for(r.flags|=128,Lo(B,!1),C=V.updateQueue,C!==null&&(r.updateQueue=C,r.flags|=4),r.subtreeFlags=0,C=u,u=r.child;u!==null;)B=u,n=C,B.flags&=14680066,V=B.alternate,V===null?(B.childLanes=0,B.lanes=n,B.child=null,B.subtreeFlags=0,B.memoizedProps=null,B.memoizedState=null,B.updateQueue=null,B.dependencies=null,B.stateNode=null):(B.childLanes=V.childLanes,B.lanes=V.lanes,B.child=V.child,B.subtreeFlags=0,B.deletions=null,B.memoizedProps=V.memoizedProps,B.memoizedState=V.memoizedState,B.updateQueue=V.updateQueue,B.type=V.type,n=V.dependencies,B.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),u=u.sibling;return Ot(qt,qt.current&1|2),r.child}n=n.sibling}B.tail!==null&&At()>Ii&&(r.flags|=128,C=!0,Lo(B,!1),r.lanes=4194304)}else{if(!C)if(n=zl(V),n!==null){if(r.flags|=128,C=!0,u=n.updateQueue,u!==null&&(r.updateQueue=u,r.flags|=4),Lo(B,!0),B.tail===null&&B.tailMode==="hidden"&&!V.alternate&&!zt)return vn(r),null}else 2*At()-B.renderingStartTime>Ii&&u!==1073741824&&(r.flags|=128,C=!0,Lo(B,!1),r.lanes=4194304);B.isBackwards?(V.sibling=r.child,r.child=V):(u=B.last,u!==null?u.sibling=V:r.child=V,B.last=V)}return B.tail!==null?(r=B.tail,B.rendering=r,B.tail=r.sibling,B.renderingStartTime=At(),r.sibling=null,u=qt.current,Ot(qt,C?u&1|2:u&1),r):(vn(r),null);case 22:case 23:return au(),C=r.memoizedState!==null,n!==null&&n.memoizedState!==null!==C&&(r.flags|=8192),C&&(r.mode&1)!==0?(Un&1073741824)!==0&&(vn(r),r.subtreeFlags&6&&(r.flags|=8192)):vn(r),null;case 24:return null;case 25:return null}throw Error(s(156,r.tag))}function uw(n,r){switch(vc(r),r.tag){case 1:return In(r.type)&&Il(),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Ni(),Ht(An),Ht(mn),Rc(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 5:return Lc(r),null;case 13:if(Ht(qt),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));Si()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return Ht(qt),null;case 4:return Ni(),null;case 10:return Cc(r.type._context),null;case 22:case 23:return au(),null;case 24:return null;default:return null}}var Zl=!1,_n=!1,dw=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Mi(n,r){var u=n.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(C){Vt(n,r,C)}else u.current=null}function Xc(n,r,u){try{u()}catch(C){Vt(n,r,C)}}var Tf=!1;function hw(n,r){if(ac=Ns,n=fo(),X(n)){if("selectionStart"in n)var u={start:n.selectionStart,end:n.selectionEnd};else e:{u=(u=n.ownerDocument)&&u.defaultView||window;var C=u.getSelection&&u.getSelection();if(C&&C.rangeCount!==0){u=C.anchorNode;var A=C.anchorOffset,B=C.focusNode;C=C.focusOffset;try{u.nodeType,B.nodeType}catch{u=null;break e}var V=0,J=-1,re=-1,he=0,Se=0,Ee=n,xe=null;t:for(;;){for(var qe;Ee!==u||A!==0&&Ee.nodeType!==3||(J=V+A),Ee!==B||C!==0&&Ee.nodeType!==3||(re=V+C),Ee.nodeType===3&&(V+=Ee.nodeValue.length),(qe=Ee.firstChild)!==null;)xe=Ee,Ee=qe;for(;;){if(Ee===n)break t;if(xe===u&&++he===A&&(J=V),xe===B&&++Se===C&&(re=V),(qe=Ee.nextSibling)!==null)break;Ee=xe,xe=Ee.parentNode}Ee=qe}u=J===-1||re===-1?null:{start:J,end:re}}else u=null}u=u||{start:0,end:0}}else u=null;for(cc={focusedElem:n,selectionRange:u},Ns=!1,Ve=r;Ve!==null;)if(r=Ve,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Ve=n;else for(;Ve!==null;){r=Ve;try{var Ye=r.alternate;if((r.flags&1024)!==0)switch(r.tag){case 0:case 11:case 15:break;case 1:if(Ye!==null){var Ze=Ye.memoizedProps,Xt=Ye.memoizedState,ce=r.stateNode,le=ce.getSnapshotBeforeUpdate(r.elementType===r.type?Ze:or(r.type,Ze),Xt);ce.__reactInternalSnapshotBeforeUpdate=le}break;case 3:var ue=r.stateNode.containerInfo;ue.nodeType===1?ue.textContent="":ue.nodeType===9&&ue.documentElement&&ue.removeChild(ue.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(s(163))}}catch(Me){Vt(r,r.return,Me)}if(n=r.sibling,n!==null){n.return=r.return,Ve=n;break}Ve=r.return}return Ye=Tf,Tf=!1,Ye}function No(n,r,u){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 B=A.destroy;A.destroy=void 0,B!==void 0&&Xc(r,u,B)}A=A.next}while(A!==C)}}function ea(n,r){if(r=r.updateQueue,r=r!==null?r.lastEffect:null,r!==null){var u=r=r.next;do{if((u.tag&n)===n){var C=u.create;u.destroy=C()}u=u.next}while(u!==r)}}function Qc(n){var r=n.ref;if(r!==null){var u=n.stateNode;switch(n.tag){case 5:n=u;break;default:n=u}typeof r=="function"?r(n):r.current=n}}function Lf(n){var r=n.alternate;r!==null&&(n.alternate=null,Lf(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&(delete r[br],delete r[_o],delete r[fc],delete r[G_],delete r[Y_])),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 Nf(n){return n.tag===5||n.tag===3||n.tag===4}function Rf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Nf(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 Jc(n,r,u){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?u.nodeType===8?u.parentNode.insertBefore(n,r):u.insertBefore(n,r):(u.nodeType===8?(r=u.parentNode,r.insertBefore(n,u)):(r=u,r.appendChild(n)),u=u._reactRootContainer,u!=null||r.onclick!==null||(r.onclick=Ml));else if(C!==4&&(n=n.child,n!==null))for(Jc(n,r,u),n=n.sibling;n!==null;)Jc(n,r,u),n=n.sibling}function Zc(n,r,u){var C=n.tag;if(C===5||C===6)n=n.stateNode,r?u.insertBefore(n,r):u.appendChild(n);else if(C!==4&&(n=n.child,n!==null))for(Zc(n,r,u),n=n.sibling;n!==null;)Zc(n,r,u),n=n.sibling}var dn=null,lr=!1;function ds(n,r,u){for(u=u.child;u!==null;)Mf(n,r,u),u=u.sibling}function Mf(n,r,u){if(Cn&&typeof Cn.onCommitFiberUnmount=="function")try{Cn.onCommitFiberUnmount(nr,u)}catch{}switch(u.tag){case 5:_n||Mi(u,r);case 6:var C=dn,A=lr;dn=null,ds(n,r,u),dn=C,lr=A,dn!==null&&(lr?(n=dn,u=u.stateNode,n.nodeType===8?n.parentNode.removeChild(u):n.removeChild(u)):dn.removeChild(u.stateNode));break;case 18:dn!==null&&(lr?(n=dn,u=u.stateNode,n.nodeType===8?hc(n.parentNode,u):n.nodeType===1&&hc(n,u),Nt(n)):hc(dn,u.stateNode));break;case 4:C=dn,A=lr,dn=u.stateNode.containerInfo,lr=!0,ds(n,r,u),dn=C,lr=A;break;case 0:case 11:case 14:case 15:if(!_n&&(C=u.updateQueue,C!==null&&(C=C.lastEffect,C!==null))){A=C=C.next;do{var B=A,V=B.destroy;B=B.tag,V!==void 0&&((B&2)!==0||(B&4)!==0)&&Xc(u,r,V),A=A.next}while(A!==C)}ds(n,r,u);break;case 1:if(!_n&&(Mi(u,r),C=u.stateNode,typeof C.componentWillUnmount=="function"))try{C.props=u.memoizedProps,C.state=u.memoizedState,C.componentWillUnmount()}catch(J){Vt(u,r,J)}ds(n,r,u);break;case 21:ds(n,r,u);break;case 22:u.mode&1?(_n=(C=_n)||u.memoizedState!==null,ds(n,r,u),_n=C):ds(n,r,u);break;default:ds(n,r,u)}}function Af(n){var r=n.updateQueue;if(r!==null){n.updateQueue=null;var u=n.stateNode;u===null&&(u=n.stateNode=new dw),r.forEach(function(C){var A=yw.bind(null,n,C);u.has(C)||(u.add(C),C.then(A,A))})}}function ar(n,r){var u=r.deletions;if(u!==null)for(var C=0;C<u.length;C++){var A=u[C];try{var B=n,V=r,J=V;e:for(;J!==null;){switch(J.tag){case 5:dn=J.stateNode,lr=!1;break e;case 3:dn=J.stateNode.containerInfo,lr=!0;break e;case 4:dn=J.stateNode.containerInfo,lr=!0;break e}J=J.return}if(dn===null)throw Error(s(160));Mf(B,V,A),dn=null,lr=!1;var re=A.alternate;re!==null&&(re.return=null),A.return=null}catch(he){Vt(A,r,he)}}if(r.subtreeFlags&12854)for(r=r.child;r!==null;)If(r,n),r=r.sibling}function If(n,r){var u=n.alternate,C=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(ar(r,n),Cr(n),C&4){try{No(3,n,n.return),ea(3,n)}catch(Ze){Vt(n,n.return,Ze)}try{No(5,n,n.return)}catch(Ze){Vt(n,n.return,Ze)}}break;case 1:ar(r,n),Cr(n),C&512&&u!==null&&Mi(u,u.return);break;case 5:if(ar(r,n),Cr(n),C&512&&u!==null&&Mi(u,u.return),n.flags&32){var A=n.stateNode;try{ft(A,"")}catch(Ze){Vt(n,n.return,Ze)}}if(C&4&&(A=n.stateNode,A!=null)){var B=n.memoizedProps,V=u!==null?u.memoizedProps:B,J=n.type,re=n.updateQueue;if(n.updateQueue=null,re!==null)try{J==="input"&&B.type==="radio"&&B.name!=null&&dt(A,B),He(J,V);var he=He(J,B);for(V=0;V<re.length;V+=2){var Se=re[V],Ee=re[V+1];Se==="style"?Bt(A,Ee):Se==="dangerouslySetInnerHTML"?Et(A,Ee):Se==="children"?ft(A,Ee):p(A,Se,Ee,he)}switch(J){case"input":Ie(A,B);break;case"textarea":nt(A,B);break;case"select":var xe=A._wrapperState.wasMultiple;A._wrapperState.wasMultiple=!!B.multiple;var qe=B.value;qe!=null?je(A,!!B.multiple,qe,!1):xe!==!!B.multiple&&(B.defaultValue!=null?je(A,!!B.multiple,B.defaultValue,!0):je(A,!!B.multiple,B.multiple?[]:"",!1))}A[_o]=B}catch(Ze){Vt(n,n.return,Ze)}}break;case 6:if(ar(r,n),Cr(n),C&4){if(n.stateNode===null)throw Error(s(162));A=n.stateNode,B=n.memoizedProps;try{A.nodeValue=B}catch(Ze){Vt(n,n.return,Ze)}}break;case 3:if(ar(r,n),Cr(n),C&4&&u!==null&&u.memoizedState.isDehydrated)try{Nt(r.containerInfo)}catch(Ze){Vt(n,n.return,Ze)}break;case 4:ar(r,n),Cr(n);break;case 13:ar(r,n),Cr(n),A=n.child,A.flags&8192&&(B=A.memoizedState!==null,A.stateNode.isHidden=B,!B||A.alternate!==null&&A.alternate.memoizedState!==null||(nu=At())),C&4&&Af(n);break;case 22:if(Se=u!==null&&u.memoizedState!==null,n.mode&1?(_n=(he=_n)||Se,ar(r,n),_n=he):ar(r,n),Cr(n),C&8192){if(he=n.memoizedState!==null,(n.stateNode.isHidden=he)&&!Se&&(n.mode&1)!==0)for(Ve=n,Se=n.child;Se!==null;){for(Ee=Ve=Se;Ve!==null;){switch(xe=Ve,qe=xe.child,xe.tag){case 0:case 11:case 14:case 15:No(4,xe,xe.return);break;case 1:Mi(xe,xe.return);var Ye=xe.stateNode;if(typeof Ye.componentWillUnmount=="function"){C=xe,u=xe.return;try{r=C,Ye.props=r.memoizedProps,Ye.state=r.memoizedState,Ye.componentWillUnmount()}catch(Ze){Vt(C,u,Ze)}}break;case 5:Mi(xe,xe.return);break;case 22:if(xe.memoizedState!==null){Pf(Ee);continue}}qe!==null?(qe.return=xe,Ve=qe):Pf(Ee)}Se=Se.sibling}e:for(Se=null,Ee=n;;){if(Ee.tag===5){if(Se===null){Se=Ee;try{A=Ee.stateNode,he?(B=A.style,typeof B.setProperty=="function"?B.setProperty("display","none","important"):B.display="none"):(J=Ee.stateNode,re=Ee.memoizedProps.style,V=re!=null&&re.hasOwnProperty("display")?re.display:null,J.style.display=yt("display",V))}catch(Ze){Vt(n,n.return,Ze)}}}else if(Ee.tag===6){if(Se===null)try{Ee.stateNode.nodeValue=he?"":Ee.memoizedProps}catch(Ze){Vt(n,n.return,Ze)}}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;Se===Ee&&(Se=null),Ee=Ee.return}Se===Ee&&(Se=null),Ee.sibling.return=Ee.return,Ee=Ee.sibling}}break;case 19:ar(r,n),Cr(n),C&4&&Af(n);break;case 21:break;default:ar(r,n),Cr(n)}}function Cr(n){var r=n.flags;if(r&2){try{e:{for(var u=n.return;u!==null;){if(Nf(u)){var C=u;break e}u=u.return}throw Error(s(160))}switch(C.tag){case 5:var A=C.stateNode;C.flags&32&&(ft(A,""),C.flags&=-33);var B=Rf(n);Zc(n,B,A);break;case 3:case 4:var V=C.stateNode.containerInfo,J=Rf(n);Jc(n,J,V);break;default:throw Error(s(161))}}catch(re){Vt(n,n.return,re)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function fw(n,r,u){Ve=n,jf(n)}function jf(n,r,u){for(var C=(n.mode&1)!==0;Ve!==null;){var A=Ve,B=A.child;if(A.tag===22&&C){var V=A.memoizedState!==null||Zl;if(!V){var J=A.alternate,re=J!==null&&J.memoizedState!==null||_n;J=Zl;var he=_n;if(Zl=V,(_n=re)&&!he)for(Ve=A;Ve!==null;)V=Ve,re=V.child,V.tag===22&&V.memoizedState!==null?Of(A):re!==null?(re.return=V,Ve=re):Of(A);for(;B!==null;)Ve=B,jf(B),B=B.sibling;Ve=A,Zl=J,_n=he}Df(n)}else(A.subtreeFlags&8772)!==0&&B!==null?(B.return=A,Ve=B):Df(n)}}function Df(n){for(;Ve!==null;){var r=Ve;if((r.flags&8772)!==0){var u=r.alternate;try{if((r.flags&8772)!==0)switch(r.tag){case 0:case 11:case 15:_n||ea(5,r);break;case 1:var C=r.stateNode;if(r.flags&4&&!_n)if(u===null)C.componentDidMount();else{var A=r.elementType===r.type?u.memoizedProps:or(r.type,u.memoizedProps);C.componentDidUpdate(A,u.memoizedState,C.__reactInternalSnapshotBeforeUpdate)}var B=r.updateQueue;B!==null&&Dh(r,B,C);break;case 3:var V=r.updateQueue;if(V!==null){if(u=null,r.child!==null)switch(r.child.tag){case 5:u=r.child.stateNode;break;case 1:u=r.child.stateNode}Dh(r,V,u)}break;case 5:var J=r.stateNode;if(u===null&&r.flags&4){u=J;var re=r.memoizedProps;switch(r.type){case"button":case"input":case"select":case"textarea":re.autoFocus&&u.focus();break;case"img":re.src&&(u.src=re.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(r.memoizedState===null){var he=r.alternate;if(he!==null){var Se=he.memoizedState;if(Se!==null){var Ee=Se.dehydrated;Ee!==null&&Nt(Ee)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(s(163))}_n||r.flags&512&&Qc(r)}catch(xe){Vt(r,r.return,xe)}}if(r===n){Ve=null;break}if(u=r.sibling,u!==null){u.return=r.return,Ve=u;break}Ve=r.return}}function Pf(n){for(;Ve!==null;){var r=Ve;if(r===n){Ve=null;break}var u=r.sibling;if(u!==null){u.return=r.return,Ve=u;break}Ve=r.return}}function Of(n){for(;Ve!==null;){var r=Ve;try{switch(r.tag){case 0:case 11:case 15:var u=r.return;try{ea(4,r)}catch(re){Vt(r,u,re)}break;case 1:var C=r.stateNode;if(typeof C.componentDidMount=="function"){var A=r.return;try{C.componentDidMount()}catch(re){Vt(r,A,re)}}var B=r.return;try{Qc(r)}catch(re){Vt(r,B,re)}break;case 5:var V=r.return;try{Qc(r)}catch(re){Vt(r,V,re)}}}catch(re){Vt(r,r.return,re)}if(r===n){Ve=null;break}var J=r.sibling;if(J!==null){J.return=r.return,Ve=J;break}Ve=r.return}}var pw=Math.ceil,ta=S.ReactCurrentDispatcher,eu=S.ReactCurrentOwner,Xn=S.ReactCurrentBatchConfig,St=0,ln=null,Zt=null,hn=0,Un=0,Ai=os(0),rn=0,Ro=null,$s=0,na=0,tu=0,Mo=null,Dn=null,nu=0,Ii=1/0,qr=null,ra=!1,ru=null,hs=null,sa=!1,fs=null,ia=0,Ao=0,su=null,oa=-1,la=0;function Nn(){return(St&6)!==0?At():oa!==-1?oa:oa=At()}function ps(n){return(n.mode&1)===0?1:(St&2)!==0&&hn!==0?hn&-hn:Q_.transition!==null?(la===0&&(la=wt()),la):(n=kt,n!==0||(n=window.event,n=n===void 0?16:li(n.type)),n)}function cr(n,r,u,C){if(50<Ao)throw Ao=0,su=null,Error(s(185));sn(n,u,C),((St&2)===0||n!==ln)&&(n===ln&&((St&2)===0&&(na|=u),rn===4&&ms(n,hn)),Pn(n,C),u===1&&St===0&&(r.mode&1)===0&&(Ii=At()+500,Dl&&as()))}function Pn(n,r){var u=n.callbackNode;Pe(n,r);var C=zn(n,n===ln?hn:0);if(C===0)u!==null&&$n(u),n.callbackNode=null,n.callbackPriority=0;else if(r=C&-C,n.callbackPriority!==r){if(u!=null&&$n(u),r===1)n.tag===0?X_(Ff.bind(null,n)):Ch(Ff.bind(null,n)),K_(function(){(St&6)===0&&as()}),u=null;else{switch(sr(C)){case 1:u=tr;break;case 4:u=pr;break;case 16:u=Rr;break;case 536870912:u=Mr;break;default:u=Rr}u=Vf(u,Bf.bind(null,n))}n.callbackPriority=r,n.callbackNode=u}}function Bf(n,r){if(oa=-1,la=0,(St&6)!==0)throw Error(s(327));var u=n.callbackNode;if(ji()&&n.callbackNode!==u)return null;var C=zn(n,n===ln?hn:0);if(C===0)return null;if((C&30)!==0||(C&n.expiredLanes)!==0||r)r=aa(n,C);else{r=C;var A=St;St|=2;var B=Uf();(ln!==n||hn!==r)&&(qr=null,Ii=At()+500,qs(n,r));do try{vw();break}catch(J){Hf(n,J)}while(!0);kc(),ta.current=B,St=A,Zt!==null?r=0:(ln=null,hn=0,r=rn)}if(r!==0){if(r===2&&(A=ut(n),A!==0&&(C=A,r=iu(n,A))),r===1)throw u=Ro,qs(n,0),ms(n,C),Pn(n,At()),u;if(r===6)ms(n,C);else{if(A=n.current.alternate,(C&30)===0&&!mw(A)&&(r=aa(n,C),r===2&&(B=ut(n),B!==0&&(C=B,r=iu(n,B))),r===1))throw u=Ro,qs(n,0),ms(n,C),Pn(n,At()),u;switch(n.finishedWork=A,n.finishedLanes=C,r){case 0:case 1:throw Error(s(345));case 2:Ks(n,Dn,qr);break;case 3:if(ms(n,C),(C&130023424)===C&&(r=nu+500-At(),10<r)){if(zn(n,0)!==0)break;if(A=n.suspendedLanes,(A&C)!==C){Nn(),n.pingedLanes|=n.suspendedLanes&A;break}n.timeoutHandle=dc(Ks.bind(null,n,Dn,qr),r);break}Ks(n,Dn,qr);break;case 4:if(ms(n,C),(C&4194240)===C)break;for(r=n.eventTimes,A=-1;0<C;){var V=31-pn(C);B=1<<V,V=r[V],V>A&&(A=V),C&=~B}if(C=A,C=At()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*pw(C/1960))-C,10<C){n.timeoutHandle=dc(Ks.bind(null,n,Dn,qr),C);break}Ks(n,Dn,qr);break;case 5:Ks(n,Dn,qr);break;default:throw Error(s(329))}}}return Pn(n,At()),n.callbackNode===u?Bf.bind(null,n):null}function iu(n,r){var u=Mo;return n.current.memoizedState.isDehydrated&&(qs(n,r).flags|=256),n=aa(n,r),n!==2&&(r=Dn,Dn=u,r!==null&&ou(r)),n}function ou(n){Dn===null?Dn=n:Dn.push.apply(Dn,n)}function mw(n){for(var r=n;;){if(r.flags&16384){var u=r.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var C=0;C<u.length;C++){var A=u[C],B=A.getSnapshot;A=A.value;try{if(!un(B(),A))return!1}catch{return!1}}}if(u=r.child,r.subtreeFlags&16384&&u!==null)u.return=r,r=u;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 ms(n,r){for(r&=~tu,r&=~na,n.suspendedLanes|=r,n.pingedLanes&=~r,n=n.expirationTimes;0<r;){var u=31-pn(r),C=1<<u;n[u]=-1,r&=~C}}function Ff(n){if((St&6)!==0)throw Error(s(327));ji();var r=zn(n,0);if((r&1)===0)return Pn(n,At()),null;var u=aa(n,r);if(n.tag!==0&&u===2){var C=ut(n);C!==0&&(r=C,u=iu(n,C))}if(u===1)throw u=Ro,qs(n,0),ms(n,r),Pn(n,At()),u;if(u===6)throw Error(s(345));return n.finishedWork=n.current.alternate,n.finishedLanes=r,Ks(n,Dn,qr),Pn(n,At()),null}function lu(n,r){var u=St;St|=1;try{return n(r)}finally{St=u,St===0&&(Ii=At()+500,Dl&&as())}}function zs(n){fs!==null&&fs.tag===0&&(St&6)===0&&ji();var r=St;St|=1;var u=Xn.transition,C=kt;try{if(Xn.transition=null,kt=1,n)return n()}finally{kt=C,Xn.transition=u,St=r,(St&6)===0&&as()}}function au(){Un=Ai.current,Ht(Ai)}function qs(n,r){n.finishedWork=null,n.finishedLanes=0;var u=n.timeoutHandle;if(u!==-1&&(n.timeoutHandle=-1,q_(u)),Zt!==null)for(u=Zt.return;u!==null;){var C=u;switch(vc(C),C.tag){case 1:C=C.type.childContextTypes,C!=null&&Il();break;case 3:Ni(),Ht(An),Ht(mn),Rc();break;case 5:Lc(C);break;case 4:Ni();break;case 13:Ht(qt);break;case 19:Ht(qt);break;case 10:Cc(C.type._context);break;case 22:case 23:au()}u=u.return}if(ln=n,Zt=n=gs(n.current,null),hn=Un=r,rn=0,Ro=null,tu=na=$s=0,Dn=Mo=null,Hs!==null){for(r=0;r<Hs.length;r++)if(u=Hs[r],C=u.interleaved,C!==null){u.interleaved=null;var A=C.next,B=u.pending;if(B!==null){var V=B.next;B.next=A,C.next=V}u.pending=C}Hs=null}return n}function Hf(n,r){do{var u=Zt;try{if(kc(),ql.current=Yl,Kl){for(var C=Kt.memoizedState;C!==null;){var A=C.queue;A!==null&&(A.pending=null),C=C.next}Kl=!1}if(Ws=0,on=nn=Kt=null,xo=!1,So=0,eu.current=null,u===null||u.return===null){rn=1,Ro=r,Zt=null;break}e:{var B=n,V=u.return,J=u,re=r;if(r=hn,J.flags|=32768,re!==null&&typeof re=="object"&&typeof re.then=="function"){var he=re,Se=J,Ee=Se.tag;if((Se.mode&1)===0&&(Ee===0||Ee===11||Ee===15)){var xe=Se.alternate;xe?(Se.updateQueue=xe.updateQueue,Se.memoizedState=xe.memoizedState,Se.lanes=xe.lanes):(Se.updateQueue=null,Se.memoizedState=null)}var qe=df(V);if(qe!==null){qe.flags&=-257,hf(qe,V,J,B,r),qe.mode&1&&uf(B,he,r),r=qe,re=he;var Ye=r.updateQueue;if(Ye===null){var Ze=new Set;Ze.add(re),r.updateQueue=Ze}else Ye.add(re);break e}else{if((r&1)===0){uf(B,he,r),cu();break e}re=Error(s(426))}}else if(zt&&J.mode&1){var Xt=df(V);if(Xt!==null){(Xt.flags&65536)===0&&(Xt.flags|=256),hf(Xt,V,J,B,r),bc(Ri(re,J));break e}}B=re=Ri(re,J),rn!==4&&(rn=2),Mo===null?Mo=[B]:Mo.push(B),B=V;do{switch(B.tag){case 3:B.flags|=65536,r&=-r,B.lanes|=r;var ce=af(B,re,r);jh(B,ce);break e;case 1:J=re;var le=B.type,ue=B.stateNode;if((B.flags&128)===0&&(typeof le.getDerivedStateFromError=="function"||ue!==null&&typeof ue.componentDidCatch=="function"&&(hs===null||!hs.has(ue)))){B.flags|=65536,r&=-r,B.lanes|=r;var Me=cf(B,J,r);jh(B,Me);break e}}B=B.return}while(B!==null)}$f(u)}catch(tt){r=tt,Zt===u&&u!==null&&(Zt=u=u.return);continue}break}while(!0)}function Uf(){var n=ta.current;return ta.current=Yl,n===null?Yl:n}function cu(){(rn===0||rn===3||rn===2)&&(rn=4),ln===null||($s&268435455)===0&&(na&268435455)===0||ms(ln,hn)}function aa(n,r){var u=St;St|=2;var C=Uf();(ln!==n||hn!==r)&&(qr=null,qs(n,r));do try{gw();break}catch(A){Hf(n,A)}while(!0);if(kc(),St=u,ta.current=C,Zt!==null)throw Error(s(261));return ln=null,hn=0,rn}function gw(){for(;Zt!==null;)Wf(Zt)}function vw(){for(;Zt!==null&&!fr();)Wf(Zt)}function Wf(n){var r=Kf(n.alternate,n,Un);n.memoizedProps=n.pendingProps,r===null?$f(n):Zt=r,eu.current=null}function $f(n){var r=n;do{var u=r.alternate;if(n=r.return,(r.flags&32768)===0){if(u=cw(u,r,Un),u!==null){Zt=u;return}}else{if(u=uw(u,r),u!==null){u.flags&=32767,Zt=u;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{rn=6,Zt=null;return}}if(r=r.sibling,r!==null){Zt=r;return}Zt=r=n}while(r!==null);rn===0&&(rn=5)}function Ks(n,r,u){var C=kt,A=Xn.transition;try{Xn.transition=null,kt=1,_w(n,r,u,C)}finally{Xn.transition=A,kt=C}return null}function _w(n,r,u,C){do ji();while(fs!==null);if((St&6)!==0)throw Error(s(327));u=n.finishedWork;var A=n.finishedLanes;if(u===null)return null;if(n.finishedWork=null,n.finishedLanes=0,u===n.current)throw Error(s(177));n.callbackNode=null,n.callbackPriority=0;var B=u.lanes|u.childLanes;if(gr(n,B),n===ln&&(Zt=ln=null,hn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||sa||(sa=!0,Vf(Rr,function(){return ji(),null})),B=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||B){B=Xn.transition,Xn.transition=null;var V=kt;kt=1;var J=St;St|=4,eu.current=null,hw(n,u),If(u,n),ge(cc),Ns=!!ac,cc=ac=null,n.current=u,fw(u),Lr(),St=J,kt=V,Xn.transition=B}else n.current=u;if(sa&&(sa=!1,fs=n,ia=A),B=n.pendingLanes,B===0&&(hs=null),Yr(u.stateNode),Pn(n,At()),r!==null)for(C=n.onRecoverableError,u=0;u<r.length;u++)A=r[u],C(A.value,{componentStack:A.stack,digest:A.digest});if(ra)throw ra=!1,n=ru,ru=null,n;return(ia&1)!==0&&n.tag!==0&&ji(),B=n.pendingLanes,(B&1)!==0?n===su?Ao++:(Ao=0,su=n):Ao=0,as(),null}function ji(){if(fs!==null){var n=sr(ia),r=Xn.transition,u=kt;try{if(Xn.transition=null,kt=16>n?16:n,fs===null)var C=!1;else{if(n=fs,fs=null,ia=0,(St&6)!==0)throw Error(s(331));var A=St;for(St|=4,Ve=n.current;Ve!==null;){var B=Ve,V=B.child;if((Ve.flags&16)!==0){var J=B.deletions;if(J!==null){for(var re=0;re<J.length;re++){var he=J[re];for(Ve=he;Ve!==null;){var Se=Ve;switch(Se.tag){case 0:case 11:case 15:No(8,Se,B)}var Ee=Se.child;if(Ee!==null)Ee.return=Se,Ve=Ee;else for(;Ve!==null;){Se=Ve;var xe=Se.sibling,qe=Se.return;if(Lf(Se),Se===he){Ve=null;break}if(xe!==null){xe.return=qe,Ve=xe;break}Ve=qe}}}var Ye=B.alternate;if(Ye!==null){var Ze=Ye.child;if(Ze!==null){Ye.child=null;do{var Xt=Ze.sibling;Ze.sibling=null,Ze=Xt}while(Ze!==null)}}Ve=B}}if((B.subtreeFlags&2064)!==0&&V!==null)V.return=B,Ve=V;else e:for(;Ve!==null;){if(B=Ve,(B.flags&2048)!==0)switch(B.tag){case 0:case 11:case 15:No(9,B,B.return)}var ce=B.sibling;if(ce!==null){ce.return=B.return,Ve=ce;break e}Ve=B.return}}var le=n.current;for(Ve=le;Ve!==null;){V=Ve;var ue=V.child;if((V.subtreeFlags&2064)!==0&&ue!==null)ue.return=V,Ve=ue;else e:for(V=le;Ve!==null;){if(J=Ve,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:ea(9,J)}}catch(tt){Vt(J,J.return,tt)}if(J===V){Ve=null;break e}var Me=J.sibling;if(Me!==null){Me.return=J.return,Ve=Me;break e}Ve=J.return}}if(St=A,as(),Cn&&typeof Cn.onPostCommitFiberRoot=="function")try{Cn.onPostCommitFiberRoot(nr,n)}catch{}C=!0}return C}finally{kt=u,Xn.transition=r}}return!1}function zf(n,r,u){r=Ri(u,r),r=af(n,r,1),n=us(n,r,1),r=Nn(),n!==null&&(sn(n,1,r),Pn(n,r))}function Vt(n,r,u){if(n.tag===3)zf(n,n,u);else for(;r!==null;){if(r.tag===3){zf(r,n,u);break}else if(r.tag===1){var C=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(hs===null||!hs.has(C))){n=Ri(u,n),n=cf(r,n,1),r=us(r,n,1),n=Nn(),r!==null&&(sn(r,1,n),Pn(r,n));break}}r=r.return}}function ww(n,r,u){var C=n.pingCache;C!==null&&C.delete(r),r=Nn(),n.pingedLanes|=n.suspendedLanes&u,ln===n&&(hn&u)===u&&(rn===4||rn===3&&(hn&130023424)===hn&&500>At()-nu?qs(n,0):tu|=u),Pn(n,r)}function qf(n,r){r===0&&((n.mode&1)===0?r=1:(r=mr,mr<<=1,(mr&130023424)===0&&(mr=4194304)));var u=Nn();n=Wr(n,r),n!==null&&(sn(n,r,u),Pn(n,u))}function bw(n){var r=n.memoizedState,u=0;r!==null&&(u=r.retryLane),qf(n,u)}function yw(n,r){var u=0;switch(n.tag){case 13:var C=n.stateNode,A=n.memoizedState;A!==null&&(u=A.retryLane);break;case 19:C=n.stateNode;break;default:throw Error(s(314))}C!==null&&C.delete(r),qf(n,u)}var Kf;Kf=function(n,r,u){if(n!==null)if(n.memoizedProps!==r.pendingProps||An.current)jn=!0;else{if((n.lanes&u)===0&&(r.flags&128)===0)return jn=!1,aw(n,r,u);jn=(n.flags&131072)!==0}else jn=!1,zt&&(r.flags&1048576)!==0&&xh(r,Ol,r.index);switch(r.lanes=0,r.tag){case 2:var C=r.type;Jl(n,r),n=r.pendingProps;var A=ki(r,mn.current);Li(r,u),A=Ic(null,r,C,n,A,u);var B=jc();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,In(C)?(B=!0,jl(r)):B=!1,r.memoizedState=A.state!==null&&A.state!==void 0?A.state:null,Ec(r),A.updater=Xl,r.stateNode=A,A._reactInternals=r,Hc(r,C,n,u),r=zc(null,r,C,!0,B,u)):(r.tag=0,zt&&B&&gc(r),Ln(null,r,A,u),r=r.child),r;case 16:C=r.elementType;e:{switch(Jl(n,r),n=r.pendingProps,A=C._init,C=A(C._payload),r.type=C,A=r.tag=Cw(C),n=or(C,n),A){case 0:r=$c(null,r,C,n,u);break e;case 1:r=_f(null,r,C,n,u);break e;case 11:r=ff(null,r,C,n,u);break e;case 14:r=pf(null,r,C,or(C.type,n),u);break e}throw Error(s(306,C,""))}return r;case 0:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:or(C,A),$c(n,r,C,A,u);case 1:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:or(C,A),_f(n,r,C,A,u);case 3:e:{if(wf(r),n===null)throw Error(s(387));C=r.pendingProps,B=r.memoizedState,A=B.element,Ih(n,r),$l(r,C,null,u);var V=r.memoizedState;if(C=V.element,B.isDehydrated)if(B={element:C,isDehydrated:!1,cache:V.cache,pendingSuspenseBoundaries:V.pendingSuspenseBoundaries,transitions:V.transitions},r.updateQueue.baseState=B,r.memoizedState=B,r.flags&256){A=Ri(Error(s(423)),r),r=bf(n,r,C,u,A);break e}else if(C!==A){A=Ri(Error(s(424)),r),r=bf(n,r,C,u,A);break e}else for(Hn=is(r.stateNode.containerInfo.firstChild),Fn=r,zt=!0,ir=null,u=Mh(r,null,C,u),r.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Si(),C===A){r=zr(n,r,u);break e}Ln(n,r,C,u)}r=r.child}return r;case 5:return Ph(r),n===null&&wc(r),C=r.type,A=r.pendingProps,B=n!==null?n.memoizedProps:null,V=A.children,uc(C,A)?V=null:B!==null&&uc(C,B)&&(r.flags|=32),vf(n,r),Ln(n,r,V,u),r.child;case 6:return n===null&&wc(r),null;case 13:return yf(n,r,u);case 4:return Tc(r,r.stateNode.containerInfo),C=r.pendingProps,n===null?r.child=Ei(r,null,C,u):Ln(n,r,C,u),r.child;case 11:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:or(C,A),ff(n,r,C,A,u);case 7:return Ln(n,r,r.pendingProps,u),r.child;case 8:return Ln(n,r,r.pendingProps.children,u),r.child;case 12:return Ln(n,r,r.pendingProps.children,u),r.child;case 10:e:{if(C=r.type._context,A=r.pendingProps,B=r.memoizedProps,V=A.value,Ot(Hl,C._currentValue),C._currentValue=V,B!==null)if(un(B.value,V)){if(B.children===A.children&&!An.current){r=zr(n,r,u);break e}}else for(B=r.child,B!==null&&(B.return=r);B!==null;){var J=B.dependencies;if(J!==null){V=B.child;for(var re=J.firstContext;re!==null;){if(re.context===C){if(B.tag===1){re=$r(-1,u&-u),re.tag=2;var he=B.updateQueue;if(he!==null){he=he.shared;var Se=he.pending;Se===null?re.next=re:(re.next=Se.next,Se.next=re),he.pending=re}}B.lanes|=u,re=B.alternate,re!==null&&(re.lanes|=u),xc(B.return,u,r),J.lanes|=u;break}re=re.next}}else if(B.tag===10)V=B.type===r.type?null:B.child;else if(B.tag===18){if(V=B.return,V===null)throw Error(s(341));V.lanes|=u,J=V.alternate,J!==null&&(J.lanes|=u),xc(V,u,r),V=B.sibling}else V=B.child;if(V!==null)V.return=B;else for(V=B;V!==null;){if(V===r){V=null;break}if(B=V.sibling,B!==null){B.return=V.return,V=B;break}V=V.return}B=V}Ln(n,r,A.children,u),r=r.child}return r;case 9:return A=r.type,C=r.pendingProps.children,Li(r,u),A=Gn(A),C=C(A),r.flags|=1,Ln(n,r,C,u),r.child;case 14:return C=r.type,A=or(C,r.pendingProps),A=or(C.type,A),pf(n,r,C,A,u);case 15:return mf(n,r,r.type,r.pendingProps,u);case 17:return C=r.type,A=r.pendingProps,A=r.elementType===C?A:or(C,A),Jl(n,r),r.tag=1,In(C)?(n=!0,jl(r)):n=!1,Li(r,u),of(r,C,A),Hc(r,C,A,u),zc(null,r,C,!0,n,u);case 19:return Cf(n,r,u);case 22:return gf(n,r,u)}throw Error(s(156,r.tag))};function Vf(n,r){return Gr(n,r)}function kw(n,r,u,C){this.tag=n,this.key=u,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 Qn(n,r,u,C){return new kw(n,r,u,C)}function uu(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Cw(n){if(typeof n=="function")return uu(n)?1:0;if(n!=null){if(n=n.$$typeof,n===P)return 11;if(n===$)return 14}return 2}function gs(n,r){var u=n.alternate;return u===null?(u=Qn(n.tag,r,n.key,n.mode),u.elementType=n.elementType,u.type=n.type,u.stateNode=n.stateNode,u.alternate=n,n.alternate=u):(u.pendingProps=r,u.type=n.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=n.flags&14680064,u.childLanes=n.childLanes,u.lanes=n.lanes,u.child=n.child,u.memoizedProps=n.memoizedProps,u.memoizedState=n.memoizedState,u.updateQueue=n.updateQueue,r=n.dependencies,u.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},u.sibling=n.sibling,u.index=n.index,u.ref=n.ref,u}function ca(n,r,u,C,A,B){var V=2;if(C=n,typeof n=="function")uu(n)&&(V=1);else if(typeof n=="string")V=5;else e:switch(n){case R:return Vs(u.children,A,B,r);case x:V=8,A|=8;break;case T:return n=Qn(12,u,r,A|2),n.elementType=T,n.lanes=B,n;case F:return n=Qn(13,u,r,A),n.elementType=F,n.lanes=B,n;case W:return n=Qn(19,u,r,A),n.elementType=W,n.lanes=B,n;case G:return ua(u,A,B,r);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I:V=10;break e;case O:V=9;break e;case P:V=11;break e;case $:V=14;break e;case K:V=16,C=null;break e}throw Error(s(130,n==null?n:typeof n,""))}return r=Qn(V,u,r,A),r.elementType=n,r.type=C,r.lanes=B,r}function Vs(n,r,u,C){return n=Qn(7,n,C,r),n.lanes=u,n}function ua(n,r,u,C){return n=Qn(22,n,C,r),n.elementType=G,n.lanes=u,n.stateNode={isHidden:!1},n}function du(n,r,u){return n=Qn(6,n,null,r),n.lanes=u,n}function hu(n,r,u){return r=Qn(4,n.children!==null?n.children:[],n.key,r),r.lanes=u,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}function xw(n,r,u,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=pt(0),this.expirationTimes=pt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pt(0),this.identifierPrefix=C,this.onRecoverableError=A,this.mutableSourceEagerHydrationData=null}function fu(n,r,u,C,A,B,V,J,re){return n=new xw(n,r,u,J,re),r===1?(r=1,B===!0&&(r|=8)):r=0,B=Qn(3,null,null,r),n.current=B,B.stateNode=n,B.memoizedState={element:C,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ec(B),n}function Sw(n,r,u){var C=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:L,key:C==null?null:""+C,children:n,containerInfo:r,implementation:u}}function Gf(n){if(!n)return ls;n=n._reactInternals;e:{if(Rn(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(In(r.type)){r=r.stateNode.__reactInternalMemoizedMergedChildContext;break e}}r=r.return}while(r!==null);throw Error(s(171))}if(n.tag===1){var u=n.type;if(In(u))return yh(n,u,r)}return r}function Yf(n,r,u,C,A,B,V,J,re){return n=fu(u,C,!0,n,A,B,V,J,re),n.context=Gf(null),u=n.current,C=Nn(),A=ps(u),B=$r(C,A),B.callback=r??null,us(u,B,A),n.current.lanes=A,sn(n,A,C),Pn(n,C),n}function da(n,r,u,C){var A=r.current,B=Nn(),V=ps(A);return u=Gf(u),r.context===null?r.context=u:r.pendingContext=u,r=$r(B,V),r.payload={element:n},C=C===void 0?null:C,C!==null&&(r.callback=C),n=us(A,r,V),n!==null&&(cr(n,A,V,B),Wl(n,A,V)),V}function ha(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 Xf(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var u=n.retryLane;n.retryLane=u!==0&&u<r?u:r}}function pu(n,r){Xf(n,r),(n=n.alternate)&&Xf(n,r)}function Ew(){return null}var Qf=typeof reportError=="function"?reportError:function(n){console.error(n)};function mu(n){this._internalRoot=n}fa.prototype.render=mu.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));da(n,r,null,null)},fa.prototype.unmount=mu.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;zs(function(){da(null,n,null,null)}),r[Br]=null}};function fa(n){this._internalRoot=n}fa.prototype.unstable_scheduleHydration=function(n){if(n){var r=Ar();n={blockedOn:null,target:n,priority:r};for(var u=0;u<En.length&&r!==0&&r<En[u].priority;u++);En.splice(u,0,n),u===0&&qi(n)}};function gu(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function pa(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Jf(){}function Tw(n,r,u,C,A){if(A){if(typeof C=="function"){var B=C;C=function(){var he=ha(V);B.call(he)}}var V=Yf(r,C,n,0,null,!1,!1,"",Jf);return n._reactRootContainer=V,n[Br]=V.current,go(n.nodeType===8?n.parentNode:n),zs(),V}for(;A=n.lastChild;)n.removeChild(A);if(typeof C=="function"){var J=C;C=function(){var he=ha(re);J.call(he)}}var re=fu(n,0,!1,null,null,!1,!1,"",Jf);return n._reactRootContainer=re,n[Br]=re.current,go(n.nodeType===8?n.parentNode:n),zs(function(){da(r,re,u,C)}),re}function ma(n,r,u,C,A){var B=u._reactRootContainer;if(B){var V=B;if(typeof A=="function"){var J=A;A=function(){var re=ha(V);J.call(re)}}da(r,V,n,A)}else V=Tw(u,r,n,A,C);return ha(V)}nl=function(n){switch(n.tag){case 3:var r=n.stateNode;if(r.current.memoizedState.isDehydrated){var u=xn(r.pendingLanes);u!==0&&(rr(r,u|1),Pn(r,At()),(St&6)===0&&(Ii=At()+500,as()))}break;case 13:zs(function(){var C=Wr(n,1);if(C!==null){var A=Nn();cr(C,n,1,A)}}),pu(n,1)}},Es=function(n){if(n.tag===13){var r=Wr(n,134217728);if(r!==null){var u=Nn();cr(r,n,134217728,u)}pu(n,134217728)}},ni=function(n){if(n.tag===13){var r=ps(n),u=Wr(n,r);if(u!==null){var C=Nn();cr(u,n,r,C)}pu(n,r)}},Ar=function(){return kt},Ir=function(n,r){var u=kt;try{return kt=n,r()}finally{kt=u}},fe=function(n,r,u){switch(r){case"input":if(Ie(n,u),r=u.name,u.type==="radio"&&r!=null){for(u=n;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+r)+'][type="radio"]'),r=0;r<u.length;r++){var C=u[r];if(C!==n&&C.form===n.form){var A=Al(C);if(!A)throw Error(s(90));me(C),Ie(C,A)}}}break;case"textarea":nt(n,u);break;case"select":r=u.value,r!=null&&je(n,!!u.multiple,r,!1)}},we=lu,Ue=zs;var Lw={usingClientEntryPoint:!1,Events:[wo,bi,Al,ke,gt,lu]},Io={findFiberByHostInstance:Ps,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nw={bundleType:Io.bundleType,version:Io.version,rendererPackageName:Io.rendererPackageName,rendererConfig:Io.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=ei(n),n===null?null:n.stateNode},findFiberByHostInstance:Io.findFiberByHostInstance||Ew,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 ga=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ga.isDisabled&&ga.supportsFiber)try{nr=ga.inject(Nw),Cn=ga}catch{}}return On.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Lw,On.createPortal=function(n,r){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gu(r))throw Error(s(200));return Sw(n,r,null,u)},On.createRoot=function(n,r){if(!gu(n))throw Error(s(299));var u=!1,C="",A=Qf;return r!=null&&(r.unstable_strictMode===!0&&(u=!0),r.identifierPrefix!==void 0&&(C=r.identifierPrefix),r.onRecoverableError!==void 0&&(A=r.onRecoverableError)),r=fu(n,1,!1,null,null,u,!1,C,A),n[Br]=r.current,go(n.nodeType===8?n.parentNode:n),new mu(r)},On.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=ei(r),n=n===null?null:n.stateNode,n},On.flushSync=function(n){return zs(n)},On.hydrate=function(n,r,u){if(!pa(r))throw Error(s(200));return ma(null,n,r,!0,u)},On.hydrateRoot=function(n,r,u){if(!gu(n))throw Error(s(405));var C=u!=null&&u.hydratedSources||null,A=!1,B="",V=Qf;if(u!=null&&(u.unstable_strictMode===!0&&(A=!0),u.identifierPrefix!==void 0&&(B=u.identifierPrefix),u.onRecoverableError!==void 0&&(V=u.onRecoverableError)),r=Yf(r,null,n,1,u??null,A,!1,B,V),n[Br]=r.current,go(n),C)for(n=0;n<C.length;n++)u=C[n],A=u._getVersion,A=A(u._source),r.mutableSourceEagerHydrationData==null?r.mutableSourceEagerHydrationData=[u,A]:r.mutableSourceEagerHydrationData.push(u,A);return new fa(r)},On.render=function(n,r,u){if(!pa(r))throw Error(s(200));return ma(null,n,r,!1,u)},On.unmountComponentAtNode=function(n){if(!pa(n))throw Error(s(40));return n._reactRootContainer?(zs(function(){ma(null,null,n,!1,function(){n._reactRootContainer=null,n[Br]=null})}),!0):!1},On.unstable_batchedUpdates=lu,On.unstable_renderSubtreeIntoContainer=function(n,r,u,C){if(!pa(u))throw Error(s(200));if(n==null||n._reactInternals===void 0)throw Error(s(38));return ma(n,r,u,!1,C)},On.version="18.3.1-next-f1338f8080-20240426",On}var op;function kg(){if(op)return wu.exports;op=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(),wu.exports=Fw(),wu.exports}var lp;function Hw(){if(lp)return va;lp=1;var t=kg();return va.createRoot=t.createRoot,va.hydrateRoot=t.hydrateRoot,va}var Uw=Hw(),N=jd();const Ww=Iw(N);function Te(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function Oe(t){return typeof t=="string"?t:null}function ae(t){return typeof t=="string"&&t.length>0?t:null}function bt(t){return typeof t=="boolean"?t:null}function Re(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function $w(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:null}function Qt(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 Rt(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const c=e(l);if(c===null)return null;s.push(c)}return s}function Gt(t,e){if(!Array.isArray(t))return null;const s=[];for(const l of t){const c=e(l);c!==null&&s.push(c)}return s}function Xe(t,e){return typeof t=="string"&&e.includes(t)?t:null}function zw(t){try{return JSON.parse(t)}catch{return}}const qw=["auto","default","acceptEdits","plan"];function Xs(t){return typeof t=="string"&&qw.includes(t)}const Kw={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:[],noteCliDraft:["label"],noteCliNotStarted:[],noteEmpty:[],noteExists:[],noteGone:[],noteIdInvalid:[],noteImageFailed:[],noteImagesMax:["max"],noteImagesUnsupported:[],noteInterrupted:[],noteNoAgent:[],noteNoReadySignal:[],noteSaveFailed:[],noteTooLong:["max"],notesMax:["max"],openToolSubmit:["label"],submitUnknownActivity:["label"],submitStartupPending:["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"],scheduledCliDraft:[],scheduledCliNotReady:[],scheduledCliOpenFailed:[],scheduledElsewhereTimeout:[],scheduledMissed:[],scheduledNoTab:[],scheduledUncertain:[],scheduledUncertainWrite:[],scheduledUnconfirmed:[],scheduledWaitAnswer:[],scheduledWaitBusy:[],scheduledWaitElsewhere:[],scheduledWaitGrace:[],scheduledWaitNoTab:[],scheduledWaitOtherInstance:[],searchFailed:[],settingsFailed:[],settingsHostOnly:[],settingsShellMissing:[],shellNotFound:[],submitCliDraft:["label"],submitCliDraftCommand:["label"],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"],worktreeMoveBusy:[],worktreeMoveCliCheckFailed:["cli","detail"],worktreeMoveCliFailed:["branch","cli","detail"],worktreeMoveCliUnsupported:["cli"],worktreeMovePending:[],worktreeMoveUnavailable:[],worktreeMoveWaiting:[],worktreeNoConflicts:[],worktreeNoReview:[],worktreeNotRepo:[],worktreeNotesConflict:["count"],worktreeNotesFailed:["detail"],worktreeNothingToCommit:[],worktreeNothingToIntegrate:[],worktreeNothingToReview:[],worktreeProjectUnknown:[],worktreeReviewUnread:[],worktreeUncommitted:["count"],worktreeUnknown:[],worktreeUntrackedChanged:[],worktreeUpToDate:["base"]};function Vw(t){return Object.prototype.hasOwnProperty.call(Kw,t)}function dr(t,e=0){const s=Te(t);if(s===null)return null;const l=Oe(s.key);if(l===null||l.length===0)return null;const c=s.params;if(c===void 0)return{key:l};const y=Te(c);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 f=e===0?dr(a,e+1):null;if(f===null)return null;b[i]=f}return{key:l,params:b}}function Gw(t){if(!Array.isArray(t))return null;const e=[];for(const s of t){const l=dr(s);if(l===null)return null;e.push(l)}return e}const Er=["claude-code","codex","opencode","antigravity","pi"],ku=6e3,Yw=["gemini-cli","antigravity-ide"],Wa=[...Er,...Yw],Xw={"gemini-cli":"Gemini CLI","antigravity-ide":"Antigravity IDE"};function Ui(t){return Er.includes(t)}const Qw=["at-quoted","bare-path-paste","quoted-path-line"],Jw=["at"],Zw=["usage-with-variants","token-count","usage-with-catalog","status-line"],eb=["child-session-marker"],tb=["active","missing","other-command","disabled","unreadable"],nb=["cli","tools"];function Cg(t,e=null){return!t.statusSource||e==="unknown"}const xg={sessionIdAtLaunch:!1,resume:!1,statusSource:!1,readySignal:!1,permissionCycle:null,codexPermissions:!1,models:null,efforts:null,questionCards:!1,imagesByPath:null,fileMentions:null,rewind:!1,contextWindowSource:null,plans:!1,waitingBlocksSubmit:!1,forceSend:!1,editQueue:!1,scheduledSend:!1,codexNativeQueue:!1,moveToWorktree:!1,readOnlyLaunch:null};function rb(t,e){var c;const s=t.permissionCycle;if(s===null)return null;const l=e?((c=t.readOnlyLaunch)==null?void 0:c.mode)??null:null;return l!==null&&s.modes.includes(l)?l:s.launchMode}function Dd(t){return t.filter(e=>e.available).length>1}function sb(t){const e=Te(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(!Xs(b))return null;l.push(b)}const c=e.launchMode;if(!Xs(c)||!l.includes(c))return null;const y=ae(e.keyLabel);return y===null?null:{modes:l,launchMode:c,keyLabel:y,approvesPendingOnCycle:e.approvesPendingOnCycle===!0}}function ib(t){const e=Te(t);if(e===null)return null;const s=Xe(e.guard,nb),l=e.mode;return s===null||l!==null&&!Xs(l)?null:{mode:l===null?null:l,guard:s}}function ap(t){const e=Te(t);if(e===null)return null;const s=Xe(e.state,tb),l=ae(e.settingsPath),c=ae(e.scriptPath),y=e.fragment,b=y===null?null:ae(y);return s===null||l===null||c===null||y!==null&&b===null?null:{state:s,settingsPath:l,scriptPath:c,fragment:b}}function ob(t){const e=Te(t);if(e===null)return null;const s=ae(e.value),l=Oe(e.label),c=Oe(e.family),y=bt(e.long),b=e.window,i=b===null?null:Re(b);if(s===null||l===null||c===null||y===null||b!==null&&i===null)return null;const a=Rt(e.supportedEfforts,ae),f=e.defaultEffort===null?null:ae(e.defaultEffort);return{value:s,label:l,family:c,long:y,window:i,...a===null?{}:{supportedEfforts:a},...typeof e.isDefault=="boolean"?{isDefault:e.isDefault}:{},...f!==null||e.defaultEffort===null?{defaultEffort:f}:{}}}function lb(t){const e=Te(t);if(e===null)return null;const s=ae(e.value),l=Oe(e.label);return s===null||l===null?null:{value:s,label:l}}function cp(t,e){const s=Rt(t,e);return s===null||s.length===0?null:s}function ab(t){const e=Te(t);return e===null?{...xg}:{sessionIdAtLaunch:e.sessionIdAtLaunch===!0,resume:e.resume===!0,statusSource:e.statusSource===!0,readySignal:e.readySignal===!0,permissionCycle:sb(e.permissionCycle),codexPermissions:e.codexPermissions===!0,models:cp(e.models,ob),efforts:cp(e.efforts,lb),questionCards:e.questionCards===!0,imagesByPath:Xe(e.imagesByPath,Qw),fileMentions:Xe(e.fileMentions,Jw),rewind:e.rewind===!0,contextWindowSource:Xe(e.contextWindowSource,Zw),plans:e.plans===!0,waitingBlocksSubmit:e.waitingBlocksSubmit===!0,forceSend:e.forceSend===!0,editQueue:e.editQueue===!0,scheduledSend:e.scheduledSend===!0,codexNativeQueue:e.codexNativeQueue===!0,moveToWorktree:e.moveToWorktree===!0,readOnlyLaunch:ib(e.readOnlyLaunch)}}function up(t){const e=Te(t);if(e===null)return null;const s=Xe(e.id,Er),l=Oe(e.label),c=Oe(e.command),y=Oe(e.installUrl);return s===null||l===null||c===null||y===null?null:{id:s,label:l,command:c,available:e.available===!0,version:Oe(e.version),installUrl:y,missingMessage:dr(e.missingMessage),capabilities:ab(e.capabilities),environmentNotice:Xe(e.environmentNotice,eb),statusLine:ap(e.statusLine),planLimitsSetup:ap(e.planLimitsSetup)}}const cb=["staged","unstaged","untracked","conflict"],Sg=["added","modified","deleted","renamed","copied","type-changed","untracked","conflict"],ub=["ready","not-a-repo","git-missing","error"],_a={state:"not-a-repo",message:null,repoRoot:"",branch:null,head:null,upstream:null,ahead:0,behind:0,changes:[],worktrees:[],truncated:!1,updatedAt:0},db=["meta","hunk","context","added","removed"];function hb(t){const e=Te(t);if(e===null)return null;const s=ae(e.path),l=Xe(e.kind,Sg),c=Xe(e.stage,cb);return s===null||l===null||c===null?null:{path:s,kind:l,stage:c,oldPath:Oe(e.oldPath)}}function fb(t){const e=Te(t);if(e===null)return null;const s=ae(e.path);return s===null?null:{path:s,branch:Oe(e.branch),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0}}function pb(t){const e=Te(t);if(e===null)return null;const s=Xe(e.state,ub),l=Oe(e.repoRoot),c=Re(e.ahead),y=Re(e.behind),b=Rt(e.changes,hb),i=Rt(e.worktrees,fb),a=Re(e.updatedAt);return s===null||l===null||c===null||y===null||b===null||i===null||a===null?null:{state:s,message:dr(e.message),repoRoot:l,branch:Oe(e.branch),head:Oe(e.head),upstream:Oe(e.upstream),ahead:c,behind:y,changes:b,worktrees:i,truncated:e.truncated===!0,updatedAt:a}}function mb(t){const e=Te(t);if(e===null)return null;const s=Xe(e.kind,db),l=Oe(e.text);return s===null||l===null?null:{kind:s,text:l,oldLine:Re(e.oldLine),newLine:Re(e.newLine)}}function dp(t){const e=Te(t);if(e===null)return null;const s=ae(e.path),l=bt(e.staged),c=Rt(e.lines,mb);return s===null||l===null||c===null?null:{path:s,staged:l,lines:c,truncated:e.truncated===!0,binary:e.binary===!0,message:dr(e.message)}}const gb=100,vb=/^[A-Za-z0-9._/-]+$/,_b=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i;function wb(t){if(t.length===0)return"empty";if(t.length>gb)return"too-long";if(!vb.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=Eg(t).split(".")[0]??"";return _b.test(s)?"reserved":null}function Eg(t){return t.split("/").join("-")}function bb(t,e){return t==="busy"?"busy":t==="waiting"?"waiting":e?"pending":null}const yb=8,kb=["nested-repo","too-many","copied"],Cb=2e4,xb=["clean","conflicts"],Sb=["ready","changes","none"],Eb=["working","pending","done"],Tb=["nothing","behind","no-base-folder","local-changes"],Lb=["not-integrated","checked-out"];function Nb(t,e){const s=b=>b==="cli"?0:b==="tools"?1:2,l=e.filter(b=>b.id!==t),c=l.length>0?l:e;let y=null;for(const b of c)(y===null||s(b.guard)<s(y.guard))&&(y=b);return(y==null?void 0:y.id)??null}function Rb(t){return typeof t=="string"&&/^[0-9a-f]{40}(?:[0-9a-f]{24})?$/.test(t)?t:null}function Mb(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)?t:null}function Ab(t){const e=Te(t);if(e===null)return null;const s=Re(e.files),l=Re(e.bytes);if(s===null||l===null)return null;if(e.blocked!==null&&e.blocked!==void 0){const y=Xe(e.blocked,kb);return y===null?null:{files:s,bytes:l,stamp:null,blocked:y}}const c=Mb(e.stamp);return c===null?null:{files:s,bytes:l,stamp:c,blocked:null}}function Ib(t){const e=Te(t);if(e===null)return null;const s=ae(e.mainCwd),l=bt(e.linked);return s===null||l===null?null:{mainCwd:s,branch:ae(e.branch),linked:l}}function jb(t){const e=Te(t);if(e===null)return null;const s=ae(e.branch),l=bt(e.exists);return s===null||l===null?null:{branch:s,exists:l,reopenable:e.reopenable===!0}}function hp(t){const e=Te(t);if(e===null)return null;const s=Re(e.files),l=Re(e.bytes),c=Qt(e.sample);return s===null||l===null||c===null?null:{files:s,bytes:l,overCap:e.overCap===!0,sample:c}}function Db(t){const e=Te(t);if(e===null)return null;const s=ae(e.name);return s===null?null:{name:s,checkedOut:e.checkedOut===!0}}function Pb(t){const e=Te(t);if(e===null)return null;const s=ae(e.mainRoot),l=ae(e.parentDir),c=ae(e.separator),y=Rt(e.branches,Db),b=Re(e.mainChanges),i=hp(e.notes),a=e.include===null?null:hp(e.include);return s===null||l===null||c===null||y===null||b===null||i===null||e.include!==null&&a===null?null:{mainRoot:s,parentDir:l,separator:c,currentBranch:ae(e.currentBranch),branches:y,mainChanges:b,sourceChanges:Re(e.sourceChanges),include:a,notes:i}}function Ob(t){const e=Te(t);if(e===null)return null;const s=ae(e.path);if(s===null)return null;const l=e.integrated;return{id:ae(e.id),path:s,branch:ae(e.branch),base:ae(e.base),isCurrent:e.isCurrent===!0,isMain:e.isMain===!0,changes:Re(e.changes),ahead:Re(e.ahead),integrated:typeof l=="boolean"?l:null,behind:Re(e.behind),merge:Bb(e.merge),overlaps:Gt(e.overlaps,Fb)??[],review:Tg(e.review)}}function Pd(t){const e=Qt(t.files),s=Re(t.fileCount);return e===null||s===null?null:{files:e,fileCount:s}}function Bb(t){const e=Te(t);if(e===null)return null;const s=Xe(e.state,xb),l=Pd(e);return s===null||l===null?null:{state:s,...l}}function Fb(t){const e=Te(t);if(e===null)return null;const s=ae(e.branch),l=Pd(e);return s===null||l===null?null:{branch:s,...l}}function Tg(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Er),l=Xe(e.state,Eb),c=Re(e.requestedAt);return s===null||l===null||c===null?null:{agent:s,state:l,verdict:l==="done"?Xe(e.verdict,Sb)??"none":null,stale:e.stale===!0,requestedAt:c,terminalId:ae(e.terminalId)}}function Hb(t){const e=Te(t);if(e===null)return null;const s=ae(e.sha),l=Oe(e.subject),c=Re(e.at);return s===null||l===null||c===null?null:{sha:s,subject:l,at:c}}function Ub(t){const e=Te(t);if(e===null)return null;const s=ae(e.path),l=Xe(e.kind,Sg);return s===null||l===null?null:{path:s,oldPath:ae(e.oldPath),kind:l}}function Wb(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.base),y=Rt(e.commits,Hb),b=Re(e.commitCount),i=Rt(e.files,Ub),a=Re(e.fileCount),f=Re(e.uncommitted);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null?null:{id:s,branch:l,base:c,commits:y,commitCount:b,files:i,fileCount:a,uncommitted:f}}function $b(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.base),y=ae(e.prompt),b=Re(e.ahead),i=Re(e.uncommitted),a=bt(e.branchBusy);return s===null||l===null||c===null||y===null||b===null||i===null||a===null?null:{id:s,branch:l,base:c,author:Xe(e.author,Er),prompt:y,ahead:b,uncommitted:i,branchBusy:a}}function zb(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.base),y=Re(e.ahead),b=Re(e.behind),i=Pd(e),a=Rt(e.tabs,Lg),f=Qt(e.localConflicts),_=Re(e.branchUncommitted),d=e.blocker,k=d===null?null:Xe(d,Tb);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null||_===null||d!==null&&k===null?null:{id:s,branch:l,base:c,baseFolder:ae(e.baseFolder),command:ae(e.command),branchCommit:Rb(e.branchCommit),ahead:y,behind:b,...i,review:Tg(e.review),tabs:a,localConflicts:f,branchUncommitted:_,blocker:k,notes:qb(e.notes)}}function qb(t){const e=Te(t);if(e===null)return null;const s=Qt(e.returning),l=Qt(e.conflicts);return s===null||l===null?null:{returning:s,merging:Qt(e.merging)??[],resolved:Qt(e.resolved)??[],conflicts:l}}function Kb(t){const e=Te(t);if(e===null)return null;const s=Re(e.commits),l=ae(e.base);if(s===null||l===null)return null;const c=Te(e.notes),y=Re(c==null?void 0:c.returned),b=Qt(c==null?void 0:c.stayed);return y===null||b===null?{commits:s,base:l}:{commits:s,base:l,notes:{returned:y,stayed:b}}}function Vb(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.base);return s===null||l===null||c===null?null:{id:s,branch:l,base:c,ahead:Re(e.ahead)}}function Gb(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.base),y=ae(e.folder),b=ae(e.command),i=e.blocker,a=i===null?null:Xe(i,Lb);return s===null||l===null||c===null||y===null||b===null||i!==null&&a===null?null:{id:s,branch:l,base:c,folder:y,command:b,ahead:Re(e.ahead),blocker:a}}const Yb=["agent","shell"];function Lg(t){const e=Te(t);if(e===null)return null;const s=ae(e.terminalId),l=Xe(e.kind,Yb),c=Oe(e.label);return s===null||l===null||c===null?null:{terminalId:s,kind:l,label:c}}const fp=255;function Xb(t){var y;const e=Te(t);if(e===null)return null;const s=$w(e.pid),l=ae(e.name);if(s===null||l===null||l.length>fp)return null;const c=((y=Oe(e.description))==null?void 0:y.trim())??"";return{pid:s,name:l,description:c.length>0&&c.length<=fp?c:null}}function Qb(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=ae(e.branch),c=ae(e.path),y=Qt(e.commands),b=Qt(e.uncommitted),i=Re(e.uncommittedCount),a=Rt(e.tabs,Lg),f=Qt(e.returning),_=Qt(e.conflicts),d=bt(e.deletesBranch);if(s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null||_===null||d===null)return null;const k=typeof e.inUse=="boolean"?e.inUse:null;return{id:s,branch:l,path:c,commands:y,uncommitted:b,uncommittedCount:i,untracked:i>0?Ab(e.untracked):null,tabs:a,returning:f,merging:(Qt(e.merging)??[]).filter(E=>f.includes(E)),resolved:Qt(e.resolved)??[],conflicts:_,inUse:k,holders:k===!0?(Gt(e.holders,Xb)??[]).slice(0,yb):[],deletesBranch:d,branchUnused:d&&e.branchUnused===!0,createdBranch:e.createdBranch!==!1}}function Jb(t){const e=Te(t);if(e===null)return null;const s=bt(e.branchDeleted),l=Re(e.returned),c=Re(e.discarded);return s===null||l===null||c===null?null:{branchDeleted:s,returned:l,discarded:c,discardedFiles:Re(e.discardedFiles)??0}}const Zb=["custom","ai","first-message","none"],e0=["native","vault"],t0=["idle","scanning","ready"],n0=["agent","shell"],r0=["busy","idle","waiting","offline","unknown"],s0=["server-closed"];function i0(t){const e=Te(t);if(e===null)return null;const s=ae(e.sessionId),l=Oe(e.title),c=Xe(e.titleSource,Zb),y=Re(e.updatedAt),b=Re(e.sizeBytes);if(s===null||l===null||c===null||y===null||b===null)return null;const i=e.agent===void 0?"claude-code":Xe(e.agent,Wa);if(i===null)return null;const a=Oe(e.cwd)??"";return{agent:i,sessionId:s,cwd:a,title:l,titleSource:c,updatedAt:y,sizeBytes:b,archived:e.archived===!0,storage:Xe(e.storage,e0)??"native",partial:e.partial===!0,worktree:jb(e.worktree)}}function o0(t){const e=Te(t);if(e===null)return null;const s=Oe(e.cwd),l=bt(e.cwdExists),c=Gt(e.sessions,i0),y=Re(e.lastActivityAt);if(s===null||l===null||c===null||y===null)return null;const b=ae(e.key);if(b!==null)return{key:b,fallbackName:Oe(e.fallbackName)??"",cwd:s,cwdExists:l,isGitRepo:e.isGitRepo===!0,sessions:c,lastActivityAt:y};const i=ae(e.slug);return i===null?null:{key:i,fallbackName:s.length===0?i:"",cwd:s,cwdExists:l,isGitRepo:!1,sessions:c,lastActivityAt:y}}function l0(t){const e=Te(t);if(e===null)return null;const s=Xe(e.state,t0),l=Re(e.scannedFiles),c=Re(e.totalFiles);return s===null||l===null||c===null?null:{state:s,scannedFiles:l,totalFiles:c}}function Cu(t){const e=Te(t);if(e===null)return null;const s=ae(e.terminalId),l=Xe(e.kind,n0)??"agent";let c=null;if(l==="agent"&&(c=e.agent===void 0?"claude-code":Xe(e.agent,Er),c===null))return null;const y=Oe(e.cwd),b=Oe(e.sessionId),i=Oe(e.label),a=bt(e.resumed),f=Re(e.createdAt),_=bt(e.alive);if(s===null||y===null||b===null||i===null||a===null||f===null||_===null)return null;const d=e.exitCode;return{terminalId:s,kind:l,agent:c,cwd:y,sessionId:b,label:i,resumed:a,createdAt:f,alive:_,exitCode:typeof d=="number"?d:null,sleeping:e.sleeping===!0,launchedAt:Re(e.launchedAt),worktree:Ib(e.worktree),review:l==="agent"&&e.review===!0}}const Ng=["user","assistant"];function wa(t){return t.replace(/[`*_]/g,"").replace(/\s+/g," ").trim().toLowerCase()}function a0(t,e){return wa(t.question)===wa(e.question)&&t.multiSelect===e.multiSelect&&(t.allowWriteIn??!0)===(e.allowWriteIn??!0)&&t.options.length===e.options.length&&t.options.every((s,l)=>{var b;const c=wa(s.label),y=wa(((b=e.options[l])==null?void 0:b.label)??"");return c.length>0&&y.length>0&&(c.startsWith(y)||y.startsWith(c))})}function c0(t,e){return t>0&&e!==null&&t<e}const Rg=["content","attachment","pasted"],u0=["compacted","interrupted","error"],d0=["cli-plans","project","scratch","reference"],h0=120,f0=20,p0=20,pp=4e3,xu={lastRequestTokens:0,lastOutputTokens:0,lastModel:null,contextWindow:null,contextWindowEstimated:!1,totalInputTokens:0,totalOutputTokens:0,totalCacheReadTokens:0,assistantMessages:0},mp=["waiting","live","unavailable","no-transcript"];function m0(t){const e=Te(t);if(e===null)return null;const s=Re(e.inputTokens),l=Re(e.outputTokens),c=Re(e.cacheCreationInputTokens),y=Re(e.cacheReadInputTokens);return s===null||l===null||c===null||y===null?null:{inputTokens:s,outputTokens:l,cacheCreationInputTokens:c,cacheReadInputTokens:y}}function g0(t){const e=Te(t);if(e===null)return null;const s=ae(e.label);return s===null?null:{label:s,description:Oe(e.description)??""}}function v0(t){const e=Te(t);if(e===null)return null;const s=ae(e.question),l=Rt(e.options,g0);return s===null||l===null||l.length===0?null:{question:s,header:Oe(e.header)??"",multiSelect:e.multiSelect===!0,...e.allowWriteIn===!1?{allowWriteIn:!1}:{},options:l}}function Od(t){const e=Te(t);if(e===null)return null;switch(e.kind){case"text":{const s=Oe(e.text),l=bt(e.truncated);return s===null||l===null?null:{kind:"text",text:s,truncated:l}}case"tool-call":{const s=Oe(e.toolUseId),l=Oe(e.name),c=Oe(e.input),y=bt(e.truncated);return s===null||l===null||c===null||y===null?null:{kind:"tool-call",toolUseId:s,name:l,input:c,truncated:y}}case"tool-result":{const s=Oe(e.toolUseId),l=Oe(e.text),c=bt(e.isError),y=bt(e.truncated),b=Re(e.imageCount);return s===null||l===null||c===null||y===null||b===null?null:{kind:"tool-result",toolUseId:s,text:l,isError:c,truncated:y,imageCount:b}}case"thinking":return{kind:"thinking"};case"question":{const s=ae(e.toolUseId),l=Rt(e.questions,v0);return s===null||l===null||l.length===0?null:{kind:"question",toolUseId:s,questions:l}}case"image":{const s=Re(e.index),l=Oe(e.mediaType);if(s===null||l===null)return null;const c=Xe(e.source,Rg)??"content";return{kind:"image",index:s,mediaType:l,source:c}}case"notice":{const s=Xe(e.notice,u0);return s===null?null:{kind:"notice",notice:s,detail:Oe(e.detail)??""}}default:return null}}function Su(t){const e=Te(t);if(e===null)return null;const s=ae(e.eventId),l=Xe(e.role,Ng),c=Re(e.at),y=Rt(e.parts,Od);return s===null||l===null||c===null||y===null?null:{eventId:s,role:l,at:c,parts:y,model:Oe(e.model),usage:m0(e.usage),effort:Oe(e.effort),durationMs:Re(e.durationMs),queued:e.queued===!0}}function _0(t){const e=Te(t);if(e===null)return null;const s=ae(e.toolUseId),l=Oe(e.description),c=Re(e.startedAt);return s===null||l===null||c===null?null:{toolUseId:s,description:l.slice(0,h0),background:e.background===!0,startedAt:c}}function w0(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=Oe(e.text),c=Re(e.images),y=Re(e.at);if(s===null||l===null||c===null||y===null)return null;const b={id:s,text:l.slice(0,pp),truncated:e.truncated===!0||l.length>pp,images:Math.max(0,Math.floor(c)),at:y},i=ae(e.eventId);return i!==null&&(b.eventId=i),e.forced===!0&&(b.forced=!0),e.sent===!0&&(b.sent=!0,e.editable===!0&&(b.editable=!0)),b}function gp(t){const e=Te(t);if(e===null)return null;const s=Re(e.lastRequestTokens),l=Re(e.lastOutputTokens),c=Re(e.totalInputTokens),y=Re(e.totalOutputTokens),b=Re(e.totalCacheReadTokens),i=Re(e.assistantMessages);if(s===null||l===null||c===null||y===null||b===null||i===null)return null;const a=Oe(e.lastEffort);return{lastRequestTokens:s,lastOutputTokens:l,lastModel:Oe(e.lastModel),contextWindow:Re(e.contextWindow),contextWindowEstimated:e.contextWindowEstimated===!0,totalInputTokens:c,totalOutputTokens:y,totalCacheReadTokens:b,assistantMessages:i,...a!==null?{lastEffort:a}:{},...e.compacted===!0?{compacted:!0}:{}}}function b0(t){const e=Te(t);if(e===null)return null;const s=ae(e.fileName),l=ae(e.title),c=Re(e.modifiedAt),y=Re(e.sizeBytes);if(s===null||l===null||c===null||y===null)return null;const b=e.origin,i=d0.find(f=>f===b)??"cli-plans",a=Oe(e.path)??"";return{fileName:s,title:l,origin:i,path:a,absolutePath:Oe(e.absolutePath)??"",exists:e.exists===!0,modifiedAt:c,sizeBytes:y}}function y0(t){const e=Te(t);if(e===null)return null;const s=ae(e.fileName),l=Oe(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 k0(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 C0(t,e=Mg){const s=x0(t,e);if(s===null||t===null)return null;const l=t.includes("[1m]");return e.find(c=>c.family===s&&c.long===l)??null}function x0(t,e=Mg){var l;return t===null||t.length===0?null:((l=e.filter(c=>c.family.length>0).sort((c,y)=>y.family.length-c.family.length).find(c=>t.includes(c.family)))==null?void 0:l.family)??null}function S0(t){return`/model ${t}`}const Bd="/effort";function E0(t,e=Bd){return`${e} ${t}`}const T0=["ask-for-approval","automatic","read-only","full-access"],L0=["written","blocked","failed"],N0=["unsupported","gone","review","busy","waiting","tool-pending","not-ready","failed"];function vp(t){const e=Te(t);if(e===null)return null;const s=b=>{const i=Oe(b);return i!==null&&i.length<=128?i:null};if("profileId"in e||"approvalPolicy"in e||"reviewer"in e||"fileSystem"in e||"network"in e)return{profileId:s(e.profileId),approvalPolicy:s(e.approvalPolicy),reviewer:s(e.reviewer),fileSystem:s(e.fileSystem),network:s(e.network)};const l=Te(e.active_permission_profile),c=Te(e.permission_profile),y=Te(c==null?void 0:c.file_system);return{profileId:s(l==null?void 0:l.id),approvalPolicy:s(e.approval_policy),reviewer:s(e.approvals_reviewer),fileSystem:s(y==null?void 0:y.type),network:s(c==null?void 0:c.network)}}function R0(t){return typeof t=="string"&&T0.includes(t)}function id(t){return t===null?null:t.profileId===":workspace"&&t.approvalPolicy==="on-request"&&t.reviewer==="user"?"ask-for-approval":t.profileId===":workspace"&&t.approvalPolicy==="on-request"&&t.reviewer==="auto_review"?"automatic":t.reviewer!=="user"?null:t.profileId===":read-only"&&t.approvalPolicy==="on-request"?"read-only":t.profileId===":danger-full-access"&&t.approvalPolicy==="never"?"full-access":null}const M0=["dir","file"],A0=["ignored","always"];function I0(t){return typeof t=="string"&&/^[0-9a-f]{64}$/.test(t)}function Ag(t){const e=Te(t);if(e===null)return null;const s=ae(e.name),l=ae(e.path),c=Xe(e.kind,M0),y=Re(e.sizeBytes),b=Re(e.modifiedAt);if(s===null||l===null||c===null||y===null||b===null)return null;const i=Xe(e.hidden,A0),a={name:s,path:l,kind:c,sizeBytes:y,modifiedAt:b};return i===null?a:{...a,hidden:i}}function j0(t){const e=Te(t);if(e===null)return null;const s=Oe(e.query),l=Rt(e.entries,Ag);return s===null||l===null?null:{query:s,entries:l,truncated:e.truncated===!0}}function D0(t){const e=Te(t);if(e===null)return null;const s=Oe(e.path),l=Rt(e.entries,Ag),c=Re(e.hiddenCount);return s===null||l===null||c===null?null:{path:s,entries:l,truncated:e.truncated===!0,hiddenCount:c}}function _p(t){const e=Te(t);if(e===null)return null;const s=ae(e.path),l=Oe(e.text),c=Re(e.sizeBytes),y=bt(e.binary);if(s===null||l===null||c===null||y===null)return null;const b={path:s,language:Oe(e.language),text:l,sizeBytes:c,truncated:e.truncated===!0,binary:y},i=e.hash;return e.editable===!0&&I0(i)?{...b,editable:!0,hash:i}:b}function P0(t){const e=Te(t);if(e===null)return null;const s=ae(e.pickerId),l=ae(e.path),c=Rt(e.entries,b=>ae(b)),y=Rt(e.roots,b=>ae(b));return s===null||l===null||c===null||y===null?null:{pickerId:s,path:l,entries:c,roots:y,canGoUp:e.canGoUp===!0,truncated:e.truncated===!0}}const Ig=1e6,O0=100,B0=999999;function jg(t){return t.pasted.reduce((e,s)=>e+s.text.length,t.text.length)}function Ma(t){return t.text.trim().length===0&&t.pasted.every(e=>e.text.trim().length===0)}function Dg(t,e){return t.text!==e.text||t.pasted.length!==e.pasted.length?!1:t.pasted.every((s,l)=>{const c=e.pasted[l];return c!==void 0&&c.number===s.number&&c.text===s.text})}function F0(t){const e=Te(t);if(e===null)return null;const s=e.number,l=Oe(e.text);return typeof s!="number"||!Number.isInteger(s)||s<1||s>B0||l===null?null:{number:s,text:l}}function H0(t){const e=Te(t);if(e===null)return null;const s=Oe(e.text),l=Rt(e.pasted,F0);return s===null||l===null||l.length>O0||new Set(l.map(c=>c.number)).size!==l.length?null:{text:s,pasted:l}}const od=720*60*60*1e3,U0=["scheduled","waiting","sending","paused","failed"];function W0(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=Xe(e.agent,Er),c=ae(e.sessionId),y=e.terminalId,b=y===null?null:ae(y),i=Oe(e.text),a=Re(e.sendAt),f=Re(e.createdAt),_=Xe(e.state,U0),d=e.note,k=d==null?null:dr(d);return s===null||l===null||c===null||i===null||a===null||f===null||_===null||y!==null&&b===null||d!=null&&k===null?null:{id:s,agent:l,sessionId:c,terminalId:b,text:i,sendAt:a,createdAt:f,state:_,note:k}}const Aa="MEMORY.md",Fd=["AGENTS.md","CLAUDE.md"],Pg=["claude-code","codex","antigravity","opencode","pi"],$0=["outside","encoding"],z0=["create","append-block","replace-block","append-lines","copy"];function q0(t){return{instructionFiles:[...Fd],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 K0(t){const e=Te(t);if(e===null)return null;const s=Xe(e.name,Fd),l=bt(e.exists),c=bt(e.hasBlock),y=bt(e.blockCurrent),b=bt(e.brokenBlock),i=e.problem,a=i===null?null:Xe(i,$0);return s===null||l===null||c===null||y===null||b===null||i!==null&&a===null?null:{name:s,exists:l,hasBlock:c,blockCurrent:y,brokenBlock:b,problem:a}}function V0(t){const e=Te(t);if(e===null)return null;switch(e.kind){case"not-repo":return{kind:"not-repo"};case"error":{const s=dr(e.message);return s===null?null:{kind:"error",message:s}}case"repo":{const s=bt(e.ignored);if(s===null)return null;if(e.worktree===null)return{kind:"repo",ignored:s,worktree:null};const l=Te(e.worktree);if(l===null)return null;const c=ae(l.mainPath),y=bt(l.mainHasMemory);return c===null||y===null?null:{kind:"repo",ignored:s,worktree:{mainPath:c,mainHasMemory:y}}}default:return null}}function G0(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Pg),l=ae(e.label),c=bt(e.reaches),y=dr(e.via);return s===null||l===null||c===null||y===null?null:{agent:s,label:l,reaches:c,via:y}}function Y0(t){const e=Te(t);if(e===null)return null;const s=ae(e.name),l=Oe(e.title),c=Oe(e.description),y=Re(e.sizeBytes),b=Re(e.modifiedAt);return s===null||l===null||c===null||y===null||b===null?null:{name:s,title:l,description:c,sizeBytes:y,modifiedAt:b}}const X0=["line","command","json"];function Q0(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Pg),l=ae(e.label),c=ae(e.target),y=Xe(e.kind,X0),b=ae(e.text),i=dr(e.note);return s===null||l===null||c===null||y===null||b===null||i===null?null:{agent:s,label:l,target:c,kind:y,text:b,note:i}}function J0(t){const e=Te(t);if(e===null)return null;const s=ae(e.cwd),l=bt(e.folderExists),c=bt(e.indexExists),y=bt(e.installed),b=Rt(e.notes,Y0),i=Rt(e.files,K0),a=V0(e.git),f=Rt(e.reach,G0),_=Te(e.native),d=_===null?null:Re(_.available),k=_===null?null:Re(_.pending),E=Rt(e.globalFragments,Q0);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null||d===null||k===null||E===null?null:{cwd:s,folderExists:l,indexExists:c,installed:y,notes:b,files:i,git:a,reach:f,native:{available:d,pending:k},globalFragments:E}}function wp(t){const e=Te(t);if(e===null)return null;const s=ae(e.file),l=Xe(e.action,z0),c=Oe(e.preview),y=Oe(e.copiedFrom);return s===null||l===null||c===null?null:{file:s,action:l,preview:c,copiedFrom:y}}function Z0(t){const e=Te(t);if(e===null)return null;const s=ae(e.name),l=Oe(e.text),c=bt(e.truncated);return s===null||l===null||c===null?null:{name:s,text:l,truncated:c}}const bp=20;function ey(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 ty(t){const e=Te(t);if(e===null)return null;const s=ae(e.imageId),l=ae(e.mediaType),c=Re(e.bytes);return s===null||l===null||c===null?null:{imageId:s,mediaType:l,bytes:c}}function ny(t){const e=Te(t);if(e===null)return null;const s=ae(e.noteId),l=Oe(e.text),c=Rt(e.images,ty),y=Re(e.createdAt),b=Re(e.updatedAt);return s===null||l===null||c===null?null:{noteId:s,text:l,images:c,createdAt:y??0,updatedAt:b??0}}const Gs={fiveHours:300,day:1440,week:10080,month:43200},ry=8,sy=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,63}$/;function iy(t){const e=Te(t);if(e===null)return null;const s=e.id;if(typeof s!="string"||!sy.test(s))return null;const l=Re(e.usedPercent),c=Re(e.observedAt);if(l===null||l<0||c===null||c<=0)return null;const y=e.minutes,b=y===null?null:Re(y);if(y!==null&&(b===null||b<=0))return null;const i=e.resetsAt,a=i===null?null:Re(i);return i!==null&&(a===null||a<=0)?null:{id:s,minutes:b,usedPercent:l,resetsAt:a,observedAt:c}}function oy(t){var e;return((e=Gt(t,iy))==null?void 0:e.slice(0,ry))??null}function ly(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Er),l=oy(e.windows);return s===null||l===null?null:{agent:s,windows:l}}function ay(t,e){return t.filter(s=>s.resetsAt===null||s.resetsAt>e)}const Og=3,cy=3e4,uy=["results","time"];function Bi(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Ho(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function Bg(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Wa),l=ae(e.sessionId),c=Ho(e.cwd,Oe),y=Oe(e.title),b=Ho(e.eventId,ae),i=Ho(e.role,k=>Xe(k,Ng)),a=Ho(e.at,Re),f=Oe(e.snippet),_=Bi(e.matchStart),d=Bi(e.matchLength);return s===null||l===null||c===void 0||y===null||b===void 0||i===void 0||a===void 0||f===null||_===null||d===null||_+d>f.length?null:{agent:s,sessionId:l,cwd:c,title:y,eventId:b,role:i,at:a,snippet:f,matchStart:_,matchLength:d}}function dy(t){const e=Te(t);if(e===null)return null;const s=Oe(e.query),l=Gt(e.hits,Bg),c=Bi(e.sessionsScanned),y=Bi(e.sessionsTotal),b=Ho(e.truncated,i=>Xe(i,uy));return s===null||l===null||c===null||y===null||c>y||b===void 0?null:{query:s,hits:l,sessionsScanned:c,sessionsTotal:y,truncated:b}}function hy(t){const e=Te(t);if(e===null)return null;const s=Oe(e.query),l=Gt(e.hits,Bg),c=Bi(e.sessionsScanned),y=Bi(e.sessionsTotal);return s===null||l===null||c===null||y===null||c>y?null:{query:s,hits:l,sessionsScanned:c,sessionsTotal:y}}const fy=["off","idle","measuring","writing","moving"];function bn(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function Do(t,e){if(t==null)return null;const s=e(t);return s===null?void 0:s}function py(t){const e=Te(t);if(e===null)return null;const s=Xe(e.agent,Wa),l=bn(e.sessions),c=bn(e.eventBytes),y=bn(e.images),b=bn(e.imageBytes),i=bn(e.skippedArchived),a=bn(e.skippedEmpty),f=bn(e.unsupported),_=bn(e.failed),d=Gw(e.failureReasons);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null||_===null||d===null?null:{agent:s,sessions:l,eventBytes:c,images:y,imageBytes:b,skippedArchived:i,skippedEmpty:a,unsupported:f,failed:_,failureReasons:d}}function my(t){const e=Te(t);if(e===null)return null;const s=Re(e.measuredAt),l=Re(e.durationMs),c=Gt(e.byAgent,py),y=bn(e.memoryProjects),b=bn(e.memoryBytes);return s===null||l===null||c===null||y===null||b===null?null:{measuredAt:s,durationMs:l,byAgent:c,memoryProjects:y,memoryBytes:b}}function gy(t){const e=Te(t);if(e===null)return null;const s=bn(e.done),l=bn(e.total);return s===null||l===null?null:{done:s,total:l}}function vy(t){const e=Te(t);if(e===null)return null;const s=bt(e.enabled),l=Oe(e.dir),c=bt(e.isDefaultDir),y=Xe(e.state,fy),b=bn(e.sessions),i=bn(e.passSessions),a=bn(e.bytes),f=bn(e.pending),_=Do(e.progress,gy),d=Do(e.lastPassAt,Re),k=Do(e.measurement,my),E=Do(e.previousDir,Oe),M=Do(e.lastError,dr);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null||_===void 0||d===void 0||k===void 0||E===void 0||M===void 0?null:{enabled:s,dir:l,isDefaultDir:c,state:y,progress:_,sessions:b,passSessions:i,bytes:a,lastPassAt:d,pending:f,measurement:k,previousDir:E,lastError:M}}const Fg=1024,Hg=65535,_y="pair",wy=4001;function by(t){return typeof t=="number"&&Number.isInteger(t)&&t>=Fg&&t<=Hg}const yy=["off","active","restart-needed","port-busy"];function ky(t){const e=Te(t);if(e===null)return null;const s=ae(e.id),l=Oe(e.label),c=Re(e.createdAt),y=bt(e.connected);if(s===null||l===null||c===null||y===null)return null;const b=e.lastSeenAt,i=b==null?null:Re(b);return b!=null&&i===null?null:{id:s,label:l,createdAt:c,lastSeenAt:i,connected:y}}function Cy(t){const e=Te(t);if(e===null)return null;const s=bt(e.enabled),l=Re(e.port),c=Xe(e.state,yy),y=Re(e.listeningPort),b=Oe(e.sshUser),i=Qt(e.hostNames),a=bt(e.pairingActive),f=Rt(e.devices,ky);return s===null||l===null||c===null||y===null||b===null||i===null||a===null||f===null?null:{enabled:s,port:l,state:c,listeningPort:y,sshUser:b,hostNames:i,pairingActive:a,devices:f}}function xy(t){const e=Te(t);if(e===null)return null;const s=ae(e.code),l=Re(e.expiresAt);return s===null||l===null?null:{code:s,expiresAt:l}}const Sy=["powershell-admin","powershell","terminal"];function Ey(t){const e=Te(t);if(e===null)return null;const s=ae(e.payload),l=ae(e.authorizeCommand),c=Xe(e.shell,Sy),y=ae(e.code),b=Re(e.expiresAt);return s===null||l===null||c===null||y===null||b===null?null:{payload:s,authorizeCommand:l,shell:c,code:y,expiresAt:b}}const Ty=["auto","pwsh","powershell","cmd","git-bash","login","bash","sh","zsh"];function Ug(t){return Xe(t,Ty)}function Ly(t){const e=Te(t);if(e===null)return null;const s=Ug(e.id),l=ae(e.label);return s===null||s==="auto"||l===null?null:{id:s,label:l}}function yp(t){return Array.isArray(t)?[...new Set(t.filter(e=>typeof e=="string"&&Ui(e)))]:null}function Ny(t){const e=Te(t);if(e===null)return null;const s=Ug(e.consoleShell),l=Gt(e.consoleShells,Ly),c=e.shellName,y=c===null?null:ae(c),b=yp(e.disabledAgents),i=yp(e.disabledAtStart);if(s===null||l===null||b===null||i===null||c!==null&&y===null)return null;const a=e.scheduledMessages===!0;return{consoleShell:s,consoleShells:l,shellName:y,disabledAgents:b,disabledAtStart:i,scheduledMessages:a}}const Pi=8,Ry="/ws",ld="token",Ys=12*1024*1024,Po=8,kp=10*1024*1024,Eu=4,Cp=100,My=512,Ay=["saved","changed"],Iy=["sending","prefilled"],jy=["no-delivery","not-ready","send-failed","returned-by-cli","stopped-early","rewound","requested","queue-edit","unscheduled"],Dy=["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 xp(t){const e={model:null,effort:null,contextWindow:null};if(typeof t!="object"||t===null)return e;const s=t;return{model:ae(s.model),effort:ae(s.effort),contextWindow:Re(s.contextWindow)}}function Py(t){const e=Te(t);if(e===null)return null;const s=ae(e.terminalId),l=H0(e.draft);return s===null||l===null?null:{terminalId:s,draft:l}}function Sp(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}function ba(t,e){const s=ae(e.requestId);return s!==null&&(t.requestId=s),t}function Ep(t){var e;return((e=Gt(t,_0))==null?void 0:e.slice(0,f0))??null}function Tu(t){var e;return((e=Gt(t,w0))==null?void 0:e.slice(0,p0))??null}function Tp(t){const e=Od(t);return e!==null&&e.kind==="question"?e:null}function Oy(t){const e=Te(zw(t));if(e===null)return null;switch(e.type){case"hello":{const s=Re(e.protocolVersion),l=Oe(e.platform),c=Oe(e.defaultCwd);return s===null||l===null||c===null?null:{type:"hello",protocolVersion:s,agents:Gt(e.agents,up)??[],defaultAgent:Xe(e.defaultAgent,Er),platform:l,defaultCwd:c,shellName:ae(e.shellName),remoteClient:e.remoteClient===!0,fileCheck:e.fileCheck===!0,fileWrite:e.fileWrite===!0}}case"agents":{const s=Gt(e.agents,up);return s===null?null:{type:"agents",agents:s,defaultAgent:Xe(e.defaultAgent,Er)}}case"terminal.list":{const s=Gt(e.terminals,Cu),l=Qt(e.order);return s===null||l===null?null:{type:"terminal.list",terminals:s,order:l}}case"terminal.opened":{const s=ae(e.requestId),l=Cu(e.terminal);return s===null||l===null?null:{type:"terminal.opened",requestId:s,terminal:l}}case"terminal.output":{const s=ae(e.terminalId),l=Oe(e.data);return s===null||l===null?null:{type:"terminal.output",terminalId:s,data:l}}case"terminal.replay":{const s=ae(e.terminalId),l=Oe(e.data);return s===null||l===null?null:{type:"terminal.replay",terminalId:s,data:l,truncated:e.truncated===!0}}case"terminal.exit":{const s=ae(e.terminalId),l=Re(e.exitCode);if(s===null||l===null)return null;const c=e.signal;return{type:"terminal.exit",terminalId:s,exitCode:l,signal:typeof c=="number"?c:null}}case"terminal.closed":{const s=ae(e.terminalId);return s===null?null:{type:"terminal.closed",terminalId:s}}case"terminal.activity":{const s=ae(e.terminalId),l=Xe(e.activity,r0);if(s===null||l===null)return null;const c=l==="offline"?Xe(e.offlineReason,s0):null;return c===null?{type:"terminal.activity",terminalId:s,activity:l}:{type:"terminal.activity",terminalId:s,activity:l,offlineReason:c}}case"index.status":{const s=l0(e.status);return s===null?null:{type:"index.status",status:s}}case"index.projects":{const s=Gt(e.projects,o0);return s===null?null:{type:"index.projects",projects:s,replace:e.replace===!0}}case"conversation.reset":{const s=ae(e.terminalId),l=Oe(e.sessionId),c=Xe(e.state,mp),y=Gt(e.events,Su),b=gp(e.usage);return s===null||l===null||c===null||y===null||b===null?null:{type:"conversation.reset",terminalId:s,sessionId:l,state:c,events:y,hasMore:e.hasMore===!0,usage:b,permissionMode:Xs(e.permissionMode)?e.permissionMode:null,codexPermissions:e.codexPermissions===null||e.codexPermissions===void 0?null:vp(e.codexPermissions),defaults:xp(e.defaults),waitingFor:ae(e.waitingFor),openToolCall:e.openToolCall===!0,subagents:Ep(e.subagents)??[],queue:Tu(e.queue)??[],liveQuestion:Tp(e.liveQuestion)}}case"conversation.liveQuestion":{const s=ae(e.terminalId),l=e.question===null?null:Tp(e.question);return s===null||e.question!==null&&l===null?null:{type:"conversation.liveQuestion",terminalId:s,question:l}}case"conversation.subagents":{const s=ae(e.terminalId),l=Ep(e.subagents);return s===null||l===null?null:{type:"conversation.subagents",terminalId:s,subagents:l}}case"conversation.queue":{const s=ae(e.terminalId),l=Tu(e.queue);return s===null||l===null?null:{type:"conversation.queue",terminalId:s,queue:l}}case"agent.forceSent":{const s=ae(e.terminalId),l=ae(e.requestId),c=bt(e.sent);return s===null||l===null||c===null?null:{type:"agent.forceSent",terminalId:s,requestId:l,sent:c}}case"agent.queueEdited":{const s=ae(e.terminalId),l=ae(e.requestId),c=bt(e.edited);return s===null||l===null||c===null?null:{type:"agent.queueEdited",terminalId:s,requestId:l,edited:c}}case"agent.submitted":{const s=ae(e.terminalId),l=ae(e.requestId),c=bt(e.delivered);return s===null||l===null||c===null?null:{type:"agent.submitted",terminalId:s,requestId:l,delivered:c}}case"agent.codexQueueResult":{const s=ae(e.terminalId),l=Oe(e.sessionId),c=ae(e.requestId),y=Xe(e.result,["queued","failed","unavailable","not-busy"]);return s===null||l===null||c===null||y===null?null:{type:"agent.codexQueueResult",terminalId:s,sessionId:l,requestId:c,result:y}}case"agent.codexPermissions.result":{const s=ae(e.terminalId),l=ae(e.requestId),c=R0(e.preset)?e.preset:null,y=Xe(e.status,L0),b=e.reason===void 0?null:Xe(e.reason,N0);return s===null||l===null||c===null||y===null||e.reason!==void 0&&b===null?null:{type:"agent.codexPermissions.result",terminalId:s,requestId:l,preset:c,status:y,...b===null?{}:{reason:b}}}case"agent.rewound":{const s=ae(e.terminalId),l=ae(e.requestId),c=bt(e.codeRestored);return s===null||l===null||c===null?null:{type:"agent.rewound",terminalId:s,requestId:l,codeRestored:c}}case"conversation.append":{const s=ae(e.terminalId),l=Gt(e.events,Su),c=gp(e.usage);if(s===null||l===null||c===null)return null;const y={type:"conversation.append",terminalId:s,events:l,usage:c,permissionMode:Xs(e.permissionMode)?e.permissionMode:null},b=Tu(e.queue);return b!==null&&(y.queue=b),y}case"conversation.mode":{const s=ae(e.terminalId),l=e.mode;return s===null||!Xs(l)?null:{type:"conversation.mode",terminalId:s,mode:l}}case"conversation.codexPermissions":{const s=ae(e.terminalId),l=e.state===null?null:vp(e.state);return s===null||e.state!==null&&l===null?null:{type:"conversation.codexPermissions",terminalId:s,state:l}}case"conversation.waiting":{const s=ae(e.terminalId);return s===null?null:{type:"conversation.waiting",terminalId:s,waitingFor:ae(e.waitingFor)}}case"conversation.toolCall":{const s=ae(e.terminalId),l=bt(e.open);return s===null||l===null?null:{type:"conversation.toolCall",terminalId:s,open:l}}case"conversation.page":{const s=ae(e.terminalId),l=Gt(e.events,Su);return s===null||l===null?null:{type:"conversation.page",terminalId:s,events:l,hasMore:e.hasMore===!0}}case"conversation.turns":{const s=ae(e.terminalId),l=Rt(e.turns,c=>{const y=Te(c);if(y===null)return null;const b=ae(y.eventId),i=Re(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=ae(e.terminalId),l=Rt(e.updates,c=>{const y=Te(c);if(y===null)return null;const b=ae(y.eventId),i=Rt(y.parts,Od);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=ae(e.terminalId),l=ae(e.eventId),c=Re(e.index),y=Oe(e.mediaType);if(s===null||l===null||c===null||y===null)return null;const b=e.data;return{type:"conversation.imageData",terminalId:s,eventId:l,index:c,source:Xe(e.source,Rg)??"content",mediaType:y,data:typeof b=="string"?b:null}}case"conversation.state":{const s=ae(e.terminalId),l=Xe(e.state,mp);return s===null||l===null?null:{type:"conversation.state",terminalId:s,state:l}}case"git.status":{const s=ae(e.terminalId),l=pb(e.status);return s===null||l===null?null:{type:"git.status",terminalId:s,status:l}}case"git.diff":{const s=ae(e.terminalId),l=dp(e.diff);return s===null||l===null?null:{type:"git.diff",terminalId:s,diff:l}}case"files.listing":{const s=ae(e.terminalId),l=D0(e.listing);return s===null||l===null?null:{type:"files.listing",terminalId:s,listing:l}}case"picker.listing":{const s=P0(e.listing);return s===null?null:{type:"picker.listing",listing:s}}case"files.preview":{const s=ae(e.terminalId),l=_p(e.preview);return s===null||l===null?null:{type:"files.preview",terminalId:s,preview:l}}case"files.checked":{const s=ae(e.terminalId),l=ae(e.requestId),c=Qt(e.existing),y=Qt(e.directories)??[];return s===null||l===null||c===null?null:{type:"files.checked",terminalId:s,requestId:l,existing:c,directories:y}}case"files.saved":{const s=ae(e.terminalId),l=ae(e.requestId),c=ae(e.path),y=Xe(e.outcome,Ay),b=e.preview===null?null:_p(e.preview);return s===null||l===null||c===null||y===null||b===null&&(y==="saved"||e.preview!==null)?null:{type:"files.saved",terminalId:s,requestId:l,path:c,outcome:y,preview:b}}case"conversation.plans":{const s=ae(e.terminalId),l=Rt(e.plans,b0);return s===null||l===null?null:{type:"conversation.plans",terminalId:s,plans:l}}case"conversation.defaults":{const s=ae(e.terminalId);return s===null?null:{type:"conversation.defaults",terminalId:s,defaults:xp(e.defaults)}}case"plans.content":{const s=ae(e.terminalId),l=y0(e.plan);return s===null||l===null?null:{type:"plans.content",terminalId:s,plan:l}}case"files.results":{const s=ae(e.terminalId),l=j0(e.result);return s===null||l===null?null:{type:"files.results",terminalId:s,result:l}}case"notes.list":{const s=Rt(e.notes,ny);return s===null?null:{type:"notes.list",notes:s}}case"notes.imageData":{const s=ae(e.imageId),l=Oe(e.mediaType);if(s===null||l===null)return null;const c=e.data;return{type:"notes.imageData",imageId:s,mediaType:l,data:typeof c=="string"?c:null}}case"memory.status":{const s=ae(e.terminalId),l=J0(e.status);return s===null||l===null?null:{type:"memory.status",terminalId:s,status:l}}case"memory.planned":{const s=ae(e.terminalId),l=Rt(e.changes,wp);return s===null||l===null?null:ba({type:"memory.planned",terminalId:s,changes:l},e)}case"memory.installed":{const s=ae(e.terminalId),l=Rt(e.applied,wp);return s===null||l===null?null:ba({type:"memory.installed",terminalId:s,applied:l},e)}case"memory.imported":{const s=ae(e.terminalId),l=Qt(e.copied),c=Qt(e.skipped);return s===null||l===null||c===null?null:ba({type:"memory.imported",terminalId:s,copied:l,skipped:c},e)}case"memory.content":{const s=ae(e.terminalId),l=Z0(e.note);return s===null||l===null?null:ba({type:"memory.content",terminalId:s,note:l},e)}case"vault.status":{const s=vy(e.status);return s===null?null:{type:"vault.status",status:s}}case"vault.exported":{const s=ae(e.projectKey),l=Re(e.sessions);return s===null||l===null?null:{type:"vault.exported",projectKey:s,sessions:l}}case"session.continued":{const s=ae(e.requestId),l=ae(e.terminalId),c=Te(e.source),y=Xe(c==null?void 0:c.agent,Wa),b=ae(c==null?void 0:c.sessionId),i=Oe(c==null?void 0:c.title),a=Sp(e.includedTurns),f=Sp(e.totalTurns),_=Xe(e.delivery,Iy);return s===null||l===null||y===null||b===null||i===null||a===null||f===null||a>f||_===null?null:{type:"session.continued",requestId:s,terminalId:l,source:{agent:y,sessionId:b,title:i},includedTurns:a,totalTurns:f,totalTurnsIsMinimum:e.totalTurnsIsMinimum===!0,delivery:_}}case"composer.prefill":{const s=ae(e.terminalId),l=ae(e.text),c=Xe(e.reason,jy);if(s===null||l===null||c===null)return null;const y={type:"composer.prefill",terminalId:s,text:l,reason:c};if(e.pasted!==void 0){const i=Qt(e.pasted);if(i===null)return null;i.length>0&&(y.pasted=i)}const b=ae(e.requestId);return b!==null&&(y.requestId=b),y}case"composer.drafts":{const s=Gt(e.drafts,Py);return s===null?null:{type:"composer.drafts",drafts:s}}case"composer.suggestion":{const s=ae(e.terminalId);if(s===null)return null;if(e.text===null)return{type:"composer.suggestion",terminalId:s,text:null};const l=ae(e.text);return l===null?null:{type:"composer.suggestion",terminalId:s,text:l}}case"search.progress":{const s=ae(e.searchId),l=hy(e.progress);return s===null||l===null?null:{type:"search.progress",searchId:s,progress:l}}case"remote.status":{const s=Cy(e.status);return s===null?null:{type:"remote.status",status:s}}case"settings.status":{const s=Ny(e.settings);return s===null?null:{type:"settings.status",settings:s}}case"schedule.list":{const s=Gt(e.messages,W0);return s===null?null:{type:"schedule.list",messages:s}}case"schedule.created":{const s=ae(e.requestId),l=ae(e.id);return s===null||l===null?null:{type:"schedule.created",requestId:s,id:l}}case"plan.limits":{const s=Gt(e.limits,ly);return s===null?null:{type:"plan.limits",limits:s}}case"remote.pairing.code":{const s=xy(e.pairing);return s===null?null:{type:"remote.pairing.code",pairing:s}}case"remote.phone.pairing":{const s=Ey(e.pairing);return s===null?null:{type:"remote.phone.pairing",pairing:s}}case"search.results":{const s=ae(e.searchId),l=dy(e.result);return s===null||l===null?null:{type:"search.results",searchId:s,result:l}}case"worktree.inspected":{const s=ae(e.requestId),l=Pb(e.inspection);return s===null||l===null?null:{type:"worktree.inspected",requestId:s,inspection:l}}case"worktree.moved":{const s=ae(e.requestId),l=Cu(e.terminal);return s===null||l===null?null:{type:"worktree.moved",requestId:s,terminal:l}}case"worktree.rows":{const s=ae(e.terminalId),l=Gt(e.rows,Ob);if(s===null||l===null)return null;const c=Gt(e.kept,Vb);return c===null?{type:"worktree.rows",terminalId:s,rows:l}:{type:"worktree.rows",terminalId:s,rows:l,kept:c}}case"worktree.removePlan":{const s=ae(e.requestId),l=Qb(e.plan);return s===null||l===null?null:{type:"worktree.removePlan",requestId:s,plan:l}}case"worktree.removed":{const s=ae(e.requestId),l=ae(e.worktreeId),c=Jb(e.outcome);return s===null||l===null||c===null?null:{type:"worktree.removed",requestId:s,worktreeId:l,outcome:c}}case"worktree.changed":return{type:"worktree.changed"};case"worktree.branchChanges":{const s=ae(e.requestId),l=Wb(e.changes);return s===null||l===null?null:{type:"worktree.branchChanges",requestId:s,changes:l}}case"worktree.branchDiff":{const s=ae(e.requestId),l=ae(e.worktreeId),c=dp(e.diff);return s===null||l===null||c===null?null:{type:"worktree.branchDiff",requestId:s,worktreeId:l,diff:c}}case"worktree.reviewPlan":{const s=ae(e.requestId),l=$b(e.plan);return s===null||l===null?null:{type:"worktree.reviewPlan",requestId:s,plan:l}}case"worktree.integratePlan":{const s=ae(e.requestId),l=zb(e.plan);return s===null||l===null?null:{type:"worktree.integratePlan",requestId:s,plan:l}}case"worktree.integrated":{const s=ae(e.requestId),l=ae(e.worktreeId),c=Kb(e.outcome);return s===null||l===null||c===null?null:{type:"worktree.integrated",requestId:s,worktreeId:l,outcome:c}}case"worktree.deleteBranchPlan":{const s=ae(e.requestId),l=Gb(e.plan);return s===null||l===null?null:{type:"worktree.deleteBranchPlan",requestId:s,plan:l}}case"worktree.branchDeleted":{const s=ae(e.requestId),l=ae(e.worktreeId),c=ae(e.branch);return s===null||l===null||c===null?null:{type:"worktree.branchDeleted",requestId:s,worktreeId:l,branch:c}}case"error":{const s=dr(e.text);if(s===null)return null;const c={type:"error",code:Xe(e.code,Dy)??"internal",text:s},y=Oe(e.detail);y!==null&&(c.detail=y);const b=ae(e.requestId);return b!==null&&(c.requestId=b),c}default:return null}}function Lp(t){return JSON.stringify(t)}const By=/^[A-Za-z]:\\$/;function Tr(t,e){return t.length===0?"":e==="win32"?Fy(t):Hy(t)}function Fy(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("\\")&&!By.test(e);)e=e.slice(0,-1);return e.toLowerCase()}function Wg(t,e,s){return t.length===0||s==="win32"&&t!==e&&t.toLowerCase()===e.toLowerCase()?e:t}function Hy(t){let e=t.replace(/\/+/g,"/");for(;e.length>1&&e.endsWith("/");)e=e.slice(0,-1);return e}function ad(t){var e;return((e=t.worktree)==null?void 0:e.mainCwd)??t.cwd}function Uy(t,e,s,l){if(s.kind!=="agent")return t.length;const c=Tr(ad(s),l);let y=-1;for(const[b,i]of t.entries()){const a=e(i);a===void 0||a.kind!=="agent"||Tr(ad(a),l)===c&&(y=b)}return y===-1?t.length:y+1}function Hd(t){return`[Pasted text #${t}]`}function Wy(t){return`[Start of pasted text #${t}]`}function $y(t){return`[End of pasted text #${t}]`}function zy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n([\s\S]*?)\n\[End of pasted text #\2\](?=\n|$)/g}function qy(){return/(^|\n)\[Start of pasted text #(\d{1,6})\]\n/}function Ky(){return/\[Pasted text #(\d{1,6})\]/g}const $g="https://buymeacoffee.com/cvelasquez",Vy="modulepreload",Gy=function(t){return"/"+t},Np={},xr=function(e,s,l){let c=Promise.resolve();if(s&&s.length>0){let b=function(f){return Promise.all(f.map(_=>Promise.resolve(_).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};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"));c=b(s.map(f=>{if(f=Gy(f),f in Np)return;Np[f]=!0;const _=f.endsWith(".css"),d=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${d}`))return;const k=document.createElement("link");if(k.rel=_?"stylesheet":Vy,_||(k.as="script"),k.crossOrigin="",k.href=f,a&&k.setAttribute("nonce",a),document.head.appendChild(k),_)return new Promise((E,M)=>{k.addEventListener("load",E),k.addEventListener("error",()=>M(new Error(`Unable to preload CSS for ${f}`)))})}))}function y(b){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=b,window.dispatchEvent(i),!i.defaultPrevented)throw b}return c.then(b=>{for(const i of b||[])i.status==="rejected"&&y(i.reason);return e().catch(y)})},Yy={"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.codexQueue.failed":"Codex did not confirm the queue. Check the session before retrying to avoid duplicates.","composer.codexQueue.label":"Queue in Codex","composer.codexQueue.notBusy":"The session is no longer working. The text was returned to the message box.","composer.codexQueue.pending":"Adding to Codex queue…","composer.codexQueue.queued":"Text added to Codex's queue.","composer.codexQueue.textOnly":"Codex's native queue accepts text only, without images or files.","composer.codexQueue.tooLong":"The message exceeds the {{max}} character limit for Codex's queue.","composer.codexQueue.unavailable":"Codex's queue isn't available for this session.","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)","composer.suggestion.key":"Tab","composer.suggestion.keyTitle":"The CLI's suggestion: Tab writes it in the box, to send it or change it","composer.suggestion.use":"Use the CLI's suggestion","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":"Provisional effort: {{effort}}. The session has not 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":"Provisional model: {{model}}. The session has not confirmed it yet","controls.permission.askForApproval":"Ask for approval","controls.permission.askForApprovalHint":"Ask before accessing the internet or editing outside the workspace.","controls.permission.automatic":"Approve for me","controls.permission.automaticHint":"Codex reviews approval requests and asks about potentially unsafe actions.","controls.permission.awaiting":"Request sent. If Codex asks for confirmation, answer in its tab.","controls.permission.custom":"Custom","controls.permission.error.busy":"Wait for the Codex turn to finish.","controls.permission.error.failed":"The permission change could not be sent.","controls.permission.error.gone":"The Codex tab has closed.","controls.permission.error.notReady":"The Codex composer must be empty and ready.","controls.permission.error.review":"Permissions cannot be expanded in a read-only review tab.","controls.permission.error.toolPending":"A Codex tool is still pending. Check its tab.","controls.permission.error.unsupported":"This Codex version does not support changing permissions from the app.","controls.permission.error.waiting":"Answer the pending confirmation in the Codex tab first.","controls.permission.fullAccess":"Full access","controls.permission.fullAccessHint":"Full access. Codex may ask you to confirm the expansion in its tab.","controls.permission.label":"Permissions","controls.permission.pending":"Sending permission change …","controls.permission.readOnly":"Read only","controls.permission.readOnlyHint":"Read-only access. File changes require approval.","controls.permission.unconfirmed":"Codex has not confirmed the change yet. The last observed state is kept.","controls.permission.unknown":"Unconfirmed","controls.permission.unknownHint":"Codex has not published the effective permissions for this conversation 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.updating":"Updating…","git.upstreamTitle":"Upstream branch: {{upstream}}","git.waitingTitle":"Wait for the repository's current state: this is what it showed last time.","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.noteCliDraft":"The note wasn't sent: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with the note. Check the CLI tab.","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.scheduledCliDraft":"Not sent: the CLI had something typed in its own box that couldn't be set aside.","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.submitCliDraft":"Not sent: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with your message. Check the CLI tab: your message is back in the message box.","server.submitCliDraftCommand":"Not changed: {{label}} has something typed in its own box that couldn't be set aside, and it would have been sent together with the command. Check the CLI tab.","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.submitStartupPending":"{{label}} is still starting. Some content may remain in the CLI tab; check it before sending again.","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.submitUnknownActivity":"Cannot determine the state of {{label}}. Check the CLI tab before sending again.","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.worktreeMoveBusy":"The agent is working: move the conversation to a branch when it's done.","server.worktreeMoveCliCheckFailed":"Couldn't ask {{cli}} whether it can move the conversation to another folder: {{detail}}. Nothing was changed.","server.worktreeMoveCliFailed":"The branch {{branch}} was created, but {{cli}} didn't move the conversation: {{detail}}. The tab stays in its previous folder; you can remove the branch from Changes.","server.worktreeMoveCliUnsupported":"This version of {{cli}} can't move a conversation to another folder. Nothing was changed.","server.worktreeMovePending":"A message is waiting for the agent: move the conversation to a branch once the agent is done with it.","server.worktreeMoveUnavailable":"This tab's conversation can't be moved to a separate branch.","server.worktreeMoveWaiting":"The CLI is waiting for your answer: answer it, then move the conversation to a branch.","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.moveBranch":"Branch","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.editSentTitle":"Stops the agent and brings your message back to the message box to fix it. Only until the agent starts answering","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.queue.sent":"sent","thread.queue.sentTitle":"The CLI already has it, and the agent hasn't started answering yet","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.tools.hide":"Hide search and buttons","thread.tools.show":"Show search and buttons","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.move.askChanges":"Ask the agent to take its own","worktree.move.askChangesHint":"It's left written in its box, unsent: you review it and send it.","worktree.move.changes_one":"The folder of this conversation has {{count}} file with uncommitted changes. It doesn't move on its own: the app doesn't know which conversation it belongs to.","worktree.move.changes_other":"The folder of this conversation has {{count}} files with uncommitted changes. They don't move on their own: the app doesn't know which conversation each one belongs to.","worktree.move.intro":"The conversation continues whole on a branch with its own folder next to {{project}}: the agent works there without touching the main folder. If its CLI is open, it closes and reopens on the branch.","worktree.move.moving":"Moving…","worktree.move.submit":"Move to the branch","worktree.move.title":"Move this conversation to a separate 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"},Ud=["en","es","de","fr","pt-BR","ru","ja","ko","zh-CN"],zg="en",Lu={en:"English",es:"Español",de:"Deutsch",fr:"Français","pt-BR":"Português (Brasil)",ru:"Русский",ja:"日本語",ko:"한국어","zh-CN":"简体中文"},Xy={en:"EN",es:"ES",de:"DE",fr:"FR","pt-BR":"PT",ru:"RU",ja:"JA",ko:"KO","zh-CN":"ZH"},Wd={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"},Qy={es:()=>xr(()=>import("./es-CPhm39HJ.js"),[]),de:()=>xr(()=>import("./de-C678otZQ.js"),[]),fr:()=>xr(()=>import("./fr-CXsDqneg.js"),[]),"pt-BR":()=>xr(()=>import("./pt-BR-DrTp_uEs.js"),[]),ru:()=>xr(()=>import("./ru-CyrqdjsW.js"),[]),ja:()=>xr(()=>import("./ja-DVeeRhCP.js"),[]),ko:()=>xr(()=>import("./ko-DozzP6h6.js"),[]),"zh-CN":()=>xr(()=>import("./zh-CN-EUpCRWqV.js"),[])},qg=Yy,cd=new Map([["en",qg]]),Rp=new Map,ud=new Set;let zo=zg,dd=Wd[zg],Mp=0;function Kg(t){return Ud.includes(t)}function hd(){return zo}function Qs(){return dd}function Jy(t){return Wd[t]}function Vg(t){return ud.add(t),()=>ud.delete(t)}async function Gg(t,e=Wd[t]){const s=++Mp;if(!cd.has(t)&&t!=="en"){const l=await Qy[t]();cd.set(t,l.default)}if(s===Mp&&!(zo===t&&dd===e)){zo=t,dd=e;for(const l of ud)l()}}function Zy(t,e){let s=Rp.get(t);return s===void 0&&(s=new Intl.PluralRules(t),Rp.set(t,s)),s.select(e)}function Ap(t,e,s,l){if(l!==void 0){const c=t[`${s}_${Zy(e,l)}`]??t[`${s}_other`];if(c!==void 0)return c}return t[s]}function ek(t,e,s,l){const c=l==null?void 0:l.count,y=typeof c=="number"?c:void 0;return(t===void 0?void 0:Ap(t,e,s,y))??Ap(qg,"en",s,y)??s}function Ta(t,e){return e===void 0?t:t.replace(/\{\{\s*([A-Za-z0-9_]+)\s*\}\}/g,(s,l)=>{const c=e[l];return c===void 0?s:String(c)})}function Yg(t,e){return ek(cd.get(zo),zo,t,e)}function m(t,e){return Ta(Yg(t,e),e)}function tk(){return[{keys:"Esc",description:m("agent.shortcuts.codex.interruptTurn")},{keys:"Esc Esc",description:m("agent.shortcuts.codex.editPrevious")},{keys:"Ctrl + C",description:m("agent.shortcuts.codex.interruptOrExit")},{keys:"Alt + , / Alt + .",description:m("agent.shortcuts.codex.effort")},{keys:"Shift + Tab",description:m("agent.shortcuts.codex.cycleMode")},{keys:"Tab",description:m("agent.shortcuts.codex.queue")},{keys:"Ctrl + T",description:m("agent.shortcuts.codex.transcript")},{keys:"Ctrl + R",description:m("agent.shortcuts.codex.searchHistory")},{keys:"@",description:m("agent.shortcuts.codex.mention")},{keys:"/",description:m("agent.shortcuts.commands")},{keys:"Ctrl + G",description:m("agent.shortcuts.codex.externalEditor")}]}function nk(){return[{keys:"Esc Esc",description:m("agent.shortcuts.opencode.interrupt")},{keys:"Tab / Shift + Tab",description:m("agent.shortcuts.opencode.cycleAgent")},{keys:"Ctrl + P",description:m("agent.shortcuts.opencode.commandList")},{keys:m("agent.shortcuts.leaderThen",{key:"M"}),description:m("agent.shortcuts.opencode.model")},{keys:m("agent.shortcuts.leaderThen",{key:"N"}),description:m("agent.shortcuts.opencode.newSession")},{keys:"Ctrl + J",description:m("agent.shortcuts.opencode.newline")},{keys:"Ctrl + C",description:m("agent.shortcuts.opencode.clearInput")},{keys:"Ctrl + V",description:m("agent.shortcuts.opencode.paste")}]}function rk(){return[{keys:"Esc",description:m("agent.shortcuts.antigravity.interrupt")},{keys:"Shift + Tab",description:m("agent.shortcuts.antigravity.cycleMode")},{keys:"1 … 4",description:m("agent.shortcuts.antigravity.answerPermission")},{keys:"/",description:m("agent.shortcuts.commands")},{keys:"?",description:m("agent.shortcuts.antigravity.help")}]}function sk(){return[{keys:"Esc",description:m("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:m("agent.shortcuts.pi.tree")},{keys:"Ctrl + C",description:m("agent.shortcuts.pi.clearOrExit")},{keys:"Shift + Tab",description:m("agent.shortcuts.pi.cycleThinking")},{keys:"Ctrl + L",description:m("agent.shortcuts.pi.model")},{keys:"Ctrl + P",description:m("agent.shortcuts.pi.nextModel")},{keys:"Ctrl + O",description:m("agent.shortcuts.pi.toolOutput")},{keys:"Ctrl + J",description:m("agent.shortcuts.pi.newline")},{keys:"!",description:m("agent.shortcuts.pi.bash")},{keys:"/",description:m("agent.shortcuts.commands")}]}function ik(){return[{keys:"Esc",description:m("agent.shortcuts.interruptCli")},{keys:"Esc Esc",description:m("agent.shortcuts.claudeCode.rewind")},{keys:"Ctrl + C",description:m("agent.shortcuts.claudeCode.cancel")},{keys:"Ctrl + R",description:m("agent.shortcuts.claudeCode.searchHistory")},{keys:"Ctrl + O",description:m("agent.shortcuts.claudeCode.fullOutput")},{keys:"Shift + Tab",description:m("agent.shortcuts.claudeCode.cycleMode")},{keys:"Alt + V",description:m("agent.shortcuts.claudeCode.pasteImage")},{keys:"Ctrl + V",description:m("agent.shortcuts.claudeCode.pasteText")}]}const xs={"claude-code":{shortLabel:"CC",get shortcuts(){return ik()},shortcutsNote:null,instructionsFile:"CLAUDE.md",savesModelChoice:!1,compactCommand:"/compact"},codex:{shortLabel:"CX",get shortcuts(){return tk()},get shortcutsNote(){return m("agent.shortcuts.codex.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},opencode:{shortLabel:"OC",get shortcuts(){return nk()},get shortcutsNote(){return m("agent.shortcuts.opencode.note")},instructionsFile:"AGENTS.md",savesModelChoice:!1,compactCommand:"/compact"},antigravity:{shortLabel:"AG",get shortcuts(){return rk()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!0,compactCommand:"/compact"},pi:{shortLabel:"PI",get shortcuts(){return sk()},shortcutsNote:null,instructionsFile:"AGENTS.md",savesModelChoice:!1,effortCommand:"/thinking",compactCommand:"/compact"}};function ok(t){return(t===null?void 0:xs[t].effortCommand)??Bd}function lk(t){return t===null?null:xs[t].compactCommand}const ak={"gemini-cli":"GC","antigravity-ide":"AI"};function ck(t){return Ui(t)?xs[t].shortLabel:ak[t]}function Qo(t,e){var s;return Ui(t)?((s=e.find(l=>l.id===t))==null?void 0:s.label)??t:Xw[t]}const Xg="Sesion sin titulo";function Sr(t,e){return e==="none"||t===Xg?m("session.untitled"):t}function uk(t,e){const s=new Map;for(const c of e)c.titleSource==="none"||c.title===Xg||s.set(`${c.agent}\0${c.sessionId}`,c.title);const l=new Map;for(const c of t){if(c.agent===null||c.sessionId.length===0)continue;const y=s.get(`${c.agent}\0${c.sessionId}`);y!==void 0&&l.set(c.terminalId,y)}return l}function La(t){return t.storage==="native"&&Ui(t.agent)}function dk(t){return t!==null&&xs[t].savesModelChoice}function hk(t,e,s){if(e!=null)return e;for(let l=t.length-1;l>=0;l-=1){const c=t[l];if(!(c===void 0||c.effort===null))return s===null||c.at>=s?c.effort:null}return null}function fk(t){return t===null?null:xs[t].instructionsFile}function Ip(t,e=!1){const s=t.permissionCycle,l=rb(t,e);return{modeCycle:s===null||l===null||l===s.launchMode?s:{...s,launchMode:l},codexPermissions:t.codexPermissions,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,codexNativeQueue:t.codexNativeQueue,moveToWorktree:t.moveToWorktree}}function pk(t,e){const s=C0(e,t);return s===null?null:t.find(l=>l.value===s.value)??null}function mk(t,e){return t??e.launchMode}const gk={auto:"mode.auto.label",default:"mode.default.label",acceptEdits:"mode.acceptEdits.label",plan:"mode.plan.label"},vk={auto:"mode.auto.hint",default:"mode.default.hint",acceptEdits:"mode.acceptEdits.hint",plan:"mode.plan.hint"};function Qg(t){return m(gk[t])}function _k(t){return m(vk[t])}function wk(t,e){return m("agent.mode.title",{mode:Qg(t),hint:_k(t),key:e.keyLabel})}function Jg(t,e){return t.approvesPendingOnCycle&&e!==null}function bk(t,e,s,l){if(Jg(e,l))return m("agent.mode.blocked");const c=wk(t,e);return!e.approvesPendingOnCycle||s?c:m("agent.mode.titleBlind",{title:c})}const yk={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 kk(t){return m(yk[t])}function Ck(){return m("agent.statusLine.noFragment")}function xk(t,e){return t.fragment===null?null:m("statusLine.agentPrompt",{agent:e,path:t.settingsPath,fragment:t.fragment})}function Sk(t,e){return t.filter(s=>s.available&&!e.includes(s.id)&&s.statusLine!==null&&s.statusLine.state!=="active"&&!s.capabilities.scheduledSend)}function Ek(t,e,s=new Set){return t.filter(l=>(e||l.id!=="plans")&&(l.id==="cli"||!s.has(l.id)))}function Tk(t,e,s=new Set){return t==="plans"&&!e||t!=="cli"&&s.has(t)?"cli":t}function Lk(t,e,s){const l=c=>c===null?void 0:e.find(y=>y.id===c);return l(t)??l(s)??e[0]??null}function Nk(t){return[{keys:"Enter",description:m("agent.shortcuts.composer.send")},{keys:"Shift + Enter",description:m("agent.shortcuts.composer.newline")},{keys:"Ctrl + V",description:m(t?"agent.shortcuts.composer.pasteWithImages":"agent.shortcuts.composer.pasteText")},{keys:"Esc",description:m("agent.shortcuts.interruptCli")}]}function jp(){return m("agent.composer.imagesRefused")}function Rk(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 Mk(t,e){return e.compacted===!0?!1:t==="status-line"?e.lastRequestTokens>0:e.assistantMessages>0}function Ak(t,e){return t===null&&e!==null&&e.state!=="active"}function Ik(t){return m(t==="other-command"?"agent.meter.setup.otherCommand":t==="disabled"?"agent.meter.setup.disabled":t==="unreadable"?"agent.meter.setup.unreadable":"agent.meter.setup.missing")}function jk(t,e){return e.contextWindowEstimated?m("agent.meter.origin.estimated"):t==="usage-with-catalog"&&e.contextWindow!==null?m("agent.meter.origin.catalog"):null}function Dk(t,e=null,s=!1){return s?m("agent.meter.idle.compacted"):e==="status-line"?m("agent.meter.idle.statusLine"):t===null?m("agent.meter.idle.noFile"):m("agent.meter.idle.withFile",{file:t})}function Pk(t,e=null){return t==="idle"?m("agent.dot.idle"):t==="unknown"?e===null?m("agent.dot.noStatus"):e.state==="active"?m("agent.dot.statusLinePending"):m("agent.dot.statusLineOnly"):m("agent.dot.open")}function Dp(t,e){return t.length===0?!0:t.some(s=>s.id===e&&s.available&&s.capabilities.resume)}function Ok(t,e,s){return t?s?m("agent.note.empty"):m("agent.note.send",{cwd:e??""}):m(e===null?"agent.note.needsTab":"agent.note.noReadySignal")}function Bk(t,e,s){return t===null?m("notes.toComposer.needsTab"):e?m("agent.note.empty"):s?m("notes.toComposer.title",{tab:t}):m("notes.toComposer.loading")}function Zg(t,e,s){const l=Tr(e,s);let c=null;for(const y of t)y.kind!=="agent"||y.agent===null||Tr(y.cwd,s)===l&&(c=y.agent);return c}function ev(t,e){var l;const s=e.filter(c=>c.available);for(const c of t)if(c!==null&&s.some(y=>y.id===c))return c;return((l=s[0])==null?void 0:l.id)??null}function Fk(t){let e=null;for(const s of t){const l=s.agent;Ui(l)&&(e===null||s.updatedAt>e.updatedAt)&&(e={agent:l,updatedAt:s.updatedAt})}return(e==null?void 0:e.agent)??null}function Hk(t,e,s,l,c){return ev([Zg(t,e,s),c],l)}function Pp(t,e,s,l,c){return ev([Zg(t,e.cwd,s),Fk(e.sessions),c],l)}function fd(t){return t.filter(e=>e.available)}function Uk(t,e){const s=t.findIndex(l=>l.id===e);return s===-1?0:s}function Wk(t,e,s){return s<=0?0:((t+e)%s+s)%s}function tv(t,e,s,l=4){const c=t.bottom+2,y=t.top-2-e.height,b=c+e.height+l<=s.height||y<l?Math.max(l,Math.min(c,s.height-e.height-l)):y;return{left:Math.max(l,Math.min(t.left,s.width-e.width-l)),top:b}}function nv(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 rv(t,e,s=!1,l=!1){return e===null||s?[]:l?fd(t):Dd(t)?fd(t).filter(c=>c.id!==e):[]}function $d(t=!1){return m(t?"agent.continue.titleMain":"agent.continue.title")}function $k(t,e,s){return e?m("agent.continue.discovering"):t.length===0?m("agent.continue.noConversation"):s?null:m("agent.continue.noMessages")}function zk(t,e,s,l){const c=e>=s&&!l?s===1?m("agent.handoff.turns.single"):m("agent.handoff.turns.all",{count:s}):e===1?l?m("agent.handoff.turns.lastOneOfMore",{total:s}):m("agent.handoff.turns.lastOne",{total:s}):l?m("agent.handoff.turns.lastManyOfMore",{count:s,included:e}):m("agent.handoff.turns.lastMany",{count:s,included:e});return m("agent.handoff.notice",{label:t,turns:c})}const Op=40;function Bp(t){const e=t.replace(/\s+/g," ").trim(),s=[...e],l=s.length>Op?`${s.slice(0,Op).join("").trimEnd()}…`:e;return l.length>0?m("agent.handoff.tabLabel",{title:l}):m("agent.handoff.tabLabelNoTitle")}function qk(){return m("agent.handoff.sending")}function Kk(t){return t===null?m("agent.queueReturned.noLabel"):m("agent.queueReturned.withLabel",{label:t})}function Vk(){return m("agent.stoppedEarly")}function Gk(t){switch(t){case"no-delivery":return m("agent.handoff.prefill.noDelivery");case"not-ready":return m("agent.handoff.prefill.notReady");case"send-failed":return m("agent.handoff.prefill.sendFailed")}}function zd(t,e){return t.trim().length===0?e:`${e}
46
-
47
- ${t}`}function Yk(t,e){return t&&e!==null}function Xk(t,e,s){if(!Ui(t))return{badge:!0,unavailableTitle:null};const l=e.find(b=>b.id===t),c=e.some(b=>b.available),y=l!==void 0&&!l.available&&c;return{badge:s||y,unavailableTitle:y?m("agent.session.cliMissing",{label:l.label}):null}}function Qk(t,e,s){return t!==null&&e===""&&!s.sessionIdAtLaunch}function Jk(){return m("agent.thread.noTranscript")}function Zk(){return m("agent.thread.discovering")}function eC(t,e,s,l,c=null){return!l||!Cg(t,c)||!e?null:s===null?m("agent.openTool.noLabel"):m("agent.openTool.withLabel",{label:s})}function sv(t,e=!1){return m(t==="permission prompt"?"agent.waiting.permission":t==="question"&&e?"agent.waiting.question":"agent.waiting.answer")}function tC(t){return t.relaunching?"relaunching":t.offlineReason==="server-closed"&&t.alive?"offer":null}function nC(t){return t===null?m("agent.serverClosed.noLabel"):m("agent.serverClosed.withLabel",{label:t})}function rC(){return m("agent.serverClosed.relaunch")}function sC(){return m("agent.serverClosed.relaunching")}function iC(t,e){const s=new Map,l=[];for(const[c,y]of t){const b=e.find(i=>i.terminalId===c);b===void 0||b.alive&&y==="exited"?l.push(c):s.set(c,b.alive?y:"exited")}return{phases:s,finished:l}}function oC(t,e,s){var l;return!s||e===null||((l=t.permissionCycle)==null?void 0:l.approvesPendingOnCycle)!==!0&&!t.waitingBlocksSubmit?null:sv(e,t.questionCards)}const Fp=2e4;function lC(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 aC(t,e,s){const l=t.map(y=>({terminalId:y.terminalId,kind:y.kind,cwd:y.cwd,worktree:y.worktree??null})),c=[];for(const y of e){const b=Uy(l.map(i=>i.terminalId),i=>l.find(a=>a.terminalId===i),{kind:"agent",cwd:y.cwd},s);c.push({pending:y,index:b,label:lC(y)}),l.splice(b,0,{terminalId:`pending:${y.requestId}`,kind:"agent",cwd:y.cwd})}return c}function Hp(t,e,s){const l=Tr(e,s);return t.some(c=>Tr(c.cwd,s)===l)}function iv(){return m("agent.openBlocked")}const cC={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 uC(t){const e=cC[t.value];return e===void 0?t.label:m(e)}function dC(t){return t.value==="default"?m("controls.model.default"):k0(t)}function hC({models:t,efforts:e,model:s,effort:l,modelProvisional:c=!1,effortProvisional:y=!1,savesChoice:b=!1,effortCommandName:i=Bd,effortUsesModel:a=!1,disabled:f,onCommand:_}){const d=t===null?null:pk(t,s),k=a&&(d!=null&&d.supportedEfforts)?(e==null?void 0:e.filter(M=>{var w;return(w=d.supportedEfforts)==null?void 0:w.includes(M.value)}))??null:e,E=d===null&&s!==null;return o.jsxs(o.Fragment,{children:[t!==null&&o.jsxs("select",{className:"agent-select",value:(d==null?void 0:d.value)??"",disabled:f,onChange:M=>{M.target.value.length>0&&_(S0(M.target.value))},title:s===null?m("controls.model.noData"):c?m("controls.model.provisional",{model:s}):b?m("controls.model.inUseSaved",{model:s}):m("controls.model.inUse",{model:s}),children:[d===null&&o.jsx("option",{value:"",children:E?s??"":m("controls.model.placeholder")}),t.map(M=>o.jsx("option",{value:M.value,children:dC(M)},M.value))]}),k!==null&&o.jsxs("select",{className:"agent-select",value:l??"",disabled:f,onChange:M=>{M.target.value.length>0&&_(a?`/model --reasoning=${M.target.value}`:E0(M.target.value,i))},title:l===null?m("controls.effort.noData"):y?m("controls.effort.provisional",{effort:l}):b?m("controls.effort.inUseSaved",{effort:l,command:i}):m("controls.effort.inUse",{effort:l,command:i}),children:[l===null&&o.jsx("option",{value:"",children:m("controls.effort.placeholder")}),k.map(M=>o.jsx("option",{value:M.value,children:uC(M)},M.value))]})]})}function fC({mode:t,cycle:e,disabled:s,waitingFor:l=null,statusKnown:c=!0,onChange:y}){const b=mk(t,e);return o.jsx("select",{className:"agent-select agent-select-mode",value:b,disabled:s||Jg(e,l),onChange:i=>{Xs(i.target.value)&&y(i.target.value)},title:bk(b,e,c,l),children:e.modes.map(i=>o.jsx("option",{value:i,children:Qg(i)},i))})}const pC={"ask-for-approval":"controls.permission.askForApprovalHint",automatic:"controls.permission.automaticHint","read-only":"controls.permission.readOnlyHint","full-access":"controls.permission.fullAccessHint"},mC={unsupported:"controls.permission.error.unsupported",gone:"controls.permission.error.gone",review:"controls.permission.error.review",busy:"controls.permission.error.busy",waiting:"controls.permission.error.waiting","tool-pending":"controls.permission.error.toolPending","not-ready":"controls.permission.error.notReady",failed:"controls.permission.error.failed"};function gC({disabled:t,state:e,request:s,onChange:l}){const c=id(e),y=c??(e===null?"__unknown":"__custom"),b=(s==null?void 0:s.status)==="writing"||(s==null?void 0:s.status)==="awaiting";let i=null;return(s==null?void 0:s.status)==="writing"?i=m("controls.permission.pending"):(s==null?void 0:s.status)==="awaiting"?i=m("controls.permission.awaiting"):(s==null?void 0:s.status)==="unconfirmed"?i=m("controls.permission.unconfirmed"):(s==null?void 0:s.status)==="blocked"&&(i=m(s.reason===void 0?"controls.permission.error.failed":mC[s.reason])),o.jsxs("div",{className:"codex-permission-control",children:[o.jsxs("select",{className:"agent-select agent-select-permission",value:y,disabled:t||b,"aria-label":m("controls.permission.label"),title:m(c===null?"controls.permission.unknownHint":pC[c]),onChange:a=>{const f=a.target.value;(f==="ask-for-approval"||f==="automatic"||f==="read-only"||f==="full-access")&&l(f)},children:[c===null&&o.jsx("option",{value:e===null?"__unknown":"__custom",disabled:!0,children:m(e===null?"controls.permission.unknown":"controls.permission.custom")}),o.jsx("option",{value:"ask-for-approval",children:m("controls.permission.askForApproval")}),o.jsx("option",{value:"automatic",children:m("controls.permission.automatic")}),o.jsx("option",{value:"full-access",children:m("controls.permission.fullAccess")}),o.jsx("option",{value:"read-only",children:m("controls.permission.readOnly")})]}),i!==null&&o.jsx("span",{className:"codex-permission-status",role:"status",children:i})]})}function qo(t){const e=t.replace(/(\r?\n)+$/,"");return e.length===0?0:e.split(`
48
- `).length}function vC(t,e){return e===0?m("composer.chip.pastedTextEmpty",{number:t}):m("composer.chip.pastedText",{number:t,count:e})}function ov(t){return t.length===0?1:Math.max(...t)+1}function lv(t){const e=new Set;for(const s of t.matchAll(Ky()))e.add(Number(s[1]));return[...e].sort((s,l)=>s-l)}const _C=/[^\s([{"'¿¡«]/u,wC=/[\p{L}\p{N}]/u;function bC(t,e,s,l){const{start:c,end:y,before:b,after:i}=av(t,e,s),a=`${b!==""&&_C.test(b)?" ":""}${Hd(l)}${i!==""&&wC.test(i)?" ":""}`;return cv(t,c,y,a)}const yC=/[^\s([{¿¡«]/u,kC=/[\p{L}\p{N}"'«]/u;function Up(t,e,s,l){const{start:c,end:y,before:b,after:i}=av(t,e,s),a=b!==""&&yC.test(b),f=i===""||kC.test(i),_=`${a?" ":""}${l}${f?" ":""}`;return cv(t,c,y,_)}function av(t,e,s){const l=Math.max(0,Math.min(e,t.length)),c=Math.max(l,Math.min(s,t.length));return{start:l,end:c,before:l>0?t.charAt(l-1):"",after:c<t.length?t.charAt(c):""}}function cv(t,e,s,l){return{text:`${t.slice(0,e)}${l}${t.slice(s)}`,inserted:l,caret:e+l.length}}function uv(t,e){const s=new RegExp(`( ?)${xC(Hd(e))}( ?)`,"g");return t.replace(s,(l,c,y)=>c!==""&&y!==""?" ":"")}function Uo(t,e){let s=e;const l=[];for(const c of t){const y=c.text.replace(/\r\n?/g,`
49
- `).replace(/\n+$/,"");if(y.trim().length===0){s=uv(s,c.number);continue}l.push(`${Wy(c.number)}
50
- ${y}
51
- ${$y(c.number)}`)}return s.trim().length>0&&l.push(s),l.join(`
52
-
53
- `)}function CC(t,e=!1){const s=t.replace(/\r\n?/g,`
54
- `),l=[],c=a=>{const f=a.replace(/^\n+|\n+$/g,"");f.trim().length>0&&l.push({kind:"text",text:f})};let y=0;for(const a of s.matchAll(zy())){const f=a[1]??"",_=(a.index??0)+f.length;c(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?qy().exec(b):null;if(i!==null){const a=i.index+(i[1]??"").length;c(b.slice(0,a)),l.push({kind:"pasted",number:Number(i[2]),text:b.slice(i.index+i[0].length),complete:!1})}else c(b);return l.some(a=>a.kind==="pasted")?l:[{kind:"text",text:t}]}function xC(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const SC=800,Wp=256;function Na(t){return{text:t.text,pasted:t.items.flatMap(e=>e.kind==="text"?[{number:e.number,text:e.text}]:[])}}function EC(t,e){return{text:t.text,items:t.pasted.map(s=>({id:e(),kind:"text",number:s.number,text:s.text,lines:qo(s.text)}))}}function $p(t,e,s){const l=[...t.items.flatMap(i=>i.kind==="text"?[i.number]:[]),...lv(t.text)],c=[];for(const i of e.pasted){const a=ov([...l,...c.map(f=>f.kind==="text"?f.number:0)]);c.push({id:s(),kind:"text",number:a,text:i,lines:qo(i)})}const y=c.map(i=>i.kind==="text"?Hd(i.number):"").join(" "),b=y.length===0?e.text:`${e.text}
55
-
56
- ${y}`;return{text:zd(t.text,b),items:[...t.items,...c]}}function TC(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),c=Math.max(l,s(e.selectionEnd));return{start:l,end:c,direction:e.backward?"backward":"forward",scrollTop:Math.max(0,e.scrollTop)}}function LC(t){return jg(Na(t))>Ig}function Di(t,e){return t===void 0||Ma(t)?Ma(e):Dg(t,e)}const zp={text:"",pasted:[]};function NC(t,e,s){const l=EC(t,s),c=((e==null?void 0:e.items)??[]).filter(y=>y.kind!=="text");return{text:l.text,items:[...l.items,...c]}}class RC{constructor(e){Ut(this,"local",new Map);Ut(this,"sentDrafts",new Map);Ut(this,"failedPrefills",new Map);Ut(this,"views",new Map);Ut(this,"saved",new Map);Ut(this,"heard",new Map);Ut(this,"unconfirmed",new Map);Ut(this,"submitting",new Map);Ut(this,"pending",new Map);Ut(this,"listeners",new Set);Ut(this,"serverKeeps",!1);this.deps=e}get(e){return this.local.get(e)}put(e,s){this.local.set(e,s),this.schedule(e,Na(s))}rememberView(e,s){this.views.set(e,s)}viewOf(e){return this.views.get(e)}submitted(e,s,l,c){l!==void 0&&c!==void 0&&(this.sentDrafts.set(l,{terminalId:e,draft:c,prefillSeen:!1}),this.sentDrafts.size>Wp&&this.sentDrafts.delete(this.sentDrafts.keys().next().value)),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")}submittedAck(e,s,l){const c=this.sentDrafts.get(s);if(c===void 0||c.terminalId!==e||(this.sentDrafts.delete(s),l))return;c.prefillSeen||(this.failedPrefills.set(s,e),this.failedPrefills.size>Wp&&this.failedPrefills.delete(this.failedPrefills.keys().next().value));const y=this.local.get(e);let b=c.draft;if(y!==void 0&&(y.text.length>0||y.items.length>0)){const i=c.draft.items.flatMap(f=>f.kind==="text"?[{number:f.number,text:f.text}]:[]),a=Uo(i,c.draft.text);b={text:a.length===0?y.text:zd(y.text,a),items:[...c.draft.items.filter(f=>f.kind!=="text"),...y.items]}}this.put(e,b);for(const i of this.listeners)i(e)}consumeSubmitPrefill(e,s){if(s===void 0)return!1;const l=this.sentDrafts.get(s);return(l==null?void 0:l.terminalId)===e?(l.prefillSeen=!0,!0):this.failedPrefills.get(s)!==e?!1:(this.failedPrefills.delete(s),!0)}restore(e){const s=!this.serverKeeps;this.serverKeeps=!0;const l=[];for(const{terminalId:c,draft:y}of e)this.receive(c,y,s)&&l.push(c);for(const c of l)for(const y of this.listeners)y(c);for(const[c,y]of[...this.pending])y.handle===null&&this.sendNow(c)}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,c]of this.sentDrafts)s.has(c.terminalId)||this.sentDrafts.delete(l);for(const[l,c]of this.failedPrefills)s.has(c)||this.failedPrefills.delete(l);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 c=this.heard.get(e);if(this.heard.set(e,s),this.submitting.has(e)){if(!Ma(s))return!1;this.submitting.delete(e)}const y=this.unconfirmed.get(e);if(y!==void 0)if(Di(y,s))this.unconfirmed.delete(e);else if(l)if(Di(c,s)){this.unconfirmed.delete(e),this.setSaved(e,s);const f=this.local.get(e);return f!==void 0&&this.schedule(e,Na(f)),!1}else this.unconfirmed.delete(e);else return!1;const b=this.local.get(e),i=b===void 0?zp:Na(b),a=Di(this.saved.get(e),i);return this.setSaved(e,s),this.pending.has(e)||!a||Di(s,i)?!1:(this.local.set(e,NC(s,b,this.deps.newId)),this.views.delete(e),!0)}setSaved(e,s){Ma(s)?this.saved.delete(e):this.saved.set(e,s)}schedule(e,s){const l=this.pending.get(e);if(l!==void 0&&Dg(l.draft,s)||(this.cancel(e),Di(this.saved.get(e),s)))return;const c=this.deps.setTimer(()=>this.sendNow(e),this.deps.delayMs??SC);this.pending.set(e,{handle:c,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=jg(s.draft)>Ig?zp:s.draft;Di(this.saved.get(e),l)||(this.deps.send(e,l),this.unconfirmed.set(e,l),this.setSaved(e,l))}}const pd=1024,md=pd*1024,qp=md*1024;function Oi(t,e=0){return new Intl.NumberFormat(Qs(),{minimumFractionDigits:e,maximumFractionDigits:e,useGrouping:!1}).format(t)}function yn(t){return!Number.isFinite(t)||t<pd?m("format.bytes.b",{value:Oi(Math.max(0,Math.round(t)||0))}):t<md?m("format.bytes.kb",{value:Oi(Math.round(t/pd))}):t<qp?m("format.bytes.mb",{value:Oi(t/md,1)}):m("format.bytes.gb",{value:Oi(t/qp,2)})}function dv(t){const e=Math.floor(t/60),s=t%60;return s===0?m("format.duration.minutes",{value:e}):m("format.duration.minutesSeconds",{minutes:e,seconds:s})}function MC(t){if(t<1e3)return m("format.duration.ms",{value:t});const e=Math.round(t/1e3);return e<60?m("format.duration.seconds",{value:e}):dv(e)}function Ko(t){if(!Number.isFinite(t)||t<1e3)return m("format.duration.underSecond");const e=Math.round(t/1e3);return e<60?m("format.duration.seconds",{value:e}):dv(e)}function Jn(t,e=Date.now()){if(t<=0)return"";const s=Math.floor((e-t)/6e4);if(s<1)return m("time.justNow");if(s<60)return m("time.minutesAgo",{count:s});const l=Math.floor(s/60);if(l<24)return m("time.hoursAgo",{count:l});const c=Math.floor(l/24);return c<30?m("time.daysAgo",{count:c}):qd(t)}function qd(t){return new Date(t).toLocaleDateString(Qs())}function Fi(t){return new Date(t).toLocaleTimeString(Qs(),{hour:"2-digit",minute:"2-digit"})}function AC(t){return new Date(t).toLocaleString(Qs(),{weekday:"short",hour:"2-digit",minute:"2-digit"})}function Jo(t){return new Date(t).toLocaleString(Qs(),{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})}function Kd(t){const e=Math.floor(Math.max(0,t)/6e4);if(e<1)return m("format.timeLeft.underMinute");const s=Math.floor(e/1440),l=Math.floor(e%1440/60);return s>0?m("format.timeLeft.daysHours",{days:s,hours:l}):l>0?m("format.timeLeft.hoursMinutes",{hours:l,minutes:e%60}):m("format.timeLeft.minutes",{minutes:e})}function IC(t){return new Intl.NumberFormat(Qs(),{style:"percent",maximumFractionDigits:0}).format(t/100)}function kn(t){return new Intl.ListFormat(Qs(),{type:"conjunction"}).format(t)}var Vd=kg();function hv({src:t,caption:e,onClose:s}){return N.useEffect(()=>{const l=c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),s())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[s]),Vd.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:m("common.closeEsc"),children:"×"})]})]}),document.body)}const jC=/^([ \t]*)(\d{1,3})([.)])([ \t]+)/,DC=/^([ \t]*)([a-zA-Z])\)([ \t]+)/,PC=/^([ \t]*)([-*•])([ \t]+)/;function Kp(t){const e=jC.exec(t);if(e!==null){const[c,y="",b="",i=".",a=" "]=e;return{kind:"number",indent:y,value:Number(b),upper:!1,sep:i,space:a,length:c.length}}const s=DC.exec(t);if(s!==null){const[c,y="",b="a",i=" "]=s;return{kind:"letter",indent:y,value:b.toLowerCase().charCodeAt(0)-97,upper:b!==b.toLowerCase(),sep:")",space:i,length:c.length}}const l=PC.exec(t);if(l!==null){const[c,y="",b="-",i=" "]=l;return{kind:"bullet",indent:y,value:0,upper:!1,sep:b,space:i,length:c.length}}return null}function Vp(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 OC(t,e){return t.kind===e.kind&&t.indent===e.indent&&t.sep===e.sep&&t.upper===e.upper}function BC(t,e,s){if(e!==s)return null;const l=t.lastIndexOf(`
57
- `,e-1)+1,c=t.indexOf(`
58
- `,e),y=c===-1?t.length:c,b=t.slice(l,y),i=Kp(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=Vp(i,i.value+1);if(a===null)return null;let f="",_=y;if(i.kind!=="bullet"){let d=i.value+1;for(;_<t.length;){const k=_+1,E=t.indexOf(`
59
- `,k),M=E===-1?t.length:E,w=t.slice(k,M),h=Kp(w);if(h===null||!OC(i,h)||h.value!==d)break;const v=Vp(h,h.value+1);if(v===null)break;f+=`
60
- ${v}${w.slice(h.length)}`,d+=1,_=M}}return{from:e,to:_,text:`
61
- ${a}${t.slice(e,y)}${f}`,caret:e+1+a.length}}const FC=768,HC=`(max-width: ${FC}px)`,UC="(hover: none)",Gp="agent-workbench.narrow-view",fv="tab",pv=["chat","cli","git","files","plans","memory","notes","console"];function WC(t){return typeof t=="string"&&pv.includes(t)}function $C(t){return WC(t)?t:null}function zC(t){const e=t.hidden??new Set,s=l=>l==="chat"||l==="cli"||!e.has(l);return t.hasTab?pv.filter(l=>(l!=="plans"||t.plansAvailable)&&s(l)):["chat","notes"].filter(s)}function qC(t,e){return e.includes(t)?t:"chat"}function Yp(t){switch(t){case"cli":case"git":case"files":case"plans":case"memory":return t;default:return null}}const KC={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 VC(t){return KC[t]}const GC=/^[A-Za-z0-9_-]{1,80}$/;function YC(t){const e=new URLSearchParams(t).get(fv);return e!==null&&GC.test(e)?e:null}function XC(t,e){const s=new URLSearchParams(t);for(const c of e)s.delete(c);const l=s.toString();return l.length>0?`?${l}`:""}const QC=[{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 JC(t,e){return t.shiftKey||t.altKey?!1:!e||t.ctrlKey||t.metaKey}const ZC="AgentWorkbenchAndroid/",ex="agentworkbench://settings",tx="agentworkbench://disconnect",Xp="agentWorkbenchBack";function mv(t){return t.includes(ZC)}function nx(t){return t.dialogOpen?"close-dialog":t.sheetOpen?"close-sheet":t.drawerOpen?"close-drawer":t.view!=="chat"?"show-chat":null}function Qp(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 rx(t,e,s){const l=[];return t.forEach((c,y)=>{const b=e[c.imageId];if(typeof b!="string")return;const i=ix(b);i!==null&&l.push({...i,dataUrl:b,name:s(y)})}),l}function sx(t,e){return t.every(s=>e[s.imageId]!==void 0)}function ix(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 c=l.endsWith("==")?2:l.endsWith("=")?1:0;return{mediaType:s,base64:l,bytes:l.length/4*3-c}}function Mt(t){if(!Vw(t.key))return t.key;let e;if(t.params!==void 0){const s={};for(const[l,c]of Object.entries(t.params))s[l]=typeof c=="object"?Mt(c):c;e=s}return m(`server.${t.key}`,e)}const gv=3600*1e3;function vv(t){const e=new Date(t+gv);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 Ia(t){return String(t).padStart(2,"0")}function gd(t){const e=new Date(t);return`${e.getFullYear()}-${Ia(e.getMonth()+1)}-${Ia(e.getDate())}`}function ox(t){const e=new Date(t);return`${Ia(e.getHours())}:${Ia(e.getMinutes())}`}function lx(t){var s;const e=((s=vv(t)[1])==null?void 0:s.at)??t+24*gv;return{date:gd(e),time:ox(e)}}function ax(t){return{min:gd(t),max:gd(t+od)}}function cx(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[c,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 f=new Date(c,y-1,b,i,a,0,0);return f.getFullYear()!==c||f.getMonth()!==y-1||f.getDate()!==b?null:f.getTime()}function ux(t,e){return t===null?m("scheduled.menu.invalid"):t<=e?m("scheduled.menu.past"):t-e>od?m("scheduled.menu.tooFar",{days:Math.round(od/864e5)}):null}function dx(t,e){const s=Jo(t);return t>e?m("scheduled.when.ahead",{when:s,left:Kd(t-e)}):s}function hx(t,e){switch(t.state){case"scheduled":return m("scheduled.state.scheduled",{when:dx(t.sendAt,e)});case"waiting":return t.note===null?m("scheduled.state.due"):Mt(t.note);case"sending":return m("scheduled.state.sending");case"paused":return m("scheduled.state.paused",{when:Jo(t.sendAt)});case"failed":return t.note===null?m("scheduled.state.failed"):Mt(t.note)}}function fx(t,e){return t===null||e===null?[]:t.filter(s=>s.terminalId===e).sort((s,l)=>s.sendAt-l.sendAt)}function _v(t){if(t.length===0)return null;const e=t.filter(l=>l.state==="failed").length;if(e>0)return m("scheduled.tab.failed",{count:e});const s=t[0];return s===void 0?null:m("scheduled.tab.next",{count:t.length,when:Jo(s.sendAt)})}function px(t){return t.some(e=>e.state==="failed")}function mx(t){const e=t.filter(l=>l.state!=="failed"),s=e[0];return s===void 0?null:m("scheduled.close.warning",{count:e.length,when:Jo(s.sendAt)})}function gx(t){return t.state!=="sending"}const vx={"in-hour":"scheduled.menu.inHour","tomorrow-morning":"scheduled.menu.tomorrow"};function _x({anchor:t,onPick:e,onClose:s}){const[l]=N.useState(()=>Date.now()),c=N.useMemo(()=>vv(l),[l]),y=N.useMemo(()=>ax(l),[l]),[b,i]=N.useState(()=>lx(l)),a=cx(b.date,b.time),f=ux(a,Date.now()),[_,d]=N.useState(null),k=N.useRef(null),E=N.useRef(null),M=N.useRef(!1),w=N.useCallback(()=>{const h=k.current;if(h===null)return;const v=t.getBoundingClientRect(),g=h.getBoundingClientRect();d(tv({left:v.left,top:v.top,bottom:v.bottom},{width:g.width,height:g.height},{width:window.innerWidth,height:window.innerHeight}))},[t]);return N.useLayoutEffect(w,[w]),N.useEffect(()=>{var h;_===null||M.current||(M.current=!0,(h=E.current)==null||h.focus())},[_]),N.useEffect(()=>{const h=S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),s(),t.focus())},v=S=>{var L;const j=S.target;j instanceof Node&&((L=k.current)!=null&&L.contains(j)||t.contains(j))||s()},g=S=>{nv(S.target,t,k.current)&&s()},p=()=>{t.isConnected?w():s()};return window.addEventListener("keydown",h,!0),document.addEventListener("pointerdown",v,!0),window.addEventListener("scroll",g,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("keydown",h,!0),document.removeEventListener("pointerdown",v,!0),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",p)}},[t,s,w]),Vd.createPortal(o.jsxs("div",{ref:k,className:"schedule-menu",role:"dialog","aria-label":m("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:m("scheduled.menu.title")}),c.map((h,v)=>o.jsxs("button",{ref:v===0?E:void 0,className:"schedule-menu-item",onClick:()=>e(h.at),children:[o.jsx("span",{className:"schedule-menu-label",children:m(vx[h.id])}),o.jsx("span",{className:"schedule-menu-when",children:Jo(h.at)})]},h.id)),o.jsxs("div",{className:"schedule-menu-custom",children:[o.jsxs("label",{className:"schedule-menu-field",children:[o.jsx("span",{children:m("scheduled.menu.day")}),o.jsx("input",{type:"date",value:b.date,min:y.min,max:y.max,onChange:h=>i(v=>({...v,date:h.target.value}))})]}),o.jsxs("label",{className:"schedule-menu-field",children:[o.jsx("span",{children:m("scheduled.menu.time")}),o.jsx("input",{type:"time",value:b.time,onChange:h=>i(v=>({...v,time:h.target.value}))})]}),o.jsx("button",{className:"primary-button primary-button-small",disabled:f!==null||a===null,title:f??void 0,onClick:()=>{a!==null&&e(a)},children:m("scheduled.menu.schedule")})]}),f!==null&&o.jsx("p",{className:"schedule-menu-hint",children:f})]}),document.body)}const wx=6e4,bx=10*6e4,yx=15e3,kx=4e3,Cx=3,wv={runStartedAt:null,busySeenAt:null};function vd(){return`submit-${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}`}function xx(t,e){var l;let s=0;if(t!==null){const c=e.findIndex(y=>y.eventId===t);if(c===-1)return!0;s=c+1}for(let c=s;c<e.length;c+=1)if(((l=e[c])==null?void 0:l.role)==="assistant")return!0;return!1}function Sx(t,e,s,l){const c=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:c}}function Ex(t,e,s,l){const c=new Map;for(const[y,b]of e){const i=t.get(y),a=s.get(y);c.set(y,a!==void 0&&i===b?a:Sx(i,b,a??wv,l))}return c}function Tx(t,e){const s=new Map;for(const[l,c]of t)c.phase!=="sending"?s.set(l,c):c.queued&&s.set(l,{...c,queued:!1,sentAt:e});return s}function Lx(t,e,s){const l=t.get(e.terminalId);if(l===void 0||l.requestId!==e.requestId)return t;const c=new Map(t);return e.delivered?c.set(e.terminalId,{...l,phase:"delivered",queued:!1,deliveredAt:s}):c.delete(e.terminalId),c}function Nx(t){if(!t.live||t.waitingFor!==null)return null;const{receipt:e,activity:s,now:l}=t,c=t.clock??wv;if((e==null?void 0:e.phase)==="sending"&&(e.queued||l-e.sentAt<wx))return{kind:"sending"};const y=(e==null?void 0:e.phase)==="delivered"?e.deliveredAt:null;return s==="busy"?{kind:"working",since:c.runStartedAt,justDelivered:y!==null&&l-y<kx}:e===null||y===null||xx(e.afterEventId,t.events)?null:s==="unknown"?l-y<bx?{kind:"awaiting-reply",since:y}:null:s!=="idle"&&s!==null||c.busySeenAt!==null&&c.busySeenAt>=e.sentAt?null:l-y<yx?{kind:"delivered"}:null}function Rx(t,e){switch(t.kind){case"sending":return m("thread.status.sending");case"delivered":return m("thread.status.delivered");case"working":{const s=t.since===null?0:e-t.since;if(s<1e3)return t.justDelivered?m("thread.status.workingDelivered"):m("thread.status.working");const l={elapsed:Ko(s)};return t.justDelivered?m("thread.status.workingForDelivered",l):m("thread.status.workingFor",l)}case"awaiting-reply":{const s=e-t.since;return s<1e3?m("thread.status.delivered"):m("thread.status.awaitingReply",{elapsed:Ko(s)})}}}function Mx(t,e){const s=t.slice(0,Cx).map(c=>m("thread.status.subagent",{name:c.description.length>0?c.description:m("thread.status.subagentUnnamed"),elapsed:Ko(Math.max(0,e-c.startedAt))})),l=t.length-s.length;return l>0&&s.push(m("thread.status.subagentsMore",{count:l})),m("thread.status.subagents",{count:t.length,list:kn(s)})}const Ax=5,Ix=1200;function ya(){return crypto.randomUUID()}function jx(t=!0){const[e,s]=N.useState([]),[l,c]=N.useState(null),y=N.useCallback(w=>{if(e.filter(v=>v.kind==="image").length>=Po){c(m("composer.problem.tooManyImages",{count:Po}));return}if(w.size>Ys){const v=Math.round(w.size/1024/1024),g=Ys/1024/1024;c(w.name.length>0?m("composer.problem.tooBig",{name:w.name,size:v,max:g}):m("composer.problem.imageTooBig",{size:v,max:g}));return}const h=new FileReader;h.onload=()=>{const v=h.result;if(typeof v!="string")return;const g=v.indexOf(",");g!==-1&&s(p=>p.filter(S=>S.kind==="image").length>=Po?p:[...p,{id:ya(),kind:"image",mediaType:w.type,base64:v.slice(g+1),dataUrl:v,bytes:w.size,name:w.name.length>0?w.name:m("composer.pastedImage")}])},h.onerror=()=>c(m("composer.problem.imageUnreadable")),h.readAsDataURL(w)},[e]),b=N.useCallback(w=>{if(e.filter(v=>v.kind==="file").length>=Eu){c(m("composer.problem.tooManyFiles",{count:Eu}));return}if(w.size===0){c(m("composer.problem.empty",{name:w.name}));return}if(w.size>kp){c(m("composer.problem.tooBig",{name:w.name,size:Math.round(w.size/1024/1024),max:kp/1024/1024}));return}const h=new FileReader;h.onload=()=>{const v=h.result;if(typeof v!="string")return;const g=v.indexOf(",");g!==-1&&s(p=>p.filter(S=>S.kind==="file").length>=Eu?p:[...p,{id:ya(),kind:"file",name:w.name.length>0?w.name:"archivo",base64:v.slice(g+1),bytes:w.size}])},h.onerror=()=>c(m("composer.problem.unreadable",{name:w.name})),h.readAsDataURL(w)},[e]),i=N.useCallback(w=>{const h=Array.from(w),v=h.filter(p=>p.type.startsWith("image/")),g=h.filter(p=>!p.type.startsWith("image/"));if(v.length>0&&!t)c(jp());else for(const p of v)y(p);for(const p of g)b(p)},[y,b,t]),a=N.useCallback((w,h=[])=>{if(w.files.length>0)return i(w.files),{consumed:!0,pastedNumber:null};const v=w.getData("text/plain");if(v.length===0)return{consumed:!1,pastedNumber:null};if(v.split(`
64
- `).length<Ax&&v.length<Ix)return{consumed:!1,pastedNumber:null};const g=ov([...e.flatMap(p=>p.kind==="text"?[p.number]:[]),...h]);return s(p=>[...p,{id:ya(),kind:"text",number:g,text:v,lines:qo(v)}]),{consumed:!0,pastedNumber:g}},[i,e]),f=N.useCallback(w=>{if(w.length===0)return;if(!t){c(jp());return}const h=Po-e.filter(S=>S.kind==="image").length,v=w.filter(S=>S.bytes<=Ys),g=w.find(S=>S.bytes>Ys);g!==void 0&&c(m("composer.problem.imageTooBig",{size:Math.round(g.bytes/1024/1024),max:Ys/1024/1024})),v.length>h&&c(m("composer.problem.tooManyImages",{count:Po}));const p=v.slice(0,Math.max(0,h)).map(S=>({...S,id:ya(),kind:"image"}));p.length>0&&s(S=>[...S,...p])},[e,t]),_=N.useCallback(w=>{s(h=>h.filter(v=>v.id!==w))},[]),d=N.useCallback((w,h)=>{s(v=>v.map(g=>g.id===w&&g.kind==="text"?{...g,text:h,lines:qo(h)}:g))},[]),k=N.useCallback(w=>{s(w),c(null)},[]),E=N.useCallback(()=>k([]),[k]),M=N.useCallback(()=>c(null),[]);return{items:e,problem:l,acceptPaste:a,acceptFiles:i,acceptImages:f,remove:_,updateText:d,replace:k,clear:E,dismissProblem:M}}function Ra({min:t,max:e,value:s,measure:l,onChange:c,onCommit:y,onStart:b}){const i=N.useRef(!1),a=N.useRef(s),f=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 E=Math.min(e,Math.max(t,l(k)));a.current=E,c(E)},[e,t,l,c]),d=N.useCallback(k=>{i.current&&(i.current=!1,k.currentTarget.releasePointerCapture(k.pointerId),y(a.current))},[y]);return{onPointerDown:f,onPointerMove:_,onPointerUp:d,onPointerCancel:d}}function bv(t){const[e,s]=N.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return N.useEffect(()=>{const l=window.matchMedia(t),c=()=>s(l.matches);return c(),l.addEventListener("change",c),()=>l.removeEventListener("change",c)},[t]),e}function Dx(){return bv(HC)}function Px(){return bv(UC)}function Ox(t){if(t.disabled||t.text.length>0||t.attachments>0)return null;const e=t.suggestion??null;return e!==null&&e.trim().length>0?e:null}function Bx(t){return t.key==="Tab"&&!t.shiftKey&&!t.altKey&&!t.ctrlKey&&!t.metaKey&&!t.isComposing}function Jp(t,e,s){if((t.get(e)??null)===s)return t;const l=new Map(t);return s===null?l.delete(e):l.set(e,s),l}const yv="agent_workbench_prefs",_d="agent-workbench.",kv=/^[a-z0-9][a-z0-9.-]{0,59}$/,Cv=200,Fx=400*24*60*60,Hx=3500;function Ux(t){const e=new Map;for(const s of t.split(";")){const l=s.indexOf("=");if(l===-1||s.slice(0,l).trim()!==yv)continue;let c;try{c=JSON.parse(decodeURIComponent(s.slice(l+1).trim()))}catch{return e}if(c===null||typeof c!="object"||Array.isArray(c))return e;for(const[y,b]of Object.entries(c))!kv.test(y)||typeof b!="string"||b.length>Cv||e.set(`${_d}${y}`,b);return e}return e}function Wx(t){const e={};for(const[l,c]of t){if(!l.startsWith(_d))continue;const y=l.slice(_d.length);!kv.test(y)||c.length>Cv||(e[y]=c)}const s=encodeURIComponent(JSON.stringify(e));return s.length>Hx?null:s}function $x(t){return`${yv}=${t}; Path=/; Max-Age=${Fx}; SameSite=Strict`}function xv(){try{return Ux(document.cookie)}catch{return new Map}}function Sv(t,e){const s=xv();if(s.get(t)===e)return;s.set(t,e);const l=Wx(s);if(l!==null)try{document.cookie=$x(l)}catch{}}function jt(t,e,s){const l=xv().get(t);if(l!==void 0){const c=s(l);if(c!==null)return c}try{const c=window.localStorage.getItem(t);if(c===null)return e;const y=s(c);return y===null?e:(l===void 0&&Sv(t,c),y)}catch{return e}}function Lt(t,e){Sv(t,e);try{window.localStorage.setItem(t,e)}catch{}}function zx(t,e,s){const l=Number.parseInt(t,10);return Number.isFinite(l)&&l>=e&&l<=s?l:null}const Zp=90,qx=260,em=720,tm="agent-workbench.composer-height";function nm(t){return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd,backward:t.selectionDirection==="backward",scrollTop:t.scrollTop}}function Kx({connection:t,drafts:e,terminalId:s,alive:l,sleeping:c=!1,projectColor:y,activity:b,controls:i,leading:a,imagesAllowed:f=!0,blockedReason:_=null,prefills:d,onPrefillApplied:k,notice:E=null,onDismissNotice:M,onSubmitted:w,fontSize:h,insertRef:v,noteInsertRef:g,onEditQueue:p,onSchedule:S,codexQueueAvailable:j=!1,codexQueueSessionId:L=null,suggestion:R=null}){const[x,T]=N.useState(""),[I,O]=N.useState(!1),[P,F]=N.useState(null),[W,$]=N.useState(()=>new Map),[K,G]=N.useState(null),q=N.useRef(new Map),D=jx(f),U=N.useRef(null),H=Px(),z=Ox({suggestion:R,text:x,attachments:D.items.length,disabled:s===null||!l}),Z=N.useRef(z);Z.current=z;const[ie,ye]=N.useState(()=>jt(tm,qx,se=>zx(se,Zp,em))),[_e,Q]=N.useState(!1),Y=N.useCallback(()=>{const se=U.current;if(se===null)return;se.style.height="auto";const te=se.offsetHeight-se.clientHeight,ve=se.value.length===0?Z.current:null;ve!==null&&(se.value=ve);const st=se.scrollHeight+te;ve!==null&&(se.value="");const We=_e?ie:Math.min(st,ie);se.style.height=`${We}px`,se.style.overflowY=st>We?"auto":"hidden"},[ie,_e]);N.useEffect(Y,[x,Y,h,z]);const ne=N.useRef(0),ee=N.useRef(0),be=Ra({min:Zp,max:em,value:ie,measure:N.useCallback(se=>ne.current-se.clientY-ee.current,[]),onChange:ye,onCommit:N.useCallback(se=>{Q(!1),Lt(tm,String(se))},[]),onStart:N.useCallback(se=>{const te=U.current,ve=te==null?void 0:te.getBoundingClientRect();ne.current=(ve==null?void 0:ve.bottom)??se.clientY,ee.current=((ve==null?void 0:ve.bottom)??se.clientY)-se.clientY-((ve==null?void 0:ve.height)??0),Q(!0)},[])}),me=N.useRef(null),[Be,ze]=N.useState(0),Qe=N.useCallback(()=>ze(se=>se+1),[]),dt=N.useRef(x);dt.current=x;const Ie=N.useRef(D.items);Ie.current=D.items;const{replace:at}=D;N.useEffect(()=>t.onMessage(se=>{if(se.type!=="agent.codexQueueResult")return;const te=q.current.get(se.requestId);te===void 0||te!==se.terminalId||(q.current.delete(se.requestId),$(ve=>{const st=new Map(ve);return st.delete(se.requestId),st}),G({terminalId:se.terminalId,result:se.result}))}),[t]),N.useEffect(()=>{const se=me.current;se!==null&&e.put(se,{text:x,items:D.items})},[x,D.items,e]),N.useEffect(()=>{var ve;const se=me.current;if(se===s)return;if(me.current=s,se!==null){e.put(se,{text:dt.current,items:Ie.current});const st=U.current;st!==null&&e.rememberView(se,nm(st))}const te=s===null?void 0:e.get(s);T((te==null?void 0:te.text)??""),at((te==null?void 0:te.items)??[]),Qe(),s!==null&&((ve=U.current)==null||ve.focus())},[s,at,e,Qe]),N.useEffect(()=>()=>{const se=me.current;se!==null&&e.put(se,{text:dt.current,items:Ie.current})},[e]),N.useLayoutEffect(()=>()=>{const se=me.current,te=U.current;se!==null&&te!==null&&e.rememberView(se,nm(te))},[e]),N.useEffect(()=>{if(Be===0)return;const se=me.current,te=U.current;if(se===null||te===null)return;const ve=TC(te.value.length,e.viewOf(se));te.setSelectionRange(ve.start,ve.end,ve.direction),te.scrollTop=ve.scrollTop==="end"?te.scrollHeight:ve.scrollTop},[Be,e]),N.useEffect(()=>e.onRestored(se=>{if(se!==me.current)return;const te=e.get(se);te!==void 0&&(T(te.text),at(te.items),Qe())}),[e,at,Qe]);const xt=N.useRef(new Set);N.useEffect(()=>{var se;if(!(d===void 0||d.length===0)){for(const te of d)if(!xt.current.has(te.id)){if(xt.current.add(te.id),te.terminalId===me.current&&te.pasted.length===0)T(ve=>zd(ve,te.text)),te.focus&&((se=U.current)==null||se.focus());else if(te.terminalId===me.current){const ve=$p({text:dt.current,items:Ie.current},te,()=>crypto.randomUUID());T(ve.text),at(ve.items)}else{const ve=e.get(te.terminalId);e.put(te.terminalId,$p({text:(ve==null?void 0:ve.text)??"",items:(ve==null?void 0:ve.items)??[]},te,()=>crypto.randomUUID()))}k==null||k(te.id)}}},[d,k,e,at]);const oe=N.useCallback(()=>{if(s===null||_!==null)return;const se=D.items.filter(Je=>Je.kind==="text").map(Je=>({number:Je.number,text:Je.text})),te=D.items.filter(Je=>Je.kind==="image").map(Je=>({mediaType:Je.mediaType,data:Je.base64})),ve=D.items.filter(Je=>Je.kind==="file").map(Je=>({name:Je.name,data:Je.base64})),st=Uo(se,x);if(st.length===0&&te.length===0&&ve.length===0)return;const We=vd(),De=t.send({type:"agent.submit",terminalId:s,text:st,images:te,...ve.length>0?{files:ve}:{},requestId:We});e.submitted(s,De,We,{text:x,items:D.items}),T(""),D.clear(),w==null||w(s,We,!De)},[t,e,s,x,D,_,w]),je=N.useCallback(()=>{if(s===null||!j||L===null||_!==null||D.items.some(We=>We.kind!=="text"))return;const se=D.items.filter(We=>We.kind==="text").map(We=>({number:We.number,text:We.text})),te=Uo(se,x);if(te.trim().length===0||te.length>ku)return;const ve=vd(),st=t.send({type:"agent.codexQueue",terminalId:s,requestId:ve,text:te});q.current.set(ve,s),$(We=>new Map(We).set(ve,s)),G(null),e.submitted(s,st,ve,{text:x,items:D.items}),T(""),D.clear()},[s,j,L,_,D,x,t,e]),Ae=N.useCallback(se=>{if(F(null),s===null||S===void 0||D.items.some(We=>We.kind!=="text"))return;const te=D.items.filter(We=>We.kind==="text").map(We=>({number:We.number,text:We.text})),ve=Uo(te,x);if(ve.trim().length===0)return;const st=S(s,ve,se);e.submitted(s,st),T(""),D.clear()},[s,S,D,x,e]),Le=N.useCallback(()=>F(null),[]);N.useEffect(()=>F(null),[s]);const nt=S!==void 0;N.useEffect(()=>{nt||F(null)},[nt]);const Fe=N.useCallback(()=>{s!==null&&t.send({type:"agent.interrupt",terminalId:s})},[t,s]),Ke=N.useCallback((se,te)=>{se.setSelectionRange(te.from,te.to);let ve=!1;try{ve=te.text.length>0?document.execCommand("insertText",!1,te.text):document.execCommand("delete")}catch{ve=!1}ve||(se.setRangeText(te.text,te.from,te.to,"end"),T(se.value)),se.setSelectionRange(te.caret,te.caret)},[]),mt=N.useCallback(()=>{const se=Z.current,te=U.current;if(se===null||te===null)return;te.focus();let ve=!1;try{ve=document.execCommand("insertText",!1,se)}catch{ve=!1}ve||T(se)},[]),_t=N.useCallback(se=>{if(Z.current!==null&&Bx({key:se.key,shiftKey:se.shiftKey,altKey:se.altKey,ctrlKey:se.ctrlKey,metaKey:se.metaKey,isComposing:se.nativeEvent.isComposing})){se.preventDefault(),mt();return}if(se.key==="Enter"&&JC(se,H)){se.preventDefault(),oe();return}if(se.key==="Enter"&&!se.nativeEvent.isComposing){const te=se.currentTarget,ve=BC(te.value,te.selectionStart,te.selectionEnd);if(ve!==null){se.preventDefault(),Ke(te,ve);return}}if(se.key==="Escape"){se.preventDefault(),Fe();return}se.key==="ArrowUp"&&p!==void 0&&!se.shiftKey&&!se.altKey&&!se.ctrlKey&&!se.metaKey&&!se.nativeEvent.isComposing&&se.currentTarget.value.length===0&&D.items.length===0&&(se.preventDefault(),p())},[oe,Fe,H,Ke,p,D.items.length,mt]),Et=N.useCallback((se,te)=>{const{inserted:ve}=bC(se.value,se.selectionStart,se.selectionEnd,te);let st=!1;try{st=document.execCommand("insertText",!1,ve)}catch{st=!1}st||(se.setRangeText(ve,se.selectionStart,se.selectionEnd,"end"),T(se.value))},[]),ft=N.useCallback((se,te)=>{const ve=U.current;if(ve===null||ve.disabled){T(De=>Up(De,De.length,De.length,se).text);return}const{inserted:st}=Up(ve.value,ve.selectionStart,ve.selectionEnd,se);let We=!1;if(te){ve.focus();try{We=document.execCommand("insertText",!1,st)}catch{We=!1}}We||(ve.setRangeText(st,ve.selectionStart,ve.selectionEnd,"end"),T(ve.value))},[]);N.useEffect(()=>{if(v!==void 0)return v.current=ft,()=>{v.current===ft&&(v.current=null)}},[v,ft]);const{acceptImages:ct}=D,Ge=N.useCallback((se,te,ve)=>{const st=U.current;if(st===null||st.disabled)T(We=>{const De=Qp(We,se);return De===null?We:We.slice(0,De.from)+De.inserted});else{const We=Qp(st.value,se);if(We!==null){st.setSelectionRange(We.from,st.value.length);let De=!1;if(ve){st.focus();try{De=document.execCommand("insertText",!1,We.inserted)}catch{De=!1}}De||(st.setRangeText(We.inserted,We.from,st.value.length,"end"),T(st.value))}}ct(te)},[ct]);N.useEffect(()=>{if(g!==void 0)return g.current=Ge,()=>{g.current===Ge&&(g.current=null)}},[g,Ge]);const yt=N.useCallback(se=>{if(se.clipboardData===null)return;const te=D.acceptPaste(se.clipboardData,lv(se.currentTarget.value));te.consumed&&(se.preventDefault(),te.pastedNumber!==null&&Et(se.currentTarget,te.pastedNumber))},[D,Et]),Bt=N.useCallback(se=>{D.remove(se.id),se.kind==="text"&&T(te=>uv(te,se.number))},[D]),Wt=N.useRef(null),Ne=s===null||!l,He=x.trim().length>0||D.items.some(se=>se.kind!=="text"||se.text.trim().length>0),de=l&&b!=="idle",lt=He||!de,fe=LC({text:x,items:D.items}),$e=D.items.some(se=>se.kind!=="text")?m("scheduled.composer.onlyText"):He?null:m("scheduled.composer.empty"),rt=s!==null&&[...W.values()].includes(s),ke=D.items.some(se=>se.kind!=="text"),gt=Uo(D.items.filter(se=>se.kind==="text").map(se=>({number:se.number,text:se.text})),x),we=ke?m("composer.codexQueue.textOnly"):gt.length>ku?m("composer.codexQueue.tooLong",{max:ku}):_,Ue=(K==null?void 0:K.terminalId)!==s?null:K.result==="queued"?m("composer.codexQueue.queued"):K.result==="not-busy"?m("composer.codexQueue.notBusy"):K.result==="unavailable"?m("composer.codexQueue.unavailable"):m("composer.codexQueue.failed");return o.jsxs("div",{className:`composer${I?" composer-dragging":""}`,style:y===void 0?void 0:{"--composer-accent":y},onDragOver:se=>{Array.from(se.dataTransfer.types).includes("Files")&&(se.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:se=>{se.preventDefault(),O(!1),D.acceptFiles(se.dataTransfer.files)},children:[o.jsx("div",{className:"hdivider composer-divider",...be,title:m("composer.resizeTitle")}),E!==null&&o.jsxs("div",{className:"handoff-notice",role:"status",children:[o.jsxs("span",{className:"handoff-notice-text",children:[E.text,E.status!==null&&o.jsx("span",{className:"handoff-notice-status",children:E.status})]}),M!==void 0&&o.jsx("button",{className:"icon-button",onClick:M,title:m("common.dismissNotice"),children:"×"})]}),D.problem!==null&&o.jsxs("div",{className:"composer-problem",children:[o.jsx("span",{children:D.problem}),o.jsx("button",{className:"icon-button",onClick:D.dismissProblem,title:m("common.close"),children:"×"})]}),fe&&o.jsx("div",{className:"composer-problem",role:"status",children:o.jsx("span",{children:m("composer.problem.draftTooLong")})}),D.items.length>0&&o.jsx("div",{className:"composer-chips",children:D.items.map(se=>o.jsx(Vx,{item:se,onRemove:()=>Bt(se),onEdit:te=>D.updateText(se.id,te),onDoneEditing:()=>{var te;return(te=U.current)==null?void 0:te.focus()}},se.id))}),o.jsxs("div",{className:`composer-field${de&&lt||z!==null?" composer-field-two":""}`,children:[o.jsx("textarea",{ref:U,className:"composer-input",value:x,rows:1,placeholder:z!==null?z:m(Ne?c?"composer.placeholder.sleeping":"composer.placeholder.ended":"composer.placeholder.ready"),disabled:Ne,onChange:se=>T(se.target.value),onKeyDown:_t,onPaste:yt,spellCheck:!1}),o.jsxs("div",{className:"composer-field-actions",children:[z!==null&&(H?o.jsx("button",{className:"composer-icon composer-suggestion-use",onMouseDown:se=>se.preventDefault(),onClick:mt,title:m("composer.suggestion.use"),"aria-label":m("composer.suggestion.use"),children:o.jsx("span",{"aria-hidden":"true",children:"↗"})}):o.jsx("kbd",{className:"composer-suggestion-key",title:m("composer.suggestion.keyTitle"),children:m("composer.suggestion.key")})),de&&o.jsx("button",{className:"composer-icon composer-stop",onClick:Fe,disabled:Ne,title:m("composer.stopTitle"),"aria-label":m("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"})})}),lt&&o.jsx("button",{className:"composer-icon composer-send",onClick:oe,disabled:Ne||!He||_!==null,title:_??m("composer.sendTitle"),"aria-label":m("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:Wt,type:"file",multiple:!0,hidden:!0,onChange:se=>{se.target.files!==null&&D.acceptFiles(se.target.files),se.target.value=""}}),o.jsx("button",{className:"icon-button composer-attach",onClick:()=>{var se;return(se=Wt.current)==null?void 0:se.click()},disabled:Ne,title:m("composer.attachTitle"),"aria-label":m("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"})})}),S!==void 0&&o.jsx("button",{className:`icon-button composer-schedule${P!==null?" composer-schedule-open":""}`,onClick:se=>{const te=se.currentTarget;F(ve=>ve===null?te:null)},disabled:Ne||$e!==null,title:$e??m("scheduled.composer.title"),"aria-label":m("scheduled.composer.label"),"aria-haspopup":"dialog","aria-expanded":P!==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"})]})}),j&&o.jsx("button",{className:`icon-button composer-codex-queue${rt?" composer-codex-queue-pending":""}`,onClick:je,disabled:Ne||!He||we!==null||rt,title:rt?m("composer.codexQueue.pending"):we??m("composer.codexQueue.label"),"aria-label":m(rt?"composer.codexQueue.pending":"composer.codexQueue.label"),children:rt?"…":"↳"}),Ue!==null&&o.jsx("span",{className:"composer-codex-queue-status","aria-live":"polite",children:Ue}),P!==null&&o.jsx(_x,{anchor:P,onPick:Ae,onClose:Le}),a,o.jsx("span",{className:"composer-spacer"}),i]})]})}function Vx({item:t,onRemove:e,onEdit:s,onDoneEditing:l}){const[c,y]=N.useState(!1);if(t.kind==="image"){const b=`${t.name} · ${yn(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:m("composer.chip.remove"),children:"×"}),c&&o.jsx(hv,{src:t.dataUrl,caption:b,onClose:()=>y(!1)})]})}return t.kind==="file"?o.jsxs("div",{className:"chip chip-text chip-file",title:`${t.name} · ${yn(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:yn(t.bytes)})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:m("composer.chip.remove"),children:"×"})]}):o.jsxs("div",{className:`chip chip-text${c?" chip-open":""}`,children:[o.jsxs("button",{className:"chip-toggle",onClick:()=>y(b=>!b),title:m("composer.chip.editHint"),"aria-expanded":c,children:[o.jsx("span",{className:"chip-icon",children:"¶"}),vC(t.number,t.lines),o.jsx("span",{className:"chip-chevron",children:c?"▾":"▸"})]}),o.jsx("button",{className:"chip-remove",onClick:e,title:m("composer.chip.remove"),children:"×"}),c&&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":m("composer.chip.editorLabel",{number:t.number}),spellCheck:!1,autoFocus:!0})]})}var Nu={exports:{}},rm;function Gx(){return rm||(rm=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(c){this._terminal=c}dispose(){}fit(){const c=this.proposeDimensions();if(!c||!this._terminal||isNaN(c.cols)||isNaN(c.rows))return;const y=this._terminal._core;this._terminal.rows===c.rows&&this._terminal.cols===c.cols||(y._renderService.clear(),this._terminal.resize(c.cols,c.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const c=this._terminal._core,y=c._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;const b=this._terminal.options.scrollback===0?0:c.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(i.getPropertyValue("height")),f=Math.max(0,parseInt(i.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),d=a-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),k=f-(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(d/y.css.cell.height))}}}})(),s})()))})(Nu)),Nu.exports}var Yx=Gx(),Ru={exports:{}},sm;function Xx(){return sm||(sm=1,(function(t,e){(function(s,l){t.exports=l()})(self,(()=>(()=>{var s={6:(b,i)=>{function a(_){try{const d=new URL(_),k=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.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(_,d,k,E={}){this._terminal=_,this._regex=d,this._handler=k,this._options=E}provideLinks(_,d){const k=f.computeLink(_,this._regex,this._terminal,this._handler);d(this._addCallbacks(k))}_addCallbacks(_){return _.map((d=>(d.leave=this._options.leave,d.hover=(k,E)=>{if(this._options.hover){const{range:M}=d;this._options.hover(k,E,M)}},d)))}};class f{static computeLink(d,k,E,M){const w=new RegExp(k.source,(k.flags||"")+"g"),[h,v]=f._getWindowedLineStrings(d-1,E),g=h.join("");let p;const S=[];for(;p=w.exec(g);){const j=p[0];if(!a(j))continue;const[L,R]=f._mapStrIdx(E,v,0,p.index),[x,T]=f._mapStrIdx(E,L,R,j.length);if(L===-1||R===-1||x===-1||T===-1)continue;const I={start:{x:R+1,y:L+1},end:{x:T,y:x+1}};S.push({range:I,text:j,activate:M})}return S}static _getWindowedLineStrings(d,k){let E,M=d,w=d,h=0,v="";const g=[];if(E=k.buffer.active.getLine(d)){const p=E.translateToString(!0);if(E.isWrapped&&p[0]!==" "){for(h=0;(E=k.buffer.active.getLine(--M))&&h<2048&&(v=E.translateToString(!0),h+=v.length,g.push(v),E.isWrapped&&v.indexOf(" ")===-1););g.reverse()}for(g.push(p),h=0;(E=k.buffer.active.getLine(++w))&&E.isWrapped&&h<2048&&(v=E.translateToString(!0),h+=v.length,g.push(v),v.indexOf(" ")===-1););}return[g,M]}static _mapStrIdx(d,k,E,M){const w=d.buffer.active,h=w.getNullCell();let v=E;for(;M;){const g=w.getLine(k);if(!g)return[-1,-1];for(let p=v;p<g.length;++p){g.getCell(p,h);const S=h.getChars();if(h.getWidth()&&(M-=S.length||1,p===g.length-1&&S==="")){const j=w.getLine(k+1);j&&j.isWrapped&&(j.getCell(0,h),h.getWidth()===2&&(M+=1))}if(M<0)return[k,p]}k++,v=0}return[k,v]}}i.LinkComputer=f}},l={};function c(b){var i=l[b];if(i!==void 0)return i.exports;var a=l[b]={exports:{}};return s[b](a,a.exports,c),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.WebLinksAddon=void 0;const i=c(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(_,d){const k=window.open();if(k){try{k.opener=null}catch{}k.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}b.WebLinksAddon=class{constructor(_=f,d={}){this._handler=_,this._options=d}activate(_){this._terminal=_;const d=this._options,k=d.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new i.WebLinkProvider(this._terminal,k,this._handler,d))}dispose(){var _;(_=this._linkProvider)==null||_.dispose()}}})(),y})()))})(Ru)),Ru.exports}var Qx=Xx(),Mu={exports:{}},im;function Jx(){return im||(im=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 f=a(374),_=a(509),d=a(855),k=a(859),E=a(381),M=11,w=M*Float32Array.BYTES_PER_ELEMENT;let h,v=0,g=0,p=0;class S extends k.Disposable{constructor(L,R,x,T){super(),this._terminal=L,this._gl=R,this._dimensions=x,this._optionsService=T,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,f.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_IMAGE_UNITS))),_.TextureAtlas.maxTextureSize=(0,f.throwIfFalsy)(I.getParameter(I.MAX_TEXTURE_SIZE))),this._program=(0,f.throwIfFalsy)((0,E.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(K){let G="";for(let q=1;q<K;q++)G+=` else if (v_texpage == ${q}) { outColor = texture(u_texture[${q}], 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[${K}];
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,f.throwIfFalsy)(I.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,f.throwIfFalsy)(I.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,f.throwIfFalsy)(I.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=I.createVertexArray(),I.bindVertexArray(this._vertexArrayObject);const O=new Float32Array([0,0,1,0,0,1,1,1]),P=I.createBuffer();this.register((0,k.toDisposable)((()=>I.deleteBuffer(P)))),I.bindBuffer(I.ARRAY_BUFFER,P),I.bufferData(I.ARRAY_BUFFER,O,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,f.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 K=0;K<_.TextureAtlas.maxAtlasPages;K++)$[K]=K;I.uniform1iv(this._textureLocation,$),I.uniformMatrix4fv(this._projectionLocation,!1,E.PROJECTION_MATRIX),this._atlasTextures=[];for(let K=0;K<_.TextureAtlas.maxAtlasPages;K++){const G=new E.GLTexture((0,f.throwIfFalsy)(I.createTexture()));this.register((0,k.toDisposable)((()=>I.deleteTexture(G.texture)))),I.activeTexture(I.TEXTURE0+K),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[K]=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(L,R,x,T,I,O,P,F,W){this._updateCell(this._vertices.attributes,L,R,x,T,I,O,P,F,W)}_updateCell(L,R,x,T,I,O,P,F,W,$){v=(x*this._terminal.cols+R)*M,T!==d.NULL_CELL_CODE&&T!==void 0?this._atlas&&(h=F&&F.length>1?this._atlas.getRasterizedGlyphCombinedChar(F,I,O,P,!1):this._atlas.getRasterizedGlyph(T,I,O,P,!1),g=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),I!==$&&h.offset.x>g?(p=h.offset.x-g,L[v]=-(h.offset.x-p)+this._dimensions.device.char.left,L[v+1]=-h.offset.y+this._dimensions.device.char.top,L[v+2]=(h.size.x-p)/this._dimensions.device.canvas.width,L[v+3]=h.size.y/this._dimensions.device.canvas.height,L[v+4]=h.texturePage,L[v+5]=h.texturePositionClipSpace.x+p/this._atlas.pages[h.texturePage].canvas.width,L[v+6]=h.texturePositionClipSpace.y,L[v+7]=h.sizeClipSpace.x-p/this._atlas.pages[h.texturePage].canvas.width,L[v+8]=h.sizeClipSpace.y):(L[v]=-h.offset.x+this._dimensions.device.char.left,L[v+1]=-h.offset.y+this._dimensions.device.char.top,L[v+2]=h.size.x/this._dimensions.device.canvas.width,L[v+3]=h.size.y/this._dimensions.device.canvas.height,L[v+4]=h.texturePage,L[v+5]=h.texturePositionClipSpace.x,L[v+6]=h.texturePositionClipSpace.y,L[v+7]=h.sizeClipSpace.x,L[v+8]=h.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(0,f.allowRescaling)(T,W,h.size.x,this._dimensions.device.cell.width)&&(L[v+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):L.fill(0,v,v+M-1-2)}clear(){const L=this._terminal,R=L.cols*L.rows*M;this._vertices.count!==R?this._vertices.attributes=new Float32Array(R):this._vertices.attributes.fill(0);let x=0;for(;x<this._vertices.attributesBuffers.length;x++)this._vertices.count!==R?this._vertices.attributesBuffers[x]=new Float32Array(R):this._vertices.attributesBuffers[x].fill(0);this._vertices.count=R,x=0;for(let T=0;T<L.rows;T++)for(let I=0;I<L.cols;I++)this._vertices.attributes[x+9]=I/L.cols,this._vertices.attributes[x+10]=T/L.rows,x+=M}handleResize(){const L=this._gl;L.useProgram(this._program),L.viewport(0,0,L.canvas.width,L.canvas.height),L.uniform2f(this._resolutionLocation,L.canvas.width,L.canvas.height),this.clear()}render(L){if(!this._atlas)return;const R=this._gl;R.useProgram(this._program),R.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;const x=this._vertices.attributesBuffers[this._activeBuffer];let T=0;for(let I=0;I<L.lineLengths.length;I++){const O=I*this._terminal.cols*M,P=this._vertices.attributes.subarray(O,O+L.lineLengths[I]*M);x.set(P,T),T+=P.length}R.bindBuffer(R.ARRAY_BUFFER,this._attributesBuffer),R.bufferData(R.ARRAY_BUFFER,x.subarray(0,T),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,T/M)}setAtlas(L){this._atlas=L;for(const R of this._atlasTextures)R.version=-1}_bindAtlasPageTexture(L,R,x){L.activeTexture(L.TEXTURE0+x),L.bindTexture(L.TEXTURE_2D,this._atlasTextures[x].texture),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texImage2D(L.TEXTURE_2D,0,L.RGBA,L.RGBA,L.UNSIGNED_BYTE,R.pages[x].canvas),L.generateMipmap(L.TEXTURE_2D),this._atlasTextures[x].version=R.pages[x].version}setDimensions(L){this._dimensions=L}}i.GlyphRenderer=S},742:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RectangleRenderer=void 0;const f=a(374),_=a(859),d=a(310),k=a(381),E=8*Float32Array.BYTES_PER_ELEMENT;class M{constructor(){this.attributes=new Float32Array(160),this.count=0}}let w=0,h=0,v=0,g=0,p=0,S=0,j=0;class L extends _.Disposable{constructor(x,T,I,O){super(),this._terminal=x,this._gl=T,this._dimensions=I,this._themeService=O,this._vertices=new M,this._verticesCursor=new M;const P=this._gl;this._program=(0,f.throwIfFalsy)((0,k.createProgram)(P,`#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)((()=>P.deleteProgram(this._program)))),this._projectionLocation=(0,f.throwIfFalsy)(P.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=P.createVertexArray(),P.bindVertexArray(this._vertexArrayObject);const F=new Float32Array([0,0,1,0,0,1,1,1]),W=P.createBuffer();this.register((0,_.toDisposable)((()=>P.deleteBuffer(W)))),P.bindBuffer(P.ARRAY_BUFFER,W),P.bufferData(P.ARRAY_BUFFER,F,P.STATIC_DRAW),P.enableVertexAttribArray(3),P.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const $=new Uint8Array([0,1,2,3]),K=P.createBuffer();this.register((0,_.toDisposable)((()=>P.deleteBuffer(K)))),P.bindBuffer(P.ELEMENT_ARRAY_BUFFER,K),P.bufferData(P.ELEMENT_ARRAY_BUFFER,$,P.STATIC_DRAW),this._attributesBuffer=(0,f.throwIfFalsy)(P.createBuffer()),this.register((0,_.toDisposable)((()=>P.deleteBuffer(this._attributesBuffer)))),P.bindBuffer(P.ARRAY_BUFFER,this._attributesBuffer),P.enableVertexAttribArray(0),P.vertexAttribPointer(0,2,P.FLOAT,!1,E,0),P.vertexAttribDivisor(0,1),P.enableVertexAttribArray(1),P.vertexAttribPointer(1,2,P.FLOAT,!1,E,2*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(1,1),P.enableVertexAttribArray(2),P.vertexAttribPointer(2,4,P.FLOAT,!1,E,4*Float32Array.BYTES_PER_ELEMENT),P.vertexAttribDivisor(2,1),this._updateCachedColors(O.colors),this.register(this._themeService.onChangeColors((G=>{this._updateCachedColors(G),this._updateViewportRectangle()})))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(x){const T=this._gl;T.useProgram(this._program),T.bindVertexArray(this._vertexArrayObject),T.uniformMatrix4fv(this._projectionLocation,!1,k.PROJECTION_MATRIX),T.bindBuffer(T.ARRAY_BUFFER,this._attributesBuffer),T.bufferData(T.ARRAY_BUFFER,x.attributes,T.DYNAMIC_DRAW),T.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,T.UNSIGNED_BYTE,0,x.count)}handleResize(){this._updateViewportRectangle()}setDimensions(x){this._dimensions=x}_updateCachedColors(x){this._bgFloat=this._colorToFloat32Array(x.background),this._cursorFloat=this._colorToFloat32Array(x.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(x){const T=this._terminal,I=this._vertices;let O,P,F,W,$,K,G,q,D,U,H,z=1;for(O=0;O<T.rows;O++){for(F=-1,W=0,$=0,K=!1,P=0;P<T.cols;P++)G=(O*T.cols+P)*d.RENDER_MODEL_INDICIES_PER_CELL,q=x.cells[G+d.RENDER_MODEL_BG_OFFSET],D=x.cells[G+d.RENDER_MODEL_FG_OFFSET],U=!!(67108864&D),(q!==W||D!==$&&(K||U))&&((W!==0||K&&$!==0)&&(H=8*z++,this._updateRectangle(I,H,$,W,F,P,O)),F=P,W=q,$=D,K=U);(W!==0||K&&$!==0)&&(H=8*z++,this._updateRectangle(I,H,$,W,F,T.cols,O))}I.count=z}updateCursor(x){const T=this._verticesCursor,I=x.cursor;if(!I||I.style==="block")return void(T.count=0);let O,P=0;I.style!=="bar"&&I.style!=="outline"||(O=8*P++,this._addRectangleFloat(T.attributes,O,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"||(O=8*P++,this._addRectangleFloat(T.attributes,O,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"&&(O=8*P++,this._addRectangleFloat(T.attributes,O,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),O=8*P++,this._addRectangleFloat(T.attributes,O,(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)),T.count=P}_updateRectangle(x,T,I,O,P,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&O){case 16777216:case 33554432:w=this._themeService.colors.ansi[255&O].rgba;break;case 50331648:w=(16777215&O)<<8;break;default:w=this._themeService.colors.background.rgba}x.attributes.length<T+4&&(x.attributes=(0,k.expandFloat32Array)(x.attributes,this._terminal.rows*this._terminal.cols*8)),h=P*this._dimensions.device.cell.width,v=W*this._dimensions.device.cell.height,g=(w>>24&255)/255,p=(w>>16&255)/255,S=(w>>8&255)/255,j=1,this._addRectangle(x.attributes,T,h,v,(F-P)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,g,p,S,j)}_addRectangle(x,T,I,O,P,F,W,$,K,G){x[T]=I/this._dimensions.device.canvas.width,x[T+1]=O/this._dimensions.device.canvas.height,x[T+2]=P/this._dimensions.device.canvas.width,x[T+3]=F/this._dimensions.device.canvas.height,x[T+4]=W,x[T+5]=$,x[T+6]=K,x[T+7]=G}_addRectangleFloat(x,T,I,O,P,F,W){x[T]=I/this._dimensions.device.canvas.width,x[T+1]=O/this._dimensions.device.canvas.height,x[T+2]=P/this._dimensions.device.canvas.width,x[T+3]=F/this._dimensions.device.canvas.height,x[T+4]=W[0],x[T+5]=W[1],x[T+6]=W[2],x[T+7]=W[3]}_colorToFloat32Array(x){return new Float32Array([(x.rgba>>24&255)/255,(x.rgba>>16&255)/255,(x.rgba>>8&255)/255,(255&x.rgba)/255])}}i.RectangleRenderer=L},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 f=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,f.createSelectionRenderModel)()}resize(_,d){const k=_*d*i.RENDER_MODEL_INDICIES_PER_CELL;k!==this.cells.length&&(this.cells=new Uint32Array(k),this.lineLengths=new Uint32Array(d))}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 f=a(820),_=a(274),d=a(627),k=a(457),E=a(56),M=a(374),w=a(345),h=a(859),v=a(147),g=a(782),p=a(855),S=a(965),j=a(742),L=a(310),R=a(733);class x extends h.Disposable{constructor(P,F,W,$,K,G,q,D,U){super(),this._terminal=P,this._characterJoinerService=F,this._charSizeService=W,this._coreBrowserService=$,this._coreService=K,this._decorationService=G,this._optionsService=q,this._themeService=D,this._cursorBlinkStateManager=new h.MutableDisposable,this._charAtlasDisposable=this.register(new h.MutableDisposable),this._observerDisposable=this.register(new h.MutableDisposable),this._model=new L.RenderModel,this._workCell=new g.CellData,this._workCell2=new g.CellData,this._rectangleRenderer=this.register(new h.MutableDisposable),this._glyphRenderer=this.register(new h.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,q,this._themeService)],this.dimensions=(0,M.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(q.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,f.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,f.addDisposableDomListener)(this._canvas,"webglcontextrestored",(z=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,d.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()}))),this._observerDisposable.value=(0,E.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,((z,Z)=>this._setCanvasDevicePixelDimensions(z,Z))),this.register(this._coreBrowserService.onWindowChange((z=>{this._observerDisposable.value=(0,E.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,h.toDisposable)((()=>{var z;for(const Z of this._renderLayers)Z.dispose();(z=this._canvas.parentElement)==null||z.removeChild(this._canvas),(0,d.removeTerminalFromCache)(this._terminal)})))}get textureAtlas(){var P;return(P=this._charAtlas)==null?void 0:P.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(P,F){var W,$,K,G;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const q of this._renderLayers)q.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(),(K=this._glyphRenderer.value)==null||K.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 P;for(const F of this._renderLayers)F.handleBlur(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.pause(),this._requestRedrawViewport()}handleFocus(){var P;for(const F of this._renderLayers)F.handleFocus(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.resume(),this._requestRedrawViewport()}handleSelectionChanged(P,F,W){for(const $ of this._renderLayers)$.handleSelectionChanged(this._terminal,P,F,W);this._model.selection.update(this._core,P,F,W),this._requestRedrawViewport()}handleCursorMove(){var P;for(const F of this._renderLayers)F.handleCursorMove(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.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 S.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 P=(0,d.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!==P&&(this._onChangeTextureAtlas.fire(P.pages[0].canvas),this._charAtlasDisposable.value=(0,h.getDisposeArrayDisposable)([(0,w.forwardEvent)(P.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,w.forwardEvent)(P.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=P,this._charAtlas.warmUp(),(F=this._glyphRenderer.value)==null||F.setAtlas(this._charAtlas)}_clearModel(P){var F;this._model.clear(),P&&((F=this._glyphRenderer.value)==null||F.clear())}clearTextureAtlas(){var P;(P=this._charAtlas)==null||P.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var P;this._clearModel(!0);for(const F of this._renderLayers)F.reset(this._terminal);(P=this._cursorBlinkStateManager.value)==null||P.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(P){return-1}deregisterCharacterJoiner(P){return!1}renderRows(P,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,P,F);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(P,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(P,F){const W=this._core;let $,K,G,q,D,U,H,z,Z,ie,ye,_e,Q,Y,ne=this._workCell;P=I(P,W.rows-1,0),F=I(F,W.rows-1,0);const ee=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,be=ee-W.buffer.ydisp,me=Math.min(this._terminal.buffer.active.cursorX,W.cols-1);let Be=-1;const ze=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Qe=!1;for(K=P;K<=F;K++)for(G=K+W.buffer.ydisp,q=W.buffer.lines.get(G),this._model.lineLengths[K]=0,D=this._characterJoinerService.getJoinedCharacters(G),Q=0;Q<W.cols;Q++)if($=this._cellColorResolver.result.bg,q.loadCell(Q,ne),Q===0&&($=this._cellColorResolver.result.bg),U=!1,H=Q,D.length>0&&Q===D[0][0]&&(U=!0,z=D.shift(),ne=new T(ne,q.translateToString(!0,z[0],z[1]),z[1]-z[0]),H=z[1]-1),Z=ne.getChars(),ie=ne.getCode(),_e=(K*W.cols+Q)*L.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve(ne,Q,G,this.dimensions.device.cell.width),ze&&G===ee&&(Q===me&&(this._model.cursor={x:me,y:be,width:ne.getWidth(),style:this._coreBrowserService.isFocused?W.options.cursorStyle||"block":W.options.cursorInactiveStyle,cursorWidth:W.options.cursorWidth,dpr:this._devicePixelRatio},Be=me+ne.getWidth()-1),Q>=me&&Q<=Be&&(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!==p.NULL_CELL_CODE&&(this._model.lineLengths[K]=Q+1),(this._model.cells[_e]!==ie||this._model.cells[_e+L.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[_e+L.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[_e+L.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(Qe=!0,Z.length>1&&(ie|=L.COMBINED_CHAR_BIT_MASK),this._model.cells[_e]=ie,this._model.cells[_e+L.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[_e+L.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[_e+L.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,ye=ne.getWidth(),this._glyphRenderer.value.updateCell(Q,K,ie,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,Z,ye,$),U))for(ne=this._workCell,Q++;Q<H;Q++)Y=(K*W.cols+Q)*L.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(Q,K,p.NULL_CELL_CODE,0,0,0,p.NULL_CELL_CHAR,0,0),this._model.cells[Y]=p.NULL_CELL_CODE,this._model.cells[Y+L.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+L.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+L.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;Qe&&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(P,F){this._canvas.width===P&&this._canvas.height===F||(this._canvas.width=P,this._canvas.height=F,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const P=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:P,end:P})}}i.WebglRenderer=x;class T extends v.AttributeData{constructor(P,F,W){super(),this.content=0,this.combinedData="",this.fg=P.fg,this.bg=P.bg,this.combinedData=F,this._width=W}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()]}}function I(O,P,F=0){return Math.max(Math.min(O,P),F)}i.JoinedCellData=T},381:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.GLTexture=i.expandFloat32Array=i.createShader=i.createProgram=i.PROJECTION_MATRIX=void 0;const f=a(374);function _(d,k,E){const M=(0,f.throwIfFalsy)(d.createShader(k));if(d.shaderSource(M,E),d.compileShader(M),d.getShaderParameter(M,d.COMPILE_STATUS))return M;console.error(d.getShaderInfoLog(M)),d.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(d,k,E){const M=(0,f.throwIfFalsy)(d.createProgram());if(d.attachShader(M,(0,f.throwIfFalsy)(_(d,d.VERTEX_SHADER,k))),d.attachShader(M,(0,f.throwIfFalsy)(_(d,d.FRAGMENT_SHADER,E))),d.linkProgram(M),d.getProgramParameter(M,d.LINK_STATUS))return M;console.error(d.getProgramInfoLog(M)),d.deleteProgram(M)},i.createShader=_,i.expandFloat32Array=function(d,k){const E=Math.min(2*d.length,k),M=new Float32Array(E);for(let w=0;w<d.length;w++)M[w]=d[w];return M},i.GLTexture=class{constructor(d){this.texture=d,this.version=-1}}},592:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BaseRenderLayer=void 0;const f=a(627),_=a(237),d=a(374),k=a(859);class E extends k.Disposable{constructor(w,h,v,g,p,S,j,L){super(),this._container=h,this._alpha=p,this._coreBrowserService=S,this._optionsService=j,this._themeService=L,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-${v}-layer`),this._canvas.style.zIndex=g.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,d.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(w){}handleFocus(w){}handleCursorMove(w){}handleGridChanged(w,h,v){}handleSelectionChanged(w,h,v,g=!1){}_setTransparency(w,h){if(h===this._alpha)return;const v=this._canvas;this._alpha=h,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,v),this._refreshCharAtlas(w,this._themeService.colors),this.handleGridChanged(w,0,w.rows-1)}_refreshCharAtlas(w,h){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,f.acquireTextureAtlas)(w,this._optionsService.rawOptions,h,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(w,h){this._deviceCellWidth=h.device.cell.width,this._deviceCellHeight=h.device.cell.height,this._deviceCharWidth=h.device.char.width,this._deviceCharHeight=h.device.char.height,this._deviceCharLeft=h.device.char.left,this._deviceCharTop=h.device.char.top,this._canvas.width=h.device.canvas.width,this._canvas.height=h.device.canvas.height,this._canvas.style.width=`${h.css.canvas.width}px`,this._canvas.style.height=`${h.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(w,this._themeService.colors)}_fillBottomLineAtCells(w,h,v=1){this._ctx.fillRect(w*this._deviceCellWidth,(h+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,v*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,h,v,g){this._alpha?this._ctx.clearRect(w*this._deviceCellWidth,h*this._deviceCellHeight,v*this._deviceCellWidth,g*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(w*this._deviceCellWidth,h*this._deviceCellHeight,v*this._deviceCellWidth,g*this._deviceCellHeight))}_fillCharTrueColor(w,h,v,g){this._ctx.font=this._getFont(w,!1,!1),this._ctx.textBaseline=_.TEXT_BASELINE,this._clipCell(v,g,h.getWidth()),this._ctx.fillText(h.getChars(),v*this._deviceCellWidth+this._deviceCharLeft,g*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(w,h,v){this._ctx.beginPath(),this._ctx.rect(w*this._deviceCellWidth,h*this._deviceCellHeight,v*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(w,h,v){return`${v?"italic":""} ${h?w.options.fontWeightBold:w.options.fontWeight} ${w.options.fontSize*this._coreBrowserService.dpr}px ${w.options.fontFamily}`}}i.BaseRenderLayer=E},733:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.LinkRenderLayer=void 0;const f=a(197),_=a(237),d=a(592);class k extends d.BaseRenderLayer{constructor(M,w,h,v,g,p,S){super(h,M,"link",w,!0,g,p,S),this.register(v.onShowLinkUnderline((j=>this._handleShowLinkUnderline(j)))),this.register(v.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,f.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,f,_,d){a.addEventListener(f,_,d);let k=!1;return{dispose:()=>{k||(k=!0,a.removeEventListener(f,_,d))}}}},274:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellColorResolver=void 0;const f=a(855),_=a(160),d=a(374);let k,E=0,M=0,w=!1,h=!1,v=!1,g=0;i.CellColorResolver=class{constructor(p,S,j,L,R,x){this._terminal=p,this._optionService=S,this._selectionRenderModel=j,this._decorationService=L,this._coreBrowserService=R,this._themeService=x,this.result={fg:0,bg:0,ext:0}}resolve(p,S,j,L){if(this.result.bg=p.bg,this.result.fg=p.fg,this.result.ext=268435456&p.bg?p.extended.ext:0,M=0,E=0,h=!1,w=!1,v=!1,k=this._themeService.colors,g=0,p.getCode()!==f.NULL_CELL_CODE&&p.extended.underlineStyle===4){const R=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));g=S*L%(2*Math.round(R))}if(this._decorationService.forEachDecorationAtCell(S,j,"bottom",(R=>{R.backgroundColorRGB&&(M=R.backgroundColorRGB.rgba>>8&16777215,h=!0),R.foregroundColorRGB&&(E=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),v=this._selectionRenderModel.isCellSelected(this._terminal,S,j),v){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(h=!0,k.selectionForeground&&(E=k.selectionForeground.rgba>>8&16777215,w=!0),(0,d.treatGlyphAsBackgroundColor)(p.getCode())){if(67108864&this.result.fg&&(50331648&this.result.bg)==0)E=(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:E=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:E=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:E=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:E=(16777215&this.result.fg)<<8|255;break;default:E=this._themeService.colors.foreground.rgba}E=_.rgba.blend(E,4294967040&(this._coreBrowserService.isFocused?k.selectionBackgroundOpaque:k.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}w=!0}}this._decorationService.forEachDecorationAtCell(S,j,"top",(R=>{R.backgroundColorRGB&&(M=R.backgroundColorRGB.rgba>>8&16777215,h=!0),R.foregroundColorRGB&&(E=R.foregroundColorRGB.rgba>>8&16777215,w=!0)})),h&&(M=v?-16777216&p.bg&-134217729|M|50331648:-16777216&p.bg|M|50331648),w&&(E=-16777216&p.fg&-67108865|E|50331648),67108864&this.result.fg&&(h&&!w&&(E=(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),!h&&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,h=!0)),k=void 0,this.result.bg=h?M:this.result.bg,this.result.fg=w?E:this.result.fg,this.result.ext&=536870911,this.result.ext|=g<<29&3758096384}}},627:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.removeTerminalFromCache=i.acquireTextureAtlas=void 0;const f=a(509),_=a(197),d=[];i.acquireTextureAtlas=function(k,E,M,w,h,v,g,p){const S=(0,_.generateConfig)(w,h,v,g,E,M,p);for(let R=0;R<d.length;R++){const x=d[R],T=x.ownedBy.indexOf(k);if(T>=0){if((0,_.configEquals)(x.config,S))return x.atlas;x.ownedBy.length===1?(x.atlas.dispose(),d.splice(R,1)):x.ownedBy.splice(T,1);break}}for(let R=0;R<d.length;R++){const x=d[R];if((0,_.configEquals)(x.config,S))return x.ownedBy.push(k),x.atlas}const j=k._core,L={atlas:new f.TextureAtlas(document,S,j.unicodeService),config:S,ownedBy:[k]};return d.push(L),L.atlas},i.removeTerminalFromCache=function(k){for(let E=0;E<d.length;E++){const M=d[E].ownedBy.indexOf(k);if(M!==-1){d[E].ownedBy.length===1?(d[E].atlas.dispose(),d.splice(E,1)):d[E].ownedBy.splice(M,1);break}}}},197:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.is256Color=i.configEquals=i.generateConfig=void 0;const f=a(160);i.generateConfig=function(_,d,k,E,M,w,h){const v={foreground:w.foreground,background:w.background,cursor:f.NULL_COLOR,cursorAccent:f.NULL_COLOR,selectionForeground:f.NULL_COLOR,selectionBackgroundTransparent:f.NULL_COLOR,selectionBackgroundOpaque:f.NULL_COLOR,selectionInactiveBackgroundTransparent:f.NULL_COLOR,selectionInactiveBackgroundOpaque:f.NULL_COLOR,ansi:w.ansi.slice(),contrastCache:w.contrastCache,halfContrastCache:w.halfContrastCache};return{customGlyphs:M.customGlyphs,devicePixelRatio:h,letterSpacing:M.letterSpacing,lineHeight:M.lineHeight,deviceCellWidth:_,deviceCellHeight:d,deviceCharWidth:k,deviceCharHeight:E,fontFamily:M.fontFamily,fontSize:M.fontSize,fontWeight:M.fontWeight,fontWeightBold:M.fontWeightBold,allowTransparency:M.allowTransparency,drawBoldTextInBrightColors:M.drawBoldTextInBrightColors,minimumContrastRatio:M.minimumContrastRatio,colors:v}},i.configEquals=function(_,d){for(let k=0;k<_.colors.ansi.length;k++)if(_.colors.ansi[k].rgba!==d.colors.ansi[k].rgba)return!1;return _.devicePixelRatio===d.devicePixelRatio&&_.customGlyphs===d.customGlyphs&&_.lineHeight===d.lineHeight&&_.letterSpacing===d.letterSpacing&&_.fontFamily===d.fontFamily&&_.fontSize===d.fontSize&&_.fontWeight===d.fontWeight&&_.fontWeightBold===d.fontWeightBold&&_.allowTransparency===d.allowTransparency&&_.deviceCharWidth===d.deviceCharWidth&&_.deviceCharHeight===d.deviceCharHeight&&_.drawBoldTextInBrightColors===d.drawBoldTextInBrightColors&&_.minimumContrastRatio===d.minimumContrastRatio&&_.colors.foreground.rgba===d.colors.foreground.rgba&&_.colors.background.rgba===d.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 f=a(399);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},457:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CursorBlinkStateManager=void 0,i.CursorBlinkStateManager=class{constructor(a,f){this._renderCallback=a,this._coreBrowserService=f,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 f=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,f>0)return void this._restartInterval(f)}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 f=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(f)}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 f=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,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"║":{1:(w,h)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╒":{1:(w,h)=>`M.5,1 L.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╓":{1:(w,h)=>`M${.5-w},1 L${.5-w},.5 L1,.5 M${.5+w},.5 L${.5+w},1`},"╔":{1:(w,h)=>`M1,${.5-h} L${.5-w},${.5-h} L${.5-w},1 M1,${.5+h} L${.5+w},${.5+h} L${.5+w},1`},"╕":{1:(w,h)=>`M0,${.5-h} L.5,${.5-h} L.5,1 M0,${.5+h} L.5,${.5+h}`},"╖":{1:(w,h)=>`M${.5+w},1 L${.5+w},.5 L0,.5 M${.5-w},.5 L${.5-w},1`},"╗":{1:(w,h)=>`M0,${.5+h} L${.5-w},${.5+h} L${.5-w},1 M0,${.5-h} L${.5+w},${.5-h} L${.5+w},1`},"╘":{1:(w,h)=>`M.5,0 L.5,${.5+h} L1,${.5+h} M.5,${.5-h} L1,${.5-h}`},"╙":{1:(w,h)=>`M1,.5 L${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╚":{1:(w,h)=>`M1,${.5-h} L${.5+w},${.5-h} L${.5+w},0 M1,${.5+h} L${.5-w},${.5+h} L${.5-w},0`},"╛":{1:(w,h)=>`M0,${.5+h} L.5,${.5+h} L.5,0 M0,${.5-h} L.5,${.5-h}`},"╜":{1:(w,h)=>`M0,.5 L${.5+w},.5 L${.5+w},0 M${.5-w},.5 L${.5-w},0`},"╝":{1:(w,h)=>`M0,${.5-h} L${.5-w},${.5-h} L${.5-w},0 M0,${.5+h} L${.5+w},${.5+h} L${.5+w},0`},"╞":{1:(w,h)=>`M.5,0 L.5,1 M.5,${.5-h} L1,${.5-h} M.5,${.5+h} L1,${.5+h}`},"╟":{1:(w,h)=>`M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1 M${.5+w},.5 L1,.5`},"╠":{1:(w,h)=>`M${.5-w},0 L${.5-w},1 M1,${.5+h} L${.5+w},${.5+h} L${.5+w},1 M1,${.5-h} L${.5+w},${.5-h} L${.5+w},0`},"╡":{1:(w,h)=>`M.5,0 L.5,1 M0,${.5-h} L.5,${.5-h} M0,${.5+h} L.5,${.5+h}`},"╢":{1:(w,h)=>`M0,.5 L${.5-w},.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╣":{1:(w,h)=>`M${.5+w},0 L${.5+w},1 M0,${.5+h} L${.5-w},${.5+h} L${.5-w},1 M0,${.5-h} L${.5-w},${.5-h} L${.5-w},0`},"╤":{1:(w,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h} M.5,${.5+h} L.5,1`},"╥":{1:(w,h)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},1 M${.5+w},.5 L${.5+w},1`},"╦":{1:(w,h)=>`M0,${.5-h} L1,${.5-h} M0,${.5+h} L${.5-w},${.5+h} L${.5-w},1 M1,${.5+h} L${.5+w},${.5+h} L${.5+w},1`},"╧":{1:(w,h)=>`M.5,0 L.5,${.5-h} M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╨":{1:(w,h)=>`M0,.5 L1,.5 M${.5-w},.5 L${.5-w},0 M${.5+w},.5 L${.5+w},0`},"╩":{1:(w,h)=>`M0,${.5+h} L1,${.5+h} M0,${.5-h} L${.5-w},${.5-h} L${.5-w},0 M1,${.5-h} L${.5+w},${.5-h} L${.5+w},0`},"╪":{1:(w,h)=>`M.5,0 L.5,1 M0,${.5-h} L1,${.5-h} M0,${.5+h} L1,${.5+h}`},"╫":{1:(w,h)=>`M0,.5 L1,.5 M${.5-w},0 L${.5-w},1 M${.5+w},0 L${.5+w},1`},"╬":{1:(w,h)=>`M0,${.5+h} L${.5-w},${.5+h} L${.5-w},1 M1,${.5+h} L${.5+w},${.5+h} L${.5+w},1 M0,${.5-h} L${.5-w},${.5-h} L${.5-w},0 M1,${.5-h} L${.5+w},${.5-h} 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,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,1,.5`},"╮":{1:(w,h)=>`M.5,1 L.5,${.5+h/.15*.5} C.5,${.5+h/.15*.5},.5,.5,0,.5`},"╯":{1:(w,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.15*.5},.5,.5,0,.5`},"╰":{1:(w,h)=>`M.5,0 L.5,${.5-h/.15*.5} C.5,${.5-h/.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,h,v,g,p,S,j,L){const R=i.blockElementDefinitions[h];if(R)return(function(O,P,F,W,$,K){for(let G=0;G<P.length;G++){const q=P[G],D=$/8,U=K/8;O.fillRect(F+q.x*D,W+q.y*U,q.w*D,q.h*U)}})(w,R,v,g,p,S),!0;const x=_[h];if(x)return(function(O,P,F,W,$,K){let G=d.get(P);G||(G=new Map,d.set(P,G));const q=O.fillStyle;if(typeof q!="string")throw new Error(`Unexpected fillStyle type "${q}"`);let D=G.get(q);if(!D){const U=P[0].length,H=P.length,z=O.canvas.ownerDocument.createElement("canvas");z.width=U,z.height=H;const Z=(0,f.throwIfFalsy)(z.getContext("2d")),ie=new ImageData(U,H);let ye,_e,Q,Y;if(q.startsWith("#"))ye=parseInt(q.slice(1,3),16),_e=parseInt(q.slice(3,5),16),Q=parseInt(q.slice(5,7),16),Y=q.length>7&&parseInt(q.slice(7,9),16)||1;else{if(!q.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${q}" when drawing pattern glyph`);[ye,_e,Q,Y]=q.substring(5,q.length-1).split(",").map((ne=>parseFloat(ne)))}for(let ne=0;ne<H;ne++)for(let ee=0;ee<U;ee++)ie.data[4*(ne*U+ee)]=ye,ie.data[4*(ne*U+ee)+1]=_e,ie.data[4*(ne*U+ee)+2]=Q,ie.data[4*(ne*U+ee)+3]=P[ne][ee]*(255*Y);Z.putImageData(ie,0,0),D=(0,f.throwIfFalsy)(O.createPattern(z,null)),G.set(q,D)}O.fillStyle=D,O.fillRect(F,W,$,K)})(w,x,v,g,p,S),!0;const T=i.boxDrawingDefinitions[h];if(T)return(function(O,P,F,W,$,K,G){O.strokeStyle=O.fillStyle;for(const[q,D]of Object.entries(P)){let U;O.beginPath(),O.lineWidth=G*Number.parseInt(q),U=typeof D=="function"?D(.15,.15/K*$):D;for(const H of U.split(" ")){const z=H[0],Z=E[z];if(!Z){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&Z(O,M(ie,$,K,F,W,!0,G))}O.stroke(),O.closePath()}})(w,T,v,g,p,S,L),!0;const I=i.powerlineDefinitions[h];return!!I&&((function(O,P,F,W,$,K,G,q){const D=new Path2D;D.rect(F,W,$,K),O.clip(D),O.beginPath();const U=G/12;O.lineWidth=q*U;for(const H of P.d.split(" ")){const z=H[0],Z=E[z];if(!Z){console.error(`Could not find drawing instructions for "${z}"`);continue}const ie=H.substring(1).split(",");ie[0]&&ie[1]&&Z(O,M(ie,$,K,F,W,!1,q,(P.leftPadding??0)*(U/2),(P.rightPadding??0)*(U/2)))}P.type===1?(O.strokeStyle=O.fillStyle,O.stroke()):O.fill(),O.closePath()})(w,I,v,g,p,S,j,L),!0)};const d=new Map;function k(w,h,v=0){return Math.max(Math.min(w,h),v)}const E={C:(w,h)=>w.bezierCurveTo(h[0],h[1],h[2],h[3],h[4],h[5]),L:(w,h)=>w.lineTo(h[0],h[1]),M:(w,h)=>w.moveTo(h[0],h[1])};function M(w,h,v,g,p,S,j,L=0,R=0){const x=w.map((T=>parseFloat(T)||parseInt(T)));if(x.length<2)throw new Error("Too few arguments for instruction");for(let T=0;T<x.length;T+=2)x[T]*=h-L*j-R*j,S&&x[T]!==0&&(x[T]=k(Math.round(x[T]+.5)-.5,h,0)),x[T]+=g+L*j;for(let T=1;T<x.length;T+=2)x[T]*=v,S&&x[T]!==0&&(x[T]=k(Math.round(x[T]+.5)-.5,v,0)),x[T]+=p;return x}},56:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.observeDevicePixelDimensions=void 0;const f=a(859);i.observeDevicePixelDimensions=function(_,d,k){let E=new d.ResizeObserver((M=>{const w=M.find((g=>g.target===_));if(!w)return;if(!("devicePixelContentBoxSize"in w))return E==null||E.disconnect(),void(E=void 0);const h=w.devicePixelContentBoxSize[0].inlineSize,v=w.devicePixelContentBoxSize[0].blockSize;h>0&&v>0&&k(h,v)}));try{E.observe(_,{box:["device-pixel-content-box"]})}catch{E.disconnect(),E=void 0}return(0,f.toDisposable)((()=>E==null?void 0:E.disconnect()))}},374:(b,i)=>{function a(_){return 57508<=_&&_<=57558}function f(_){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=f,i.allowRescaling=function(_,d,k,E){return d===1&&k>Math.ceil(1.5*E)&&_!==void 0&&_>255&&!f(_)&&!a(_)&&!(function(M){return 57344<=M&&M<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return a(_)||(function(d){return 9472<=d&&d<=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(_,d,k=0){return(_-(2*Math.round(d)-k))%(2*Math.round(d))}},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(_,d,k,E=!1){if(this.selectionStart=d,this.selectionEnd=k,!d||!k||d[0]===k[0]&&d[1]===k[1])return void this.clear();const M=_.buffers.active.ydisp,w=d[1]-M,h=k[1]-M,v=Math.max(w,0),g=Math.min(h,_.rows-1);v>=_.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=w,this.viewportEndRow=h,this.viewportCappedStartRow=v,this.viewportCappedEndRow=g,this.startCol=d[0],this.endCol=k[0])}isCellSelected(_,d,k){return!!this.hasSelection&&(k-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&k>=this.viewportCappedStartRow&&d<this.endCol&&k<=this.viewportCappedEndRow:d<this.startCol&&k>=this.viewportCappedStartRow&&d>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol)}}i.createSelectionRenderModel=function(){return new a}},509:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TextureAtlas=void 0;const f=a(237),_=a(860),d=a(374),k=a(160),E=a(345),M=a(485),w=a(385),h=a(147),v=a(855),g={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 p;class S{get pages(){return this._pages}constructor(T,I,O){this._document=T,this._config=I,this._unicodeService=O,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 h.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new E.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new E.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=R(T,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,d.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const T of this.pages)T.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const T=new w.IdleTaskQueue;for(let I=33;I<126;I++)T.enqueue((()=>{if(!this._cacheMap.get(I,v.DEFAULT_COLOR,v.DEFAULT_COLOR,v.DEFAULT_EXT)){const O=this._drawToCache(I,v.DEFAULT_COLOR,v.DEFAULT_COLOR,v.DEFAULT_EXT);this._cacheMap.set(I,v.DEFAULT_COLOR,v.DEFAULT_COLOR,v.DEFAULT_EXT,O)}}))}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const T of this._pages)T.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(S.maxAtlasPages&&this._pages.length>=Math.max(4,S.maxAtlasPages)){const I=this._pages.filter((G=>2*G.canvas.width<=(S.maxTextureSize||4096))).sort(((G,q)=>q.canvas.width!==G.canvas.width?q.canvas.width-G.canvas.width:q.percentageUsed-G.percentageUsed));let O=-1,P=0;for(let G=0;G<I.length;G++)if(I[G].canvas.width!==P)O=G,P=I[G].canvas.width;else if(G-O==3)break;const F=I.slice(O,O+4),W=F.map((G=>G.glyphs[0].texturePage)).sort(((G,q)=>G>q?1:-1)),$=this.pages.length-F.length,K=this._mergePages(F,$);K.version++;for(let G=W.length-1;G>=0;G--)this._deletePage(W[G]);this.pages.push(K),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(K.canvas)}const T=new j(this._document,this._textureSize);return this._pages.push(T),this._activePages.push(T),this._onAddTextureAtlasCanvas.fire(T.canvas),T}_mergePages(T,I){const O=2*T[0].canvas.width,P=new j(this._document,O,T);for(const[F,W]of T.entries()){const $=F*W.canvas.width%O,K=Math.floor(F/2)*W.canvas.height;P.ctx.drawImage(W.canvas,$,K);for(const q of W.glyphs)q.texturePage=I,q.sizeClipSpace.x=q.size.x/O,q.sizeClipSpace.y=q.size.y/O,q.texturePosition.x+=$,q.texturePosition.y+=K,q.texturePositionClipSpace.x=q.texturePosition.x/O,q.texturePositionClipSpace.y=q.texturePosition.y/O;this._onRemoveTextureAtlasCanvas.fire(W.canvas);const G=this._activePages.indexOf(W);G!==-1&&this._activePages.splice(G,1)}return P}_deletePage(T){this._pages.splice(T,1);for(let I=T;I<this._pages.length;I++){const O=this._pages[I];for(const P of O.glyphs)P.texturePage--;O.version++}}getRasterizedGlyphCombinedChar(T,I,O,P,F){return this._getFromCacheMap(this._cacheMapCombined,T,I,O,P,F)}getRasterizedGlyph(T,I,O,P,F){return this._getFromCacheMap(this._cacheMap,T,I,O,P,F)}_getFromCacheMap(T,I,O,P,F,W=!1){return p=T.get(I,O,P,F),p||(p=this._drawToCache(I,O,P,F,W),T.set(I,O,P,F,p)),p}_getColorFromAnsiIndex(T){if(T>=this._config.colors.ansi.length)throw new Error("No color found for idx "+T);return this._config.colors.ansi[T]}_getBackgroundColor(T,I,O,P){if(this._config.allowTransparency)return k.NULL_COLOR;let F;switch(T){case 16777216:case 33554432:F=this._getColorFromAnsiIndex(I);break;case 50331648:const W=h.AttributeData.toColorRGB(I);F=k.channels.toColor(W[0],W[1],W[2]);break;default:F=O?k.color.opaque(this._config.colors.foreground):this._config.colors.background}return F}_getForegroundColor(T,I,O,P,F,W,$,K,G,q){const D=this._getMinimumContrastColor(T,I,O,P,F,W,$,G,K,q);if(D)return D;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=h.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)),K&&(U=k.color.multiplyOpacity(U,f.DIM_OPACITY)),U}_resolveBackgroundRgba(T,I,O){switch(T){case 16777216:case 33554432:return this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return O?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(T,I,O,P){switch(T){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&P&&I<8&&(I+=8),this._getColorFromAnsiIndex(I).rgba;case 50331648:return I<<8;default:return O?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(T,I,O,P,F,W,$,K,G,q){if(this._config.minimumContrastRatio===1||q)return;const D=this._getContrastCache(G),U=D.getColor(T,P);if(U!==void 0)return U||void 0;const H=this._resolveBackgroundRgba(I,O,$),z=this._resolveForegroundRgba(F,W,$,K),Z=k.rgba.ensureContrastRatio(H,z,this._config.minimumContrastRatio/(G?2:1));if(!Z)return void D.setColor(T,P,null);const ie=k.channels.toColor(Z>>24&255,Z>>16&255,Z>>8&255);return D.setColor(T,P,ie),ie}_getContrastCache(T){return T?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(T,I,O,P,F=!1){const W=typeof T=="number"?String.fromCharCode(T):T,$=Math.min(this._config.deviceCellWidth*Math.max(W.length,2)+4,this._textureSize);this._tmpCanvas.width<$&&(this._tmpCanvas.width=$);const K=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<K&&(this._tmpCanvas.height=K),this._tmpCtx.save(),this._workAttributeData.fg=O,this._workAttributeData.bg=I,this._workAttributeData.extended.ext=P,this._workAttributeData.isInvisible())return g;const G=!!this._workAttributeData.isBold(),q=!!this._workAttributeData.isInverse(),D=!!this._workAttributeData.isDim(),U=!!this._workAttributeData.isItalic(),H=!!this._workAttributeData.isUnderline(),z=!!this._workAttributeData.isStrikethrough(),Z=!!this._workAttributeData.isOverline();let ie=this._workAttributeData.getFgColor(),ye=this._workAttributeData.getFgColorMode(),_e=this._workAttributeData.getBgColor(),Q=this._workAttributeData.getBgColorMode();if(q){const Le=ie;ie=_e,_e=Le;const nt=ye;ye=Q,Q=nt}const Y=this._getBackgroundColor(Q,_e,q,D);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const ne=G?this._config.fontWeightBold:this._config.fontWeight,ee=U?"italic":"";this._tmpCtx.font=`${ee} ${ne} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=f.TEXT_BASELINE;const be=W.length===1&&(0,d.isPowerlineGlyph)(W.charCodeAt(0)),me=W.length===1&&(0,d.isRestrictedPowerlineGlyph)(W.charCodeAt(0)),Be=this._getForegroundColor(I,Q,_e,O,ye,ie,q,D,G,(0,d.treatGlyphAsBackgroundColor)(W.charCodeAt(0)));this._tmpCtx.fillStyle=Be.css;const ze=me?0:4;let Qe=!1;this._config.customGlyphs!==!1&&(Qe=(0,_.tryDrawCustomChar)(this._tmpCtx,W,ze,ze,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let dt,Ie=!be;if(dt=typeof T=="number"?this._unicodeService.wcwidth(T):this._unicodeService.getStringCellWidth(T),H){this._tmpCtx.save();const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),nt=Le%2==1?.5:0;if(this._tmpCtx.lineWidth=Le,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ie=!1,this._tmpCtx.strokeStyle=`rgb(${h.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ie=!1;let ft=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ft<8&&(ft+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ft).css}this._tmpCtx.beginPath();const Fe=ze,Ke=Math.ceil(ze+this._config.deviceCharHeight)-nt-(F?2*Le:0),mt=Ke+Le,_t=Ke+2*Le;let Et=this._workAttributeData.getUnderlineVariantOffset();for(let ft=0;ft<dt;ft++){this._tmpCtx.save();const ct=Fe+ft*this._config.deviceCellWidth,Ge=Fe+(ft+1)*this._config.deviceCellWidth,yt=ct+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ct,Ke),this._tmpCtx.lineTo(Ge,Ke),this._tmpCtx.moveTo(ct,_t),this._tmpCtx.lineTo(Ge,_t);break;case 3:const Bt=Le<=1?_t:Math.ceil(ze+this._config.deviceCharHeight-Le/2)-nt,Wt=Le<=1?Ke:Math.ceil(ze+this._config.deviceCharHeight+Le/2)-nt,Ne=new Path2D;Ne.rect(ct,Ke,this._config.deviceCellWidth,_t-Ke),this._tmpCtx.clip(Ne),this._tmpCtx.moveTo(ct-this._config.deviceCellWidth/2,mt),this._tmpCtx.bezierCurveTo(ct-this._config.deviceCellWidth/2,Wt,ct,Wt,ct,mt),this._tmpCtx.bezierCurveTo(ct,Bt,yt,Bt,yt,mt),this._tmpCtx.bezierCurveTo(yt,Wt,Ge,Wt,Ge,mt),this._tmpCtx.bezierCurveTo(Ge,Bt,Ge+this._config.deviceCellWidth/2,Bt,Ge+this._config.deviceCellWidth/2,mt);break;case 4:const He=Et===0?0:Et>=Le?2*Le-Et:Le-Et;Et>=Le||He===0?(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(ct+He,Ke),this._tmpCtx.lineTo(Ge,Ke)):(this._tmpCtx.setLineDash([Math.round(Le),Math.round(Le)]),this._tmpCtx.moveTo(ct,Ke),this._tmpCtx.lineTo(ct+He,Ke),this._tmpCtx.moveTo(ct+He+Le,Ke),this._tmpCtx.lineTo(Ge,Ke)),Et=(0,d.computeNextVariantOffset)(Ge-ct,Le,Et);break;case 5:const de=.6,lt=.3,fe=Ge-ct,Ce=Math.floor(de*fe),$e=Math.floor(lt*fe),rt=fe-Ce-$e;this._tmpCtx.setLineDash([Ce,$e,rt]),this._tmpCtx.moveTo(ct,Ke),this._tmpCtx.lineTo(Ge,Ke);break;default:this._tmpCtx.moveTo(ct,Ke),this._tmpCtx.lineTo(Ge,Ke)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Qe&&this._config.fontSize>=12&&!this._config.allowTransparency&&W!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const ft=this._tmpCtx.measureText(W);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ft&&ft.actualBoundingBoxDescent>0){this._tmpCtx.save();const ct=new Path2D;ct.rect(Fe,Ke-Math.ceil(Le/2),this._config.deviceCellWidth*dt,_t-Ke+Math.ceil(Le/2)),this._tmpCtx.clip(ct),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=Y.css,this._tmpCtx.strokeText(W,ze,ze+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(Z){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),nt=Le%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ze,ze+nt),this._tmpCtx.lineTo(ze+this._config.deviceCharWidth*dt,ze+nt),this._tmpCtx.stroke()}if(Qe||this._tmpCtx.fillText(W,ze,ze+this._config.deviceCharHeight),W==="_"&&!this._config.allowTransparency){let Le=L(this._tmpCtx.getImageData(ze,ze,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Be,Ie);if(Le)for(let nt=1;nt<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=Y.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(W,ze,ze+this._config.deviceCharHeight-nt),Le=L(this._tmpCtx.getImageData(ze,ze,this._config.deviceCellWidth,this._config.deviceCellHeight),Y,Be,Ie),Le);nt++);}if(z){const Le=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),nt=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=Le,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(ze,ze+Math.floor(this._config.deviceCharHeight/2)-nt),this._tmpCtx.lineTo(ze+this._config.deviceCharWidth*dt,ze+Math.floor(this._config.deviceCharHeight/2)-nt),this._tmpCtx.stroke()}this._tmpCtx.restore();const at=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let xt;if(xt=this._config.allowTransparency?(function(Le){for(let nt=0;nt<Le.data.length;nt+=4)if(Le.data[nt+3]>0)return!1;return!0})(at):L(at,Y,Be,Ie),xt)return g;const oe=this._findGlyphBoundingBox(at,this._workBoundingBox,$,me,Qe,ze);let je,Ae;for(;;){if(this._activePages.length===0){const Le=this._createNewPage();je=Le,Ae=Le.currentRow,Ae.height=oe.size.y;break}je=this._activePages[this._activePages.length-1],Ae=je.currentRow;for(const Le of this._activePages)oe.size.y<=Le.currentRow.height&&(je=Le,Ae=Le.currentRow);for(let Le=this._activePages.length-1;Le>=0;Le--)for(const nt of this._activePages[Le].fixedRows)nt.height<=Ae.height&&oe.size.y<=nt.height&&(je=this._activePages[Le],Ae=nt);if(Ae.y+oe.size.y>=je.canvas.height||Ae.height>oe.size.y+2){let Le=!1;if(je.currentRow.y+je.currentRow.height+oe.size.y>=je.canvas.height){let nt;for(const Fe of this._activePages)if(Fe.currentRow.y+Fe.currentRow.height+oe.size.y<Fe.canvas.height){nt=Fe;break}if(nt)je=nt;else if(S.maxAtlasPages&&this._pages.length>=S.maxAtlasPages&&Ae.y+oe.size.y<=je.canvas.height&&Ae.height>=oe.size.y&&Ae.x+oe.size.x<=je.canvas.width)Le=!0;else{const Fe=this._createNewPage();je=Fe,Ae=Fe.currentRow,Ae.height=oe.size.y,Le=!0}}Le||(je.currentRow.height>0&&je.fixedRows.push(je.currentRow),Ae={x:0,y:je.currentRow.y+je.currentRow.height,height:oe.size.y},je.fixedRows.push(Ae),je.currentRow={x:0,y:Ae.y+Ae.height,height:0})}if(Ae.x+oe.size.x<=je.canvas.width)break;Ae===je.currentRow?(Ae.x=0,Ae.y+=Ae.height,Ae.height=0):je.fixedRows.splice(je.fixedRows.indexOf(Ae),1)}return oe.texturePage=this._pages.indexOf(je),oe.texturePosition.x=Ae.x,oe.texturePosition.y=Ae.y,oe.texturePositionClipSpace.x=Ae.x/je.canvas.width,oe.texturePositionClipSpace.y=Ae.y/je.canvas.height,oe.sizeClipSpace.x/=je.canvas.width,oe.sizeClipSpace.y/=je.canvas.height,Ae.height=Math.max(Ae.height,oe.size.y),Ae.x+=oe.size.x,je.ctx.putImageData(at,oe.texturePosition.x-this._workBoundingBox.left,oe.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,oe.size.x,oe.size.y),je.addGlyph(oe),je.version++,oe}_findGlyphBoundingBox(T,I,O,P,F,W){I.top=0;const $=P?this._config.deviceCellHeight:this._tmpCanvas.height,K=P?this._config.deviceCellWidth:O;let G=!1;for(let q=0;q<$;q++){for(let D=0;D<K;D++){const U=q*this._tmpCanvas.width*4+4*D+3;if(T.data[U]!==0){I.top=q,G=!0;break}}if(G)break}I.left=0,G=!1;for(let q=0;q<W+K;q++){for(let D=0;D<$;D++){const U=D*this._tmpCanvas.width*4+4*q+3;if(T.data[U]!==0){I.left=q,G=!0;break}}if(G)break}I.right=K,G=!1;for(let q=W+K-1;q>=W;q--){for(let D=0;D<$;D++){const U=D*this._tmpCanvas.width*4+4*q+3;if(T.data[U]!==0){I.right=q,G=!0;break}}if(G)break}I.bottom=$,G=!1;for(let q=$-1;q>=0;q--){for(let D=0;D<K;D++){const U=q*this._tmpCanvas.width*4+4*D+3;if(T.data[U]!==0){I.bottom=q,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+(P||F?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-I.top+W+(P||F?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}i.TextureAtlas=S;class j{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(T){this._glyphs.push(T),this._usedPixels+=T.size.x*T.size.y}constructor(T,I,O){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],O)for(const P of O)this._glyphs.push(...P.glyphs),this._usedPixels+=P._usedPixels;this.canvas=R(T,I,I),this.ctx=(0,d.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 L(x,T,I,O){const P=T.rgba>>>24,F=T.rgba>>>16&255,W=T.rgba>>>8&255,$=I.rgba>>>24,K=I.rgba>>>16&255,G=I.rgba>>>8&255,q=Math.floor((Math.abs(P-$)+Math.abs(F-K)+Math.abs(W-G))/12);let D=!0;for(let U=0;U<x.data.length;U+=4)x.data[U]===P&&x.data[U+1]===F&&x.data[U+2]===W||O&&Math.abs(x.data[U]-P)+Math.abs(x.data[U+1]-F)+Math.abs(x.data[U+2]-W)<q?x.data[U+3]=0:D=!1;return D}function R(x,T,I){const O=x.createElement("canvas");return O.width=T,O.height=I,O}},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,f=0,_=0,d=0;var k,E,M,w,h;function v(p){const S=p.toString(16);return S.length<2?"0"+S:S}function g(p,S){return p<S?(S+.05)/(p+.05):(p+.05)/(S+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(S,j,L,R){return R!==void 0?`#${v(S)}${v(j)}${v(L)}${v(R)}`:`#${v(S)}${v(j)}${v(L)}`},p.toRgba=function(S,j,L,R=255){return(S<<24|j<<16|L<<8|R)>>>0},p.toColor=function(S,j,L,R){return{css:p.toCss(S,j,L,R),rgba:p.toRgba(S,j,L,R)}}})(k||(i.channels=k={})),(function(p){function S(j,L){return d=Math.round(255*L),[a,f,_]=h.toChannels(j.rgba),{css:k.toCss(a,f,_,d),rgba:k.toRgba(a,f,_,d)}}p.blend=function(j,L){if(d=(255&L.rgba)/255,d===1)return{css:L.css,rgba:L.rgba};const R=L.rgba>>24&255,x=L.rgba>>16&255,T=L.rgba>>8&255,I=j.rgba>>24&255,O=j.rgba>>16&255,P=j.rgba>>8&255;return a=I+Math.round((R-I)*d),f=O+Math.round((x-O)*d),_=P+Math.round((T-P)*d),{css:k.toCss(a,f,_),rgba:k.toRgba(a,f,_)}},p.isOpaque=function(j){return(255&j.rgba)==255},p.ensureContrastRatio=function(j,L,R){const x=h.ensureContrastRatio(j.rgba,L.rgba,R);if(x)return k.toColor(x>>24&255,x>>16&255,x>>8&255)},p.opaque=function(j){const L=(255|j.rgba)>>>0;return[a,f,_]=h.toChannels(L),{css:k.toCss(a,f,_),rgba:L}},p.opacity=S,p.multiplyOpacity=function(j,L){return d=255&j.rgba,S(j,d*L/255)},p.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(E||(i.color=E={})),(function(p){let S,j;try{const L=document.createElement("canvas");L.width=1,L.height=1;const R=L.getContext("2d",{willReadFrequently:!0});R&&(S=R,S.globalCompositeOperation="copy",j=S.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(L){if(L.match(/#[\da-f]{3,8}/i))switch(L.length){case 4:return a=parseInt(L.slice(1,2).repeat(2),16),f=parseInt(L.slice(2,3).repeat(2),16),_=parseInt(L.slice(3,4).repeat(2),16),k.toColor(a,f,_);case 5:return a=parseInt(L.slice(1,2).repeat(2),16),f=parseInt(L.slice(2,3).repeat(2),16),_=parseInt(L.slice(3,4).repeat(2),16),d=parseInt(L.slice(4,5).repeat(2),16),k.toColor(a,f,_,d);case 7:return{css:L,rgba:(parseInt(L.slice(1),16)<<8|255)>>>0};case 9:return{css:L,rgba:parseInt(L.slice(1),16)>>>0}}const R=L.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]),f=parseInt(R[2]),_=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),k.toColor(a,f,_,d);if(!S||!j)throw new Error("css.toColor: Unsupported css format");if(S.fillStyle=j,S.fillStyle=L,typeof S.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(S.fillRect(0,0,1,1),[a,f,_,d]=S.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(a,f,_,d),css:L}}})(M||(i.css=M={})),(function(p){function S(j,L,R){const x=j/255,T=L/255,I=R/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}p.relativeLuminance=function(j){return S(j>>16&255,j>>8&255,255&j)},p.relativeLuminance2=S})(w||(i.rgb=w={})),(function(p){function S(L,R,x){const T=L>>24&255,I=L>>16&255,O=L>>8&255;let P=R>>24&255,F=R>>16&255,W=R>>8&255,$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));for(;$<x&&(P>0||F>0||W>0);)P-=Math.max(0,Math.ceil(.1*P)),F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));return(P<<24|F<<16|W<<8|255)>>>0}function j(L,R,x){const T=L>>24&255,I=L>>16&255,O=L>>8&255;let P=R>>24&255,F=R>>16&255,W=R>>8&255,$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));for(;$<x&&(P<255||F<255||W<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));return(P<<24|F<<16|W<<8|255)>>>0}p.blend=function(L,R){if(d=(255&R)/255,d===1)return R;const x=R>>24&255,T=R>>16&255,I=R>>8&255,O=L>>24&255,P=L>>16&255,F=L>>8&255;return a=O+Math.round((x-O)*d),f=P+Math.round((T-P)*d),_=F+Math.round((I-F)*d),k.toRgba(a,f,_)},p.ensureContrastRatio=function(L,R,x){const T=w.relativeLuminance(L>>8),I=w.relativeLuminance(R>>8);if(g(T,I)<x){if(I<T){const F=S(L,R,x),W=g(T,w.relativeLuminance(F>>8));if(W<x){const $=j(L,R,x);return W>g(T,w.relativeLuminance($>>8))?F:$}return F}const O=j(L,R,x),P=g(T,w.relativeLuminance(O>>8));if(P<x){const F=S(L,R,x);return P>g(T,w.relativeLuminance(F>>8))?O:F}return O}},p.reduceLuminance=S,p.increaseLuminance=j,p.toChannels=function(L){return[L>>24&255,L>>16&255,L>>8&255,255&L]}})(h||(i.rgba=h={})),i.toPaddedHex=v,i.contrastRatio=g},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 f=0;f<this._listeners.length;f++)if(this._listeners[f]===a)return void this._listeners.splice(f,1)}}})),this._event}fire(a,f){const _=[];for(let d=0;d<this._listeners.length;d++)_.push(this._listeners[d]);for(let d=0;d<_.length;d++)_[d].call(void 0,a,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,f){return a((_=>f.fire(_)))},i.runAndSubscribe=function(a,f){return f(void 0),a((_=>f(_)))}},859:(b,i)=>{function a(f){for(const _ of f)_.dispose();f.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 f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const _=this._disposables.indexOf(f);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var _;this._isDisposed||f===this._value||((_=this._value)==null||_.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},i.toDisposable=function(f){return{dispose:f}},i.disposeArray=a,i.getDisposeArrayDisposable=function(f){return{dispose:()=>a(f)}}},485:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,d,k){this._data[_]||(this._data[_]={}),this._data[_][d]=k}get(_,d){return this._data[_]?this._data[_][d]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(f,_,d,k,E){this._data.get(f,_)||this._data.set(f,_,new a),this._data.get(f,_).set(d,k,E)}get(f,_,d,k){var E;return(E=this._data.get(f,_))==null?void 0:E.get(d,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,f=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(f),i.isIpad=f==="iPad",i.isIphone=f==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),i.isLinux=f.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 f=a(399);class _{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let M=0,w=0,h=E.timeRemaining(),v=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),v=E.timeRemaining(),1.5*w>v)return h-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-M))}ms`),void this._start();h=v}this.clear()}}class d extends _{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const M=Date.now()+E;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}i.PriorityTaskQueue=d,i.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:d,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 f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new a;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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 f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,k=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=k}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=f},782:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CellData=void 0;const f=a(133),_=a(855),d=a(147);class k extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.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,f.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 h=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const v=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(h-55296)+v-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,f=0,_=a.length){let d="";for(let k=f;k<_;++k){let E=a[k];E>65535?(E-=65536,d+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):d+=String.fromCharCode(E)}return d},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,f){const _=a.length;if(!_)return 0;let d=0,k=0;if(this._interim){const E=a.charCodeAt(k++);56320<=E&&E<=57343?f[d++]=1024*(this._interim-55296)+E-56320+65536:(f[d++]=this._interim,f[d++]=E),this._interim=0}for(let E=k;E<_;++E){const M=a.charCodeAt(E);if(55296<=M&&M<=56319){if(++E>=_)return this._interim=M,d;const w=a.charCodeAt(E);56320<=w&&w<=57343?f[d++]=1024*(M-55296)+w-56320+65536:(f[d++]=M,f[d++]=w)}else M!==65279&&(f[d++]=M)}return d}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,f){const _=a.length;if(!_)return 0;let d,k,E,M,w=0,h=0,v=0;if(this.interim[0]){let S=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let L,R=0;for(;(L=63&this.interim[++R])&&R<4;)j<<=6,j|=L;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=x-R;for(;v<T;){if(v>=_)return 0;if(L=a[v++],(192&L)!=128){v--,S=!0;break}this.interim[R++]=L,j<<=6,j|=63&L}S||(x===2?j<128?v--:f[w++]=j:x===3?j<2048||j>=55296&&j<=57343||j===65279||(f[w++]=j):j<65536||j>1114111||(f[w++]=j)),this.interim.fill(0)}const g=_-4;let p=v;for(;p<_;){for(;!(!(p<g)||128&(d=a[p])||128&(k=a[p+1])||128&(E=a[p+2])||128&(M=a[p+3]));)f[w++]=d,f[w++]=k,f[w++]=E,f[w++]=M,p+=4;if(d=a[p++],d<128)f[w++]=d;else if((224&d)==192){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(h=(31&d)<<6|63&k,h<128){p--;continue}f[w++]=h}else if((240&d)==224){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,w;if(E=a[p++],(192&E)!=128){p--;continue}if(h=(15&d)<<12|(63&k)<<6|63&E,h<2048||h>=55296&&h<=57343||h===65279)continue;f[w++]=h}else if((248&d)==240){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,w;if(E=a[p++],(192&E)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,this.interim[2]=E,w;if(M=a[p++],(192&M)!=128){p--;continue}if(h=(7&d)<<18|(63&k)<<12|(63&E)<<6|63&M,h<65536||h>1114111)continue;f[w++]=h}}return w}}},776:function(b,i,a){var f=this&&this.__decorate||function(h,v,g,p){var S,j=arguments.length,L=j<3?v:p===null?p=Object.getOwnPropertyDescriptor(v,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(h,v,g,p);else for(var R=h.length-1;R>=0;R--)(S=h[R])&&(L=(j<3?S(L):j>3?S(v,g,L):S(v,g))||L);return j>3&&L&&Object.defineProperty(v,g,L),L},_=this&&this.__param||function(h,v){return function(g,p){v(g,p,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const d=a(859),k=a(97),E={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 d.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let v=0;v<h.length;v++)typeof h[v]=="function"&&(h[v]=h[v]())}_log(h,v,g){this._evalLazyOptionalParams(g),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...g)}trace(h,...v){var g;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.trace.bind(this._optionsService.options.logger))??console.log,h,v)}debug(h,...v){var g;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.debug.bind(this._optionsService.options.logger))??console.log,h,v)}info(h,...v){var g;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.info.bind(this._optionsService.options.logger))??console.info,h,v)}warn(h,...v){var g;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.warn.bind(this._optionsService.options.logger))??console.warn,h,v)}error(h,...v){var g;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.error.bind(this._optionsService.options.logger))??console.error,h,v)}};i.LogService=w=f([_(0,k.IOptionsService)],w),i.setTraceLogger=function(h){M=h},i.traceCall=function(h,v,g){if(typeof g.value!="function")throw new Error("not supported");const p=g.value;g.value=function(...S){if(M.logLevel!==k.LogLevelEnum.TRACE)return p.apply(this,S);M.trace(`GlyphRenderer#${p.name}(${S.map((L=>JSON.stringify(L))).join(", ")})`);const j=p.apply(this,S);return M.trace(`GlyphRenderer#${p.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",f="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[f]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);const d=function(k,E,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,h,v){h[a]===h?h[f].push({id:w,index:v}):(h[f]=[{id:w,index:v}],h[a]=h)})(d,k,M)};return d.toString=()=>_,i.serviceRegistry.set(_,d),d}},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 f=a(726);var _;i.IBufferService=(0,f.createDecorator)("BufferService"),i.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),i.ICoreService=(0,f.createDecorator)("CoreService"),i.ICharsetService=(0,f.createDecorator)("CharsetService"),i.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(_||(i.LogLevelEnum=_={})),i.ILogService=(0,f.createDecorator)("LogService"),i.IOptionsService=(0,f.createDecorator)("OptionsService"),i.IOscLinkService=(0,f.createDecorator)("OscLinkService"),i.IUnicodeService=(0,f.createDecorator)("UnicodeService"),i.IDecorationService=(0,f.createDecorator)("DecorationService")}},l={};function c(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,c),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.WebglAddon=void 0;const i=c(345),a=c(859),f=c(399),_=c(666),d=c(776);class k extends a.Disposable{constructor(M){if(f.isSafari&&(0,f.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 h=w.coreService,v=w.optionsService,g=w,p=g._renderService,S=g._characterJoinerService,j=g._charSizeService,L=g._coreBrowserService,R=g._decorationService,x=g._logService,T=g._themeService;(0,d.setTraceLogger)(x),this._renderer=this.register(new _.WebglRenderer(M,S,j,L,h,R,v,T,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)),p.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})()))})(Mu)),Mu.exports}var Zx=Jx(),Au={exports:{}},om;function e1(){return om||(om=1,(function(t,e){(function(s,l){t.exports=l()})(globalThis,(()=>(()=>{var s={4567:function(b,i,a){var f=this&&this.__decorate||function(g,p,S,j){var L,R=arguments.length,x=R<3?p:j===null?j=Object.getOwnPropertyDescriptor(p,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,S,j);else for(var T=g.length-1;T>=0;T--)(L=g[T])&&(x=(R<3?L(x):R>3?L(p,S,x):L(p,S))||x);return R>3&&x&&Object.defineProperty(p,S,x),x},_=this&&this.__param||function(g,p){return function(S,j){p(S,j,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.AccessibilityManager=void 0;const d=a(9042),k=a(9924),E=a(844),M=a(4725),w=a(2585),h=a(3656);let v=i.AccessibilityManager=class extends E.Disposable{constructor(g,p,S,j){super(),this._terminal=g,this._coreBrowserService=S,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 L=0;L<this._terminal.rows;L++)this._rowElements[L]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[L]);if(this._topBoundaryFocusListener=L=>this._handleBoundaryFocus(L,0),this._bottomBoundaryFocusListener=L=>this._handleBoundaryFocus(L,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((L=>this._handleResize(L.rows)))),this.register(this._terminal.onRender((L=>this._refreshRows(L.start,L.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((L=>this._handleChar(L)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
122
- `)))),this.register(this._terminal.onA11yTab((L=>this._handleTab(L)))),this.register(this._terminal.onKey((L=>this._handleKey(L.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,h.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,E.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(g){for(let p=0;p<g;p++)this._handleChar(" ")}_handleChar(g){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==g&&(this._charsToAnnounce+=g):this._charsToAnnounce+=g,g===`
123
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(g){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(g)||this._charsToConsume.push(g)}_refreshRows(g,p){this._liveRegionDebouncer.refresh(g,p,this._terminal.rows)}_renderRows(g,p){const S=this._terminal.buffer,j=S.lines.length.toString();for(let L=g;L<=p;L++){const R=S.lines.get(S.ydisp+L),x=[],T=(R==null?void 0:R.translateToString(!0,void 0,void 0,x))||"",I=(S.ydisp+L+1).toString(),O=this._rowElements[L];O&&(T.length===0?(O.innerText=" ",this._rowColumns.set(O,[0,1])):(O.textContent=T,this._rowColumns.set(O,x)),O.setAttribute("aria-posinset",I),O.setAttribute("aria-setsize",j))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(g,p){const S=g.target,j=this._rowElements[p===0?1:this._rowElements.length-2];if(S.getAttribute("aria-posinset")===(p===0?"1":`${this._terminal.buffer.lines.length}`)||g.relatedTarget!==j)return;let L,R;if(p===0?(L=S,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(L=this._rowElements.shift(),R=S,this._rowContainer.removeChild(L)),L.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),p===0){const x=this._createAccessibilityTreeNode();this._rowElements.unshift(x),this._rowContainer.insertAdjacentElement("afterbegin",x)}else{const x=this._createAccessibilityTreeNode();this._rowElements.push(x),this._rowContainer.appendChild(x)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(p===0?-1:1),this._rowElements[p===0?1:this._rowElements.length-2].focus(),g.preventDefault(),g.stopImmediatePropagation()}_handleSelectionChange(){var T;if(this._rowElements.length===0)return;const g=document.getSelection();if(!g)return;if(g.isCollapsed)return void(this._rowContainer.contains(g.anchorNode)&&this._terminal.clearSelection());if(!g.anchorNode||!g.focusNode)return void console.error("anchorNode and/or focusNode are null");let p={node:g.anchorNode,offset:g.anchorOffset},S={node:g.focusNode,offset:g.focusOffset};if((p.node.compareDocumentPosition(S.node)&Node.DOCUMENT_POSITION_PRECEDING||p.node===S.node&&p.offset>S.offset)&&([p,S]=[S,p]),p.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(p={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(p.node))return;const j=this._rowElements.slice(-1)[0];if(S.node.compareDocumentPosition(j)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(S={node:j,offset:((T=j.textContent)==null?void 0:T.length)??0}),!this._rowContainer.contains(S.node))return;const L=({node:I,offset:O})=>{const P=I instanceof Text?I.parentNode:I;let F=parseInt(P==null?void 0:P.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const W=this._rowColumns.get(P);if(!W)return console.warn("columns is null. Race condition?"),null;let $=O<W.length?W[O]:W.slice(-1)[0]+1;return $>=this._terminal.cols&&(++F,$=0),{row:F,column:$}},R=L(p),x=L(S);if(R&&x){if(R.row>x.row||R.row===x.row&&R.column>=x.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(x.row-R.row)*this._terminal.cols-R.column+x.column)}}_handleResize(g){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let p=this._rowContainer.children.length;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const g=this._coreBrowserService.mainDocument.createElement("div");return g.setAttribute("role","listitem"),g.tabIndex=-1,this._refreshRowDimensions(g),g}_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 g=0;g<this._terminal.rows;g++)this._refreshRowDimensions(this._rowElements[g])}}_refreshRowDimensions(g){g.style.height=`${this._renderService.dimensions.css.cell.height}px`}};i.AccessibilityManager=v=f([_(1,w.IInstantiationService),_(2,M.ICoreBrowserService),_(3,M.IRenderService)],v)},3614:(b,i)=>{function a(k){return k.replace(/\r?\n/g,"\r")}function f(k,E){return E?"\x1B[200~"+k+"\x1B[201~":k}function _(k,E,M,w){k=f(k=a(k),M.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),M.triggerDataEvent(k,!0),E.value=""}function d(k,E,M){const w=M.getBoundingClientRect(),h=k.clientX-w.left-10,v=k.clientY-w.top-10;E.style.width="20px",E.style.height="20px",E.style.left=`${h}px`,E.style.top=`${v}px`,E.style.zIndex="1000",E.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=f,i.copyHandler=function(k,E){k.clipboardData&&k.clipboardData.setData("text/plain",E.selectionText),k.preventDefault()},i.handlePasteEvent=function(k,E,M,w){k.stopPropagation(),k.clipboardData&&_(k.clipboardData.getData("text/plain"),E,M,w)},i.paste=_,i.moveTextAreaUnderMouseCursor=d,i.rightClickHandler=function(k,E,M,w,h){d(k,E,M),h&&w.rightClickSelect(k),E.value=w.selectionText,E.select()}},7239:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ColorContrastCache=void 0;const f=a(1505);i.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(_,d,k){this._css.set(_,d,k)}getCss(_,d){return this._css.get(_,d)}setColor(_,d,k){this._color.set(_,d,k)}getColor(_,d){return this._color.get(_,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.addDisposableDomListener=void 0,i.addDisposableDomListener=function(a,f,_,d){a.addEventListener(f,_,d);let k=!1;return{dispose:()=>{k||(k=!0,a.removeEventListener(f,_,d))}}}},3551:function(b,i,a){var f=this&&this.__decorate||function(v,g,p,S){var j,L=arguments.length,R=L<3?g:S===null?S=Object.getOwnPropertyDescriptor(g,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,g,p,S);else for(var x=v.length-1;x>=0;x--)(j=v[x])&&(R=(L<3?j(R):L>3?j(g,p,R):j(g,p))||R);return L>3&&R&&Object.defineProperty(g,p,R),R},_=this&&this.__param||function(v,g){return function(p,S){g(p,S,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Linkifier=void 0;const d=a(3656),k=a(8460),E=a(844),M=a(2585),w=a(4725);let h=i.Linkifier=class extends E.Disposable{get currentLink(){return this._currentLink}constructor(v,g,p,S,j){super(),this._element=v,this._mouseService=g,this._renderService=p,this._bufferService=S,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,E.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,E.toDisposable)((()=>{var L;this._lastMouseEvent=void 0,(L=this._activeProviderReplies)==null||L.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(v){this._lastMouseEvent=v;const g=this._positionFromMouseEvent(v,this._element,this._mouseService);if(!g)return;this._isMouseOut=!1;const p=v.composedPath();for(let S=0;S<p.length;S++){const j=p[S];if(j.classList.contains("xterm"))break;if(j.classList.contains("xterm-hover"))return}this._lastBufferCell&&g.x===this._lastBufferCell.x&&g.y===this._lastBufferCell.y||(this._handleHover(g),this._lastBufferCell=g)}_handleHover(v){if(this._activeLine!==v.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(v,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,v)||(this._clearCurrentLink(),this._askForLink(v,!0))}_askForLink(v,g){var S,j;this._activeProviderReplies&&g||((S=this._activeProviderReplies)==null||S.forEach((L=>{L==null||L.forEach((R=>{R.link.dispose&&R.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=v.y);let p=!1;for(const[L,R]of this._linkProviderService.linkProviders.entries())g?(j=this._activeProviderReplies)!=null&&j.get(L)&&(p=this._checkLinkProviderResult(L,v,p)):R.provideLinks(v.y,(x=>{var I,O;if(this._isMouseOut)return;const T=x==null?void 0:x.map((P=>({link:P})));(I=this._activeProviderReplies)==null||I.set(L,T),p=this._checkLinkProviderResult(L,v,p),((O=this._activeProviderReplies)==null?void 0:O.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(v.y,this._activeProviderReplies)}))}_removeIntersectingLinks(v,g){const p=new Set;for(let S=0;S<g.size;S++){const j=g.get(S);if(j)for(let L=0;L<j.length;L++){const R=j[L],x=R.link.range.start.y<v?0:R.link.range.start.x,T=R.link.range.end.y>v?this._bufferService.cols:R.link.range.end.x;for(let I=x;I<=T;I++){if(p.has(I)){j.splice(L--,1);break}p.add(I)}}}}_checkLinkProviderResult(v,g,p){var L;if(!this._activeProviderReplies)return p;const S=this._activeProviderReplies.get(v);let j=!1;for(let R=0;R<v;R++)this._activeProviderReplies.has(R)&&!this._activeProviderReplies.get(R)||(j=!0);if(!j&&S){const R=S.find((x=>this._linkAtPosition(x.link,g)));R&&(p=!0,this._handleNewLink(R))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!p)for(let R=0;R<this._activeProviderReplies.size;R++){const x=(L=this._activeProviderReplies.get(R))==null?void 0:L.find((T=>this._linkAtPosition(T.link,g)));if(x){p=!0,this._handleNewLink(x);break}}return p}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(v){if(!this._currentLink)return;const g=this._positionFromMouseEvent(v,this._element,this._mouseService);g&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,g)&&this._currentLink.link.activate(v,this._currentLink.link.text)}_clearCurrentLink(v,g){this._currentLink&&this._lastMouseEvent&&(!v||!g||this._currentLink.link.range.start.y>=v&&this._currentLink.link.range.end.y<=g)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,E.disposeArray)(this._linkCacheDisposables))}_handleNewLink(v){if(!this._lastMouseEvent)return;const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._linkAtPosition(v.link,g)&&(this._currentLink=v,this._currentLink.state={decorations:{underline:v.link.decorations===void 0||v.link.decorations.underline,pointerCursor:v.link.decorations===void 0||v.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,v.link,this._lastMouseEvent),v.link.decorations={},Object.defineProperties(v.link.decorations,{pointerCursor:{get:()=>{var p,S;return(S=(p=this._currentLink)==null?void 0:p.state)==null?void 0:S.decorations.pointerCursor},set:p=>{var S;(S=this._currentLink)!=null&&S.state&&this._currentLink.state.decorations.pointerCursor!==p&&(this._currentLink.state.decorations.pointerCursor=p,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",p))}},underline:{get:()=>{var p,S;return(S=(p=this._currentLink)==null?void 0:p.state)==null?void 0:S.decorations.underline},set:p=>{var S,j,L;(S=this._currentLink)!=null&&S.state&&((L=(j=this._currentLink)==null?void 0:j.state)==null?void 0:L.decorations.underline)!==p&&(this._currentLink.state.decorations.underline=p,this._currentLink.state.isHovered&&this._fireUnderlineEvent(v.link,p))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((p=>{if(!this._currentLink)return;const S=p.start===0?0:p.start+1+this._bufferService.buffer.ydisp,j=this._bufferService.buffer.ydisp+1+p.end;if(this._currentLink.link.range.start.y>=S&&this._currentLink.link.range.end.y<=j&&(this._clearCurrentLink(S,j),this._lastMouseEvent)){const L=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);L&&this._askForLink(L,!1)}}))))}_linkHover(v,g,p){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!0),this._currentLink.state.decorations.pointerCursor&&v.classList.add("xterm-cursor-pointer")),g.hover&&g.hover(p,g.text)}_fireUnderlineEvent(v,g){const p=v.range,S=this._bufferService.buffer.ydisp,j=this._createLinkUnderlineEvent(p.start.x-1,p.start.y-S-1,p.end.x,p.end.y-S-1,void 0);(g?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(j)}_linkLeave(v,g,p){var S;(S=this._currentLink)!=null&&S.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!1),this._currentLink.state.decorations.pointerCursor&&v.classList.remove("xterm-cursor-pointer")),g.leave&&g.leave(p,g.text)}_linkAtPosition(v,g){const p=v.range.start.y*this._bufferService.cols+v.range.start.x,S=v.range.end.y*this._bufferService.cols+v.range.end.x,j=g.y*this._bufferService.cols+g.x;return p<=j&&j<=S}_positionFromMouseEvent(v,g,p){const S=p.getCoords(v,g,this._bufferService.cols,this._bufferService.rows);if(S)return{x:S[0],y:S[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(v,g,p,S,j){return{x1:v,y1:g,x2:p,y2:S,cols:this._bufferService.cols,fg:j}}};i.Linkifier=h=f([_(1,w.IMouseService),_(2,w.IRenderService),_(3,M.IBufferService),_(4,w.ILinkProviderService)],h)},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 f=this&&this.__decorate||function(w,h,v,g){var p,S=arguments.length,j=S<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,v):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,h,v,g);else for(var L=w.length-1;L>=0;L--)(p=w[L])&&(j=(S<3?p(j):S>3?p(h,v,j):p(h,v))||j);return S>3&&j&&Object.defineProperty(h,v,j),j},_=this&&this.__param||function(w,h){return function(v,g){h(v,g,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkProvider=void 0;const d=a(511),k=a(2585);let E=i.OscLinkProvider=class{constructor(w,h,v){this._bufferService=w,this._optionsService=h,this._oscLinkService=v}provideLinks(w,h){var T;const v=this._bufferService.buffer.lines.get(w-1);if(!v)return void h(void 0);const g=[],p=this._optionsService.rawOptions.linkHandler,S=new d.CellData,j=v.getTrimmedLength();let L=-1,R=-1,x=!1;for(let I=0;I<j;I++)if(R!==-1||v.hasContent(I)){if(v.loadCell(I,S),S.hasExtendedAttrs()&&S.extended.urlId){if(R===-1){R=I,L=S.extended.urlId;continue}x=S.extended.urlId!==L}else R!==-1&&(x=!0);if(x||R!==-1&&I===j-1){const O=(T=this._oscLinkService.getLinkData(L))==null?void 0:T.uri;if(O){const P={start:{x:R+1,y:w},end:{x:I+(x||I!==j-1?0:1),y:w}};let F=!1;if(!(p!=null&&p.allowNonHttpProtocols))try{const W=new URL(O);["http:","https:"].includes(W.protocol)||(F=!0)}catch{F=!0}F||g.push({text:O,range:P,activate:(W,$)=>p?p.activate(W,$,P):M(0,$),hover:(W,$)=>{var K;return(K=p==null?void 0:p.hover)==null?void 0:K.call(p,W,$,P)},leave:(W,$)=>{var K;return(K=p==null?void 0:p.leave)==null?void 0:K.call(p,W,$,P)}})}x=!1,S.hasExtendedAttrs()&&S.extended.urlId?(R=I,L=S.extended.urlId):(R=-1,L=-1)}}h(g)}};function M(w,h){if(confirm(`Do you want to navigate to ${h}?
124
-
125
- WARNING: This link could potentially be dangerous`)){const v=window.open();if(v){try{v.opener=null}catch{}v.location.href=h}else console.warn("Opening link blocked as opener could not be cleared")}}i.OscLinkProvider=E=f([_(0,k.IBufferService),_(1,k.IOptionsService),_(2,k.IOscLinkService)],E)},6193:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.RenderDebouncer=void 0,i.RenderDebouncer=class{constructor(a,f){this._renderCallback=a,this._coreBrowserService=f,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,f,_){this._rowCount=_,a=a!==void 0?a:0,f=f!==void 0?f: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,f):f,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),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,f),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 f=a(3614),_=a(3656),d=a(3551),k=a(9042),E=a(3730),M=a(1680),w=a(3107),h=a(5744),v=a(2950),g=a(1296),p=a(428),S=a(4269),j=a(5114),L=a(8934),R=a(3230),x=a(9312),T=a(4725),I=a(6731),O=a(8055),P=a(8969),F=a(8460),W=a(844),$=a(6114),K=a(8437),G=a(2584),q=a(7399),D=a(5941),U=a(9074),H=a(2585),z=a(5435),Z=a(4567),ie=a(779);class ye extends P.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(T.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(E.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((Y,ne)=>this.refresh(Y,ne)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((Y=>this._reportWindowsOptions(Y)))),this.register(this._inputHandler.onColor((Y=>this._handleColorEvent(Y)))),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((Y=>this._afterResize(Y.cols,Y.rows)))),this.register((0,W.toDisposable)((()=>{var Y,ne;this._customKeyEventHandler=void 0,(ne=(Y=this.element)==null?void 0:Y.parentNode)==null||ne.removeChild(this.element)})))}_handleColorEvent(Q){if(this._themeService)for(const Y of Q){let ne,ee="";switch(Y.index){case 256:ne="foreground",ee="10";break;case 257:ne="background",ee="11";break;case 258:ne="cursor",ee="12";break;default:ne="ansi",ee="4;"+Y.index}switch(Y.type){case 0:const be=O.color.toColorRGB(ne==="ansi"?this._themeService.colors.ansi[Y.index]:this._themeService.colors[ne]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${ee};${(0,D.toRgbString)(be)}${G.C1_ESCAPED.ST}`);break;case 1:if(ne==="ansi")this._themeService.modifyColors((me=>me.ansi[Y.index]=O.channels.toColor(...Y.color)));else{const me=ne;this._themeService.modifyColors((Be=>Be[me]=O.channels.toColor(...Y.color)))}break;case 2:this._themeService.restoreColor(Y.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,Y=this.buffer.lines.get(Q);if(!Y)return;const ne=Math.min(this.buffer.x,this.cols-1),ee=this._renderService.dimensions.css.cell.height,be=Y.getWidth(ne),me=this._renderService.dimensions.css.cell.width*be,Be=this.buffer.y*this._renderService.dimensions.css.cell.height,ze=ne*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ze+"px",this.textarea.style.top=Be+"px",this.textarea.style.width=me+"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",(Y=>{this.hasSelection()&&(0,f.copyHandler)(Y,this._selectionService)})));const Q=Y=>(0,f.handlePasteEvent)(Y,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",(Y=>{Y.button===2&&(0,f.rightClickHandler)(Y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",(Y=>{(0,f.rightClickHandler)(Y,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),$.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",(Y=>{Y.button===1&&(0,f.moveTextAreaUnderMouseCursor)(Y,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 ne;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"),((ne=this.element)==null?void 0:ne.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 Y=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),Y.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),Y.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(T.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(p.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(T.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(I.ThemeService),this._instantiationService.setService(T.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(S.CharacterJoinerService),this._instantiationService.setService(T.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(R.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(T.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(v.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(L.MouseService),this._instantiationService.setService(T.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(d.Linkifier,this.screenElement)),this.element.appendChild(Y);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(x.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(T.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(h.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ee=>{!this._overviewRulerRenderer&&ee&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(h.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(g.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const Q=this,Y=this.element;function ne(me){const Be=Q._mouseService.getMouseReportCoords(me,Q.screenElement);if(!Be)return!1;let ze,Qe;switch(me.overrideType||me.type){case"mousemove":Qe=32,me.buttons===void 0?(ze=3,me.button!==void 0&&(ze=me.button<3?me.button:3)):ze=1&me.buttons?0:4&me.buttons?1:2&me.buttons?2:3;break;case"mouseup":Qe=0,ze=me.button<3?me.button:3;break;case"mousedown":Qe=1,ze=me.button<3?me.button:3;break;case"wheel":if(Q._customWheelEventHandler&&Q._customWheelEventHandler(me)===!1||Q.viewport.getLinesScrolled(me)===0)return!1;Qe=me.deltaY<0?0:1,ze=4;break;default:return!1}return!(Qe===void 0||ze===void 0||ze>4)&&Q.coreMouseService.triggerMouseEvent({col:Be.col,row:Be.row,x:Be.x,y:Be.y,button:ze,action:Qe,ctrl:me.ctrlKey,alt:me.altKey,shift:me.shiftKey})}const ee={mouseup:null,wheel:null,mousedrag:null,mousemove:null},be={mouseup:me=>(ne(me),me.buttons||(this._document.removeEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.removeEventListener("mousemove",ee.mousedrag)),this.cancel(me)),wheel:me=>(ne(me),this.cancel(me,!0)),mousedrag:me=>{me.buttons&&ne(me)},mousemove:me=>{me.buttons||ne(me)}};this.register(this.coreMouseService.onProtocolChange((me=>{me?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(me)),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&me?ee.mousemove||(Y.addEventListener("mousemove",be.mousemove),ee.mousemove=be.mousemove):(Y.removeEventListener("mousemove",ee.mousemove),ee.mousemove=null),16&me?ee.wheel||(Y.addEventListener("wheel",be.wheel,{passive:!1}),ee.wheel=be.wheel):(Y.removeEventListener("wheel",ee.wheel),ee.wheel=null),2&me?ee.mouseup||(ee.mouseup=be.mouseup):(this._document.removeEventListener("mouseup",ee.mouseup),ee.mouseup=null),4&me?ee.mousedrag||(ee.mousedrag=be.mousedrag):(this._document.removeEventListener("mousemove",ee.mousedrag),ee.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(Y,"mousedown",(me=>{if(me.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(me))return ne(me),ee.mouseup&&this._document.addEventListener("mouseup",ee.mouseup),ee.mousedrag&&this._document.addEventListener("mousemove",ee.mousedrag),this.cancel(me)}))),this.register((0,_.addDisposableDomListener)(Y,"wheel",(me=>{if(!ee.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(me)===!1)return!1;if(!this.buffer.hasScrollback){const Be=this.viewport.getLinesScrolled(me);if(Be===0)return;const ze=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(me.deltaY<0?"A":"B");let Qe="";for(let dt=0;dt<Math.abs(Be);dt++)Qe+=ze;return this.coreService.triggerDataEvent(Qe,!0),this.cancel(me,!0)}return this.viewport.handleWheel(me)?this.cancel(me):void 0}}),{passive:!1})),this.register((0,_.addDisposableDomListener)(Y,"touchstart",(me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(me),this.cancel(me)}),{passive:!0})),this.register((0,_.addDisposableDomListener)(Y,"touchmove",(me=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(me)?void 0:this.cancel(me)}),{passive:!1}))}refresh(Q,Y){var ne;(ne=this._renderService)==null||ne.refreshRows(Q,Y)}updateCursorStyle(Q){var Y;(Y=this._selectionService)!=null&&Y.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,Y,ne=0){var ee;ne===1?(super.scrollLines(Q,Y,ne),this.refresh(0,this.rows-1)):(ee=this.viewport)==null||ee.scrollLines(Q)}paste(Q){(0,f.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 Y=this._characterJoinerService.register(Q);return this.refresh(0,this.rows-1),Y}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,Y,ne){this._selectionService.setSelection(Q,Y,ne)}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,Y){var ne;(ne=this._selectionService)==null||ne.selectLines(Q,Y)}_keyDown(Q){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;const Y=this.browser.isMac&&this.options.macOptionIsMeta&&Q.altKey;if(!Y&&!this._compositionHelper.keydown(Q))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;Y||Q.key!=="Dead"&&Q.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ne=(0,q.evaluateKeyboardEvent)(Q,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(Q),ne.type===3||ne.type===2){const ee=this.rows-1;return this.scrollLines(ne.type===2?-ee:ee),this.cancel(Q,!0)}return ne.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,Q)||(ne.cancel&&this.cancel(Q,!0),!ne.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):(ne.key!==G.C0.ETX&&ne.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ne.key,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(ne.key,!0),!this.optionsService.rawOptions.screenReaderMode||Q.altKey||Q.ctrlKey?this.cancel(Q,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(Q,Y){const ne=Q.isMac&&!this.options.macOptionIsMeta&&Y.altKey&&!Y.ctrlKey&&!Y.metaKey||Q.isWindows&&Y.altKey&&Y.ctrlKey&&!Y.metaKey||Q.isWindows&&Y.getModifierState("AltGraph");return Y.type==="keypress"?ne:ne&&(!Y.keyCode||Y.keyCode>47)}_keyUp(Q){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1||((function(Y){return Y.keyCode===16||Y.keyCode===17||Y.keyCode===18})(Q)||this.focus(),this.updateCursorStyle(Q),this._keyPressHandled=!1)}_keyPress(Q){let Y;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(Q)===!1)return!1;if(this.cancel(Q),Q.charCode)Y=Q.charCode;else if(Q.which===null||Q.which===void 0)Y=Q.keyCode;else{if(Q.which===0||Q.charCode===0)return!1;Y=Q.which}return!(!Y||(Q.altKey||Q.ctrlKey||Q.metaKey)&&!this._isThirdLevelShift(this.browser,Q)||(Y=String.fromCharCode(Y),this._onKey.fire({key:Y,domEvent:Q}),this._showCursor(),this.coreService.triggerDataEvent(Y,!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 Y=Q.data;return this.coreService.triggerDataEvent(Y,!0),this.cancel(Q),!0}return!1}resize(Q,Y){Q!==this.cols||Y!==this.rows?super.resize(Q,Y):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(Q,Y){var ne,ee;(ne=this._charSizeService)==null||ne.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 Y=1;Y<this.rows;Y++)this.buffer.lines.push(this.buffer.getBlankLine(K.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 Y,ne;this.options.rows=this.rows,this.options.cols=this.cols;const Q=this._customKeyEventHandler;this._setup(),super.reset(),(Y=this._selectionService)==null||Y.reset(),this._decorationService.reset(),(ne=this.viewport)==null||ne.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 Y=this._renderService.dimensions.css.canvas.width.toFixed(0),ne=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${ne};${Y}t`);break;case z.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const ee=this._renderService.dimensions.css.cell.width.toFixed(0),be=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${be};${ee}t`)}}cancel(Q,Y){if(this.options.cancelEvents||Y)return Q.preventDefault(),Q.stopPropagation(),!1}}i.Terminal=ye},9924:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.TimeBasedDebouncer=void 0,i.TimeBasedDebouncer=class{constructor(a,f=1e3){this._renderCallback=a,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,f,_){this._rowCount=_,a=a!==void 0?a:0,f=f!==void 0?f: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,f):f;const d=Date.now();if(d-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=d,this._innerRefresh();else if(!this._additionalRefreshRequested){const k=d-this._lastRefreshMs,E=this._debounceThresholdMS-k;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),E)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,f)}}},1680:function(b,i,a){var f=this&&this.__decorate||function(v,g,p,S){var j,L=arguments.length,R=L<3?g:S===null?S=Object.getOwnPropertyDescriptor(g,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,g,p,S);else for(var x=v.length-1;x>=0;x--)(j=v[x])&&(R=(L<3?j(R):L>3?j(g,p,R):j(g,p))||R);return L>3&&R&&Object.defineProperty(g,p,R),R},_=this&&this.__param||function(v,g){return function(p,S){g(p,S,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.Viewport=void 0;const d=a(3656),k=a(4725),E=a(8460),M=a(844),w=a(2585);let h=i.Viewport=class extends M.Disposable{constructor(v,g,p,S,j,L,R,x){super(),this._viewportElement=v,this._scrollArea=g,this._bufferService=p,this._optionsService=S,this._charSizeService=j,this._renderService=L,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 E.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((T=>this._activeBuffer=T.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((T=>this._renderDimensions=T))),this._handleThemeChange(x.colors),this.register(x.onChangeColors((T=>this._handleThemeChange(T)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(v){this._viewportElement.style.backgroundColor=v.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(v){if(v)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 g=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==g&&(this._lastRecordedBufferHeight=g,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const v=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==v&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=v),this._refreshAnimationFrame=null}syncScrollArea(v=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(v);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(v)}_handleScroll(v){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 g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const v=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(v*(this._smoothScrollState.target-this._smoothScrollState.origin)),v<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(v,g){const p=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&p<this._lastRecordedBufferHeight)||(v.cancelable&&v.preventDefault(),!1)}handleWheel(v){const g=this._getPixelsScrolled(v);return g!==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+g:this._smoothScrollState.target+=g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=g,this._bubbleScroll(v,g))}scrollLines(v){if(v!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const g=v*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:v,suppressScrollEvent:!1})}_getPixelsScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let g=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g}getBufferElements(v,g){var x;let p,S="";const j=[],L=g??this._bufferService.buffer.lines.length,R=this._bufferService.buffer.lines;for(let T=v;T<L;T++){const I=R.get(T);if(!I)continue;const O=(x=R.get(T+1))==null?void 0:x.isWrapped;if(S+=I.translateToString(!O),!O||T===R.length-1){const P=document.createElement("div");P.textContent=S,j.push(P),S.length>0&&(p=P),S=""}}return{bufferElements:j,cursorElement:p}}getLinesScrolled(v){if(v.deltaY===0||v.shiftKey)return 0;let g=this._applyScrollModifier(v.deltaY,v);return v.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):v.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g}_applyScrollModifier(v,g){const p=this._optionsService.rawOptions.fastScrollModifier;return p==="alt"&&g.altKey||p==="ctrl"&&g.ctrlKey||p==="shift"&&g.shiftKey?v*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:v*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(v){this._lastTouchY=v.touches[0].pageY}handleTouchMove(v){const g=this._lastTouchY-v.touches[0].pageY;return this._lastTouchY=v.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(v,g))}};i.Viewport=h=f([_(2,w.IBufferService),_(3,w.IOptionsService),_(4,k.ICharSizeService),_(5,k.IRenderService),_(6,k.ICoreBrowserService),_(7,k.IThemeService)],h)},3107:function(b,i,a){var f=this&&this.__decorate||function(w,h,v,g){var p,S=arguments.length,j=S<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,v):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,h,v,g);else for(var L=w.length-1;L>=0;L--)(p=w[L])&&(j=(S<3?p(j):S>3?p(h,v,j):p(h,v))||j);return S>3&&j&&Object.defineProperty(h,v,j),j},_=this&&this.__param||function(w,h){return function(v,g){h(v,g,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferDecorationRenderer=void 0;const d=a(4725),k=a(844),E=a(2585);let M=i.BufferDecorationRenderer=class extends k.Disposable{constructor(w,h,v,g,p){super(),this._screenElement=w,this._bufferService=h,this._coreBrowserService=v,this._decorationService=g,this._renderService=p,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((S=>this._removeDecoration(S)))),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 g;const h=this._coreBrowserService.mainDocument.createElement("div");h.classList.add("xterm-decoration"),h.classList.toggle("xterm-decoration-top-layer",((g=w==null?void 0:w.options)==null?void 0:g.layer)==="top"),h.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,h.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",h.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",h.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const v=w.options.x??0;return v&&v>this._bufferService.cols&&(h.style.display="none"),this._refreshXPosition(w,h),h}_refreshStyle(w){const h=w.marker.line-this._bufferService.buffers.active.ydisp;if(h<0||h>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let v=this._decorationElements.get(w);v||(v=this._createElement(w),w.element=v,this._decorationElements.set(w,v),this._container.appendChild(v),w.onDispose((()=>{this._decorationElements.delete(w),v.remove()}))),v.style.top=h*this._renderService.dimensions.css.cell.height+"px",v.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(v)}}_refreshXPosition(w,h=w.element){if(!h)return;const v=w.options.x??0;(w.options.anchor||"left")==="right"?h.style.right=v?v*this._renderService.dimensions.css.cell.width+"px":"":h.style.left=v?v*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var h;(h=this._decorationElements.get(w))==null||h.remove(),this._decorationElements.delete(w),w.dispose()}};i.BufferDecorationRenderer=M=f([_(1,E.IBufferService),_(2,d.ICoreBrowserService),_(3,E.IDecorationService),_(4,d.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 f of this._zones)if(f.color===a.options.overviewRulerOptions.color&&f.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,a.marker.line))return;if(this._lineAdjacentToZone(f,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(f,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,f){return f>=a.startBufferLine&&f<=a.endBufferLine}_lineAdjacentToZone(a,f,_){return f>=a.startBufferLine-this._linePadding[_||"full"]&&f<=a.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(a,f){a.startBufferLine=Math.min(a.startBufferLine,f),a.endBufferLine=Math.max(a.endBufferLine,f)}}},5744:function(b,i,a){var f=this&&this.__decorate||function(p,S,j,L){var R,x=arguments.length,T=x<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,j):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(p,S,j,L);else for(var I=p.length-1;I>=0;I--)(R=p[I])&&(T=(x<3?R(T):x>3?R(S,j,T):R(S,j))||T);return x>3&&T&&Object.defineProperty(S,j,T),T},_=this&&this.__param||function(p,S){return function(j,L){S(j,L,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OverviewRulerRenderer=void 0;const d=a(5871),k=a(4725),E=a(844),M=a(2585),w={full:0,left:0,center:0,right:0},h={full:0,left:0,center:0,right:0},v={full:0,left:0,center:0,right:0};let g=i.OverviewRulerRenderer=class extends E.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(p,S,j,L,R,x,T){var O;super(),this._viewportElement=p,this._screenElement=S,this._bufferService=j,this._decorationService=L,this._renderService=R,this._optionsService=x,this._coreBrowserService=T,this._colorZoneStore=new d.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(),(O=this._viewportElement.parentElement)==null||O.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,E.toDisposable)((()=>{var P;(P=this._canvas)==null||P.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 p=Math.floor(this._canvas.width/3),S=Math.ceil(this._canvas.width/3);h.full=this._canvas.width,h.left=p,h.center=S,h.right=p,this._refreshDrawHeightConstants(),v.full=0,v.left=0,v.center=h.left,v.right=h.left+h.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const p=this._canvas.height/this._bufferService.buffer.lines.length,S=Math.round(Math.max(Math.min(p,12),6)*this._coreBrowserService.dpr);w.left=S,w.center=S,w.right=S}_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 S of this._decorationService.decorations)this._colorZoneStore.addDecoration(S);this._ctx.lineWidth=1;const p=this._colorZoneStore.zones;for(const S of p)S.position!=="full"&&this._renderColorZone(S);for(const S of p)S.position==="full"&&this._renderColorZone(S);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(p){this._ctx.fillStyle=p.color,this._ctx.fillRect(v[p.position||"full"],Math.round((this._canvas.height-1)*(p.startBufferLine/this._bufferService.buffers.active.lines.length)-w[p.position||"full"]/2),h[p.position||"full"],Math.round((this._canvas.height-1)*((p.endBufferLine-p.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[p.position||"full"]))}_queueRefresh(p,S){this._shouldUpdateDimensions=p||this._shouldUpdateDimensions,this._shouldUpdateAnchor=S||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};i.OverviewRulerRenderer=g=f([_(2,M.IBufferService),_(3,M.IDecorationService),_(4,k.IRenderService),_(5,M.IOptionsService),_(6,k.ICoreBrowserService)],g)},2950:function(b,i,a){var f=this&&this.__decorate||function(w,h,v,g){var p,S=arguments.length,j=S<3?h:g===null?g=Object.getOwnPropertyDescriptor(h,v):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(w,h,v,g);else for(var L=w.length-1;L>=0;L--)(p=w[L])&&(j=(S<3?p(j):S>3?p(h,v,j):p(h,v))||j);return S>3&&j&&Object.defineProperty(h,v,j),j},_=this&&this.__param||function(w,h){return function(v,g){h(v,g,w)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CompositionHelper=void 0;const d=a(4725),k=a(2585),E=a(2584);let M=i.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,h,v,g,p,S){this._textarea=w,this._compositionView=h,this._bufferService=v,this._optionsService=g,this._coreService=p,this._renderService=S,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 h={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let v;this._isSendingComposition=!1,h.start+=this._dataAlreadySent.length,v=this._isComposing?this._textarea.value.substring(h.start,h.end):this._textarea.value.substring(h.start),v.length>0&&this._coreService.triggerDataEvent(v,!0)}}),0)}else{this._isSendingComposition=!1;const h=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(h,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const h=this._textarea.value,v=h.replace(w,"");this._dataAlreadySent=v,h.length>w.length?this._coreService.triggerDataEvent(v,!0):h.length<w.length?this._coreService.triggerDataEvent(`${E.C0.DEL}`,!0):h.length===w.length&&h!==w&&this._coreService.triggerDataEvent(h,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const h=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),v=this._renderService.dimensions.css.cell.height,g=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,p=h*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=p+"px",this._compositionView.style.top=g+"px",this._compositionView.style.height=v+"px",this._compositionView.style.lineHeight=v+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const S=this._compositionView.getBoundingClientRect();this._textarea.style.left=p+"px",this._textarea.style.top=g+"px",this._textarea.style.width=Math.max(S.width,1)+"px",this._textarea.style.height=Math.max(S.height,1)+"px",this._textarea.style.lineHeight=S.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};i.CompositionHelper=M=f([_(2,k.IBufferService),_(3,k.IOptionsService),_(4,k.ICoreService),_(5,d.IRenderService)],M)},9806:(b,i)=>{function a(f,_,d){const k=d.getBoundingClientRect(),E=f.getComputedStyle(d),M=parseInt(E.getPropertyValue("padding-left")),w=parseInt(E.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(f,_,d,k,E,M,w,h,v){if(!M)return;const g=a(f,_,d);return g?(g[0]=Math.ceil((g[0]+(v?w/2:0))/w),g[1]=Math.ceil(g[1]/h),g[0]=Math.min(Math.max(g[0],1),k+(v?1:0)),g[1]=Math.min(Math.max(g[1],1),E),g):void 0}},9504:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.moveToCellSequence=void 0;const f=a(2584);function _(h,v,g,p){const S=h-d(h,g),j=v-d(v,g),L=Math.abs(S-j)-(function(R,x,T){let I=0;const O=R-d(R,T),P=x-d(x,T);for(let F=0;F<Math.abs(O-P);F++){const W=k(R,x)==="A"?-1:1,$=T.buffer.lines.get(O+W*F);$!=null&&$.isWrapped&&I++}return I})(h,v,g);return w(L,M(k(h,v),p))}function d(h,v){let g=0,p=v.buffer.lines.get(h),S=p==null?void 0:p.isWrapped;for(;S&&h>=0&&h<v.rows;)g++,p=v.buffer.lines.get(--h),S=p==null?void 0:p.isWrapped;return g}function k(h,v){return h>v?"A":"B"}function E(h,v,g,p,S,j){let L=h,R=v,x="";for(;L!==g||R!==p;)L+=S?1:-1,S&&L>j.cols-1?(x+=j.buffer.translateBufferLineToString(R,!1,h,L),L=0,h=0,R++):!S&&L<0&&(x+=j.buffer.translateBufferLineToString(R,!1,0,h+1),L=j.cols-1,h=L,R--);return x+j.buffer.translateBufferLineToString(R,!1,h,L)}function M(h,v){const g=v?"O":"[";return f.C0.ESC+g+h}function w(h,v){h=Math.floor(h);let g="";for(let p=0;p<h;p++)g+=v;return g}i.moveToCellSequence=function(h,v,g,p){const S=g.buffer.x,j=g.buffer.y;if(!g.buffer.hasScrollback)return(function(x,T,I,O,P,F){return _(T,O,P,F).length===0?"":w(E(x,T,x,T-d(T,P),!1,P).length,M("D",F))})(S,j,0,v,g,p)+_(j,v,g,p)+(function(x,T,I,O,P,F){let W;W=_(T,O,P,F).length>0?O-d(O,P):T;const $=O,K=(function(G,q,D,U,H,z){let Z;return Z=_(D,U,H,z).length>0?U-d(U,H):q,G<D&&Z<=U||G>=D&&Z<U?"C":"D"})(x,T,I,O,P,F);return w(E(x,W,I,$,K==="C",P).length,M(K,F))})(S,j,h,v,g,p);let L;if(j===v)return L=S>h?"D":"C",w(Math.abs(S-h),M(L,p));L=j>v?"D":"C";const R=Math.abs(j-v);return w((function(x,T){return T.cols-x})(j>v?h:S,g)+(R-1)*g.cols+1+((j>v?S:h)-1),M(L,p))}},1296:function(b,i,a){var f=this&&this.__decorate||function(F,W,$,K){var G,q=arguments.length,D=q<3?W:K===null?K=Object.getOwnPropertyDescriptor(W,$):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(F,W,$,K);else for(var U=F.length-1;U>=0;U--)(G=F[U])&&(D=(q<3?G(D):q>3?G(W,$,D):G(W,$))||D);return q>3&&D&&Object.defineProperty(W,$,D),D},_=this&&this.__param||function(F,W){return function($,K){W($,K,F)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRenderer=void 0;const d=a(3787),k=a(2550),E=a(2223),M=a(6171),w=a(6052),h=a(4725),v=a(8055),g=a(8460),p=a(844),S=a(2585),j="xterm-dom-renderer-owner-",L="xterm-rows",R="xterm-fg-",x="xterm-bg-",T="xterm-focus",I="xterm-selection";let O=1,P=i.DomRenderer=class extends p.Disposable{constructor(F,W,$,K,G,q,D,U,H,z,Z,ie,ye){super(),this._terminal=F,this._document=W,this._element=$,this._screenElement=K,this._viewportElement=G,this._helperContainer=q,this._linkifier2=D,this._charSizeService=H,this._optionsService=z,this._bufferService=Z,this._coreBrowserService=ie,this._themeService=ye,this._terminalClass=O++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new g.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(L),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((_e=>this._injectCss(_e)))),this._injectCss(this._themeService.colors),this._rowFactory=U.createInstance(d.DomRendererRowFactory,document),this._element.classList.add(j+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((_e=>this._handleLinkHover(_e)))),this.register(this._linkifier2.onHideLinkUnderline((_e=>this._handleLinkLeave(_e)))),this.register((0,p.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} .${L} 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} .${L} { 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} .${L} .xterm-dim { color: ${v.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}`,K=`blink_bar_${this._terminalClass}`,G=`blink_block_${this._terminalClass}`;W+=`@keyframes ${$} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${K} { 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} .${L}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${$} 1s step-end infinite;}${this._terminalSelector} .${L}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${L}.${T} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${L} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${L} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${L} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${L} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${L} .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[q,D]of F.ansi.entries())W+=`${this._terminalSelector} .${R}${q} { color: ${D.css}; }${this._terminalSelector} .${R}${q}.xterm-dim { color: ${v.color.multiplyOpacity(D,.5).css}; }${this._terminalSelector} .${x}${q} { background-color: ${D.css}; }`;W+=`${this._terminalSelector} .${R}${E.INVERTED_DEFAULT_COLOR} { color: ${v.color.opaque(F.background).css}; }${this._terminalSelector} .${R}${E.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${v.color.multiplyOpacity(v.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${x}${E.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 K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}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(T),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(T),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 K=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,q=this._selectionRenderModel.viewportCappedStartRow,D=this._selectionRenderModel.viewportCappedEndRow;if(q>=this._bufferService.rows||D<0)return;const U=this._document.createDocumentFragment();if($){const H=F[0]>W[0];U.appendChild(this._createSelectionElement(q,H?W[0]:F[0],H?F[0]:W[0],D-q+1))}else{const H=K===q?F[0]:0,z=q===G?W[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(q,H,z));const Z=D-q-1;if(U.appendChild(this._createSelectionElement(q+1,0,this._bufferService.cols,Z)),q!==D){const ie=G===D?W[0]:this._bufferService.cols;U.appendChild(this._createSelectionElement(D,0,ie))}}this._selectionContainer.appendChild(U)}_createSelectionElement(F,W,$,K=1){const G=this._document.createElement("div"),q=W*this.dimensions.css.cell.width;let D=this.dimensions.css.cell.width*($-W);return q+D>this.dimensions.css.canvas.width&&(D=this.dimensions.css.canvas.width-q),G.style.height=K*this.dimensions.css.cell.height+"px",G.style.top=F*this.dimensions.css.cell.height+"px",G.style.left=`${q}px`,G.style.width=`${D}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,K=$.ybase+$.y,G=Math.min($.x,this._bufferService.cols-1),q=this._optionsService.rawOptions.cursorBlink,D=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===K,D,U,G,q,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,$,K,G,q){$<0&&(F=0),K<0&&(W=0);const D=this._bufferService.rows-1;$=Math.max(Math.min($,D),0),K=Math.max(Math.min(K,D),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,ye=this._optionsService.rawOptions.cursorInactiveStyle;for(let _e=$;_e<=K;++_e){const Q=_e+U.ydisp,Y=this._rowElements[_e],ne=U.lines.get(Q);if(!Y||!ne)break;Y.replaceChildren(...this._rowFactory.createRow(ne,Q,Q===H,ie,ye,z,Z,this.dimensions.css.cell.width,this._widthCache,q?_e===$?F:0:-1,q?(_e===K?W:G)-1:-1))}}};i.DomRenderer=P=f([_(7,S.IInstantiationService),_(8,h.ICharSizeService),_(9,S.IOptionsService),_(10,S.IBufferService),_(11,h.ICoreBrowserService),_(12,h.IThemeService)],P)},3787:function(b,i,a){var f=this&&this.__decorate||function(L,R,x,T){var I,O=arguments.length,P=O<3?R:T===null?T=Object.getOwnPropertyDescriptor(R,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(L,R,x,T);else for(var F=L.length-1;F>=0;F--)(I=L[F])&&(P=(O<3?I(P):O>3?I(R,x,P):I(R,x))||P);return O>3&&P&&Object.defineProperty(R,x,P),P},_=this&&this.__param||function(L,R){return function(x,T){R(x,T,L)}};Object.defineProperty(i,"__esModule",{value:!0}),i.DomRendererRowFactory=void 0;const d=a(2223),k=a(643),E=a(511),M=a(2585),w=a(8055),h=a(4725),v=a(4269),g=a(6171),p=a(3734);let S=i.DomRendererRowFactory=class{constructor(L,R,x,T,I,O,P){this._document=L,this._characterJoinerService=R,this._optionsService=x,this._coreBrowserService=T,this._coreService=I,this._decorationService=O,this._themeService=P,this._workCell=new E.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(L,R,x){this._selectionStart=L,this._selectionEnd=R,this._columnSelectMode=x}createRow(L,R,x,T,I,O,P,F,W,$,K){const G=[],q=this._characterJoinerService.getJoinedCharacters(R),D=this._themeService.colors;let U,H=L.getNoBgTrimmedLength();x&&H<O+1&&(H=O+1);let z=0,Z="",ie=0,ye=0,_e=0,Q=!1,Y=0,ne=!1,ee=0;const be=[],me=$!==-1&&K!==-1;for(let Be=0;Be<H;Be++){L.loadCell(Be,this._workCell);let ze=this._workCell.getWidth();if(ze===0)continue;let Qe=!1,dt=Be,Ie=this._workCell;if(q.length>0&&Be===q[0][0]){Qe=!0;const Ge=q.shift();Ie=new v.JoinedCellData(this._workCell,L.translateToString(!0,Ge[0],Ge[1]),Ge[1]-Ge[0]),dt=Ge[1]-1,ze=Ie.getWidth()}const at=this._isCellInSelection(Be,R),xt=x&&Be===O,oe=me&&Be>=$&&Be<=K;let je=!1;this._decorationService.forEachDecorationAtCell(Be,R,void 0,(Ge=>{je=!0}));let Ae=Ie.getChars()||k.WHITESPACE_CELL_CHAR;if(Ae===" "&&(Ie.isUnderline()||Ie.isOverline())&&(Ae=" "),ee=ze*F-W.get(Ae,Ie.isBold(),Ie.isItalic()),U){if(z&&(at&&ne||!at&&!ne&&Ie.bg===ie)&&(at&&ne&&D.selectionForeground||Ie.fg===ye)&&Ie.extended.ext===_e&&oe===Q&&ee===Y&&!xt&&!Qe&&!je){Ie.isInvisible()?Z+=k.WHITESPACE_CELL_CHAR:Z+=Ae,z++;continue}z&&(U.textContent=Z),U=this._document.createElement("span"),z=0,Z=""}else U=this._document.createElement("span");if(ie=Ie.bg,ye=Ie.fg,_e=Ie.extended.ext,Q=oe,Y=ee,ne=at,Qe&&O>=Be&&O<=dt&&(O=Be),!this._coreService.isCursorHidden&&xt&&this._coreService.isCursorInitialized){if(be.push("xterm-cursor"),this._coreBrowserService.isFocused)P&&be.push("xterm-cursor-blink"),be.push(T==="bar"?"xterm-cursor-bar":T==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(I)switch(I){case"outline":be.push("xterm-cursor-outline");break;case"block":be.push("xterm-cursor-block");break;case"bar":be.push("xterm-cursor-bar");break;case"underline":be.push("xterm-cursor-underline")}}if(Ie.isBold()&&be.push("xterm-bold"),Ie.isItalic()&&be.push("xterm-italic"),Ie.isDim()&&be.push("xterm-dim"),Z=Ie.isInvisible()?k.WHITESPACE_CELL_CHAR:Ie.getChars()||k.WHITESPACE_CELL_CHAR,Ie.isUnderline()&&(be.push(`xterm-underline-${Ie.extended.underlineStyle}`),Z===" "&&(Z=" "),!Ie.isUnderlineColorDefault()))if(Ie.isUnderlineColorRGB())U.style.textDecorationColor=`rgb(${p.AttributeData.toColorRGB(Ie.getUnderlineColor()).join(",")})`;else{let Ge=Ie.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ie.isBold()&&Ge<8&&(Ge+=8),U.style.textDecorationColor=D.ansi[Ge].css}Ie.isOverline()&&(be.push("xterm-overline"),Z===" "&&(Z=" ")),Ie.isStrikethrough()&&be.push("xterm-strikethrough"),oe&&(U.style.textDecoration="underline");let Le=Ie.getFgColor(),nt=Ie.getFgColorMode(),Fe=Ie.getBgColor(),Ke=Ie.getBgColorMode();const mt=!!Ie.isInverse();if(mt){const Ge=Le;Le=Fe,Fe=Ge;const yt=nt;nt=Ke,Ke=yt}let _t,Et,ft,ct=!1;switch(this._decorationService.forEachDecorationAtCell(Be,R,void 0,(Ge=>{Ge.options.layer!=="top"&&ct||(Ge.backgroundColorRGB&&(Ke=50331648,Fe=Ge.backgroundColorRGB.rgba>>8&16777215,_t=Ge.backgroundColorRGB),Ge.foregroundColorRGB&&(nt=50331648,Le=Ge.foregroundColorRGB.rgba>>8&16777215,Et=Ge.foregroundColorRGB),ct=Ge.options.layer==="top")})),!ct&&at&&(_t=this._coreBrowserService.isFocused?D.selectionBackgroundOpaque:D.selectionInactiveBackgroundOpaque,Fe=_t.rgba>>8&16777215,Ke=50331648,ct=!0,D.selectionForeground&&(nt=50331648,Le=D.selectionForeground.rgba>>8&16777215,Et=D.selectionForeground)),ct&&be.push("xterm-decoration-top"),Ke){case 16777216:case 33554432:ft=D.ansi[Fe],be.push(`xterm-bg-${Fe}`);break;case 50331648:ft=w.channels.toColor(Fe>>16,Fe>>8&255,255&Fe),this._addStyle(U,`background-color:#${j((Fe>>>0).toString(16),"0",6)}`);break;default:mt?(ft=D.foreground,be.push(`xterm-bg-${d.INVERTED_DEFAULT_COLOR}`)):ft=D.background}switch(_t||Ie.isDim()&&(_t=w.color.multiplyOpacity(ft,.5)),nt){case 16777216:case 33554432:Ie.isBold()&&Le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Le+=8),this._applyMinimumContrast(U,ft,D.ansi[Le],Ie,_t,void 0)||be.push(`xterm-fg-${Le}`);break;case 50331648:const Ge=w.channels.toColor(Le>>16&255,Le>>8&255,255&Le);this._applyMinimumContrast(U,ft,Ge,Ie,_t,Et)||this._addStyle(U,`color:#${j(Le.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(U,ft,D.foreground,Ie,_t,Et)||mt&&be.push(`xterm-fg-${d.INVERTED_DEFAULT_COLOR}`)}be.length&&(U.className=be.join(" "),be.length=0),xt||Qe||je?U.textContent=Z:z++,ee!==this.defaultSpacing&&(U.style.letterSpacing=`${ee}px`),G.push(U),Be=dt}return U&&z&&(U.textContent=Z),G}_applyMinimumContrast(L,R,x,T,I,O){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,g.treatGlyphAsBackgroundColor)(T.getCode()))return!1;const P=this._getContrastCache(T);let F;if(I||O||(F=P.getColor(R.rgba,x.rgba)),F===void 0){const W=this._optionsService.rawOptions.minimumContrastRatio/(T.isDim()?2:1);F=w.color.ensureContrastRatio(I||R,O||x,W),P.setColor((I||R).rgba,(O||x).rgba,F??null)}return!!F&&(this._addStyle(L,`color:${F.css}`),!0)}_getContrastCache(L){return L.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(L,R){L.setAttribute("style",`${L.getAttribute("style")||""}${R};`)}_isCellInSelection(L,R){const x=this._selectionStart,T=this._selectionEnd;return!(!x||!T)&&(this._columnSelectMode?x[0]<=T[0]?L>=x[0]&&R>=x[1]&&L<T[0]&&R<=T[1]:L<x[0]&&R>=x[1]&&L>=T[0]&&R<=T[1]:R>x[1]&&R<T[1]||x[1]===T[1]&&R===x[1]&&L>=x[0]&&L<T[0]||x[1]<T[1]&&R===T[1]&&L<T[0]||x[1]<T[1]&&R===x[1]&&L>=x[0])}};function j(L,R,x){for(;L.length<x;)L=R+L;return L}i.DomRendererRowFactory=S=f([_(1,h.ICharacterJoinerService),_(2,M.IOptionsService),_(3,h.ICoreBrowserService),_(4,M.ICoreService),_(5,M.IDecorationService),_(6,h.IThemeService)],S)},2550:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WidthCache=void 0,i.WidthCache=class{constructor(a,f){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 d=a.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontWeight="bold";const k=a.createElement("span");k.classList.add("xterm-char-measure-element"),k.style.fontStyle="italic";const E=a.createElement("span");E.classList.add("xterm-char-measure-element"),E.style.fontWeight="bold",E.style.fontStyle="italic",this._measureElements=[_,d,k,E],this._container.appendChild(_),this._container.appendChild(d),this._container.appendChild(k),this._container.appendChild(E),f.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,f,_,d){a===this._font&&f===this._fontSize&&_===this._weight&&d===this._weightBold||(this._font=a,this._fontSize=f,this._weight=_,this._weightBold=d,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${d}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${d}`,this.clear())}get(a,f,_){let d=0;if(!f&&!_&&a.length===1&&(d=a.charCodeAt(0))<256){if(this._flat[d]!==-9999)return this._flat[d];const M=this._measure(a,0);return M>0&&(this._flat[d]=M),M}let k=a;f&&(k+="B"),_&&(k+="I");let E=this._holey.get(k);if(E===void 0){let M=0;f&&(M|=1),_&&(M|=2),E=this._measure(a,M),E>0&&this._holey.set(k,E)}return E}_measure(a,f){const _=this._measureElements[f];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 f=a(6114);i.INVERTED_DEFAULT_COLOR=257,i.DIM_OPACITY=.5,i.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(b,i)=>{function a(_){return 57508<=_&&_<=57558}function f(_){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=f,i.allowRescaling=function(_,d,k,E){return d===1&&k>Math.ceil(1.5*E)&&_!==void 0&&_>255&&!f(_)&&!a(_)&&!(function(M){return 57344<=M&&M<=63743})(_)},i.treatGlyphAsBackgroundColor=function(_){return a(_)||(function(d){return 9472<=d&&d<=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(_,d,k=0){return(_-(2*Math.round(d)-k))%(2*Math.round(d))}},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(_,d,k,E=!1){if(this.selectionStart=d,this.selectionEnd=k,!d||!k||d[0]===k[0]&&d[1]===k[1])return void this.clear();const M=_.buffers.active.ydisp,w=d[1]-M,h=k[1]-M,v=Math.max(w,0),g=Math.min(h,_.rows-1);v>=_.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=E,this.viewportStartRow=w,this.viewportEndRow=h,this.viewportCappedStartRow=v,this.viewportCappedEndRow=g,this.startCol=d[0],this.endCol=k[0])}isCellSelected(_,d,k){return!!this.hasSelection&&(k-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?d>=this.startCol&&k>=this.viewportCappedStartRow&&d<this.endCol&&k<=this.viewportCappedEndRow:d<this.startCol&&k>=this.viewportCappedStartRow&&d>=this.endCol&&k<=this.viewportCappedEndRow:k>this.viewportStartRow&&k<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&k===this.viewportStartRow&&d>=this.startCol&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportEndRow&&d<this.endCol||this.viewportStartRow<this.viewportEndRow&&k===this.viewportStartRow&&d>=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,f=this.selectionEnd;return!(!a||!f)&&(a[1]>f[1]||a[1]===f[1]&&a[0]>f[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 f=this&&this.__decorate||function(g,p,S,j){var L,R=arguments.length,x=R<3?p:j===null?j=Object.getOwnPropertyDescriptor(p,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,S,j);else for(var T=g.length-1;T>=0;T--)(L=g[T])&&(x=(R<3?L(x):R>3?L(p,S,x):L(p,S))||x);return R>3&&x&&Object.defineProperty(p,S,x),x},_=this&&this.__param||function(g,p){return function(S,j){p(S,j,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharSizeService=void 0;const d=a(2585),k=a(8460),E=a(844);let M=i.CharSizeService=class extends E.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(g,p,S){super(),this._optionsService=S,this.width=0,this.height=0,this._onCharSizeChange=this.register(new k.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new v(this._optionsService))}catch{this._measureStrategy=this.register(new h(g,p,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const g=this._measureStrategy.measure();g.width===this.width&&g.height===this.height||(this.width=g.width,this.height=g.height,this._onCharSizeChange.fire())}};i.CharSizeService=M=f([_(2,d.IOptionsService)],M);class w extends E.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(p,S){p!==void 0&&p>0&&S!==void 0&&S>0&&(this._result.width=p,this._result.height=S)}}class h extends w{constructor(p,S,j){super(),this._document=p,this._parentElement=S,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 v extends w{constructor(p){super(),this._optionsService=p,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const S=this._ctx.measureText("W");if(!("width"in S&&"fontBoundingBoxAscent"in S&&"fontBoundingBoxDescent"in S))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const p=this._ctx.measureText("W");return this._validateAndSet(p.width,p.fontBoundingBoxAscent+p.fontBoundingBoxDescent),this._result}}},4269:function(b,i,a){var f=this&&this.__decorate||function(v,g,p,S){var j,L=arguments.length,R=L<3?g:S===null?S=Object.getOwnPropertyDescriptor(g,p):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(v,g,p,S);else for(var x=v.length-1;x>=0;x--)(j=v[x])&&(R=(L<3?j(R):L>3?j(g,p,R):j(g,p))||R);return L>3&&R&&Object.defineProperty(g,p,R),R},_=this&&this.__param||function(v,g){return function(p,S){g(p,S,v)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CharacterJoinerService=i.JoinedCellData=void 0;const d=a(3734),k=a(643),E=a(511),M=a(2585);class w extends d.AttributeData{constructor(g,p,S){super(),this.content=0,this.combinedData="",this.fg=g.fg,this.bg=g.bg,this.combinedData=p,this._width=S}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(g){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}i.JoinedCellData=w;let h=i.CharacterJoinerService=class Ev{constructor(g){this._bufferService=g,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new E.CellData}register(g){const p={id:this._nextCharacterJoinerId++,handler:g};return this._characterJoiners.push(p),p.id}deregister(g){for(let p=0;p<this._characterJoiners.length;p++)if(this._characterJoiners[p].id===g)return this._characterJoiners.splice(p,1),!0;return!1}getJoinedCharacters(g){if(this._characterJoiners.length===0)return[];const p=this._bufferService.buffer.lines.get(g);if(!p||p.length===0)return[];const S=[],j=p.translateToString(!0);let L=0,R=0,x=0,T=p.getFg(0),I=p.getBg(0);for(let O=0;O<p.getTrimmedLength();O++)if(p.loadCell(O,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==T||this._workCell.bg!==I){if(O-L>1){const P=this._getJoinedRanges(j,x,R,p,L);for(let F=0;F<P.length;F++)S.push(P[F])}L=O,x=R,T=this._workCell.fg,I=this._workCell.bg}R+=this._workCell.getChars().length||k.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-L>1){const O=this._getJoinedRanges(j,x,R,p,L);for(let P=0;P<O.length;P++)S.push(O[P])}return S}_getJoinedRanges(g,p,S,j,L){const R=g.substring(p,S);let x=[];try{x=this._characterJoiners[0].handler(R)}catch(T){console.error(T)}for(let T=1;T<this._characterJoiners.length;T++)try{const I=this._characterJoiners[T].handler(R);for(let O=0;O<I.length;O++)Ev._mergeRanges(x,I[O])}catch(I){console.error(I)}return this._stringRangesToCellRanges(x,j,L),x}_stringRangesToCellRanges(g,p,S){let j=0,L=!1,R=0,x=g[j];if(x){for(let T=S;T<this._bufferService.cols;T++){const I=p.getWidth(T),O=p.getString(T).length||k.WHITESPACE_CELL_CHAR.length;if(I!==0){if(!L&&x[0]<=R&&(x[0]=T,L=!0),x[1]<=R){if(x[1]=T,x=g[++j],!x)break;x[0]<=R?(x[0]=T,L=!0):L=!1}R+=O}}x&&(x[1]=this._bufferService.cols)}}static _mergeRanges(g,p){let S=!1;for(let j=0;j<g.length;j++){const L=g[j];if(S){if(p[1]<=L[0])return g[j-1][1]=p[1],g;if(p[1]<=L[1])return g[j-1][1]=Math.max(p[1],L[1]),g.splice(j,1),g;g.splice(j,1),j--}else{if(p[1]<=L[0])return g.splice(j,0,p),g;if(p[1]<=L[1])return L[0]=Math.min(p[0],L[0]),g;p[0]<L[1]&&(L[0]=Math.min(p[0],L[0]),S=!0)}}return S?g[g.length-1][1]=p[1]:g.push(p),g}};i.CharacterJoinerService=h=f([_(0,M.IBufferService)],h)},5114:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreBrowserService=void 0;const f=a(844),_=a(8460),d=a(3656);class k extends f.Disposable{constructor(w,h,v){super(),this._textarea=w,this._window=h,this.mainDocument=v,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new E(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((g=>this._screenDprMonitor.setWindow(g)))),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 E extends f.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new f.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,f.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,d.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 f=a(844);class _ extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(k){return this.linkProviders.push(k),{dispose:()=>{const E=this.linkProviders.indexOf(k);E!==-1&&this.linkProviders.splice(E,1)}}}}i.LinkProviderService=_},8934:function(b,i,a){var f=this&&this.__decorate||function(M,w,h,v){var g,p=arguments.length,S=p<3?w:v===null?v=Object.getOwnPropertyDescriptor(w,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(M,w,h,v);else for(var j=M.length-1;j>=0;j--)(g=M[j])&&(S=(p<3?g(S):p>3?g(w,h,S):g(w,h))||S);return p>3&&S&&Object.defineProperty(w,h,S),S},_=this&&this.__param||function(M,w){return function(h,v){w(h,v,M)}};Object.defineProperty(i,"__esModule",{value:!0}),i.MouseService=void 0;const d=a(4725),k=a(9806);let E=i.MouseService=class{constructor(M,w){this._renderService=M,this._charSizeService=w}getCoords(M,w,h,v,g){return(0,k.getCoords)(window,M,w,h,v,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,g)}getMouseReportCoords(M,w){const h=(0,k.getCoordsRelativeToElement)(window,M,w);if(this._charSizeService.hasValidSize)return h[0]=Math.min(Math.max(h[0],0),this._renderService.dimensions.css.canvas.width-1),h[1]=Math.min(Math.max(h[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(h[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(h[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(h[0]),y:Math.floor(h[1])}}};i.MouseService=E=f([_(0,d.IRenderService),_(1,d.ICharSizeService)],E)},3230:function(b,i,a){var f=this&&this.__decorate||function(g,p,S,j){var L,R=arguments.length,x=R<3?p:j===null?j=Object.getOwnPropertyDescriptor(p,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,S,j);else for(var T=g.length-1;T>=0;T--)(L=g[T])&&(x=(R<3?L(x):R>3?L(p,S,x):L(p,S))||x);return R>3&&x&&Object.defineProperty(p,S,x),x},_=this&&this.__param||function(g,p){return function(S,j){p(S,j,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.RenderService=void 0;const d=a(6193),k=a(4725),E=a(8460),M=a(844),w=a(7226),h=a(2585);let v=i.RenderService=class extends M.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,p,S,j,L,R,x,T){super(),this._rowCount=g,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 E.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new E.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new E.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new d.RenderDebouncer(((I,O)=>this._renderRows(I,O)),x),this.register(this._renderDebouncer),this.register(x.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(S.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(L.onDecorationRegistered((()=>this._fullRefresh()))),this.register(L.onDecorationRemoved((()=>this._fullRefresh()))),this.register(S.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(R.cols,R.rows),this._fullRefresh()}))),this.register(S.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(R.buffer.y,R.buffer.y,!0)))),this.register(T.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(x.window,p),this.register(x.onWindowChange((I=>this._registerIntersectionObserver(I,p))))}_registerIntersectionObserver(g,p){if("IntersectionObserver"in g){const S=new g.IntersectionObserver((j=>this._handleIntersectionChange(j[j.length-1])),{threshold:0});S.observe(p),this._observerDisposable.value=(0,M.toDisposable)((()=>S.disconnect()))}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,p,S=!1){this._isPaused?this._needsFullRefresh=!0:(S||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,p,this._rowCount))}_renderRows(g,p){this._renderer.value&&(g=Math.min(g,this._rowCount-1),p=Math.min(p,this._rowCount-1),this._renderer.value.renderRows(g,p),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:p}),this._onRender.fire({start:g,end:p}),this._isNextRenderRedrawOnly=!0)}resize(g,p){this._rowCount=p,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(g){this._renderer.value=g,this._renderer.value&&(this._renderer.value.onRequestRedraw((p=>this.refreshRows(p.start,p.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var g,p;this._renderer.value&&((p=(g=this._renderer.value).clearTextureAtlas)==null||p.call(g),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(g,p){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var S;return(S=this._renderer.value)==null?void 0:S.handleResize(g,p)})):this._renderer.value.handleResize(g,p),this._fullRefresh())}handleCharSizeChanged(){var g;(g=this._renderer.value)==null||g.handleCharSizeChanged()}handleBlur(){var g;(g=this._renderer.value)==null||g.handleBlur()}handleFocus(){var g;(g=this._renderer.value)==null||g.handleFocus()}handleSelectionChanged(g,p,S){var j;this._selectionState.start=g,this._selectionState.end=p,this._selectionState.columnSelectMode=S,(j=this._renderer.value)==null||j.handleSelectionChanged(g,p,S)}handleCursorMove(){var g;(g=this._renderer.value)==null||g.handleCursorMove()}clear(){var g;(g=this._renderer.value)==null||g.clear()}};i.RenderService=v=f([_(2,h.IOptionsService),_(3,k.ICharSizeService),_(4,h.IDecorationService),_(5,h.IBufferService),_(6,k.ICoreBrowserService),_(7,k.IThemeService)],v)},9312:function(b,i,a){var f=this&&this.__decorate||function(x,T,I,O){var P,F=arguments.length,W=F<3?T:O===null?O=Object.getOwnPropertyDescriptor(T,I):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(x,T,I,O);else for(var $=x.length-1;$>=0;$--)(P=x[$])&&(W=(F<3?P(W):F>3?P(T,I,W):P(T,I))||W);return F>3&&W&&Object.defineProperty(T,I,W),W},_=this&&this.__param||function(x,T){return function(I,O){T(I,O,x)}};Object.defineProperty(i,"__esModule",{value:!0}),i.SelectionService=void 0;const d=a(9806),k=a(9504),E=a(456),M=a(4725),w=a(8460),h=a(844),v=a(6114),g=a(4841),p=a(511),S=a(2585),j=" ",L=new RegExp(j,"g");let R=i.SelectionService=class extends h.Disposable{constructor(x,T,I,O,P,F,W,$,K){super(),this._element=x,this._screenElement=T,this._linkifier=I,this._bufferService=O,this._coreService=P,this._mouseService=F,this._optionsService=W,this._renderService=$,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new p.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 E.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,h.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 x=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!x||!T||x[0]===T[0]&&x[1]===T[1])}get selectionText(){const x=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;if(!x||!T)return"";const I=this._bufferService.buffer,O=[];if(this._activeSelectionMode===3){if(x[0]===T[0])return"";const P=x[0]<T[0]?x[0]:T[0],F=x[0]<T[0]?T[0]:x[0];for(let W=x[1];W<=T[1];W++){const $=I.translateBufferLineToString(W,!0,P,F);O.push($)}}else{const P=x[1]===T[1]?T[0]:void 0;O.push(I.translateBufferLineToString(x[1],!0,x[0],P));for(let F=x[1]+1;F<=T[1]-1;F++){const W=I.lines.get(F),$=I.translateBufferLineToString(F,!0);W!=null&&W.isWrapped?O[O.length-1]+=$:O.push($)}if(x[1]!==T[1]){const F=I.lines.get(T[1]),W=I.translateBufferLineToString(T[1],!0,0,T[0]);F&&F.isWrapped?O[O.length-1]+=W:O.push(W)}}return O.map((P=>P.replace(L," "))).join(v.isWindows?`\r
126
- `:`
127
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(x){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),v.isLinux&&x&&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(x){const T=this._getMouseBufferCoords(x),I=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(I&&O&&T)&&this._areCoordsInSelection(T,I,O)}isCellInSelection(x,T){const I=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!I||!O)&&this._areCoordsInSelection([x,T],I,O)}_areCoordsInSelection(x,T,I){return x[1]>T[1]&&x[1]<I[1]||T[1]===I[1]&&x[1]===T[1]&&x[0]>=T[0]&&x[0]<I[0]||T[1]<I[1]&&x[1]===I[1]&&x[0]<I[0]||T[1]<I[1]&&x[1]===T[1]&&x[0]>=T[0]}_selectWordAtCursor(x,T){var P,F;const I=(F=(P=this._linkifier.currentLink)==null?void 0:P.link)==null?void 0:F.range;if(I)return this._model.selectionStart=[I.start.x-1,I.start.y-1],this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const O=this._getMouseBufferCoords(x);return!!O&&(this._selectWordAt(O,T),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(x,T){this._model.clearSelection(),x=Math.max(x,0),T=Math.min(T,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,x],this._model.selectionEnd=[this._bufferService.cols,T],this.refresh(),this._onSelectionChange.fire()}_handleTrim(x){this._model.handleTrim(x)&&this.refresh()}_getMouseBufferCoords(x){const T=this._mouseService.getCoords(x,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(T)return T[0]--,T[1]--,T[1]+=this._bufferService.buffer.ydisp,T}_getMouseEventScrollAmount(x){let T=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,x,this._screenElement)[1];const I=this._renderService.dimensions.css.canvas.height;return T>=0&&T<=I?0:(T>I&&(T-=I),T=Math.min(Math.max(T,-50),50),T/=50,T/Math.abs(T)+Math.round(14*T))}shouldForceSelection(x){return v.isMac?x.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:x.shiftKey}handleMouseDown(x){if(this._mouseDownTimeStamp=x.timeStamp,(x.button!==2||!this.hasSelection)&&x.button===0){if(!this._enabled){if(!this.shouldForceSelection(x))return;x.stopPropagation()}x.preventDefault(),this._dragScrollAmount=0,this._enabled&&x.shiftKey?this._handleIncrementalClick(x):x.detail===1?this._handleSingleClick(x):x.detail===2?this._handleDoubleClick(x):x.detail===3&&this._handleTripleClick(x),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(x){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(x))}_handleSingleClick(x){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(x)?3:0,this._model.selectionStart=this._getMouseBufferCoords(x),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const T=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);T&&T.length!==this._model.selectionStart[0]&&T.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(x){this._selectWordAtCursor(x,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(x){const T=this._getMouseBufferCoords(x);T&&(this._activeSelectionMode=2,this._selectLineAt(T[1]))}shouldColumnSelect(x){return x.altKey&&!(v.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(x){if(x.stopImmediatePropagation(),!this._model.selectionStart)return;const T=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(x),!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(x),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 O=I.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}T&&T[0]===this._model.selectionEnd[0]&&T[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const x=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(x.ydisp+this._bufferService.rows,x.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=x.ydisp),this.refresh()}}_handleMouseUp(x){const T=x.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&T<500&&x.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const I=this._mouseService.getCoords(x,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(I&&I[0]!==void 0&&I[1]!==void 0){const O=(0,k.moveToCellSequence)(I[0]-1,I[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const x=this._model.finalSelectionStart,T=this._model.finalSelectionEnd,I=!(!x||!T||x[0]===T[0]&&x[1]===T[1]);I?x&&T&&(this._oldSelectionStart&&this._oldSelectionEnd&&x[0]===this._oldSelectionStart[0]&&x[1]===this._oldSelectionStart[1]&&T[0]===this._oldSelectionEnd[0]&&T[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(x,T,I)):this._oldHasSelection&&this._fireOnSelectionChange(x,T,I)}_fireOnSelectionChange(x,T,I){this._oldSelectionStart=x,this._oldSelectionEnd=T,this._oldHasSelection=I,this._onSelectionChange.fire()}_handleBufferActivate(x){this.clearSelection(),this._trimListener.dispose(),this._trimListener=x.activeBuffer.lines.onTrim((T=>this._handleTrim(T)))}_convertViewportColToCharacterIndex(x,T){let I=T;for(let O=0;T>=O;O++){const P=x.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?I--:P>1&&T!==O&&(I+=P-1)}return I}setSelection(x,T,I){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[x,T],this._model.selectionStartLength=I,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(x){this._isClickInSelection(x)||(this._selectWordAtCursor(x,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(x,T,I=!0,O=!0){if(x[0]>=this._bufferService.cols)return;const P=this._bufferService.buffer,F=P.lines.get(x[1]);if(!F)return;const W=P.translateBufferLineToString(x[1],!1);let $=this._convertViewportColToCharacterIndex(F,x[0]),K=$;const G=x[0]-$;let q=0,D=0,U=0,H=0;if(W.charAt($)===" "){for(;$>0&&W.charAt($-1)===" ";)$--;for(;K<W.length&&W.charAt(K+1)===" ";)K++}else{let ie=x[0],ye=x[0];F.getWidth(ie)===0&&(q++,ie--),F.getWidth(ye)===2&&(D++,ye++);const _e=F.getString(ye).length;for(_e>1&&(H+=_e-1,K+=_e-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?(q++,ie--):Q>1&&(U+=Q-1,$-=Q-1),$--,ie--}for(;ye<F.length&&K+1<W.length&&!this._isCharWordSeparator(F.loadCell(ye+1,this._workCell));){F.loadCell(ye+1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===2?(D++,ye++):Q>1&&(H+=Q-1,K+=Q-1),K++,ye++}}K++;let z=$+G-q+U,Z=Math.min(this._bufferService.cols,K-$+q+D-U-H);if(T||W.slice($,K).trim()!==""){if(I&&z===0&&F.getCodePoint(0)!==32){const ie=P.lines.get(x[1]-1);if(ie&&F.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const ye=this._getWordAt([this._bufferService.cols-1,x[1]-1],!1,!0,!1);if(ye){const _e=this._bufferService.cols-ye.start;z-=_e,Z+=_e}}}if(O&&z+Z===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const ie=P.lines.get(x[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const ye=this._getWordAt([0,x[1]+1],!1,!1,!0);ye&&(Z+=ye.length)}}return{start:z,length:Z}}}_selectWordAt(x,T){const I=this._getWordAt(x,T);if(I){for(;I.start<0;)I.start+=this._bufferService.cols,x[1]--;this._model.selectionStart=[I.start,x[1]],this._model.selectionStartLength=I.length}}_selectToWordAt(x){const T=this._getWordAt(x,!0);if(T){let I=x[1];for(;T.start<0;)T.start+=this._bufferService.cols,I--;if(!this._model.areSelectionValuesReversed())for(;T.start+T.length>this._bufferService.cols;)T.length-=this._bufferService.cols,I++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?T.start:T.start+T.length,I]}}_isCharWordSeparator(x){return x.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(x.getChars())>=0}_selectLineAt(x){const T=this._bufferService.buffer.getWrappedRangeForLine(x),I={start:{x:0,y:T.first},end:{x:this._bufferService.cols-1,y:T.last}};this._model.selectionStart=[0,T.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,g.getRangeLength)(I,this._bufferService.cols)}};i.SelectionService=R=f([_(3,S.IBufferService),_(4,S.ICoreService),_(5,M.IMouseService),_(6,S.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 f=a(8343);i.ICharSizeService=(0,f.createDecorator)("CharSizeService"),i.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),i.IMouseService=(0,f.createDecorator)("MouseService"),i.IRenderService=(0,f.createDecorator)("RenderService"),i.ISelectionService=(0,f.createDecorator)("SelectionService"),i.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),i.IThemeService=(0,f.createDecorator)("ThemeService"),i.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(b,i,a){var f=this&&this.__decorate||function(R,x,T,I){var O,P=arguments.length,F=P<3?x:I===null?I=Object.getOwnPropertyDescriptor(x,T):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(R,x,T,I);else for(var W=R.length-1;W>=0;W--)(O=R[W])&&(F=(P<3?O(F):P>3?O(x,T,F):O(x,T))||F);return P>3&&F&&Object.defineProperty(x,T,F),F},_=this&&this.__param||function(R,x){return function(T,I){x(T,I,R)}};Object.defineProperty(i,"__esModule",{value:!0}),i.ThemeService=i.DEFAULT_ANSI_COLORS=void 0;const d=a(7239),k=a(8055),E=a(8460),M=a(844),w=a(2585),h=k.css.toColor("#ffffff"),v=k.css.toColor("#000000"),g=k.css.toColor("#ffffff"),p=k.css.toColor("#000000"),S={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")],x=[0,95,135,175,215,255];for(let T=0;T<216;T++){const I=x[T/36%6|0],O=x[T/6%6|0],P=x[T%6];R.push({css:k.channels.toCss(I,O,P),rgba:k.channels.toRgba(I,O,P)})}for(let T=0;T<24;T++){const I=8+10*T;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 d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new E.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:h,background:v,cursor:g,cursorAccent:p,selectionForeground:void 0,selectionBackgroundTransparent:S,selectionBackgroundOpaque:k.color.blend(v,S),selectionInactiveBackgroundTransparent:S,selectionInactiveBackgroundOpaque:k.color.blend(v,S),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 x=this._colors;if(x.foreground=L(R.foreground,h),x.background=L(R.background,v),x.cursor=L(R.cursor,g),x.cursorAccent=L(R.cursorAccent,p),x.selectionBackgroundTransparent=L(R.selectionBackground,S),x.selectionBackgroundOpaque=k.color.blend(x.background,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundTransparent=L(R.selectionInactiveBackground,x.selectionBackgroundTransparent),x.selectionInactiveBackgroundOpaque=k.color.blend(x.background,x.selectionInactiveBackgroundTransparent),x.selectionForeground=R.selectionForeground?L(R.selectionForeground,k.NULL_COLOR):void 0,x.selectionForeground===k.NULL_COLOR&&(x.selectionForeground=void 0),k.color.isOpaque(x.selectionBackgroundTransparent)&&(x.selectionBackgroundTransparent=k.color.opacity(x.selectionBackgroundTransparent,.3)),k.color.isOpaque(x.selectionInactiveBackgroundTransparent)&&(x.selectionInactiveBackgroundTransparent=k.color.opacity(x.selectionInactiveBackgroundTransparent,.3)),x.ansi=i.DEFAULT_ANSI_COLORS.slice(),x.ansi[0]=L(R.black,i.DEFAULT_ANSI_COLORS[0]),x.ansi[1]=L(R.red,i.DEFAULT_ANSI_COLORS[1]),x.ansi[2]=L(R.green,i.DEFAULT_ANSI_COLORS[2]),x.ansi[3]=L(R.yellow,i.DEFAULT_ANSI_COLORS[3]),x.ansi[4]=L(R.blue,i.DEFAULT_ANSI_COLORS[4]),x.ansi[5]=L(R.magenta,i.DEFAULT_ANSI_COLORS[5]),x.ansi[6]=L(R.cyan,i.DEFAULT_ANSI_COLORS[6]),x.ansi[7]=L(R.white,i.DEFAULT_ANSI_COLORS[7]),x.ansi[8]=L(R.brightBlack,i.DEFAULT_ANSI_COLORS[8]),x.ansi[9]=L(R.brightRed,i.DEFAULT_ANSI_COLORS[9]),x.ansi[10]=L(R.brightGreen,i.DEFAULT_ANSI_COLORS[10]),x.ansi[11]=L(R.brightYellow,i.DEFAULT_ANSI_COLORS[11]),x.ansi[12]=L(R.brightBlue,i.DEFAULT_ANSI_COLORS[12]),x.ansi[13]=L(R.brightMagenta,i.DEFAULT_ANSI_COLORS[13]),x.ansi[14]=L(R.brightCyan,i.DEFAULT_ANSI_COLORS[14]),x.ansi[15]=L(R.brightWhite,i.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const T=Math.min(x.ansi.length-16,R.extendedAnsi.length);for(let I=0;I<T;I++)x.ansi[I+16]=L(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 x=0;x<this._restoreColors.ansi.length;++x)this._colors.ansi[x]=this._restoreColors.ansi[x]}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 L(R,x){if(R!==void 0)try{return k.css.toColor(R)}catch{}return x}i.ThemeService=j=f([_(0,w.IOptionsService)],j)},6349:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CircularList=void 0;const f=a(8460),_=a(844);class d extends _.Disposable{constructor(E){super(),this._maxLength=E,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.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(E){if(this._maxLength===E)return;const M=new Array(E);for(let w=0;w<Math.min(E,this.length);w++)M[w]=this._array[this._getCyclicIndex(w)];this._array=M,this._maxLength=E,this._startIndex=0}get length(){return this._length}set length(E){if(E>this._length)for(let M=this._length;M<E;M++)this._array[M]=void 0;this._length=E}get(E){return this._array[this._getCyclicIndex(E)]}set(E,M){this._array[this._getCyclicIndex(E)]=M}push(E){this._array[this._getCyclicIndex(this._length)]=E,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(E,M,...w){if(M){for(let h=E;h<this._length-M;h++)this._array[this._getCyclicIndex(h)]=this._array[this._getCyclicIndex(h+M)];this._length-=M,this.onDeleteEmitter.fire({index:E,amount:M})}for(let h=this._length-1;h>=E;h--)this._array[this._getCyclicIndex(h+w.length)]=this._array[this._getCyclicIndex(h)];for(let h=0;h<w.length;h++)this._array[this._getCyclicIndex(E+h)]=w[h];if(w.length&&this.onInsertEmitter.fire({index:E,amount:w.length}),this._length+w.length>this._maxLength){const h=this._length+w.length-this._maxLength;this._startIndex+=h,this._length=this._maxLength,this.onTrimEmitter.fire(h)}else this._length+=w.length}trimStart(E){E>this._length&&(E=this._length),this._startIndex+=E,this._length-=E,this.onTrimEmitter.fire(E)}shiftElements(E,M,w){if(!(M<=0)){if(E<0||E>=this._length)throw new Error("start argument out of range");if(E+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let v=M-1;v>=0;v--)this.set(E+v+w,this.get(E+v));const h=E+M+w-this._length;if(h>0)for(this._length+=h;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let h=0;h<M;h++)this.set(E+h+w,this.get(E+h))}}_getCyclicIndex(E){return(this._startIndex+E)%this._maxLength}}i.CircularList=d},1439:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.clone=void 0,i.clone=function a(f,_=5){if(typeof f!="object")return f;const d=Array.isArray(f)?[]:{};for(const k in f)d[k]=_<=1?f[k]:f[k]&&a(f[k],_-1);return d}},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,f=0,_=0,d=0;var k,E,M,w,h;function v(p){const S=p.toString(16);return S.length<2?"0"+S:S}function g(p,S){return p<S?(S+.05)/(p+.05):(p+.05)/(S+.05)}i.NULL_COLOR={css:"#00000000",rgba:0},(function(p){p.toCss=function(S,j,L,R){return R!==void 0?`#${v(S)}${v(j)}${v(L)}${v(R)}`:`#${v(S)}${v(j)}${v(L)}`},p.toRgba=function(S,j,L,R=255){return(S<<24|j<<16|L<<8|R)>>>0},p.toColor=function(S,j,L,R){return{css:p.toCss(S,j,L,R),rgba:p.toRgba(S,j,L,R)}}})(k||(i.channels=k={})),(function(p){function S(j,L){return d=Math.round(255*L),[a,f,_]=h.toChannels(j.rgba),{css:k.toCss(a,f,_,d),rgba:k.toRgba(a,f,_,d)}}p.blend=function(j,L){if(d=(255&L.rgba)/255,d===1)return{css:L.css,rgba:L.rgba};const R=L.rgba>>24&255,x=L.rgba>>16&255,T=L.rgba>>8&255,I=j.rgba>>24&255,O=j.rgba>>16&255,P=j.rgba>>8&255;return a=I+Math.round((R-I)*d),f=O+Math.round((x-O)*d),_=P+Math.round((T-P)*d),{css:k.toCss(a,f,_),rgba:k.toRgba(a,f,_)}},p.isOpaque=function(j){return(255&j.rgba)==255},p.ensureContrastRatio=function(j,L,R){const x=h.ensureContrastRatio(j.rgba,L.rgba,R);if(x)return k.toColor(x>>24&255,x>>16&255,x>>8&255)},p.opaque=function(j){const L=(255|j.rgba)>>>0;return[a,f,_]=h.toChannels(L),{css:k.toCss(a,f,_),rgba:L}},p.opacity=S,p.multiplyOpacity=function(j,L){return d=255&j.rgba,S(j,d*L/255)},p.toColorRGB=function(j){return[j.rgba>>24&255,j.rgba>>16&255,j.rgba>>8&255]}})(E||(i.color=E={})),(function(p){let S,j;try{const L=document.createElement("canvas");L.width=1,L.height=1;const R=L.getContext("2d",{willReadFrequently:!0});R&&(S=R,S.globalCompositeOperation="copy",j=S.createLinearGradient(0,0,1,1))}catch{}p.toColor=function(L){if(L.match(/#[\da-f]{3,8}/i))switch(L.length){case 4:return a=parseInt(L.slice(1,2).repeat(2),16),f=parseInt(L.slice(2,3).repeat(2),16),_=parseInt(L.slice(3,4).repeat(2),16),k.toColor(a,f,_);case 5:return a=parseInt(L.slice(1,2).repeat(2),16),f=parseInt(L.slice(2,3).repeat(2),16),_=parseInt(L.slice(3,4).repeat(2),16),d=parseInt(L.slice(4,5).repeat(2),16),k.toColor(a,f,_,d);case 7:return{css:L,rgba:(parseInt(L.slice(1),16)<<8|255)>>>0};case 9:return{css:L,rgba:parseInt(L.slice(1),16)>>>0}}const R=L.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]),f=parseInt(R[2]),_=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),k.toColor(a,f,_,d);if(!S||!j)throw new Error("css.toColor: Unsupported css format");if(S.fillStyle=j,S.fillStyle=L,typeof S.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(S.fillRect(0,0,1,1),[a,f,_,d]=S.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:k.toRgba(a,f,_,d),css:L}}})(M||(i.css=M={})),(function(p){function S(j,L,R){const x=j/255,T=L/255,I=R/255;return .2126*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.7152*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))+.0722*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))}p.relativeLuminance=function(j){return S(j>>16&255,j>>8&255,255&j)},p.relativeLuminance2=S})(w||(i.rgb=w={})),(function(p){function S(L,R,x){const T=L>>24&255,I=L>>16&255,O=L>>8&255;let P=R>>24&255,F=R>>16&255,W=R>>8&255,$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));for(;$<x&&(P>0||F>0||W>0);)P-=Math.max(0,Math.ceil(.1*P)),F-=Math.max(0,Math.ceil(.1*F)),W-=Math.max(0,Math.ceil(.1*W)),$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));return(P<<24|F<<16|W<<8|255)>>>0}function j(L,R,x){const T=L>>24&255,I=L>>16&255,O=L>>8&255;let P=R>>24&255,F=R>>16&255,W=R>>8&255,$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));for(;$<x&&(P<255||F<255||W<255);)P=Math.min(255,P+Math.ceil(.1*(255-P))),F=Math.min(255,F+Math.ceil(.1*(255-F))),W=Math.min(255,W+Math.ceil(.1*(255-W))),$=g(w.relativeLuminance2(P,F,W),w.relativeLuminance2(T,I,O));return(P<<24|F<<16|W<<8|255)>>>0}p.blend=function(L,R){if(d=(255&R)/255,d===1)return R;const x=R>>24&255,T=R>>16&255,I=R>>8&255,O=L>>24&255,P=L>>16&255,F=L>>8&255;return a=O+Math.round((x-O)*d),f=P+Math.round((T-P)*d),_=F+Math.round((I-F)*d),k.toRgba(a,f,_)},p.ensureContrastRatio=function(L,R,x){const T=w.relativeLuminance(L>>8),I=w.relativeLuminance(R>>8);if(g(T,I)<x){if(I<T){const F=S(L,R,x),W=g(T,w.relativeLuminance(F>>8));if(W<x){const $=j(L,R,x);return W>g(T,w.relativeLuminance($>>8))?F:$}return F}const O=j(L,R,x),P=g(T,w.relativeLuminance(O>>8));if(P<x){const F=S(L,R,x);return P>g(T,w.relativeLuminance(F>>8))?O:F}return O}},p.reduceLuminance=S,p.increaseLuminance=j,p.toChannels=function(L){return[L>>24&255,L>>16&255,L>>8&255,255&L]}})(h||(i.rgba=h={})),i.toPaddedHex=v,i.contrastRatio=g},8969:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.CoreTerminal=void 0;const f=a(844),_=a(2585),d=a(4348),k=a(7866),E=a(744),M=a(7302),w=a(6975),h=a(8460),v=a(1753),g=a(1480),p=a(7994),S=a(9282),j=a(5435),L=a(5981),R=a(2660);let x=!1;class T extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new h.EventEmitter),this._onScroll.event((O=>{var P;(P=this._onScrollApi)==null||P.fire(O.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(O){for(const P in O)this.optionsService.options[P]=O[P]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new h.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new h.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new M.OptionsService(O)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(E.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(v.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(g.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(p.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,h.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,h.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,h.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,h.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((P=>{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((P=>{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 L.WriteBuffer(((P,F)=>this._inputHandler.parse(P,F)))),this.register((0,h.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,P){this._writeBuffer.write(O,P)}writeSync(O,P){this._logService.logLevel<=_.LogLevelEnum.WARN&&!x&&(this._logService.warn("writeSync is unreliable and will be removed soon."),x=!0),this._writeBuffer.writeSync(O,P)}input(O,P=!0){this.coreService.triggerDataEvent(O,P)}resize(O,P){isNaN(O)||isNaN(P)||(O=Math.max(O,E.MINIMUM_COLS),P=Math.max(P,E.MINIMUM_ROWS),this._bufferService.resize(O,P))}scroll(O,P=!1){this._bufferService.scroll(O,P)}scrollLines(O,P,F){this._bufferService.scrollLines(O,P,F)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const P=O-this._bufferService.buffer.ydisp;P!==0&&this.scrollLines(P)}registerEscHandler(O,P){return this._inputHandler.registerEscHandler(O,P)}registerDcsHandler(O,P){return this._inputHandler.registerDcsHandler(O,P)}registerCsiHandler(O,P){return this._inputHandler.registerCsiHandler(O,P)}registerOscHandler(O,P){return this._inputHandler.registerOscHandler(O,P)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const P=this.optionsService.rawOptions.windowsPty;P&&P.buildNumber!==void 0&&P.buildNumber!==void 0?O=P.backend==="conpty"&&P.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(S.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,S.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const P of O)P.dispose()}))}}}i.CoreTerminal=T},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 f=0;f<this._listeners.length;f++)if(this._listeners[f]===a)return void this._listeners.splice(f,1)}}})),this._event}fire(a,f){const _=[];for(let d=0;d<this._listeners.length;d++)_.push(this._listeners[d]);for(let d=0;d<_.length;d++)_[d].call(void 0,a,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},i.forwardEvent=function(a,f){return a((_=>f.fire(_)))},i.runAndSubscribe=function(a,f){return f(void 0),a((_=>f(_)))}},5435:function(b,i,a){var f=this&&this.__decorate||function(q,D,U,H){var z,Z=arguments.length,ie=Z<3?D:H===null?H=Object.getOwnPropertyDescriptor(D,U):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(q,D,U,H);else for(var ye=q.length-1;ye>=0;ye--)(z=q[ye])&&(ie=(Z<3?z(ie):Z>3?z(D,U,ie):z(D,U))||ie);return Z>3&&ie&&Object.defineProperty(D,U,ie),ie},_=this&&this.__param||function(q,D){return function(U,H){D(U,H,q)}};Object.defineProperty(i,"__esModule",{value:!0}),i.InputHandler=i.WindowsOptionsReportType=void 0;const d=a(2584),k=a(7116),E=a(2015),M=a(844),w=a(482),h=a(8437),v=a(8460),g=a(643),p=a(511),S=a(3734),j=a(2585),L=a(1480),R=a(6242),x=a(6351),T=a(5941),I={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function P(q,D){if(q>24)return D.setWinLines||!1;switch(q){case 1:return!!D.restoreWin;case 2:return!!D.minimizeWin;case 3:return!!D.setWinPosition;case 4:return!!D.setWinSizePixels;case 5:return!!D.raiseWin;case 6:return!!D.lowerWin;case 7:return!!D.refreshWin;case 8:return!!D.setWinSizeChars;case 9:return!!D.maximizeWin;case 10:return!!D.fullscreenWin;case 11:return!!D.getWinState;case 13:return!!D.getWinPosition;case 14:return!!D.getWinSizePixels;case 15:return!!D.getScreenSizePixels;case 16:return!!D.getCellSizePixels;case 18:return!!D.getWinSizeChars;case 19:return!!D.getScreenSizeChars;case 20:return!!D.getIconTitle;case 21:return!!D.getWinTitle;case 22:return!!D.pushTitle;case 23:return!!D.popTitle;case 24:return!!D.setWinLines}return!1}var F;(function(q){q[q.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",q[q.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(D,U,H,z,Z,ie,ye,_e,Q=new E.EscapeSequenceParser){super(),this._bufferService=D,this._charsetService=U,this._coreService=H,this._logService=z,this._optionsService=Z,this._oscLinkService=ie,this._coreMouseService=ye,this._unicodeService=_e,this._parser=Q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new p.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new v.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new v.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new v.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new v.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new v.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new v.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new v.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new v.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new v.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new v.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new v.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new v.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new v.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 K(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((Y=>this._activeBuffer=Y.activeBuffer))),this._parser.setCsiHandlerFallback(((Y,ne)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Y),params:ne.toArray()})})),this._parser.setEscHandlerFallback((Y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Y)})})),this._parser.setExecuteHandlerFallback((Y=>{this._logService.debug("Unknown EXECUTE code: ",{code:Y})})),this._parser.setOscHandlerFallback(((Y,ne,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:Y,action:ne,data:ee})})),this._parser.setDcsHandlerFallback(((Y,ne,ee)=>{ne==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Y),action:ne,payload:ee})})),this._parser.setPrintHandler(((Y,ne,ee)=>this.print(Y,ne,ee))),this._parser.registerCsiHandler({final:"@"},(Y=>this.insertChars(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(Y=>this.scrollLeft(Y))),this._parser.registerCsiHandler({final:"A"},(Y=>this.cursorUp(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(Y=>this.scrollRight(Y))),this._parser.registerCsiHandler({final:"B"},(Y=>this.cursorDown(Y))),this._parser.registerCsiHandler({final:"C"},(Y=>this.cursorForward(Y))),this._parser.registerCsiHandler({final:"D"},(Y=>this.cursorBackward(Y))),this._parser.registerCsiHandler({final:"E"},(Y=>this.cursorNextLine(Y))),this._parser.registerCsiHandler({final:"F"},(Y=>this.cursorPrecedingLine(Y))),this._parser.registerCsiHandler({final:"G"},(Y=>this.cursorCharAbsolute(Y))),this._parser.registerCsiHandler({final:"H"},(Y=>this.cursorPosition(Y))),this._parser.registerCsiHandler({final:"I"},(Y=>this.cursorForwardTab(Y))),this._parser.registerCsiHandler({final:"J"},(Y=>this.eraseInDisplay(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(Y=>this.eraseInDisplay(Y,!0))),this._parser.registerCsiHandler({final:"K"},(Y=>this.eraseInLine(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(Y=>this.eraseInLine(Y,!0))),this._parser.registerCsiHandler({final:"L"},(Y=>this.insertLines(Y))),this._parser.registerCsiHandler({final:"M"},(Y=>this.deleteLines(Y))),this._parser.registerCsiHandler({final:"P"},(Y=>this.deleteChars(Y))),this._parser.registerCsiHandler({final:"S"},(Y=>this.scrollUp(Y))),this._parser.registerCsiHandler({final:"T"},(Y=>this.scrollDown(Y))),this._parser.registerCsiHandler({final:"X"},(Y=>this.eraseChars(Y))),this._parser.registerCsiHandler({final:"Z"},(Y=>this.cursorBackwardTab(Y))),this._parser.registerCsiHandler({final:"`"},(Y=>this.charPosAbsolute(Y))),this._parser.registerCsiHandler({final:"a"},(Y=>this.hPositionRelative(Y))),this._parser.registerCsiHandler({final:"b"},(Y=>this.repeatPrecedingCharacter(Y))),this._parser.registerCsiHandler({final:"c"},(Y=>this.sendDeviceAttributesPrimary(Y))),this._parser.registerCsiHandler({prefix:">",final:"c"},(Y=>this.sendDeviceAttributesSecondary(Y))),this._parser.registerCsiHandler({final:"d"},(Y=>this.linePosAbsolute(Y))),this._parser.registerCsiHandler({final:"e"},(Y=>this.vPositionRelative(Y))),this._parser.registerCsiHandler({final:"f"},(Y=>this.hVPosition(Y))),this._parser.registerCsiHandler({final:"g"},(Y=>this.tabClear(Y))),this._parser.registerCsiHandler({final:"h"},(Y=>this.setMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(Y=>this.setModePrivate(Y))),this._parser.registerCsiHandler({final:"l"},(Y=>this.resetMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(Y=>this.resetModePrivate(Y))),this._parser.registerCsiHandler({final:"m"},(Y=>this.charAttributes(Y))),this._parser.registerCsiHandler({final:"n"},(Y=>this.deviceStatus(Y))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(Y=>this.deviceStatusPrivate(Y))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(Y=>this.softReset(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(Y=>this.setCursorStyle(Y))),this._parser.registerCsiHandler({final:"r"},(Y=>this.setScrollRegion(Y))),this._parser.registerCsiHandler({final:"s"},(Y=>this.saveCursor(Y))),this._parser.registerCsiHandler({final:"t"},(Y=>this.windowOptions(Y))),this._parser.registerCsiHandler({final:"u"},(Y=>this.restoreCursor(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(Y=>this.insertColumns(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(Y=>this.deleteColumns(Y))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(Y=>this.selectProtected(Y))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((Y=>(this.setTitle(Y),this.setIconName(Y),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((Y=>this.setIconName(Y)))),this._parser.registerOscHandler(2,new R.OscHandler((Y=>this.setTitle(Y)))),this._parser.registerOscHandler(4,new R.OscHandler((Y=>this.setOrReportIndexedColor(Y)))),this._parser.registerOscHandler(8,new R.OscHandler((Y=>this.setHyperlink(Y)))),this._parser.registerOscHandler(10,new R.OscHandler((Y=>this.setOrReportFgColor(Y)))),this._parser.registerOscHandler(11,new R.OscHandler((Y=>this.setOrReportBgColor(Y)))),this._parser.registerOscHandler(12,new R.OscHandler((Y=>this.setOrReportCursorColor(Y)))),this._parser.registerOscHandler(104,new R.OscHandler((Y=>this.restoreIndexedColor(Y)))),this._parser.registerOscHandler(110,new R.OscHandler((Y=>this.restoreFgColor(Y)))),this._parser.registerOscHandler(111,new R.OscHandler((Y=>this.restoreBgColor(Y)))),this._parser.registerOscHandler(112,new R.OscHandler((Y=>this.restoreCursorColor(Y)))),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 Y in k.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Y},(()=>this.selectCharset("("+Y))),this._parser.registerEscHandler({intermediates:")",final:Y},(()=>this.selectCharset(")"+Y))),this._parser.registerEscHandler({intermediates:"*",final:Y},(()=>this.selectCharset("*"+Y))),this._parser.registerEscHandler({intermediates:"+",final:Y},(()=>this.selectCharset("+"+Y))),this._parser.registerEscHandler({intermediates:"-",final:Y},(()=>this.selectCharset("-"+Y))),this._parser.registerEscHandler({intermediates:".",final:Y},(()=>this.selectCharset("."+Y))),this._parser.registerEscHandler({intermediates:"/",final:Y},(()=>this.selectCharset("/"+Y)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((Y=>(this._logService.error("Parsing error: ",Y),Y))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new x.DcsHandler(((Y,ne)=>this.requestStatusString(Y,ne))))}_preserveStack(D,U,H,z){this._parseStack.paused=!0,this._parseStack.cursorStartX=D,this._parseStack.cursorStartY=U,this._parseStack.decodedLength=H,this._parseStack.position=z}_logSlowResolvingAsync(D){this._logService.logLevel<=j.LogLevelEnum.WARN&&Promise.race([D,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(D,U){let H,z=this._activeBuffer.x,Z=this._activeBuffer.y,ie=0;const ye=this._parseStack.paused;if(ye){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,D.length>O&&(ie=this._parseStack.position+O)}if(this._logService.logLevel<=j.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof D=="string"?` "${D}"`:` "${Array.prototype.map.call(D,(Y=>String.fromCharCode(Y))).join("")}"`),typeof D=="string"?D.split("").map((Y=>Y.charCodeAt(0))):D),this._parseBuffer.length<D.length&&this._parseBuffer.length<O&&(this._parseBuffer=new Uint32Array(Math.min(D.length,O))),ye||this._dirtyRowTracker.clearRange(),D.length>O)for(let Y=ie;Y<D.length;Y+=O){const ne=Y+O<D.length?Y+O:D.length,ee=typeof D=="string"?this._stringDecoder.decode(D.substring(Y,ne),this._parseBuffer):this._utf8Decoder.decode(D.subarray(Y,ne),this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,ee))return this._preserveStack(z,Z,ee,Y),this._logSlowResolvingAsync(H),H}else if(!ye){const Y=typeof D=="string"?this._stringDecoder.decode(D,this._parseBuffer):this._utf8Decoder.decode(D,this._parseBuffer);if(H=this._parser.parse(this._parseBuffer,Y))return this._preserveStack(z,Z,Y,0),this._logSlowResolvingAsync(H),H}this._activeBuffer.x===z&&this._activeBuffer.y===Z||this._onCursorMove.fire();const _e=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(_e,this._bufferService.rows-1))}print(D,U,H){let z,Z;const ie=this._charsetService.charset,ye=this._optionsService.rawOptions.screenReaderMode,_e=this._bufferService.cols,Q=this._coreService.decPrivateModes.wraparound,Y=this._coreService.modes.insertMode,ne=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,ne);let be=this._parser.precedingJoinState;for(let me=U;me<H;++me){if(z=D[me],z<127&&ie){const dt=ie[String.fromCharCode(z)];dt&&(z=dt.charCodeAt(0))}const Be=this._unicodeService.charProperties(z,be);Z=L.UnicodeService.extractWidth(Be);const ze=L.UnicodeService.extractShouldJoin(Be),Qe=ze?L.UnicodeService.extractWidth(be):0;if(be=Be,ye&&this._onA11yChar.fire((0,w.stringFromCodePoint)(z)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+Z-Qe>_e){if(Q){const dt=ee;let Ie=this._activeBuffer.x-Qe;for(this._activeBuffer.x=Qe,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),Qe>0&&ee instanceof h.BufferLine&&ee.copyCellsFrom(dt,Ie,0,Qe,!1);Ie<_e;)dt.setCellFromCodepoint(Ie++,0,1,ne)}else if(this._activeBuffer.x=_e-1,Z===2)continue}if(ze&&this._activeBuffer.x){const dt=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-dt,z,Z);for(let Ie=Z-Qe;--Ie>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}else if(Y&&(ee.insertCells(this._activeBuffer.x,Z-Qe,this._activeBuffer.getNullCell(ne)),ee.getWidth(_e-1)===2&&ee.setCellFromCodepoint(_e-1,g.NULL_CELL_CODE,g.NULL_CELL_WIDTH,ne)),ee.setCellFromCodepoint(this._activeBuffer.x++,z,Z,ne),Z>0)for(;--Z;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,ne)}this._parser.precedingJoinState=be,this._activeBuffer.x<_e&&H-U>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,ne),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(D,U){return D.final!=="t"||D.prefix||D.intermediates?this._parser.registerCsiHandler(D,U):this._parser.registerCsiHandler(D,(H=>!P(H.params[0],this._optionsService.rawOptions.windowOptions)||U(H)))}registerDcsHandler(D,U){return this._parser.registerDcsHandler(D,new x.DcsHandler(U))}registerEscHandler(D,U){return this._parser.registerEscHandler(D,U)}registerOscHandler(D,U){return this._parser.registerOscHandler(D,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 D;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&&((D=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&D.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 D=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-D),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(D=this._bufferService.cols-1){this._activeBuffer.x=Math.min(D,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(D,U){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=D,this._activeBuffer.y=this._activeBuffer.scrollTop+U):(this._activeBuffer.x=D,this._activeBuffer.y=U),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(D,U){this._restrictCursor(),this._setCursor(this._activeBuffer.x+D,this._activeBuffer.y+U)}cursorUp(D){const U=this._activeBuffer.y-this._activeBuffer.scrollTop;return U>=0?this._moveCursor(0,-Math.min(U,D.params[0]||1)):this._moveCursor(0,-(D.params[0]||1)),!0}cursorDown(D){const U=this._activeBuffer.scrollBottom-this._activeBuffer.y;return U>=0?this._moveCursor(0,Math.min(U,D.params[0]||1)):this._moveCursor(0,D.params[0]||1),!0}cursorForward(D){return this._moveCursor(D.params[0]||1,0),!0}cursorBackward(D){return this._moveCursor(-(D.params[0]||1),0),!0}cursorNextLine(D){return this.cursorDown(D),this._activeBuffer.x=0,!0}cursorPrecedingLine(D){return this.cursorUp(D),this._activeBuffer.x=0,!0}cursorCharAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(D){return this._setCursor(D.length>=2?(D.params[1]||1)-1:0,(D.params[0]||1)-1),!0}charPosAbsolute(D){return this._setCursor((D.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(D){return this._moveCursor(D.params[0]||1,0),!0}linePosAbsolute(D){return this._setCursor(this._activeBuffer.x,(D.params[0]||1)-1),!0}vPositionRelative(D){return this._moveCursor(0,D.params[0]||1),!0}hVPosition(D){return this.cursorPosition(D),!0}tabClear(D){const U=D.params[0];return U===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:U===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=D.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(D){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let U=D.params[0]||1;for(;U--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(D){const U=D.params[0];return U===1&&(this._curAttrData.bg|=536870912),U!==2&&U!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(D,U,H,z=!1,Z=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);ie.replaceCells(U,H,this._activeBuffer.getNullCell(this._eraseAttrData()),Z),z&&(ie.isWrapped=!1)}_resetBufferLine(D,U=!1){const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);H&&(H.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),U),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+D),H.isWrapped=!1)}eraseInDisplay(D,U=!1){let H;switch(this._restrictCursor(this._bufferService.cols),D.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(D,U=!1){switch(this._restrictCursor(this._bufferService.cols),D.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(D){this._restrictCursor();let U=D.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(D){this._restrictCursor();let U=D.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(D){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.insertCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(D){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.deleteCells(this._activeBuffer.x,D.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(D){let U=D.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(D){let U=D.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(h.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=D.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(D){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=D.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(D){this._restrictCursor();const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return U&&(U.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(D.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(D){const U=this._parser.precedingJoinState;if(!U)return!0;const H=D.params[0]||1,z=L.UnicodeService.extractWidth(U),Z=this._activeBuffer.x-z,ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(Z),ye=new Uint32Array(ie.length*H);let _e=0;for(let Y=0;Y<ie.length;){const ne=ie.codePointAt(Y)||0;ye[_e++]=ne,Y+=ne>65535?2:1}let Q=_e;for(let Y=1;Y<H;++Y)ye.copyWithin(Q,0,_e),Q+=_e;return this.print(ye,0,Q),!0}sendDeviceAttributesPrimary(D){return D.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(D){return D.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(D.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(D){return(this._optionsService.rawOptions.termName+"").indexOf(D)===0}setMode(D){for(let U=0;U<D.length;U++)switch(D.params[U]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(D){for(let U=0;U<D.length;U++)switch(D.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(D){for(let U=0;U<D.length;U++)switch(D.params[U]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(D){for(let U=0;U<D.length;U++)switch(D.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(),D.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(D,U){const H=this._coreService.decPrivateModes,{activeProtocol:z,activeEncoding:Z}=this._coreMouseService,ie=this._coreService,{buffers:ye,cols:_e}=this._bufferService,{active:Q,alt:Y}=ye,ne=this._optionsService.rawOptions,ee=ze=>ze?1:2,be=D.params[0];return me=be,Be=U?be===2?4:be===4?ee(ie.modes.insertMode):be===12?3:be===20?ee(ne.convertEol):0:be===1?ee(H.applicationCursorKeys):be===3?ne.windowOptions.setWinLines?_e===80?2:_e===132?1:0:0:be===6?ee(H.origin):be===7?ee(H.wraparound):be===8?3:be===9?ee(z==="X10"):be===12?ee(ne.cursorBlink):be===25?ee(!ie.isCursorHidden):be===45?ee(H.reverseWraparound):be===66?ee(H.applicationKeypad):be===67?4:be===1e3?ee(z==="VT200"):be===1002?ee(z==="DRAG"):be===1003?ee(z==="ANY"):be===1004?ee(H.sendFocus):be===1005?4:be===1006?ee(Z==="SGR"):be===1015?4:be===1016?ee(Z==="SGR_PIXELS"):be===1048?1:be===47||be===1047||be===1049?ee(Q===Y):be===2004?ee(H.bracketedPasteMode):0,ie.triggerDataEvent(`${d.C0.ESC}[${U?"":"?"}${me};${Be}$y`),!0;var me,Be}_updateAttrColor(D,U,H,z,Z){return U===2?(D|=50331648,D&=-16777216,D|=S.AttributeData.fromColorRGB([H,z,Z])):U===5&&(D&=-50331904,D|=33554432|255&H),D}_extractColor(D,U,H){const z=[0,0,-1,0,0,0];let Z=0,ie=0;do{if(z[ie+Z]=D.params[U+ie],D.hasSubParams(U+ie)){const ye=D.getSubParams(U+ie);let _e=0;do z[1]===5&&(Z=1),z[ie+_e+1+Z]=ye[_e];while(++_e<ye.length&&_e+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<D.length&&ie+Z<z.length);for(let ye=2;ye<z.length;++ye)z[ye]===-1&&(z[ye]=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(D,U){U.extended=U.extended.clone(),(!~D||D>5)&&(D=1),U.extended.underlineStyle=D,U.fg|=268435456,D===0&&(U.fg&=-268435457),U.updateExtended()}_processSGR0(D){D.fg=h.DEFAULT_ATTR_DATA.fg,D.bg=h.DEFAULT_ATTR_DATA.bg,D.extended=D.extended.clone(),D.extended.underlineStyle=0,D.extended.underlineColor&=-67108864,D.updateExtended()}charAttributes(D){if(D.length===1&&D.params[0]===0)return this._processSGR0(this._curAttrData),!0;const U=D.length;let H;const z=this._curAttrData;for(let Z=0;Z<U;Z++)H=D.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(D.hasSubParams(Z)?D.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&h.DEFAULT_ATTR_DATA.fg):H===49?(z.bg&=-67108864,z.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):H===38||H===48||H===58?Z+=this._extractColor(D,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&h.DEFAULT_ATTR_DATA.fg,z.bg&=-67108864,z.bg|=16777215&h.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",H);return!0}deviceStatus(D){switch(D.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${U};${H}R`)}return!0}deviceStatusPrivate(D){if(D.params[0]===6){const U=this._activeBuffer.y+1,H=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${U};${H}R`)}return!0}softReset(D){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=h.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(D){const U=D.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(D){const U=D.params[0]||1;let H;return(D.length<2||(H=D.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(D){if(!P(D.params[0],this._optionsService.rawOptions.windowOptions))return!0;const U=D.length>1?D.params[1]:0;switch(D.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(`${d.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(D){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(D){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(D){return this._windowTitle=D,this._onTitleChange.fire(D),!0}setIconName(D){return this._iconName=D,!0}setOrReportIndexedColor(D){const U=[],H=D.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 ye=(0,T.parseColor)(Z);ye&&U.push({type:1,index:ie,color:ye})}}}return U.length&&this._onColor.fire(U),!0}setHyperlink(D){const U=D.split(";");return!(U.length<2)&&(U[1]?this._createHyperlink(U[0],U[1]):!U[0]&&this._finishHyperlink())}_createHyperlink(D,U){this._getCurrentLinkId()&&this._finishHyperlink();const H=D.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(D,U){const H=D.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,T.parseColor)(H[z]);Z&&this._onColor.fire([{type:1,index:this._specialColors[U],color:Z}])}return!0}setOrReportFgColor(D){return this._setOrReportSpecialColor(D,0)}setOrReportBgColor(D){return this._setOrReportSpecialColor(D,1)}setOrReportCursorColor(D){return this._setOrReportSpecialColor(D,2)}restoreIndexedColor(D){if(!D)return this._onColor.fire([{type:2}]),!0;const U=[],H=D.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(D){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(D){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(D){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(D){return D.length!==2?(this.selectDefaultCharset(),!0):(D[0]==="/"||this._charsetService.setgCharset(I[D[0]],k.CHARSETS[D[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 D=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,D,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=h.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=h.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(D){return this._charsetService.setgLevel(D),!0}screenAlignmentPattern(){const D=new p.CellData;D.content=4194373,D.fg=this._curAttrData.fg,D.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(D),z.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(D,U){const H=this._bufferService.buffer,z=this._optionsService.rawOptions;return(Z=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${Z}${d.C0.ESC}\\`),!0))(D==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:D==='"p'?'P1$r61;1"p':D==="r"?`P1$r${H.scrollTop+1};${H.scrollBottom+1}r`:D==="m"?"P1$r0m":D===" q"?`P1$r${{block:2,underline:4,bar:6}[z.cursorStyle]-(z.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(D,U){this._dirtyRowTracker.markRangeDirty(D,U)}}i.InputHandler=$;let K=class{constructor(q){this._bufferService=q,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(q){q<this.start?this.start=q:q>this.end&&(this.end=q)}markRangeDirty(q,D){q>D&&(W=q,q=D,D=W),q<this.start&&(this.start=q),D>this.end&&(this.end=D)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(q){return 0<=q&&q<256}K=f([_(0,j.IBufferService)],K)},844:(b,i)=>{function a(f){for(const _ of f)_.dispose();f.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 f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const _=this._disposables.indexOf(f);_!==-1&&this._disposables.splice(_,1)}},i.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){var _;this._isDisposed||f===this._value||((_=this._value)==null||_.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){var f;this._isDisposed=!0,(f=this._value)==null||f.dispose(),this._value=void 0}},i.toDisposable=function(f){return{dispose:f}},i.disposeArray=a,i.getDisposeArrayDisposable=function(f){return{dispose:()=>a(f)}}},1505:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.FourKeyMap=i.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(_,d,k){this._data[_]||(this._data[_]={}),this._data[_][d]=k}get(_,d){return this._data[_]?this._data[_][d]:void 0}clear(){this._data={}}}i.TwoKeyMap=a,i.FourKeyMap=class{constructor(){this._data=new a}set(f,_,d,k,E){this._data.get(f,_)||this._data.set(f,_,new a),this._data.get(f,_).set(d,k,E)}get(f,_,d,k){var E;return(E=this._data.get(f,_))==null?void 0:E.get(d,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,f=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(f),i.isIpad=f==="iPad",i.isIphone=f==="iPhone",i.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),i.isLinux=f.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(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(a=this._search(this._getKey(f)),this._array.splice(a,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const _=this._getKey(f);if(_===void 0||(a=this._search(_),a===-1)||this._getKey(this._array[a])!==_)return!1;do if(this._array[a]===f)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===_);return!1}*getKeyIterator(f){if(this._array.length!==0&&(a=this._search(f),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===f))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===f)}forEachByKey(f,_){if(this._array.length!==0&&(a=this._search(f),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===f))do _(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===f)}values(){return[...this._array].values()}_search(f){let _=0,d=this._array.length-1;for(;d>=_;){let k=_+d>>1;const E=this._getKey(this._array[k]);if(E>f)d=k-1;else{if(!(E<f)){for(;k>0&&this._getKey(this._array[k-1])===f;)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 f=a(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(E){this._tasks.push(E),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(E){this._idleCallback=void 0;let M=0,w=0,h=E.timeRemaining(),v=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),v=E.timeRemaining(),1.5*w>v)return h-M<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(h-M))}ms`),void this._start();h=v}this.clear()}}class d extends _{_requestCallback(E){return setTimeout((()=>E(this._createDeadline(16))))}_cancelCallback(E){clearTimeout(E)}_createDeadline(E){const M=Date.now()+E;return{timeRemaining:()=>Math.max(0,M-Date.now())}}}i.PriorityTaskQueue=d,i.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(k){return requestIdleCallback(k)}_cancelCallback(k){cancelIdleCallback(k)}}:d,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 f=a(643);i.updateWindowsModeWrappedState=function(_){const d=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),k=d==null?void 0:d.get(_.cols-1),E=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);E&&k&&(E.isWrapped=k[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&k[f.CHAR_DATA_CODE_INDEX]!==f.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 f}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new a;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}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 f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,k=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=k}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}i.ExtendedAttrs=f},9092:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Buffer=i.MAX_BUFFER_SIZE=void 0;const f=a(6349),_=a(7226),d=a(3734),k=a(8437),E=a(4634),M=a(511),w=a(643),h=a(4863),v=a(7116);i.MAX_BUFFER_SIZE=4294967295,i.Buffer=class{constructor(g,p,S){this._hasScrollback=g,this._optionsService=p,this._bufferService=S,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=v.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 f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(g){return g?(this._nullCell.fg=g.fg,this._nullCell.bg=g.bg,this._nullCell.extended=g.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(g){return g?(this._whitespaceCell.fg=g.fg,this._whitespaceCell.bg=g.bg,this._whitespaceCell.extended=g.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(g,p){return new k.BufferLine(this._bufferService.cols,this.getNullCell(g),p)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const g=this.ybase+this.y-this.ydisp;return g>=0&&g<this._rows}_getCorrectBufferLength(g){if(!this._hasScrollback)return g;const p=g+this._optionsService.rawOptions.scrollback;return p>i.MAX_BUFFER_SIZE?i.MAX_BUFFER_SIZE:p}fillViewportRows(g){if(this.lines.length===0){g===void 0&&(g=k.DEFAULT_ATTR_DATA);let p=this._rows;for(;p--;)this.lines.push(this.getBlankLine(g))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(g,p){const S=this.getNullCell(k.DEFAULT_ATTR_DATA);let j=0;const L=this._getCorrectBufferLength(p);if(L>this.lines.maxLength&&(this.lines.maxLength=L),this.lines.length>0){if(this._cols<g)for(let x=0;x<this.lines.length;x++)j+=+this.lines.get(x).resize(g,S);let R=0;if(this._rows<p)for(let x=this._rows;x<p;x++)this.lines.length<p+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(g,S)):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(g,S)));else for(let x=this._rows;x>p;x--)this.lines.length>p+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(L<this.lines.maxLength){const x=this.lines.length-L;x>0&&(this.lines.trimStart(x),this.ybase=Math.max(this.ybase-x,0),this.ydisp=Math.max(this.ydisp-x,0),this.savedY=Math.max(this.savedY-x,0)),this.lines.maxLength=L}this.x=Math.min(this.x,g-1),this.y=Math.min(this.y,p-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,g-1),this.scrollTop=0}if(this.scrollBottom=p-1,this._isReflowEnabled&&(this._reflow(g,p),this._cols>g))for(let R=0;R<this.lines.length;R++)j+=+this.lines.get(R).resize(g,S);this._cols=g,this._rows=p,this._memoryCleanupQueue.clear(),j>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let g=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,g=!1);let p=0;for(;this._memoryCleanupPosition<this.lines.length;)if(p+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),p>100)return!0;return g}get _isReflowEnabled(){const g=this._optionsService.rawOptions.windowsPty;return g&&g.buildNumber?this._hasScrollback&&g.backend==="conpty"&&g.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(g,p){this._cols!==g&&(g>this._cols?this._reflowLarger(g,p):this._reflowSmaller(g,p))}_reflowLarger(g,p){const S=(0,E.reflowLargerGetLinesToRemove)(this.lines,this._cols,g,this.ybase+this.y,this.getNullCell(k.DEFAULT_ATTR_DATA));if(S.length>0){const j=(0,E.reflowLargerCreateNewLayout)(this.lines,S);(0,E.reflowLargerApplyNewLayout)(this.lines,j.layout),this._reflowLargerAdjustViewport(g,p,j.countRemoved)}}_reflowLargerAdjustViewport(g,p,S){const j=this.getNullCell(k.DEFAULT_ATTR_DATA);let L=S;for(;L-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<p&&this.lines.push(new k.BufferLine(g,j))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-S,0)}_reflowSmaller(g,p){const S=this.getNullCell(k.DEFAULT_ATTR_DATA),j=[];let L=0;for(let R=this.lines.length-1;R>=0;R--){let x=this.lines.get(R);if(!x||!x.isWrapped&&x.getTrimmedLength()<=g)continue;const T=[x];for(;x.isWrapped&&R>0;)x=this.lines.get(--R),T.unshift(x);const I=this.ybase+this.y;if(I>=R&&I<R+T.length)continue;const O=T[T.length-1].getTrimmedLength(),P=(0,E.reflowSmallerGetNewLineLengths)(T,this._cols,g),F=P.length-T.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+T.length+L,newLines:$}),L+=$.length),T.push(...$);let K=P.length-1,G=P[K];G===0&&(K--,G=P[K]);let q=T.length-F-1,D=O;for(;q>=0;){const H=Math.min(D,G);if(T[K]===void 0)break;if(T[K].copyCellsFrom(T[q],D-H,G-H,H,!0),G-=H,G===0&&(K--,G=P[K]),D-=H,D===0){q--;const z=Math.max(q,0);D=(0,E.getWrappedLineTrimmedLength)(T,z,this._cols)}}for(let H=0;H<T.length;H++)P[H]<g&&T[H].setCell(P[H],S);let U=F-W;for(;U-- >0;)this.ybase===0?this.y<p-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+L)-p&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+p-1)}if(j.length>0){const R=[],x=[];for(let K=0;K<this.lines.length;K++)x.push(this.lines.get(K));const T=this.lines.length;let I=T-1,O=0,P=j[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+L);let F=0;for(let K=Math.min(this.lines.maxLength-1,T+L-1);K>=0;K--)if(P&&P.start>I+F){for(let G=P.newLines.length-1;G>=0;G--)this.lines.set(K--,P.newLines[G]);K++,R.push({index:I+1,amount:P.newLines.length}),F+=P.newLines.length,P=j[++O]}else this.lines.set(K,x[I--]);let W=0;for(let K=R.length-1;K>=0;K--)R[K].index+=W,this.lines.onInsertEmitter.fire(R[K]),W+=R[K].amount;const $=Math.max(0,T+L-this.lines.maxLength);$>0&&this.lines.onTrimEmitter.fire($)}}translateBufferLineToString(g,p,S=0,j){const L=this.lines.get(g);return L?L.translateToString(p,S,j):""}getWrappedRangeForLine(g){let p=g,S=g;for(;p>0&&this.lines.get(p).isWrapped;)p--;for(;S+1<this.lines.length&&this.lines.get(S+1).isWrapped;)S++;return{first:p,last:S}}setupTabStops(g){for(g!=null?this.tabs[g]||(g=this.prevStop(g)):(this.tabs={},g=0);g<this._cols;g+=this._optionsService.rawOptions.tabStopWidth)this.tabs[g]=!0}prevStop(g){for(g==null&&(g=this.x);!this.tabs[--g]&&g>0;);return g>=this._cols?this._cols-1:g<0?0:g}nextStop(g){for(g==null&&(g=this.x);!this.tabs[++g]&&g<this._cols;);return g>=this._cols?this._cols-1:g<0?0:g}clearMarkers(g){this._isClearing=!0;for(let p=0;p<this.markers.length;p++)this.markers[p].line===g&&(this.markers[p].dispose(),this.markers.splice(p--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].dispose(),this.markers.splice(g--,1);this._isClearing=!1}addMarker(g){const p=new h.Marker(g);return this.markers.push(p),p.register(this.lines.onTrim((S=>{p.line-=S,p.line<0&&p.dispose()}))),p.register(this.lines.onInsert((S=>{p.line>=S.index&&(p.line+=S.amount)}))),p.register(this.lines.onDelete((S=>{p.line>=S.index&&p.line<S.index+S.amount&&p.dispose(),p.line>S.index&&(p.line-=S.amount)}))),p.register(p.onDispose((()=>this._removeMarker(p)))),p}_removeMarker(g){this._isClearing||this.markers.splice(this.markers.indexOf(g),1)}}},8437:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLine=i.DEFAULT_ATTR_DATA=void 0;const f=a(3734),_=a(511),d=a(643),k=a(482);i.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let E=0;class M{constructor(h,v,g=!1){this.isWrapped=g,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*h);const p=v||_.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let S=0;S<h;++S)this.setCell(S,p);this.length=h}get(h){const v=this._data[3*h+0],g=2097151&v;return[this._data[3*h+1],2097152&v?this._combined[h]:g?(0,k.stringFromCodePoint)(g):"",v>>22,2097152&v?this._combined[h].charCodeAt(this._combined[h].length-1):g]}set(h,v){this._data[3*h+1]=v[d.CHAR_DATA_ATTR_INDEX],v[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[h]=v[1],this._data[3*h+0]=2097152|h|v[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*h+0]=v[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|v[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(h){return this._data[3*h+0]>>22}hasWidth(h){return 12582912&this._data[3*h+0]}getFg(h){return this._data[3*h+1]}getBg(h){return this._data[3*h+2]}hasContent(h){return 4194303&this._data[3*h+0]}getCodePoint(h){const v=this._data[3*h+0];return 2097152&v?this._combined[h].charCodeAt(this._combined[h].length-1):2097151&v}isCombined(h){return 2097152&this._data[3*h+0]}getString(h){const v=this._data[3*h+0];return 2097152&v?this._combined[h]:2097151&v?(0,k.stringFromCodePoint)(2097151&v):""}isProtected(h){return 536870912&this._data[3*h+2]}loadCell(h,v){return E=3*h,v.content=this._data[E+0],v.fg=this._data[E+1],v.bg=this._data[E+2],2097152&v.content&&(v.combinedData=this._combined[h]),268435456&v.bg&&(v.extended=this._extendedAttrs[h]),v}setCell(h,v){2097152&v.content&&(this._combined[h]=v.combinedData),268435456&v.bg&&(this._extendedAttrs[h]=v.extended),this._data[3*h+0]=v.content,this._data[3*h+1]=v.fg,this._data[3*h+2]=v.bg}setCellFromCodepoint(h,v,g,p){268435456&p.bg&&(this._extendedAttrs[h]=p.extended),this._data[3*h+0]=v|g<<22,this._data[3*h+1]=p.fg,this._data[3*h+2]=p.bg}addCodepointToCell(h,v,g){let p=this._data[3*h+0];2097152&p?this._combined[h]+=(0,k.stringFromCodePoint)(v):2097151&p?(this._combined[h]=(0,k.stringFromCodePoint)(2097151&p)+(0,k.stringFromCodePoint)(v),p&=-2097152,p|=2097152):p=v|4194304,g&&(p&=-12582913,p|=g<<22),this._data[3*h+0]=p}insertCells(h,v,g){if((h%=this.length)&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),v<this.length-h){const p=new _.CellData;for(let S=this.length-h-v-1;S>=0;--S)this.setCell(h+v+S,this.loadCell(h+S,p));for(let S=0;S<v;++S)this.setCell(h+S,g)}else for(let p=h;p<this.length;++p)this.setCell(p,g);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,g)}deleteCells(h,v,g){if(h%=this.length,v<this.length-h){const p=new _.CellData;for(let S=0;S<this.length-h-v;++S)this.setCell(h+S,this.loadCell(h+v+S,p));for(let S=this.length-v;S<this.length;++S)this.setCell(S,g)}else for(let p=h;p<this.length;++p)this.setCell(p,g);h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),this.getWidth(h)!==0||this.hasContent(h)||this.setCellFromCodepoint(h,0,1,g)}replaceCells(h,v,g,p=!1){if(p)for(h&&this.getWidth(h-1)===2&&!this.isProtected(h-1)&&this.setCellFromCodepoint(h-1,0,1,g),v<this.length&&this.getWidth(v-1)===2&&!this.isProtected(v)&&this.setCellFromCodepoint(v,0,1,g);h<v&&h<this.length;)this.isProtected(h)||this.setCell(h,g),h++;else for(h&&this.getWidth(h-1)===2&&this.setCellFromCodepoint(h-1,0,1,g),v<this.length&&this.getWidth(v-1)===2&&this.setCellFromCodepoint(v,0,1,g);h<v&&h<this.length;)this.setCell(h++,g)}resize(h,v){if(h===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const g=3*h;if(h>this.length){if(this._data.buffer.byteLength>=4*g)this._data=new Uint32Array(this._data.buffer,0,g);else{const p=new Uint32Array(g);p.set(this._data),this._data=p}for(let p=this.length;p<h;++p)this.setCell(p,v)}else{this._data=this._data.subarray(0,g);const p=Object.keys(this._combined);for(let j=0;j<p.length;j++){const L=parseInt(p[j],10);L>=h&&delete this._combined[L]}const S=Object.keys(this._extendedAttrs);for(let j=0;j<S.length;j++){const L=parseInt(S[j],10);L>=h&&delete this._extendedAttrs[L]}}return this.length=h,4*g*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const h=new Uint32Array(this._data.length);return h.set(this._data),this._data=h,1}return 0}fill(h,v=!1){if(v)for(let g=0;g<this.length;++g)this.isProtected(g)||this.setCell(g,h);else{this._combined={},this._extendedAttrs={};for(let g=0;g<this.length;++g)this.setCell(g,h)}}copyFrom(h){this.length!==h.length?this._data=new Uint32Array(h._data):this._data.set(h._data),this.length=h.length,this._combined={};for(const v in h._combined)this._combined[v]=h._combined[v];this._extendedAttrs={};for(const v in h._extendedAttrs)this._extendedAttrs[v]=h._extendedAttrs[v];this.isWrapped=h.isWrapped}clone(){const h=new M(0);h._data=new Uint32Array(this._data),h.length=this.length;for(const v in this._combined)h._combined[v]=this._combined[v];for(const v in this._extendedAttrs)h._extendedAttrs[v]=this._extendedAttrs[v];return h.isWrapped=this.isWrapped,h}getTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0])return h+(this._data[3*h+0]>>22);return 0}getNoBgTrimmedLength(){for(let h=this.length-1;h>=0;--h)if(4194303&this._data[3*h+0]||50331648&this._data[3*h+2])return h+(this._data[3*h+0]>>22);return 0}copyCellsFrom(h,v,g,p,S){const j=h._data;if(S)for(let R=p-1;R>=0;R--){for(let x=0;x<3;x++)this._data[3*(g+R)+x]=j[3*(v+R)+x];268435456&j[3*(v+R)+2]&&(this._extendedAttrs[g+R]=h._extendedAttrs[v+R])}else for(let R=0;R<p;R++){for(let x=0;x<3;x++)this._data[3*(g+R)+x]=j[3*(v+R)+x];268435456&j[3*(v+R)+2]&&(this._extendedAttrs[g+R]=h._extendedAttrs[v+R])}const L=Object.keys(h._combined);for(let R=0;R<L.length;R++){const x=parseInt(L[R],10);x>=v&&(this._combined[x-v+g]=h._combined[x])}}translateToString(h,v,g,p){v=v??0,g=g??this.length,h&&(g=Math.min(g,this.getTrimmedLength())),p&&(p.length=0);let S="";for(;v<g;){const j=this._data[3*v+0],L=2097151&j,R=2097152&j?this._combined[v]:L?(0,k.stringFromCodePoint)(L):d.WHITESPACE_CELL_CHAR;if(S+=R,p)for(let x=0;x<R.length;++x)p.push(v);v+=j>>22||1}return p&&p.push(v),S}}i.BufferLine=M},4841:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.getRangeLength=void 0,i.getRangeLength=function(a,f){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 f*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(b,i)=>{function a(f,_,d){if(_===f.length-1)return f[_].getTrimmedLength();const k=!f[_].hasContent(d-1)&&f[_].getWidth(d-1)===1,E=f[_+1].getWidth(0)===2;return k&&E?d-1:d}Object.defineProperty(i,"__esModule",{value:!0}),i.getWrappedLineTrimmedLength=i.reflowSmallerGetNewLineLengths=i.reflowLargerApplyNewLayout=i.reflowLargerCreateNewLayout=i.reflowLargerGetLinesToRemove=void 0,i.reflowLargerGetLinesToRemove=function(f,_,d,k,E){const M=[];for(let w=0;w<f.length-1;w++){let h=w,v=f.get(++h);if(!v.isWrapped)continue;const g=[f.get(w)];for(;h<f.length&&v.isWrapped;)g.push(v),v=f.get(++h);if(k>=w&&k<h){w+=g.length-1;continue}let p=0,S=a(g,p,_),j=1,L=0;for(;j<g.length;){const x=a(g,j,_),T=x-L,I=d-S,O=Math.min(T,I);g[p].copyCellsFrom(g[j],L,S,O,!1),S+=O,S===d&&(p++,S=0),L+=O,L===x&&(j++,L=0),S===0&&p!==0&&g[p-1].getWidth(d-1)===2&&(g[p].copyCellsFrom(g[p-1],d-1,S++,1,!1),g[p-1].setCell(d-1,E))}g[p].replaceCells(S,d,E);let R=0;for(let x=g.length-1;x>0&&(x>p||g[x].getTrimmedLength()===0);x--)R++;R>0&&(M.push(w+g.length-R),M.push(R)),w+=g.length-1}return M},i.reflowLargerCreateNewLayout=function(f,_){const d=[];let k=0,E=_[k],M=0;for(let w=0;w<f.length;w++)if(E===w){const h=_[++k];f.onDeleteEmitter.fire({index:w-M,amount:h}),w+=h-1,M+=h,E=_[++k]}else d.push(w);return{layout:d,countRemoved:M}},i.reflowLargerApplyNewLayout=function(f,_){const d=[];for(let k=0;k<_.length;k++)d.push(f.get(_[k]));for(let k=0;k<d.length;k++)f.set(k,d[k]);f.length=_.length},i.reflowSmallerGetNewLineLengths=function(f,_,d){const k=[],E=f.map(((v,g)=>a(f,g,_))).reduce(((v,g)=>v+g));let M=0,w=0,h=0;for(;h<E;){if(E-h<d){k.push(E-h);break}M+=d;const v=a(f,w,_);M>v&&(M-=v,w++);const g=f[w].getWidth(M-1)===2;g&&M--;const p=g?d-1:d;k.push(p),h+=p}return k},i.getWrappedLineTrimmedLength=a},5295:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferSet=void 0;const f=a(8460),_=a(844),d=a(9092);class k extends _.Disposable{constructor(M,w){super(),this._optionsService=M,this._bufferService=w,this._onBufferActivate=this.register(new f.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 d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.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 f=a(482),_=a(643),d=a(3734);class k extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.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,f.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 h=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=h&&h<=56319){const v=M[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=v&&v<=57343?this.content=1024*(h-55296)+v-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 f=a(8460),_=a(844);class d{get id(){return this._id}constructor(E){this.line=E,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new f.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(E){return this._disposables.push(E),E}}i.Marker=d,d._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,f,_;Object.defineProperty(i,"__esModule",{value:!0}),i.C1_ESCAPED=i.C1=i.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
128
- `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(a||(i.C0=a={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(f||(i.C1=f={})),(function(d){d.ST=`${a.ESC}\\`})(_||(i.C1_ESCAPED=_={}))},7399:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.evaluateKeyboardEvent=void 0;const f=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(d,k,E,M){const w={type:0,cancel:!1,key:void 0},h=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?w.key=k?f.C0.ESC+"OA":f.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?w.key=k?f.C0.ESC+"OD":f.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?w.key=k?f.C0.ESC+"OC":f.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(w.key=k?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:w.key=d.ctrlKey?"\b":f.C0.DEL,d.altKey&&(w.key=f.C0.ESC+w.key);break;case 9:if(d.shiftKey){w.key=f.C0.ESC+"[Z";break}w.key=f.C0.HT,w.cancel=!0;break;case 13:w.key=d.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,w.cancel=!0;break;case 27:w.key=f.C0.ESC,d.altKey&&(w.key=f.C0.ESC+f.C0.ESC),w.cancel=!0;break;case 37:if(d.metaKey)break;h?(w.key=f.C0.ESC+"[1;"+(h+1)+"D",w.key===f.C0.ESC+"[1;3D"&&(w.key=f.C0.ESC+(E?"b":"[1;5D"))):w.key=k?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(d.metaKey)break;h?(w.key=f.C0.ESC+"[1;"+(h+1)+"C",w.key===f.C0.ESC+"[1;3C"&&(w.key=f.C0.ESC+(E?"f":"[1;5C"))):w.key=k?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(d.metaKey)break;h?(w.key=f.C0.ESC+"[1;"+(h+1)+"A",E||w.key!==f.C0.ESC+"[1;3A"||(w.key=f.C0.ESC+"[1;5A")):w.key=k?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(d.metaKey)break;h?(w.key=f.C0.ESC+"[1;"+(h+1)+"B",E||w.key!==f.C0.ESC+"[1;3B"||(w.key=f.C0.ESC+"[1;5B")):w.key=k?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(w.key=f.C0.ESC+"[2~");break;case 46:w.key=h?f.C0.ESC+"[3;"+(h+1)+"~":f.C0.ESC+"[3~";break;case 36:w.key=h?f.C0.ESC+"[1;"+(h+1)+"H":k?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:w.key=h?f.C0.ESC+"[1;"+(h+1)+"F":k?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:d.shiftKey?w.type=2:d.ctrlKey?w.key=f.C0.ESC+"[5;"+(h+1)+"~":w.key=f.C0.ESC+"[5~";break;case 34:d.shiftKey?w.type=3:d.ctrlKey?w.key=f.C0.ESC+"[6;"+(h+1)+"~":w.key=f.C0.ESC+"[6~";break;case 112:w.key=h?f.C0.ESC+"[1;"+(h+1)+"P":f.C0.ESC+"OP";break;case 113:w.key=h?f.C0.ESC+"[1;"+(h+1)+"Q":f.C0.ESC+"OQ";break;case 114:w.key=h?f.C0.ESC+"[1;"+(h+1)+"R":f.C0.ESC+"OR";break;case 115:w.key=h?f.C0.ESC+"[1;"+(h+1)+"S":f.C0.ESC+"OS";break;case 116:w.key=h?f.C0.ESC+"[15;"+(h+1)+"~":f.C0.ESC+"[15~";break;case 117:w.key=h?f.C0.ESC+"[17;"+(h+1)+"~":f.C0.ESC+"[17~";break;case 118:w.key=h?f.C0.ESC+"[18;"+(h+1)+"~":f.C0.ESC+"[18~";break;case 119:w.key=h?f.C0.ESC+"[19;"+(h+1)+"~":f.C0.ESC+"[19~";break;case 120:w.key=h?f.C0.ESC+"[20;"+(h+1)+"~":f.C0.ESC+"[20~";break;case 121:w.key=h?f.C0.ESC+"[21;"+(h+1)+"~":f.C0.ESC+"[21~";break;case 122:w.key=h?f.C0.ESC+"[23;"+(h+1)+"~":f.C0.ESC+"[23~";break;case 123:w.key=h?f.C0.ESC+"[24;"+(h+1)+"~":f.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(E&&!M||!d.altKey||d.metaKey)!E||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?w.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(w.key=f.C0.US),d.key==="@"&&(w.key=f.C0.NUL)):d.keyCode===65&&(w.type=1);else{const v=_[d.keyCode],g=v==null?void 0:v[d.shiftKey?1:0];if(g)w.key=f.C0.ESC+g;else if(d.keyCode>=65&&d.keyCode<=90){const p=d.ctrlKey?d.keyCode-64:d.keyCode+32;let S=String.fromCharCode(p);d.shiftKey&&(S=S.toUpperCase()),w.key=f.C0.ESC+S}else if(d.keyCode===32)w.key=f.C0.ESC+(d.ctrlKey?f.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let p=d.code.slice(3,4);d.shiftKey||(p=p.toLowerCase()),w.key=f.C0.ESC+p,w.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?w.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?w.key=f.C0.NUL:d.keyCode>=51&&d.keyCode<=55?w.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?w.key=f.C0.DEL:d.keyCode===219?w.key=f.C0.ESC:d.keyCode===220?w.key=f.C0.FS:d.keyCode===221&&(w.key=f.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,f=0,_=a.length){let d="";for(let k=f;k<_;++k){let E=a[k];E>65535?(E-=65536,d+=String.fromCharCode(55296+(E>>10))+String.fromCharCode(E%1024+56320)):d+=String.fromCharCode(E)}return d},i.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,f){const _=a.length;if(!_)return 0;let d=0,k=0;if(this._interim){const E=a.charCodeAt(k++);56320<=E&&E<=57343?f[d++]=1024*(this._interim-55296)+E-56320+65536:(f[d++]=this._interim,f[d++]=E),this._interim=0}for(let E=k;E<_;++E){const M=a.charCodeAt(E);if(55296<=M&&M<=56319){if(++E>=_)return this._interim=M,d;const w=a.charCodeAt(E);56320<=w&&w<=57343?f[d++]=1024*(M-55296)+w-56320+65536:(f[d++]=M,f[d++]=w)}else M!==65279&&(f[d++]=M)}return d}},i.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,f){const _=a.length;if(!_)return 0;let d,k,E,M,w=0,h=0,v=0;if(this.interim[0]){let S=!1,j=this.interim[0];j&=(224&j)==192?31:(240&j)==224?15:7;let L,R=0;for(;(L=63&this.interim[++R])&&R<4;)j<<=6,j|=L;const x=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,T=x-R;for(;v<T;){if(v>=_)return 0;if(L=a[v++],(192&L)!=128){v--,S=!0;break}this.interim[R++]=L,j<<=6,j|=63&L}S||(x===2?j<128?v--:f[w++]=j:x===3?j<2048||j>=55296&&j<=57343||j===65279||(f[w++]=j):j<65536||j>1114111||(f[w++]=j)),this.interim.fill(0)}const g=_-4;let p=v;for(;p<_;){for(;!(!(p<g)||128&(d=a[p])||128&(k=a[p+1])||128&(E=a[p+2])||128&(M=a[p+3]));)f[w++]=d,f[w++]=k,f[w++]=E,f[w++]=M,p+=4;if(d=a[p++],d<128)f[w++]=d;else if((224&d)==192){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(h=(31&d)<<6|63&k,h<128){p--;continue}f[w++]=h}else if((240&d)==224){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,w;if(E=a[p++],(192&E)!=128){p--;continue}if(h=(15&d)<<12|(63&k)<<6|63&E,h<2048||h>=55296&&h<=57343||h===65279)continue;f[w++]=h}else if((248&d)==240){if(p>=_)return this.interim[0]=d,w;if(k=a[p++],(192&k)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,w;if(E=a[p++],(192&E)!=128){p--;continue}if(p>=_)return this.interim[0]=d,this.interim[1]=k,this.interim[2]=E,w;if(M=a[p++],(192&M)!=128){p--;continue}if(h=(7&d)<<18|(63&k)<<12|(63&E)<<6|63&M,h<65536||h>1114111)continue;f[w++]=h}}return w}}},225:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeV6=void 0;const f=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]],d=[[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 E=0;E<_.length;++E)k.fill(0,_[E][0],_[E][1]+1)}}wcwidth(E){return E<32?0:E<127?1:E<65536?k[E]:(function(M,w){let h,v=0,g=w.length-1;if(M<w[0][0]||M>w[g][1])return!1;for(;g>=v;)if(h=v+g>>1,M>w[h][1])v=h+1;else{if(!(M<w[h][0]))return!0;g=h-1}return!1})(E,d)?0:E>=131072&&E<=196605||E>=196608&&E<=262141?2:1}charProperties(E,M){let w=this.wcwidth(E),h=w===0&&M!==0;if(h){const v=f.UnicodeService.extractWidth(M);v===0?h=!1:v>w&&(w=v)}return f.UnicodeService.createPropertyValue(0,w,h)}}},5981:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.WriteBuffer=void 0;const f=a(8460),_=a(844);class d extends _.Disposable{constructor(E){super(),this._action=E,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(E,M){if(M!==void 0&&this._syncCalls>M)return void(this._syncCalls=0);if(this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const h=this._callbacks.shift();h&&h()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(E,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+=E.length,this._writeBuffer.push(E),this._callbacks.push(M),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=E.length,this._writeBuffer.push(E),this._callbacks.push(M)}_innerWrite(E=0,M=!0){const w=E||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const h=this._writeBuffer[this._bufferOffset],v=this._action(h,M);if(v){const p=S=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,S))):this._innerWrite(w,S);return void v.catch((S=>(queueMicrotask((()=>{throw S})),Promise.resolve(!1)))).then(p)}const g=this._callbacks[this._bufferOffset];if(g&&g(),this._bufferOffset++,this._pendingData-=h.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=d},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})$/,f=/^[\da-f]+$/;function _(d,k){const E=d.toString(16),M=E.length<2?"0"+E:E;switch(k){case 4:return E[0];case 8:return M;case 12:return(M+M).slice(0,3);default:return M+M}}i.parseColor=function(d){if(!d)return;let k=d.toLowerCase();if(k.indexOf("rgb:")===0){k=k.slice(4);const E=a.exec(k);if(E){const M=E[1]?15:E[4]?255:E[7]?4095:65535;return[Math.round(parseInt(E[1]||E[4]||E[7]||E[10],16)/M*255),Math.round(parseInt(E[2]||E[5]||E[8]||E[11],16)/M*255),Math.round(parseInt(E[3]||E[6]||E[9]||E[12],16)/M*255)]}}else if(k.indexOf("#")===0&&(k=k.slice(1),f.exec(k)&&[3,6,9,12].includes(k.length))){const E=k.length/3,M=[0,0,0];for(let w=0;w<3;++w){const h=parseInt(k.slice(E*w,E*w+E),16);M[w]=E===1?h<<4:E===2?h:E===3?h>>4:h>>8}return M}},i.toRgbString=function(d,k=16){const[E,M,w]=d;return`rgb:${_(E,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 f=a(482),_=a(8742),d=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 h=this._handlers[M];return h.push(w),{dispose:()=>{const v=h.indexOf(w);v!==-1&&h.splice(v,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 h=this._active.length-1;h>=0;h--)this._active[h].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(M,w,h){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(M,w,h);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(M,w,h))}unhook(M,w=!0){if(this._active.length){let h=!1,v=this._active.length-1,g=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,h=w,g=this._stack.fallThrough,this._stack.paused=!1),!g&&h===!1){for(;v>=0&&(h=this._active[v].unhook(M),h!==!0);v--)if(h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,h;v--}for(;v>=0;v--)if(h=this._active[v].unhook(!1),h instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,h}else this._handlerFb(this._ident,"UNHOOK",M);this._active=k,this._ident=0}};const E=new _.Params;E.addParam(0),i.DcsHandler=class{constructor(M){this._handler=M,this._data="",this._params=E,this._hitLimit=!1}hook(M){this._params=M.length>1||M.params[0]?M.clone():E,this._data="",this._hitLimit=!1}put(M,w,h){this._hitLimit||(this._data+=(0,f.utf32ToString)(M,w,h),this._data.length>d.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((h=>(this._params=E,this._data="",this._hitLimit=!1,h)));return this._params=E,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 f=a(844),_=a(8742),d=a(6242),k=a(6351);class E{constructor(v){this.table=new Uint8Array(v)}setDefault(v,g){this.table.fill(v<<4|g)}add(v,g,p,S){this.table[g<<8|v]=p<<4|S}addMany(v,g,p,S){for(let j=0;j<v.length;j++)this.table[g<<8|v[j]]=p<<4|S}}i.TransitionTable=E;const M=160;i.VT500_TRANSITION_TABLE=(function(){const h=new E(4095),v=Array.apply(null,Array(256)).map(((R,x)=>x)),g=(R,x)=>v.slice(R,x),p=g(32,127),S=g(0,24);S.push(25),S.push.apply(S,g(28,32));const j=g(0,14);let L;for(L in h.setDefault(1,0),h.addMany(p,0,2,0),j)h.addMany([24,26,153,154],L,3,0),h.addMany(g(128,144),L,3,0),h.addMany(g(144,152),L,3,0),h.add(156,L,0,0),h.add(27,L,11,1),h.add(157,L,4,8),h.addMany([152,158,159],L,0,7),h.add(155,L,11,3),h.add(144,L,11,9);return h.addMany(S,0,3,0),h.addMany(S,1,3,1),h.add(127,1,0,1),h.addMany(S,8,0,8),h.addMany(S,3,3,3),h.add(127,3,0,3),h.addMany(S,4,3,4),h.add(127,4,0,4),h.addMany(S,6,3,6),h.addMany(S,5,3,5),h.add(127,5,0,5),h.addMany(S,2,3,2),h.add(127,2,0,2),h.add(93,1,4,8),h.addMany(p,8,5,8),h.add(127,8,5,8),h.addMany([156,27,24,26,7],8,6,0),h.addMany(g(28,32),8,0,8),h.addMany([88,94,95],1,0,7),h.addMany(p,7,0,7),h.addMany(S,7,0,7),h.add(156,7,0,0),h.add(127,7,0,7),h.add(91,1,11,3),h.addMany(g(64,127),3,7,0),h.addMany(g(48,60),3,8,4),h.addMany([60,61,62,63],3,9,4),h.addMany(g(48,60),4,8,4),h.addMany(g(64,127),4,7,0),h.addMany([60,61,62,63],4,0,6),h.addMany(g(32,64),6,0,6),h.add(127,6,0,6),h.addMany(g(64,127),6,0,0),h.addMany(g(32,48),3,9,5),h.addMany(g(32,48),5,9,5),h.addMany(g(48,64),5,0,6),h.addMany(g(64,127),5,7,0),h.addMany(g(32,48),4,9,5),h.addMany(g(32,48),1,9,2),h.addMany(g(32,48),2,9,2),h.addMany(g(48,127),2,10,0),h.addMany(g(48,80),1,10,0),h.addMany(g(81,88),1,10,0),h.addMany([89,90,92],1,10,0),h.addMany(g(96,127),1,10,0),h.add(80,1,11,9),h.addMany(S,9,0,9),h.add(127,9,0,9),h.addMany(g(28,32),9,0,9),h.addMany(g(32,48),9,9,12),h.addMany(g(48,60),9,8,10),h.addMany([60,61,62,63],9,9,10),h.addMany(S,11,0,11),h.addMany(g(32,128),11,0,11),h.addMany(g(28,32),11,0,11),h.addMany(S,10,0,10),h.add(127,10,0,10),h.addMany(g(28,32),10,0,10),h.addMany(g(48,60),10,8,10),h.addMany([60,61,62,63],10,0,11),h.addMany(g(32,48),10,9,12),h.addMany(S,12,0,12),h.add(127,12,0,12),h.addMany(g(28,32),12,0,12),h.addMany(g(32,48),12,9,12),h.addMany(g(48,64),12,0,11),h.addMany(g(64,127),12,12,13),h.addMany(g(64,127),10,12,13),h.addMany(g(64,127),9,12,13),h.addMany(S,13,13,13),h.addMany(p,13,13,13),h.add(127,13,0,13),h.addMany([27,156,24,26],13,14,0),h.add(M,0,2,0),h.add(M,8,5,8),h.add(M,6,0,6),h.add(M,11,0,11),h.add(M,13,13,13),h})();class w extends f.Disposable{constructor(v=i.VT500_TRANSITION_TABLE){super(),this._transitions=v,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=(g,p,S)=>{},this._executeHandlerFb=g=>{},this._csiHandlerFb=(g,p)=>{},this._escHandlerFb=g=>{},this._errorHandlerFb=g=>g,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new k.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(v,g=[64,126]){let p=0;if(v.prefix){if(v.prefix.length>1)throw new Error("only one byte as prefix supported");if(p=v.prefix.charCodeAt(0),p&&60>p||p>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(v.intermediates){if(v.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let j=0;j<v.intermediates.length;++j){const L=v.intermediates.charCodeAt(j);if(32>L||L>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");p<<=8,p|=L}}if(v.final.length!==1)throw new Error("final must be a single byte");const S=v.final.charCodeAt(0);if(g[0]>S||S>g[1])throw new Error(`final must be in range ${g[0]} .. ${g[1]}`);return p<<=8,p|=S,p}identToString(v){const g=[];for(;v;)g.push(String.fromCharCode(255&v)),v>>=8;return g.reverse().join("")}setPrintHandler(v){this._printHandler=v}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(v,g){const p=this._identifier(v,[48,126]);this._escHandlers[p]===void 0&&(this._escHandlers[p]=[]);const S=this._escHandlers[p];return S.push(g),{dispose:()=>{const j=S.indexOf(g);j!==-1&&S.splice(j,1)}}}clearEscHandler(v){this._escHandlers[this._identifier(v,[48,126])]&&delete this._escHandlers[this._identifier(v,[48,126])]}setEscHandlerFallback(v){this._escHandlerFb=v}setExecuteHandler(v,g){this._executeHandlers[v.charCodeAt(0)]=g}clearExecuteHandler(v){this._executeHandlers[v.charCodeAt(0)]&&delete this._executeHandlers[v.charCodeAt(0)]}setExecuteHandlerFallback(v){this._executeHandlerFb=v}registerCsiHandler(v,g){const p=this._identifier(v);this._csiHandlers[p]===void 0&&(this._csiHandlers[p]=[]);const S=this._csiHandlers[p];return S.push(g),{dispose:()=>{const j=S.indexOf(g);j!==-1&&S.splice(j,1)}}}clearCsiHandler(v){this._csiHandlers[this._identifier(v)]&&delete this._csiHandlers[this._identifier(v)]}setCsiHandlerFallback(v){this._csiHandlerFb=v}registerDcsHandler(v,g){return this._dcsParser.registerHandler(this._identifier(v),g)}clearDcsHandler(v){this._dcsParser.clearHandler(this._identifier(v))}setDcsHandlerFallback(v){this._dcsParser.setHandlerFallback(v)}registerOscHandler(v,g){return this._oscParser.registerHandler(v,g)}clearOscHandler(v){this._oscParser.clearHandler(v)}setOscHandlerFallback(v){this._oscParser.setHandlerFallback(v)}setErrorHandler(v){this._errorHandler=v}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(v,g,p,S,j){this._parseStack.state=v,this._parseStack.handlers=g,this._parseStack.handlerPos=p,this._parseStack.transition=S,this._parseStack.chunkPos=j}parse(v,g,p){let S,j=0,L=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(p===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const x=this._parseStack.handlers;let T=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(p===!1&&T>-1){for(;T>=0&&(S=x[T](this._params),S!==!0);T--)if(S instanceof Promise)return this._parseStack.handlerPos=T,S}this._parseStack.handlers=[];break;case 4:if(p===!1&&T>-1){for(;T>=0&&(S=x[T](),S!==!0);T--)if(S instanceof Promise)return this._parseStack.handlerPos=T,S}this._parseStack.handlers=[];break;case 6:if(j=v[this._parseStack.chunkPos],S=this._dcsParser.unhook(j!==24&&j!==26,p),S)return S;j===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(j=v[this._parseStack.chunkPos],S=this._oscParser.end(j!==24&&j!==26,p),S)return S;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 x=R;x<g;++x){switch(j=v[x],L=this._transitions.table[this.currentState<<8|(j<160?j:M)],L>>4){case 2:for(let F=x+1;;++F){if(F>=g||(j=v[F])<32||j>126&&j<M){this._printHandler(v,x,F),x=F-1;break}if(++F>=g||(j=v[F])<32||j>126&&j<M){this._printHandler(v,x,F),x=F-1;break}if(++F>=g||(j=v[F])<32||j>126&&j<M){this._printHandler(v,x,F),x=F-1;break}if(++F>=g||(j=v[F])<32||j>126&&j<M){this._printHandler(v,x,F),x=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:x,code:j,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const T=this._csiHandlers[this._collect<<8|j];let I=T?T.length-1:-1;for(;I>=0&&(S=T[I](this._params),S!==!0);I--)if(S instanceof Promise)return this._preserveStack(3,T,I,L,x),S;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(++x<g&&(j=v[x])>47&&j<60);x--;break;case 9:this._collect<<=8,this._collect|=j;break;case 10:const O=this._escHandlers[this._collect<<8|j];let P=O?O.length-1:-1;for(;P>=0&&(S=O[P](),S!==!0);P--)if(S instanceof Promise)return this._preserveStack(4,O,P,L,x),S;P<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=x+1;;++F)if(F>=g||(j=v[F])===24||j===26||j===27||j>127&&j<M){this._dcsParser.put(v,x,F),x=F-1;break}break;case 14:if(S=this._dcsParser.unhook(j!==24&&j!==26),S)return this._preserveStack(6,[],0,L,x),S;j===27&&(L|=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=x+1;;F++)if(F>=g||(j=v[F])<32||j>127&&j<M){this._oscParser.put(v,x,F),x=F-1;break}break;case 6:if(S=this._oscParser.end(j!==24&&j!==26),S)return this._preserveStack(5,[],0,L,x),S;j===27&&(L|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&L}}}i.EscapeSequenceParser=w},6242:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OscHandler=i.OscParser=void 0;const f=a(5770),_=a(482),d=[];i.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(k,E){this._handlers[k]===void 0&&(this._handlers[k]=[]);const M=this._handlers[k];return M.push(E),{dispose:()=>{const w=M.indexOf(E);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=d}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=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,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,E,M){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(k,E,M);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(k,E,M))}start(){this.reset(),this._state=1}put(k,E,M){if(this._state!==3){if(this._state===1)for(;E<M;){const w=k[E++];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-E>0&&this._put(k,E,M)}}end(k,E=!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,h=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,M=E,h=this._stack.fallThrough,this._stack.paused=!1),!h&&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=d,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,E,M){this._hitLimit||(this._data+=(0,_.utf32ToString)(k,E,M),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(k){let E=!1;if(this._hitLimit)E=!1;else if(k&&(E=this._handler(this._data),E instanceof Promise))return E.then((M=>(this._data="",this._hitLimit=!1,M)));return this._data="",this._hitLimit=!1,E}}},8742:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.Params=void 0;const a=2147483647;class f{static fromArray(d){const k=new f;if(!d.length)return k;for(let E=Array.isArray(d[0])?1:0;E<d.length;++E){const M=d[E];if(Array.isArray(M))for(let w=0;w<M.length;++w)k.addSubParam(M[w]);else k.addParam(M)}return k}constructor(d=32,k=32){if(this.maxLength=d,this.maxSubParamsLength=k,k>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(k),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new f(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let k=0;k<this.length;++k){d.push(this.params[k]);const E=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-E>0&&d.push(Array.prototype.slice.call(this._subParams,E,M))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>a?a:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>a?a:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const k=this._subParamsIdx[d]>>8,E=255&this._subParamsIdx[d];return E-k>0?this._subParams.subarray(k,E):null}getSubParamsAll(){const d={};for(let k=0;k<this.length;++k){const E=this._subParamsIdx[k]>>8,M=255&this._subParamsIdx[k];M-E>0&&(d[k]=this._subParams.slice(E,M))}return d}addDigit(d){let k;if(this._rejectDigits||!(k=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const E=this._digitIsSub?this._subParams:this.params,M=E[k-1];E[k-1]=~M?Math.min(10*M+d,a):d}}i.Params=f},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,f){const _={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(_),f.dispose=()=>this._wrappedAddonDispose(_),f.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let f=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===a){f=_;break}if(f===-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(f,1)}}},8771:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferApiView=void 0;const f=a(3785),_=a(511);i.BufferApiView=class{constructor(d,k){this._buffer=d,this.type=k}init(d){return this._buffer=d,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(d){const k=this._buffer.lines.get(d);if(k)return new f.BufferLineApiView(k)}getNullCell(){return new _.CellData}}},3785:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferLineApiView=void 0;const f=a(511);i.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,d){if(!(_<0||_>=this._line.length))return d?(this._line.loadCell(_,d),d):this._line.loadCell(_,new f.CellData)}translateToString(_,d,k){return this._line.translateToString(_,d,k)}}},8285:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.BufferNamespaceApi=void 0;const f=a(8771),_=a(8460),d=a(844);class k extends d.Disposable{constructor(M){super(),this._core=M,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.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,f){return this._core.registerCsiHandler(a,(_=>f(_.toArray())))}addCsiHandler(a,f){return this.registerCsiHandler(a,f)}registerDcsHandler(a,f){return this._core.registerDcsHandler(a,((_,d)=>f(_,d.toArray())))}addDcsHandler(a,f){return this.registerDcsHandler(a,f)}registerEscHandler(a,f){return this._core.registerEscHandler(a,f)}addEscHandler(a,f){return this.registerEscHandler(a,f)}registerOscHandler(a,f){return this._core.registerOscHandler(a,f)}addOscHandler(a,f){return this.registerOscHandler(a,f)}}},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 f=this&&this.__decorate||function(h,v,g,p){var S,j=arguments.length,L=j<3?v:p===null?p=Object.getOwnPropertyDescriptor(v,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(h,v,g,p);else for(var R=h.length-1;R>=0;R--)(S=h[R])&&(L=(j<3?S(L):j>3?S(v,g,L):S(v,g))||L);return j>3&&L&&Object.defineProperty(v,g,L),L},_=this&&this.__param||function(h,v){return function(g,p){v(g,p,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.BufferService=i.MINIMUM_ROWS=i.MINIMUM_COLS=void 0;const d=a(8460),k=a(844),E=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(h){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(h.rawOptions.cols||0,i.MINIMUM_COLS),this.rows=Math.max(h.rawOptions.rows||0,i.MINIMUM_ROWS),this.buffers=this.register(new E.BufferSet(h,this))}resize(h,v){this.cols=h,this.rows=v,this.buffers.resize(h,v),this._onResize.fire({cols:h,rows:v})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(h,v=!1){const g=this.buffer;let p;p=this._cachedBlankLine,p&&p.length===this.cols&&p.getFg(0)===h.fg&&p.getBg(0)===h.bg||(p=g.getBlankLine(h,v),this._cachedBlankLine=p),p.isWrapped=v;const S=g.ybase+g.scrollTop,j=g.ybase+g.scrollBottom;if(g.scrollTop===0){const L=g.lines.isFull;j===g.lines.length-1?L?g.lines.recycle().copyFrom(p):g.lines.push(p.clone()):g.lines.splice(j+1,0,p.clone()),L?this.isUserScrolling&&(g.ydisp=Math.max(g.ydisp-1,0)):(g.ybase++,this.isUserScrolling||g.ydisp++)}else{const L=j-S+1;g.lines.shiftElements(S+1,L-1,-1),g.lines.set(j,p.clone())}this.isUserScrolling||(g.ydisp=g.ybase),this._onScroll.fire(g.ydisp)}scrollLines(h,v,g){const p=this.buffer;if(h<0){if(p.ydisp===0)return;this.isUserScrolling=!0}else h+p.ydisp>=p.ybase&&(this.isUserScrolling=!1);const S=p.ydisp;p.ydisp=Math.max(Math.min(p.ydisp+h,p.ybase),0),S!==p.ydisp&&(v||this._onScroll.fire(p.ydisp))}};i.BufferService=w=f([_(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,f){this._charsets[a]=f,this.glevel===a&&(this.charset=f)}}},1753:function(b,i,a){var f=this&&this.__decorate||function(p,S,j,L){var R,x=arguments.length,T=x<3?S:L===null?L=Object.getOwnPropertyDescriptor(S,j):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(p,S,j,L);else for(var I=p.length-1;I>=0;I--)(R=p[I])&&(T=(x<3?R(T):x>3?R(S,j,T):R(S,j))||T);return x>3&&T&&Object.defineProperty(S,j,T),T},_=this&&this.__param||function(p,S){return function(j,L){S(j,L,p)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreMouseService=void 0;const d=a(2585),k=a(8460),E=a(844),M={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:p=>p.button!==4&&p.action===1&&(p.ctrl=!1,p.alt=!1,p.shift=!1,!0)},VT200:{events:19,restrict:p=>p.action!==32},DRAG:{events:23,restrict:p=>p.action!==32||p.button!==3},ANY:{events:31,restrict:p=>!0}};function w(p,S){let j=(p.ctrl?16:0)|(p.shift?4:0)|(p.alt?8:0);return p.button===4?(j|=64,j|=p.action):(j|=3&p.button,4&p.button&&(j|=64),8&p.button&&(j|=128),p.action===32?j|=32:p.action!==0||S||(j|=3)),j}const h=String.fromCharCode,v={DEFAULT:p=>{const S=[w(p,!1)+32,p.col+32,p.row+32];return S[0]>255||S[1]>255||S[2]>255?"":`\x1B[M${h(S[0])}${h(S[1])}${h(S[2])}`},SGR:p=>{const S=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${w(p,!0)};${p.col};${p.row}${S}`},SGR_PIXELS:p=>{const S=p.action===0&&p.button!==4?"m":"M";return`\x1B[<${w(p,!0)};${p.x};${p.y}${S}`}};let g=i.CoreMouseService=class extends E.Disposable{constructor(p,S){super(),this._bufferService=p,this._coreService=S,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(v))this.addEncoding(j,v[j]);this.reset()}addProtocol(p,S){this._protocols[p]=S}addEncoding(p,S){this._encodings[p]=S}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(p){if(!this._protocols[p])throw new Error(`unknown protocol "${p}"`);this._activeProtocol=p,this._onProtocolChange.fire(this._protocols[p].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(p){if(!this._encodings[p])throw new Error(`unknown encoding "${p}"`);this._activeEncoding=p}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(p){if(p.col<0||p.col>=this._bufferService.cols||p.row<0||p.row>=this._bufferService.rows||p.button===4&&p.action===32||p.button===3&&p.action!==32||p.button!==4&&(p.action===2||p.action===3)||(p.col++,p.row++,p.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,p,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(p))return!1;const S=this._encodings[this._activeEncoding](p);return S&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(S):this._coreService.triggerDataEvent(S,!0)),this._lastEvent=p,!0}explainEvents(p){return{down:!!(1&p),up:!!(2&p),drag:!!(4&p),move:!!(8&p),wheel:!!(16&p)}}_equalEvents(p,S,j){if(j){if(p.x!==S.x||p.y!==S.y)return!1}else if(p.col!==S.col||p.row!==S.row)return!1;return p.button===S.button&&p.action===S.action&&p.ctrl===S.ctrl&&p.alt===S.alt&&p.shift===S.shift}};i.CoreMouseService=g=f([_(0,d.IBufferService),_(1,d.ICoreService)],g)},6975:function(b,i,a){var f=this&&this.__decorate||function(g,p,S,j){var L,R=arguments.length,x=R<3?p:j===null?j=Object.getOwnPropertyDescriptor(p,S):j;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(g,p,S,j);else for(var T=g.length-1;T>=0;T--)(L=g[T])&&(x=(R<3?L(x):R>3?L(p,S,x):L(p,S))||x);return R>3&&x&&Object.defineProperty(p,S,x),x},_=this&&this.__param||function(g,p){return function(S,j){p(S,j,g)}};Object.defineProperty(i,"__esModule",{value:!0}),i.CoreService=void 0;const d=a(1439),k=a(8460),E=a(844),M=a(2585),w=Object.freeze({insertMode:!1}),h=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let v=i.CoreService=class extends E.Disposable{constructor(g,p,S){super(),this._bufferService=g,this._logService=p,this._optionsService=S,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,d.clone)(w),this.decPrivateModes=(0,d.clone)(h)}reset(){this.modes=(0,d.clone)(w),this.decPrivateModes=(0,d.clone)(h)}triggerDataEvent(g,p=!1){if(this._optionsService.rawOptions.disableStdin)return;const S=this._bufferService.buffer;p&&this._optionsService.rawOptions.scrollOnUserInput&&S.ybase!==S.ydisp&&this._onRequestScrollToBottom.fire(),p&&this._onUserInput.fire(),this._logService.debug(`sending data "${g}"`,(()=>g.split("").map((j=>j.charCodeAt(0))))),this._onData.fire(g)}triggerBinaryEvent(g){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${g}"`,(()=>g.split("").map((p=>p.charCodeAt(0))))),this._onBinary.fire(g))}};i.CoreService=v=f([_(0,M.IBufferService),_(1,M.ILogService),_(2,M.IOptionsService)],v)},9074:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.DecorationService=void 0;const f=a(8055),_=a(8460),d=a(844),k=a(6106);let E=0,M=0;class w extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new k.SortedList((g=>g==null?void 0:g.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,d.toDisposable)((()=>this.reset())))}registerDecoration(g){if(g.marker.isDisposed)return;const p=new h(g);if(p){const S=p.marker.onDispose((()=>p.dispose()));p.onDispose((()=>{p&&(this._decorations.delete(p)&&this._onDecorationRemoved.fire(p),S.dispose())})),this._decorations.insert(p),this._onDecorationRegistered.fire(p)}return p}reset(){for(const g of this._decorations.values())g.dispose();this._decorations.clear()}*getDecorationsAtCell(g,p,S){let j=0,L=0;for(const R of this._decorations.getKeyIterator(p))j=R.options.x??0,L=j+(R.options.width??1),g>=j&&g<L&&(!S||(R.options.layer??"bottom")===S)&&(yield R)}forEachDecorationAtCell(g,p,S,j){this._decorations.forEachByKey(p,(L=>{E=L.options.x??0,M=E+(L.options.width??1),g>=E&&g<M&&(!S||(L.options.layer??"bottom")===S)&&j(L)}))}}i.DecorationService=w;class h extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(g){super(),this.options=g,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=g.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 f=a(2585),_=a(8343);class d{constructor(...E){this._entries=new Map;for(const[M,w]of E)this.set(M,w)}set(E,M){const w=this._entries.get(E);return this._entries.set(E,M),w}forEach(E){for(const[M,w]of this._entries.entries())E(M,w)}has(E){return this._entries.has(E)}get(E){return this._entries.get(E)}}i.ServiceCollection=d,i.InstantiationService=class{constructor(){this._services=new d,this._services.set(f.IInstantiationService,this)}setService(k,E){this._services.set(k,E)}getService(k){return this._services.get(k)}createInstance(k,...E){const M=(0,_.getServiceDependencies)(k).sort(((v,g)=>v.index-g.index)),w=[];for(const v of M){const g=this._services.get(v.id);if(!g)throw new Error(`[createInstance] ${k.name} depends on UNKNOWN service ${v.id}.`);w.push(g)}const h=M.length>0?M[0].index:E.length;if(E.length!==h)throw new Error(`[createInstance] First service dependency of ${k.name} at position ${h+1} conflicts with ${E.length} static arguments`);return new k(...E,...w)}}},7866:function(b,i,a){var f=this&&this.__decorate||function(h,v,g,p){var S,j=arguments.length,L=j<3?v:p===null?p=Object.getOwnPropertyDescriptor(v,g):p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(h,v,g,p);else for(var R=h.length-1;R>=0;R--)(S=h[R])&&(L=(j<3?S(L):j>3?S(v,g,L):S(v,g))||L);return j>3&&L&&Object.defineProperty(v,g,L),L},_=this&&this.__param||function(h,v){return function(g,p){v(g,p,h)}};Object.defineProperty(i,"__esModule",{value:!0}),i.traceCall=i.setTraceLogger=i.LogService=void 0;const d=a(844),k=a(2585),E={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 d.Disposable{get logLevel(){return this._logLevel}constructor(h){super(),this._optionsService=h,this._logLevel=k.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),M=this}_updateLogLevel(){this._logLevel=E[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(h){for(let v=0;v<h.length;v++)typeof h[v]=="function"&&(h[v]=h[v]())}_log(h,v,g){this._evalLazyOptionalParams(g),h.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+v,...g)}trace(h,...v){var g;this._logLevel<=k.LogLevelEnum.TRACE&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.trace.bind(this._optionsService.options.logger))??console.log,h,v)}debug(h,...v){var g;this._logLevel<=k.LogLevelEnum.DEBUG&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.debug.bind(this._optionsService.options.logger))??console.log,h,v)}info(h,...v){var g;this._logLevel<=k.LogLevelEnum.INFO&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.info.bind(this._optionsService.options.logger))??console.info,h,v)}warn(h,...v){var g;this._logLevel<=k.LogLevelEnum.WARN&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.warn.bind(this._optionsService.options.logger))??console.warn,h,v)}error(h,...v){var g;this._logLevel<=k.LogLevelEnum.ERROR&&this._log(((g=this._optionsService.options.logger)==null?void 0:g.error.bind(this._optionsService.options.logger))??console.error,h,v)}};i.LogService=w=f([_(0,k.IOptionsService)],w),i.setTraceLogger=function(h){M=h},i.traceCall=function(h,v,g){if(typeof g.value!="function")throw new Error("not supported");const p=g.value;g.value=function(...S){if(M.logLevel!==k.LogLevelEnum.TRACE)return p.apply(this,S);M.trace(`GlyphRenderer#${p.name}(${S.map((L=>JSON.stringify(L))).join(", ")})`);const j=p.apply(this,S);return M.trace(`GlyphRenderer#${p.name} return`,j),j}}},7302:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.OptionsService=i.DEFAULT_OPTIONS=void 0;const f=a(8460),_=a(844),d=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:d.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 E extends _.Disposable{constructor(w){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const h={...i.DEFAULT_OPTIONS};for(const v in w)if(v in h)try{const g=w[v];h[v]=this._sanitizeAndValidateOption(v,g)}catch(g){console.error(g)}this.rawOptions=h,this.options={...h},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,h){return this.onOptionChange((v=>{v===w&&h(this.rawOptions[w])}))}onMultipleOptionChange(w,h){return this.onOptionChange((v=>{w.indexOf(v)!==-1&&h()}))}_setupOptions(){const w=v=>{if(!(v in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);return this.rawOptions[v]},h=(v,g)=>{if(!(v in i.DEFAULT_OPTIONS))throw new Error(`No option with key "${v}"`);g=this._sanitizeAndValidateOption(v,g),this.rawOptions[v]!==g&&(this.rawOptions[v]=g,this._onOptionChange.fire(v))};for(const v in this.rawOptions){const g={get:w.bind(this,v),set:h.bind(this,v)};Object.defineProperty(this.options,v,g)}}_sanitizeAndValidateOption(w,h){switch(w){case"cursorStyle":if(h||(h=i.DEFAULT_OPTIONS[w]),!(function(v){return v==="block"||v==="underline"||v==="bar"})(h))throw new Error(`"${h}" is not a valid value for ${w}`);break;case"wordSeparator":h||(h=i.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof h=="number"&&1<=h&&h<=1e3)break;h=k.includes(h)?h:i.DEFAULT_OPTIONS[w];break;case"cursorWidth":h=Math.floor(h);case"lineHeight":case"tabStopWidth":if(h<1)throw new Error(`${w} cannot be less than 1, value: ${h}`);break;case"minimumContrastRatio":h=Math.max(1,Math.min(21,Math.round(10*h)/10));break;case"scrollback":if((h=Math.min(h,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${h}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(h<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${h}`);break;case"rows":case"cols":if(!h&&h!==0)throw new Error(`${w} must be numeric, value: ${h}`);break;case"windowsPty":h=h??{}}return h}}i.OptionsService=E},2660:function(b,i,a){var f=this&&this.__decorate||function(E,M,w,h){var v,g=arguments.length,p=g<3?M:h===null?h=Object.getOwnPropertyDescriptor(M,w):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(E,M,w,h);else for(var S=E.length-1;S>=0;S--)(v=E[S])&&(p=(g<3?v(p):g>3?v(M,w,p):v(M,w))||p);return g>3&&p&&Object.defineProperty(M,w,p),p},_=this&&this.__param||function(E,M){return function(w,h){M(w,h,E)}};Object.defineProperty(i,"__esModule",{value:!0}),i.OscLinkService=void 0;const d=a(2585);let k=i.OscLinkService=class{constructor(E){this._bufferService=E,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(E){const M=this._bufferService.buffer;if(E.id===void 0){const S=M.addMarker(M.ybase+M.y),j={data:E,id:this._nextId++,lines:[S]};return S.onDispose((()=>this._removeMarkerFromLink(j,S))),this._dataByLinkId.set(j.id,j),j.id}const w=E,h=this._getEntryIdKey(w),v=this._entriesWithId.get(h);if(v)return this.addLineToLink(v.id,M.ybase+M.y),v.id;const g=M.addMarker(M.ybase+M.y),p={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(p,g))),this._entriesWithId.set(p.key,p),this._dataByLinkId.set(p.id,p),p.id}addLineToLink(E,M){const w=this._dataByLinkId.get(E);if(w&&w.lines.every((h=>h.line!==M))){const h=this._bufferService.buffer.addMarker(M);w.lines.push(h),h.onDispose((()=>this._removeMarkerFromLink(w,h)))}}getLinkData(E){var M;return(M=this._dataByLinkId.get(E))==null?void 0:M.data}_getEntryIdKey(E){return`${E.id};;${E.uri}`}_removeMarkerFromLink(E,M){const w=E.lines.indexOf(M);w!==-1&&(E.lines.splice(w,1),E.lines.length===0&&(E.data.id!==void 0&&this._entriesWithId.delete(E.key),this._dataByLinkId.delete(E.id)))}};i.OscLinkService=k=f([_(0,d.IBufferService)],k)},8343:(b,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.createDecorator=i.getServiceDependencies=i.serviceRegistry=void 0;const a="di$target",f="di$dependencies";i.serviceRegistry=new Map,i.getServiceDependencies=function(_){return _[f]||[]},i.createDecorator=function(_){if(i.serviceRegistry.has(_))return i.serviceRegistry.get(_);const d=function(k,E,M){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,h,v){h[a]===h?h[f].push({id:w,index:v}):(h[f]=[{id:w,index:v}],h[a]=h)})(d,k,M)};return d.toString=()=>_,i.serviceRegistry.set(_,d),d}},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 f=a(8343);var _;i.IBufferService=(0,f.createDecorator)("BufferService"),i.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),i.ICoreService=(0,f.createDecorator)("CoreService"),i.ICharsetService=(0,f.createDecorator)("CharsetService"),i.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(_||(i.LogLevelEnum=_={})),i.ILogService=(0,f.createDecorator)("LogService"),i.IOptionsService=(0,f.createDecorator)("OptionsService"),i.IOscLinkService=(0,f.createDecorator)("OscLinkService"),i.IUnicodeService=(0,f.createDecorator)("UnicodeService"),i.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(b,i,a)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.UnicodeService=void 0;const f=a(8460),_=a(225);class d{static extractShouldJoin(E){return(1&E)!=0}static extractWidth(E){return E>>1&3}static extractCharKind(E){return E>>3}static createPropertyValue(E,M,w=!1){return(16777215&E)<<3|(3&M)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const E=new _.UnicodeV6;this.register(E),this._active=E.version,this._activeProvider=E}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(E){if(!this._providers[E])throw new Error(`unknown Unicode version "${E}"`);this._active=E,this._activeProvider=this._providers[E],this._onChange.fire(E)}register(E){this._providers[E.version]=E}wcwidth(E){return this._activeProvider.wcwidth(E)}getStringCellWidth(E){let M=0,w=0;const h=E.length;for(let v=0;v<h;++v){let g=E.charCodeAt(v);if(55296<=g&&g<=56319){if(++v>=h)return M+this.wcwidth(g);const j=E.charCodeAt(v);56320<=j&&j<=57343?g=1024*(g-55296)+j-56320+65536:M+=this.wcwidth(j)}const p=this.charProperties(g,w);let S=d.extractWidth(p);d.extractShouldJoin(p)&&(S-=d.extractWidth(w)),M+=S,w=p}return M}charProperties(E,M){return this._activeProvider.charProperties(E,M)}}i.UnicodeService=d}},l={};function c(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,c),a.exports}var y={};return(()=>{var b=y;Object.defineProperty(b,"__esModule",{value:!0}),b.Terminal=void 0;const i=c(9042),a=c(3236),f=c(844),_=c(5741),d=c(8285),k=c(7975),E=c(7090),M=["cols","rows"];class w extends f.Disposable{constructor(v){super(),this._core=this.register(new a.Terminal(v)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const g=S=>this._core.options[S],p=(S,j)=>{this._checkReadonlyOptions(S),this._core.options[S]=j};for(const S in this._core.options){const j={get:g.bind(this,S),set:p.bind(this,S)};Object.defineProperty(this._publicOptions,S,j)}}_checkReadonlyOptions(v){if(M.includes(v))throw new Error(`Option "${v}" 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 E.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 d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const v=this._core.coreService.decPrivateModes;let g="none";switch(this._core.coreMouseService.activeProtocol){case"X10":g="x10";break;case"VT200":g="vt200";break;case"DRAG":g="drag";break;case"ANY":g="any"}return{applicationCursorKeysMode:v.applicationCursorKeys,applicationKeypadMode:v.applicationKeypad,bracketedPasteMode:v.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:g,originMode:v.origin,reverseWraparoundMode:v.reverseWraparound,sendFocusMode:v.sendFocus,wraparoundMode:v.wraparound}}get options(){return this._publicOptions}set options(v){for(const g in v)this._publicOptions[g]=v[g]}blur(){this._core.blur()}focus(){this._core.focus()}input(v,g=!0){this._core.input(v,g)}resize(v,g){this._verifyIntegers(v,g),this._core.resize(v,g)}open(v){this._core.open(v)}attachCustomKeyEventHandler(v){this._core.attachCustomKeyEventHandler(v)}attachCustomWheelEventHandler(v){this._core.attachCustomWheelEventHandler(v)}registerLinkProvider(v){return this._core.registerLinkProvider(v)}registerCharacterJoiner(v){return this._checkProposedApi(),this._core.registerCharacterJoiner(v)}deregisterCharacterJoiner(v){this._checkProposedApi(),this._core.deregisterCharacterJoiner(v)}registerMarker(v=0){return this._verifyIntegers(v),this._core.registerMarker(v)}registerDecoration(v){return this._checkProposedApi(),this._verifyPositiveIntegers(v.x??0,v.width??0,v.height??0),this._core.registerDecoration(v)}hasSelection(){return this._core.hasSelection()}select(v,g,p){this._verifyIntegers(v,g,p),this._core.select(v,g,p)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(v,g){this._verifyIntegers(v,g),this._core.selectLines(v,g)}dispose(){super.dispose()}scrollLines(v){this._verifyIntegers(v),this._core.scrollLines(v)}scrollPages(v){this._verifyIntegers(v),this._core.scrollPages(v)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(v){this._verifyIntegers(v),this._core.scrollToLine(v)}clear(){this._core.clear()}write(v,g){this._core.write(v,g)}writeln(v,g){this._core.write(v),this._core.write(`\r
129
- `,g)}paste(v){this._core.paste(v)}refresh(v,g){this._verifyIntegers(v,g),this._core.refresh(v,g)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(v){this._addonManager.loadAddon(this,v)}static get strings(){return i}_verifyIntegers(...v){for(const g of v)if(g===1/0||isNaN(g)||g%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...v){for(const g of v)if(g&&(g===1/0||isNaN(g)||g%1!=0||g<0))throw new Error("This API only accepts positive integers")}}b.Terminal=w})(),y})()))})(Au)),Au.exports}var t1=e1();function n1(t){return t.toLowerCase().startsWith("win")}function r1(t){return t.keyCode===86&&t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey}const s1=8,i1=100,o1=80,lm=6,am=.02,l1=.95,a1=50;function c1(t,e){return Math.hypot(t,e)>s1}function u1(t,e){const s=t[t.length-1];if(s===void 0||e-s.t>o1)return 0;const l=t.filter(b=>s.t-b.t<=i1),c=l[0];if(c===void 0||l.length<2||s.t===c.t)return 0;const y=(c.y-s.y)/(s.t-c.t);return Math.max(-lm,Math.min(lm,y))}function d1(t,e){if(Math.abs(t)<am)return{delta:0,velocity:0};const s=Math.max(0,Math.min(a1,e)),l=t*l1**(s/16);return{delta:t*s,velocity:Math.abs(l)<am?0:l}}function h1(t){const e=Math.trunc(t);return{pixels:e,rest:t-e}}const f1=60;function p1(){return new URLSearchParams(window.location.search).get("renderer")==="webgl"?"webgl":"canvas"}const cm={dark:{background:"#12141a",foreground:"#d8dee9",cursor:"#d8dee9",selectionBackground:"#2f3542"},light:{background:"#fbfbfd",foreground:"#22262e",cursor:"#22262e",selectionBackground:"#cfd8e3"}},um={dark:1,light:4.5};function Tv({terminalId:t,connection:e,active:s,theme:l,autoFocus:c=!0,pasteOnCtrlV:y=!1}){const b=N.useRef(null),i=N.useRef(null),a=N.useRef(null),f=N.useRef(l);return f.current=l,N.useEffect(()=>{const _=b.current;if(_===null)return;const d=new t1.Terminal({convertEol:!1,cursorBlink:!0,fontFamily:'"Cascadia Mono", "Consolas", "Menlo", "DejaVu Sans Mono", monospace',fontSize:14,lineHeight:1.2,scrollback:1e4,allowProposedApi:!0,theme:cm[f.current],minimumContrastRatio:um[f.current]});i.current=d;const k=new Yx.FitAddon;a.current=k,d.loadAddon(k),d.loadAddon(new Qx.WebLinksAddon),d.open(_);let E=!1;const M=()=>{if(!(E||p1()!=="webgl")){E=!0;try{const ne=new Zx.WebglAddon;ne.onContextLoss(()=>ne.dispose()),d.loadAddon(ne)}catch{console.info("[terminal] WebGL no disponible; se usa el renderer por defecto.")}}};let w={cols:0,rows:0},h;const v=()=>_.clientWidth>0&&_.clientHeight>0,g=ne=>{const{cols:ee,rows:be}=d;ee<=0||be<=0||!ne&&ee===w.cols&&be===w.rows||(w={cols:ee,rows:be},e.send({type:"resize",terminalId:t,cols:ee,rows:be}))};let p={atBottom:!0,line:0},S=!1;const j=()=>{if(S||!v())return;const ne=d.buffer.active;p={atBottom:ne.viewportY>=ne.baseY,line:ne.viewportY}},L=()=>{const ne=d.buffer.active;if(ne.baseY===0)return;const ee=p.atBottom?ne.baseY:Math.min(p.line,ne.baseY);d.scrollToLine(ee>0?ee-1:ee+1),d.scrollToLine(ee)},R=d.onRender(j),x=d.onScroll(j);let T=v();const I=()=>{if(v()){try{k.fit()}catch{return}S&&(L(),S=!1),d.cols>0&&d.rows>0&&M(),g(!1)}},O=()=>{window.clearTimeout(h),h=window.setTimeout(I,f1)},P=new ResizeObserver(()=>{const ne=v();S=!0,ne&&!T&&L(),T=ne,O()});P.observe(_),window.addEventListener("resize",O);let F=null,W=0,$=0;const K=(ne,ee,be)=>{const me=d.element;if(me===void 0)return;const Be=h1($+ne);$=Be.rest,Be.pixels!==0&&me.dispatchEvent(new WheelEvent("wheel",{deltaY:Be.pixels,deltaMode:WheelEvent.DOM_DELTA_PIXEL,clientX:ee,clientY:be,bubbles:!0,cancelable:!0}))},G=()=>{window.cancelAnimationFrame(W),W=0},q=(ne,ee,be)=>{let me=ne,Be=performance.now();const ze=Qe=>{if(!v()){W=0;return}const dt=d1(me,Qe-Be);Be=Qe,K(dt.delta,ee,be),me=dt.velocity,W=me===0?0:window.requestAnimationFrame(ze)};W=window.requestAnimationFrame(ze)},D=(ne,ee)=>{for(let be=0;be<ne.length;be++){const me=ne.item(be);if(me!==null&&me.identifier===ee)return me}return null},U=ne=>{G(),$=0;const ee=ne.touches.length===1?ne.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:ne.timeStamp,y:ee.clientY}]}},H=ne=>{if(ne.stopPropagation(),F===null)return;const ee=D(ne.touches,F.id);if(ee===null)return;if(!F.moving){if(!c1(ee.clientX-F.startX,ee.clientY-F.startY))return;F.moving=!0}ne.cancelable&&ne.preventDefault();const be=F.lastY-ee.clientY;F.lastX=ee.clientX,F.lastY=ee.clientY,F.samples.push({t:ne.timeStamp,y:ee.clientY}),F.samples.length>32&&F.samples.shift(),K(be,ee.clientX,ee.clientY)},z=ne=>{if(F===null||D(ne.changedTouches,F.id)===null)return;const ee=F;if(F=null,!ee.moving)return;const be=u1(ee.samples,ne.timeStamp);be!==0&&q(be,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"||!v())){try{k.fit()}catch{return}g(!0)}};window.addEventListener("focus",ie),document.addEventListener("visibilitychange",ie),y&&d.attachCustomKeyEventHandler(ne=>!r1(ne));const ye=d.onData(ne=>{e.send({type:"input",terminalId:t,data:ne})}),_e=e.onMessage(ne=>{switch(ne.type){case"terminal.output":ne.terminalId===t&&d.write(ne.data);break;case"terminal.replay":if(ne.terminalId!==t)break;d.reset(),ne.truncated&&d.write(`\x1B[90m-- ${m("terminal.replayTruncated")} --\x1B[0m\r
130
- `),d.write(ne.data);break;case"terminal.exit":if(ne.terminalId!==t)break;d.write(`\r
131
- \x1B[90m-- ${m("terminal.exited",{code:ne.exitCode})} --\x1B[0m\r
132
- `);break}}),Q=()=>{if(v())try{k.fit()}catch{}const ne=d.cols>0?d.cols:80,ee=d.rows>0?d.rows:24;w={cols:ne,rows:ee},e.send({type:"terminal.attach",terminalId:t,cols:ne,rows:ee})};Q();const Y=e.onReopen(Q);return()=>{window.clearTimeout(h),window.removeEventListener("resize",O),window.removeEventListener("focus",ie),document.removeEventListener("visibilitychange",ie),P.disconnect(),G(),_.removeEventListener("touchstart",U,{capture:!0}),_.removeEventListener("touchmove",H,{capture:!0}),_.removeEventListener("touchend",z,{capture:!0}),_.removeEventListener("touchcancel",Z,{capture:!0}),R.dispose(),x.dispose(),ye.dispose(),_e(),Y(),e.send({type:"terminal.detach",terminalId:t}),d.dispose(),i.current=null,a.current=null}},[t,e,y]),N.useEffect(()=>{const _=i.current;_!==null&&(_.options.theme=cm[l],_.options.minimumContrastRatio=um[l])},[l]),N.useEffect(()=>{if(!s)return;const _=i.current,d=a.current;if(_===null||d===null)return;const k=window.setTimeout(()=>{const E=b.current;if(!(E===null||E.clientWidth===0||E.clientHeight===0)){try{d.fit()}catch{return}c&&_.focus(),_.cols>0&&_.rows>0&&e.send({type:"resize",terminalId:t,cols:_.cols,rows:_.rows})}},0);return()=>window.clearTimeout(k)},[s,c,t,e]),o.jsx("div",{className:`terminal-surface${s?"":" terminal-surface-hidden"}`,ref:b})}function m1(){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 ja({title:t,onHide:e,confirmText:s}){const[l,c]=N.useState(!1);return o.jsxs("span",{className:"section-hide",children:[o.jsx("button",{className:"icon-button",onClick:y=>{y.stopPropagation(),s===null?e():c(!0)},title:t,"aria-label":t,children:o.jsx(m1,{})}),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:()=>{c(!1),e()},children:m("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>c(!1),children:m("common.cancel")})]})]})}const g1=typeof navigator<"u"&&n1(navigator.platform);function v1({connection:t,shells:e,activeShellId:s,cwd:l,shellName:c,theme:y,onSelect:b,onOpen:i,onCloseShell:a,onCollapse:f,onHide:_,hideCount:d=0}){const k=c??m("console.name"),E=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===(E==null?void 0:E.terminalId)?" is-active":""}${M.alive?"":" is-dead"}`,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>b(M.terminalId),title:M.alive?m("console.tab.title",{shell:M.label.length>0?M.label:k,number:w+1,cwd:l}):m("console.tab.exited",{code:M.exitCode??"?"}),children:m("console.tab.label",{number:w+1})}),o.jsx("button",{className:"strip-tab-close",onClick:()=>a(M.terminalId),title:m("console.tab.close"),children:"×"})]},M.terminalId)),c!==null&&o.jsx("button",{className:"strip-tab-new",onClick:i,title:m("console.openAnother",{shell:k,cwd:l}),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button",onClick:f,title:m("console.collapse"),children:"▾"}),_!==void 0&&o.jsx(ja,{title:m("settings.hide.console"),onHide:_,confirmText:d===0?null:m("settings.panels.consoleConfirm",{count:d})})]}),o.jsx("div",{className:"console-body",children:e.length===0?o.jsx("div",{className:"console-empty",children:c===null?o.jsx("p",{className:"panel-note",children:m("console.noShell")}):o.jsx("button",{className:"link-button",onClick:i,children:m("console.openIn",{shell:k,cwd:l})})}):o.jsx("div",{className:"terminal-stack",children:e.map(M=>o.jsx(Tv,{terminalId:M.terminalId,connection:t,active:M.terminalId===(E==null?void 0:E.terminalId),theme:y,pasteOnCtrlV:g1},M.terminalId))})})]})}function _1(t){return t.cwd===null||!t.shellAvailable||t.shellCwds.includes(t.cwd)?null:t.cwd}const w1=.75,b1=.9,y1=.7;function ur(t){if(t<1e3)return String(t);if(t<1e6){const e=t/1e3;return`${e<100?Oi(e,1):Math.round(e)}k`}return`${Oi(t/1e6,2)}M`}function k1({usage:t,source:e,instructionsFile:s,fallbackWindow:l=null,compact:c=!1,statusLineState:y=null,onConfigure:b,compactAction:i=null}){const{lastRequestTokens:a,contextWindow:f}=t;if(b!==void 0&&y!==null&&Ak(e,{state:y}))return o.jsxs("div",{className:`meter meter-idle${c?" meter-compact":""}`,title:Ik(y),children:[o.jsx("span",{className:"meter-label",children:m("meter.label")}),o.jsx("span",{className:`meter-bar${c?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:m("meter.unmeasured")}),o.jsx("button",{className:"link-button",onClick:b,children:m("meter.configure")})]});if(e===null)return o.jsxs("div",{className:`meter meter-idle${c?" meter-compact":""}`,title:m("meter.noTokensTitle"),children:[o.jsx("span",{className:"meter-label",children:m("meter.label")}),o.jsx("span",{className:`meter-bar${c?" meter-bar-inline":""}`}),o.jsx("span",{className:"meter-value",children:m("meter.noTokens")})]});if(!Mk(e,t)){const M=Dk(s,e,t.compacted===!0),w=Rk(e,t,l);return o.jsxs("div",{className:`meter meter-idle${c?" meter-compact":""}`,title:M,children:[o.jsx("span",{className:"meter-label",children:m("meter.label")}),o.jsx("span",{className:`meter-bar${c?" meter-bar-inline":""}`}),o.jsxs("span",{className:"meter-value",children:[m("meter.unmeasured"),w!==null&&o.jsxs("span",{className:"meter-dim",children:[" / ",ur(w)]})]})]})}const _=f!==null&&f>0?Math.min(a/f,1):null,d=_===null?"unknown":_>=b1?"danger":_>=w1?"warn":"ok",k=f===null?"":` / ${ur(f)}${t.contextWindowEstimated?"+":""}`,E=jk(e,t);if(c){const M=[t.lastModel===null?null:t.lastModel,E,_===null?m("meter.unknownModelShort"):m("meter.windowPercent",{percent:Math.round(_*100)}),m("meter.output",{tokens:ur(t.lastOutputTokens)}),e==="status-line"?m("meter.responses",{count:t.assistantMessages}):m("meter.sessionTotals",{output:ur(t.totalOutputTokens),cache:ur(t.totalCacheReadTokens),count:t.assistantMessages})].filter(h=>h!==null).join(" · "),w=i!==null&&_!==null&&_>=y1;return o.jsxs("div",{className:"meter meter-compact",title:M,children:[o.jsx("span",{className:"meter-label",children:m("meter.label")}),_!==null&&o.jsx("span",{className:"meter-bar meter-bar-inline",children:o.jsx("span",{className:`meter-fill meter-fill-${d}`,style:{width:`${_*100}%`}})}),o.jsxs("span",{className:"meter-value",children:[ur(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??m("meter.compactTitle",{command:i.command}),children:m("meter.compact")})]})}return o.jsxs("div",{className:"meter",children:[o.jsxs("div",{className:"meter-row",children:[o.jsx("span",{className:"meter-label",children:m("meter.label")}),o.jsxs("span",{className:"meter-value",children:[ur(a),f!==null&&o.jsxs("span",{className:"meter-dim",title:t.lastModel===null?void 0:E!==null?m("meter.modelWithOrigin",{model:t.lastModel,origin:E}):t.lastModel,children:[" ","/ ",ur(f),t.contextWindowEstimated&&"+"]})]})]}),_!==null?o.jsx("div",{className:"meter-bar",title:m("meter.windowPercent",{percent:Math.round(_*100)}),children:o.jsx("div",{className:`meter-fill meter-fill-${d}`,style:{width:`${_*100}%`}})}):o.jsx("div",{className:"meter-note",title:t.lastModel??void 0,children:m("meter.unknownModel")}),o.jsxs("div",{className:"meter-row meter-row-dim",children:[o.jsx("span",{title:m("meter.lastResponseTitle"),children:m("meter.output",{tokens:ur(t.lastOutputTokens)})}),o.jsx("span",{title:m("meter.sessionTitle"),children:m("meter.sessionTotals",{output:ur(t.totalOutputTokens),cache:ur(t.totalCacheReadTokens),count:t.assistantMessages})})]})]})}const C1=75,Da=90,x1=3e4;function S1(t){return t>=Da?"danger":t>=C1?"warn":"ok"}function Iu(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 E1(t,e){const s=ay(t,e).sort(Iu);if(s.length===0)return null;const l=new Map;for(const f of s){const _=f.minutes===null?`id:${f.id}`:`m:${f.minutes}`,d=l.get(_);(d===void 0||f.usedPercent>d.usedPercent)&&l.set(_,f)}const c=[...l.values()].sort(Iu),y=c[0];if(y===void 0)return null;const b=c.find(f=>f.usedPercent>=Da),i=y.usedPercent<Da&&b!==void 0?b:y;let a=c.slice(0,2);return a.includes(i)||(a=[y,i]),{shown:a.sort(Iu),priorityId:i.id,all:s}}function Lv(t){const{minutes:e}=t;return e===null?m("plan.window.quota"):e===Gs.fiveHours?m("plan.window.fiveHours"):e===Gs.day?m("plan.window.day"):e===Gs.week?m("plan.window.week"):Math.abs(e-Gs.month)<=Gs.day?m("plan.window.month"):e%Gs.day===0?m("plan.window.days",{value:e/Gs.day}):m("plan.window.hours",{value:Math.max(1,Math.round(e/60))})}function Nv(t){const e=t>=100?Math.round(t):Math.min(99,Math.round(t));return IC(e)}function T1(t,e){return t.resetsAt===null?null:Kd(t.resetsAt-e)}function L1(t,e){return t-e<1440*60*1e3?Fi(t):t-e<10080*60*1e3?AC(t):`${qd(t)} ${Fi(t)}`}function N1(t,e){const s=t.all.map(c=>{const y=m("plan.used",{percent:Nv(c.usedPercent)}),b=c.resetsAt===null?m("plan.noReset"):m("plan.resetsIn",{time:Kd(c.resetsAt-e),at:L1(c.resetsAt,e)});return`${Lv(c)}: ${y} · ${b}`}),l=Math.max(...t.all.map(c=>c.observedAt));return s.push(m("plan.observed",{when:Jn(l,e)})),s.join(`
133
- `)}const R1={missing:"plan.setup.missing","other-command":"plan.setup.otherCommand",disabled:"plan.setup.disabled",unreadable:"plan.setup.unreadable"};function M1(t){return t===null?"hidden":t==="active"?"waiting":"configure"}function A1(t){return m(t==="active"?"plan.noDataTitle":R1[t])}function I1({windows:t,setupState:e,onConfigure:s}){const[l,c]=N.useState(()=>Date.now());N.useEffect(()=>{c(Date.now());const b=window.setInterval(()=>c(Date.now()),x1);return()=>window.clearInterval(b)},[t]);const y=E1(t,l);if(y===null){const b=M1(e);return b==="hidden"||e===null||b==="configure"&&s===void 0?null:o.jsxs("div",{className:"meter meter-idle meter-compact plan-meter",title:A1(e),children:[o.jsx("span",{className:"meter-label",children:m("plan.label")}),b==="configure"?o.jsx("button",{className:"link-button",onClick:s,children:m("meter.configure")}):o.jsx("span",{className:"meter-value",children:m("plan.noData")})]})}return o.jsx("div",{className:"meter meter-compact plan-meter",title:N1(y,l),children:y.shown.map(b=>{const i=S1(b.usedPercent),a=T1(b,l),f=b.id===y.priorityId;return o.jsxs("span",{className:`plan-window ${f?"plan-window-priority":"plan-window-extra"}`,children:[o.jsx("span",{className:"meter-label plan-label",children:Lv(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>=Da?"plan-danger":void 0,children:Nv(b.usedPercent)}),a!==null&&o.jsxs("span",{className:"meter-dim",children:[" · ",a]})]})]},b.id)})})}const ju=["s","m","l"],Rv="m",j1="agent-workbench.thread-font",D1="agent-workbench.notes-font",P1="s",O1={s:"threadFont.size.s",m:"threadFont.size.m",l:"threadFont.size.l"};function dm(t){return m(O1[t])}function Mv(t){const e=ju.indexOf(t);return ju[(e+1)%ju.length]??Rv}function B1(t){return t==="s"||t==="m"||t==="l"?t:null}function Pa(t){return m("threadFont.title",{current:dm(t),next:dm(Mv(t))})}const F1=300,H1=200,U1=2,W1=F1+H1,Av=U1*W1,$1=200;function Iv(t){return Math.max($1,t)}function z1(t){return t.hasMore&&!t.loading&&t.searching!==!0&&t.scrollTop<t.previousScrollTop&&t.scrollTop<=Iv(t.clientHeight)}function q1(t,e,s){return t<0&&e<=Iv(s)}function K1(t,e){return Math.max(0,e-t)}function V1(t,e){return t===null||e.length===0||e[0]===t?!1:e.includes(t)}const G1=52,Y1=10;function X1(t){return t.filter(e=>e.role==="user"&&e.parts.some(s=>s.kind==="text"||s.kind==="image")).map(e=>e.eventId)}function Q1(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 J1(t){return t.awayFromEnd&&(t.ownAbove||t.hasMore)}function hm(t,e){return Math.max(0,t+e-G1)}function Z1(t){return t.found?"jump":t.loading?"wait":!t.hasMore||t.pagesRequested>=Y1?"give-up":"load"}const eS=1;function tS(t,e){for(const s of t){const l=e(s);if(!(l===null||l.bottom<=eS))return{eventId:s,offset:l.top,lastId:t[t.length-1]??null}}return null}function nS(t,e,s,l){const c=e.indexOf(t.eventId);if(c===-1)return null;for(let y=c;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===c?t.offset:0))}return null}function rS(t,e){if(e===null)return 0;const s=t.lastIndexOf(e);return s===-1?0:t.length-1-s}const jv=80;function sS(t){return t.distanceFromEnd<=jv?!0:t.wasAtEnd&&t.scrollTop>=t.previousScrollTop}const fm=2,iS=4;function oS(t,e,s,l=iS){const c=e.right-e.left,y=e.bottom-e.top;if(c<=0||y<=0)return 0;const b=t.right-fm,i=b-c,a=t.top+fm,f=a+y;return b<=s.left-l||i>=s.right+l||f<=s.top-l||a>=s.bottom+l?0:Math.ceil(b-(s.left-l))}function Dv(t,e){return t.questionCards?t.cliOpen?e!==null&&c0(e,t.launchedAt)?"closed":null:"no-cli":"unsupported"}function lS(t,e,s){var y;const l=[...e].filter(([,b])=>b.terminalId===s),c=[];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 f=l.findIndex(([,E])=>a0(E.item,a)),[_]=f===-1?[]:l.splice(f,1);if(_===void 0)continue;const[d,k]=_;c.push({liveId:d,toolUseId:i.toolUseId,selections:k.selections,failure:k.failure})}return c}function Pv({agents:t,preselected:e,anchor:s,label:l=m("agentMenu.openWith"),onPick:c,onClose:y}){const b=N.useMemo(()=>fd(t),[t]),[i,a]=N.useState(()=>Uk(b,e)),[f,_]=N.useState(null),d=N.useRef(null),k=N.useRef([]);return N.useLayoutEffect(()=>{const E=d.current;if(E===null)return;const M=s.getBoundingClientRect(),w=E.getBoundingClientRect();_(tv({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 E;(E=k.current[i])==null||E.focus()},[i,f]),N.useEffect(()=>{const E=h=>{if(!(h.altKey||h.ctrlKey||h.metaKey)){if(h.key==="Escape"){h.preventDefault(),h.stopPropagation(),y(),s.focus();return}if(h.key==="ArrowDown"||h.key==="ArrowUp"){h.preventDefault(),h.stopPropagation(),a(v=>Wk(v,h.key==="ArrowDown"?1:-1,b.length));return}if(h.key==="Enter"){h.preventDefault(),h.stopPropagation();const v=b[i];v!==void 0&&c(v.id);return}h.key==="Tab"&&y()}},M=h=>{var g;const v=h.target;v instanceof Node&&((g=d.current)!=null&&g.contains(v)||s.contains(v))||y()},w=h=>{nv(h.target,s,d.current)&&y()};return window.addEventListener("keydown",E,!0),document.addEventListener("pointerdown",M,!0),window.addEventListener("scroll",w,!0),window.addEventListener("resize",y),()=>{window.removeEventListener("keydown",E,!0),document.removeEventListener("pointerdown",M,!0),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",y)}},[i,s,b,y,c]),Vd.createPortal(o.jsx("div",{ref:d,className:"agent-menu",role:"menu","aria-label":l,style:f===null?{left:0,top:0,visibility:"hidden"}:{left:`${f.left}px`,top:`${f.top}px`},children:b.map((E,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:()=>c(E.id),children:[o.jsx("span",{className:"agent-menu-label",children:E.label}),E.version!==null&&o.jsx("span",{className:"agent-menu-version",children:E.version})]},E.id))}),document.body)}function aS(){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 Ov({targets:t,className:e,text:s,label:l,blockedReason:c=null,title:y=$d(),onPick:b}){const[i,a]=N.useState(!1),f=N.useRef(null),_=N.useCallback(()=>a(!1),[]),d=N.useCallback(k=>{a(!1),b(k)},[b]);return t.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:f,className:e,onClick:()=>a(k=>!k),disabled:c!==null,"aria-haspopup":"menu","aria-expanded":i,"aria-label":l,title:c??y,children:s}),i&&f.current!==null&&o.jsx(Pv,{agents:t,preselected:null,anchor:f.current,label:m("continue.menuLabel"),onPick:d,onClose:_})]})}function wd(){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"})]})}function Gd(){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("path",{d:"M6 7.2v9.6"}),o.jsx("path",{d:"M8.5 12h11"}),o.jsx("path",{d:"M16 8.5l3.5 3.5-3.5 3.5"})]})}function Bv(t){switch(t.notice){case"compacted":return t.detail==="auto"?m("thread.notice.compactedAuto"):m("thread.notice.compacted");case"interrupted":return m("thread.notice.interrupted");case"error":return t.detail.length>0?m("thread.notice.error",{detail:t.detail}):m("thread.notice.errorNoDetail")}}const Fv="agent-workbench.locale",Hv="auto";function cS(t){return t==="auto"||Kg(t)?t:null}function Uv(t){const e=t.trim().replace(/_/g,"-").toLowerCase();if(e.length===0)return null;const s=Ud.find(y=>y.toLowerCase()===e);if(s!==void 0)return s;const[l="",...c]=e.split("-");return l==="zh"?c.includes("hant")||c.some(b=>b==="tw"||b==="hk"||b==="mo")?null:Du("zh-CN"):Du(l==="pt"?"pt-BR":l)}function Du(t){return Kg(t)?t:null}function Wv(t,e){if(t!=="auto")return t;for(const s of e){const l=Uv(s);if(l!==null)return l}return"en"}function $v(t,e){for(const s of e)if(Uv(s)===t)try{if(Intl.DateTimeFormat.supportedLocalesOf([s]).length>0)return s}catch{}return Jy(t)}let Oa=Hv;const bd=new Set;function Yd(){return Array.isArray(navigator.languages)&&navigator.languages.length>0?navigator.languages:typeof navigator.language=="string"?[navigator.language]:[]}function uS(){return Wv("auto",Yd())}async function zv(t){const e=Yd(),s=Wv(t,e);await Gg(s,$v(s,e))}async function dS(){Oa=jt(Fv,Hv,cS);try{await zv(Oa)}catch{await Gg("en",$v("en",Yd()))}document.documentElement.lang=hd(),Vg(()=>{document.documentElement.lang=hd()})}async function hS(t){await zv(t),Oa=t,Lt(Fv,t);for(const e of bd)e()}function fS(t){return bd.add(t),()=>bd.delete(t)}function pS(){return Oa}function Zo(){return N.useSyncExternalStore(Vg,hd)}function mS(){return N.useSyncExternalStore(fS,pS)}const qv=String.raw`https?:\/\/[^\s<>"'\`]+`,gS=new RegExp([String.raw`(\`[^\`\n]+\`)`,String.raw`(\*\*[^*\n]+\*\*)`,String.raw`(__[^_\n]+__)`,String.raw`(\*[^*\n]+\*)`,String.raw`(~~[^~\n]+~~)`,String.raw`(\[[^\]\n]+\]\([^)\s]+\))`,`(${qv})`].join("|")),vS=/^(https?:|mailto:)/i,_S=new RegExp(qv);function wS(t){const e=_S.exec(t);if(e===null||e.index===void 0)return null;const s=Kv(e[0]);return{index:e.index,length:s.length,href:s}}function ka(t,e){let s=0;for(const l of t)l===e&&(s+=1);return s}function Kv(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===")"&&ka(e,"(")<ka(e,")")){e=e.slice(0,-1);continue}if(s==="]"&&ka(e,"[")<ka(e,"]")){e=e.slice(0,-1);continue}return e}}function bS(t){const e=gS.exec(t);if(e===null||e.index===void 0)return null;const s=e[0],l=e.index,c=(b,i=s.length)=>({index:l,length:i,token:b});if(s.startsWith("`"))return c({kind:"code",text:s.slice(1,-1)});if(s.startsWith("**")||s.startsWith("__"))return c({kind:"strong",text:s.slice(2,-2)});if(s.startsWith("~~"))return c({kind:"del",text:s.slice(2,-2)});if(s.startsWith("*"))return c({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 vS.test(a)?c({kind:"link",label:i,href:a}):c({kind:"plain",text:s})}const y=Kv(s);return c({kind:"link",label:y,href:y},y.length)}function Oo(t,e,s){if(e.length===0)return[t];const l=t.toLowerCase(),c=e.toLowerCase(),y=[];let b=0,i=l.indexOf(c),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(c,b);return b<t.length&&y.push(t.slice(b)),y}const yS=/^\[([^\]\n]+)\]\(([^)\s]+)\)$/;function kS(t,e){const s=yS.exec(t);if(s===null)return null;const l=s[2]??"",c=e(l);return c===null?null:{label:s[1]??"",href:l,open:c}}function Kr(t,e,s,l){const c=[];let y=t,b=0;for(;y.length>0;){const i=bS(y);if(i===null){c.push(...Oo(y,e,`${s}-${b++}`));break}i.index>0&&c.push(...Oo(y.slice(0,i.index),e,`${s}-${b++}`));const a=`${s}-i${b++}`,{token:f}=i;switch(f.kind){case"code":{const _=l.code===void 0?null:l.code(f.text);c.push(_===null?o.jsx("code",{children:f.text},a):o.jsx("code",{className:"md-file-link",role:"link",tabIndex:0,title:_.folder?m("thread.openFolder",{path:f.text}):m("thread.openInFiles",{path:f.text}),onClick:_.open,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),_.open())},children:f.text},a));break}case"strong":c.push(o.jsx("strong",{children:Kr(f.text,e,a,l)},a));break;case"del":c.push(o.jsx("del",{children:Kr(f.text,e,a,l)},a));break;case"em":c.push(o.jsx("em",{children:Kr(f.text,e,a,l)},a));break;case"link":c.push(o.jsx("a",{href:f.href,target:"_blank",rel:"noreferrer noopener",children:Oo(f.label,e,a)},a));break;default:{const _=l.local===void 0?null:kS(f.text,l.local);if(_!==null){c.push(o.jsx("button",{className:"md-local-link",onClick:_.open,title:_.href,children:Oo(_.label,e,a)},a));break}c.push(o.jsx("span",{children:Oo(f.text,e,a)},a));break}}y=y.slice(i.index+i.length)}return c}function CS({code:t,language:e}){const[s,l]=N.useState(null),[c,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 xr(async()=>{const{highlightCode:f}=await import("./highlight-BdYEMg2B.js");return{highlightCode:f}},[]).then(({highlightCode:f})=>{a&&l(f(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:m(c?"common.copied":"common.copyCode"),"aria-label":m("common.copyCode"),children:c?"✓":"⧉"})]})]})}const pm=/^(#{1,6})\s+(.*)$/,Pu=/^\s{0,3}[-*+]\s+(.*)$/,Bo=/^\s{0,3}(\d{1,3})[.)]\s+(.*)$/,Ca=/^>\s?(.*)$/,Ou=/^\s*```(\S*)\s*$/,mm=/^\s*(-{3,}|\*{3,}|_{3,})\s*$/,Bu=/^\s*\|.*\|\s*$/,xS=/^\s*\|[\s:|-]+\|\s*$/;function gm(t){return t.trim().replace(/^\||\|$/g,"").split("|").map(e=>e.trim())}function Xd({text:t,needle:e="",localLink:s,codeLink:l}){var a,f;const c={local:s,code:l},y=t.split(`
134
- `),b=[];let i=0;for(;i<y.length;){const _=y[i]??"",d=`b${i}`,k=Ou.exec(_);if(k!==null){const w=(k[1]??"").length>0?k[1]:null,h=[];for(i+=1;i<y.length&&!Ou.test(y[i]??"");)h.push(y[i]??""),i+=1;i+=1,b.push({key:d,node:o.jsx(CS,{code:h.join(`
135
- `),language:w},d)});continue}if(_.trim().length===0){i+=1;continue}if(mm.test(_)){b.push({key:d,node:o.jsx("hr",{className:"md-rule"},d)}),i+=1;continue}const E=pm.exec(_);if(E!==null){const w=Math.min((E[1]??"#").length,6);b.push({key:d,node:o.jsx("p",{className:`md-heading md-h${w}`,children:Kr(E[2]??"",e,d,c)},d)}),i+=1;continue}if(Bu.test(_)&&xS.test(y[i+1]??"")){const w=gm(_);i+=2;const h=[];for(;i<y.length&&Bu.test(y[i]??"");)h.push(gm(y[i]??"")),i+=1;b.push({key:d,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((v,g)=>o.jsx("th",{children:Kr(v,e,`${d}-h${g}`,c)},g))})}),o.jsx("tbody",{children:h.map((v,g)=>o.jsx("tr",{children:v.map((p,S)=>o.jsx("td",{children:Kr(p,e,`${d}-${g}-${S}`,c)},S))},g))})]})},d)});continue}if(Ca.test(_)){const w=[];for(;i<y.length&&Ca.test(y[i]??"");)w.push(((a=Ca.exec(y[i]??""))==null?void 0:a[1])??""),i+=1;b.push({key:d,node:o.jsx("blockquote",{className:"md-quote",children:Kr(w.join(`
136
- `),e,d,c)},d)});continue}if(Pu.test(_)||Bo.test(_)){const w=Bo.test(_),h=w?Number(((f=Bo.exec(_))==null?void 0:f[1])??"1"):1,v=[];for(;i<y.length;){const p=y[i]??"",S=Pu.exec(p),j=Bo.exec(p);if(w&&j!==null)v.push(j[2]??"");else if(!w&&S!==null)v.push(S[1]??"");else if(v.length>0&&/^\s{2,}\S/.test(p)&&S===null&&j===null)v[v.length-1]=`${v[v.length-1]??""} ${p.trim()}`;else break;i+=1}const g=v.map((p,S)=>o.jsx("li",{children:Kr(p,e,`${d}-l${S}`,c)},S));b.push({key:d,node:w?o.jsx("ol",{className:"md-list",start:h===1?void 0:h,children:g},d):o.jsx("ul",{className:"md-list",children:g},d)});continue}const M=[];for(;i<y.length;){const w=y[i]??"";if(w.trim().length===0||Ou.test(w)||pm.test(w)||Pu.test(w)||Bo.test(w)||Ca.test(w)||mm.test(w)||Bu.test(w))break;M.push(w),i+=1}b.push({key:d,node:o.jsx("p",{className:"md-paragraph",children:Kr(M.join(`
137
- `),e,d,c)},d)})}return o.jsx("div",{className:"md",children:b.map(_=>_.node)})}const Vv=[{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 Fu(t){const e=Vv.find(s=>s.names.includes(t));return e===void 0?{key:`name:${t}`,known:!1}:{key:e.key,known:!0}}function SS(t,e,s){const l=Vv.find(c=>c.key===t);return l===void 0?m("tools.run.callsTo",{count:e,name:s}):m(l.run,{count:e})}const Gv=2e4,yd=new Map;function ES(t,e=Date.now()){yd.set(t,e)}function TS(t,e=Date.now()){const s=yd.get(t);return yd.delete(t),s!==void 0&&e-s<=Gv}const Hu={model:null,effort:null,contextWindow:null},LS=200,NS=2e4,RS={},MS={},vm=[],_m=[],AS=15e3,IS=2e4,jS=2e4;function kd(t,e,s){return`${t}:${s}:${e}`}function DS(t,e){const[s,l]=N.useState([]),[c,y]=N.useState(xu),[b,i]=N.useState(Hu),[a,f]=N.useState("waiting"),[_,d]=N.useState(!1),[k,E]=N.useState(!1),[M,w]=N.useState({}),[h,v]=N.useState(null),[g,p]=N.useState(null),[S,j]=N.useState(null),L=N.useRef(null),R=N.useRef(null),[x,T]=N.useState(null),[I,O]=N.useState(!1),[P,F]=N.useState(vm),[W,$]=N.useState(_m),[K,G]=N.useState(null),q=N.useRef(new Map),D=N.useRef(new Map),[U,H]=N.useState(!1),z=N.useRef(null),Z=N.useRef(null),[ie,ye]=N.useState(!1),_e=N.useRef(null),Q=N.useRef(null),[Y,ne]=N.useState(!1),ee=N.useRef(null),be=N.useCallback(()=>{ee.current!==null&&window.clearTimeout(ee.current),ee.current=null,ne(!1)},[]),me=N.useCallback(()=>{z.current=null,Z.current!==null&&window.clearTimeout(Z.current),Z.current=null,H(!1)},[]),Be=N.useCallback(()=>{_e.current=null,Q.current!==null&&window.clearTimeout(Q.current),Q.current=null,ye(!1)},[]),[ze,Qe]=N.useState({}),[dt,Ie]=N.useState({}),at=(e===null?void 0:ze[e])??RS,xt=(e===null?void 0:dt[e])??MS,oe=N.useRef(new Set),je=N.useRef(new Map),Ae=N.useRef(new Set),Le=N.useCallback((Ne,He,de)=>{Ie(lt=>({...lt,[Ne]:{...lt[Ne]??{},[He]:de}}))},[]),nt=N.useCallback(Ne=>{Ie(He=>{let de=!1;const lt={};for(const[fe,Ce]of Object.entries(He))if(Ne in Ce){const $e={...Ce};delete $e[Ne],lt[fe]=$e,de=!0}else lt[fe]=Ce;return de?lt:He})},[]),Fe=N.useCallback((Ne,He)=>{Ie(de=>{const lt=de[Ne];if(lt===void 0||!(He in lt))return de;const fe={...lt};return delete fe[He],{...de,[Ne]:fe}})},[]),Ke=N.useCallback((Ne,He,de)=>{const lt=je.current.get(He);lt!==void 0&&window.clearTimeout(lt);const fe=window.setTimeout(()=>{je.current.delete(He),!Ae.current.has(He)&&(de&&q.current.get(Ne)!==He||(Qe(Ce=>{const $e=Ce[Ne];if($e===void 0||!(He in $e))return Ce;const rt={...$e};return delete rt[He],{...Ce,[Ne]:rt}}),Le(Ne,He,m("conversation.answerUnconfirmed"))))},NS);je.current.set(He,fe)},[Le]);N.useEffect(()=>{for(const Ne of s)for(const He of Ne.parts){if(He.kind!=="tool-result")continue;Ae.current.add(He.toolUseId);const de=je.current.get(He.toolUseId);de!==void 0&&(window.clearTimeout(de),je.current.delete(He.toolUseId)),nt(He.toolUseId)}},[s,nt]),N.useEffect(()=>{if(!(e===null||D.current.size===0))for(const{liveId:Ne,toolUseId:He,selections:de,failure:lt}of lS(s,D.current,e))D.current.delete(Ne),de!==null&&(Qe(fe=>{const Ce=fe[e]??{};return He in Ce?fe:{...fe,[e]:{...Ce,[He]:de}}}),Ae.current.has(He)||Ke(e,He,!1)),lt!==null&&Le(e,He,lt)},[s,e,Ke,Le]),N.useEffect(()=>{const Ne=je.current;return()=>{for(const He of Ne.values())window.clearTimeout(He);Ne.clear()}},[]);const mt=N.useRef(null);N.useEffect(()=>{if(e===null){l([]),y(xu),i(Hu),p(null),L.current=null,j(null),R.current!==null&&window.clearTimeout(R.current),R.current=null,f("waiting"),d(!1),mt.current=null;return}l([]),y(xu),i(Hu),f("waiting"),d(!1),E(!1),w({}),v(null),p(null),L.current=null,j(null),R.current!==null&&window.clearTimeout(R.current),R.current=null,T(null),O(!1),F(vm),$(_m),G(null),me(),Be(),oe.current.clear(),mt.current=null;const Ne=t.onMessage(de=>{var lt,fe,Ce,$e;if(de.type==="conversation.reset"||de.type==="conversation.liveQuestion"){const rt=de.type==="conversation.reset"?de.liveQuestion:de.question;rt===null?q.current.delete(de.terminalId):q.current.set(de.terminalId,rt.toolUseId)}switch(de.type){case"conversation.reset":if(de.terminalId!==e)break;G(de.liveQuestion),l(de.events),y(de.usage),i(de.defaults),v(de.permissionMode),p(de.codexPermissions),id(de.codexPermissions)===((lt=L.current)==null?void 0:lt.preset)&&(L.current=null,j(null),R.current!==null&&window.clearTimeout(R.current),R.current=null),T(de.waitingFor),O(de.openToolCall),F(de.subagents),$(de.queue),f(de.state),d(de.hasMore),E(!1),mt.current=((fe=de.events[0])==null?void 0:fe.eventId)??null;break;case"conversation.defaults":if(de.terminalId!==e)break;i(de.defaults);break;case"conversation.codexPermissions":if(de.terminalId!==e)break;p(de.state),id(de.state)===((Ce=L.current)==null?void 0:Ce.preset)&&(L.current=null,j(null),R.current!==null&&window.clearTimeout(R.current),R.current=null);break;case"agent.codexPermissions.result":{if(de.terminalId!==e||(($e=L.current)==null?void 0:$e.requestId)!==de.requestId)break;const rt=L.current;if(rt===null)break;const ke=de.status==="written"?{...rt,status:"awaiting"}:{...rt,status:"blocked",...de.reason===void 0?{}:{reason:de.reason}};L.current=ke,j(ke),de.status!=="written"&&R.current!==null&&(window.clearTimeout(R.current),R.current=null);break}case"conversation.append":{if(de.terminalId!==e)break;l(rt=>{var we;const ke=new Set(rt.map(Ue=>Ue.eventId)),gt=de.events.filter(Ue=>!ke.has(Ue.eventId));return gt.length===0?rt:(mt.current===null&&(mt.current=((we=gt[0])==null?void 0:we.eventId)??null),[...rt,...gt])}),y(de.usage),de.permissionMode!==null&&v(de.permissionMode),de.queue!==void 0&&$(de.queue),f("live");break}case"conversation.page":{if(de.terminalId!==e)break;l(rt=>{var we;const ke=new Set(rt.map(Ue=>Ue.eventId)),gt=de.events.filter(Ue=>!ke.has(Ue.eventId));return gt.length===0?rt:(mt.current=((we=gt[0])==null?void 0:we.eventId)??mt.current,[...gt,...rt])}),d(de.hasMore),E(!1);break}case"conversation.turns":{if(de.terminalId!==e)break;const rt=new Map(de.turns.map(ke=>[ke.eventId,ke.durationMs]));l(ke=>ke.map(gt=>{const we=rt.get(gt.eventId);return we===void 0?gt:{...gt,durationMs:we}}));break}case"conversation.parts":{if(de.terminalId!==e)break;const rt=new Map(de.updates.map(ke=>[ke.eventId,ke.parts]));l(ke=>ke.map(gt=>{const we=rt.get(gt.eventId);return we===void 0?gt:{...gt,parts:we}}));break}case"conversation.imageData":{if(de.terminalId!==e)break;const rt=kd(de.eventId,de.index,de.source);w(ke=>({...ke,[rt]:de.data===null?null:`data:${de.mediaType};base64,${de.data}`}));break}case"conversation.state":if(de.terminalId!==e)break;f(de.state);break;case"conversation.mode":if(de.terminalId!==e)break;v(de.mode);break;case"conversation.waiting":if(de.terminalId!==e)break;T(de.waitingFor);break;case"conversation.toolCall":if(de.terminalId!==e)break;O(de.open);break;case"conversation.subagents":if(de.terminalId!==e)break;F(de.subagents);break;case"conversation.queue":if(de.terminalId!==e)break;$(de.queue);break;case"conversation.liveQuestion":if(de.terminalId!==e)break;G(de.question);break;case"agent.forceSent":de.requestId===z.current&&!de.sent&&me();break;case"agent.queueEdited":de.requestId===_e.current&&Be();break;case"error":{if(de.requestId!==void 0&&de.requestId===z.current){me();break}if(de.requestId!==void 0&&de.requestId===_e.current){Be();break}if(de.code!=="answer-failed"||e===null)break;const rt=Mt(de.text);for(const[ke,gt]of je.current){window.clearTimeout(gt),je.current.delete(ke),Qe(Ue=>{const se=Ue[e];if(se===void 0||!(ke in se))return Ue;const te={...se};return delete te[ke],{...Ue,[e]:te}}),Le(e,ke,rt);const we=D.current.get(ke);we!==void 0&&D.current.set(ke,{...we,selections:null,failure:rt})}break}}});t.send({type:"conversation.subscribe",terminalId:e});const He=t.onReopen(()=>{t.send({type:"conversation.subscribe",terminalId:e})});return()=>{Ne(),He(),t.send({type:"conversation.unsubscribe",terminalId:e}),R.current!==null&&window.clearTimeout(R.current),R.current=null}},[t,e,Le,me,Be]),N.useEffect(()=>{U&&W.every(Ne=>Ne.sent===!0||Ne.forced===!0)&&me()},[U,W,me]),N.useEffect(()=>{Y&&!W.some(Ne=>Ne.sent===!0)&&be()},[Y,W,be]),N.useEffect(()=>()=>{Z.current!==null&&window.clearTimeout(Z.current),Q.current!==null&&window.clearTimeout(Q.current),ee.current!==null&&window.clearTimeout(ee.current)},[]);const _t=N.useCallback(()=>{if(e===null||z.current!==null)return;const Ne=crypto.randomUUID();z.current=Ne,H(!0),Z.current!==null&&window.clearTimeout(Z.current),Z.current=window.setTimeout(me,AS),t.send({type:"agent.forceSend",terminalId:e,requestId:Ne})},[t,e,me]),Et=N.useCallback(()=>{if(e===null||_e.current!==null)return;const Ne=crypto.randomUUID();_e.current=Ne,ye(!0),Q.current!==null&&window.clearTimeout(Q.current),Q.current=window.setTimeout(Be,IS),t.send({type:"agent.editQueue",terminalId:e,requestId:Ne})},[t,e,Be]),ft=N.useCallback(()=>{e===null||Y||(ne(!0),ee.current!==null&&window.clearTimeout(ee.current),ee.current=window.setTimeout(be,Gv),ES(e),t.send({type:"agent.interrupt",terminalId:e}))},[t,e,Y,be]),ct=N.useCallback(()=>{const Ne=mt.current;e===null||Ne===null||k||(E(!0),t.send({type:"conversation.loadMore",terminalId:e,beforeEventId:Ne,limit:LS}))},[t,e,k]),Ge=N.useCallback((Ne,He,de)=>{if(e===null)return;const lt=kd(Ne,He,de);oe.current.has(lt)||(oe.current.add(lt),t.send({type:"conversation.image",terminalId:e,eventId:Ne,index:He,source:de}))},[t,e]),yt=N.useCallback((Ne,He)=>{if(e===null)return;Qe(lt=>{const fe=lt[e]??{};return Ne in fe?lt:{...lt,[e]:{...fe,[Ne]:He}}}),Fe(e,Ne);const de=(K==null?void 0:K.toolUseId)===Ne?K.questions[0]:void 0;de!==void 0&&D.current.set(Ne,{terminalId:e,item:de,selections:He,failure:null}),t.send({type:"agent.answer",terminalId:e,toolUseId:Ne,selections:He}),Ke(e,Ne,de!==void 0)},[t,e,Fe,K,Ke]),Bt=N.useCallback(Ne=>{e!==null&&t.send({type:"agent.mode",terminalId:e,mode:Ne})},[t,e]),Wt=N.useCallback(Ne=>{var lt,fe;if(e===null||((lt=L.current)==null?void 0:lt.status)==="writing"||((fe=L.current)==null?void 0:fe.status)==="awaiting")return;const He=crypto.randomUUID(),de={requestId:He,preset:Ne,status:"writing"};L.current=de,j(de),R.current!==null&&window.clearTimeout(R.current),R.current=window.setTimeout(()=>{const Ce=L.current;if((Ce==null?void 0:Ce.requestId)!==He||Ce.status==="blocked")return;const $e={...Ce,status:"unconfirmed"};L.current=$e,j($e),R.current=null},jS),t.send({type:"agent.codexPermissions",terminalId:e,requestId:He,preset:Ne})},[t,e]);return{events:s,usage:c,defaults:b,state:a,permissionMode:h,codexPermissions:g,codexPermissionRequest:S,waitingFor:x,openToolCall:I,subagents:P,queue:W,forceSend:_t,forcing:U,editQueue:Et,editingQueue:ie,editSent:ft,editingSent:Y,hasMore:_,loadingMore:k,loadMore:ct,images:M,requestImage:Ge,answer:yt,answered:at,answerFailed:xt,setPermissionMode:Bt,requestCodexPermissions:Wt,liveQuestion:K}}function PS(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 OS=new Set(["Write","Edit","MultiEdit","NotebookEdit"]);function BS(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 FS(t,e){const s=y=>y.replace(/\\/g,"/").replace(/\/+$/,""),l=s(t),c=s(e);return l.length>0&&c.toLowerCase().startsWith(`${l.toLowerCase()}/`)?e.slice(l.length+1):e}function HS(t,e,s){const l=t.findIndex(y=>y.eventId===e);if(l===-1)return[];const c=[];for(const y of t.slice(l))for(const b of y.parts){if(b.kind!=="tool-call"||!OS.has(b.name))continue;const i=BS(b.input);if(i===null)continue;const a=FS(s,i);c.includes(a)||c.push(a)}return c}function US(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 WS(){return o.jsxs("svg",{className:"archive-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.5",cy:"10.5",r:"6"}),o.jsx("path",{d:"M15 15l5 5"})]})}function Uu(t){return t.scrollHeight-t.scrollTop-t.clientHeight>jv}const wm=5;function xa(t){return!Array.isArray(t)}function bm(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 $S(t){const e=[];let s=0;for(;s<t.length;){const l=t[s];if(l===void 0)break;const c=bm(l),y=c===null?null:Fu(c[0]??"");if(!(c!==null&&y!==null&&c.every(_=>Fu(_).key===y.key))||c===null||y===null){e.push({kind:"card",card:l}),s+=1;continue}const i=[l];let a=c.length,f=s+1;for(;f<t.length;){const _=t[f];if(_===void 0)break;const d=bm(_);if(d===null||!d.every(k=>Fu(k).key===y.key))break;i.push(_),a+=d.length,f+=1}if(a<2){e.push({kind:"card",card:l}),s+=1;continue}e.push({kind:"tools",id:`tools-${l.event.eventId}`,summary:SS(y.key,a,c[0]??""),at:l.event.at,cards:i}),s=f}return e}function zS(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 Bv(t);case"thinking":case"image":return""}}function ym(t,e){const s=[];for(const l of t.parts)if(s.push(zS(l)),l.kind==="tool-call"){const c=e.get(l.toolUseId);c!==void 0&&s.push(c.text)}return s.join(`
142
- `)}function Cs(t,e){if(e.length===0)return o.jsx(o.Fragment,{children:t});const s=t.toLowerCase(),l=e.toLowerCase(),c=[];let y=0,b=s.indexOf(l),i=0;for(;b!==-1;)b>y&&c.push(o.jsx("span",{children:t.slice(y,b)},i++)),c.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&&c.push(o.jsx("span",{children:t.slice(y)},i++)),o.jsx(o.Fragment,{children:c})}function Yv(t,e){const s=[];let l=t,c=0;for(;l.length>0;){const y=wS(l);if(y===null){s.push(o.jsx("span",{children:Cs(l,e)},c++));break}y.index>0&&s.push(o.jsx("span",{children:Cs(l.slice(0,y.index),e)},c++)),s.push(o.jsx("a",{href:y.href,target:"_blank",rel:"noreferrer noopener",children:Cs(y.href,e)},c++)),l=l.slice(y.index+y.length)}return o.jsx(o.Fragment,{children:s})}const Xv=N.createContext(null);function qS({view:t,terminalId:e,onRewind:s,rewindBlocked:l=!1,questionsAnswerable:c,contextWindowSource:y,instructionsFile:b,onGoToCli:i,cliPresence:a,cliLaunchedAt:f,exitCode:_,onWakeCli:d,waking:k,discovering:E=!1,toolCallNotice:M=null,serverClosed:w=null,statusLineState:h=null,onConfigureStatusLine:v,threadFont:g,threadTools:p,continueTargets:S=[],continueBlockedReason:j=null,onContinue:L,onMoveToBranch:R,searchRequest:x=null,onSearchRequestApplied:T,activity:I=null,receipt:O=null,clock:P=null,takeNotice:F,fileLinks:W=null,forceSendAvailable:$=!1,queueEditAvailable:K=!1,planWindows:G=[],planSetupState:q=null,onConfigurePlanLimits:D,compactAction:U=null,scheduled:H=eE,onCancelScheduled:z,onSendScheduledNow:Z}){const{events:ie,usage:ye,defaults:_e,state:Q,waitingFor:Y,subagents:ne,queue:ee,forceSend:be,forcing:me,editQueue:Be,editingQueue:ze,editSent:Qe,editingSent:dt,hasMore:Ie,loadingMore:at,loadMore:xt,images:oe,requestImage:je,answer:Ae,answered:Le,answerFailed:nt,liveQuestion:Fe}=t,Ke=Zo(),[mt,_t]=N.useState(""),[Et,ft]=N.useState(0),[ct,Ge]=N.useState(null),yt=(p==null?void 0:p.open)??!0,Bt=p==null?void 0:p.setOpen,Wt=()=>{Bt!==void 0&&(yt&&_t(""),Bt(!yt))};N.useEffect(()=>{x!==null&&(_t(x.query),Bt==null||Bt(!0),T==null||T(x.seq))},[x,T,Bt]);const Ne=N.useRef(null),He=N.useRef(new Map),de=N.useRef(!0),[lt,fe]=N.useState(!1),[Ce,$e]=N.useState(0),rt=N.useRef(e),ke=N.useRef(new Map),gt=N.useRef(null),we=N.useRef(F);we.current=F;const[Ue,se]=N.useState(!1),te=N.useRef(null),[ve,st]=N.useState(!1),[We,De]=N.useState(!1),Je=N.useRef(null),Dt=N.useMemo(()=>new Set(ee.flatMap(pe=>pe.eventId===void 0?[]:[pe.eventId])),[ee]),Yt=N.useMemo(()=>Dt.size===0?ie:ie.filter(pe=>!Dt.has(pe.eventId)),[ie,Dt]),Zn=N.useMemo(()=>X1(Yt),[Yt]),{cards:Jt,results:er}=N.useMemo(()=>{const pe=new Map,Pe=new Set;for(const wt of Yt)for(const pt of wt.parts)pt.kind==="tool-result"?pe.set(pt.toolUseId,pt):(pt.kind==="tool-call"||pt.kind==="question")&&Pe.add(pt.toolUseId);const ut=[];for(const wt of Yt){const pt=wt.parts.filter(sn=>sn.kind!=="thinking"&&!(sn.kind==="tool-result"&&Pe.has(sn.toolUseId)));pt.length!==0&&ut.push({event:wt,parts:pt})}return{cards:ut,results:pe}},[Yt]),Vr=N.useRef([]);Vr.current=N.useMemo(()=>Jt.map(pe=>pe.event.eventId),[Jt]);const Rn=N.useCallback(pe=>{const Pe=pe.getBoundingClientRect().top;return ut=>{const wt=He.current.get(ut);if(wt===void 0)return null;const pt=wt.getBoundingClientRect();return pt.height<=0?null:{top:pt.top-Pe,bottom:pt.bottom-Pe}}},[]),Zs=N.useMemo(()=>$S(Jt),[Jt,Ke]),$t=mt.trim(),en=N.useMemo(()=>{if($t.length===0)return[];const pe=$t.toLowerCase();return Jt.filter(Pe=>ym(Pe,er).toLowerCase().includes(pe)).map(Pe=>Pe.event.eventId)},[Jt,er,$t,Ke]);N.useEffect(()=>{ft(0)},[$t]);const ei=N.useMemo(()=>new Set(en),[en]),hr=en[Et]??null;N.useEffect(()=>{var pe;hr!==null&&((pe=He.current.get(hr))==null||pe.scrollIntoView({block:"center"}))},[hr]);const Gr=N.useMemo(()=>({questionCards:c,cliOpen:a==="live",launchedAt:f}),[c,a,f]);N.useLayoutEffect(()=>{var ut,wt;const pe=rt.current;rt.current=e;const Pe=Ne.current;if(pe!==null&&pe!==e){if(gt.current===null){const pt=Pe===null||de.current?null:tS(Vr.current,Rn(Pe));pt===null?ke.current.delete(pe):ke.current.set(pe,pt)}(ut=we.current)==null||ut.call(we,pe)}e!==null&&pe!==e&&((wt=we.current)==null?void 0:wt.call(we,e))===!0&&ke.current.delete(e),gt.current=e===null?null:ke.current.get(e)??null,de.current=!0,fe(!1),$e(0),Je.current=null,De(!1),st(!1),se(!1)},[e,Rn]),N.useEffect(()=>()=>{te.current!==null&&window.clearTimeout(te.current)},[]);const $n=N.useCallback(()=>{const pe=Ne.current;if(pe===null)return;const Pe=Uu(pe);fe(Pe),Pe||$e(0)},[]),fr=N.useCallback(pe=>{const Pe=pe.getBoundingClientRect().top,ut=pt=>{const sn=Zn[pt],gr=sn===void 0?void 0:He.current.get(sn);return gr===void 0?null:gr.getBoundingClientRect().top-Pe},wt=Q1(Zn.length,ut);return wt===null?null:ut(wt)},[Zn]),Lr=N.useCallback(()=>{const pe=Ne.current;pe!==null&&st(J1({awayFromEnd:Uu(pe),ownAbove:fr(pe)!==null,hasMore:Ie}))},[fr,Ie]),At=N.useRef(null),Nr=N.useRef(0),tr=N.useRef(0);N.useLayoutEffect(()=>{const pe=At.current,Pe=ie.map(wt=>wt.eventId);At.current=Pe[0]??null;const ut=Ne.current;ut===null||!V1(pe,Pe)||(ut.scrollTop=K1(Nr.current,ut.scrollHeight))},[ie]),N.useLayoutEffect(()=>{const pe=Ne.current,Pe=gt.current;if(pe!==null&&Pe!==null&&Jt.length>0){gt.current=null;const ut=Vr.current,wt=$t.length>0?null:nS(Pe,ut,Rn(pe),pe.scrollTop);wt!==null&&(pe.scrollTop=wt,de.current=!Uu(pe),de.current||($e(rS(ut,Pe.lastId)),se(!0),te.current!==null&&window.clearTimeout(te.current),te.current=window.setTimeout(()=>{te.current=null,se(!1)},Av)))}pe!==null&&de.current&&$t.length===0&&(pe.scrollTop=pe.scrollHeight),$n()},[Jt,ee.length,Fe==null?void 0:Fe.toolUseId,H.length,$t,$n,Rn]);const pr=N.useCallback(()=>{const pe=Ne.current;pe===null||!de.current||$t.length>0||(pe.scrollTop=pe.scrollHeight,$n())},[$t,$n]);N.useEffect(()=>{const pe=Ne.current;if(pe===null)return;pe.addEventListener("load",pr,!0);const Pe=typeof ResizeObserver>"u"?null:new ResizeObserver(pr);return Pe==null||Pe.observe(pe),()=>{pe.removeEventListener("load",pr,!0),Pe==null||Pe.disconnect()}},[pr]),N.useLayoutEffect(()=>{const pe=Je.current,Pe=Ne.current;if(pe===null||Pe===null)return;const ut=fr(Pe),wt=Z1({found:ut!==null,hasMore:Ie,loading:at,pagesRequested:pe.pages});if(wt!=="wait"){if(wt==="load"){pe.pages+=1,xt();return}Je.current=null,De(!1),ut!==null&&(de.current=!1,Pe.scrollTop=hm(Pe.scrollTop,ut))}},[Jt,Ie,at,We,fr,xt]),N.useLayoutEffect(()=>{Lr()},[Jt,Lr]);const Rr=N.useRef(null),ti=N.useRef(null),Mr=N.useRef(new Map),nr=N.useCallback(()=>{const pe=new Map;for(const Pe of[Rr.current,ti.current]){if(Pe===null)continue;const ut=Pe.getBoundingClientRect();for(const wt of[ut.top+1,(ut.top+ut.bottom)/2,ut.bottom-1]){const pt=document.elementsFromPoint(ut.left+1,wt).map(rr=>rr.closest(".turn")).find(rr=>rr!==null),sn=(pt==null?void 0:pt.querySelector(":scope > .turn-actions"))??null;if(pt==null||sn===null)continue;const gr=oS(pt.getBoundingClientRect(),sn.getBoundingClientRect(),ut);gr>0&&pe.set(pt,Math.max(pe.get(pt)??0,gr))}}for(const Pe of Mr.current.keys())pe.has(Pe)||Pe.style.removeProperty("--turn-actions-shift");for(const[Pe,ut]of pe)Mr.current.get(Pe)!==ut&&Pe.style.setProperty("--turn-actions-shift",`${ut}px`);Mr.current=pe},[]);N.useLayoutEffect(()=>{const pe=Ne.current;pe!==null&&(Nr.current=pe.scrollHeight-pe.scrollTop,tr.current=pe.scrollTop,nr())});const Cn=N.useRef(null),Yr=N.useCallback(()=>{var Pe;const pe=((Pe=ie[0])==null?void 0:Pe.eventId)??null;pe===null||Cn.current===pe||(Cn.current=pe,xt())},[ie,xt]),pn=N.useRef(null);N.useEffect(()=>{var wt;const pe=((wt=Jt[Jt.length-1])==null?void 0:wt.event.eventId)??null,Pe=pn.current;if(pn.current=pe,Pe===null||pe===Pe||de.current&&$t.length===0)return;const ut=Jt.findIndex(pt=>pt.event.eventId===Pe);ut!==-1&&$e(pt=>pt+(Jt.length-1-ut))},[Jt,$t]);const $i=N.useCallback(()=>{const pe=Ne.current;if(pe===null)return;de.current=sS({wasAtEnd:de.current,distanceFromEnd:pe.scrollHeight-pe.scrollTop-pe.clientHeight,scrollTop:pe.scrollTop,previousScrollTop:tr.current}),$n(),Lr(),nr();const Pe=z1({scrollTop:pe.scrollTop,previousScrollTop:tr.current,clientHeight:pe.clientHeight,hasMore:Ie,loading:at,searching:$t.length>0});tr.current=pe.scrollTop,Nr.current=pe.scrollHeight-pe.scrollTop,Pe&&Yr()},[$n,Lr,nr,Ie,at,Yr,$t]),Ss=N.useCallback(pe=>{const Pe=Ne.current;Pe===null||!Ie||at||$t.length>0||q1(pe.deltaY,Pe.scrollTop,Pe.clientHeight)&&Yr()},[Ie,at,Yr,$t]),Xr=N.useCallback(()=>{const pe=Ne.current;pe!==null&&(pe.scrollTop=pe.scrollHeight,de.current=!0,fe(!1),$e(0),Je.current=null,De(!1),st(!1))},[]),Bn=N.useCallback(()=>{const pe=Ne.current;if(pe===null)return;const Pe=fr(pe);if(Pe!==null){de.current=!1,pe.scrollTop=hm(pe.scrollTop,Pe);return}Je.current===null&&(Je.current={pages:0},De(!0))},[fr]),mr=N.useCallback((pe,Pe)=>{Pe===null?He.current.delete(pe):He.current.set(pe,Pe)},[]),xn=N.useCallback(pe=>{const Pe=ym(pe,er);navigator.clipboard.writeText(Pe).then(()=>{Ge(pe.event.eventId),window.setTimeout(()=>Ge(null),1200)}).catch(()=>Ge(null))},[er,Ke]),zn=pe=>{en.length!==0&&ft(Pe=>(Pe+pe+en.length)%en.length)};return o.jsx(Xv.Provider,{value:W,children:o.jsxs("div",{className:"conversation-pane",children:[o.jsxs("div",{className:`conversation-search${yt?"":" thread-tools-closed"}`,children:[p!==void 0&&o.jsxs("button",{className:"icon-button thread-tools-toggle",onClick:Wt,"aria-expanded":yt,title:m(yt?"thread.tools.hide":"thread.tools.show"),"aria-label":m(yt?"thread.tools.hide":"thread.tools.show"),children:[o.jsx(WS,{}),o.jsx("span",{className:"thread-tools-chevron","aria-hidden":"true",children:"▾"})]}),yt&&o.jsx("input",{className:"conversation-search-input",type:"search",placeholder:m("thread.search.placeholder"),value:mt,onChange:pe=>_t(pe.target.value),onKeyDown:pe=>{pe.key==="Enter"&&zn(pe.shiftKey?-1:1),pe.stopPropagation()},spellCheck:!1}),yt&&$t.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:en.length===0?m("thread.search.none"):`${Et+1}/${en.length}`}),o.jsx("button",{className:"icon-button",onClick:()=>zn(-1),disabled:en.length===0,title:m("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>zn(1),disabled:en.length===0,title:m("thread.search.next"),children:"↓"})]}),o.jsx("span",{className:"conversation-spacer"}),yt&&L!==void 0&&o.jsx(Ov,{targets:S,className:"icon-button conversation-continue",text:o.jsxs(o.Fragment,{children:[o.jsx(aS,{}),o.jsx("span",{children:m("thread.continueCli")})]}),label:$d(),blockedReason:j,onPick:L}),yt&&R!==void 0&&o.jsxs("button",{className:"icon-button conversation-continue",onClick:R,title:m("worktree.move.title"),"aria-label":m("worktree.move.title"),children:[o.jsx(Gd,{}),o.jsx("span",{children:m("thread.moveBranch")})]}),yt&&g!==void 0&&o.jsx("button",{className:"icon-button thread-font-button",onClick:g.cycle,title:Pa(g.size),"aria-label":Pa(g.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(I1,{windows:G,setupState:q,onConfigure:D}),o.jsx(k1,{usage:ye,source:y,instructionsFile:b,fallbackWindow:_e.contextWindow,compact:!0,statusLineState:h,onConfigure:v,compactAction:U})]})]}),o.jsxs("div",{className:"conversation-scroll-frame",children:[o.jsxs("div",{className:"conversation-scroll",ref:Ne,onScroll:$i,onWheel:Ss,children:[Ie&&o.jsxs("button",{className:`conversation-more${at?" conversation-more-loading":""}`,onClick:xt,disabled:at,"aria-busy":at,children:[at&&o.jsx("span",{className:"conversation-more-spinner","aria-hidden":"true"}),m(at?"thread.loadingMore":"thread.loadEarlier")]}),Jt.length===0&&o.jsxs("p",{className:"conversation-empty",children:[Q==="unavailable"?m("thread.empty.unavailable"):Q==="no-transcript"?Jk():m(Q==="waiting"?"thread.empty.waiting":"thread.empty.noMessages"),Q==="waiting"&&E&&o.jsxs(o.Fragment,{children:[o.jsx("br",{}),Zk()]})]}),Zs.map(pe=>{if(pe.kind==="card")return o.jsx(km,{card:pe.card,results:er,needle:$t,isMatch:pe.card.event.eventId===hr,copied:ct===pe.card.event.eventId,images:oe,onRequestImage:je,onCopy:()=>xn(pe.card),onRewind:s,rewindBlocked:l,register:mr,answered:Le,answerFailed:nt,questionTab:Gr,onAnswer:Ae},pe.card.event.eventId);const Pe=pe.cards.some(ut=>ei.has(ut.event.eventId));return o.jsx(rE,{summary:pe.summary,at:pe.at,open:Pe,children:pe.cards.map(ut=>o.jsx(km,{card:ut,results:er,needle:$t,isMatch:ut.event.eventId===hr,copied:ct===ut.event.eventId,images:oe,onRequestImage:je,onCopy:()=>xn(ut),onRewind:s,rewindBlocked:l,register:mr,answered:Le,answerFailed:nt,questionTab:Gr,onAnswer:Ae},ut.event.eventId))},pe.id)}),a==="live"&&Fe!==null&&o.jsx("article",{className:"turn turn-assistant turn-live-question",children:o.jsx(Qv,{part:Fe,answeredAt:Le[Fe.toolUseId]??null,failure:nt[Fe.toolUseId]??null,lock:Dv(Gr,null),onAnswer:Ae,needle:$t})}),a==="live"&&ee.length>0&&o.jsx(ZS,{queue:ee,canForce:$&&ee.some(pe=>pe.sent!==!0&&pe.forced!==!0),forceBlocked:Y!==null,forcing:me,onForce:be,canEdit:K&&ee.every(pe=>pe.sent===!0||pe.forced!==!0),editing:ze,onEdit:Be,editingSent:dt,onEditSent:Qe}),H.length>0&&o.jsx(nE,{messages:H,onCancel:z,onSendNow:Z})]}),lt&&(ve||We)&&o.jsx("button",{ref:Rr,className:`conversation-jump conversation-jump-own${We?" is-seeking":""}`,onClick:Bn,disabled:We,"aria-busy":We,title:m("thread.jumpToOwn"),"aria-label":m("thread.jumpToOwn"),children:o.jsx("span",{"aria-hidden":"true",children:"↑"})}),lt&&o.jsxs("button",{ref:ti,className:`conversation-jump${Ce>0?" has-unseen":""}${Ue?" is-hinting":""}`,onClick:Xr,title:Ce>0?m("thread.jumpToEndNew",{count:Ce}):m("thread.jumpToEnd"),"aria-label":Ce>0?m("thread.jumpToEndNew",{count:Ce}):m("thread.jumpToEnd"),children:[o.jsx("span",{"aria-hidden":"true",children:"↓"}),Ce>0&&o.jsx("span",{className:"conversation-jump-count",children:Ce>99?"99+":Ce}),Ue&&o.jsx("span",{className:"conversation-jump-tip","aria-hidden":"true",children:Ce>0?m("thread.jumpToEndNew",{count:Ce}):m("thread.jumpToEnd")})]})]}),o.jsx(VS,{live:a==="live"&&w===null,activity:I,waitingFor:Y,receipt:O,events:ie,clock:P,subagents:ne}),w!==null&&(w.state==="relaunching"||a==="live")?o.jsx(XS,{text:w.text,relaunching:w.state==="relaunching",onRelaunch:d}):a==="live"?Y===null&&M!==null?o.jsx(JS,{notice:M,onGoToCli:i}):o.jsx(QS,{waitingFor:Y,questionsAnswerable:c,liveQuestion:Fe!==null,onGoToCli:i}):o.jsx(YS,{presence:a,exitCode:_,waking:k,onWake:d})]})})}const KS=1e3;function VS({live:t,activity:e,waitingFor:s,receipt:l,events:c,clock:y,subagents:b}){const[,i]=N.useState(0),a=Date.now(),f=Nx({live:t,activity:e,waitingFor:s,receipt:l,events:c,clock:y,now:a}),_=t?b:[],d=f!==null||_.length>0;return N.useEffect(()=>{if(!d)return;const k=window.setInterval(()=>i(E=>E+1),KS);return()=>window.clearInterval(k)},[d]),d?o.jsxs("div",{className:"thread-status",children:[f!==null&&o.jsxs("div",{className:`thread-status-row thread-status-${f.kind}`,children:[o.jsx(GS,{kind:f.kind}),o.jsx("span",{className:"thread-status-text",children:Rx(f,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:Mx(_,a)})]})]}):null}function GS({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 YS({presence:t,exitCode:e,waking:s,onWake:l}){const c=t==="sleeping"?m("thread.wake.sleeping"):e===null?m("thread.wake.exited"):m("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:c}),o.jsx("button",{className:"primary-button primary-button-small",onClick:l,disabled:s,children:m(s?"thread.wake.opening":"thread.wake.open")})]})}function XS({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?sC():rC()})]})}function QS({waitingFor:t,questionsAnswerable:e,liveQuestion:s,onGoToCli:l}){if(t===null)return null;const c=s&&e?m("agent.waiting.question"):sv(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:c}),o.jsx("button",{className:"link-button",onClick:l,children:m("thread.goToCli")})]})}function JS({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:m("thread.goToCli")})]})}function km({card:t,results:e,needle:s,isMatch:l,copied:c,images:y,onRequestImage:b,onCopy:i,onRewind:a,rewindBlocked:f=!1,register:_,answered:d,answerFailed:k,questionTab:E,onAnswer:M}){const{event:w}=t,h=w.role==="user",v=Dv(E,w.at),g=p=>{const S=d[p.toolUseId];return S!==void 0?S:e.has(p.toolUseId)?[]:null};return o.jsxs("article",{ref:p=>_(w.eventId,p),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:m("thread.copyMessage"),children:c?"✓":"⧉"}),h&&a!==void 0&&PS(w)&&o.jsx("button",{className:"icon-button",onClick:()=>a(w.eventId),disabled:f,title:m(f?"thread.rewindBusy":"thread.rewind"),children:"↩"})]}),t.parts.map((p,S)=>o.jsx(iE,{part:p,eventId:w.eventId,mine:h,result:p.kind==="tool-call"?e.get(p.toolUseId)??null:null,needle:s,images:y,onRequestImage:b,answeredAt:p.kind==="question"?g(p):null,failure:p.kind==="question"?k[p.toolUseId]??null:null,questionLock:v,onAnswer:M},S)),o.jsx(sE,{event:w,mine:h})]})}function ZS({queue:t,canForce:e,forceBlocked:s,forcing:l,onForce:c,canEdit:y,editing:b,onEdit:i,editingSent:a,onEditSent:f}){const _=d=>d.sent===!0?{label:m("thread.queue.sent"),title:m("thread.queue.sentTitle")}:d.forced===!0?{label:m("thread.queue.forced"),title:m("thread.queue.forcedTitle")}:{label:m("thread.queue.label"),title:m("thread.queue.labelTitle")};return o.jsxs("div",{className:"queued-prompts",children:[t.map(d=>o.jsxs("article",{className:`turn turn-user turn-pending${d.forced===!0?" turn-pending-forced":""}`,children:[d.text.length>0&&o.jsx(Qd,{text:d.text,truncated:d.truncated,needle:""}),d.images>0&&o.jsx("div",{className:"turn-pending-images",children:m("thread.queue.images",{count:d.images})}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:m("thread.turn.you")}),d.at>0&&o.jsx("span",{children:Fi(d.at)}),o.jsx("span",{className:"turn-pending-state",title:_(d).title,children:_(d).label}),d.sent===!0&&d.editable===!0&&o.jsx("button",{className:"queued-edit",onClick:f,disabled:a||s,"aria-busy":a,title:m(s?"thread.queue.forceBlocked":"thread.queue.editSentTitle"),children:m(a?"thread.queue.editing":"thread.queue.edit")}),d.sent!==!0&&y&&o.jsx("button",{className:"queued-edit",onClick:i,disabled:b||l||s,"aria-busy":b,title:s?m("thread.queue.forceBlocked"):m("thread.queue.editTitle",{count:t.filter(k=>k.sent!==!0).length}),children:m(b?"thread.queue.editing":"thread.queue.edit")})]})]},d.id)),e&&o.jsx("div",{className:"queued-prompts-actions",children:o.jsx("button",{className:"queued-force",onClick:c,disabled:l||s||b,"aria-busy":l,title:m(s?"thread.queue.forceBlocked":"thread.queue.forceSendTitle"),children:m(l?"thread.queue.forcing":"thread.queue.forceSend")})})]})}const eE=[],tE=3e4;function nE({messages:t,onCancel:e,onSendNow:s}){const[l,c]=N.useState(()=>Date.now());return N.useEffect(()=>{const y=window.setInterval(()=>c(Date.now()),tE);return()=>window.clearInterval(y)},[]),o.jsx("div",{className:"scheduled-prompts",children:t.map(y=>{const b=y.state==="failed",i=gx(y);return o.jsxs("article",{className:`turn turn-user turn-pending turn-scheduled${b?" turn-scheduled-failed":""}`,children:[o.jsx(Qd,{text:y.text,truncated:!1,needle:""}),o.jsxs("div",{className:"turn-meta",children:[o.jsx("span",{className:"turn-who",children:m("thread.turn.you")}),o.jsx("span",{className:`turn-scheduled-state${b?" is-failed":""}`,role:b?"alert":void 0,children:hx(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:m("scheduled.thread.sendNowTitle"),children:m("scheduled.thread.sendNow")}),e!==void 0&&o.jsx("button",{className:"queued-edit",onClick:()=>e(y.id),disabled:!i,title:m("scheduled.thread.cancelTitle"),children:m("scheduled.thread.cancel")})]})]})]},y.id)})})}function rE({summary:t,at:e,open:s,children:l}){const c=e>0?Fi(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}),c.length>0&&o.jsx("span",{className:"tool-group-time",children:c})]}),o.jsx("div",{className:"tool-group-body",children:l})]})}function sE({event:t,mine:e}){const s=t.at>0?Fi(t.at):"",l=[];return t.durationMs!==null&&l.push(MC(t.durationMs)),t.effort!==null&&l.push(m("thread.turn.effort",{effort:t.effort})),o.jsxs("div",{className:"turn-meta",children:[e&&o.jsx("span",{className:"turn-who",children:m("thread.turn.you")}),s.length>0&&o.jsx("span",{children:s}),t.queued&&o.jsx("span",{className:"turn-queued",title:m("thread.turn.queuedTitle"),children:m("thread.turn.queued")}),l.map(c=>o.jsx("span",{className:"turn-meta-bit",children:c},c))]})}function iE({part:t,eventId:e,mine:s,result:l,needle:c,images:y,onRequestImage:b,answeredAt:i,failure:a,questionLock:f,onAnswer:_}){const d=N.useContext(Xv);switch(t.kind){case"text":return s?o.jsx(Qd,{text:t.text,truncated:t.truncated,needle:c}):o.jsxs("div",{className:"part-text",children:[o.jsx(Xd,{text:t.text,needle:c,codeLink:d==null?void 0:d.code,localLink:d==null?void 0:d.link}),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",m("thread.truncated")]})]});case"image":return o.jsx(lE,{eventId:e,index:t.index,source:t.source,src:y[kd(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:Cs(Bv(t),c)});case"question":return o.jsx(Qv,{part:t,answeredAt:i,failure:a,lock:f,onAnswer:_,needle:c});case"tool-call":{const k=c.length>0&&`${t.name} ${t.input} ${(l==null?void 0:l.text)??""}`.toLowerCase().includes(c.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:m("thread.tool.error")}),l!==null&&l.imageCount>0&&o.jsx("span",{className:"tool-images",children:m("thread.tool.images",{count:l.imageCount})})]}),o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:m("thread.tool.input")}),o.jsxs("pre",{className:"tool-pre",children:[Cs(t.input,c),t.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",m("thread.truncated")]})]})]}),l!==null&&o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:m("thread.tool.result")}),o.jsxs("pre",{className:`tool-pre${l.isError?" tool-pre-error":""}`,children:[l.text.length>0?Cs(l.text,c):l.imageCount>0?m("thread.tool.imagesNotSent",{count:l.imageCount}):m("thread.tool.noOutput"),l.truncated&&o.jsxs("span",{className:"part-truncated",children:[" ",m("thread.truncated")]})]})]})]})}case"tool-result":return o.jsxs("div",{className:"tool-block",children:[o.jsx("span",{className:"tool-label",children:m("thread.tool.orphanResult")}),o.jsx("pre",{className:`tool-pre${t.isError?" tool-pre-error":""}`,children:Cs(t.text,c)})]})}}function Qv({part:t,answeredAt:e,failure:s,lock:l,onAnswer:c,needle:y}){var j;const[b,i]=N.useState(()=>t.questions.map(()=>[])),[a,f]=N.useState(null),[_,d]=N.useState(""),k=e!==null,E=k||l!==null,M=e??b,w=t.questions.length===1&&((j=t.questions[0])==null?void 0:j.multiSelect)===!1,h=M.every(L=>xa(L)?L.text.trim().length>0:L.length>0),v=L=>L===void 0||xa(L)?[]:L,g=(L,R)=>{if(E)return;const x=t.questions[L];if(x!==void 0){if(w){c(t.toolUseId,[[R]]);return}f(T=>T===L?null:T),i(T=>T.map((I,O)=>{if(O!==L)return I;const P=v(I);return x.multiSelect?P.includes(R)?P.filter(F=>F!==R):[...P,R]:[R]}))}},p=L=>{const R=_.trim();if(R.length===0||E)return;const x={kind:"free",text:R};if(w){c(t.toolUseId,[x]);return}i(T=>T.map((I,O)=>O===L?x:I)),f(null),d("")},S=L=>{var x;if(E||((x=t.questions[L])==null?void 0:x.allowWriteIn)===!1)return;const R=M[L];d(R!==void 0&&xa(R)?R.text:""),f(L)};return o.jsxs("div",{className:`question${k?" question-done":""}`,children:[t.questions.map((L,R)=>{const x=M[R],T=x!==void 0&&xa(x)?x.text:null;return o.jsxs("div",{className:"question-item",children:[o.jsxs("div",{className:"question-head",children:[L.header.length>0&&o.jsx("span",{className:"question-header",children:L.header}),o.jsx("span",{className:"question-text",children:Cs(L.question,y)}),L.multiSelect&&o.jsx("span",{className:"question-hint",children:m("thread.question.multi")})]}),o.jsxs("div",{className:"question-options",children:[L.options.map((I,O)=>{const P=v(x).includes(O);return o.jsxs("button",{type:"button",className:`question-option${P?" question-option-picked":""}`,disabled:E,onClick:()=>g(R,O),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})]},O)}),L.allowWriteIn===!1?null:a===R&&!E?o.jsxs("div",{className:"question-write",children:[o.jsx("textarea",{className:"question-write-input",autoFocus:!0,rows:2,value:_,placeholder:m("thread.question.placeholder"),onChange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&!I.shiftKey&&(I.preventDefault(),p(R)),I.key==="Escape"&&f(null),I.stopPropagation()}}),o.jsxs("div",{className:"question-write-actions",children:[o.jsx("button",{type:"button",className:"question-send",disabled:_.trim().length===0,onClick:()=>p(R),children:m(w?"thread.question.send":"thread.question.useText")}),o.jsx("button",{type:"button",className:"question-write-cancel",onClick:()=>f(null),children:m("common.cancel")})]})]}):o.jsxs("button",{type:"button",className:`question-option question-option-write${T!==null?" question-option-picked":""}`,disabled:E,onClick:()=>S(R),children:[o.jsx("span",{className:"question-option-label",children:T!==null?T:m("thread.question.writeOther")}),T===null&&o.jsx("span",{className:"question-option-desc",children:m("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:m("thread.question.answered")}):l==="unsupported"?o.jsx("span",{className:"question-note",children:m("thread.question.answerInCli")}):l==="no-cli"?o.jsx("span",{className:"question-note",children:m("thread.question.noCli")}):l==="closed"?o.jsx("span",{className:"question-note",children:m("thread.question.closed")}):o.jsxs(o.Fragment,{children:[!w&&o.jsx("button",{type:"button",className:"question-send",disabled:!h,onClick:()=>c(t.toolUseId,b),children:m("thread.question.sendAnswers")}),o.jsx("span",{className:"question-note",children:m(w?"thread.question.pickOne":"thread.question.pickEach")})]})]})]})}function Qd({text:t,truncated:e,needle:s}){const l=CC(t,e),c=l.length===1?l[0]:void 0;if(c!==void 0&&c.kind==="text")return o.jsx(Cm,{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(Cm,{text:b.text,truncated:e&&i===y,needle:s},i):o.jsx(oE,{number:b.number,text:b.text,complete:b.complete,needle:s},i))})}function oE({number:t,text:e,complete:s,needle:l}){const[c,y]=N.useState(!1),b=l.length>0&&e.toLowerCase().includes(l.toLowerCase()),i=c||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:"¶"}),m("thread.pasted",{number:t,count:qo(e)}),!s&&o.jsxs("span",{className:"part-truncated",children:[" ",m("thread.truncated")]}),o.jsx("span",{className:"chip-chevron",children:i?"▾":"▸"})]}),i&&o.jsx("div",{className:"thread-pasted-text part-mine",children:Yv(e,l)})]})}function Cm({text:t,truncated:e,needle:s}){const[l,c]=N.useState(!1),y=t.split(`
143
- `),b=s.length>0&&t.toLowerCase().includes(s.toLowerCase()),i=y.length>=wm&&!b,a=i&&!l?y.slice(0,wm-1).join(`
144
- `):t;return o.jsxs("div",{className:"part-text part-mine",children:[Yv(a,s),e&&o.jsxs("span",{className:"part-truncated",children:[" ",m("thread.truncated")]}),i&&o.jsx("button",{className:"fold-toggle",onClick:()=>c(f=>!f),children:l?m("thread.fold.less"):m("thread.fold.more",{count:y.length})})]})}function lE({eventId:t,index:e,source:s,src:l,onRequest:c}){const[y,b]=N.useState(!1);return N.useEffect(()=>{l===void 0&&c(t,e,s)},[l,t,e,s,c]),l===void 0?o.jsx("div",{className:"conversation-image-placeholder",children:m("thread.image.loading")}):l===null?o.jsx("div",{className:"conversation-image-placeholder",children:m("thread.image.gone")}):o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"conversation-image",src:l,alt:m("thread.image.alt"),onClick:()=>b(!0),title:m("thread.image.openTitle")}),y&&o.jsx(hv,{src:l,caption:m("thread.image.alt"),onClose:()=>b(!1)})]})}function xm({connection:t,title:e,confirmLabel:s,confirmTitle:l,onChoose:c,onClose:y}){const[b,i]=N.useState(null),[a,f]=N.useState(null),[_,d]=N.useState(!1),[k,E]=N.useState(""),M=N.useRef(null),w=N.useRef(null);N.useEffect(()=>{const p=t.onMessage(S=>{if(S.type==="picker.listing"){M.current=S.listing.pickerId,i(S.listing),f(null),d(!1),E("");return}S.type==="error"&&S.code==="picker-failed"&&f(Mt(S.text))});return t.send({type:"picker.open"}),()=>{p();const S=M.current;S!==null&&t.send({type:"picker.close",pickerId:S})}},[t]),N.useEffect(()=>{const p=S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),y())};return window.addEventListener("keydown",p,!0),()=>window.removeEventListener("keydown",p,!0)},[y]),N.useEffect(()=>{var p;_&&((p=w.current)==null||p.focus())},[_]);const h=N.useCallback(p=>{const S=M.current;S!==null&&t.send({type:"picker.enter",pickerId:S,name:p})},[t]),v=N.useCallback(p=>{const S=M.current;S!==null&&t.send({type:"picker.root",pickerId:S,rootIndex:p})},[t]),g=N.useCallback(()=>{const p=M.current,S=k.trim();p===null||S.length===0||t.send({type:"picker.create",pickerId:p,name:S})},[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:p=>p.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:m("common.close"),children:"×"})]}),b===null?o.jsx("p",{className:"panel-note",children:m("picker.loading")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"picker-roots",children:b.roots.map((p,S)=>o.jsx("button",{className:"picker-root",onClick:()=>v(S),title:m("picker.goTo",{root:p}),children:p},p))}),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:()=>h(".."),children:["‹ ",m("picker.up")]}),b.entries.length===0&&!b.canGoUp&&o.jsx("p",{className:"panel-note",children:m("picker.empty")}),b.entries.map(p=>o.jsx("button",{className:"picker-entry",onClick:()=>h(p),children:p},p)),b.truncated&&o.jsx("p",{className:"panel-note",children:m("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:m("picker.newFolderName"),onChange:p=>E(p.target.value),onKeyDown:p=>{p.key==="Enter"&&g(),p.key==="Escape"&&(p.stopPropagation(),d(!1)),p.stopPropagation()},spellCheck:!1}),o.jsx("button",{className:"primary-button primary-button-small",onClick:g,children:m("picker.create")}),o.jsx("button",{className:"link-button",onClick:()=>d(!1),children:m("common.cancel")})]}):o.jsx("button",{className:"primary-button primary-button-small",onClick:()=>d(!0),children:m("picker.createHere")}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"picker-open",onClick:()=>c(b.pickerId,b.path),title:l(b.path),children:s})]})]})]})})}function aE(t,e){return Dd(t)&&e!==null&&e.sessions>0}function cE(){return m("search.mode.titles")}function uE(){return m("search.mode.conversations")}function dE(){return m("search.mode.conversationsTitle")}function hE(t){return m(t==="conversations"?"search.placeholder.conversations":"search.placeholder.titles")}function fE(){return m("search.tooShort",{min:Og})}function pE(t){return[...t.trim()].length<Og}function mE(){return m("search.off")}function gE(t){const e=new Map;for(const s of t){const l=`${s.agent}:${s.sessionId}`;let c=e.get(l);c===void 0&&(c={key:l,agent:s.agent,sessionId:s.sessionId,title:s.title,titleHit:null,hits:[],lastAt:null},e.set(l,c)),s.eventId===null?c.titleHit=s:c.hits.push(s),s.at!==null&&(c.lastAt=Math.max(c.lastAt??0,s.at))}return[...e.values()]}const vE=40;function Jv(t,e=vE){const s=t.matchStart+t.matchLength;let l=t.snippet.slice(0,t.matchStart);if(l.length>e){let c=l.length-e;const y=l.charCodeAt(c);y>=56320&&y<=57343&&(c+=1),l=`…${l.slice(c)}`}return{before:l,match:t.snippet.slice(t.matchStart,s),after:t.snippet.slice(s)}}function _E(t){return t.role==="user"?m("search.role.user"):t.role==="assistant"?m("search.role.assistant"):m("search.role.title")}function Zv(t){return Jv(t).match.trim()}function wE(t){const e=t.hits[0]??t.titleHit;return e===null?"":Zv(e)}const Cd=t=>m("search.sessions",{count:t});function bE(t,e){return{query:e.query,hits:t===null?[...e.hits]:[...t.hits,...e.hits],sessionsScanned:e.sessionsScanned,sessionsTotal:e.sessionsTotal,truncated:null}}function yE(t){const{result:e}=t;if(t.searching&&t.error===null){if(e===null)return m("search.status.searching");const l={count:e.sessionsTotal,scanned:e.sessionsScanned};return e.hits.length===0?m("search.status.progress",l):m("search.status.progressFound",{...l,found:Sm(e)})}if(t.error!==null)return t.error;if(e===null)return null;const s=e.hits.length===0?m("search.status.none"):Sm(e);if(e.truncated===null&&e.hits.length===0&&e.sessionsScanned>0)return m("search.status.noneIn",{sessions:Cd(e.sessionsScanned)});if(e.truncated==="results")return m("search.status.truncatedResults",{found:s});if(e.truncated==="time"){const l=Math.max(0,e.sessionsTotal-e.sessionsScanned);return m("search.status.truncatedTime",{found:s,seconds:Math.round(cy/1e3),left:Cd(l)})}return m("search.status.done",{found:s})}function Sm(t){const e=new Set(t.hits.map(s=>`${s.agent}:${s.sessionId}`)).size;return m("search.found",{hits:m("search.hits",{count:t.hits.length}),sessions:Cd(e)})}function kE(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 c=l.sessions.find(y=>y.agent===t.agent&&y.sessionId===t.sessionId);if(c!==void 0)return La(c)&&l.cwdExists&&e.canResume(c.agent)?{kind:"resume",cwd:Wg(c.cwd,l.cwd,e.platform),session:c}:{kind:"copy"}}return{kind:"copy"}}const CE=/<(code|kbd|b|strong|em)>([\s\S]*?)<\/\1>|<br\s*\/?>/g;function fn(t,e,s){const l=Yg(t,e),c=[];let y=0;for(const b of l.matchAll(CE)){const i=b.index??0;i>y&&c.push(Ta(l.slice(y,i),e));const a=b[1];if(a===void 0)c.push(N.createElement("br",{key:c.length}));else{const f=Ta(b[2]??"",e);c.push(N.createElement(a,{key:c.length},f))}y=i+b[0].length}return y<l.length&&c.push(Ta(l.slice(y),e)),c.length===1?c[0]:c}const Em="0.9.1",Tm="agent-workbench.support-notice",xE=3e4;function SE(t){return/^[0-9A-Za-z][0-9A-Za-z.+-]{0,39}$/.test(t)?t:null}function EE(t,e){return t!==e}function TE(){return[{keys:"Alt + T",description:m("shortcuts.app.newTab")},{keys:"Alt + W",description:m("shortcuts.app.closeTab")},{keys:"Alt + ← / →",description:m("shortcuts.app.switchTab")},{keys:"Alt + P",description:m("shortcuts.app.togglePanel")},{keys:"Shift + Tab",description:m("shortcuts.app.previousTab")}]}function LE({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":m("shortcuts.ariaLabel"),onClick:s=>s.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:m("shortcuts.title")}),o.jsx("button",{className:"icon-button",onClick:e,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("h3",{className:"modal-section",children:m("shortcuts.section.app")}),o.jsx(Wu,{shortcuts:TE()}),o.jsx("h3",{className:"modal-section",children:m("shortcuts.section.composer")}),o.jsx(Wu,{shortcuts:Nk(t!==null&&t.capabilities.imagesByPath!==null)}),t!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("shortcuts.section.cli")}),o.jsx("p",{className:"modal-hint",children:fn("shortcuts.cliHint")}),o.jsx(Wu,{shortcuts:xs[t.id].shortcuts}),xs[t.id].shortcutsNote!==null&&o.jsx("p",{className:"modal-hint",children:xs[t.id].shortcutsNote})]}),o.jsx("p",{className:"modal-hint",children:fn("shortcuts.browserReserved")}),o.jsx("p",{className:"modal-hint",children:fn("shortcuts.altNumber")}),o.jsxs("p",{className:"modal-hint support-hint",children:[o.jsx("span",{"aria-hidden":"true",children:"☕"})," ",m("support.notice")," ",o.jsx("a",{href:$g,target:"_blank",rel:"noreferrer noopener",children:m("support.link")})]})]})]})})}function Wu({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 NE=1e3,RE=5e3;function Lm({info:t,agentLabel:e,purpose:s="status",onRefresh:l,onClose:c}){const[y,b]=N.useState(null),[i,a]=N.useState(!1),f=N.useRef(null),_=N.useRef(null);N.useEffect(()=>{const v=g=>{g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),c())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[c]),N.useEffect(()=>{a(!1)},[t]),N.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current),_.current!==null&&window.clearTimeout(_.current)},[]);const d=(v,g)=>{navigator.clipboard.writeText(g).then(()=>{b(v),f.current!==null&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>b(null),NE)}).catch(()=>b(null))},k=()=>{a(!0),l(),_.current!==null&&window.clearTimeout(_.current),_.current=window.setTimeout(()=>a(!1),RE)},E=t.state==="active",M=m("statusLine.title",{agent:e}),w=s==="plan-limits",h=xk(t,e);return o.jsx("div",{className:"modal-backdrop",onClick:c,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":M,onClick:v=>v.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:M}),o.jsx("button",{className:"icon-button",onClick:c,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:`status-line-state${E?" status-line-state-active":""}`,children:kk(t.state)}),o.jsx("p",{className:"modal-hint",children:m(w?"statusLine.planBenefit":"statusLine.benefit")}),w&&o.jsx("p",{className:"modal-hint",children:m("statusLine.planReplaces")}),o.jsx("h3",{className:"modal-section",children:m("statusLine.lineSection")}),t.fragment===null?o.jsx("p",{className:"modal-hint",children:w?m("statusLine.planNoFragment"):Ck()}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:fn("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:()=>d("line",t.fragment??""),title:m("statusLine.copyTitle"),children:y==="line"?o.jsxs(o.Fragment,{children:["✓ ",m("statusLine.copied")]}):m("statusLine.copy")})]}),h!==null&&o.jsx("p",{className:"modal-hint",children:o.jsx("button",{className:"link-button",onClick:()=>d("prompt",h),title:m("statusLine.copyPromptTitle"),children:y==="prompt"?o.jsxs(o.Fragment,{children:["✓ ",m("statusLine.promptCopied")]}):m("statusLine.copyPrompt")})})]}),o.jsx("h3",{className:"modal-section",children:m("statusLine.whereSection")}),o.jsx("p",{className:"status-line-path",children:t.settingsPath}),o.jsx("p",{className:"modal-hint",children:m("statusLine.whereHint")}),o.jsx("h3",{className:"modal-section",children:m("statusLine.scriptSection")}),o.jsx("p",{className:"modal-hint",children:m(w?"statusLine.planScriptHint":"statusLine.scriptHint")}),o.jsx("p",{className:"status-line-path",children:t.scriptPath}),o.jsx("p",{className:"modal-hint",children:fn("statusLine.runsEverywhere")}),o.jsxs("div",{className:"status-line-actions",children:[o.jsx("button",{className:"primary-button",onClick:k,disabled:i,children:m(i?"statusLine.checking":"statusLine.check")}),o.jsx("span",{className:"modal-hint",children:m("statusLine.checkHint")})]})]})]})})}function ME(){const[t,e]=N.useState(()=>EE(jt(Tm,null,SE),Em));return N.useEffect(()=>{if(!t)return;Lt(Tm,Em);const s=window.setTimeout(()=>e(!1),xE);return()=>window.clearTimeout(s)},[t]),t?o.jsxs("div",{className:"banner banner-support",role:"status",children:[o.jsx("span",{children:m("support.notice")}),o.jsx("a",{className:"banner-support-link",href:$g,target:"_blank",rel:"noreferrer noopener",onClick:()=>e(!1),children:m("support.link")}),o.jsx("button",{className:"link-button banner-support-dismiss",onClick:()=>e(!1),children:m("support.dismiss")})]}):null}function xd({agent:t,agents:e}){return o.jsx("span",{className:"agent-badge",title:Qo(t,e),children:ck(t)})}const AE=500,Nm=10;function IE(t){const e=N.useRef(null),s=N.useRef(null),l=N.useRef(!1),c=N.useRef(t);c.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,c.current()},AE))},[y]),i=N.useCallback(_=>{const d=s.current;d!==null&&(Math.abs(_.clientX-d.x)>Nm||Math.abs(_.clientY-d.y)>Nm)&&y()},[y]),a=N.useCallback(_=>{(l.current||e.current!==null)&&_.preventDefault()},[]),f=N.useCallback(_=>{l.current&&(l.current=!1,_.preventDefault(),_.stopPropagation())},[]);return{onPointerDown:b,onPointerMove:i,onPointerUp:y,onPointerCancel:y,onContextMenu:a,onClickCapture:f}}function jE({onLongPress:t,...e}){const s=IE(t);return o.jsx("button",{...e,...s})}function Jd({className:t,text:e,title:s,disabled:l,offerAgentChoice:c,agents:y,agent:b,onOpen:i}){var M;const[a,f]=N.useState(!1),_=N.useRef(null),d=N.useCallback(()=>f(!1),[]),k=N.useCallback(w=>{f(!1),i(w)},[i]);if(!c)return o.jsx("button",{className:t,onClick:()=>i(),disabled:l,title:s,children:e});const E=((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:E===null?s:m("agentMenu.titleWithAgent",{title:s,label:E}),children:e}),o.jsx("button",{ref:_,className:`${t} split-button-arrow`,onClick:()=>f(w=>!w),disabled:l,"aria-haspopup":"menu","aria-expanded":a,title:m("agentMenu.chooseTitle"),children:"▾"}),a&&_.current!==null&&o.jsx(Pv,{agents:y,preselected:b,anchor:_.current,onPick:k,onClose:d})]})}function DE(t){const e=new Date(t);return e.setHours(0,0,0,0),e.getTime()}function e_(t,e,s,l){const c=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)||c.add(b.sessionId)));return[...c]}function PE(t,e,s,l){const c=[];for(const i of t)for(const a of i.sessions)c.includes(a.agent)||c.push(a.agent);const y=l,b=i=>{const a=y.indexOf(i);return a===-1?l.length:a};return c.sort((i,a)=>b(i)-b(a)).map(i=>({agent:i,count:e_(t,i,e,s).length})).filter(i=>i.count>0)}function t_(t,e){const s=new Set;let l=0;for(const c of t.sessions)if(!c.archived){if(e.has(c.sessionId)){l+=1;continue}s.add(c.sessionId)}return{sessionIds:[...s],blocked:l}}function OE(t){const{sessionIds:e,blocked:s}=t;if(e.length===0)return m("archive.allBlocked",{count:s});const l=m("archive.confirm",{count:e.length});return s===0?l:m("archive.withBlocked",{confirm:l,blocked:m("archive.blockedStays",{count:s})})}const Rm=12;function BE(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 Js(t){const e=t.toLowerCase().replace(/[\\/]+/g,"/").replace(/\/+$/,"");return`hsl(${BE(e)%Rm*(360/Rm)} var(--project-color-s) var(--project-color-l))`}function Hi(){return m("vault.name")}function FE(){return m("vault.privacy")}function HE(){return m("vault.archived")}function UE(){return m("vault.mark.copy")}function Mm(){return m("vault.mark.copyTitle")}function WE(){return m("vault.mark.partial")}function $E(){return m("vault.mark.partialTitle")}function n_(t){return m("vault.sessions",{count:t})}function Zd(t){return t==="measuring"||t==="writing"||t==="moving"}function zE(t){const e=t.progress;switch(t.state){case"measuring":return e===null?m("vault.state.measuring"):m("vault.state.measuringProgress",{done:e.done,total:e.total});case"writing":return e===null?m("vault.state.writing"):m("vault.state.writingProgress",{done:e.done,total:e.total});case"moving":return m("vault.state.moving");default:return t.enabled?m("vault.state.on"):m("vault.state.off")}}function qE(t){if(t===null||!t.enabled)return null;const e=[Hi(),n_(t.sessions)];return t.state==="writing"?e.push(t.progress===null?m("vault.line.copying"):m("vault.line.copyingProgress",{done:t.progress.done,total:t.progress.total})):t.state==="moving"?e.push(m("vault.line.moving")):t.state==="measuring"?e.push(m("vault.line.measuring")):e.push(t.lastPassAt===null?m("vault.line.neverCopied"):Jn(t.lastPassAt)),t.pending>0&&e.push(m("vault.line.pending",{count:t.pending})),e.join(" · ")}function KE(t){return t===null?Hi():t.enabled?m("vault.button.on"):m("vault.button.off")}function VE(t){return t.enabled?"enabled":Zd(t.state)?"busy":t.measurement!==null?"measured":t.passSessions>0?"existing":"needs-measure"}function GE(t,e){return Zd(t.state)?m("vault.busy"):e?null:m("vault.indexNotReady")}function YE(t){return Zd(t.state)?m("vault.busy"):null}function XE(t){return m("vault.previousDir",{dir:t})}function QE(t){const e=[];return t.skippedEmpty>0&&e.push(m("vault.note.empty",{count:t.skippedEmpty})),t.unsupported>0&&e.push(m("vault.note.unsupported",{count:t.unsupported})),t.failed>0&&e.push(t.failureReasons.length>0?m("vault.note.failedWithReasons",{count:t.failed,reasons:t.failureReasons.map(Mt).join("; ")}):m("vault.note.failed",{count:t.failed})),e.length===0?null:m("vault.note.notCopied",{parts:e.join(" · ")})}function JE(t,e){const s=t.byAgent.map(y=>({agent:y.agent,label:Qo(y.agent,e),sessions:y.sessions,bytes:y.eventBytes+y.imageBytes,images:y.images,imageBytes:y.imageBytes,skippedArchived:y.skippedArchived,note:QE(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}),c=Jn(t.measuredAt);return{rows:s,memoryProjects:t.memoryProjects,memoryBytes:t.memoryBytes,total:l,summary:c.length>0?m("vault.measure.summary",{when:c,duration:Ko(t.durationMs)}):m("vault.measure.summaryNoWhen",{duration:Ko(t.durationMs)})}}function ZE(t){const e=t.storage==="vault";return{copy:e,partial:e&&t.partial}}function eT(t){switch(t){case"exporting":return m("vault.export.exporting");case"done":return m("vault.export.done");default:return m("vault.export.idle")}}const tT=1e3;function Am({hit:t}){const{before:e,match:s,after:l}=Jv(t);return o.jsxs(o.Fragment,{children:[e,o.jsx("mark",{children:s}),l]})}function nT({project:t,openSessionIds:e,onConfirm:s,onCancel:l}){const c=t_(t,e);return o.jsxs("div",{className:"project-archive-confirm",role:"group",children:[o.jsx("span",{className:"archive-history-text",children:OE(c)}),c.sessionIds.length>0&&o.jsx("button",{className:"link-button",onClick:s,children:m("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:l,children:c.sessionIds.length>0?m("common.cancel"):m("common.close")})]})}function $u(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 Im({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 rT(){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 sT({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 iT({candidates:t,agents:e,onArchiveAgent:s,onClose:l,anchorRef:c}){const[y,b]=N.useState(null),i=N.useRef(null);return N.useEffect(()=>{const a=d=>{var k,E;return d instanceof Node&&(((k=i.current)==null?void 0:k.contains(d))===!0||((E=c.current)==null?void 0:E.contains(d))===!0)},f=d=>{d.key!=="Escape"||!a(document.activeElement)||(d.preventDefault(),d.stopPropagation(),l())},_=d=>{a(d.target)||l()};return window.addEventListener("keydown",f,!0),document.addEventListener("pointerdown",_,!0),()=>{window.removeEventListener("keydown",f,!0),document.removeEventListener("pointerdown",_,!0)}},[c,l]),o.jsxs("div",{ref:i,className:"archive-history",role:"region","aria-label":m("sidebar.history.region"),children:[o.jsxs("div",{className:"archive-history-header",children:[o.jsx("span",{children:m("sidebar.history.heading")}),o.jsx("button",{className:"icon-button",onClick:l,title:m("common.closeEsc"),children:"×"})]}),t.map(({agent:a,count:f})=>{const _=Qo(a,e);return y===a?o.jsxs("div",{className:"archive-history-row archive-history-confirm",children:[o.jsx("span",{className:"archive-history-text",children:m("sidebar.history.confirm",{count:f,label:_})}),o.jsx("button",{className:"link-button",onClick:()=>s(a),children:m("sidebar.action.archive")}),o.jsx("button",{className:"link-button",onClick:()=>b(null),children:m("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:m("sidebar.history.count",{count:f})})]}),o.jsx("button",{className:"link-button",onClick:()=>b(a),children:m("sidebar.action.archive")})]},a)})]})}function oT({projects:t,indexStatus:e,disabled:s,openSessionIds:l,openBlocked:c,onOpenProject:y,agents:b,offerAgentChoice:i,agentForProject:a,onOpenSession:f,canResume:_,platform:d,onRefresh:k,onArchive:E,onHide:M,width:w,onNewProject:h,vault:v,onOpenVault:g,onOpenVaultSession:p,onExportProject:S,exporting:j,lastExported:L,onContinueSession:R,moveToBranchOf:x,globalSearch:T,onOpenSearchHit:I,onNewWorktree:O,onReopenWorktree:P}){const[F,W]=N.useState(new Set),[$,K]=N.useState(null);N.useEffect(()=>{const fe=L===null?0:L.at+tT-Date.now();if(L===null||fe<=0)return;K(L.projectKey);const Ce=window.setTimeout(()=>K(null),fe);return()=>window.clearTimeout(Ce)},[L]);const G=fe=>j.has(fe)?"exporting":$===fe?"done":"idle",q=qE(v),[D,U]=N.useState(""),[H,z]=N.useState(!1),[Z,ie]=N.useState(new Set),[ye,_e]=N.useState("titles"),Q=T===null?"titles":ye,[Y,ne]=N.useState(!1),ee=T!==null&&Q==="conversations"&&D.trim().length>0&&(Y||T.submitted!==null),be=(T==null?void 0:T.result)??null,me=N.useMemo(()=>ee&&be!==null?gE(be.hits):[],[ee,be]),Be=fe=>{_e(fe),ne(!1),T==null||T.clear()},ze=()=>{if(T!==null){if(pE(D)){ne(!0),T.clear();return}ne(!1),T.search(D.trim(),H)}},Qe=(T==null?void 0:T.submitted)??null,dt=T==null?void 0:T.search;N.useEffect(()=>{Q!=="conversations"||Qe===null||dt===void 0||Qe.includeArchived!==H&&dt(Qe.query,H)},[Q,Qe,dt,H]);const Ie=N.useMemo(()=>t.reduce((fe,Ce)=>fe+Ce.sessions.filter($e=>$e.archived).length,0),[t]),at=N.useMemo(()=>{const fe=Q==="titles"?D.trim().toLowerCase():"";return t.map(Ce=>{const $e=H?Ce.sessions:Ce.sessions.filter(gt=>!gt.archived);if($e.length===0)return null;if(fe.length===0)return{...Ce,sessions:$e};if($u(Ce).toLowerCase().includes(fe)||Ce.cwd.toLowerCase().includes(fe))return{...Ce,sessions:$e};const ke=$e.filter(gt=>Sr(gt.title,gt.titleSource).toLowerCase().includes(fe));return ke.length>0?{...Ce,sessions:ke}:null}).filter(Ce=>Ce!==null)},[t,D,H,Q]),xt=Q==="titles"&&D.trim().length>0,oe=fe=>fe.archived||!l.has(fe.sessionId),[je,Ae]=N.useState(!1),Le=N.useRef(null),nt=DE(Date.now()),Fe=N.useMemo(()=>b.map(fe=>fe.id),[b]),Ke=N.useMemo(()=>PE(t,nt,l,Fe),[t,nt,l,Fe]),[mt,_t]=N.useState(null);N.useEffect(()=>{Ke.length===0&&Ae(!1)},[Ke.length]);const Et=N.useCallback(()=>Ae(!1),[]),ft=fe=>{const Ce=e_(t,fe,nt,l);Ce.length>0&&(E(Ce,!0),_t({what:Qo(fe,b),sessionIds:Ce})),Ae(!1)},[ct,Ge]=N.useState(null),yt=fe=>{const Ce=t_(fe,l);Ce.sessionIds.length>0&&(E(Ce.sessionIds,!0),_t({what:$u(fe),sessionIds:Ce.sessionIds})),Ge(null)},Bt=()=>{mt!==null&&E(mt.sessionIds,!1),_t(null)},Wt=fe=>{ie(Ce=>{const $e=new Set(Ce);return $e.has(fe)?$e.delete(fe):$e.add(fe),$e})},Ne=N.useMemo(()=>{const fe=[];for(const Ce of at)for(const $e of Ce.sessions)Z.has($e.sessionId)&&fe.push($e);return fe},[at,Z]),He=fe=>{const Ce=Ne.filter($e=>fe?oe($e):!0).map($e=>$e.sessionId);Ce.length>0&&E(Ce,fe),ie(new Set)},de=fe=>{W(Ce=>{const $e=new Set(Ce);return $e.has(fe)?$e.delete(fe):$e.add(fe),$e})},lt=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:hE(Q),value:D,onChange:fe=>{U(fe.target.value),Q==="conversations"&&(ne(!1),fe.target.value.trim().length===0&&(T==null||T.clear()))},onKeyDown:fe=>{Q!=="conversations"||fe.key!=="Enter"||(fe.preventDefault(),ze())},spellCheck:!1}),o.jsx("button",{className:"icon-button",onClick:h,title:m("sidebar.newProject"),disabled:s,children:"+"}),o.jsx("button",{className:"icon-button",onClick:k,title:m("sidebar.reindex"),disabled:lt,children:"⟳"}),o.jsx("button",{className:`icon-button${(v==null?void 0:v.enabled)===!0?" icon-button-on":""}`,onClick:g,title:KE(v),"aria-label":Hi(),children:o.jsx(rT,{})}),o.jsx("button",{className:"icon-button",onClick:M,title:m("sidebar.hide"),children:"«"})]}),T!==null&&o.jsxs("div",{className:"sidebar-search-mode",role:"group","aria-label":m("sidebar.searchMode.label"),children:[o.jsx("button",{className:`sidebar-search-mode-option${Q==="titles"?" is-on":""}`,"aria-pressed":Q==="titles",onClick:()=>Be("titles"),title:m("sidebar.searchMode.titlesTitle"),children:cE()}),o.jsx("button",{className:`sidebar-search-mode-option${Q==="conversations"?" is-on":""}`,"aria-pressed":Q==="conversations",onClick:()=>Be("conversations"),title:dE(),children:uE()})]}),lt&&o.jsx("div",{className:"sidebar-progress",children:m("sidebar.indexing",{scanned:e.scannedFiles,total:e.totalFiles})}),(Ie>0||Ke.length>0)&&o.jsxs("div",{className:"sidebar-archive-bar",children:[Ie>0&&o.jsx("button",{className:`sidebar-archived-toggle${H?" is-on":""}`,onClick:()=>z(fe=>!fe),title:m("sidebar.archived.toggleTitle"),children:H?m("sidebar.archived.hide",{count:Ie}):m("sidebar.archived.show",{count:Ie})}),Ke.length>0&&o.jsx("button",{ref:Le,className:`link-button sidebar-archive-history${je?" is-on":""}`,onClick:()=>Ae(fe=>!fe),"aria-expanded":je,title:m("sidebar.history.buttonTitle"),children:m("sidebar.history.button")})]}),je&&Ke.length>0&&o.jsx(iT,{candidates:Ke,agents:b,onArchiveAgent:ft,onClose:Et,anchorRef:Le}),mt!==null&&!je&&o.jsxs("div",{className:"archive-history archive-history-undo",role:"status",children:[o.jsx("span",{className:"archive-history-text",children:m("sidebar.undo.text",{count:mt.sessionIds.length,what:mt.what})}),o.jsx("button",{className:"link-button",onClick:Bt,children:m("sidebar.action.undo")}),o.jsx("button",{className:"icon-button",onClick:()=>_t(null),title:m("sidebar.undo.dismissTitle"),children:"×"})]}),q!==null&&o.jsx("button",{className:`sidebar-vault-line${(v==null?void 0:v.lastError)!=null?" is-problem":""}`,onClick:g,title:(v==null?void 0:v.lastError)!=null?m("sidebar.vaultLine.lastError",{error:Mt(v.lastError)}):m("sidebar.vaultLine.title"),children:q}),o.jsxs("div",{className:"sidebar-scroll",children:[ee&&T!==null&&o.jsxs("div",{className:"search-results",children:[!T.vaultEnabled&&o.jsx("p",{className:"search-note",children:mE()}),o.jsx("p",{className:`search-status${T.error!==null?" is-problem":""}`,role:"status",children:Y?fE():yE(T)}),!Y&&me.map(fe=>{const Ce=fe.hits[0]??fe.titleHit;return Ce===null?null:o.jsxs("div",{className:"search-group",children:[o.jsxs("button",{className:"search-group-title",onClick:()=>I(Ce,wE(fe)),title:Sr(fe.title),children:[o.jsx(xd,{agent:fe.agent,agents:b}),fe.titleHit!==null?o.jsx(Am,{hit:fe.titleHit}):Sr(fe.title)]}),fe.hits.map($e=>o.jsxs("button",{className:"search-hit",onClick:()=>I($e,Zv($e)),children:[o.jsx("span",{className:"search-hit-snippet",children:o.jsx(Am,{hit:$e})}),o.jsxs("span",{className:"search-hit-meta",children:[_E($e),$e.at!==null?` · ${Jn($e.at)}`:""]})]},$e.eventId??"titulo"))]},fe.key)})]}),!ee&&at.length===0&&!lt&&o.jsx("p",{className:"sidebar-empty",children:t.length===0?m("sidebar.empty.noProjects"):m("sidebar.empty.noMatch")}),!ee&&at.map(fe=>{const Ce=F.has(fe.key)||xt,$e=!s&&fe.cwdExists,rt=c(fe.cwd);return o.jsxs("div",{className:"project",children:[o.jsxs("div",{className:"project-row",children:[o.jsxs("button",{className:"project-toggle",onClick:()=>de(fe.key),title:fe.cwd.length>0?fe.cwd:fe.fallbackName,children:[o.jsx("span",{className:`chevron${Ce?" chevron-open":""}`,children:"›"}),o.jsx("span",{className:"project-swatch",style:{background:Js(fe.cwd)},"aria-hidden":"true"}),o.jsx("span",{className:"project-name",children:$u(fe)}),o.jsx("span",{className:"project-count",children:fe.sessions.length})]}),o.jsxs("span",{className:"project-actions",children:[O!==null&&fe.isGitRepo&&fe.cwdExists&&o.jsx("button",{className:"icon-button project-action",onClick:()=>O(fe),disabled:s,title:m("worktree.new"),"aria-label":m("worktree.new"),children:o.jsx(wd,{})}),S!==null&&o.jsx("button",{className:`icon-button project-action${G(fe.key)!=="idle"?" project-action-busy":""}`,onClick:()=>S(fe.key),disabled:G(fe.key)==="exporting",title:eT(G(fe.key)),"aria-label":m("sidebar.project.export"),children:o.jsx(sT,{done:G(fe.key)==="done"})}),o.jsx("button",{className:`icon-button project-action${ct===fe.key?" project-action-busy":""}`,onClick:()=>Ge(ke=>ke===fe.key?null:fe.key),title:m("sidebar.project.archiveTitle"),"aria-label":m("sidebar.project.archive"),"aria-expanded":ct===fe.key,children:o.jsx(Im,{out:!1})})]}),o.jsx(Jd,{className:"icon-button",text:"+",title:rt?iv():fe.cwdExists?m("sidebar.project.newSession"):m("sidebar.project.folderGone"),disabled:!$e||rt,offerAgentChoice:i,agents:b,agent:i?a(fe):null,onOpen:ke=>y(fe.cwd,ke)})]}),!fe.cwdExists&&o.jsx("div",{className:"project-missing",title:fe.cwd,children:m("sidebar.project.missing")}),ct===fe.key&&o.jsx(nT,{project:fe,openSessionIds:l,onConfirm:()=>yt(fe),onCancel:()=>Ge(null)}),Ce&&o.jsx("ul",{className:"session-list",children:fe.sessions.map(ke=>{var De;const gt=Z.has(ke.sessionId),we=!oe(ke),Ue=Xk(ke.agent,b,i),se=ZE(ke),te=La(ke)&&_(ke.agent),ve=ke.worktree!==null&&!ke.worktree.exists,st=se.copy?p!==null:$e&&te&&!ve,We=x(ke);return o.jsxs("li",{className:`session-row${ke.archived?" session-archived":""}${gt?" session-selected":""}`,children:[o.jsxs(jE,{className:"session-item",onLongPress:()=>Wt(ke.sessionId),onClick:Je=>{if(Je.ctrlKey||Je.metaKey){Wt(ke.sessionId);return}if(se.copy){p==null||p(ke);return}La(ke)&&(ke.archived&&E([ke.sessionId],!1),f(Wg(ke.cwd,fe.cwd,d),ke))},disabled:!st,title:se.copy?`${Sr(ke.title,ke.titleSource)}
145
- ${p===null?m("remote.onlyOnHost"):Mm()}`:Ue.unavailableTitle??Sr(ke.title,ke.titleSource),children:[o.jsxs("span",{className:"session-title",children:[Ue.badge&&o.jsx(xd,{agent:ke.agent,agents:b}),se.copy&&o.jsx("span",{className:"session-vault-mark",title:Mm(),children:UE()}),se.partial&&o.jsx("span",{className:"session-partial-mark",title:$E(),children:WE()}),ke.worktree!==null&&o.jsxs("span",{className:`session-branch${ve?" session-branch-gone":""}`,title:ve?m("worktree.sidebar.removedTitle"):m("worktree.sidebar.branchTitle",{branch:ke.worktree.branch}),children:[ke.worktree.branch,ve&&o.jsx("span",{className:"session-branch-note",children:m("worktree.sidebar.removed")})]}),Sr(ke.title,ke.titleSource)]}),o.jsx("span",{className:"session-meta",children:Jn(ke.updatedAt)})]}),We!==null&&!se.copy&&!ve&&o.jsx("button",{className:"icon-button session-move",onClick:We,title:m("worktree.move.title"),"aria-label":m("worktree.move.title"),children:o.jsx(Gd,{})}),o.jsx(Ov,{targets:rv(b,ke.agent,ke.partial,ve),className:"icon-button session-continue",text:"↪",title:$d(ve),onPick:Je=>R(ke,Je)}),ve&&((De=ke.worktree)==null?void 0:De.reopenable)===!0&&$e&&La(ke)&&_(ke.agent)&&o.jsx("button",{className:"icon-button session-action session-reopen",onClick:()=>P(ke,fe),title:m("worktree.sidebar.reopenTitle"),"aria-label":m("worktree.sidebar.reopen"),children:o.jsx(wd,{})}),o.jsx("button",{className:"icon-button session-action",onClick:()=>E([ke.sessionId],!ke.archived),disabled:we,title:ke.archived?m("sidebar.session.restore"):m(we?"sidebar.session.blocked":"sidebar.session.archive"),children:o.jsx(Im,{out:ke.archived})})]},`${ke.agent}:${ke.sessionId}`)})})]},fe.key)})]}),Ne.length>0&&o.jsxs("div",{className:"sidebar-selection",children:[o.jsx("span",{children:m("sidebar.selection.count",{count:Ne.length})}),Ne.some(fe=>!fe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>He(!0),children:m("sidebar.action.archive")}),Ne.some(fe=>fe.archived)&&o.jsx("button",{className:"link-button",onClick:()=>He(!1),children:m("sidebar.action.restore")}),o.jsx("button",{className:"link-button",onClick:()=>ie(new Set),children:m("common.cancel")})]})]})}function Sd({x:t,y:e,items:s,onClose:l,anchor:c=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:f,height:_}=a.getBoundingClientRect();i({left:Math.max(4,Math.min(t,window.innerWidth-f-4)),top:Math.max(4,Math.min(e,window.innerHeight-_-4))})},[t,e]),N.useEffect(()=>{const a=_=>{_.key==="Escape"&&(_.stopPropagation(),l())},f=_=>{var k;const d=_.target;d instanceof Node&&((k=y.current)!=null&&k.contains(d)||c!=null&&c.contains(d))||l()};return window.addEventListener("keydown",a,!0),window.addEventListener("pointerdown",f,!0),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{window.removeEventListener("keydown",a,!0),window.removeEventListener("pointerdown",f,!0),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[c,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 r_({listLabel:t,docs:e,active:s,tooltipOf:l,labelOf:c=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:m("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:c(a)}),o.jsx("button",{className:"strip-tab-close",onClick:()=>i(a.key),title:m("docs.tab.close"),children:"×"})]},a.key))})]})}const lT={added:"+",removed:"-",context:" ",hunk:"",meta:""};function s_({diff:t}){return t.binary?o.jsx("p",{className:"panel-note",children:m("diff.binary")}):t.lines.length===0?o.jsx("p",{className:"panel-note",children:t.message===null?m("diff.noChanges"):Mt(t.message)}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx(i_,{lines:t.lines}),t.truncated&&o.jsx("p",{className:"panel-note",children:m("diff.truncated")})]})}function i_({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:lT[e.kind]}),o.jsx("span",{className:"diff-text",children:e.text})]},s))})}function jm(t){let e="";for(let s=0;s<t.length;s++){const l=t[s]??"",c=l.toLowerCase();e+=c.length===l.length?c:l}return e}function aT(t,e){if(e.length===0)return[];const s=jm(t),l=jm(e),c=[];let y=s.indexOf(l);for(;y!==-1;)c.push(y),y=s.indexOf(l,y+l.length);return c}function Dm(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),c=l===0?0:t[l-1]??0;return{node:l,offset:(t[l]??0)-c}}function cT(t,e,s){return e===0?0:(t+s+e)%e}function uT(t){return/\.(md|markdown)$/i.test(t)}function dT(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 c=t.split("/").slice(0,-1);for(const b of l.replace(/\\/g,"/").split("/")){if(b.includes(":"))return null;if(!(b===""||b===".")){if(b===".."){if(c.length===0)return null;c.pop();continue}c.push(b)}}return c.length===0?null:c.join("/")}function hT({text:t,language:e}){const[s,l]=N.useState(null);N.useEffect(()=>{if(e===null){l(null);return}let y=!1;return xr(async()=>{const{highlightCode:b}=await import("./highlight-BdYEMg2B.js");return{highlightCode:b}},[]).then(({highlightCode:b})=>{y||l(b(t,e))}).catch(()=>{y||l(null)}),()=>{y=!0,l(null)}},[t,e]);const c=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:c},(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 Pm({onInsert:t,onOpenWithSystem:e}){const[s,l]=N.useState(!1),c=N.useRef(null);N.useEffect(()=>()=>{c.current!==null&&window.clearTimeout(c.current)},[]);const y=()=>{t==null||t(),l(!0),c.current!==null&&window.clearTimeout(c.current),c.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:m(s?"files.pathInserted":"files.preview.insertPath")}),e!==null&&o.jsx("button",{className:"primary-button primary-button-small preview-open",onClick:e,children:m("files.menu.openWithSystem")})]})}const Ed="doc-search",Td="doc-search-current";function Ld(){const t=CSS.highlights,e=window.Highlight;return t===void 0||typeof e!="function"?null:t}function Om(t){const e=window.Highlight;return new e(...t)}function Bm(){const t=Ld();t==null||t.delete(Ed),t==null||t.delete(Td)}function fT(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 pT(t,e,s,l){const[c,y]=N.useState(0),[b,i]=N.useState(0),[a,f]=N.useState(0),_=N.useRef([]);N.useEffect(()=>{const k=t.current;if(k===null||s.length===0)return;let E=0;const M=new MutationObserver(()=>{E===0&&(E=window.requestAnimationFrame(()=>{E=0,f(w=>w+1)}))});return M.observe(k,{childList:!0,subtree:!0,characterData:!0}),()=>{M.disconnect(),E!==0&&window.cancelAnimationFrame(E)}},[t,s,l]),N.useEffect(()=>{const k=t.current;if(_.current=[],k===null||s.length===0){Bm(),y(0),i(0);return}const E=[],M=[];let w="";const h=document.createTreeWalker(k,NodeFilter.SHOW_TEXT,{acceptNode:g=>{var p;return(p=g.parentElement)!=null&&p.closest("[data-search-skip]")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(let g=h.nextNode();g!==null;g=h.nextNode()){const p=g;E.push(p),w+=p.data,M.push(w.length)}_.current=aT(w,s).map(g=>{const p=Dm(M,g,"start"),S=Dm(M,g+s.length,"end"),j=document.createRange();return j.setStart(E[p.node],p.offset),j.setEnd(E[S.node],S.offset),j}),y(_.current.length),i(g=>g<_.current.length?g:0);const v=Ld();return v!==null&&_.current.length>0?v.set(Ed,Om(_.current)):v==null||v.delete(Ed),Bm},[t,s,a,l]),N.useEffect(()=>{i(0)},[s]),N.useEffect(()=>{const k=_.current[b],E=Ld();if(k===void 0){E==null||E.delete(Td);return}E==null||E.set(Td,Om([k])),fT(k,e.current)},[b,c,a,l,s,e]);const d=N.useCallback(k=>i(E=>cT(E,c,k)),[c]);return{count:c,index:b,step:d}}function o_({doc:t,content:e,readingText:s,truncatedText:l,onReload:c,onModeChange:y,onOpenWithSystem:b,onInsert:i,onOpenLink:a,initialScroll:f,onScrollChange:_,editor:d=null,insertButton:k}){const[E,M]=N.useState(""),w=N.useRef(null),h=N.useRef(null),v=(e==null?void 0:e.loaded)??null,g=v===null?"":v.kind==="file"?v.preview.text:v.plan.text,p=v!==null&&v.kind==="file"&&v.preview.binary,S=v!==null&&(v.kind==="file"?v.preview.truncated:v.plan.truncated),j=v!==null&&(v.kind==="plan"||v.preview.language==="markdown"||uT(v.preview.path)),L=j&&(t.mode??"formatted")==="formatted",R=v!==null&&v.kind==="file"?v.preview.language:"markdown",x=E.trim(),T=pT(h,w,x,`${L?"f":"s"}:${g.length}:${g.slice(0,64)}`),I=N.useRef(!1);N.useLayoutEffect(()=>{I.current||v===null||(I.current=!0,f!==void 0&&w.current!==null&&(w.current.scrollTop=f))},[v,f]);const O=a===void 0||v===null||v.kind!=="file"?void 0:K=>{const G=dT(t.key,K);return G===null?null:()=>a(G)},P=v!==null&&!p,F=(d==null?void 0:d.edit)??null;if(d!==null&&F!==null)return o.jsx(mT,{title:t.title,editor:d,insertButton:k});const W=v!==null&&v.kind==="file"&&v.preview.editable===!0,$=m(W?"docs.edit.title":S?"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:m("docs.search.placeholder"),value:E,disabled:!P,onChange:K=>M(K.target.value),onKeyDown:K=>{K.key==="Enter"&&T.step(K.shiftKey?-1:1),K.key==="Escape"&&M(""),K.stopPropagation()},spellCheck:!1}),x.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"conversation-matches",children:T.count===0?m("thread.search.none"):`${T.index+1}/${T.count}`}),o.jsx("button",{className:"icon-button",onClick:()=>T.step(-1),disabled:T.count===0,title:m("thread.search.previous"),children:"↑"}),o.jsx("button",{className:"icon-button",onClick:()=>T.step(1),disabled:T.count===0,title:m("thread.search.next"),children:"↓"})]}),j&&o.jsxs("div",{className:"doc-mode",role:"group","aria-label":m("docs.mode.label"),children:[o.jsx("button",{className:L?"is-active":"","aria-pressed":L,onClick:()=>y("formatted"),children:m("docs.mode.formatted")}),o.jsx("button",{className:L?"":"is-active","aria-pressed":!L,onClick:()=>y("source"),children:m("docs.mode.source")})]}),d!==null&&v!==null&&v.kind==="file"&&!p&&o.jsx("button",{className:"primary-button primary-button-small doc-edit-button",onClick:d.begin,disabled:!W,title:$,children:d.justSaved?m("docs.edit.saved"):m("docs.edit.button")}),k,o.jsx("button",{className:"icon-button",onClick:c,disabled:(e==null?void 0:e.loading)===!0,title:m("docs.reload"),children:"⟳"})]}),(e==null?void 0:e.failed)===!0&&v!==null&&o.jsx("p",{className:"panel-note doc-note",children:m("docs.reloadFailed")}),v===null?o.jsx("p",{className:"panel-note",children:(e==null?void 0:e.failed)===!0?m("docs.failed"):s}):p?o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:m("files.preview.binary")}),o.jsx(Pm,{onInsert:i,onOpenWithSystem:b})]}):o.jsxs("div",{className:"panel-scroll",ref:w,onScroll:K=>_(K.currentTarget.scrollTop),children:[o.jsx("div",{ref:h,className:L?"plan-body":"doc-source",children:L?o.jsx(Xd,{text:g,localLink:O}):o.jsx(hT,{text:g,language:R})}),S&&o.jsxs("div",{className:"preview-fallback",children:[o.jsx("p",{className:"panel-note",children:l}),v.kind==="file"&&o.jsx(Pm,{onInsert:i,onOpenWithSystem:b})]})]})]})}function mT({title:t,editor:e,insertButton:s}){const[l,c]=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,f=y.saving?m("docs.edit.saving"):m(b?"docs.edit.unsaved":"docs.edit.noChanges"),_=()=>{e.unsaved?c(!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:[m("docs.edit.editing",{name:t}),o.jsxs("span",{className:"doc-edit-state",children:[" · ",f]})]}),o.jsx("button",{className:"link-button",onClick:_,disabled:y.saving,children:m("docs.edit.cancel")}),o.jsx("button",{className:"primary-button primary-button-small",onClick:e.save,disabled:!a,title:m("docs.edit.saveTitle"),children:m("docs.edit.save")}),s,o.jsx("button",{className:"icon-button",disabled:!0,title:m("docs.reload"),children:"⟳"})]}),y.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:m("docs.edit.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.confirmClose,children:m("docs.edit.discardAndClose")}),o.jsx("button",{className:"link-button",onClick:e.keepEditing,children:m("docs.edit.keepEditing")})]}),l&&!y.closing&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:m("docs.edit.discardConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:m("docs.edit.discard")}),o.jsx("button",{className:"link-button",onClick:()=>c(!1),children:m("docs.edit.keepEditing")})]}),i!==null&&o.jsxs("div",{className:"note-closing doc-edit-bar",children:[o.jsx("span",{children:i.next===null?m("docs.edit.gone"):m("docs.edit.conflict")}),i.next!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:e.adopt,children:m("docs.edit.adopt")}),o.jsx("button",{className:"link-button link-danger",onClick:e.discard,children:m("docs.edit.discardMine")})]}),y.failure!==null&&o.jsx("div",{className:"composer-problem doc-edit-bar",children:o.jsx("span",{children:y.failure.kind==="lost"?m("docs.edit.lost"):Mt(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:m("docs.edit.pending")}),o.jsx("button",{className:"link-button",onClick:e.dismissPending,children:m("docs.edit.pendingDone")})]}),o.jsx("div",{className:"doc-changes-body",children:o.jsx(i_,{lines:y.pending})})]}),o.jsx("textarea",{className:"doc-editor",value:y.text,readOnly:i!==null||y.saving,spellCheck:!1,autoFocus:!0,"aria-label":m("docs.edit.editing",{name:t}),onChange:d=>e.change(d.target.value),onKeyDown:d=>{(d.ctrlKey||d.metaKey)&&!d.altKey&&d.key.toLowerCase()==="s"&&(d.preventDefault(),a&&e.save()),d.stopPropagation()}})]})}function eh(){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 gT(){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 vT({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 _T(){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 wT(){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 l_({className:t,title:e,doneTitle:s,icon:l,onAction:c}){const[y,b]=N.useState(!1),i=N.useRef(null);N.useEffect(()=>()=>{i.current!==null&&window.clearTimeout(i.current)},[]);const a=f=>{f.stopPropagation(),c(),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(wT,{}):l})}function bT({className:t,title:e,onCopy:s}){return o.jsx(l_,{className:t,title:e,doneTitle:m("common.copied"),icon:o.jsx(gT,{}),onAction:s})}function Vo({className:t,title:e,onInsert:s}){return o.jsx(l_,{className:t,title:e,doneTitle:m("files.pathInserted"),icon:o.jsx(_T,{}),onAction:s})}function yT({view:t,cwd:e,platform:s,onInsert:l,onInsertPath:c,onReveal:y,docs:b}){const{listings:i,loading:a,refresh:f,query:_,setQuery:d,showHidden:k,toggleHidden:E}=t,M=Zo(),[w,h]=N.useState(null),v=s==="win32"?"\\":"/",g=N.useCallback($=>{const K=$.split("/").join(v);return e.length===0?K:e.endsWith(v)?`${e}${K}`:`${e}${v}${K}`},[e,v]),p=N.useCallback($=>{navigator.clipboard.writeText($).catch(()=>{})},[]),S=N.useCallback($=>c(`"${g($)}"`),[g,c]),j=N.useCallback(($,K)=>{$.preventDefault(),$.stopPropagation(),h({x:$.clientX,y:$.clientY,items:[{label:m("files.menu.copyAbsolute"),onSelect:()=>p(g(K))},{label:m("files.menu.copyRelative"),onSelect:()=>p(K)},...l===void 0?[]:[{label:m("files.menu.insertMention"),onSelect:()=>l(`@${K}`)}],...y===null?[]:[{label:m("files.menu.openWithSystem"),onSelect:()=>y(K)}]]})},[g,p,l,y,M]),L=b.active===null?null:b.docs.find($=>$.key===b.active)??null,R=L===null?void 0:b.content(L.key),x=L!==null&&R===void 0;N.useEffect(()=>{x&&L!==null&&b.reload(L.key)},[x,L==null?void 0:L.key]);const T=N.useCallback($=>b.open({key:$,title:$.split("/").pop()??$}),[b]),I=N.useMemo(()=>({...t,openFile:T}),[t,T]),O=$=>{var G;const K=(G=b.content($.key))==null?void 0:G.loaded;return(K==null?void 0:K.kind)==="file"?`${$.key} · ${yn(K.preview.sizeBytes)}`:$.key},P=b.docs.length>0?o.jsx(r_,{listLabel:m("panel.tab.files"),docs:b.docs,active:b.active,tooltipOf:O,labelOf:$=>b.unsaved($.key)?`${$.title} •`:$.title,onShowList:b.showList,onSelect:b.select,onClose:b.requestClose}):null;if(L!==null)return o.jsxs("div",{className:"panel-body",children:[P,o.jsx(o_,{doc:L,content:R,readingText:m("files.readingFile"),truncatedText:m("files.preview.truncated"),onReload:()=>b.reload(L.key),onModeChange:$=>b.setMode(L.key,$),onOpenWithSystem:y===null?null:()=>y(L.key),onInsert:()=>S(L.key),onOpenLink:T,initialScroll:b.scrollOf(L.key),onScrollChange:$=>b.rememberScroll(L.key,$),editor:b.editorFor(L.key),insertButton:o.jsx(Vo,{className:"icon-button",title:m("files.insertPath",{name:L.title}),onInsert:()=>S(L.key)})},L.key),w!==null&&o.jsx(Sd,{x:w.x,y:w.y,items:w.items,onClose:()=>h(null)})]});const F=i.get(""),W=_.trim();return o.jsxs("div",{className:"panel-body",children:[P,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(Vo,{className:"icon-button",title:m("files.insertFolderPath"),onInsert:()=>S("")}),o.jsx("button",{className:k?"icon-button icon-button-on":"icon-button",onClick:E,title:m(k?"files.hidden.hide":"files.hidden.show"),children:o.jsx(vT,{open:k})}),y!==null&&o.jsx("button",{className:"icon-button",onClick:()=>y(""),title:m("files.revealFolder"),children:o.jsx(eh,{})}),o.jsx("button",{className:"icon-button",onClick:f,title:m("files.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"tree-search",children:[o.jsx("input",{className:"tree-search-input",value:_,placeholder:m("files.search.placeholder"),onChange:$=>d($.target.value),onKeyDown:$=>{$.key==="Escape"&&_.length>0&&($.stopPropagation(),d(""))}}),_.length>0&&o.jsx("button",{className:"tree-search-clear",onClick:()=>d(""),title:m("files.search.clear"),children:"×"})]}),o.jsx("div",{className:"panel-scroll",children:W.length>0?o.jsx(kT,{view:I,onContextMenu:j,onReveal:y,onInsertPath:S}):F===void 0?o.jsx("p",{className:"panel-note",children:a.has("")?m("files.readingDir"):m("files.readDirFailed")}):o.jsx(a_,{path:"",depth:0,view:I,onContextMenu:j,onReveal:y,onInsertPath:S})}),w!==null&&o.jsx(Sd,{x:w.x,y:w.y,items:w.items,onClose:()=>h(null)})]})}function kT({view:t,onContextMenu:e,onReveal:s,onInsertPath:l}){const{results:c,searching:y,openFile:b,toggleDirectory:i}=t;return c===null?o.jsx("p",{className:"panel-note",children:m(y?"files.search.searching":"files.search.prompt")}):c.entries.length===0?o.jsx("p",{className:"panel-note",children:m("files.search.none")}):o.jsxs("ul",{className:"tree tree-results",children:[c.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:f=>e(f,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:yn(a.sizeBytes)})]}),o.jsx(Vo,{className:"tree-action",title:m("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:m("files.reveal",{name:a.name}),children:o.jsx(eh,{})})]})},a.path)),c.truncated&&o.jsx("li",{className:"tree-hidden",title:m("files.search.moreTitle"),children:m("files.search.more")})]})}function a_({path:t,depth:e,view:s,onContextMenu:l,onReveal:c,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:m("files.loading")}):null:o.jsxs("ul",{className:"tree",children:[a.entries.map(f=>o.jsx(CT,{entry:f,depth:e,view:s,onContextMenu:l,onReveal:c,onInsertPath:y},f.path)),a.entries.length===0&&o.jsx("li",{className:"tree-empty",style:{paddingLeft:`${e*12+8}px`},children:a.hiddenCount>0?m("files.allHidden"):m("files.empty")}),(a.truncated||a.hiddenCount>0)&&a.entries.length>0&&o.jsx("li",{className:"tree-hidden",style:{paddingLeft:`${e*12+8}px`},title:m("files.hiddenTitle"),children:a.truncated?m("files.moreEntries"):m("files.hiddenCount",{count:a.hiddenCount})})]})}function CT({entry:t,depth:e,view:s,onContextMenu:l,onReveal:c,onInsertPath:y}){const{expanded:b,toggleDirectory:i,openFile:a}=s,f=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"?m("files.row.ignored"):m("files.row.alwaysHidden")}`,children:[o.jsx("span",{className:`tree-chevron${f?" 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:yn(t.sizeBytes)})]}),o.jsx(Vo,{className:"tree-action",title:m("files.insertPath",{name:t.name}),onInsert:()=>y(t.path)}),t.kind==="dir"&&c!==null&&o.jsx("button",{className:"tree-action",onClick:()=>c(t.path),title:m("files.reveal",{name:t.name}),children:o.jsx(eh,{})})]}),f&&o.jsx(a_,{path:t.path,depth:e+1,view:s,onContextMenu:l,onReveal:c,onInsertPath:y})]})}const c_={added:"A",modified:"M",deleted:"D",renamed:"R",copied:"C","type-changed":"T",untracked:"?",conflict:"!"},u_={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 Ba(t){const e=t.endsWith("/"),s=e?t.slice(0,-1):t,l=s.lastIndexOf("/"),c=l===-1?s:s.slice(l+1);return{dir:l===-1?"":s.slice(0,l+1),name:e?`${c}/`:c,isDirectory:e}}const xT=32;class d_{constructor(e=xT){Ut(this,"byTerminal",new Map);this.limit=e}enter(e,s){const l=this.byTerminal.get(e);return l===void 0?{value:s,stale:!1}:{value:l,stale:!0}}store(e,s){for(this.byTerminal.delete(e),this.byTerminal.set(e,s);this.byTerminal.size>this.limit;){const l=this.byTerminal.keys().next();if(l.done===!0)break;this.byTerminal.delete(l.value)}}forget(e){this.byTerminal.delete(e)}}function ST(t,e,s){s.state==="ready"?t.store(e,s):t.forget(e)}const ET={openDiff:!1,refresh:!1,newBranch:!0,moveBranch:!0,openBranch:!1,viewChanges:!1,showReviewer:!1,requestReview:!0,sendReview:!0,catchUp:!0,integrate:!0,remove:!0,deleteBranch:!0};function TT(t,e){return ET[t]?t==="newBranch"||t==="moveBranch"?e.statusStale:e.statusStale||e.rowsStale:!1}function LT({view:t,onBack:e,onOpenDiff:s,onCloseDiff:l,onRequestReview:c}){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:Ba(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:m("git.readingDiff")}):o.jsx(s_,{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:["← ",m("git.backToChanges")]}),o.jsx("span",{className:"panel-subhead-title",title:b===null?t.branch:m("worktree.changes.title",{branch:b.branch,base:b.base}),children:b===null?t.branch:m("worktree.changes.title",{branch:b.branch,base:b.base})}),c!==null&&b!==null&&b.commitCount>0&&o.jsx("button",{className:"link-button",onClick:c,title:m("worktree.actions.reviewTitle"),children:m("worktree.actions.review")})]}),o.jsxs("div",{className:"panel-scroll",children:[y.phase==="loading"&&o.jsx("p",{className:"panel-note",children:m("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:m("worktree.changes.uncommitted",{count:b.uncommitted})}),b.commitCount===0&&b.files.length===0&&o.jsx("p",{className:"panel-note",children:m("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:[m("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:`${qd(i.at)} ${Fi(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:Jn(i.at)})]},i.sha))}),b.commitCount>b.commits.length&&o.jsx("p",{className:"panel-note",children:m("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:[m("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:f}=Ba(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:m(u_[i.kind]),children:c_[i.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:f}),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:m("worktree.changes.more",{count:b.fileCount-b.files.length})})]})]})]})]})}function h_(t,e,s){const l=t.worktree;if(l===null||l.branch===null)return null;if(l.linked)return l.branch;const c=Tr(l.mainCwd,s);return e.some(b=>{var i;return b.terminalId!==t.terminalId&&((i=b.worktree)==null?void 0:i.linked)===!0&&Tr(b.worktree.mainCwd,s)===c})?l.branch:null}function NT(t,e){const s=t.worktree;return s===null||e===null?null:s.linked?m("worktree.tab.linkedTitle",{branch:e,main:s.mainCwd}):m("worktree.tab.mainTitle",{branch:e})}function ks(t){return ad(t)}const RT={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 MT(t){return m(RT[t])}function AT(t,e,s,l){if(e.length===0)return null;const c=wb(e);if(c!==null)return MT(c);const y=t.branches.find(b=>b.name===e);return s==="new"&&y!==void 0?m("worktree.create.branchExists"):s==="existing"&&(y==null?void 0:y.checkedOut)===!0?m("worktree.create.branchInUse"):t.branches.some(b=>b.name===l)?null:m("worktree.create.baseMissing")}const IT={busy:"worktreeMoveBusy",waiting:"worktreeMoveWaiting",pending:"worktreeMovePending"};function jT(t){return t===null?null:Mt({key:IT[t]})}function f_(t,e){return t.kind==="agent"&&e&&t.sessionId.length>0&&t.worktree!==null}function DT(t,e,s){const l=t.find(c=>c.kind==="agent"&&c.agent===e.agent&&c.sessionId===e.sessionId);return l===void 0||l.agent===null?null:f_(l,s(l.agent))?l:null}function PT(t,e){var s;return e!==null&&t.branches.some(l=>l.name===e)?e:t.currentBranch??((s=t.branches[0])==null?void 0:s.name)??""}function p_(t,e){return`${t.parentDir}${t.separator}${Eg(e)}`}const OT=t=>/[\s"]/.test(t)?`"${t}"`:t;function BT(t,e,s,l){const c=OT(p_(t,e));return l==="new"?`git worktree add -b ${e} ${c} ${s}`:`git worktree add ${c} ${e}`}function Sa(t){return m("worktree.copy.summary",{count:t.files,size:yn(t.bytes)})}function FT(t){const e=[];return t.changes!==null&&t.changes>0&&e.push(m("worktree.rows.changes",{count:t.changes})),t.ahead!==null&&t.ahead>0&&e.push(m("worktree.rows.ahead",{count:t.ahead})),t.integrated===!0&&e.push(m("worktree.rows.integrated")),e.length===0&&t.changes===0&&e.push(m("worktree.rows.clean")),e}function HT(t){return[...t].sort((e,s)=>e.isMain!==s.isMain?e.isMain?-1:1:(e.branch??e.path).localeCompare(s.branch??s.path))}function Fm(t,e){const s=kn(t.map(l=>l.split("/").pop()??l));return e>t.length?`${s}…`:s}function UT(t){var s,l;const e=[];if(t.behind!==null&&t.behind>0&&t.base!==null){const c=[m("worktree.rows.behind",{base:t.base,count:t.behind})];((s=t.merge)==null?void 0:s.state)==="clean"&&c.push(m("worktree.rows.mergeClean")),((l=t.merge)==null?void 0:l.state)==="conflicts"&&c.push(m("worktree.rows.mergeConflicts",{count:t.merge.fileCount,list:Fm(t.merge.files,t.merge.fileCount)})),e.push(c.join(" · "))}for(const c of t.overlaps)e.push(m("worktree.rows.overlap",{branch:c.branch,list:Fm(c.files,c.fileCount)}));return e}const Hm={working:"worktree.review.stateWorking",pending:"worktree.review.statePending",ready:"worktree.review.stateReady",changes:"worktree.review.stateChanges",none:"worktree.review.stateNone"};function m_(t,e){const s=t.state==="done"?Hm[t.verdict??"none"]:Hm[t.state],l=m(s,{agent:e});return t.stale?m("worktree.review.stale",{text:l}):l}function WT(t){return t!==null&&t.state==="done"}function $T(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&&WT(t.review),catchUp:e&&t.base!==null&&(t.behind??0)>0,integrate:e&&t.base!==null&&s}}function zT(t){return t.base===null?null:t.ahead===0?m("worktree.integrate.blockerNothing",{base:t.base}):t.behind!==null&&t.behind>0?m("worktree.integrate.blockerBehind",{base:t.base}):null}function qT(t){switch(t.blocker){case"nothing":return m("worktree.integrate.blockerNothing",{base:t.base});case"behind":return m("worktree.integrate.blockerBehind",{base:t.base});case"no-base-folder":return m("worktree.integrate.blockerNoBase",{base:t.base});case"local-changes":return m("worktree.integrate.blockerLocal",{base:t.base,count:t.localConflicts.length,list:kn(t.localConflicts)});case null:return null}}function KT(t,e){var l;const s=((l=t.readOnlyLaunch)==null?void 0:l.guard)??null;return s==="cli"?m("worktree.review.guardCli",{agent:e}):s==="tools"?m("worktree.review.guardTools",{agent:e}):m("worktree.review.guardNone",{agent:e})}function VT(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 GT(t){return t.ahead===null?null:t.ahead===0?m("worktree.rows.integrated"):m("worktree.rows.notIntegrated",{count:t.ahead})}function YT(t){switch(t.blocker){case"checked-out":return m("worktree.deleteBranch.checkedOut",{branch:t.branch});case"not-integrated":return t.ahead===null?m("worktree.deleteBranch.noBase",{base:t.base}):m("worktree.deleteBranch.notIntegrated",{count:t.ahead,base:t.base});case null:return null}}function el(t,e){var s;return((s=t.untracked)==null?void 0:s.stamp)!=null&&e!==null&&t.untracked.stamp===e}function XT(t,e=null){return t.uncommittedCount>0&&!el(t,e)?"uncommitted":t.inUse===!0?"in-use":t.conflicts.length>0?"conflicts":null}function g_(t,e=null){switch(XT(t,e)){case"uncommitted":return"ask-commit";case"in-use":return"retry";case"conflicts":return"ask-notes";case null:return"remove"}}function QT(t,e){var s;return t.uncommittedCount>0&&((s=t.untracked)==null?void 0:s.stamp)!=null&&!el(t,e)}const JT={"nested-repo":"worktree.remove.untrackedNestedRepo","too-many":"worktree.remove.untrackedTooMany",copied:"worktree.remove.untrackedCopied"};function ZT(t,e){const s=t.untracked;return t.uncommittedCount===0||s===null?null:s.blocked!==null?m(JT[s.blocked],{max:Cb}):el(t,e)?m("worktree.remove.untrackedAccepted"):m("worktree.remove.untracked",{count:s.files,size:yn(s.bytes)})}function eL(t){if(t.holders.length===0)return m("worktree.remove.inUse");const e=[];for(const l of t.holders){const c=l.name.toLowerCase().replace(/\.exe$/,""),y=l.description!==null&&l.description.toLowerCase()!==c?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=kn(e.map(({exe:l,program:c,pids:y})=>{const b={exe:l,pids:kn(y.map(String))};return c===null?m("worktree.remove.holderExe",b):m("worktree.remove.holder",{...b,program:c})}));return m("worktree.remove.inUseBy",{count:e.length,list:s})}function tL(t){return`${kn(t.uncommitted)}${t.uncommittedCount>t.uncommitted.length?"…":""}`}function nL(t){const{branch:e}=t;return t.deletesBranch?t.branchUnused?m("worktree.remove.deletesUnusedBranch",{branch:e}):m("worktree.remove.deletesBranch",{branch:e}):t.createdBranch?m("worktree.remove.keepsBranch",{branch:e}):m("worktree.remove.keepsExistingBranch",{branch:e})}const rL=[{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 sL({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?m("git.detachedAt",{head:t.head}):m("git.detached"))}),t.upstream!==null&&o.jsx("span",{className:"git-upstream",title:m("git.upstreamTitle",{upstream:t.upstream}),children:t.upstream}),(t.ahead>0||t.behind>0)&&o.jsxs("span",{className:"git-ab",title:m("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 iL(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 oL({row:t,worktrees:e,waiting:s}){const l=FT(t),c=UT(t),y=t.id,b=y!==null&&!t.isMain?{...t,id:y}:null,i=$T(t),a=zT(t),f=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??m("git.worktrees.detached"),t.isMain&&o.jsx("span",{className:"git-worktree-main",children:m("worktree.rows.main")}),t.isCurrent&&o.jsx("span",{className:"git-worktree-main",children:m("worktree.rows.current")})]}),l.length>0&&o.jsx("span",{className:"git-worktree-state",children:l.join(" · ")}),c.map(_=>o.jsx("span",{className:"git-worktree-team",children:_},_)),f!==null&&o.jsxs("span",{className:`git-worktree-review${iL(t)}`,children:[m_(f,e.agentLabel(f.agent)),f.terminalId!==null&&o.jsx("button",{className:"link-button",onClick:()=>{f.terminalId!==null&&e.onShowReviewer(f.terminalId)},title:m("worktree.actions.showReviewerTitle"),children:m("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:m("worktree.rows.openTitle"),children:m("worktree.rows.open")}),b!==null&&i.viewChanges&&o.jsx("button",{className:"link-button",onClick:()=>e.onViewChanges(b),title:m("worktree.actions.viewChangesTitle"),children:m("worktree.actions.viewChanges")}),b!==null&&i.review&&o.jsx("button",{className:"link-button",onClick:()=>e.onRequestReview(b),disabled:s.waits("requestReview"),title:s.title("requestReview",m("worktree.actions.reviewTitle")),children:m("worktree.actions.review")}),b!==null&&i.sendReview&&o.jsx("button",{className:"link-button",onClick:()=>e.onSendReview(b),disabled:s.waits("sendReview"),title:s.title("sendReview",m("worktree.actions.sendReviewTitle")),children:m("worktree.actions.sendReview")}),b!==null&&i.catchUp&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onCatchUp(b),disabled:s.waits("catchUp"),title:s.title("catchUp",m("worktree.actions.catchUpTitle",{base:t.base})),children:m("worktree.actions.catchUp")}),b!==null&&i.integrate&&t.base!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onIntegrate(b),disabled:a!==null||s.waits("integrate"),title:s.title("integrate",a??m("worktree.actions.integrateTitle",{base:t.base})),children:m("worktree.actions.integrate",{base:t.base})}),b!==null&&o.jsx("button",{className:"link-button",onClick:()=>e.onRemove(b),disabled:s.waits("remove"),title:s.title("remove",m("worktree.rows.removeTitle")),children:m("worktree.rows.remove")})]})]})})}function lL({kept:t,worktrees:e,waiting:s}){const l=GT(t);return o.jsx("li",{children:o.jsxs("div",{className:"git-worktree",title:m("worktree.rows.keptTitle"),children:[o.jsxs("span",{className:"git-worktree-branch",children:[t.branch,o.jsx("span",{className:"git-worktree-main",children:m("worktree.rows.kept")})]}),l!==null&&o.jsx("span",{className:"git-worktree-state",children:l}),o.jsx("span",{className:"git-worktree-actions",children:o.jsx("button",{className:"link-button",onClick:()=>e.onDeleteBranch(t),disabled:s.waits("deleteBranch"),title:s.title("deleteBranch",m("worktree.rows.deleteBranchTitle")),children:m("worktree.rows.deleteBranch")})})]})})}function aL({view:t,worktrees:e}){const{status:s,diff:l,loadingDiff:c,openDiff:y,closeDiff:b,refresh:i}=t,a={statusStale:t.stale,rowsStale:e.rowsStale},f=E=>TT(E,a),_={waits:f,title:(E,M)=>f(E)?m("git.waitingTitle"):M};if(e.changes!==null){const E=e.changes,M=e.rows.find(w=>w.id===E.worktreeId)??null;return o.jsx(LT,{view:E,onBack:e.onCloseChanges,onOpenDiff:e.onOpenChangeDiff,onCloseDiff:e.onCloseChangeDiff,onRequestReview:M===null||M.id===null||f("requestReview")?null:()=>e.onRequestReview({...M,id:E.worktreeId})})}if(l!==null||c)return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsxs("button",{className:"link-button",onClick:b,children:["← ",m("git.backToChanges")]}),l!==null&&o.jsxs("span",{className:"panel-subhead-title",title:l.path,children:[Ba(l.path).name,l.staged&&o.jsxs("span",{className:"panel-tagline",children:[" ",m("git.stagedTag")]})]})]}),c?o.jsx("p",{className:"panel-note",children:m("git.readingDiff")}):l!==null&&o.jsx(s_,{diff:l})]});if(s.state!=="ready")return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:s.message===null?m("git.unknownState"):Mt(s.message)})});const d=HT(e.rows).filter(E=>!(E.isCurrent&&E.isMain)),k=d.some(E=>!E.isMain)||e.kept.length>0;return o.jsxs("div",{className:`panel-body${t.stale?" git-stale":""}`,"aria-busy":t.stale,children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx(sL,{status:s}),t.stale&&o.jsx("span",{className:"git-updating",children:m("git.updating")}),o.jsx("button",{className:"icon-button",onClick:e.onNew,disabled:f("newBranch"),title:_.title("newBranch",m("worktree.new")),"aria-label":m("worktree.new"),children:o.jsx(wd,{})}),e.onMove!==null&&o.jsx("button",{className:"icon-button",onClick:e.onMove,disabled:f("moveBranch"),title:_.title("moveBranch",m("worktree.move.title")),"aria-label":m("worktree.move.title"),children:o.jsx(Gd,{})}),o.jsx("button",{className:"icon-button",onClick:i,title:m("git.refresh"),children:"⟳"})]}),o.jsxs("div",{className:"panel-scroll",children:[s.changes.length===0&&o.jsx("p",{className:"panel-note",children:m("git.clean")}),rL.map(E=>{const M=s.changes.filter(w=>w.stage===E.stage);return M.length===0?null:o.jsxs("section",{className:"git-group",children:[o.jsxs("h3",{className:"git-group-title",title:m(E.hint),children:[m(E.title),o.jsx("span",{className:"git-group-count",children:M.length})]}),o.jsx("ul",{className:"git-list",children:M.map(w=>{const{dir:h,name:v,isDirectory:g}=Ba(w.path),p=w.oldPath!==null?`${w.oldPath} → ${w.path}`:g?m("git.newFolderTitle",{path:w.path}):w.path,S=o.jsxs(o.Fragment,{children:[o.jsx("span",{className:`git-badge git-badge-${w.kind}`,title:m(u_[w.kind]),children:c_[w.kind]}),o.jsxs("span",{className:"git-path",children:[o.jsx("span",{className:"git-path-name",children:v}),h.length>0&&o.jsx("span",{className:"git-path-dir",children:h})]})]});return o.jsx("li",{children:g?o.jsx("div",{className:"git-item git-item-static",title:p,children:S}):o.jsx("button",{className:"git-item",onClick:()=>y(w.path,w.stage==="staged"),title:p,children:S})},`${E.stage}:${w.path}`)})})]},E.stage)}),s.truncated&&o.jsx("p",{className:"panel-note",children:fn("git.truncated")}),k&&o.jsxs("section",{className:`git-group${e.rowsStale?" git-stale-rows":""}`,children:[o.jsxs("h3",{className:"git-group-title",title:m("worktree.rows.headingTitle"),children:[m("worktree.rows.heading"),o.jsx("span",{className:"git-group-count",children:d.length+e.kept.length})]}),o.jsxs("ul",{className:"git-list",children:[d.map(E=>o.jsx(oL,{row:E,worktrees:e,waiting:_},E.path)),e.kept.map(E=>o.jsx(lL,{kept:E,worktrees:e,waiting:_},E.id))]})]})]})]})}const cL={create:"memory.action.create","append-block":"memory.action.appendBlock","replace-block":"memory.action.replaceBlock","append-lines":"memory.action.appendLines",copy:"memory.action.copy"},uL={"AGENTS.md":["Codex","Antigravity","OpenCode","Pi"],"CLAUDE.md":["Claude Code"]};function $a(t){return t.brokenBlock||t.problem!==null}function dL(t){return t.problem==="outside"?m("memory.problem.outside"):t.problem==="encoding"?m("memory.problem.encoding"):t.brokenBlock?m("memory.problem.brokenBlock"):null}function hL(t){const e=t.files.filter(s=>!$a(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}:{...q0(t),instructionFiles:e.map(s=>s.name)}}function fL(t){const e=t.files.filter(c=>c.hasBlock&&!c.blockCurrent),s=t.files.filter(c=>c.exists&&!c.hasBlock&&!$a(c)),l=c=>kn(c.map(y=>y.name));return e.length===0?s.length===0?null:m("memory.update.missing",{files:l(s)}):s.length===0?m("memory.update.outdated",{count:e.length,files:l(e)}):m("memory.update.outdatedAndMissing",{count:e.length,outdated:l(e),missing:l(s)})}function pL(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 mL(t){return t.split(/`([^`]+)`/).map((e,s)=>s%2===1?o.jsx("code",{children:e},s):e)}function gL({view:t}){var h;const{status:e,open:s,loading:l,error:c,closeNote:y,openNote:b}=t,[i,a]=N.useState(null),[f,_]=N.useState(!1),d=(e==null?void 0:e.cwd)??null;N.useEffect(()=>{a(null),_(!1)},[d]),N.useEffect(()=>{t.lastResult!==null&&(a(null),_(!1))},[t.lastResult]);const k=N.useCallback(v=>{if(e===null)return null;let g=v.replace(/^\.\//,"");try{g=decodeURIComponent(g)}catch{return null}return g===Aa||e.notes.some(S=>S.name===g)?()=>b(g):null},[e,b]);if(e===null)return o.jsx("div",{className:"panel-body",children:o.jsx("p",{className:"panel-note",children:c??m("memory.loading")})});if(s!==null||l!==null){const v=(s==null?void 0:s.name)??l??"",g=v===Aa?m("memory.index"):((h=e.notes.find(p=>p.name===v))==null?void 0:h.title)??v;return o.jsxs("div",{className:"panel-body",children:[o.jsxs("div",{className:"panel-subhead",children:[o.jsx("button",{className:"link-button",onClick:y,children:m("memory.back")}),o.jsx("span",{className:"panel-subhead-title",title:v,children:g})]}),s===null?o.jsx("p",{className:"panel-note",children:m("memory.note.loading")}):o.jsxs("div",{className:"panel-scroll",children:[o.jsx("div",{className:"plan-body",children:o.jsx(Xd,{text:pL(s.text),localLink:k})}),s.truncated&&o.jsx("p",{className:"panel-note",children:m("memory.note.truncated")})]})]})}const E=i??hL(e),M=e.installed?fL(e):null,w=!e.installed||f||t.planned!==null;return o.jsxs("div",{className:"panel-body",children:[o.jsx(vL,{reach:e.reach,onAdjust:e.installed&&!w&&M===null&&e.reach.some(v=>!v.reaches)?()=>_(!0):null}),o.jsxs("div",{className:"panel-scroll",children:[(c??t.lastResult)!==null&&o.jsxs("div",{className:`memory-message${c!==null?" memory-message-error":""}`,children:[o.jsx("span",{children:c??t.lastResult}),o.jsx("button",{className:"link-button",onClick:t.dismissMessage,title:m("common.dismissNotice"),children:"×"})]}),e.git.kind==="error"&&o.jsxs("div",{className:"memory-warning",children:[o.jsx("p",{className:"memory-warning-line",children:fn("memory.git.errorWarning")}),o.jsx("pre",{className:"memory-git-message",children:Mt(e.git.message)})]}),e.files.filter($a).map(v=>o.jsx("p",{className:"memory-warning",children:v.problem==="outside"?fn("memory.problem.outsideWarning",{file:v.name}):v.problem==="encoding"?fn("memory.problem.encodingWarning",{file:v.name}):fn("memory.problem.brokenBlockWarning",{file:v.name})},v.name)),!e.installed&&o.jsxs("div",{className:"memory-intro",children:[o.jsx("p",{children:m("memory.intro.what")}),o.jsx("p",{children:fn("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:m("memory.update.button")})]}),w&&(t.planned===null?o.jsx(_L,{status:e,options:E,busy:t.busy,onChange:a,onPlan:()=>{a(E),t.requestPlan(E)},onCancel:e.installed?()=>{_(!1),a(null)}:null}):o.jsx(wL,{changes:t.planned,busy:t.busy,confirmLabel:e.installed?m("memory.plan.update"):m("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:m("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"?m("memory.native.importing"):m("memory.native.import",{count:e.native.pending})})]}),e.installed&&o.jsx(bL,{notes:e.notes,indexExists:e.indexExists,onOpen:b}),e.globalFragments.length>0&&o.jsx(yL,{fragments:e.globalFragments})]})]})}function vL({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:m("memory.reach.title",{label:s.label,via:Mt(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?m("memory.reach.reaches",{via:Mt(s.via)}):m("memory.reach.doesNotReach",{via:Mt(s.via)})})]},s.agent)),e!==null&&o.jsx("button",{className:"link-button memory-reach-adjust",onClick:e,title:m("memory.reach.adjustTitle"),children:m("memory.reach.adjust")})]})}function _L({status:t,options:e,busy:s,onChange:l,onPlan:c,onCancel:y}){const{git:b}=t,i=b.kind==="repo"?b.worktree:null,a=b.kind==="error"&&e.gitMode==="ignore",f=(_,d)=>{const k=new Set(e.instructionFiles);d?k.add(_):k.delete(_),l({...e,instructionFiles:Fd.filter(E=>k.has(E))})};return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:m("memory.form.files")}),t.files.map(_=>o.jsxs("label",{className:"memory-option",title:dL(_)??void 0,children:[o.jsx("input",{type:"checkbox",checked:e.instructionFiles.includes(_.name),disabled:$a(_),onChange:d=>f(_.name,d.target.checked)}),o.jsx("code",{children:_.name}),o.jsx("span",{className:"memory-option-hint",children:kn(uL[_.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"})}),m("memory.git.ignore"),o.jsx("span",{className:"memory-option-hint",children:m("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"})}),m("memory.git.version"),o.jsx("span",{className:"memory-option-hint",children:m("memory.git.versionHint")})]}),b.ignored&&e.gitMode==="version"&&o.jsx("p",{className:"memory-warning",children:fn("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"})}),fn("memory.git.dontTouch"),o.jsx("span",{className:"memory-option-hint",children:m("memory.git.errorHint")})]})]}),(t.native.pending>0||(i==null?void 0:i.mainHasMemory)===!0)&&o.jsx("p",{className:"memory-section-label",children:m("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})}),m("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})}),m("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:c,title:e.instructionFiles.length===0?m("memory.form.noFiles"):a?m("memory.git.blocked"):void 0,children:m(s==="plan"?"memory.form.planning":"memory.form.preview")}),y!==null&&o.jsx("button",{className:"link-button",onClick:y,disabled:s!==null,children:m("common.cancel")})]})]})}function wL({changes:t,busy:e,confirmLabel:s,onConfirm:l,onCancel:c}){const y=e==="install";return o.jsxs("div",{className:"memory-form",children:[o.jsx("p",{className:"memory-section-label",children:m("memory.plan.changes")}),t.length===0?o.jsx("p",{className:"memory-empty",children:m("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:m(cL[b.action])})]}),b.copiedFrom!==null&&o.jsx("p",{className:"memory-option-hint",children:m("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?m("memory.plan.writing"):s}),o.jsx("button",{className:"link-button",onClick:c,disabled:y,children:t.length===0?m("memory.plan.back"):m("common.cancel")})]})]})}function bL({notes:t,indexExists:e,onOpen:s}){return o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"memory-section-label",children:m("memory.list.notes")}),o.jsxs("ul",{className:"plan-list",children:[e&&o.jsx("li",{children:o.jsxs("button",{className:"plan-row",onClick:()=>s(Aa),children:[o.jsx("span",{className:"plan-name",children:m("memory.index")}),o.jsx("span",{className:"plan-meta",children:Aa})]})}),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:[Jn(l.modifiedAt)," · ",yn(l.sizeBytes)]})]})},l.name))]}),t.length===0&&o.jsx("p",{className:"memory-empty",children:m("memory.list.empty")})]})}function yL({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:m("memory.global.title")}),o.jsx("p",{className:"memory-empty",children:fn("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(bT,{className:"icon-button",title:m("memory.global.copy"),onCopy:()=>e(s.text)})]}),o.jsx("p",{className:"memory-fragment-note",children:mL(Mt(s.note))})]},s.agent))]})}function kL(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 CL({view:t,docs:e,onInsertPath:s}){const{plans:l}=t,c=e.active===null?null:e.docs.find(f=>f.key===e.active)??null,y=c===null?void 0:e.content(c.key),b=c!==null&&y===void 0&&t.listFor!==null&&t.listFor===e.terminalId;N.useEffect(()=>{b&&c!==null&&e.reload(c.key)},[b,c==null?void 0:c.key]),N.useEffect(()=>{if(c===null||!c.key.startsWith("codex-plan:")||t.listFor!==e.terminalId||l.some(_=>_.fileName===c.key))return;const f=l.find(_=>_.fileName.startsWith("codex-plan:"));f!==void 0&&(e.close(c.key),e.open({key:f.fileName,title:f.title}))},[c==null?void 0:c.key,t.listFor,e.terminalId,l]);const i=f=>{var d;const _=(d=e.content(f.key))==null?void 0:d.loaded;return(_==null?void 0:_.kind)==="plan"?kL(_.plan.text)??f.title:f.title},a=f=>{var d;const _=((d=l.find(k=>k.fileName===f.key))==null?void 0:d.path)??"";return _.length>0?_:i(f)};return o.jsxs("div",{className:"panel-body",children:[e.docs.length>0&&o.jsx(r_,{listLabel:m("panel.tab.plans"),docs:e.docs,active:e.active,tooltipOf:a,labelOf:i,onShowList:e.showList,onSelect:e.select,onClose:e.close}),c!==null?o.jsx(o_,{doc:c,content:y,readingText:m("plans.loading"),truncatedText:m("plans.truncated"),onReload:()=>e.reload(c.key),onModeChange:f=>e.setMode(c.key,f),onOpenWithSystem:null,initialScroll:e.scrollOf(c.key),onScrollChange:f=>e.rememberScroll(c.key,f)},c.key):o.jsx("div",{className:"panel-scroll",children:l.length===0?o.jsx("p",{className:"panel-note",children:fn("plans.empty")}):o.jsx("ul",{className:"plan-list",children:[...l].reverse().map(f=>o.jsx(xL,{plan:f,onOpen:()=>e.open({key:f.fileName,title:f.title}),onInsertPath:s},f.fileName))})})]})}function xL({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:[t.modifiedAt>0?`${Jn(t.modifiedAt)} · `:"",yn(t.sizeBytes)]})]}),t.absolutePath.length>0&&o.jsx(Vo,{className:"tree-action plan-action",title:m("files.insertPath",{name:t.absolutePath.split(/[\\/]/).pop()??t.title}),onInsert:()=>s(`"${t.absolutePath}"`)})]}):o.jsxs("li",{className:"plan-row plan-row-missing",title:l??m("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:m("plans.missing")})]})}const SL=[{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 v_(t){return t.state!=="ready"?0:new Set(t.changes.map(e=>e.path)).size}function EL({tab:t,plansAvailable:e,hiddenTabs:s,hidden:l,onTabChange:c,title:y,cwd:b,colorCwd:i,platform:a,cli:f,cliUnseen:_,expanded:d,onToggleExpanded:k,git:E,worktrees:M,files:w,plans:h,documents:v,memory:g,onInsert:p,onInsertPath:S,onReveal:j,onHide:L}){var T;const R=v_(E.status),x=((T=g.status)==null?void 0:T.installed)===!0?g.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:L,title:m("panel.hide"),children:"»"}),b.length>0&&o.jsx("span",{className:"project-swatch",style:{background:Js(i)}}),o.jsx("span",{className:"side-panel-title",title:b,children:y}),o.jsx("button",{className:"icon-button",onClick:k,title:m(d?"panel.restoreWidth":"panel.widen"),children:d?"⇥":"⇤"})]}),o.jsx("nav",{className:"side-panel-tabs",children:Ek(SL,e,s).map(I=>o.jsxs("button",{className:`side-panel-tab${I.id===t?" side-panel-tab-active":""}`,onClick:()=>c(I.id),title:m(I.labelKey),children:[o.jsx("span",{className:"side-panel-tab-label",children:m(I.labelKey)}),I.id==="git"&&R>0&&o.jsx("span",{className:"side-panel-badge",children:R}),I.id==="plans"&&h.plans.length>0&&o.jsx("span",{className:"side-panel-badge",children:h.plans.length}),I.id==="memory"&&x>0&&o.jsx("span",{className:"side-panel-badge",children:x}),I.id==="cli"&&_&&t!=="cli"&&o.jsx("span",{className:"side-panel-dot",title:m("panel.cliUnseen")})]},I.id))}),o.jsxs("div",{className:"side-panel-body",children:[o.jsx("div",{className:`cli-slot${t==="cli"?"":" cli-slot-hidden"}`,children:f}),t==="git"&&o.jsx(aL,{view:E,worktrees:M}),t==="plans"&&o.jsx(CL,{view:h,docs:v.plans,onInsertPath:S}),t==="memory"&&o.jsx(gL,{view:g}),t==="files"&&o.jsx(yT,{view:w,cwd:b,platform:a,onInsert:p,onInsertPath:S,onReveal:j,docs:v.files})]})]})}function __({messages:t}){return o.jsx("span",{className:`tab-scheduled${px(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 TL(t,e,s,l=null){const c=e===void 0||e.length===0?t:`${t} — ${e}`;return l===null?`${c}
150
- ${s}`:`${c}
151
- ${l}
152
- ${s}`}function LL(t,e){const s=[NT(t,e),t.review?m("worktree.tab.reviewTitle"):null].filter(l=>l!==null);return s.length===0?null:s.join(`
153
- `)}function NL({placement:t}){return o.jsxs("div",{className:"tab tab-pending","aria-busy":"true",title:`${t.pending.cwd}
154
- ${m("tabs.state.opening")}`,style:{"--tab-project-color":Js(t.pending.cwd)},children:[o.jsx("span",{className:"tab-opening","aria-label":m("tabs.aria.opening"),children:o.jsx("i",{})}),o.jsx("span",{className:"tab-label",children:t.label})]})}function th({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:m(l?"tabs.dot.sleeping":"tabs.dot.exited")})}return e==="waiting"?o.jsx("span",{className:"tab-bang",title:m("tabs.dot.waiting"),children:"!"}):e==="busy"?o.jsxs("span",{className:"tab-working",title:m("tabs.dot.busy"),"aria-label":m("tabs.aria.working"),children:[o.jsx("i",{}),o.jsx("i",{}),o.jsx("i",{})]}):o.jsx("span",{className:"tab-dot",title:Pk(e,s)})}function Go(t){var c;if(t.label.length>0)return t.label;const e=((c=t.worktree)==null?void 0:c.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 RL(t){return t.alive?m("tabs.state.alive"):t.sleeping?m("tabs.state.sleeping"):m("tabs.state.exited",{code:t.exitCode??"?"})}function ML({terminals:t,activeTerminalId:e,activity:s,attention:l,canOpen:c,onSelect:y,onClose:b,onRename:i,onReorder:a,onNew:f,agents:_,offerAgentChoice:d,newTabAgent:k,pendingOpens:E,platform:M,newTabBlockedTitle:w,sessionTitles:h,scheduled:v}){const[g,p]=N.useState(null),[S,j]=N.useState(""),[L,R]=N.useState(null),x=N.useRef(null);N.useEffect(()=>{var $;g!==null&&(($=x.current)==null||$.select())},[g]);const T=$=>{p($.terminalId),j($.label.length>0?$.label:Go($))},I=()=>{g!==null&&i(g,S.trim()),p(null)},O=$=>{if(L===null||L===$)return;const K=t.map(D=>D.terminalId),G=K.indexOf(L),q=K.indexOf($);G===-1||q===-1||(K.splice(q,0,...K.splice(G,1)),a(K),R(null))},P=aC(t,E,M),F=new Map;for(const $ of P){const K=F.get($.index);K===void 0?F.set($.index,[$]):K.push($)}const W=$=>(F.get($)??[]).map(K=>o.jsx(NL,{placement:K},`pending:${K.pending.requestId}`));return o.jsxs("div",{className:"tab-bar",children:[t.map(($,K)=>{var Z;const G=$.terminalId===e,q=$.terminalId===g,D=h_($,t,M),U=(v==null?void 0:v.get($.terminalId))??[],H=_v(U),z=[LL($,D),H].filter(ie=>ie!==null);return o.jsxs(Ww.Fragment,{children:[W(K),o.jsx("div",{className:`tab${G?" tab-active":""}${$.alive||$.sleeping?"":" tab-dead"}${(l==null?void 0:l.has($.terminalId))===!0?" tab-attention":""}`,draggable:!q,onDragStart:()=>R($.terminalId),onDragOver:ie=>ie.preventDefault(),onDrop:()=>O($.terminalId),onDragEnd:()=>R(null),onClick:()=>y($.terminalId),onDoubleClick:()=>T($),title:TL($.cwd,h.get($.terminalId),RL($),z.length===0?null:z.join(`
155
- `)),style:{"--tab-project-color":Js(ks($))},children:q?o.jsx("input",{ref:x,className:"tab-input",value:S,onChange:ie=>j(ie.target.value),onBlur:I,onKeyDown:ie=>{ie.key==="Enter"&&I(),ie.key==="Escape"&&p(null),ie.stopPropagation()},onClick:ie=>ie.stopPropagation()}):o.jsxs(o.Fragment,{children:[o.jsx(th,{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&&Yk(d,$.agent)&&o.jsx(xd,{agent:$.agent,agents:_}),$.review&&o.jsx("span",{className:"tab-review",children:m("worktree.tab.review")}),D!==null&&o.jsx("span",{className:"tab-branch",children:D}),U.length>0&&o.jsx(__,{messages:U}),Go($)]}),o.jsx("button",{className:"tab-close",onClick:ie=>{ie.stopPropagation(),b($.terminalId)},title:m("tabs.close"),children:"×"})]})})]},$.terminalId)}),W(t.length),o.jsx(Jd,{className:"tab-new",text:"+",title:w??m("tabs.new"),disabled:!c||w!==null,offerAgentChoice:d,agents:_,agent:k,onOpen:f})]})}function AL(t,e,s){const[l,c]=N.useState(!1);return N.useEffect(()=>{if(c(!1),!(e===null||s))return t.onMessage(y=>{y.type==="terminal.output"&&y.terminalId===e&&c(!0)})},[t,e,s]),l&&!s}const IL=200,Um="agent-workbench.files.hidden";function jL(t,e,s=null){const[l,c]=N.useState(new Map),[y,b]=N.useState(new Set),[i,a]=N.useState(new Set),[f,_]=N.useState(""),[d,k]=N.useState(null),[E,M]=N.useState(!1),[w,h]=N.useState(()=>jt(Um,!1,R=>R==="true"?!0:R==="false"?!1:null)),v=N.useRef(new Set),g=N.useRef(w);g.current=w;const p=N.useCallback(R=>{e===null||v.current.has(R)||(v.current.add(R),a(x=>new Set(x).add(R)),t.send({type:"files.list",terminalId:e,path:R,includeHidden:g.current}))},[t,e]);N.useEffect(()=>{if(c(new Map),b(new Set),a(new Set),_(""),k(null),M(!1),v.current=new Set,e===null)return;const R=t.onMessage(T=>{switch(T.type){case"files.listing":{if(T.terminalId!==e)break;const{listing:I}=T;v.current.delete(I.path),c(O=>new Map(O).set(I.path,I)),a(O=>{const P=new Set(O);return P.delete(I.path),P});break}case"files.results":if(T.terminalId!==e)break;k(T.result),M(!1);break;case"error":v.current=new Set,a(new Set),M(!1);break}});t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current}),v.current.add(""),a(new Set([""]));const x=t.onReopen(()=>{v.current=new Set,t.send({type:"files.list",terminalId:e,path:"",includeHidden:g.current})});return()=>{R(),x()}},[t,e,s]),N.useEffect(()=>{const R=f.trim();if(e===null||R.length===0){k(null),M(!1);return}M(!0);const x=window.setTimeout(()=>{t.send({type:"files.search",terminalId:e,query:R,includeHidden:g.current})},IL);return()=>window.clearTimeout(x)},[t,e,f,w]);const S=N.useCallback(R=>{b(x=>{const T=new Set(x);return T.has(R)?T.delete(R):(T.add(R),p(R)),T})},[p]),j=N.useCallback(()=>{if(e===null)return;v.current=new Set;const R=["",...y];for(const x of R)v.current.add(x),t.send({type:"files.list",terminalId:e,path:x,includeHidden:g.current});a(new Set(R))},[t,e,y]),L=N.useCallback(()=>{h(R=>{const x=!R;if(g.current=x,Lt(Um,String(x)),e!==null){v.current=new Set;const T=["",...y];for(const I of T)v.current.add(I),t.send({type:"files.list",terminalId:e,path:I,includeHidden:x});a(new Set(T))}return x})},[t,e,y]);return{listings:l,expanded:y,loading:i,query:f,setQuery:_,results:d,searching:E,showHidden:w,toggleHidden:L,toggleDirectory:S,refresh:j}}function DL(t){const[e,s]=N.useState(!1),[l,c]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),f=N.useRef(null);N.useEffect(()=>{const k=t.onMessage(M=>{switch(M.type){case"search.progress":if(f.current===null||M.searchId!==f.current)break;c(w=>bE(w,M.progress));break;case"search.results":if(f.current===null||M.searchId!==f.current)break;f.current=null,c(M.result),b(null),s(!1);break;case"error":if(M.code!=="search-failed"||f.current===null||M.requestId!==f.current)break;f.current=null,M.detail!==void 0&&console.error("[servidor]",M.detail),c(null),b(Mt(M.text)),s(!1);break}}),E=t.onReopen(()=>{f.current!==null&&(f.current=null,s(!1),b(m("searchHook.connectionLost")))});return()=>{k(),E()}},[t]);const _=N.useCallback((k,E)=>{const M=crypto.randomUUID();f.current=M,a({query:k,includeArchived:E}),s(!0),b(null),c(null),t.send({type:"search.global",searchId:M,query:k,includeArchived:E})},[t]),d=N.useCallback(()=>{const k=f.current;f.current=null,k!==null&&t.send({type:"search.cancel",searchId:k}),a(null),s(!1),c(null),b(null)},[t]);return{searching:e,result:l,error:y,submitted:i,search:_,clear:d}}function PL(t,e){const[s,l]=N.useState([]),[c,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:c}}const w_=8,b_=1024,OL=300,BL=["file","plan"],Fa={docs:[],active:null,recent:[]},Yo={};function Ha(t,e){return[...t.filter(s=>s!==e),e]}function FL(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:Ha(t.recent,e.key)};let c=[...t.docs,{key:e.key,title:e.title}],y=Ha(t.recent,e.key);for(;c.length>w_;){const b=y.find(i=>i!==e.key&&!s.has(i));if(b===void 0)break;c=c.filter(i=>i.key!==b),y=y.filter(i=>i!==b)}return{docs:c,active:e.key,recent:y}}function Wm(t,e){return t.docs.some(s=>s.key===e)?{...t,active:e,recent:Ha(t.recent,e)}:t}function HL(t){return t.active===null?t:{...t,active:null}}function UL(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),c=t.recent.filter(b=>b!==e);if(t.active!==e)return{docs:l,active:t.active,recent:c};const y=l[s]??l[s-1]??null;return{docs:l,active:y===null?null:y.key,recent:y===null?c:Ha(c,y.key)}}function WL(t,e,s){return{...t,docs:t.docs.map(l=>l.key===e?{...l,mode:s}:l)}}function zu(t,e,s){var l;return((l=t[e])==null?void 0:l[s])??Fa}function $L(t,e,s,l){const c=t[e]??{file:Fa,plan:Fa};return{...t,[e]:{...c,[s]:l}}}function zL(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 c={...t};for(const y of l)delete c[y];return c}function bs(t,e,s){return`${t}\0${e}\0${s}`}function qL(t){const e=new Set;for(const[s,l]of Object.entries(t))for(const c of BL)for(const y of l[c].docs)e.add(bs(s,c,y.key));return e}function KL(t){return JSON.stringify(t)}function Ua(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:null}function VL(t){const e=Ua(t);if(e===null)return null;const{key:s,title:l,mode:c}=e;if(typeof s!="string"||s.length===0||s.length>b_||typeof l!="string"||l.length>OL)return null;const y={key:s,title:l};return c==="formatted"||c==="source"?{...y,mode:c}:y}function $m(t){const e=Ua(t);if(e===null||!Array.isArray(e.docs))return Fa;const s=[];for(const i of e.docs){const a=VL(i);if(a!==null&&!s.some(f=>f.key===a.key)&&s.push(a),s.length===w_)break}const l=s.map(i=>i.key),c=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:c,recent:b}}function GL(t){let e;try{e=JSON.parse(t)}catch{return Yo}const s=Ua(e);if(s===null)return Yo;const l={};for(const[c,y]of Object.entries(s)){const b=Ua(y);if(b===null||c.length===0||c.length>b_)continue;const i=$m(b.file),a=$m(b.plan);i.docs.length===0&&a.docs.length===0||(l[c]={file:i,plan:a})}return l}const zm=1,YL=25e4,y_={kind:"hunk",text:"…",oldLine:null,newLine:null};function Nd(t){return t.replace(/\r\n?/g,`
156
- `)}function qm(t){const e=Nd(t).split(`
157
- `);return e.length>0&&e[e.length-1]===""&&e.pop(),e}function XL(t,e){const s=qm(t),l=qm(e);let c=0;for(;c<s.length&&c<l.length&&s[c]===l[c];)c+=1;let y=s.length,b=l.length;for(;y>c&&b>c&&s[y-1]===l[b-1];)y-=1,b-=1;if(c===y&&c===b)return[];const i=[];for(let a=0;a<c;a+=1)i.push(Rd(s,a,a));QL(s,l,c,y,c,b,i);for(let a=y,f=b;a<s.length;a+=1,f+=1)i.push(Rd(s,a,f));return JL(i)}function Rd(t,e,s){return{kind:"context",text:t[e]??"",oldLine:e+1,newLine:s+1}}function qu(t,e){return{kind:"removed",text:t[e]??"",oldLine:e+1,newLine:null}}function Ku(t,e){return{kind:"added",text:t[e]??"",oldLine:null,newLine:e+1}}function QL(t,e,s,l,c,y,b){const i=l-s,a=y-c;if(i===0||a===0||i*a>YL){for(let M=s;M<l;M+=1)b.push(qu(t,M));for(let M=c;M<y;M+=1)b.push(Ku(e,M));return}const f=a+1,_=new Uint32Array((i+1)*f),d=(M,w)=>_[M*f+w]??0;for(let M=i-1;M>=0;M-=1)for(let w=a-1;w>=0;w-=1)_[M*f+w]=t[s+M]===e[c+w]?d(M+1,w+1)+1:Math.max(d(M+1,w),d(M,w+1));let k=0,E=0;for(;k<i&&E<a;)t[s+k]===e[c+E]?(b.push(Rd(t,s+k,c+E)),k+=1,E+=1):d(k+1,E)>=d(k,E+1)?(b.push(qu(t,s+k)),k+=1):(b.push(Ku(e,c+E)),E+=1);for(;k<i;k+=1)b.push(qu(t,s+k));for(;E<a;E+=1)b.push(Ku(e,c+E))}function JL(t){const e=t.map(c=>c.kind!=="context"),s=[];let l=-1;return t.forEach((c,y)=>{let b=!1;for(let i=-zm;i<=zm&&!b;i+=1)b=e[y+i]===!0;b&&(l!==-1&&y>l+1&&s.push(y_),s.push(c),l=y)}),s}const k_="agent-workbench.docTabs",ZL=1600;function e5(){try{const t=window.sessionStorage.getItem(k_);return t===null?Yo:GL(t)}catch{return Yo}}function Vu(t){return t!==void 0&&(t.text!==t.opened||t.conflict!==null||t.pending!==null)}function t5(t,e,s,l){const[c,y]=N.useState(e5),[b,i]=N.useState(new Map),[a,f]=N.useState(new Map),[_,d]=N.useState(new Set),k=N.useRef(b);k.current=b;const E=N.useRef(a);E.current=a;const M=N.useRef(new Map),w=N.useRef(new Map),h=N.useRef(new Map);N.useEffect(()=>{y(L=>zL(L,e.map(R=>R.terminalId)))},[e]),N.useEffect(()=>{const L=qL(c);for(const R of[...M.current.keys()])L.has(R)||M.current.delete(R);i(R=>{const x=[...R.keys()].filter(I=>!L.has(I));if(x.length===0)return R;const T=new Map(R);for(const I of x)T.delete(I);return T}),f(R=>{const x=[...R.keys()].filter(I=>!L.has(I));if(x.length===0)return R;const T=new Map(R);for(const I of x)T.delete(I);return T})},[c]),N.useEffect(()=>{try{window.sessionStorage.setItem(k_,KL(c))}catch{}},[c]);const v=N.useMemo(()=>[...a.values()].some(Vu),[a]);N.useEffect(()=>{if(!v)return;const L=R=>{R.preventDefault(),R.returnValue=""};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[v]),N.useEffect(()=>{const L=h.current;return()=>{for(const R of L.values())window.clearTimeout(R)}},[]);const g=N.useCallback((L,R,x)=>{const T=bs(L,R,x);i(I=>{var O;return new Map(I).set(T,{loaded:((O=I.get(T))==null?void 0:O.loaded)??null,loading:!0,failed:!1})}),R==="file"?t.send({type:"files.read",terminalId:L,path:x}):t.send({type:"plans.read",terminalId:L,fileName:x})},[t]),p=N.useCallback((L,R)=>{f(x=>{const T=x.get(L);if(T===void 0)return x;const I=new Map(x),O=R(T);return O===null?I.delete(L):I.set(L,O),I})},[]),S=N.useCallback(L=>{d(x=>new Set(x).add(L));const R=h.current.get(L);R!==void 0&&window.clearTimeout(R),h.current.set(L,window.setTimeout(()=>{h.current.delete(L),d(x=>{if(!x.has(L))return x;const T=new Set(x);return T.delete(L),T})},ZL))},[]);N.useEffect(()=>{const L=(T,I)=>i(O=>O.has(T)?new Map(O).set(T,{loaded:I,loading:!1,failed:!1}):O),R=t.onMessage(T=>{switch(T.type){case"files.preview":L(bs(T.terminalId,"file",T.preview.path),{kind:"file",preview:T.preview});break;case"plans.content":L(bs(T.terminalId,"plan",T.plan.fileName),{kind:"plan",plan:T.plan});break;case"files.saved":{const I=w.current.get(T.requestId);if(I===void 0)break;w.current.delete(T.requestId);const{id:O}=I,{preview:P}=T;if(P!==null&&L(O,{kind:"file",preview:P}),T.outcome==="saved")p(O,()=>null),S(O);else{const F=P!==null&&P.editable===!0?P:null;p(O,W=>({...W,saving:!1,conflict:{next:F}}))}break}case"error":{const I=T.requestId===void 0?void 0:w.current.get(T.requestId);if(I!==void 0&&T.requestId!==void 0){w.current.delete(T.requestId),p(I.id,O=>({...O,saving:!1,failure:{kind:"server",text:T.text}}));break}i(O=>{if(![...O.values()].some(F=>F.loading))return O;const P=new Map;for(const[F,W]of O)P.set(F,W.loading?{...W,loading:!1,failed:!0}:W);return P});break}}}),x=t.onReopen(()=>{for(const[T,I]of k.current){if(!I.loading)continue;const[O,P,F]=T.split("\0");O===void 0||F===void 0||(P==="file"&&t.send({type:"files.read",terminalId:O,path:F}),P==="plan"&&t.send({type:"plans.read",terminalId:O,fileName:F}))}for(const[T,I]of w.current){if(!I.sent){I.sent=!0;continue}w.current.delete(T),p(I.id,O=>({...O,saving:!1,failure:{kind:"lost"}}))}});return()=>{R(),x()}},[t,p,S]);const j=N.useCallback(L=>{const R=s,x=R===null?zu(Yo,"",L):zu(c,R,L),T=$=>R===null?null:bs(R,L,$),I=$=>{R!==null&&y(K=>$L(K,R,L,$(zu(K,R,L))))},O=$=>{const K=T($);return K!==null&&Vu(a.get(K))},P=()=>new Set(x.docs.filter($=>O($.key)).map($=>$.key)),F=$=>I(K=>UL(K,$)),W=$=>{const K=T($);if(L!=="file"||!l||R===null||K===null)return null;const G=a.get(K)??null;return{edit:G,unsaved:Vu(G??void 0),justSaved:_.has(K),begin:()=>{var H;const q=(H=b.get(K))==null?void 0:H.loaded;if((q==null?void 0:q.kind)!=="file"||q.preview.editable!==!0||q.preview.hash===void 0)return;const{hash:D}=q.preview,U=Nd(q.preview.text);f(z=>z.has(K)?z:new Map(z).set(K,{opened:U,baseHash:D,text:U,saving:!1,failure:null,conflict:null,pending:null,closing:!1}))},change:q=>p(K,D=>D.conflict!==null?D:{...D,text:q,failure:null}),save:()=>{const q=E.current.get(K);if(q===void 0||q.saving||q.conflict!==null||q.text===q.opened)return;const D=crypto.randomUUID(),U=t.send({type:"files.write",terminalId:R,requestId:D,path:$,text:q.text,baseHash:q.baseHash});w.current.set(D,{id:K,sent:U}),p(K,H=>({...H,saving:!0,failure:null}))},discard:()=>{const q=E.current.get(K);p(K,()=>null),q!==void 0&&q.conflict!==null&&q.conflict.next===null&&g(R,L,$)},adopt:()=>p(K,q=>{var Z;const D=((Z=q.conflict)==null?void 0:Z.next)??null;if(D===null||D.hash===void 0)return q;const U=XL(q.opened,q.text),H=U.length===0?q.pending:q.pending===null?U:[...q.pending,y_,...U],z=Nd(D.text);return{...q,opened:z,baseHash:D.hash,text:z,failure:null,conflict:null,pending:H,closing:!1}}),dismissPending:()=>p(K,q=>({...q,pending:null})),confirmClose:()=>{p(K,()=>null),F($)},keepEditing:()=>p(K,q=>({...q,closing:!1}))}};return{terminalId:R,docs:x.docs,active:x.active,open:$=>{if(R===null)return;const K=P();I(G=>FL(G,$,K)),g(R,L,$.key)},select:$=>I(K=>Wm(K,$)),showList:()=>I(HL),close:F,requestClose:$=>{const K=T($);if(K===null||!O($)){F($);return}I(G=>Wm(G,$)),p(K,G=>({...G,closing:!0}))},setMode:($,K)=>I(G=>WL(G,$,K)),content:$=>R===null?void 0:b.get(bs(R,L,$)),reload:$=>{R!==null&&g(R,L,$)},rememberScroll:($,K)=>{R!==null&&M.current.set(bs(R,L,$),K)},scrollOf:$=>R===null?void 0:M.current.get(bs(R,L,$)),editorFor:W,unsaved:O}},[s,c,b,a,_,l,t,g,p]);return N.useMemo(()=>({files:j("file"),plans:j("plan")}),[j])}const n5=/(?::\d+(?:[:-]\d+)?|#L\d+(?:-L?\d+)?)$/,r5=/[\n\r\t*?<>|"`]/,s5=/\.[A-Za-z0-9_-]{1,12}$/,C_=t=>t.replace(/\\/g,"/"),i5=t=>t.replace(/\/+$/,"");function Km(t,e){const s=i5(C_(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 nh(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>My||r5.test(s)||s.includes("://")||s.startsWith("~")||s.startsWith("-")||(s=C_(s.replace(n5,"")).replace(/[.,;:]+$/,""),s.length===0))return null;const c=e.platform==="win32";if(/^[A-Za-z]:\//.test(s)||s.startsWith("//")){const a=c?Km(s,e):null;if(a===null)return null;s=a}else if(s.startsWith("/")){const a=c?null:Km(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&&!s5.test(i)&&!y?null:b.join("/")}function x_(t,e){var c;const s=((c=t.split("#")[0])==null?void 0:c.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:nh(l,e)}const o5=/`([^`\n]+)`/g,l5=/\]\(([^)\s]+)\)/g;function a5(t,e){const s=new Set;for(const l of t.matchAll(o5)){const c=nh(l[1]??"",e);c!==null&&s.add(c)}for(const l of t.matchAll(l5)){const c=x_(l[1]??"",e);c!==null&&s.add(c)}return[...s]}function c5(t,e,s){return t.filter(l=>(e.get(l)??null)===null&&!s.has(l))}function u5(t,e,s,l=[]){const c=new Set(s),y=new Set(l),b=new Map(t);for(const i of e)b.set(i,c.has(i)?"file":y.has(i)?"directory":null);return b}const d5=1e3;function h5(t){const{connection:e,enabled:s,terminalId:l,cwd:c,platform:y,events:b,liveTerminalIds:i,onOpen:a,onOpenFolder:f}=t,_=N.useRef(new Map),d=N.useRef(new Map),k=N.useRef(0),[E,M]=N.useState(0),[w,h]=N.useState(0),v=N.useMemo(()=>({cwd:c,platform:y}),[c,y]);return N.useEffect(()=>{const g=e.onMessage(S=>{if(S.type!=="files.checked")return;const j=d.current.get(S.requestId);if(j===void 0)return;d.current.delete(S.requestId);const L=_.current.get(j.terminalId);if(L!==void 0){for(const R of j.paths)L.pending.delete(R);L.known=u5(L.known,j.paths,S.existing,S.directories),M(R=>R+1)}}),p=e.onReopen(()=>{d.current.clear();for(const S of _.current.values())S.pending.clear(),S.scanned=new WeakSet;h(S=>S+1)});return()=>{g(),p()}},[e]),N.useEffect(()=>{const g=new Set(i);for(const p of[..._.current.keys()])g.has(p)||_.current.delete(p)},[i]),N.useEffect(()=>{if(!s||l===null||c.length===0)return;let g=_.current.get(l);g===void 0&&(g={known:new Map,pending:new Set,scanned:new WeakSet},_.current.set(l,g));const p=new Set;for(const j of b)if(!g.scanned.has(j)&&(g.scanned.add(j),j.role==="assistant")){for(const L of j.parts)if(L.kind==="text")for(const R of a5(L.text,v))p.add(R)}const S=c5([...p],g.known,g.pending).slice(0,d5);for(let j=0;j<S.length;j+=Cp){const L=S.slice(j,j+Cp);k.current+=1;const R=`files-${k.current}`;d.current.set(R,{terminalId:l,paths:L});for(const x of L)g.pending.add(x);e.send({type:"files.check",terminalId:l,requestId:R,paths:L})}},[e,s,l,c,v,b,w]),N.useMemo(()=>{var S;if(!s||l===null)return null;const g=(S=_.current.get(l))==null?void 0:S.known,p=j=>{if(j===null)return null;const L=(g==null?void 0:g.get(j))??null;return L==="file"?{open:()=>a(j),folder:!1}:L==="directory"&&f!==null?{open:()=>f(j),folder:!0}:null};return{code:j=>p(nh(j,v)),link:j=>{var L;return((L=p(x_(j,v)))==null?void 0:L.open)??null}}},[s,l,v,a,f,E])}const Gu=new d_;function f5(t,e){const[s,l]=N.useState(_a),[c,y]=N.useState(!1),b=N.useRef(!1),i=N.useRef(null),[a,f]=N.useState(null),[_,d]=N.useState(!1);N.useEffect(()=>{const w=p=>{b.current=p,y(p)};if(e===null){l(_a),w(!1),f(null);return}const h=Gu.enter(e,_a);l(h.value),w(h.stale),i.current=null,f(null),d(!1);const v=t.onMessage(p=>{switch(p.type){case"git.status":{if(p.terminalId!==e)break;ST(Gu,e,p.status),l(p.status),w(!1);const S=i.current;if(i.current=null,S===null)break;p.status.state==="ready"?t.send({type:"git.diff",terminalId:e,path:S.path,staged:S.staged}):d(!1);break}case"git.diff":if(p.terminalId!==e)break;f(p.diff),d(!1);break;case"error":d(!1),i.current=null,p.code==="unknown-terminal"&&b.current&&(Gu.forget(e),l(_a),w(!1));break}});t.send({type:"git.subscribe",terminalId:e});const g=t.onReopen(()=>{t.send({type:"git.subscribe",terminalId:e})});return()=>{v(),g(),t.send({type:"git.unsubscribe",terminalId:e})}},[t,e]);const k=N.useCallback((w,h)=>{if(e!==null){if(d(!0),f(null),b.current){i.current={path:w,staged:h};return}t.send({type:"git.diff",terminalId:e,path:w,staged:h})}},[t,e]),E=N.useCallback(()=>{i.current=null,f(null),d(!1)},[]),M=N.useCallback(()=>{e!==null&&t.send({type:"git.refresh",terminalId:e})},[t,e]);return{status:s,stale:c,diff:a,loadingDiff:_,openDiff:k,closeDiff:E,refresh:M}}const Md=new Set;function p5(t){return t!==void 0&&Md.has(t)}function m5(t){return t.length===0?m("memory.result.nothingChanged"):m("memory.result.installed",{count:t.length})}function g5(t,e){const s=t.length===0?m("memory.result.nothingImported"):m("memory.result.imported",{count:t.length});return e.length===0?s:m("memory.result.withSkipped",{result:s,skipped:m("memory.result.skipped",{count:e.length,files:e.join(", ")})})}function v5(t,e,s=null){const[l,c]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),[f,_]=N.useState(null),[d,k]=N.useState(null),[E,M]=N.useState(null),[w,h]=N.useState(null),v=N.useRef(new Map),g=N.useRef(new Set),p=N.useRef(null),S=N.useRef(!1),j=N.useCallback($=>{const K=`memory-${crypto.randomUUID()}`;return v.current.set(K,$),g.current.add(K),Md.add(K),K},[]),L=N.useCallback($=>{for(const[K,G]of v.current)G===$&&v.current.delete(K)},[]);N.useEffect(()=>{c(null),b(null),a(null),_(null),k(null),M(null),h(null),v.current.clear();for(const U of g.current)Md.delete(U);if(g.current.clear(),p.current=null,S.current=!1,e===null)return;const $=(U,H)=>U===void 0||v.current.get(U)!==H?!1:(v.current.delete(U),!0),K=t.onMessage(U=>{switch(U.type){case"memory.status":if(U.terminalId!==e)break;c(U.status),S.current&&(S.current=!1,h(null));break;case"memory.planned":if(U.terminalId!==e||!$(U.requestId,"plan"))break;_(U.changes),k(null);break;case"memory.installed":if(U.terminalId!==e||!$(U.requestId,"install"))break;p.current=null,_(null),k(null),M(m5(U.applied));break;case"memory.imported":if(U.terminalId!==e||!$(U.requestId,"import"))break;k(null),M(g5(U.copied,U.skipped));break;case"memory.content":if(U.terminalId!==e||!$(U.requestId,"read"))break;b(U.note),a(null);break;case"error":{const H=U.requestId,z=H===void 0?void 0:v.current.get(H);if(H===void 0||z===void 0)break;v.current.delete(H),z==="read"?a(null):z!=="subscribe"&&k(null),h(Mt(U.text)),S.current=z==="subscribe";break}}}),G=t.onStatus(U=>{if(U!=="reconnecting"&&U!=="failed")return;const H=new Set(v.current.values());v.current.clear(),k(null),a(null),(H.has("install")||H.has("import"))&&(p.current=null,_(null),h(m("memory.error.connectionLost")))}),q=()=>{t.send({type:"memory.subscribe",terminalId:e,requestId:j("subscribe")})};q();const D=t.onReopen(q);return()=>{K(),G(),D(),t.send({type:"memory.unsubscribe",terminalId:e})}},[t,e,s,j]);const R=N.useCallback(()=>{S.current=!1,h(null),M(null)},[]),x=N.useCallback($=>{e!==null&&(L("read"),R(),a($),b(null),t.send({type:"memory.read",terminalId:e,name:$,requestId:j("read")}))},[t,e,R,L,j]),T=N.useCallback(()=>{L("read"),b(null),a(null)},[L]),I=N.useCallback($=>{e!==null&&(R(),p.current=$,_(null),k("plan"),t.send({type:"memory.plan",terminalId:e,options:$,requestId:j("plan")}))},[t,e,R,j]),O=N.useCallback(()=>{const $=p.current;e===null||$===null||(R(),k("install"),t.send({type:"memory.install",terminalId:e,options:$,requestId:j("install")}))},[t,e,R,j]),P=N.useCallback(()=>{e!==null&&(R(),k("import"),t.send({type:"memory.import",terminalId:e,requestId:j("import")}))},[t,e,R,j]),F=N.useCallback(()=>{L("plan"),p.current=null,_(null)},[L]),W=N.useCallback(()=>{S.current=!1,h(null),M(null)},[]);return{status:l,open:y,loading:i,planned:f,busy:d,lastResult:E,error:w,openNote:x,closeNote:T,requestPlan:I,install:O,importNative:P,cancelPlan:F,dismissMessage:W}}function _5(t){const[e,s]=N.useState([]),[l,c]=N.useState({}),[y,b]=N.useState(null),i=N.useRef(new Set);N.useEffect(()=>{const h=t.onMessage(g=>{switch(g.type){case"notes.list":s(g.notes);break;case"notes.imageData":i.current.add(g.imageId),c(p=>({...p,[g.imageId]:g.data===null?null:`data:${g.mediaType};base64,${g.data}`}));break;case"error":g.code==="notes-failed"&&b(Mt(g.text));break}}),v=t.onReopen(()=>{i.current.clear()});return()=>{h(),v()}},[t]);const a=N.useCallback(h=>{i.current.has(h)||(i.current.add(h),t.send({type:"notes.image",imageId:h}))},[t]),f=N.useCallback(()=>{const h=crypto.randomUUID(),v=Date.now();return s(g=>[...g,{noteId:h,text:"",images:[],createdAt:v,updatedAt:v}]),t.send({type:"notes.create",noteId:h}),h},[t]),_=N.useCallback((h,v)=>{s(g=>g.map(p=>p.noteId===h?{...p,text:v,updatedAt:Date.now()}:p)),t.send({type:"notes.update",noteId:h,text:v})},[t]),d=N.useCallback(h=>{s(v=>v.filter(g=>g.noteId!==h)),t.send({type:"notes.delete",noteId:h})},[t]),k=N.useCallback((h,v)=>{const g=e.find(S=>S.noteId===h);if(g!==void 0&&g.images.length>=bp){b(m("notes.tooManyImages",{count:bp}));return}if(v.size>Ys){b(m("notes.imageTooBig",{name:v.name||m("notes.imageFallbackName"),size:Math.round(v.size/1024/1024),max:Ys/1024/1024}));return}const p=new FileReader;p.onload=()=>{const S=p.result;if(typeof S!="string")return;const j=S.indexOf(",");j!==-1&&t.send({type:"notes.addImage",noteId:h,image:{mediaType:v.type,data:S.slice(j+1)}})},p.onerror=()=>b(m("notes.readFailed")),p.readAsDataURL(v)},[t,e]),E=N.useCallback((h,v)=>{s(g=>g.map(p=>p.noteId===h?{...p,images:p.images.filter(S=>S.imageId!==v)}:p)),t.send({type:"notes.removeImage",noteId:h,imageId:v})},[t]),M=N.useCallback((h,v)=>{t.send({type:"notes.send",noteId:h,terminalId:v})},[t]),w=N.useCallback(()=>b(null),[]);return{notes:e,images:l,problem:y,requestImage:a,create:f,updateText:_,remove:d,addImage:k,removeImage:E,sendToAgent:M,dismissProblem:w}}function w5(t){const[e,s]=N.useState([]);return N.useEffect(()=>t.onMessage(l=>{l.type==="plan.limits"&&s(l.limits)}),[t]),e}const S_="agent-workbench.theme",Yu=["system","light","dark"],b5={system:"theme.system",light:"theme.light",dark:"theme.dark"};function Vm(t){return m("theme.title",{theme:m(b5[t])})}const Gm={system:"◐",light:"☀",dark:"☾"};function y5(){return jt(S_,"system",t=>t==="light"||t==="dark"||t==="system"?t:null)}function k5(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function C5(){const[t,e]=N.useState(y5),[s,l]=N.useState(k5);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 c=t==="system"?s?"dark":"light":t;N.useEffect(()=>{document.documentElement.dataset.theme=c,document.documentElement.style.colorScheme=c},[c]);const y=N.useCallback(()=>{e(b=>{const i=Yu[(Yu.indexOf(b)+1)%Yu.length]??"system";return Lt(S_,i),i})},[]);return{preference:t,resolved:c,cycle:y}}const Ym="agent-workbench.terminalTheme";function x5(t){return t==="dark"||t==="follow"?t:null}function S5(t,e){return t==="follow"?e:"dark"}function E5(t){const[e,s]=N.useState(()=>jt(Ym,"dark",x5)),l=S5(e,t);N.useEffect(()=>{document.documentElement.dataset.terminalTheme=l},[l]);const c=N.useCallback(y=>{Lt(Ym,y),s(y)},[]);return{preference:e,resolved:l,setPreference:c}}const T5=1500;function L5(t,e){return t===void 0||t===e?null:e==="waiting"?"attention":e==="idle"&&t==="busy"?"done":null}function N5(t,e){const s={now:[],later:[],cancel:[]};for(const[l,c]of e){const y=t.get(l);if(y===c)continue;s.cancel.push(l);const b=L5(y,c);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 Xm="agent-workbench.phone-chime";function R5(t){return t==="system"||t==="page"?t:null}function M5(t){return`agentworkbench://chime?source=${t}`}function A5(t,e,s,l){return t?e==="page"?za:null:s?tl(l):null}const Qm="agent-workbench.sound";function I5(t){return t==="on"?!0:t==="off"?!1:null}function j5(t){return m(t?"sound.on":"sound.off")}function D5(t,e){return t&&e>0}const P5={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}]},E_=.02,za=.8,T_=.2,Jm="agent-workbench.sound-volume";function tl(t){return Math.min(za,Math.max(E_,t))}function O5(t){if(t.trim().length===0)return null;const e=Number(t);return Number.isFinite(e)?tl(e):null}function B5(t){return Math.round(tl(t)/za*100)}class F5{constructor(){Ut(this,"context",null);Ut(this,"volume",T_)}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 c of P5[e]){const y=s.createOscillator(),b=s.createGain();y.type="sine",y.frequency.value=c.frequency;const i=l+c.at;b.gain.setValueAtTime(1e-4,i),b.gain.exponentialRampToValueAtTime(tl(this.volume),i+.012),b.gain.exponentialRampToValueAtTime(1e-4,i+c.duration),y.connect(b),b.connect(s.destination),y.start(i),y.stop(i+c.duration+.02)}}}const Xu="agent-workbench.notify";function H5(t){return t==="on"?!0:t==="off"?!1:null}function U5(t,e,s){return t&&e==="granted"&&!s}function W5(t,e){return m(e==="denied"?"sound.notify.blocked":t?"sound.notify.on":"sound.notify.off")}function $5(t,e){return t==="attention"?m("notify.attention",{tab:e}):m("notify.done",{tab:e})}function Zm(t){return t===void 0?"":t.label.length>0?t.label:t.cwd.split(/[\\/]/).filter(e=>e.length>0).pop()??t.cwd}function $o(){return typeof window>"u"||!("Notification"in window)||!window.isSecureContext?"unsupported":Notification.permission}async function z5(){if($o()==="unsupported")return"unsupported";try{return await Notification.requestPermission()}catch{return $o()}}function q5(){return document.visibilityState==="visible"&&document.hasFocus()}function K5(t){try{const e=new Notification("Agent Workbench",{body:$5(t.chime,t.tabName),tag:`agent-workbench:${t.terminalId}`});e.onclick=()=>{window.focus(),t.onClick(),e.close()}}catch{}}function V5(t,e){const[s,l]=N.useState(()=>jt(Qm,!0,I5)),c=N.useRef(s);c.current=s;const[y,b]=N.useState(()=>jt(Jm,T_,O5)),i=N.useRef(y);i.current=y;const[a]=N.useState(()=>typeof navigator<"u"&&mv(navigator.userAgent)),[f,_]=N.useState(()=>jt(Xm,"system",R5)),d=N.useRef(f);d.current=f;const[k,E]=N.useState(()=>$o()),[M,w]=N.useState(()=>jt(Xu,!1,H5)),h=N.useRef(M);h.current=M;const v=N.useRef(e);v.current=e;const g=N.useCallback((U,H)=>{U5(h.current,$o(),q5())&&K5({chime:U,terminalId:H,tabName:v.current.nameOf(H),onClick:()=>v.current.activate(H)})},[]),p=N.useRef(null),S=N.useRef(new Map),j=N.useRef(new Map),[L,R]=N.useState(()=>new Set),x=N.useRef(new Map),T=N.useRef(new Set),I=N.useCallback(U=>T.current.delete(U),[]),O=N.useCallback(U=>{T.current.add(U);const H=x.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})},Av))},[]),P=N.useCallback(U=>{const H=p.current,z=A5(a,d.current,c.current,i.current);H===null||z===null||(H.volume=z,H.play(U))},[a]);N.useEffect(()=>{const U=new F5;U.volume=i.current,p.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),p.current=null}},[]),N.useEffect(()=>{const U=N5(S.current,t);S.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&&P("attention");for(const z of U.now)g("attention",z),O(z);for(const z of U.later)H.set(z,window.setTimeout(()=>{H.delete(z),P("done"),g("done",z),O(z)},T5))},[t,g,P,O]),N.useEffect(()=>{const U=j.current,H=x.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 Lt(Qm,Z?"on":"off"),Z}),c.current||((U=p.current)==null||U.unlock(),(H=p.current)==null||H.play("done"))},[]),W=N.useCallback(U=>{const H=tl(U);b(H),Lt(Jm,String(H)),p.current!==null&&(p.current.volume=H)},[]),$=N.useCallback(()=>{var U,H;c.current&&((U=p.current)==null||U.unlock(),(H=p.current)==null||H.play("done"))},[]),K=N.useCallback(()=>{if(h.current&&$o()==="granted"){w(!1),Lt(Xu,"off");return}z5().then(U=>{E(U),U==="granted"&&(w(!0),Lt(Xu,"on"))})},[]),G={supported:k!=="unsupported",enabled:M&&k==="granted",permission:k,toggle:K},q=N.useCallback(U=>{var H;_(U),d.current=U,Lt(Xm,U),window.location.href=M5(U),U==="page"&&((H=p.current)==null||H.unlock(),P("done"))},[P]);return{enabled:s,toggle:F,volume:y,setVolume:W,previewVolume:$,notify:G,phoneChime:a?{source:f,setSource:q}:null,attention:L,takeNotice:I}}function L_(t,e,s){const[l,c]=N.useState(()=>jt(t,e,B1));N.useLayoutEffect(()=>{document.documentElement.dataset[s]=l},[s,l]);const y=N.useCallback(()=>{c(b=>{const i=Mv(b);return Lt(t,i),i})},[t]);return{size:l,cycle:y}}function G5(){return L_(j1,Rv,"threadFont")}function Y5(){return L_(D1,P1,"notesFont")}function X5(t,e){const[s,l]=N.useState(()=>new Map),[c,y]=N.useState(()=>new Map),b=N.useCallback((a,f,_,d)=>{l(k=>new Map(k).set(a,{requestId:f,terminalId:a,afterEventId:_,phase:"sending",queued:d,sentAt:Date.now(),deliveredAt:null}))},[]);N.useEffect(()=>{const a=t.onMessage(_=>{_.type==="agent.submitted"&&l(d=>Lx(d,_,Date.now()))}),f=t.onReopen(()=>l(_=>Tx(_,Date.now())));return()=>{a(),f()}},[t]);const i=N.useRef(new Map);return N.useLayoutEffect(()=>{const a=i.current;if(a===e)return;i.current=e;const f=Date.now();y(_=>Ex(a,e,_,f))},[e]),{track:b,receipts:s,clocks:c}}const Q5=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]);function N_({sound:t}){return o.jsxs("span",{className:"sound-control",children:[o.jsx("button",{className:`icon-button${D5(t.enabled,t.volume)?" icon-button-on":""}`,onClick:t.toggle,title:j5(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:E_,max:za,step:.01,value:t.volume,onChange:e=>t.setVolume(Number(e.target.value)),onPointerUp:t.previewVolume,onKeyUp:e=>{Q5.has(e.key)&&t.previewVolume()},title:m("sound.volume"),"aria-label":m("sound.volume")}),o.jsxs("span",{className:"sound-volume-value",children:[B5(t.volume),"%"]})]})})]})}function R_({notify:t}){return t.supported?o.jsx("button",{className:`icon-button${t.enabled?" icon-button-on":""}`,onClick:t.toggle,title:W5(t.enabled,t.permission),"aria-pressed":t.enabled,children:o.jsx(J5,{})}):null}function J5(){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 Z5(t){const[e,s]=N.useState(null),[l,c]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(!1),[f,_]=N.useState(null);N.useEffect(()=>{const S=t.onMessage(L=>{switch(L.type){case"remote.status":s(L.status),L.status.pairingActive||(c(null),b(null));break;case"remote.pairing.code":c(L.pairing),b(null);break;case"remote.phone.pairing":b(L.pairing),c(null);break;case"error":if(L.code!=="remote-failed")break;_(Mt(L.text)),L.detail!==void 0&&console.error("[servidor]",L.detail);break}}),j=t.onReopen(()=>{c(null),b(null),a(!1)});return()=>{S(),j()}},[t]);const d=N.useCallback(S=>{_(null),t.send({type:"remote.configure",enabled:S})},[t]),k=N.useCallback(S=>{_(null),t.send({type:"remote.configure",port:S})},[t]),E=N.useCallback(()=>{_(null),t.send({type:"remote.pairing.start"})},[t]),M=N.useCallback(()=>{c(null),t.send({type:"remote.pairing.cancel"})},[t]),w=N.useCallback(()=>{_(null),a(!0),t.send({type:"remote.phone.start"})},[t]),h=N.useCallback(()=>{b(null),a(!1),t.send({type:"remote.phone.cancel"})},[t]),v=N.useCallback((S,j)=>{_(null),t.send({type:"remote.device.rename",deviceId:S,label:j})},[t]),g=N.useCallback(S=>{_(null),t.send({type:"remote.device.revoke",deviceId:S})},[t]),p=N.useCallback(()=>_(null),[]);return{status:e,pairing:l,phonePairing:y,phoneStarted:i,problem:f,setEnabled:d,setPort:k,startPairing:E,cancelPairing:M,startPhonePairing:w,cancelPhonePairing:h,renameDevice:v,revokeDevice:g,dismissProblem:p}}const e2="USER";function t2(t,e){const s=t.sshUser.length>0?t.sshUser:e2,l=/\s/.test(s)?`"${s}@${e}"`:`${s}@${e}`;return`ssh -N -L ${t.port}:127.0.0.1:${t.port} ${l}`}function M_(t){return`http://localhost:${t}`}function n2(t,e){return`${M_(t)}/?${_y}=${e}`}function eg(t){return t[0]??"localhost"}function Ad(t,e){switch(t){case"off":return m("remote.state.off");case"active":return m("remote.state.active",{port:e});case"restart-needed":return m("remote.state.restartNeeded");case"port-busy":return m("remote.state.portBusy",{port:e})}}function r2(t){const e=t.trim();if(!/^\d{1,5}$/.test(e))return null;const s=Number(e);return by(s)?s:null}function s2(){return m("remote.portInvalid",{min:Fg,max:Hg})}function tg(t,e){return Math.max(0,Math.ceil((t-e)/1e3))}function ng(t){return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function i2(t,e=Date.now()){return t.connected?m("remote.device.connected"):t.lastSeenAt===null?m("remote.device.never"):m("remote.device.lastSeen",{when:Jn(t.lastSeenAt,e)})}function o2(t,e=Date.now()){return m("remote.device.paired",{when:Jn(t.createdAt,e)})}function l2(t){switch(t){case"powershell-admin":return m("remote.phone.authorize.admin");case"powershell":return m("remote.phone.authorize.powershell");case"terminal":return m("remote.phone.authorize.terminal")}}function a2(){return[{platform:"win32",label:"Windows",hint:m("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:m("remote.ssh.macos"),command:null},{platform:"linux",label:"Linux",hint:m("remote.ssh.linux"),command:["sudo apt install openssh-server","sudo systemctl enable --now ssh"].join(`
159
- `)}]}function c2(t){return t==="win32"||t==="darwin"?t:"linux"}function Ea(t){return t!==null&&t.state==="active"}function rg(t){return t!==null&&t.state==="active"&&t.devices.length>0}const Wi=function(t,e){let c=t;const y=Wo[e];let b=null,i=0,a=null;const f=[],_={},d=function(R,x){i=c*4+17,b=(function(T){const I=new Array(T);for(let O=0;O<T;O+=1){I[O]=new Array(T);for(let P=0;P<T;P+=1)I[O][P]=null}return I})(i),k(0,0),k(i-7,0),k(0,i-7),w(),M(),v(R,x),c>=7&&h(R),a==null&&(a=S(c,y,f)),g(a,x)},k=function(R,x){for(let T=-1;T<=7;T+=1)if(!(R+T<=-1||i<=R+T))for(let I=-1;I<=7;I+=1)x+I<=-1||i<=x+I||(0<=T&&T<=6&&(I==0||I==6)||0<=I&&I<=6&&(T==0||T==6)||2<=T&&T<=4&&2<=I&&I<=4?b[R+T][x+I]=!0:b[R+T][x+I]=!1)},E=function(){let R=0,x=0;for(let T=0;T<8;T+=1){d(!0,T);const I=ws.getLostPoint(_);(T==0||R>I)&&(R=I,x=T)}return x},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=ws.getPatternPosition(c);for(let x=0;x<R.length;x+=1)for(let T=0;T<R.length;T+=1){const I=R[x],O=R[T];if(b[I][O]==null)for(let P=-2;P<=2;P+=1)for(let F=-2;F<=2;F+=1)P==-2||P==2||F==-2||F==2||P==0&&F==0?b[I+P][O+F]=!0:b[I+P][O+F]=!1}},h=function(R){const x=ws.getBCHTypeNumber(c);for(let T=0;T<18;T+=1){const I=!R&&(x>>T&1)==1;b[Math.floor(T/3)][T%3+i-8-3]=I}for(let T=0;T<18;T+=1){const I=!R&&(x>>T&1)==1;b[T%3+i-8-3][Math.floor(T/3)]=I}},v=function(R,x){const T=y<<3|x,I=ws.getBCHTypeInfo(T);for(let O=0;O<15;O+=1){const P=!R&&(I>>O&1)==1;O<6?b[O][8]=P:O<8?b[O+1][8]=P:b[i-15+O][8]=P}for(let O=0;O<15;O+=1){const P=!R&&(I>>O&1)==1;O<8?b[8][i-O-1]=P:O<9?b[8][15-O-1+1]=P:b[8][15-O-1]=P}b[i-8][8]=!R},g=function(R,x){let T=-1,I=i-1,O=7,P=0;const F=ws.getMaskFunction(x);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 K=!1;P<R.length&&(K=(R[P]>>>O&1)==1),F(I,W-$)&&(K=!K),b[I][W-$]=K,O-=1,O==-1&&(P+=1,O=7)}if(I+=T,I<0||i<=I){I-=T,T=-T;break}}},p=function(R,x){let T=0,I=0,O=0;const P=new Array(x.length),F=new Array(x.length);for(let G=0;G<x.length;G+=1){const q=x[G].dataCount,D=x[G].totalCount-q;I=Math.max(I,q),O=Math.max(O,D),P[G]=new Array(q);for(let Z=0;Z<P[G].length;Z+=1)P[G][Z]=255&R.getBuffer()[Z+T];T+=q;const U=ws.getErrorCorrectPolynomial(D),z=Xo(P[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<x.length;G+=1)W+=x[G].totalCount;const $=new Array(W);let K=0;for(let G=0;G<I;G+=1)for(let q=0;q<x.length;q+=1)G<P[q].length&&($[K]=P[q][G],K+=1);for(let G=0;G<O;G+=1)for(let q=0;q<x.length;q+=1)G<F[q].length&&($[K]=F[q][G],K+=1);return $},S=function(R,x,T){const I=sg.getRSBlocks(R,x),O=ig();for(let F=0;F<T.length;F+=1){const W=T[F];O.put(W.getMode(),4),O.put(W.getLength(),ws.getLengthInBits(W.getMode(),R)),W.write(O)}let P=0;for(let F=0;F<I.length;F+=1)P+=I[F].dataCount;if(O.getLengthInBits()>P*8)throw"code length overflow. ("+O.getLengthInBits()+">"+P*8+")";for(O.getLengthInBits()+4<=P*8&&O.put(0,4);O.getLengthInBits()%8!=0;)O.putBit(!1);for(;!(O.getLengthInBits()>=P*8||(O.put(236,8),O.getLengthInBits()>=P*8));)O.put(17,8);return p(O,I)};_.addData=function(R,x){x=x||"Byte";let T=null;switch(x){case"Numeric":T=u2(R);break;case"Alphanumeric":T=d2(R);break;case"Byte":T=h2(R);break;case"Kanji":T=f2(R);break;default:throw"mode:"+x}f.push(T),a=null},_.isDark=function(R,x){if(R<0||i<=R||x<0||i<=x)throw R+","+x;return b[R][x]},_.getModuleCount=function(){return i},_.make=function(){if(c<1){let R=1;for(;R<40;R++){const x=sg.getRSBlocks(R,y),T=ig();for(let O=0;O<f.length;O++){const P=f[O];T.put(P.getMode(),4),T.put(P.getLength(),ws.getLengthInBits(P.getMode(),R)),P.write(T)}let I=0;for(let O=0;O<x.length;O++)I+=x[O].dataCount;if(T.getLengthInBits()<=I*8)break}c=R}d(!1,E())},_.createTableTag=function(R,x){R=R||2,x=typeof x>"u"?R*4:x;let T="";T+='<table style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: "+x+"px;",T+='">',T+="<tbody>";for(let I=0;I<_.getModuleCount();I+=1){T+="<tr>";for(let O=0;O<_.getModuleCount();O+=1)T+='<td style="',T+=" border-width: 0px; border-style: none;",T+=" border-collapse: collapse;",T+=" padding: 0px; margin: 0px;",T+=" width: "+R+"px;",T+=" height: "+R+"px;",T+=" background-color: ",T+=_.isDark(I,O)?"#000000":"#ffffff",T+=";",T+='"/>';T+="</tr>"}return T+="</tbody>",T+="</table>",T},_.createSvgTag=function(R,x,T,I){let O={};typeof arguments[0]=="object"&&(O=arguments[0],R=O.cellSize,x=O.margin,T=O.alt,I=O.title),R=R||2,x=typeof x>"u"?R*4:x,T=typeof T=="string"?{text:T}:T||{},T.text=T.text||null,T.id=T.text?T.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 P=_.getModuleCount()*R+x*2;let F,W,$,K,G="",q;for(q="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",G+='<svg version="1.1" xmlns="http://www.w3.org/2000/svg"',G+=O.scalable?"":' width="'+P+'px" height="'+P+'px"',G+=' viewBox="0 0 '+P+" "+P+'" ',G+=' preserveAspectRatio="xMinYMin meet"',G+=I.text||T.text?' role="img" aria-labelledby="'+j([I.id,T.id].join(" ").trim())+'"':"",G+=">",G+=I.text?'<title id="'+j(I.id)+'">'+j(I.text)+"</title>":"",G+=T.text?'<description id="'+j(T.id)+'">'+j(T.text)+"</description>":"",G+='<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>',G+='<path d="',$=0;$<_.getModuleCount();$+=1)for(K=$*R+x,F=0;F<_.getModuleCount();F+=1)_.isDark($,F)&&(W=F*R+x,G+="M"+W+","+K+q);return G+='" stroke="transparent" fill="black"/>',G+="</svg>",G},_.createDataURL=function(R,x){R=R||2,x=typeof x>"u"?R*4:x;const T=_.getModuleCount()*R+x*2,I=x,O=T-x;return v2(T,T,function(P,F){if(I<=P&&P<O&&I<=F&&F<O){const W=Math.floor((P-I)/R),$=Math.floor((F-I)/R);return _.isDark($,W)?0:1}else return 1})},_.createImgTag=function(R,x,T){R=R||2,x=typeof x>"u"?R*4:x;const I=_.getModuleCount()*R+x*2;let O="";return O+="<img",O+=' src="',O+=_.createDataURL(R,x),O+='"',O+=' width="',O+=I,O+='"',O+=' height="',O+=I,O+='"',T&&(O+=' alt="',O+=j(T),O+='"'),O+="/>",O};const j=function(R){let x="";for(let T=0;T<R.length;T+=1){const I=R.charAt(T);switch(I){case"<":x+="&lt;";break;case">":x+="&gt;";break;case"&":x+="&amp;";break;case'"':x+="&quot;";break;default:x+=I;break}}return x},L=function(R){R=typeof R>"u"?2:R;const T=_.getModuleCount()*1+R*2,I=R,O=T-R;let P,F,W,$,K;const G={"██":"█","█ ":"▀"," █":"▄"," ":" "},q={"██":"▀","█ ":"▀"," █":" "," ":" "};let D="";for(P=0;P<T;P+=2){for(W=Math.floor((P-I)/1),$=Math.floor((P+1-I)/1),F=0;F<T;F+=1)K="█",I<=F&&F<O&&I<=P&&P<O&&_.isDark(W,Math.floor((F-I)/1))&&(K=" "),I<=F&&F<O&&I<=P+1&&P+1<O&&_.isDark($,Math.floor((F-I)/1))?K+=" ":K+="█",D+=R<1&&P+1>=O?q[K]:G[K];D+=`
160
- `}return T%2&&R>0?D.substring(0,D.length-T-1)+Array(T+1).join("▀"):D.substring(0,D.length-1)};return _.createASCII=function(R,x){if(R=R||1,R<2)return L(x);R-=1,x=typeof x>"u"?R*2:x;const T=_.getModuleCount()*R+x*2,I=x,O=T-x;let P,F,W,$;const K=Array(R+1).join("██"),G=Array(R+1).join(" ");let q="",D="";for(P=0;P<T;P+=1){for(W=Math.floor((P-I)/R),D="",F=0;F<T;F+=1)$=1,I<=F&&F<O&&I<=P&&P<O&&_.isDark(W,Math.floor((F-I)/R))&&($=0),D+=$?K:G;for(W=0;W<R;W+=1)q+=D+`
161
- `}return q.substring(0,q.length-1)},_.renderTo2dContext=function(R,x){x=x||2;const T=_.getModuleCount();for(let I=0;I<T;I++)for(let O=0;O<T;O++)R.fillStyle=_.isDark(I,O)?"black":"white",R.fillRect(O*x,I*x,x,x)},_};Wi.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};Wi.createStringToBytes=function(t,e){const s=(function(){const c=m2(t),y=function(){const a=c.read();if(a==-1)throw"eof";return a};let b=0;const i={};for(;;){const a=c.read();if(a==-1)break;const f=y(),_=y(),d=y(),k=String.fromCharCode(a<<8|f),E=_<<8|d;i[k]=E,b+=1}if(b!=e)throw b+" != "+e;return i})(),l=63;return function(c){const y=[];for(let b=0;b<c.length;b+=1){const i=c.charCodeAt(b);if(i<128)y.push(i);else{const a=s[c.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 wn={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Wo={L:1,M:0,Q:3,H:2},_s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},ws=(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,c={},y=function(b){let i=0;for(;b!=0;)i+=1,b>>>=1;return i};return c.getBCHTypeInfo=function(b){let i=b<<10;for(;y(i)-y(e)>=0;)i^=e<<y(i)-y(e);return(b<<10|i)^l},c.getBCHTypeNumber=function(b){let i=b<<12;for(;y(i)-y(s)>=0;)i^=s<<y(i)-y(s);return b<<12|i},c.getPatternPosition=function(b){return t[b-1]},c.getMaskFunction=function(b){switch(b){case _s.PATTERN000:return function(i,a){return(i+a)%2==0};case _s.PATTERN001:return function(i,a){return i%2==0};case _s.PATTERN010:return function(i,a){return a%3==0};case _s.PATTERN011:return function(i,a){return(i+a)%3==0};case _s.PATTERN100:return function(i,a){return(Math.floor(i/2)+Math.floor(a/3))%2==0};case _s.PATTERN101:return function(i,a){return i*a%2+i*a%3==0};case _s.PATTERN110:return function(i,a){return(i*a%2+i*a%3)%2==0};case _s.PATTERN111:return function(i,a){return(i*a%3+(i+a)%2)%2==0};default:throw"bad maskPattern:"+b}},c.getErrorCorrectPolynomial=function(b){let i=Xo([1],0);for(let a=0;a<b;a+=1)i=i.multiply(Xo([1,ys.gexp(a)],0));return i},c.getLengthInBits=function(b,i){if(1<=i&&i<10)switch(b){case wn.MODE_NUMBER:return 10;case wn.MODE_ALPHA_NUM:return 9;case wn.MODE_8BIT_BYTE:return 8;case wn.MODE_KANJI:return 8;default:throw"mode:"+b}else if(i<27)switch(b){case wn.MODE_NUMBER:return 12;case wn.MODE_ALPHA_NUM:return 11;case wn.MODE_8BIT_BYTE:return 16;case wn.MODE_KANJI:return 10;default:throw"mode:"+b}else if(i<41)switch(b){case wn.MODE_NUMBER:return 14;case wn.MODE_ALPHA_NUM:return 13;case wn.MODE_8BIT_BYTE:return 16;case wn.MODE_KANJI:return 12;default:throw"mode:"+b}else throw"type:"+i},c.getLostPoint=function(b){const i=b.getModuleCount();let a=0;for(let d=0;d<i;d+=1)for(let k=0;k<i;k+=1){let E=0;const M=b.isDark(d,k);for(let w=-1;w<=1;w+=1)if(!(d+w<0||i<=d+w))for(let h=-1;h<=1;h+=1)k+h<0||i<=k+h||w==0&&h==0||M==b.isDark(d+w,k+h)&&(E+=1);E>5&&(a+=3+E-5)}for(let d=0;d<i-1;d+=1)for(let k=0;k<i-1;k+=1){let E=0;b.isDark(d,k)&&(E+=1),b.isDark(d+1,k)&&(E+=1),b.isDark(d,k+1)&&(E+=1),b.isDark(d+1,k+1)&&(E+=1),(E==0||E==4)&&(a+=3)}for(let d=0;d<i;d+=1)for(let k=0;k<i-6;k+=1)b.isDark(d,k)&&!b.isDark(d,k+1)&&b.isDark(d,k+2)&&b.isDark(d,k+3)&&b.isDark(d,k+4)&&!b.isDark(d,k+5)&&b.isDark(d,k+6)&&(a+=40);for(let d=0;d<i;d+=1)for(let k=0;k<i-6;k+=1)b.isDark(k,d)&&!b.isDark(k+1,d)&&b.isDark(k+2,d)&&b.isDark(k+3,d)&&b.isDark(k+4,d)&&!b.isDark(k+5,d)&&b.isDark(k+6,d)&&(a+=40);let f=0;for(let d=0;d<i;d+=1)for(let k=0;k<i;k+=1)b.isDark(k,d)&&(f+=1);const _=Math.abs(100*f/i/i-50)/5;return a+=_*10,a},c})(),ys=(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})(),Xo=function(t,e){if(typeof t.length>"u")throw t.length+"/"+e;const s=(function(){let c=0;for(;c<t.length&&t[c]==0;)c+=1;const y=new Array(t.length-c+e);for(let b=0;b<t.length-c;b+=1)y[b]=t[b+c];return y})(),l={};return l.getAt=function(c){return s[c]},l.getLength=function(){return s.length},l.multiply=function(c){const y=new Array(l.getLength()+c.getLength()-1);for(let b=0;b<l.getLength();b+=1)for(let i=0;i<c.getLength();i+=1)y[b+i]^=ys.gexp(ys.glog(l.getAt(b))+ys.glog(c.getAt(i)));return Xo(y,0)},l.mod=function(c){if(l.getLength()-c.getLength()<0)return l;const y=ys.glog(l.getAt(0))-ys.glog(c.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<c.getLength();i+=1)b[i]^=ys.gexp(ys.glog(c.getAt(i))+y);return Xo(b,0).mod(c)},l},sg=(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(c,y){const b={};return b.totalCount=c,b.dataCount=y,b},s={},l=function(c,y){switch(y){case Wo.L:return t[(c-1)*4+0];case Wo.M:return t[(c-1)*4+1];case Wo.Q:return t[(c-1)*4+2];case Wo.H:return t[(c-1)*4+3];default:return}};return s.getRSBlocks=function(c,y){const b=l(c,y);if(typeof b>"u")throw"bad rs block @ typeNumber:"+c+"/errorCorrectionLevel:"+y;const i=b.length/3,a=[];for(let f=0;f<i;f+=1){const _=b[f*3+0],d=b[f*3+1],k=b[f*3+2];for(let E=0;E<_;E+=1)a.push(e(d,k))}return a},s})(),ig=function(){const t=[];let e=0;const s={};return s.getBuffer=function(){return t},s.getAt=function(l){const c=Math.floor(l/8);return(t[c]>>>7-l%8&1)==1},s.put=function(l,c){for(let y=0;y<c;y+=1)s.putBit((l>>>c-y-1&1)==1)},s.getLengthInBits=function(){return e},s.putBit=function(l){const c=Math.floor(e/8);t.length<=c&&t.push(0),l&&(t[c]|=128>>>e%8),e+=1},s},u2=function(t){const e=wn.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(c(i.substring(a,a+3)),10),a+=3;a<i.length&&(i.length-a==1?b.put(c(i.substring(a,a+1)),4):i.length-a==2&&b.put(c(i.substring(a,a+2)),7))};const c=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},d2=function(t){const e=wn.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(c(b.charAt(i))*45+c(b.charAt(i+1)),11),i+=2;i<b.length&&y.put(c(b.charAt(i)),6)};const c=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},h2=function(t){const e=wn.MODE_8BIT_BYTE,s=Wi.stringToBytes(t),l={};return l.getMode=function(){return e},l.getLength=function(c){return s.length},l.write=function(c){for(let y=0;y<s.length;y+=1)c.put(s[y],8)},l},f2=function(t){const e=wn.MODE_KANJI,s=Wi.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),c={};return c.getMode=function(){return e},c.getLength=function(y){return~~(l.length/2)},c.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)},c},A_=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,c){l=l||0,c=c||s.length;for(let y=0;y<c;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},p2=function(){let t=0,e=0,s=0,l="";const c={},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 c.writeByte=function(i){for(t=t<<8|i&255,e+=8,s+=1;e>=6;)y(t>>>e-6),e-=6},c.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+="="}},c.toString=function(){return l},c},m2=function(t){const e=t;let s=0,l=0,c=0;const y={};y.read=function(){for(;c<8;){if(s>=e.length){if(c==0)return-1;throw"unexpected end of file./"+c}const a=e.charAt(s);if(s+=1,a=="=")return c=0,-1;if(a.match(/^\s$/))continue;l=l<<6|b(a.charCodeAt(0)),c+=6}const i=l>>>c-8&255;return c-=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},g2=function(t,e){const s=t,l=e,c=new Array(t*e),y={};y.setPixel=function(f,_,d){c[_*s+f]=d},y.write=function(f){f.writeString("GIF87a"),f.writeShort(s),f.writeShort(l),f.writeByte(128),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(0),f.writeByte(255),f.writeByte(255),f.writeByte(255),f.writeString(","),f.writeShort(0),f.writeShort(0),f.writeShort(s),f.writeShort(l),f.writeByte(0);const _=2,d=i(_);f.writeByte(_);let k=0;for(;d.length-k>255;)f.writeByte(255),f.writeBytes(d,k,255),k+=255;f.writeByte(d.length-k),f.writeBytes(d,k,d.length-k),f.writeByte(0),f.writeString(";")};const b=function(f){const _=f;let d=0,k=0;const E={};return E.write=function(M,w){if(M>>>w)throw"length over";for(;d+w>=8;)_.writeByte(255&(M<<d|k)),w-=8-d,M>>>=8-d,k=0,d=0;k=M<<d|k,d=d+w},E.flush=function(){d>0&&_.writeByte(k)},E},i=function(f){const _=1<<f,d=(1<<f)+1;let k=f+1;const E=a();for(let g=0;g<_;g+=1)E.add(String.fromCharCode(g));E.add(String.fromCharCode(_)),E.add(String.fromCharCode(d));const M=A_(),w=b(M);w.write(_,k);let h=0,v=String.fromCharCode(c[h]);for(h+=1;h<c.length;){const g=String.fromCharCode(c[h]);h+=1,E.contains(v+g)?v=v+g:(w.write(E.indexOf(v),k),E.size()<4095&&(E.size()==1<<k&&(k+=1),E.add(v+g)),v=g)}return w.write(E.indexOf(v),k),w.write(d,k),w.flush(),M.toByteArray()},a=function(){const f={};let _=0;const d={};return d.add=function(k){if(d.contains(k))throw"dup key:"+k;f[k]=_,_+=1},d.size=function(){return _},d.indexOf=function(k){return f[k]},d.contains=function(k){return typeof f[k]<"u"},d};return y},v2=function(t,e,s){const l=g2(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 c=A_();l.write(c);const y=p2(),b=c.toByteArray();for(let i=0;i<b.length;i+=1)y.writeByte(b[i]);return y.flush(),"data:image/gif;base64,"+y};Wi.stringToBytes;const Fo=4;function _2(t){const e=Wi(0,"M");e.addData(t,"Byte"),e.make();const s=e.getModuleCount();let l="";for(let c=0;c<s;c++){let y=0;for(;y<s;){if(!e.isDark(c,y)){y++;continue}const b=y;for(;y<s&&e.isDark(c,y);)y++;l+=`M${b} ${c}h${y-b}v1h-${y-b}z`}}return{size:s,path:l}}const w2=1e3,b2=4e3;function y2({status:t,pairing:e,phonePairing:s,phoneStarted:l,problem:c,platform:y,onSetEnabled:b,onSetPort:i,onStartPairing:a,onCancelPairing:f,onStartPhonePairing:_,onCancelPhonePairing:d,onRenameDevice:k,onRevokeDevice:E,onDismissProblem:M,onClose:w}){const[h,v]=N.useState(()=>eg(t.hostNames)),[g,p]=N.useState(String(t.port)),[S,j]=N.useState(null),L=N.useRef(null),[R,x]=N.useState(()=>Date.now()),T=()=>{e!==null&&f(),l&&d(),w()},I=N.useRef(T);I.current=T,N.useEffect(()=>{const D=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),I.current())};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[]),N.useEffect(()=>{if(e===null&&s===null)return;x(Date.now());const D=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(D)},[e,s]),N.useEffect(()=>()=>{L.current!==null&&window.clearTimeout(L.current)},[]);const O=N.useRef(null),P=s!==null;N.useEffect(()=>{var U;if(!P)return;const D=window.matchMedia("(prefers-reduced-motion: reduce)").matches;(U=O.current)==null||U.scrollIntoView({block:"center",behavior:D?"auto":"smooth"})},[P]),N.useEffect(()=>{p(String(t.port))},[t.port]),N.useEffect(()=>{t.hostNames.includes(h)||v(eg(t.hostNames))},[t.hostNames,h]);const F=(D,U)=>{navigator.clipboard.writeText(U).then(()=>{j(D),L.current!==null&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>j(null),w2)}).catch(()=>j(null))},W=r2(g),$=W!==null&&W!==t.port,K=t2(t,h),G=m("remote.title"),q=e===null?null:n2(t.port,e.code);return o.jsx("div",{className:"modal-backdrop",onClick:T,children:o.jsxs("div",{className:"modal",role:"dialog","aria-label":G,onClick:D=>D.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:G}),o.jsx("button",{className:"icon-button",onClick:T,title:m("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:Ad(t.state,t.port)}),o.jsx("p",{className:"modal-hint",children:m("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:m("remote.turnOff")}),o.jsx("span",{className:"modal-hint",children:m("remote.turnOffHint")})]}):o.jsx("button",{className:"primary-button",onClick:()=>b(!0),children:m("remote.turnOn")})}),o.jsxs("div",{className:"remote-port",children:[o.jsx("label",{className:"modal-hint",htmlFor:"remote-port-input",children:m("remote.port")}),o.jsx("input",{id:"remote-port-input",className:"remote-port-input",inputMode:"numeric",value:g,onChange:D=>p(D.target.value),onKeyDown:D=>{D.key==="Enter"&&$&&W!==null&&i(W)}}),o.jsx("button",{className:"link-button",onClick:()=>W!==null&&i(W),disabled:!$,children:m("remote.portSave")}),W===null&&o.jsx("span",{className:"modal-hint remote-port-invalid",children:s2()})]}),o.jsx("p",{className:"modal-hint",children:m("remote.restartHint")}),c!==null&&o.jsxs("div",{className:"vault-problem",role:"alert",children:[o.jsx("span",{children:c}),o.jsx("button",{className:"icon-button",onClick:M,title:m("common.close"),children:"×"})]}),o.jsx("h3",{className:"modal-section",children:m("remote.step.host")}),o.jsx("p",{className:"modal-hint",children:m("remote.step.hostHint")}),a2().map(D=>o.jsxs("details",{className:"remote-os",open:D.platform===c2(y),children:[o.jsx("summary",{className:"remote-os-summary",children:D.label}),o.jsx("p",{className:"modal-hint",children:D.hint}),D.command!==null&&o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:D.command}),o.jsx("button",{className:"link-button",onClick:()=>F("ssh",D.command??""),children:S==="ssh"?o.jsxs(o.Fragment,{children:["✓ ",m("remote.copied")]}):m("remote.copy")})]})]},D.platform)),o.jsx("h3",{className:"modal-section",children:m("remote.step.tunnel")}),o.jsx("p",{className:"modal-hint",children:m("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:m("remote.address")}),o.jsx("select",{id:"remote-host-select",className:"remote-host-select",value:h,onChange:D=>v(D.target.value),children:t.hostNames.map(D=>o.jsx("option",{value:D,children:D},D))})]}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:K}),o.jsx("button",{className:"link-button",onClick:()=>F("command",K),children:S==="command"?o.jsxs(o.Fragment,{children:["✓ ",m("remote.copied")]}):m("remote.copy")})]}),o.jsxs("details",{className:"remote-os",children:[o.jsx("summary",{className:"remote-os-summary",children:m("remote.trouble")}),o.jsxs("ul",{className:"remote-trouble",children:[o.jsx("li",{className:"modal-hint",children:m("remote.trouble.network")}),o.jsx("li",{className:"modal-hint",children:m("remote.vpnHint")}),t.sshUser.length>0&&o.jsx("li",{className:"modal-hint",children:m("remote.userHint",{user:t.sshUser})})]})]}),o.jsx("h3",{className:"modal-section",children:m("remote.step.pair")}),e===null||q===null?o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:a,disabled:!Ea(t),children:m("remote.pair.start")}),!Ea(t)&&o.jsx("span",{className:"modal-hint",children:m("remote.pair.needsActive")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("remote.pair.open")}),o.jsxs("div",{className:"status-line-fragment",children:[o.jsx("pre",{className:"tool-pre",children:q}),o.jsx("button",{className:"link-button",onClick:()=>F("pairing",q),children:S==="pairing"?o.jsxs(o.Fragment,{children:["✓ ",m("remote.copied")]}):m("remote.copy")})]}),o.jsxs("p",{className:"modal-hint",children:[m("remote.pair.expires",{time:ng(tg(e.expiresAt,R))})," ",m("remote.pair.after",{url:M_(t.port)})]}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:f,children:m("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:m("remote.phone.title")}),s===null?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("remote.phone.hint")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"primary-button",onClick:_,disabled:!Ea(t),children:m("remote.phone.start")}),!Ea(t)&&o.jsx("span",{className:"modal-hint",children:m("remote.pair.needsActive")})]})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:l2(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:S==="phone"?o.jsxs(o.Fragment,{children:["✓ ",m("remote.copied")]}):m("remote.copy")})]}),o.jsx("p",{className:"modal-hint",children:m("remote.phone.authorizeOnce")}),o.jsx("p",{className:"modal-hint",children:m("remote.phone.scan")}),o.jsx("div",{ref:O,children:o.jsx(k2,{payload:s.payload})}),o.jsx("p",{className:"modal-hint",children:m("remote.phone.secret")}),o.jsx("p",{className:"modal-hint",children:m("remote.pair.expires",{time:ng(tg(s.expiresAt,R))})}),o.jsx("div",{className:"vault-actions",children:o.jsx("button",{className:"link-button",onClick:d,children:m("remote.pair.cancel")})})]}),o.jsx("h3",{className:"modal-section",children:m("remote.devices")}),t.devices.length===0?o.jsx("p",{className:"modal-hint",children:m("remote.devices.empty")}):o.jsx("ul",{className:"remote-devices",children:t.devices.map(D=>o.jsx(C2,{device:D,onRename:U=>k(D.id,U),onRevoke:()=>E(D.id)},D.id))})]})]})})}function k2({payload:t}){const e=_2(t),s=e.size+Fo*2;return o.jsxs("svg",{className:"remote-phone-qr",viewBox:`${-Fo} ${-Fo} ${s} ${s}`,role:"img","aria-label":m("remote.phone.qrLabel"),shapeRendering:"crispEdges",children:[o.jsx("rect",{x:-Fo,y:-Fo,width:s,height:s,fill:"#fff"}),o.jsx("path",{d:e.path,fill:"#000"})]})}function C2({device:t,onRename:e,onRevoke:s}){const[l,c]=N.useState(!1),[y,b]=N.useState(t.label),[i,a]=N.useState(!1),f=N.useRef(null);N.useEffect(()=>()=>{f.current!==null&&window.clearTimeout(f.current)},[]);const _=()=>{c(!1);const k=y.trim();k.length>0&&k!==t.label&&e(k)},d=()=>{if(i){s();return}a(!0),f.current=window.setTimeout(()=>a(!1),b2)};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),c(!0)},title:m("remote.device.rename"),children:t.label}),o.jsx("span",{className:`remote-device-seen${t.connected?" remote-device-connected":""}`,children:i2(t)}),o.jsx("span",{className:"remote-device-paired",children:o2(t)})]}),o.jsx("button",{className:`link-button${i?" remote-device-confirm":""}`,onClick:d,children:m(i?"remote.device.revokeConfirm":"remote.device.revoke")})]})}const Qu="agent-workbench.notes-open",og="agent-workbench.notes-active",lg="agent-workbench.notes-height",Ju=160,x2=300;function S2(t){return t.text.trim().length===0?t.images.length>0?m("notes.imageOnly"):m("notes.untitled"):ey(t)}function E2({notes:t,onSendNote:e,sendTargetCwd:s,onNoteToComposer:l,composerTarget:c,fill:y,onHide:b}){const[i,a]=N.useState(()=>jt(Qu,!1,G=>G==="true")),f=i||y,[_,d]=N.useState(()=>jt(lg,x2,G=>{const q=Number.parseInt(G,10);return Number.isFinite(q)?Math.max(q,Ju):null})),[k,E]=N.useState(()=>jt(og,null,G=>G)),[M,w]=N.useState(null),[h,v]=N.useState(null),[g,p]=N.useState(0),S=Y5(),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]),L=N.useCallback(G=>{E(G),Lt(og,G),w(null)},[]),R=N.useCallback(()=>{a(G=>{const q=!G;return Lt(Qu,String(q)),q})},[]),x=N.useCallback(()=>{const G=t.create();L(G),f||(a(!0),Lt(Qu,"true")),p(q=>q+1)},[t,f,L]),T=N.useCallback(G=>{if(G.text.trim().length===0&&G.images.length===0){t.remove(G.noteId);return}L(G.noteId),w(G.noteId)},[t,L]),I=N.useCallback(()=>{M!==null&&t.remove(M),w(null)},[M,t]),O=N.useRef(null),P=N.useCallback(G=>{const q=G.currentTarget.parentElement,D=q===null?_:Math.round(q.getBoundingClientRect().height);O.current={startY:G.clientY,startHeight:D},G.currentTarget.setPointerCapture(G.pointerId),G.preventDefault()},[_]),F=N.useCallback(G=>{const q=O.current;if(q===null)return;const D=Math.max(Ju,Math.floor(window.innerHeight*.8));d(Math.min(D,Math.max(Ju,q.startHeight+q.startY-G.clientY)))},[]),W=N.useCallback(G=>{O.current!==null&&(O.current=null,G.currentTarget.releasePointerCapture(G.pointerId),Lt(lg,String(_)))},[_]);N.useEffect(()=>{if(h===null)return;const G=q=>{q.key==="Escape"&&(q.stopPropagation(),v(null))};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[h]);const $=h===null?void 0:t.images[h],K=t.notes.length;return o.jsxs("section",{className:`notes${f?" notes-open":""}${y?" notes-fill":""}`,style:f&&!y?{height:`${_}px`}:void 0,children:[f&&!y&&o.jsx("div",{className:"notes-resize",onPointerDown:P,onPointerMove:F,onPointerUp:W,onPointerCancel:W,title:m("notes.resize")}),f?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 q=G.noteId===(j==null?void 0:j.noteId),D=S2(G);return o.jsxs("div",{className:`strip-tab${q?" is-active":""}`,role:"tab","aria-selected":q,children:[o.jsx("button",{className:"strip-tab-label",onClick:()=>L(G.noteId),title:D,children:D}),o.jsx("button",{className:"strip-tab-close",onClick:()=>T(G),title:m("notes.closeNote"),children:"×"})]},G.noteId)}),o.jsx("button",{className:"strip-tab-new",onClick:x,title:m("notes.new"),children:"+"})]}),o.jsx("span",{className:"strip-spacer"}),o.jsx("button",{className:"icon-button thread-font-button",onClick:S.cycle,title:Pa(S.size),"aria-label":Pa(S.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:m("notes.collapse"),children:"▾"}),b!==void 0&&o.jsx(ja,{title:m("settings.hide.notes"),onHide:b,confirmText:null})]}),o.jsx("div",{className:"notes-body",children:K===0||j===null?o.jsx("p",{className:"notes-empty",children:fn("notes.empty")}):o.jsx(N2,{note:j,notes:t,closing:M===j.noteId,focusRequest:g,onConfirmClose:I,onCancelClose:()=>w(null),onOpenImage:v,onSend:e===null?null:()=>e(j.noteId),sendTargetCwd:s,onToComposer:l===null?null:()=>l(j.noteId),composerTarget:c},j.noteId)})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:R,title:m("notes.expand"),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:m("notes.name")}),K>0&&o.jsx("span",{className:"strip-collapsed-count",children:K})]}),b!==void 0&&o.jsx(ja,{title:m("settings.hide.notes"),onHide:b,confirmText:null})]}),h!==null&&o.jsx("div",{className:"notes-lightbox",onClick:()=>v(null),title:m("notes.lightboxClose"),children:typeof $=="string"?o.jsx("img",{src:$,alt:m("notes.imageAlt")}):o.jsx("span",{className:"notes-lightbox-missing",children:m("notes.imageUnavailable")})})]})}function T2(){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 L2(){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 N2({note:t,notes:e,closing:s,focusRequest:l,onConfirmClose:c,onCancelClose:y,onOpenImage:b,onSend:i,sendTargetCwd:a,onToComposer:f,composerTarget:_}){const d=N.useRef(null),[k,E]=N.useState(!1),M=t.text.trim().length===0&&t.images.length===0,w=sx(t.images,e.images);N.useEffect(()=>{var g;l>0&&((g=d.current)==null||g.focus())},[l]);const h=N.useCallback(g=>{const p=Array.from(g).filter(S=>S.type.startsWith("image/"));for(const S of p)e.addImage(t.noteId,S);return p.length>0},[e,t.noteId]),v=N.useCallback(g=>{g.clipboardData!==null&&h(g.clipboardData.files)&&g.preventDefault()},[h]);return o.jsxs("div",{className:`note-editor${k?" note-editor-dragging":""}`,onDragOver:g=>{Array.from(g.dataTransfer.types).includes("Files")&&(g.preventDefault(),E(!0))},onDragLeave:()=>E(!1),onDrop:g=>{g.preventDefault(),E(!1),h(g.dataTransfer.files)},children:[s&&o.jsxs("div",{className:"note-closing",children:[o.jsx("span",{children:m("notes.closeConfirm")}),o.jsx("button",{className:"link-button link-danger",onClick:c,children:m("common.close")}),o.jsx("button",{className:"link-button",onClick:y,children:m("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:m("common.close"),children:"×"})]}),o.jsx("textarea",{ref:d,className:"note-input",value:t.text,placeholder:m("notes.placeholder"),onChange:g=>e.updateText(t.noteId,g.target.value),onPaste:v,spellCheck:!1}),t.images.length>0&&o.jsx("div",{className:"note-images",children:t.images.map(g=>o.jsx(R2,{image:g,src:e.images[g.imageId],onRequest:e.requestImage,onOpen:()=>b(g.imageId),onRemove:()=>e.removeImage(t.noteId,g.imageId)},g.imageId))}),o.jsxs("div",{className:"note-footer",children:[o.jsx("span",{className:"note-meta",children:Jn(t.updatedAt)}),o.jsx("span",{className:"composer-spacer"}),o.jsx("button",{className:"link-button note-to-composer",onClick:()=>f==null?void 0:f(),disabled:f===null||M||!w,title:Bk(f===null?null:_??"",M,w),children:m("notes.toComposer")}),o.jsx("button",{className:"icon-button",onClick:()=>i==null?void 0:i(),disabled:i===null||M,title:Ok(i!==null,a,M),children:o.jsx(L2,{})}),o.jsxs("label",{className:"icon-button note-attach",title:m("notes.attach"),children:[o.jsx(T2,{}),o.jsx("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",multiple:!0,hidden:!0,onChange:g=>{g.target.files!==null&&h(g.target.files),g.target.value=""}})]})]})]})}function R2({image:t,src:e,onRequest:s,onOpen:l,onRemove:c}){return N.useEffect(()=>{e===void 0&&s(t.imageId)},[e,t.imageId,s]),o.jsxs("figure",{className:"chip chip-image note-thumb",title:yn(t.bytes),children:[typeof e=="string"?o.jsx("img",{src:e,alt:m("notes.imageAlt"),onClick:l}):o.jsx("span",{className:"note-thumb-placeholder",children:e===null?m("notes.thumbMissing"):"…"}),o.jsx("button",{className:"chip-remove",onClick:c,title:m("notes.removeImage"),children:"×"})]})}function I_(){const t=Zo(),e=mS(),[s,l]=N.useState(null),c=N.useCallback(()=>l(null),[]),y=N.useRef(null),b=f=>{hS(f).catch(()=>{})},i=[{label:m("header.locale.auto",{name:Lu[uS()]}),checked:e==="auto",onSelect:()=>b("auto")},...Ud.map(f=>({label:Lu[f],lang:f,checked:e===f,onSelect:()=>b(f)}))],a=Lu[t];return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:y,className:"icon-button locale-button",onClick:f=>{const _=f.currentTarget.getBoundingClientRect();l(d=>d===null?{x:_.left,y:_.bottom+4}:null)},title:e==="auto"?m("header.locale.titleAuto",{name:a}):m("header.locale.title",{name:a}),"aria-haspopup":"menu","aria-expanded":s!==null,children:Xy[t]}),s!==null&&o.jsx(Sd,{x:s.x,y:s.y,items:i,onClose:c,anchor:y.current})]})}function M2({onKey:t}){return o.jsx("div",{className:"narrow-keys",role:"toolbar","aria-label":m("narrow.keys.label"),children:QC.map(e=>o.jsx("button",{className:"narrow-key",onPointerDown:s=>s.preventDefault(),onClick:()=>t(e.data),title:m(e.titleKey),children:e.label},e.id))})}function A2({banners:t,status:e,statusLabel:s,terminals:l,activeTerminalId:c,activity:y,agents:b,offerAgentChoice:i,newTabAgent:a,platform:f,canOpen:_,newTabBlockedTitle:d,onSelectTab:k,onCloseTab:E,scheduled:M,onRenameTab:w,onNewTab:h,drawer:v,drawerOpen:g,onDrawerChange:p,menu:S,view:j,views:L,onViewChange:R,badges:x,chat:T,panel:I,notes:O,console:P,onTerminalKey:F}){const[W,$]=N.useState(null),K=l.find(H=>H.terminalId===c)??null,G=H=>{var z;return((z=b.find(Z=>Z.id===H.agent))==null?void 0:z.statusLine)??null};N.useEffect(()=>{if(!g&&W===null)return;const H=z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),W!==null?$(null):p(!1))};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[g,W,p]);const q=N.useRef({sheet:W,drawerOpen:g,view:j,onDrawerChange:p,onViewChange:R});q.current={sheet:W,drawerOpen:g,view:j,onDrawerChange:p,onViewChange:R},N.useEffect(()=>{const H=window;return H[Xp]=()=>{const z=q.current;switch(nx({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[Xp]}},[]);const D=N.useRef(null);N.useEffect(()=>{var H;(H=D.current)==null||H.scrollIntoView({block:"nearest",inline:"nearest"})},[j]);const U=H=>{const z=H==="git"?x.changes:H==="plans"?x.plans:H==="memory"?x.memory:0;return z>0?o.jsx("span",{className:"side-panel-badge",children:z}):H==="cli"&&x.cliUnseen&&j!=="cli"?o.jsx("span",{className:"narrow-view-dot",title:m("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:()=>p(!0),title:m("narrow.projects"),"aria-label":m("narrow.projects"),children:"☰"}),o.jsxs("button",{className:"narrow-current",onClick:()=>$("tabs"),title:m("narrow.tabs.open"),children:[K===null?o.jsx("span",{className:"app-name",children:"Agent Workbench"}):o.jsxs(o.Fragment,{children:[o.jsx(th,{terminal:K,activity:y.get(K.terminalId),statusLine:G(K)}),o.jsx("span",{className:"project-swatch",style:{background:Js(ks(K))}}),o.jsx("span",{className:"narrow-current-label",children:Go(K)})]}),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:m("narrow.more"),"aria-label":m("narrow.more"),children:"⋮"})]}),t,o.jsxs("div",{className:"narrow-body",children:[o.jsx("nav",{className:"narrow-views",role:"tablist",children:L.map(H=>o.jsxs("button",{ref:H===j?D:null,role:"tab","aria-selected":H===j,className:`narrow-view-tab${H===j?" narrow-view-active":""}`,onClick:()=>R(H),children:[o.jsx("span",{children:m(VC(H))}),U(H)]},H))}),o.jsxs("div",{className:"narrow-stack",children:[o.jsx("main",{className:`workspace narrow-pane${j==="chat"?"":" narrow-pane-veiled"}`,children:T}),I,o.jsx("div",{className:`narrow-pane${j==="notes"?"":" narrow-pane-hidden"}`,children:O}),o.jsx("div",{className:`narrow-pane${j==="console"?"":" narrow-pane-hidden"}`,children:P})]}),F!==null&&o.jsx(M2,{onKey:F})]}),g&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>p(!1),children:o.jsx("div",{className:"narrow-drawer",onClick:H=>H.stopPropagation(),children:v})}),W==="tabs"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsxs("div",{className:"narrow-sheet",role:"dialog","aria-label":m("narrow.tabs.open"),onClick:H=>H.stopPropagation(),children:[o.jsx(I2,{terminals:l,platform:f,activeTerminalId:c,activity:y,statusLineOf:G,onSelect:H=>{k(H),$(null)},onClose:E,onRename:w,scheduled:M}),o.jsx(Jd,{className:"narrow-sheet-new",text:m("narrow.tabs.new"),title:d??m("narrow.tabs.new"),disabled:!_||d!==null,offerAgentChoice:i,agents:b,agent:a,onOpen:H=>{h(H),$(null)}})]})}),W==="menu"&&o.jsx("div",{className:"narrow-backdrop",onClick:()=>$(null),children:o.jsx("div",{className:"narrow-sheet",role:"dialog","aria-label":m("narrow.more"),onClick:H=>H.stopPropagation(),children:o.jsx(D2,{menu:S,status:e,statusLabel:s,onClose:()=>$(null)})})})]})}function I2({terminals:t,platform:e,activeTerminalId:s,activity:l,statusLineOf:c,onSelect:y,onClose:b,onRename:i,scheduled:a}){const[f,_]=N.useState(null),[d,k]=N.useState(""),E=N.useRef(null);N.useEffect(()=>{var w;f!==null&&((w=E.current)==null||w.select())},[f]);const M=()=>{f!==null&&i(f,d.trim()),_(null)};return t.length===0?o.jsx("p",{className:"narrow-sheet-empty",children:m("narrow.tabs.none")}):o.jsx("ul",{className:"narrow-tabs",children:t.map(w=>{var g;const h=f===w.terminalId,v=h_(w,t,e);return o.jsxs("li",{className:`narrow-tab-row${w.terminalId===s?" narrow-tab-active":""}`,style:{"--tab-project-color":Js(ks(w))},children:[h?o.jsx("input",{ref:E,className:"narrow-tab-input",value:d,onChange:p=>k(p.target.value),onBlur:M,onKeyDown:p=>{p.key==="Enter"&&M(),p.key==="Escape"&&(p.stopPropagation(),_(null))}}):o.jsxs("button",{className:"narrow-tab-select",onClick:()=>y(w.terminalId),children:[o.jsx(th,{terminal:w,activity:l.get(w.terminalId),statusLine:c(w)}),w.review&&o.jsx("span",{className:"tab-review",title:m("worktree.tab.reviewTitle"),children:m("worktree.tab.review")}),v!==null&&o.jsx("span",{className:"tab-branch",children:v}),(((g=a==null?void 0:a.get(w.terminalId))==null?void 0:g.length)??0)>0&&o.jsx("span",{title:_v((a==null?void 0:a.get(w.terminalId))??[])??void 0,children:o.jsx(__,{messages:(a==null?void 0:a.get(w.terminalId))??[]})}),o.jsx("span",{className:"narrow-tab-label",children:Go(w)})]}),o.jsx("button",{className:"icon-button",onClick:()=>{_(w.terminalId),k(w.label.length>0?w.label:Go(w))},title:m("narrow.tabs.rename"),children:"✎"}),o.jsx("button",{className:"icon-button",onClick:()=>b(w.terminalId),title:m("narrow.tabs.close"),children:"×"})]},w.terminalId)})})}function j2({choice:t}){const e=[{source:"system",label:m("narrow.menu.chimeSystem")},{source:"page",label:m("narrow.menu.chimePage")}];return o.jsx("div",{className:"narrow-chime-choice",role:"group","aria-label":m("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 D2({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:m("narrow.menu.connection")}),o.jsx("span",{className:`status status-${e}`,children:s}),mv(navigator.userAgent)&&o.jsxs(o.Fragment,{children:[o.jsx("a",{className:"link-button",href:tx,onClick:l,children:m("narrow.menu.phoneAppDisconnect")}),o.jsx("a",{className:"link-button",href:ex,onClick:l,children:m("narrow.menu.phoneAppSettings")})]})]}),t.cwd!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("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:m("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:m("app.header.remoteBadge")}),o.jsx("span",{className:"narrow-menu-value narrow-menu-value-wrap",children:m("app.header.remoteBadgeTitle")})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("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:m("narrow.menu.language")}),o.jsx(I_,{})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("narrow.menu.sound")}),t.sound.phoneChime===null?o.jsx(N_,{sound:t.sound}):o.jsx(j2,{choice:t.sound.phoneChime})]}),t.sound.notify.supported&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("narrow.menu.notifications")}),o.jsx(R_,{notify:t.sound.notify})]}),t.remote!==null&&o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("app.header.remoteAccess")}),o.jsx("button",{className:`icon-button${t.remote.active?" icon-button-on":""}`,onClick:()=>{var c;l(),(c=t.remote)==null||c.onOpen()},title:t.remote.title,children:"⇄"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("narrow.menu.shortcuts")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onShortcuts()},title:m("app.header.shortcuts"),children:"?"})]}),o.jsxs("div",{className:"narrow-menu-row",children:[o.jsx("span",{className:"narrow-menu-label",children:m("settings.title")}),o.jsx("button",{className:"icon-button",onClick:()=>{l(),t.onSettings()},title:m("settings.open"),"aria-label":m("settings.open"),children:"⚙"})]})]})}const P2="agent-workbench.thread-tools",O2="agent-workbench.narrow-thread-tools";function j_(t){return t?O2:P2}function B2(t){return!t}function F2(t){return t?"open":"closed"}function H2(t){return t==="open"?!0:t==="closed"?!1:null}function Zu(t){return jt(j_(t),B2(t),H2)}function U2(t){const[e,s]=N.useState(()=>({narrow:t,open:Zu(t)}));e.narrow!==t&&s({narrow:t,open:Zu(t)});const l=e.narrow===t?e.open:Zu(t),c=N.useCallback(y=>{s({narrow:t,open:y}),Lt(j_(t),F2(y))},[t]);return{open:l,setOpen:c}}function W2(){const t=window.location.search,e=new URLSearchParams(t).get(ld),s=e!==null&&e.length>0?e:null,l=YC(t);return s===null&&l===null?{token:s,tab:l}:(window.history.replaceState(null,"",`${window.location.pathname}${XC(t,[ld,fv])}`),{token:s,tab:l})}const D_=W2(),ag=D_.token,$2=D_.tab,ed=new Set;function z2(t){const[e,s]=N.useState(null),[l,c]=N.useState(null),[y,b]=N.useState(ed),[i,a]=N.useState(null);N.useEffect(()=>{const h=t.onMessage(g=>{switch(g.type){case"vault.status":s(g.status);break;case"vault.exported":b(p=>{if(!p.has(g.projectKey))return p;const S=new Set(p);return S.delete(g.projectKey),S}),a({projectKey:g.projectKey,sessions:g.sessions,at:Date.now()});break;case"error":if(g.code!=="vault-failed")break;c(Mt(g.text)),g.detail!==void 0&&console.error("[servidor]",g.detail),b(ed);break}}),v=t.onReopen(()=>b(ed));return()=>{h(),v()}},[t]);const f=N.useCallback(()=>{c(null),t.send({type:"vault.measure"})},[t]),_=N.useCallback(h=>{c(null),t.send({type:"vault.enable",enabled:h})},[t]),d=N.useCallback(h=>{c(null),t.send({type:"vault.setDir",pickerId:h})},[t]),k=N.useCallback(h=>{c(null),b(v=>new Set(v).add(h)),t.send({type:"vault.exportProject",projectKey:h})},[t]),E=N.useCallback((h,v)=>{c(null),t.send({type:"vault.openSession",agent:h,sessionId:v})},[t]),M=N.useCallback(()=>{c(null),t.send({type:"vault.reveal"})},[t]),w=N.useCallback(()=>c(null),[]);return{status:e,problem:l,exporting:y,lastExported:i,measure:f,setEnabled:_,chooseDir:d,exportProject:k,openSession:E,reveal:M,dismissProblem:w}}function q2(t){return m("summary.outdatedServer",{server:t,page:Pi})}function K2(t){const[e,...s]=t;if(e===void 0||e.missingMessage===null)return null;const l=Mt(e.missingMessage);return s.length===0?l:`${l}
162
- ${m("summary.alsoWorksWith",{names:s.map(c=>c.label).join(", ")})}`}function V2(t){const e=t.version??"?";return e.toLowerCase().includes(t.label.toLowerCase())?e:`${t.label} ${e}`}function G2(t,e,s=Pi){var b,i;if(e&&s<Pi)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:q2(s),environmentNotice:null};if(e&&s>Pi)return{cliAvailable:!1,cliVersion:null,cliMissingMessage:m("summary.newerServer",{server:s,page:Pi}),environmentNotice:null};const l=t.filter(a=>a.available);let c=null;l.length===1?c=((b=l[0])==null?void 0:b.version)??null:l.length>1&&(c=l.map(V2).join(" · "));const y=e&&l.length===0;return{cliAvailable:!e||l.length>0,cliVersion:c,cliMissingMessage:y?K2(t):null,environmentNotice:((i=t.find(a=>a.environmentNotice!==null))==null?void 0:i.environmentNotice)??null}}const Y2=500,X2=8e3;class Q2{constructor(){Ut(this,"socket",null);Ut(this,"status","connecting");Ut(this,"attempt",0);Ut(this,"closedByUs",!1);Ut(this,"hasConnectedOnce",!1);Ut(this,"reconnectTimer");Ut(this,"messageHandlers",new Set);Ut(this,"statusHandlers",new Set);Ut(this,"reopenHandlers",new Set);Ut(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(Ry,window.location.href);e.protocol=window.location.protocol==="https:"?"wss:":"ws:",ag!==null&&e.searchParams.set(ld,ag);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(Lp(l))}if(this.hasConnectedOnce)for(const l of this.reopenHandlers)l();this.hasConnectedOnce=!0},s.onmessage=l=>{const c=Oy(l.data);if(c===null){console.warn("[conexion] mensaje del servidor no reconocido");return}for(const y of this.messageHandlers)y(c)},s.onclose=l=>{if(this.socket=null,!this.closedByUs){if(l.code===wy){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(Lp(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(Y2*2**(this.attempt-1),X2);window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>this.connect(),e)}}const P_=new Set;function J2(t){return t!==void 0&&P_.has(t)}function Wn(){const t=crypto.randomUUID();return P_.add(t),t}function O_(t,e){return t.reason==="requested"&&e!==null&&(t.requestId===void 0||t.requestId===e)}const td={rows:[],kept:[]},cg=new d_;function Z2(t,e,s){const[l,c]=N.useState({...td,stale:!1});return N.useEffect(()=>{if(e===null){c({...td,stale:!1});return}const y=cg.enter(e,td);c({...y.value,stale:y.stale});const b=()=>{t.send({type:"worktree.status",terminalId:e})},i=t.onMessage(f=>{if(f.type==="worktree.rows"&&f.terminalId===e){const _={rows:f.rows,kept:f.kept??[]};cg.store(e,_),c({..._,stale:!1})}f.type==="worktree.changed"&&b()}),a=t.onReopen(b);return()=>{i(),a()}},[t,e]),N.useEffect(()=>{e!==null&&s>0&&t.send({type:"worktree.status",terminalId:e})},[t,e,s]),l}function eN(t,e,s){const[l,c]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),f=N.useRef(null),_=N.useRef(null),d=N.useRef(null),k=N.useRef(null),E=N.useRef(null);N.useEffect(()=>t.onMessage(K=>{switch(K.type){case"worktree.inspected":if(K.requestId!==f.current)break;c(G=>G===null?null:{...G,state:{phase:"ready",inspection:K.inspection}});break;case"terminal.opened":if(K.requestId===f.current){f.current=null,c(null);const G=_.current;_.current=null,G==null||G()}break;case"worktree.moved":K.requestId===f.current&&(f.current=null,c(null));break;case"worktree.removePlan":if(K.requestId!==d.current)break;b(G=>G===null?null:{...G,state:{phase:"ready",plan:K.plan}});break;case"worktree.removed":if(K.requestId!==d.current)break;d.current=null,b(G=>G===null?null:{...G,state:{phase:"done",outcome:K.outcome}});break;case"worktree.deleteBranchPlan":if(K.requestId!==E.current)break;a(G=>G===null?null:{...G,state:{phase:"ready",plan:K.plan}});break;case"worktree.branchDeleted":if(K.requestId!==E.current)break;E.current=null,a(G=>G===null?null:{...G,state:{phase:"done"}});break;case"composer.prefill":O_(K,k.current)&&(k.current=null,s(K.terminalId));break;case"error":{const G=Mt(K.text);K.requestId!==void 0&&K.requestId===f.current&&(f.current=null,c(q=>{if(q===null)return null;const D=q.state.phase==="loading"?null:q.state.inspection;return{...q,state:{phase:"failed",inspection:D,message:G}}})),K.requestId!==void 0&&K.requestId===d.current&&(d.current=null,b(q=>{if(q===null)return null;const D=q.state.phase==="ready"||q.state.phase==="removing"?q.state.plan:null;return{...q,state:{phase:"failed",plan:D,message:G}}})),K.requestId!==void 0&&K.requestId===E.current&&(E.current=null,a(q=>{if(q===null)return null;const D=q.state.phase==="ready"||q.state.phase==="deleting"?q.state.plan:null;return{...q,state:{phase:"failed",plan:D,message:G}}})),K.requestId!==void 0&&K.requestId===k.current&&(k.current=null);break}}}),[t,s]);const M=N.useCallback((K,G,q,D)=>{const U=Wn();f.current=U,_.current=D??null,c({source:K,projectCwd:G,projectName:q,state:{phase:"loading"},move:null}),t.send({type:"worktree.inspect",requestId:U,source:K})},[t]),w=N.useCallback((K,G,q)=>{const D=Wn();f.current=D,_.current=null;const U={kind:"terminal",terminalId:K.terminalId};c({source:U,projectCwd:G,projectName:q,state:{phase:"loading"},move:K}),t.send({type:"worktree.inspect",requestId:D,source:U})},[t]),h=N.useCallback(K=>{if(l===null||l.state.phase!=="ready"&&l.state.phase!=="failed")return;const{inspection:G}=l.state;if(G===null)return;const q=Wn();if(f.current=q,c({...l,state:{phase:"creating",inspection:G}}),l.move!==null){t.send({type:"worktree.move",requestId:q,terminalId:l.move.terminalId,branch:K.branch,base:K.base,mode:K.mode,copyNotes:K.copyNotes,askChanges:K.askChanges===!0});return}e(q,{cwd:l.projectCwd,label:K.branch,agent:K.agent??null}),t.send({type:"worktree.create",requestId:q,source:l.source,branch:K.branch,base:K.base,mode:K.mode,copyNotes:K.copyNotes,...K.agent!==void 0?{agent:K.agent}:{}})},[t,l,e]),v=N.useCallback(()=>{(l==null?void 0:l.state.phase)!=="creating"&&(f.current=null,_.current=null),c(null)},[l]),g=N.useCallback(K=>{const G=Wn();d.current=G,t.send({type:"worktree.planRemove",requestId:G,worktreeId:K})},[t]),p=N.useCallback((K,G)=>{b({worktreeId:K,branch:G,state:{phase:"loading"},acceptedFiles:null}),g(K)},[g]),S=N.useCallback((K,G,q,D)=>{const U=Wn();d.current=U,b({...K,acceptedFiles:D,state:{phase:"removing",plan:G}});const H=el(G,D)?D:null;t.send({type:"worktree.remove",requestId:U,worktreeId:K.worktreeId,discardConflicts:q,...H!==null?{discardUntracked:H}:{}})},[t]),j=N.useCallback(K=>{y===null||y.state.phase!=="ready"||S(y,y.state.plan,K,y.acceptedFiles)},[y,S]),L=N.useCallback(()=>{var q;if(y===null||y.state.phase!=="ready")return;const{plan:K}=y.state,G=((q=K.untracked)==null?void 0:q.stamp)??null;G!==null&&(g_(K,G)==="remove"?S(y,K,!1,G):b({...y,acceptedFiles:G}))},[y,S]),R=N.useCallback(K=>{if(y===null)return;const G=crypto.randomUUID();k.current=G,e(G,null),t.send({type:K,requestId:G,worktreeId:y.worktreeId}),d.current=null,b(null)},[t,e,y]),x=N.useCallback(()=>R("worktree.askNotes"),[R]),T=N.useCallback(()=>R("worktree.askCommit"),[R]),I=N.useCallback(()=>{y!==null&&(b({...y,state:{phase:"loading"}}),g(y.worktreeId))},[g,y]),O=N.useCallback(()=>{d.current=null,b(null)},[]),P=N.useCallback((K,G,q,D)=>{const U=crypto.randomUUID();e(U,{cwd:q,label:D,agent:K}),t.send({type:"worktree.reopen",requestId:U,agent:K,sessionId:G})},[t,e]),F=N.useCallback((K,G)=>{const q=Wn();E.current=q,a({worktreeId:K,branch:G,state:{phase:"loading"}}),t.send({type:"worktree.planDeleteBranch",requestId:q,worktreeId:K})},[t]),W=N.useCallback(()=>{if(i===null||i.state.phase!=="ready"||i.state.plan.blocker!==null)return;const K=Wn();E.current=K,a({...i,state:{phase:"deleting",plan:i.state.plan}}),t.send({type:"worktree.deleteBranch",requestId:K,worktreeId:i.worktreeId})},[t,i]),$=N.useCallback(()=>{E.current=null,a(null)},[]);return{create:l,openCreate:M,openMove:w,submitCreate:h,closeCreate:v,remove:y,openRemove:p,confirmRemove:j,discardFiles:L,askNotes:x,askCommit:T,retryRemove:I,closeRemove:O,reopen:P,deleteBranch:i,openDeleteBranch:F,confirmDeleteBranch:W,closeDeleteBranch:$}}function tN(t,e,s){const[l,c]=N.useState(null),[y,b]=N.useState(null),[i,a]=N.useState(null),f=N.useRef(null),_=N.useRef(null),d=N.useRef(null),k=N.useRef(null),E=N.useRef(null);N.useEffect(()=>t.onMessage(O=>{switch(O.type){case"worktree.branchChanges":if(O.requestId!==f.current)break;f.current=null,c(P=>P===null?null:{...P,state:{phase:"ready",changes:O.changes}});break;case"worktree.branchDiff":if(O.requestId!==_.current)break;_.current=null,c(P=>P===null||P.diff===null?P:{...P,diff:{...P.diff,diff:O.diff}});break;case"worktree.reviewPlan":if(O.requestId!==d.current)break;d.current=null,b(P=>P===null?null:{...P,state:{phase:"ready",plan:O.plan}});break;case"terminal.opened":O.requestId!==void 0&&O.requestId===d.current&&(d.current=null,b(null));break;case"worktree.integratePlan":if(O.requestId!==k.current)break;k.current=null,a(P=>P===null?null:{...P,state:{phase:"ready",plan:O.plan}});break;case"worktree.integrated":if(O.requestId!==k.current)break;k.current=null,a(P=>{if(P===null)return null;const F=P.state.phase==="integrating"?P.state.plan:null;return F===null?P:{...P,state:{phase:"done",plan:F,outcome:O.outcome}}});break;case"composer.prefill":O_(O,E.current)&&(E.current=null,s(O.terminalId));break;case"error":{const{requestId:P}=O;if(P===void 0)break;const F=Mt(O.text);P===f.current&&(f.current=null,c(W=>W===null?null:{...W,state:{phase:"failed",message:F}})),P===_.current&&(_.current=null,c(W=>W===null||W.diff===null?W:{...W,diff:{...W.diff,message:F}})),P===d.current&&(d.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}}})),P===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}}})),P===E.current&&(E.current=null);break}}}),[t,s]);const M=N.useCallback((O,P)=>{const F=Wn();f.current=F,_.current=null,c({worktreeId:O,branch:P,state:{phase:"loading"},diff:null}),t.send({type:"worktree.changes",requestId:F,worktreeId:O})},[t]),w=N.useCallback(O=>{if(l===null)return;const P=Wn();_.current=P,c({...l,diff:{path:O,diff:null,message:null}}),t.send({type:"worktree.changesDiff",requestId:P,worktreeId:l.worktreeId,path:O})},[t,l]),h=N.useCallback(()=>{_.current=null,c(O=>O===null?null:{...O,diff:null})},[]),v=N.useCallback(()=>{f.current=null,_.current=null,c(null)},[]),g=N.useCallback((O,P,F)=>{const W=Wn();d.current=W,b({worktreeId:O,branch:P,projectCwd:F,state:{phase:"loading"}}),t.send({type:"worktree.planReview",requestId:W,worktreeId:O})},[t]),p=N.useCallback(O=>{if(y===null||y.state.phase!=="ready"&&y.state.phase!=="failed")return;const{plan:P}=y.state;if(P===null)return;const F=Wn();d.current=F,b({...y,state:{phase:"requesting",plan:P}});const W=y.projectCwd.split(/[\\/]/).filter($=>$.length>0).pop()??y.projectCwd;e(F,{cwd:y.projectCwd,label:W,agent:O}),t.send({type:"worktree.requestReview",requestId:F,worktreeId:y.worktreeId,agent:O})},[t,e,y]),S=N.useCallback(()=>{(y==null?void 0:y.state.phase)!=="requesting"&&(d.current=null),b(null)},[y]),j=N.useCallback((O,P)=>{const F=Wn();k.current=F,a({worktreeId:O,branch:P,state:{phase:"loading"}}),t.send({type:"worktree.planIntegrate",requestId:F,worktreeId:O})},[t]),L=N.useCallback(()=>{if(i===null||i.state.phase!=="ready")return;const O=Wn();k.current=O;const{plan:P}=i.state;a({...i,state:{phase:"integrating",plan:P}}),t.send({type:"worktree.integrate",requestId:O,worktreeId:i.worktreeId,...P.branchCommit!==null?{branchCommit:P.branchCommit}:{}})},[t,i]),R=N.useCallback(()=>{k.current=null,a(null)},[]),x=N.useCallback((O,P)=>{const F=crypto.randomUUID();E.current=F,e(F,null),t.send({type:O,requestId:F,worktreeId:P})},[t,e]),T=N.useCallback(O=>x("worktree.sendReview",O),[x]),I=N.useCallback(O=>x("worktree.catchUp",O),[x]);return{changes:l,openChanges:M,openChangeDiff:w,closeChangeDiff:h,closeChanges:v,review:y,openReview:g,submitReview:p,closeReview:S,integrate:i,openIntegrate:j,confirmIntegrate:L,closeIntegrate:R,sendReview:T,catchUp:I}}const Id="agent-workbench.activeTab";function nN(){try{return window.sessionStorage.getItem(Id)}catch{return null}}const rN={state:"idle",scannedFiles:0,totalFiles:0};function sN(t,e,s){const l=new Map(s?[]:t.map(c=>[c.key,c]));for(const c of e)l.set(c.key,c);return[...l.values()].sort((c,y)=>y.lastActivityAt-c.lastActivityAt)}function iN(){const t=N.useMemo(()=>new Q2,[]),e=N.useMemo(()=>new RC({send:(we,Ue)=>t.send({type:"composer.draft",terminalId:we,draft:Ue}),connected:()=>t.getStatus()==="open",setTimer:(we,Ue)=>window.setTimeout(we,Ue),clearTimer:we=>window.clearTimeout(we),newId:()=>crypto.randomUUID()}),[t]),[s,l]=N.useState("connecting"),[c,y]=N.useState([]),[b,i]=N.useState(null),[a,f]=N.useState(!1),[_,d]=N.useState(Pi),[k,E]=N.useState(""),[M,w]=N.useState(""),[h,v]=N.useState(null),[g,p]=N.useState(!1),[S,j]=N.useState(!1),[L,R]=N.useState(!1),[x,T]=N.useState([]),[I,O]=N.useState([]),[P,F]=N.useState(rN),[W,$]=N.useState(nN);N.useEffect(()=>{try{W===null?window.sessionStorage.removeItem(Id):window.sessionStorage.setItem(Id,W)}catch{}},[W]);const[K,G]=N.useState(new Set),[q,D]=N.useState(new Map),[U,H]=N.useState(new Map),z=N.useRef(new Map),Z=N.useRef(new Map),[ie,ye]=N.useState(new Set),[_e,Q]=N.useState(null),[Y,ne]=N.useState([]),[ee,be]=N.useState(new Map),[me,Be]=N.useState([]),ze=N.useRef(1),[Qe,dt]=N.useState(new Map),[Ie,at]=N.useState(new Map),xt=N.useRef(new Set),oe=N.useRef(new Map),je=N.useRef(new Map),Ae=N.useCallback(we=>{const Ue=je.current.get(we);Ue!==void 0&&(clearTimeout(Ue),je.current.delete(we)),ne(se=>se.some(te=>te.requestId===we)?se.filter(te=>te.requestId!==we):se)},[]),Le=N.useCallback(()=>{for(const we of je.current.values())clearTimeout(we);je.current.clear(),ne(we=>we.length===0?we:[])},[]);N.useEffect(()=>{const we=t.onStatus(te=>{l(te),te==="failed"&&Q({message:m("workspace.connectFailed"),at:Date.now()})}),Ue=t.onMessage(te=>{switch(te.type){case"agent.submitted":e.submittedAck(te.terminalId,te.requestId,te.delivered);break;case"agent.codexQueueResult":e.submittedAck(te.terminalId,te.requestId,te.result==="queued");break;case"agents":y(te.agents),i(te.defaultAgent);break;case"hello":at(new Map),y(te.agents),i(te.defaultAgent),f(!0),d(te.protocolVersion),E(te.platform),w(te.defaultCwd),v(te.shellName),p(te.remoteClient),j(te.fileCheck),R(te.fileWrite);break;case"terminal.list":{T(te.terminals),e.retain(te.terminals.map(De=>De.terminalId));const ve=iC(Z.current,te.terminals),st=ve.finished.length>0||[...ve.phases].some(([De,Je])=>Z.current.get(De)!==Je);Z.current=ve.phases,st&&ye(new Set(ve.phases.keys())),G(De=>{if(De.size===0)return De;const Je=new Set(De);for(const Dt of De){if(ve.phases.has(Dt))continue;const Yt=te.terminals.find(Zn=>Zn.terminalId===Dt);(Yt===void 0||Yt.alive)&&Je.delete(Dt)}return Je.size===De.size?De:Je}),H(De=>{if(De.size===0)return De;const Je=new Map([...De].filter(([Dt])=>te.terminals.some(Yt=>Yt.terminalId===Dt)));return Je.size===De.size?De:(z.current=Je,Je)});const We=te.terminals.filter(De=>De.kind==="agent");$(De=>{var Je;return De!==null&&We.some(Dt=>Dt.terminalId===De)?De:((Je=We[0])==null?void 0:Je.terminalId)??null}),be(De=>{if(De.size===0)return De;const Je=new Map(De);for(const Dt of De.keys())te.terminals.some(Yt=>Yt.terminalId===Dt)||Je.delete(Dt);return Je.size===De.size?De:Je}),dt(De=>{if(De.size===0)return De;const Je=new Map([...De].filter(([Dt])=>te.terminals.some(Yt=>Yt.terminalId===Dt)));return Je.size===De.size?De:Je});break}case"session.continued":be(ve=>new Map(ve).set(te.terminalId,{sourceAgent:te.source.agent,includedTurns:te.includedTurns,totalTurns:te.totalTurns,totalTurnsIsMinimum:te.totalTurnsIsMinimum,delivery:te.delivery,prefillReason:null}));break;case"composer.prefill":{if(e.consumeSubmitPrefill(te.terminalId,te.requestId))break;const ve=ze.current;ze.current+=1;const st=te.reason==="stopped-early"&&TS(te.terminalId);Be(De=>[...De,{id:ve,terminalId:te.terminalId,text:te.text,pasted:te.pasted??[],focus:te.reason==="queue-edit"||te.reason==="unscheduled"||st}]);const{reason:We}=te;if(st)break;if(We==="returned-by-cli"||We==="stopped-early"){dt(De=>De.get(te.terminalId)===We?De:new Map(De).set(te.terminalId,We));break}if(We==="rewound"||We==="requested"||We==="queue-edit"||We==="unscheduled")break;be(De=>{const Je=De.get(te.terminalId);return Je===void 0?De:new Map(De).set(te.terminalId,{...Je,delivery:"prefilled",prefillReason:We})});break}case"composer.drafts":e.restore(te.drafts);break;case"composer.suggestion":at(ve=>Jp(ve,te.terminalId,te.text));break;case"terminal.opened":{Ae(te.requestId),xt.current.delete(te.requestId)&&te.terminal.kind==="agent"&&$(te.terminal.terminalId);const ve=oe.current.get(te.requestId);ve!==void 0&&(oe.current.delete(te.requestId),ve(te.terminal));break}case"terminal.activity":D(ve=>ve.get(te.terminalId)===te.activity?ve:new Map(ve).set(te.terminalId,te.activity)),H(ve=>{const st=te.offlineReason??null;if((ve.get(te.terminalId)??null)===st)return ve;const We=new Map(ve);return st===null?We.delete(te.terminalId):We.set(te.terminalId,st),z.current=We,We});break;case"index.status":F(te.status);break;case"index.projects":O(ve=>sN(ve,te.projects,te.replace));break;case"error":if(J2(te.requestId)){te.detail!==void 0&&console.error("[servidor]",te.detail),te.requestId!==void 0&&(xt.current.delete(te.requestId),oe.current.delete(te.requestId),Ae(te.requestId));break}if(p5(te.requestId)){te.detail!==void 0&&console.error("[servidor]",te.detail);break}if(te.code==="vault-failed"||te.code==="search-failed"||te.code==="remote-failed"||te.code==="settings-failed"||te.code==="rewind-failed")break;Q({message:Mt(te.text),at:Date.now()}),G(ve=>ve.size===0?ve:new Set),Z.current.size>0&&(Z.current=new Map,ye(new Set)),te.detail!==void 0&&console.error("[servidor]",te.detail),te.requestId!==void 0&&(xt.current.delete(te.requestId),oe.current.delete(te.requestId),Ae(te.requestId));break}}),se=t.onReopen(()=>{Le(),G(te=>te.size===0?te:new Set),Z.current.size>0&&(Z.current=new Map,ye(new Set))});return t.connect(),()=>{we(),Ue(),se(),t.close()}},[t,e,Ae,Le]),N.useEffect(()=>{const we=t.onReopen(()=>e.reconnected()),Ue=()=>e.flushAll(),se=()=>{document.visibilityState==="hidden"&&e.flushAll()};return window.addEventListener("pagehide",Ue),document.addEventListener("visibilitychange",se),()=>{we(),window.removeEventListener("pagehide",Ue),document.removeEventListener("visibilitychange",se)}},[t,e]),N.useEffect(()=>Le,[Le]);const nt=N.useCallback(we=>{const Ue=crypto.randomUUID();xt.current.add(Ue),we.onOpened!==void 0&&oe.current.set(Ue,we.onOpened),ne(te=>[...te,{requestId:Ue,cwd:we.cwd,agent:we.agent??null,label:we.label??"",at:Date.now()}]);const se=setTimeout(()=>Ae(Ue),Fp);je.current.set(Ue,se),t.send({type:"terminal.open",requestId:Ue,cwd:we.cwd,...we.resumeSessionId!==void 0?{resumeSessionId:we.resumeSessionId}:{},...we.label!==void 0?{label:we.label}:{},...we.agent!==void 0?{agent:we.agent}:{}})},[t,Ae]),Fe=N.useCallback(we=>{t.send({type:"terminal.open",requestId:crypto.randomUUID(),cwd:we,kind:"shell"})},[t]),Ke=N.useCallback(we=>t.send({type:"terminal.close",terminalId:we}),[t]),mt=N.useCallback(we=>{G(Ue=>new Set(Ue).add(we)),z.current.get(we)==="server-closed"&&(Z.current=new Map(Z.current).set(we,"waiting-exit"),ye(new Set(Z.current.keys()))),t.send({type:"terminal.wake",terminalId:we})},[t]),_t=N.useCallback((we,Ue)=>t.send({type:"terminal.rename",terminalId:we,label:Ue}),[t]),Et=N.useCallback(we=>t.send({type:"tabs.reorder",terminalIds:we}),[t]),ft=N.useCallback((we,Ue)=>t.send({type:"session.archive",sessionIds:we,archived:Ue}),[t]),ct=N.useCallback((we,Ue,se)=>{const te=crypto.randomUUID();xt.current.add(te),t.send({type:"session.continue",requestId:te,agent:we.agent,sessionId:we.sessionId,target:Ue,label:se})},[t]),Ge=N.useCallback((we,Ue)=>{if(xt.current.add(we),Ue===null)return;ne(te=>[...te,{requestId:we,...Ue,at:Date.now()}]);const se=setTimeout(()=>Ae(we),Fp);je.current.set(we,se)},[Ae]),yt=N.useCallback(we=>{be(Ue=>{if(!Ue.has(we))return Ue;const se=new Map(Ue);return se.delete(we),se})},[]),Bt=N.useCallback(we=>{dt(Ue=>{if(!Ue.has(we))return Ue;const se=new Map(Ue);return se.delete(we),se})},[]),Wt=N.useCallback(we=>{at(Ue=>Jp(Ue,we,null))},[]),Ne=N.useCallback(we=>{Be(Ue=>Ue.some(se=>se.id===we)?Ue.filter(se=>se.id!==we):Ue)},[]),He=N.useCallback(()=>t.send({type:"index.refresh"}),[t]),de=N.useCallback(()=>t.send({type:"agents.refresh"}),[t]),lt=N.useCallback(()=>Q(null),[]),fe=N.useMemo(()=>x.filter(we=>we.kind==="agent"),[x]),Ce=N.useMemo(()=>x.filter(we=>we.kind==="shell"),[x]),$e=Zo(),rt=N.useMemo(()=>G2(c,a,_),[c,a,_,$e]),ke=N.useCallback(we=>{var Ue;return(we===null||(Ue=c.find(se=>se.id===we))==null?void 0:Ue.capabilities)??xg},[c]),gt=N.useMemo(()=>Dd(c),[c]);return{connection:t,status:s,agents:c,defaultAgent:b,capabilitiesFor:ke,offerAgentChoice:gt,cliAvailable:rt.cliAvailable,cliVersion:rt.cliVersion,cliMissingMessage:rt.cliMissingMessage,platform:k,defaultCwd:M,environmentNotice:rt.environmentNotice,shellName:h,remoteClient:g,fileCheck:S,fileWrite:L,terminals:fe,shells:Ce,pendingOpens:Y,activeTerminalId:W,projects:I,indexStatus:P,error:_e,dismissError:lt,setActiveTerminal:$,openTerminal:nt,openShell:Fe,closeTerminal:Ke,wakeTerminal:mt,waking:K,activity:q,offlineReasons:U,relaunching:ie,renameTerminal:_t,reorderTabs:Et,refreshIndex:He,refreshAgents:de,archiveSessions:ft,continueSession:ct,expectTab:Ge,handoffs:ee,dismissHandoff:yt,returnedMessages:Qe,dismissReturned:Bt,suggestions:Ie,dismissSuggestion:Wt,prefills:me,prefillApplied:Ne,drafts:e}}function oN({dialog:t,agents:e,offerAgentChoice:s,agent:l,moveBlock:c=null,onSubmit:y,onClose:b}){const{state:i,move:a}=t,f=i.phase==="loading"?null:i.inspection,[_,d]=N.useState("new"),[k,E]=N.useState(""),[M,w]=N.useState(""),[h,v]=N.useState(""),[g,p]=N.useState(l),[S,j]=N.useState(!0),[L,R]=N.useState(!0);N.useEffect(()=>{const D=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),b())};return window.addEventListener("keydown",D,!0),()=>window.removeEventListener("keydown",D,!0)},[b]),N.useEffect(()=>{var D;f===null||h.length>0||v(a!==null?PT(f,a.tabBranch):f.currentBranch??((D=f.branches[0])==null?void 0:D.name)??"")},[f,h,a]);const x=N.useMemo(()=>(f==null?void 0:f.branches.filter(D=>!D.checkedOut).map(D=>D.name))??[],[f]);N.useEffect(()=>{M.length===0&&x[0]!==void 0&&w(x[0])},[M,x]);const T=e.filter(D=>D.available),I=_==="new"?k.trim():M,O=_==="new"?h:(f==null?void 0:f.currentBranch)??h,P=f===null?null:AT(f,I,_,O),F=i.phase==="creating",W=a===null?null:jT(c),$=a===null||f===null?0:f.sourceChanges??f.mainChanges,K=f!==null&&!F&&I.length>0&&P===null&&W===null,G=()=>{K&&y({branch:I,base:O,mode:_,copyNotes:S,...a===null&&s&&g!==null?{agent:g}:{},...a!==null?{askChanges:L&&$>0}:{}})},q=m(a===null?"worktree.create.title":"worktree.move.title");return o.jsx("div",{className:"modal-backdrop",onClick:b,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":q,onClick:D=>D.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:q}),o.jsx("button",{className:"icon-button",onClick:b,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"modal-hint",children:a===null?m("worktree.create.intro",{project:t.projectName}):m("worktree.move.intro",{project:t.projectName})}),i.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:m("worktree.create.loading")}),f!==null&&o.jsxs("form",{className:"worktree-form",onSubmit:D=>{D.preventDefault(),G()},children:[o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:m("worktree.create.branch")}),_==="new"?o.jsx("input",{className:"worktree-input",value:k,onChange:D=>E(D.target.value),placeholder:m("worktree.create.branchPlaceholder"),spellCheck:!1,autoFocus:!0,disabled:F}):o.jsx("select",{className:"worktree-input",value:M,onChange:D=>w(D.target.value),disabled:F||x.length===0,children:x.map(D=>o.jsx("option",{value:D,children:D},D))})]}),o.jsxs("div",{className:"worktree-modes",role:"radiogroup",children:[o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:_==="new",onChange:()=>d("new"),disabled:F}),o.jsx("span",{children:m("worktree.create.modeNew")}),o.jsx("select",{className:"worktree-input worktree-base",value:h,onChange:D=>v(D.target.value),disabled:F||_!=="new",children:f.branches.map(D=>o.jsx("option",{value:D.name,children:D.name},D.name))})]}),o.jsxs("label",{className:"worktree-mode",children:[o.jsx("input",{type:"radio",checked:_==="existing",onChange:()=>d("existing"),disabled:F||x.length===0}),o.jsx("span",{children:m("worktree.create.modeExisting")})]}),x.length===0&&o.jsx("p",{className:"modal-hint",children:m("worktree.create.noFreeBranch")})]}),a===null&&s&&T.length>1&&o.jsxs("label",{className:"worktree-field",children:[o.jsx("span",{className:"worktree-label",children:m("worktree.create.agent")}),o.jsx("select",{className:"worktree-input",value:g??"",onChange:D=>{var U;return p(((U=T.find(H=>H.id===D.target.value))==null?void 0:U.id)??null)},disabled:F,children:T.map(D=>o.jsx("option",{value:D.id,children:D.label},D.id))})]}),P!==null&&o.jsx("p",{className:"worktree-problem",children:P}),W!==null&&o.jsx("p",{className:"worktree-problem",children:W}),o.jsx("h3",{className:"modal-section",children:m("worktree.create.copySection")}),f.notes.files===0?o.jsx("p",{className:"modal-hint",children:m("worktree.create.copyNone")}):o.jsxs("label",{className:"worktree-check",children:[o.jsx("input",{type:"checkbox",checked:S,onChange:D=>j(D.target.checked),disabled:F}),o.jsxs("span",{children:[m("worktree.create.copyNotes"),o.jsxs("span",{className:"modal-hint",children:[" ",f.notes.overCap?m("worktree.create.overCap",{summary:Sa(f.notes)}):m("worktree.create.copyList",{summary:Sa(f.notes),list:kn(f.notes.sample)})]})]})]}),f.include!==null&&o.jsx("p",{className:"modal-hint",children:f.include.overCap?m("worktree.create.includeOverCap",{summary:Sa(f.include)}):m("worktree.create.include",{summary:Sa(f.include)})}),a===null&&f.mainChanges>0&&o.jsx("p",{className:"worktree-warning",children:m("worktree.create.mainChanges",{count:f.mainChanges})}),a!==null&&$>0&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"worktree-warning",children:m("worktree.move.changes",{count:$})}),o.jsxs("label",{className:"worktree-check",children:[o.jsx("input",{type:"checkbox",checked:L,onChange:D=>R(D.target.checked),disabled:F}),o.jsxs("span",{children:[m("worktree.move.askChanges"),o.jsxs("span",{className:"modal-hint",children:[" ",m("worktree.move.askChangesHint")]})]})]})]}),I.length>0&&P===null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("worktree.create.folder")}),o.jsx("p",{className:"worktree-path",children:p_(f,I)}),o.jsx("h3",{className:"modal-section",children:m("worktree.create.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:BT(f,I,O,_)})]}),i.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:i.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{type:"button",className:"link-button",onClick:b,children:m("common.cancel")}),o.jsx("button",{type:"submit",className:"primary-button",disabled:!K,children:m(a===null?F?"worktree.create.creating":"worktree.create.submit":F?"worktree.move.moving":"worktree.move.submit")})]})]}),i.phase==="failed"&&f===null&&o.jsx("p",{className:"worktree-problem",children:i.message})]})]})})}function lN({dialog:t,onConfirm:e,onClose:s}){const{state:l}=t;N.useEffect(()=>{const a=f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),s())};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[s]);const c=l.phase==="ready"||l.phase==="deleting"||l.phase==="failed"?l.plan:null,y=c===null?null:YT(c),b=l.phase==="deleting",i=m("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:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[l.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:m("worktree.deleteBranch.loading")}),l.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("worktree.deleteBranch.done",{branch:t.branch})}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:s,children:m("common.close")})})]}),c!==null&&o.jsxs(o.Fragment,{children:[y!==null?o.jsx("p",{className:"worktree-problem",children:y}):o.jsx("p",{className:"modal-hint",children:m("worktree.deleteBranch.intro",{base:c.base})}),o.jsx("h3",{className:"modal-section",children:m("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:c.folder}),o.jsx("h3",{className:"modal-section",children:m("worktree.integrate.command")}),o.jsx("pre",{className:"tool-pre worktree-command",children:c.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:m("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:e,disabled:b||y!==null||l.phase==="failed",children:m(b?"worktree.deleteBranch.deleting":"worktree.deleteBranch.submit")})]})]}),l.phase==="failed"&&c===null&&o.jsx("p",{className:"worktree-problem",children:l.message})]})]})})}function B_({returning:t,merging:e,resolved:s}){const[l,c]=N.useState(!1),y=s.length>0?o.jsx("p",{className:"modal-hint",children:m("worktree.notes.resolved",{count:s.length,list:kn(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:[m("worktree.notes.back",{count:t.length})," ",b.size>0&&o.jsxs(o.Fragment,{children:[m("worktree.notes.merged",{count:b.size})," "]}),o.jsx("button",{className:"link-button worktree-notes-toggle",onClick:()=>c(!l),"aria-expanded":l,children:m(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:m("worktree.notes.mergedMark")})]},i))})]})}function aN({dialog:t,agentLabel:e,onConfirm:s,onRemove:l,onClose:c}){const{state:y}=t;N.useEffect(()=>{const _=d=>{d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),c())};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[c]);const b=y.phase==="loading"?null:y.plan,i=b===null?null:qT(b),a=y.phase==="integrating",f=b===null?m("worktree.integrate.titleLoading",{branch:t.branch}):m("worktree.integrate.title",{branch:b.branch,base:b.base});return o.jsx("div",{className:"modal-backdrop",onClick:c,children:o.jsxs("div",{className:"modal worktree-dialog",role:"dialog","aria-label":f,onClick:_=>_.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:f}),o.jsx("button",{className:"icon-button",onClick:c,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[y.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:m("worktree.integrate.loading")}),y.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("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:m("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:m("worktree.integrate.notesStayed",{list:kn(y.outcome.notes.stayed)})}),o.jsx("p",{className:"modal-hint",children:m("worktree.integrate.doneOthers",{base:y.outcome.base})}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:c,children:m("common.close")}),o.jsx("button",{className:"primary-button",onClick:l,title:m("worktree.integrate.removeTitle"),children:m("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:m("worktree.integrate.intro",{base:b.base,count:b.ahead})}),b.fileCount>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.integrate.files",{count:b.fileCount,list:`${kn(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:m("worktree.integrate.notesStay",{list:kn(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?m("worktree.integrate.noReview"):m_(b.review,e(b.review.agent))}),b.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.integrate.tabs",{list:kn(b.tabs.map(_=>_.label))})}),b.branchUncommitted>0&&o.jsx("p",{className:"worktree-warning",children:m("worktree.integrate.branchUncommitted",{count:b.branchUncommitted})}),b.command!==null&&b.baseFolder!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("worktree.integrate.folder")}),o.jsx("p",{className:"worktree-path",children:b.baseFolder}),o.jsx("h3",{className:"modal-section",children:m("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:c,children:m("common.cancel")}),o.jsx("button",{className:"primary-button",onClick:s,disabled:a||i!==null||y.phase==="failed",children:m(a?"worktree.integrate.integrating":"worktree.integrate.submit")})]})]}),y.phase==="failed"&&b===null&&o.jsx("p",{className:"worktree-problem",children:y.message})]})]})})}function cN({dialog:t,onConfirm:e,onDiscardFiles:s,onAskNotes:l,onAskCommit:c,onRetry:y,onClose:b,scheduledCountFor:i}){var p;const{state:a,acceptedFiles:f}=t;N.useEffect(()=>{const S=j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),b())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[b]);const _=a.phase==="ready"||a.phase==="removing"||a.phase==="failed"?a.plan:null,d=a.phase==="removing",k=a.phase==="failed",E=_===null||k?null:g_(_,f),M=_!==null&&!k&&QT(_,f),w=_===null?null:ZT(_,f),h=_===null||i===void 0?0:i(_.tabs.map(S=>S.terminalId)),v=m("worktree.remove.title",{branch:t.branch}),g=k?{label:m("worktree.remove.retry"),hint:void 0,run:y}:E==="ask-commit"&&_!==null?{label:m("worktree.remove.askCommit",{count:((p=_.untracked)==null?void 0:p.stamp)!=null&&_.untracked.files>0?_.untracked.files:_.uncommittedCount}),hint:m("worktree.remove.askTitle"),run:c}:E==="retry"?{label:m("worktree.remove.retry"),hint:void 0,run:y}:E==="ask-notes"?{label:m("worktree.remove.askNotes"),hint:m("worktree.remove.askTitle"),run:l}:E==="remove"?{label:m("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":v,onClick:S=>S.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:v}),o.jsx("button",{className:"icon-button",onClick:b,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[a.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:m("worktree.remove.loading")}),a.phase==="done"&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("worktree.remove.done")}),a.outcome.returned>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.notes.returned",{count:a.outcome.returned})}),a.outcome.discarded>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.remove.doneDiscarded",{count:a.outcome.discarded})}),a.outcome.discardedFiles>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.remove.doneDiscardedFiles",{count:a.outcome.discardedFiles})}),a.outcome.branchDeleted&&o.jsx("p",{className:"modal-hint",children:m("worktree.remove.doneBranch")}),o.jsx("div",{className:"worktree-actions",children:o.jsx("button",{className:"primary-button",onClick:b,children:m("common.close")})})]}),_!==null&&a.phase!=="done"&&o.jsxs(o.Fragment,{children:[_.uncommittedCount>0&&o.jsxs("p",{className:el(_,f)?"worktree-warning":"worktree-problem",children:[w??m("worktree.remove.uncommitted",{count:_.uncommittedCount})," ",o.jsx("span",{className:"worktree-files",children:tL(_)})]}),_.inUse===!0&&o.jsx("p",{className:"worktree-problem",children:eL(_)}),_.conflicts.length>0&&o.jsx("p",{className:"worktree-warning",children:m("worktree.remove.conflicts",{list:kn(_.conflicts)})}),o.jsx("p",{className:"modal-hint",children:nL(_)}),o.jsx(B_,{returning:_.returning,merging:_.merging,resolved:_.resolved}),_.tabs.length>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.remove.tabs",{list:kn(_.tabs.map(S=>S.label))})}),h>0&&o.jsx("p",{className:"worktree-warning",children:m("scheduled.worktree.cancels",{count:h})}),_.commands.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("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:m("common.cancel")}),M&&o.jsx("button",{className:"link-button",onClick:s,disabled:d,children:m("worktree.remove.discardFiles")}),E==="ask-notes"&&o.jsx("button",{className:"link-button",onClick:()=>e(!0),disabled:d,children:m("worktree.remove.discard")}),g!==null&&o.jsx("button",{className:"primary-button",onClick:g.run,title:g.hint,disabled:d,children:d?m("worktree.remove.removing"):g.label})]})]})]})})}function uN({dialog:t,agents:e,onSubmit:s,onClose:l}){var v;const{state:c}=t,y=c.phase==="loading"?null:c.plan,b=N.useMemo(()=>VT(e),[e]),i=y===null?null:Nb(y.author,b),[a,f]=N.useState(null),_=a??i,d=e.find(g=>g.id===_)??null,k=g=>{var p;return((p=e.find(S=>S.id===g))==null?void 0:p.label)??g};N.useEffect(()=>{const g=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),l())};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[l]);const E=c.phase==="requesting",M=y!==null&&y.ahead===0&&y.uncommitted===0,w=y!==null&&d!==null&&!E&&!M,h=m("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":h,onClick:g=>g.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:h}),o.jsx("button",{className:"icon-button",onClick:l,title:m("common.close"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[c.phase==="loading"&&o.jsx("p",{className:"modal-hint",children:m("worktree.review.loading")}),y!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"modal-hint",children:m("worktree.review.intro",{base:y.base})}),M?o.jsx("p",{className:"worktree-problem",children:m("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:m("worktree.review.reviewer")}),o.jsx("select",{className:"worktree-input",value:_??"",onChange:g=>{var p;return f(((p=b.find(S=>S.id===g.target.value))==null?void 0:p.id)??null)},disabled:E,children:b.map(g=>o.jsx("option",{value:g.id,children:k(g.id)},g.id))})]}):d!==null&&o.jsx("p",{className:"modal-hint",children:m("worktree.review.sameCli",{agent:d.label})}),y.author!==null&&b.length>1&&o.jsx("p",{className:"modal-hint",children:m("worktree.review.author",{agent:k(y.author)})}),d!==null&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:((v=d.capabilities.readOnlyLaunch)==null?void 0:v.guard)==="cli"?"modal-hint":"worktree-warning",children:KT(d.capabilities,d.label)}),o.jsx("p",{className:"modal-hint",children:d.capabilities.readySignal?m("worktree.review.deliverySent"):m("worktree.review.deliveryPrefill")})]}),y.branchBusy&&o.jsx("p",{className:"worktree-warning",children:m("worktree.review.branchBusy")}),y.uncommitted>0&&o.jsx("p",{className:"modal-hint",children:m("worktree.review.uncommitted",{count:y.uncommitted})}),o.jsx("p",{className:"modal-hint",children:m("worktree.review.quota")}),o.jsx("h3",{className:"modal-section",children:m("worktree.review.prompt")}),o.jsx("pre",{className:"tool-pre worktree-command worktree-prompt",children:y.prompt})]}),c.phase==="failed"&&o.jsx("p",{className:"worktree-problem",children:c.message}),o.jsxs("div",{className:"worktree-actions",children:[o.jsx("button",{className:"link-button",onClick:l,children:m("common.cancel")}),o.jsx("button",{className:"primary-button",disabled:!w,onClick:()=>{w&&_!==null&&s(_)},children:m(E?"worktree.review.requesting":"worktree.review.submit")})]})]}),c.phase==="failed"&&y===null&&o.jsx("p",{className:"worktree-problem",children:c.message})]})]})})}const rh=["git","files","plans","memory","console","notes"],ug="agent-workbench.hiddenPanels";function dN(t){return rh.includes(t)}const hN=new Set(["memory"]),fN="none";function pN(t){return new Set(t.split(",").map(e=>e.trim()).filter(dN))}function mN(t){const e=rh.filter(s=>t.has(s));return e.length===0?fN:e.join(",")}function gN(t,e,s){const l=new Set(t);return s?l.delete(e):l.add(e),l}function vN(){const[t,e]=N.useState(()=>jt(ug,hN,pN)),s=N.useCallback((c,y)=>{e(b=>{const i=gN(b,c,y);return Lt(ug,mN(i)),i})},[]),l=N.useCallback(c=>!t.has(c),[t]);return{hidden:t,isVisible:l,setVisible:s}}const _N={git:"panel.tab.git",files:"panel.tab.files",plans:"panel.tab.plans",memory:"panel.tab.memory",console:"console.name",notes:"notes.name"},wN={dark:"settings.terminalTheme.dark",follow:"settings.terminalTheme.follow"};function bN(t,e,s){const l=t.filter(c=>c!==e);return s?[...l,e]:l}function yN(t,e){return t.length===e.length&&t.every(s=>e.includes(s))}function kN({onClose:t,terminalTheme:e,panels:s,consoleCount:l,onHideConsole:c,appSettings:y,agents:b,remoteClient:i,onOpenVault:a,onOpenRemote:f,onConfigureStatusLine:_}){const[d,k]=N.useState(!1),E=y.status,M=E!==null&&!i,[w,h]=N.useState(null),[v,g]=N.useState(null),[p,S]=N.useState(null);N.useEffect(()=>{h(null),g(null),S(null)},[E,y.problem]);const j=w??(E==null?void 0:E.consoleShell)??"auto",L=v??(E==null?void 0:E.disabledAgents)??[],R=p??(E==null?void 0:E.scheduledMessages)??!1;N.useEffect(()=>{const P=F=>{F.key==="Escape"&&(F.preventDefault(),F.stopPropagation(),t())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[t]);const x=(P,F)=>{if(P==="console"&&!F&&l>0){k(!0);return}s.setVisible(P,F)},T=(E==null?void 0:E.consoleShells.find(P=>P.id!=="git-bash"&&P.id!=="zsh"))??null,I=E!==null&&!yN(E.disabledAgents,E.disabledAtStart),O=E===null?[]:[{id:"auto",label:T===null?m("settings.console.auto"):m("settings.console.autoWith",{shell:T.label})},...E.consoleShells];return o.jsx("div",{className:"modal-backdrop",onClick:t,children:o.jsxs("div",{className:"modal settings-dialog",role:"dialog","aria-label":m("settings.title"),onClick:P=>P.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:m("settings.title")}),o.jsx("button",{className:"icon-button",onClick:t,title:m("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body settings-body",children:[o.jsx("h3",{className:"modal-section",children:m("settings.section.appearance")}),o.jsxs("div",{className:"settings-row",children:[o.jsx("span",{className:"settings-label",children:m("settings.language")}),o.jsx(I_,{})]}),o.jsxs("div",{className:"settings-row settings-row-top",children:[o.jsx("span",{className:"settings-label",children:m("settings.terminalTheme")}),o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":m("settings.terminalTheme"),children:[["dark","follow"].map(P=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"terminal-theme",checked:e.preference===P,onChange:()=>e.setPreference(P)}),m(wN[P])]},P)),o.jsx("p",{className:"modal-hint",children:m("settings.terminalTheme.hint")})]})]}),o.jsx("h3",{className:"modal-section",children:m("settings.section.panels")}),o.jsx("div",{className:"settings-panels",children:rh.map(P=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:s.isVisible(P),onChange:F=>x(P,F.target.checked)}),m(_N[P])]},P))}),d&&o.jsxs("div",{className:"settings-confirm",role:"alert",children:[o.jsx("span",{children:m("settings.panels.consoleConfirm",{count:l})}),o.jsx("button",{className:"link-button",onClick:()=>{k(!1),c()},children:m("settings.panels.consoleConfirmYes")}),o.jsx("button",{className:"link-button",onClick:()=>k(!1),children:m("common.cancel")})]}),o.jsx("p",{className:"modal-hint",children:m("settings.panels.cliAlways")}),E===null?o.jsx("p",{className:"modal-hint",children:m("settings.oldServer")}):o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("settings.section.console")}),E.consoleShells.length===0?o.jsx("p",{className:"modal-hint",children:m("console.noShell")}):o.jsxs("div",{className:"settings-choices",role:"radiogroup","aria-label":m("settings.section.console"),children:[O.map(P=>o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"radio",name:"console-shell",checked:j===P.id,disabled:!M,onChange:()=>{h(P.id),y.setConsoleShell(P.id)}}),P.label]},P.id)),o.jsx("p",{className:"modal-hint",children:m("settings.console.hint")})]}),o.jsx("h3",{className:"modal-section",children:m("settings.section.clis")}),o.jsx("ul",{className:"settings-clis",children:b.map(P=>{const F=L.includes(P.id),W=E.disabledAtStart.includes(P.id),$=P.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:K=>{const G=bN(L,P.id,!K.target.checked);g(G),y.setDisabledAgents(G)}}),o.jsx("span",{className:"settings-cli-name",children:P.label})]}):o.jsx("span",{className:"settings-cli-name settings-cli-missing",children:P.label}),o.jsx("span",{className:"settings-cli-detail",children:P.available?P.version??"":m(W?"settings.cli.disabled":"settings.cli.notInstalled")}),!$&&o.jsx("a",{className:"link-button",href:P.installUrl,target:"_blank",rel:"noreferrer noopener",children:m("settings.cli.install")})]},P.id)})}),o.jsx("p",{className:"modal-hint",children:m("settings.cli.hint")}),I&&o.jsx("p",{className:"settings-restart",children:m("settings.cli.restart")}),o.jsx("h3",{className:"modal-section",children:m("settings.section.scheduled")}),o.jsxs("label",{className:"settings-choice",children:[o.jsx("input",{type:"checkbox",checked:R,disabled:!M,onChange:P=>{S(P.target.checked),y.setScheduledMessages(P.target.checked)}}),m("settings.scheduled.enable")]}),o.jsx("p",{className:"modal-hint",children:m("settings.scheduled.hint")}),R&&Sk(b,L).map(P=>o.jsxs("p",{className:"modal-hint",children:[m("settings.scheduled.needsStatusLine",{agent:P.label})," ",o.jsx("button",{className:"link-button",onClick:()=>_(P.id),children:m("meter.configure")})]},P.id)),i&&o.jsx("p",{className:"modal-hint",children:m("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:m("common.close")})]})]}),(a!==null||f!==null)&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("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:m("settings.more.open",{name:Hi()})}),f!==null&&o.jsx("button",{className:"primary-button primary-button-small",onClick:f,children:m("settings.more.open",{name:m("app.header.remoteAccess")})})]})]})]})]})})}function CN(t){const[e,s]=N.useState(null),[l,c]=N.useState(null);N.useEffect(()=>t.onMessage(f=>{switch(f.type){case"settings.status":s(f.settings),c(null);break;case"error":if(f.code!=="settings-failed")break;c(Mt(f.text)),f.detail!==void 0&&console.error("[servidor]",f.detail);break}}),[t]);const y=N.useCallback(f=>t.send({type:"settings.update",consoleShell:f}),[t]),b=N.useCallback(f=>t.send({type:"settings.update",disabledAgents:f}),[t]),i=N.useCallback(f=>t.send({type:"settings.update",scheduledMessages:f}),[t]),a=N.useCallback(()=>c(null),[]);return{status:e,problem:l,setConsoleShell:y,setDisabledAgents:b,setScheduledMessages:i,dismissProblem:a}}function xN(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:vd(),terminalId:b,text:i,sendAt:a}),[t]),c=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:c,sendNow:y}}function SN({warning:t,onConfirm:e,onClose:s}){N.useEffect(()=>{const c=y=>{y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),s())};return window.addEventListener("keydown",c,!0),()=>window.removeEventListener("keydown",c,!0)},[s]);const l=m("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:c=>c.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:m("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:m("scheduled.close.keep")}),o.jsx("button",{className:"primary-button",onClick:e,children:m("scheduled.close.confirm")})]})]})]})})}function EN({status:t,agents:e,indexReady:s,problem:l,covered:c,onMeasure:y,onSetEnabled:b,onChangeDir:i,onReveal:a,onDismissProblem:f,onClose:_}){return N.useEffect(()=>{if(c)return;const d=k=>{k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),_())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[c,_]),o.jsx("div",{className:"modal-backdrop",onClick:_,children:o.jsxs("div",{className:"modal vault-modal",role:"dialog","aria-label":Hi(),onClick:d=>d.stopPropagation(),children:[o.jsxs("header",{className:"modal-header",children:[o.jsx("span",{className:"modal-title",children:Hi()}),t!==null&&o.jsx("span",{className:`vault-state${t.enabled?" vault-state-on":""}`,children:zE(t)}),o.jsx("button",{className:"icon-button",onClick:_,title:m("common.closeEsc"),children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{className:"vault-lead",children:FE()}),o.jsx("p",{className:"modal-hint",children:HE()}),t===null?o.jsx("p",{className:"modal-hint",children:m("vault.dialog.waiting")}):o.jsx(TN,{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:f,title:m("common.dismissNotice"),children:"×"})]})]})]})})}function TN({status:t,agents:e,indexReady:s,onMeasure:l,onSetEnabled:c,onChangeDir:y,onReveal:b}){const i=GE(t,s),a=YE(t),f=VE(t),_=t.measurement===null?null:JE(t.measurement,e),d=t.progress;return o.jsxs(o.Fragment,{children:[t.enabled&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("vault.dialog.inFolder")}),o.jsxs("p",{className:"vault-summary",children:[n_(t.sessions)," · ",yn(t.bytes),t.lastPassAt!==null&&o.jsxs(o.Fragment,{children:[" · ",m("vault.dialog.lastPass",{when:Jn(t.lastPassAt)})]}),t.pending>0&&o.jsxs(o.Fragment,{children:[" · ",m("vault.dialog.pendingCalm",{count:t.pending})]})]})]}),d!==null&&d.total>0&&o.jsx("progress",{className:"vault-progress",value:d.done,max:d.total}),o.jsx("h3",{className:"modal-section",children:m("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??m("vault.dialog.measureTitle"),children:t.state==="measuring"?m("vault.state.measuring"):m(_===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:m("vault.dialog.table.sessions")}),o.jsx("th",{children:m("vault.dialog.table.size")}),o.jsx("th",{children:m("vault.dialog.table.images")}),o.jsx("th",{title:m("vault.dialog.table.archivedTitle"),children:m("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:yn(k.bytes)}),o.jsx("td",{title:k.images>0?yn(k.imageBytes):void 0,children:k.images}),o.jsx("td",{children:k.skippedArchived})]},k.agent)),o.jsxs("tr",{children:[o.jsx("td",{children:m("vault.dialog.table.memory",{count:_.memoryProjects})}),o.jsx("td",{}),o.jsx("td",{children:yn(_.memoryBytes)}),o.jsx("td",{}),o.jsx("td",{})]})]}),o.jsx("tfoot",{children:o.jsxs("tr",{children:[o.jsx("td",{children:m("vault.dialog.table.total")}),o.jsx("td",{children:_.total.sessions}),o.jsx("td",{children:yn(_.total.bytes)}),o.jsx("td",{children:_.total.images}),o.jsx("td",{children:_.total.skippedArchived})]})})]})}),o.jsxs("div",{className:"vault-actions vault-switch",children:[f==="enabled"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"link-button",onClick:()=>c(!1),children:m("vault.dialog.turnOff")}),o.jsx("span",{className:"modal-hint",children:m("vault.dialog.turnOffHint")})]}),(f==="measured"||f==="existing")&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"primary-button",onClick:()=>c(!0),title:m(f==="existing"?"vault.dialog.activateExistingTitle":"vault.dialog.activateMeasuredTitle"),children:m("vault.dialog.activate")}),o.jsx("span",{className:"modal-hint",children:m(f==="existing"?"vault.dialog.activateExistingHint":"vault.dialog.activateMeasuredHint")})]}),f==="needs-measure"&&o.jsx("span",{className:"modal-hint",children:m("vault.dialog.needsMeasure",{activate:m("vault.dialog.activate")})})]}),o.jsx("h3",{className:"modal-section",children:m("vault.dialog.folderSection")}),o.jsx("p",{className:"vault-dir",title:t.dir,children:t.dir}),t.isDefaultDir&&o.jsx("p",{className:"modal-hint",children:m("vault.dialog.defaultDir")}),o.jsxs("div",{className:"vault-actions",children:[o.jsx("button",{className:"link-button",onClick:y,disabled:a!==null,title:a??m("vault.dialog.changeDirTitle"),children:m("vault.dialog.changeDir")}),b!==null&&o.jsx("button",{className:"link-button",onClick:b,title:m("vault.dialog.openFolderTitle"),children:m("vault.dialog.openFolder")})]}),t.previousDir!==null&&o.jsx("p",{className:"modal-hint",children:XE(t.previousDir)}),t.lastError!==null&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("vault.dialog.lastError")}),o.jsx("p",{className:"vault-error",children:Mt(t.lastError)})]})]})}function LN({preview:t,files:e,running:s,error:l,onConfirm:c,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=m("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:m("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:m("rewind.intro")}),e.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("h3",{className:"modal-section",children:m("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:m("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:()=>c("conversation-and-code"),children:m("rewind.undoAll")}),o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>c("conversation"),children:m("rewind.undoConversation")})]}):o.jsx("button",{className:"primary-button",disabled:s,onClick:()=>c("conversation"),children:m("rewind.undo")}),o.jsx("button",{className:"link-button",onClick:y,children:m("common.cancel")}),s&&o.jsx("span",{className:"modal-hint",children:m("rewind.running")})]})]})]})})}function NN(t){const[e,s]=N.useState(null),l=N.useRef(null),c=N.useRef(null),y=N.useCallback(f=>{l.current=f,s(f)},[]);N.useEffect(()=>t.onMessage(f=>{const _=c.current;if(_!==null){if(f.type==="agent.rewound"&&f.requestId===_){c.current=null,y(null);return}if(f.type==="error"&&f.requestId===_){c.current=null;const d=l.current;d!==null&&y({...d,phase:"failed",error:Mt(f.text)})}}}),[t,y]);const b=N.useCallback((f,_)=>{c.current=null,y({terminalId:f,eventId:_,phase:"confirm",error:null})},[y]),i=N.useCallback(f=>{const _=l.current;if(_===null||_.phase==="running")return;const d=crypto.randomUUID();c.current=d,t.send({type:"agent.rewind",terminalId:_.terminalId,eventId:_.eventId,restore:f,requestId:d}),y({..._,phase:"running",error:null})},[t,y]),a=N.useCallback(()=>{c.current=null,y(null)},[y]);return{state:e,open:b,confirm:i,close:a}}function RN(t){return t.focused&&t.visible?t.activeTerminalId:null}function MN(t,e,s){N.useEffect(()=>{if(!s)return;let l;const c=()=>{const y=RN({activeTerminalId:e,focused:document.hasFocus(),visible:document.visibilityState==="visible"});y!==l&&(l=y,t.send({type:"terminal.attention",terminalId:y}))};return c(),window.addEventListener("focus",c),window.addEventListener("blur",c),document.addEventListener("visibilitychange",c),()=>{window.removeEventListener("focus",c),window.removeEventListener("blur",c),document.removeEventListener("visibilitychange",c)}},[t,e,s])}const dg={connecting:"app.status.connecting",open:"app.status.open",reconnecting:"app.status.reconnecting",failed:"app.status.failed",revoked:"app.status.revoked"},hg=320,AN=1400,IN=640,fg=200,pg=560,jN=270,DN=120,PN=720,ON=260,mg="agent-workbench.panel-width",gg="agent-workbench.panel-visible",vg="agent-workbench.panel-tab",nd="agent-workbench.panel-expanded",rd="agent-workbench.sidebar-visible",_g="agent-workbench.sidebar-width",sd="agent-workbench.console-visible",wg="agent-workbench.console-height",bg="agent-workbench.marker-notice-dismissed",yg="agent-workbench.hidden-hint-shown";function BN(){var co,uo,ho,fo;const t=Zo(),e=iN(),{connection:s,status:l,agents:c,defaultAgent:y,capabilitiesFor:b,offerAgentChoice:i,cliAvailable:a,cliVersion:f,cliMissingMessage:_,platform:d,defaultCwd:k,environmentNotice:E,shellName:M,terminals:w,archiveSessions:h,shells:v,pendingOpens:g,activeTerminalId:p,projects:S,indexStatus:j,error:L,dismissError:R,setActiveTerminal:x,openTerminal:T,openShell:I,closeTerminal:O,wakeTerminal:P,waking:F,activity:W,offlineReasons:$,relaunching:K,renameTerminal:G,reorderTabs:q,refreshIndex:D,refreshAgents:U,continueSession:H,expectTab:z,handoffs:Z,dismissHandoff:ie,returnedMessages:ye,dismissReturned:_e,suggestions:Q,dismissSuggestion:Y,prefills:ne,prefillApplied:ee,drafts:be,remoteClient:me,fileCheck:Be,fileWrite:ze}=e,Qe=C5(),dt=E5(Qe.resolved);MN(s,p,l==="open");const Ie=N.useMemo(()=>({nameOf:X=>Zm(w.find(ge=>ge.terminalId===X)),activate:x}),[w,x]),at=V5(W,Ie),xt=G5(),oe=w.find(X=>X.terminalId===p)??null,je=N.useCallback(X=>{X!==p&&R(),x(X)},[p,R,x]),Ae=(oe==null?void 0:oe.agent)??null,Le=b(Ae),nt=(oe==null?void 0:oe.review)===!0,Fe=N.useMemo(()=>Ip(Le,nt),[Le,nt]),Ke=c.find(X=>X.id===Ae)??null,mt=N.useMemo(()=>{if(oe===null||Ae===null)return null;for(const X of S){const ge=X.sessions.find(et=>et.agent===Ae&&et.sessionId===oe.sessionId);if(ge!==void 0)return Sr(ge.title,ge.titleSource)}return null},[oe,Ae,S,t]),_t=N.useMemo(()=>uk(w,S.flatMap(X=>X.sessions)),[w,S]),Et=(Ke==null?void 0:Ke.statusLine)??null,ft=w5(s),ct=N.useMemo(()=>{var X;return Ae===null?[]:((X=ft.find(ge=>ge.agent===Ae))==null?void 0:X.windows)??[]},[ft,Ae]),Ge=(Ke==null?void 0:Ke.planLimitsSetup)??null,yt=(oe==null?void 0:oe.cwd)??k,Bt=N.useMemo(()=>i?Hk(w,yt,d,c,y):null,[i,w,yt,d,c,y]),Wt=N.useMemo(()=>Hp(g,yt,d),[g,yt,d]),Ne=Wt?iv():null,He=_5(s),de=z2(s),[lt,fe]=N.useState(!1),Ce=Z5(s),[$e,rt]=N.useState(!1),ke=Dx(),gt=U2(ke),we=vN(),[Ue,se]=N.useState(!1),te=N.useCallback(()=>se(!1),[]),[ve,st]=N.useState(()=>jt(Gp,"chat",$C)),We=N.useMemo(()=>zC({hasTab:oe!==null,plansAvailable:Fe.plansAvailable,hidden:we.hidden}),[oe,Fe.plansAvailable,we.hidden]),De=qC(ve,We),Je=N.useCallback(X=>{st(X),Lt(Gp,X)},[]),Dt=N.useRef($2);N.useEffect(()=>{if(Dt.current!==null)return s.onMessage(X=>{if(X.type!=="terminal.list"||Dt.current===null)return;const ge=Dt.current;Dt.current=null,X.terminals.some(et=>et.terminalId===ge&&et.kind==="agent")&&x(ge)})},[s,x]);const Yt=DL(s),Zn=aE(c,de.status),[Jt,er]=N.useState(null),Vr=N.useRef(0),Rn=N.useCallback(X=>{er(ge=>ge!==null&&ge.seq===X?null:ge)},[]),Zs=(X,ge)=>{const et=kE(X,{projects:S,terminals:w,platform:d,canResume:tn=>Dp(c,tn)}),Pt=()=>{ge.length!==0&&(Vr.current+=1,er({query:ge,seq:Vr.current}))};switch(et.kind){case"activate":je(et.terminalId),Pt();break;case"resume":et.session.archived&&h([et.session.sessionId],!1),T({cwd:et.cwd,resumeSessionId:et.session.sessionId,agent:et.session.agent,label:Sr(et.session.title,et.session.titleSource)}),Pt();break;case"copy":de.openSession(X.agent,X.sessionId);break}},$t=N.useMemo(()=>new Set(w.map(X=>X.sessionId).filter(X=>X.length>0)),[w]),[en,ei]=N.useState(()=>jt(gg,!0,X=>X==="true")),[hr,Gr]=N.useState(()=>jt(vg,"cli",X=>X==="git"||X==="files"||X==="cli"||X==="plans"||X==="memory"?X:X==="conversation"?"cli":null)),[$n,fr]=N.useState(()=>jt(mg,IN,X=>{const ge=Number.parseInt(X,10);return Number.isFinite(ge)?Math.max(ge,hg):null})),[Lr,At]=N.useState(()=>jt(nd,!1,X=>X==="true")),[Nr,tr]=N.useState(()=>jt(rd,!0,X=>X==="true")),[pr,Rr]=N.useState(()=>jt(_g,jN,X=>{const ge=Number.parseInt(X,10);return Number.isFinite(ge)?Math.min(pg,Math.max(fg,ge)):null})),[ti,Mr]=N.useState(()=>jt(sd,!1,X=>X==="true")),[nr,Cn]=N.useState(()=>jt(wg,ON,X=>{const ge=Number.parseInt(X,10);return Number.isFinite(ge)?ge:null})),[Yr,pn]=N.useState(()=>jt(bg,!0,X=>X!=="true")),[$i,Ss]=N.useState(!1),Xr=CN(s),Bn=xN(s),mr=((co=Xr.status)==null?void 0:co.scheduledMessages)===!0&&Bn.messages!==null,xn=N.useMemo(()=>{const X=new Map;for(const ge of w){const et=fx(Bn.messages,ge.terminalId);et.length>0&&X.set(ge.terminalId,et)}return X},[Bn.messages,w]),[zn,pe]=N.useState(null),Pe=N.useCallback(X=>{const ge=mx(xn.get(X)??[]);ge===null?O(X):pe({terminalId:X,warning:ge})},[xn,O]),[ut,wt]=N.useState(!1),pt=Xr.status!==null?Xr.status.shellName:M,[sn,gr]=N.useState(null),[rr,kt]=N.useState(null),sr=c.find(X=>X.id===rr)??null;N.useEffect(()=>{rr!==null&&((sr==null?void 0:sr.statusLine)??null)===null&&kt(null)},[rr,sr]);const[nl,Es]=N.useState(!1);N.useEffect(()=>{Ge===null&&Es(!1)},[Ge]);const[ni,Ar]=N.useState(null),Ir=en&&oe!==null,jr=Tk(hr,Fe.plansAvailable,we.hidden),Ts=ti&&we.isVisible("console"),Sn=oe!==null?en||Ts:en,qn=Lr&&oe!==null,cn=N.useMemo(()=>oe===null?[]:v.filter(X=>X.cwd===oe.cwd),[v,oe]),[Ls,Qr]=N.useState(null),En=cn.find(X=>X.terminalId===Ls)??cn[0]??null,ri=De==="cli"?p:De==="console"?(En==null?void 0:En.terminalId)??null:null,rl=N.useCallback(X=>{ri!==null&&s.send({type:"input",terminalId:ri,data:X})},[s,ri]),Ct=DS(s,p),zi=X5(s,W),qi=ke?oe!==null:Ir,si=ke?De==="files":Ir&&jr==="files",ii=f5(s,qi?p:null),Dr=Z2(s,(ke?De==="git":Ir&&jr==="git")?p:null,ii.status.updatedAt),Nt=eN(s,z,x),It=tN(s,z,x),{closeChanges:Ns}=It;N.useEffect(()=>Ns(),[p,Ns]);const Pr=X=>X.split(/[\\/]/).filter(ge=>ge.length>0).pop()??X,sl=X=>{var ge;return((ge=c.find(et=>et.id===X))==null?void 0:ge.label)??X},oi=X=>{var et;const ge=ks(X);Nt.openMove({terminalId:X.terminalId,tabBranch:((et=X.worktree)==null?void 0:et.branch)??null},ge,Pr(ge))},Rs=oe===null||!f_(oe,Fe.moveToWorktree)?null:()=>oi(oe),Ki=X=>{const ge=DT(w,X,et=>Ip(b(et)).moveToWorktree);return ge===null?null:()=>{te(),je(ge.terminalId),oi(ge)}},li=((uo=Nt.create)==null?void 0:uo.move)??null,vr=li===null?null:bb(W.get(li.terminalId)??null,li.terminalId===p&&Ct.queue.length>0),Vi={rows:Dr.rows,kept:Dr.kept,rowsStale:Dr.stale,onDeleteBranch:X=>Nt.openDeleteBranch(X.id,X.branch),onNew:()=>{if(oe===null)return;const X=ks(oe);Nt.openCreate({kind:"terminal",terminalId:oe.terminalId},X,Pr(X))},onMove:Rs,onOpen:X=>{const ge=Tr(X.path,d),et=w.find(Pt=>Tr(Pt.cwd,d)===ge&&!Pt.review);et!==void 0?je(et.terminalId):T({cwd:X.path})},onRemove:X=>Nt.openRemove(X.id,X.branch??Pr(X.path)),changes:It.changes,onViewChanges:X=>It.openChanges(X.id,X.branch??Pr(X.path)),onOpenChangeDiff:It.openChangeDiff,onCloseChangeDiff:It.closeChangeDiff,onCloseChanges:It.closeChanges,onRequestReview:X=>It.openReview(X.id,X.branch??Pr(X.path),oe===null?X.path:ks(oe)),onSendReview:X=>It.sendReview(X.id),onShowReviewer:X=>je(X),onCatchUp:X=>It.catchUp(X.id),onIntegrate:X=>It.openIntegrate(X.id,X.branch??Pr(X.path)),agentLabel:sl},ai=(()=>{var Pt;const X=Nt.create;if(X===null)return null;const{source:ge}=X;if(ge.kind==="terminal")return((Pt=w.find(tn=>tn.terminalId===ge.terminalId))==null?void 0:Pt.agent)??y;const et=S.find(tn=>tn.key===ge.projectKey);return et===void 0?y:Pp(w,et,d,c,y)})(),il=jL(s,si?p:null,(oe==null?void 0:oe.cwd)??null),Ms=PL(s,p),As=t5(s,w,p,ze),ci=v5(s,qi?p:null,(oe==null?void 0:oe.cwd)??null),Tn=ke?De==="cli":Ir&&jr==="cli",Or=Ct.usage.lastModel,ui=hk(Ct.events,Ct.usage.lastEffort,(oe==null?void 0:oe.launchedAt)??null),Jr=Or??Ct.defaults.model,ol=ui??Ct.defaults.effort,Gi=Or===null&&Jr!==null,Yi=ui===null&&ol!==null,Zr=AL(s,p,Tn),Mn=p===null?null:W.get(p)??null,Xi=eC(Le,Ct.openToolCall,(Ke==null?void 0:Ke.label)??null,(oe==null?void 0:oe.alive)??!1,Mn),Qi=tC({offlineReason:p===null?null:$.get(p)??null,alive:(oe==null?void 0:oe.alive)??!1,relaunching:p!==null&&K.has(p)}),Ji=Qi===null?null:nC((Ke==null?void 0:Ke.label)??null),qa=Ji??Xi??oC(Le,Ct.waitingFor,(oe==null?void 0:oe.alive)??!1),Zi=!Cg(Le,Mn),Ka=N.useMemo(()=>rv(c,Ae),[c,Ae]),ll=oe!==null&&Qk(Ae,oe.sessionId,Le),_r=p===null?null:Z.get(p)??null,Va=_r===null?null:{text:zk(Qo(_r.sourceAgent,c),_r.includedTurns,_r.totalTurns,_r.totalTurnsIsMinimum),status:_r.prefillReason!==null?Gk(_r.prefillReason):_r.delivery==="sending"&&Ct.events.length===0?qk():null},al=p===null?void 0:ye.get(p),cl=Va??(al===void 0?null:{text:al==="stopped-early"?Vk():Kk((Ke==null?void 0:Ke.label)??null),status:null}),ul=N.useCallback(X=>{ie(X),_e(X)},[ie,_e]),es=N.useCallback(()=>{ei(X=>{const ge=!X;return Lt(gg,String(ge)),ge})},[]),dl=N.useCallback(()=>{tr(X=>{const ge=!X;return Lt(rd,String(ge)),ge})},[]),eo=N.useCallback(()=>{ke||(tr(!1),Lt(rd,"false"))},[ke]),to=N.useCallback(()=>{Mr(X=>{const ge=!X;return Lt(sd,String(ge)),ge})},[]),no=N.useCallback(X=>{Gr(X),Lt(vg,X)},[]),Ga=N.useCallback(()=>{At(X=>{const ge=!X;return Lt(nd,String(ge)),ge})},[]),di=NN(s),{open:ro}=di,Ya=N.useCallback(X=>{p!==null&&ro(p,X)},[ro,p]),Xa=N.useCallback(X=>{p!==null&&s.send({type:"input",terminalId:p,data:`${X} `})},[s,p]),hi=N.useRef(null),Qa=N.useCallback(X=>{var ge;return(ge=hi.current)==null?void 0:ge.call(hi,X,!ke)},[ke]),fi=N.useRef(null),hl=X=>{if(As.files.open({key:X,title:X.split("/").pop()??X}),ke){Je("files");return}Ir||es(),no("files")},fl=N.useRef(hl);fl.current=hl;const so=N.useCallback(X=>fl.current(X),[]),Is=N.useMemo(()=>w.map(X=>X.terminalId),[w]),pl=N.useCallback(X=>{p!==null&&s.send({type:"files.reveal",terminalId:p,path:X})},[s,p]),ml=h5({connection:s,enabled:Be&&we.isVisible("files"),terminalId:p,cwd:(oe==null?void 0:oe.cwd)??"",platform:d,events:Ct.events,liveTerminalIds:Is,onOpen:so,onOpenFolder:me?null:pl}),pi=N.useCallback(X=>{p!==null&&s.send({type:"agent.submit",terminalId:p,text:X,images:[],keepDraft:!0})},[s,p]),js=lk(Ae),gl=N.useMemo(()=>{if(js===null||oe===null)return null;const X=oe.alive?Mn==="busy"||Mn==="waiting"?m("meter.compactBusy"):null:m("meter.compactNoCli");return{command:js,blockedReason:X,onCompact:()=>pi(js)}},[js,oe,Mn,pi,t]),vl=N.useCallback(()=>{Mr(!0),Lt(sd,"true");const X=_1({cwd:(oe==null?void 0:oe.cwd)??null,shellCwds:v.map(ge=>ge.cwd),shellAvailable:pt!==null});X!==null&&I(X)},[oe,v,pt,I]),wr=N.useCallback(X=>{if(X==="console")for(const ge of v)O(ge.terminalId);we.setVisible(X,!1),!jt(yg,!1,ge=>ge==="true")&&(Lt(yg,"true"),gr(X))},[v,O,we]),Ja=N.useCallback(()=>{for(const X of v)O(X.terminalId);we.setVisible("console",!1)},[v,O,we]),_l=N.useRef(new Set);N.useEffect(()=>{const X=cn.filter(et=>!_l.current.has(et.terminalId));for(const et of cn)_l.current.add(et.terminalId);const ge=X[X.length-1];ge!==void 0&&Qr(ge.terminalId)},[cn]);const Za=N.useCallback(()=>{oe!==null&&I(oe.cwd)},[oe,I]),wl=Ra({min:hg,max:AN,value:$n,measure:N.useCallback(X=>window.innerWidth-X.clientX,[]),onChange:fr,onCommit:N.useCallback(X=>Lt(mg,String(X)),[]),onStart:N.useCallback(()=>{At(!1),Lt(nd,"false")},[])}),bl=Ra({min:fg,max:pg,value:pr,measure:N.useCallback(X=>X.clientX,[]),onChange:Rr,onCommit:N.useCallback(X=>Lt(_g,String(X)),[])}),ts=N.useRef(0),Ds=Ra({min:DN,max:PN,value:nr,measure:N.useCallback(X=>Math.round(ts.current-X.clientY),[]),onChange:Cn,onCommit:N.useCallback(X=>Lt(wg,String(X)),[]),onStart:N.useCallback(X=>{const ge=X.currentTarget.nextElementSibling;ts.current=ge===null?window.innerHeight:X.clientY+ge.getBoundingClientRect().height},[])}),ec=N.useCallback(()=>{pn(!1),Lt(bg,"true")},[]),ns=N.useCallback(X=>{if(w.length===0)return;const et=(w.findIndex(tn=>tn.terminalId===p)+X+w.length)%w.length,Pt=w[et];Pt!==void 0&&je(Pt.terminalId)},[w,p,je]),yl=N.useRef(null),mi=N.useRef(null);N.useEffect(()=>{p!==mi.current&&(yl.current=mi.current,mi.current=p)},[p]);const gi=N.useCallback(()=>{const X=yl.current;X===null||X===p||w.some(ge=>ge.terminalId===X)&&je(X)},[p,w,je]);N.useEffect(()=>{const X=ge=>{if(ge.key!=="Tab"||!ge.shiftKey||ge.altKey||ge.ctrlKey||ge.metaKey)return;const et=document.activeElement;et instanceof Element&&et.closest(".xterm")!==null||(ge.preventDefault(),ge.stopPropagation(),gi())};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[gi]),N.useEffect(()=>{const X=ge=>{if(!ge.altKey||ge.ctrlKey||ge.metaKey)return;const et=ge.key.toLowerCase();if(et==="t"){a&&k.length>0&&!Wt&&(ge.preventDefault(),ge.stopPropagation(),T({cwd:(oe==null?void 0:oe.cwd)??k}));return}if(et==="w"){p!==null&&(ge.preventDefault(),ge.stopPropagation(),Pe(p));return}if(et==="p"){ge.preventDefault(),ge.stopPropagation(),es();return}if(et==="arrowright"||et==="pagedown"){ge.preventDefault(),ge.stopPropagation(),ns(1);return}(et==="arrowleft"||et==="pageup")&&(ge.preventDefault(),ge.stopPropagation(),ns(-1))};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[oe,p,a,Pe,ns,k,Wt,T,es]);const io=oe===null?m("app.panel.name"):oe.label.length>0?oe.label:oe.cwd.split(/[\\/]/).filter(X=>X.length>0).pop()??oe.cwd,oo=o.jsx(oT,{projects:S,indexStatus:j,disabled:!a,onOpenProject:(X,ge)=>{te(),T({cwd:X,...ge!==void 0?{agent:ge}:{},onOpened:eo})},agents:c,offerAgentChoice:i,agentForProject:X=>Pp(w,X,d,c,y),onOpenSession:(X,ge)=>{te(),T({cwd:X,resumeSessionId:ge.sessionId,agent:ge.agent,label:Sr(ge.title,ge.titleSource)})},canResume:X=>Dp(c,X),platform:d,onRefresh:D,openSessionIds:$t,openBlocked:X=>Hp(g,X,d),onArchive:h,onHide:ke?te:dl,width:pr,onNewProject:()=>{te(),Ar("project")},vault:de.status,onOpenVault:()=>{te(),fe(!0)},onOpenVaultSession:me?null:X=>de.openSession(X.agent,X.sessionId),onExportProject:me?null:de.exportProject,exporting:de.exporting,lastExported:de.lastExported,onNewWorktree:X=>{te(),Nt.openCreate({kind:"project",projectKey:X.key},X.cwd,Pr(X.cwd),eo)},onReopenWorktree:(X,ge)=>{var et;te(),Nt.reopen(X.agent,X.sessionId,ge.cwd,((et=X.worktree)==null?void 0:et.branch)??"")},moveToBranchOf:Ki,onContinueSession:(X,ge)=>{te(),H({agent:X.agent,sessionId:X.sessionId},ge,Bp(Sr(X.title,X.titleSource)))},globalSearch:Zn?{...Yt,vaultEnabled:((ho=de.status)==null?void 0:ho.enabled)===!0}:null,onOpenSearchHit:(X,ge)=>{te(),Zs(X,ge)}}),lo=o.jsx("div",{className:"chat-stack",children:w.length===0?o.jsxs("div",{className:"empty-state",children:[o.jsx("p",{children:m("app.empty.noTabs")}),o.jsx("p",{className:"empty-hint",children:m("app.empty.hint")}),a&&k.length>0&&o.jsx("button",{className:"primary-button",onClick:()=>T({cwd:k}),disabled:Wt,title:Ne??void 0,children:Wt?m("app.empty.opening"):m("app.empty.newSession",{cwd:k})})]}):o.jsx(qS,{view:Ct,terminalId:p,threadFont:xt,threadTools:gt,fileLinks:ml,onRewind:Fe.rewind&&(oe==null?void 0:oe.alive)===!0?Ya:void 0,rewindBlocked:Mn!=="idle",forceSendAvailable:Fe.forceSend&&(oe==null?void 0:oe.alive)===!0,queueEditAvailable:Fe.editQueue&&(oe==null?void 0:oe.alive)===!0,questionsAnswerable:Fe.questionsAnswerable,contextWindowSource:Fe.contextWindowSource,instructionsFile:fk(Ae),onGoToCli:()=>{if(ke){Je("cli");return}Ir||es(),no("cli")},cliPresence:oe===null||oe.alive?"live":oe.sleeping?"sleeping":"exited",cliLaunchedAt:(oe==null?void 0:oe.launchedAt)??null,exitCode:(oe==null?void 0:oe.exitCode)??null,waking:p!==null&&F.has(p),onWakeCli:()=>{p!==null&&P(p)},discovering:ll,continueTargets:Ka,continueBlockedReason:$k((oe==null?void 0:oe.sessionId)??"",ll,Ct.events.length>0),onContinue:oe===null||Ae===null?void 0:X=>H({agent:Ae,sessionId:oe.sessionId},X,Bp(mt??oe.label)),onMoveToBranch:Rs??void 0,searchRequest:Jt,onSearchRequestApplied:Rn,toolCallNotice:Xi,serverClosed:Qi===null||Ji===null?null:{state:Qi,text:Ji},statusLineState:(Et==null?void 0:Et.state)??null,onConfigureStatusLine:Et===null||Ke===null?void 0:()=>kt(Ke.id),activity:Mn,receipt:p===null?null:zi.receipts.get(p)??null,clock:p===null?null:zi.clocks.get(p)??null,takeNotice:at.takeNotice,planWindows:ct,planSetupState:(Ge==null?void 0:Ge.state)??null,onConfigurePlanLimits:Ge===null?void 0:()=>Es(!0),compactAction:gl,scheduled:p===null?void 0:xn.get(p),onCancelScheduled:Bn.cancel,onSendScheduledNow:mr?Bn.sendNow:void 0})}),ao=o.jsx(o.Fragment,{children:oe!==null&&o.jsx(Kx,{connection:s,drafts:be,terminalId:p,alive:oe.alive,sleeping:oe.sleeping,projectColor:Js(ks(oe)),activity:W.get(oe.terminalId),imagesAllowed:Fe.imagesAllowed,blockedReason:qa,prefills:ne,onPrefillApplied:ee,notice:cl,onDismissNotice:p===null?void 0:()=>ul(p),suggestion:p===null?null:Q.get(p)??null,onSubmitted:(X,ge,et)=>{ul(X),Y(X);const{events:Pt}=Ct,tn=X===p?Pt[Pt.length-1]:void 0;zi.track(X,ge,(tn==null?void 0:tn.eventId)??null,et)},fontSize:xt.size,insertRef:hi,noteInsertRef:fi,onEditQueue:Fe.editQueue&&oe.alive&&Ct.queue.some(X=>X.sent!==!0)&&Ct.queue.every(X=>X.sent===!0||X.forced!==!0)&&Ct.waitingFor===null&&!Ct.editingQueue?Ct.editQueue:void 0,onSchedule:mr&&Fe.scheduledSend?Bn.schedule:void 0,codexQueueAvailable:Fe.codexNativeQueue&&oe.alive&&Mn==="busy",codexQueueSessionId:oe.sessionId,leading:Fe.modeCycle===null&&!Fe.codexPermissions?void 0:o.jsxs(o.Fragment,{children:[Fe.codexPermissions&&o.jsx(gC,{disabled:!oe.alive||Mn!=="idle"||Ct.waitingFor!==null||Ct.openToolCall||nt,state:Ct.codexPermissions,request:Ct.codexPermissionRequest,onChange:Ct.requestCodexPermissions}),Fe.modeCycle!==null&&o.jsx(fC,{mode:Ct.permissionMode,cycle:Fe.modeCycle,disabled:!oe.alive,waitingFor:Ct.waitingFor,statusKnown:Zi,onChange:Ct.setPermissionMode})]}),controls:Fe.models===null&&Fe.efforts===null?void 0:o.jsx(hC,{models:Fe.models,efforts:Fe.efforts,model:Jr,effort:ol,modelProvisional:Gi,effortProvisional:Yi,savesChoice:dk(Ae),effortCommandName:ok(Ae),effortUsesModel:Ae==="codex",disabled:!oe.alive,onCommand:pi})})}),kl=oe===null?null:o.jsx(EL,{tab:ke?Yp(De)??jr:jr,plansAvailable:Fe.plansAvailable,hiddenTabs:we.hidden,hidden:ke?Yp(De)===null:!en,onTabChange:ke?Je:no,title:io,cwd:oe.cwd,colorCwd:ks(oe),platform:d,cli:o.jsx("div",{className:"terminal-stack",children:w.map(X=>o.jsx(Tv,{terminalId:X.terminalId,connection:s,active:X.terminalId===p,theme:dt.resolved,autoFocus:!1},X.terminalId))}),cliUnseen:Zr,expanded:Lr,onToggleExpanded:Ga,git:ii,worktrees:Vi,files:il,plans:Ms,documents:As,memory:ci,onInsert:Fe.fileMentions&&oe.alive?Xa:void 0,onInsertPath:Qa,onReveal:me?null:pl,onHide:es}),Cl=oe===null?null:o.jsx(v1,{connection:s,shells:cn,activeShellId:(En==null?void 0:En.terminalId)??null,cwd:oe.cwd,shellName:pt,theme:dt.resolved,onSelect:Qr,onOpen:Za,onCloseShell:O,onCollapse:ke?()=>Je("chat"):to,onHide:ke?void 0:()=>wr("console"),hideCount:v.length}),xl=we.isVisible("notes")?o.jsx(E2,{notes:He,fill:ke||oe===null,onHide:ke?void 0:()=>wr("notes"),onSendNote:oe===null||!Fe.noteSendable?null:X=>{const ge=oe.cwd;T({cwd:ge,...oe.agent!==null?{agent:oe.agent}:{},onOpened:et=>{s.send({type:"notes.send",noteId:X,terminalId:et.terminalId}),ke&&Je("chat")}})},sendTargetCwd:(oe==null?void 0:oe.cwd)??null,onNoteToComposer:oe===null?null:X=>{var Pt;const ge=He.notes.find(tn=>tn.noteId===X);if(ge===void 0)return;const et=rx(ge.images,He.images,tn=>`${m("notes.imageOnly")} ${tn+1}`);(Pt=fi.current)==null||Pt.call(fi,ge.text,et,!ke),ke&&Je("chat")},composerTarget:oe===null?null:Zm(oe)}):null,tc=oe===null||!we.isVisible("console")?null:o.jsx(o.Fragment,{children:Ts?o.jsxs(o.Fragment,{children:[en&&o.jsx("div",{className:"hdivider",...Ds,title:m("app.divider.consoleHeight")}),o.jsx("div",{className:"console-slot",style:en?{height:`${nr}px`}:{flex:"1 1 auto"},children:Cl})]}):o.jsxs("div",{className:"strip-collapsed-row",children:[o.jsxs("button",{className:"strip-collapsed",onClick:vl,title:pt===null?m("console.openAnyIn",{cwd:oe.cwd}):m("console.openIn",{shell:pt,cwd:oe.cwd}),children:[o.jsx("span",{className:"strip-collapsed-arrow",children:"▸"}),o.jsx("span",{children:pt??m("console.name")}),cn.length>0&&o.jsx("span",{className:"strip-collapsed-count",children:cn.length})]}),o.jsx(ja,{title:m("settings.hide.console"),onHide:()=>wr("console"),confirmText:v.length===0?null:m("settings.panels.consoleConfirm",{count:v.length})})]})}),Sl=o.jsxs(o.Fragment,{children:[l==="revoked"&&o.jsx("div",{className:"banner banner-error",children:m("app.banner.revoked")}),sn!==null&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:m("settings.hiddenHint",{name:m(sn==="console"?"console.name":"notes.name")})}),o.jsx("button",{className:"banner-close",onClick:()=>gr(null),title:m("common.gotIt"),children:"×"})]}),!a&&_!==null&&o.jsx("div",{className:"banner banner-error banner-lines",children:_}),E==="child-session-marker"&&Yr&&o.jsxs("div",{className:"banner banner-notice",children:[o.jsx("span",{children:fn("app.markerNotice",{variable:"CLAUDE_CODE_CHILD_SESSION"})}),o.jsx("button",{className:"banner-close",onClick:ec,title:m("common.gotIt"),children:"×"})]}),L!==null&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:L.message}),o.jsx("button",{className:"banner-close",onClick:R,title:m("common.close"),children:"×"})]}),de.problem!==null&&!lt&&o.jsxs("div",{className:"banner banner-error",children:[o.jsx("span",{children:de.problem}),o.jsx("button",{className:"banner-close",onClick:de.dismissProblem,title:m("common.close"),children:"×"})]}),o.jsx(ME,{})]}),un=di.state,rs=o.jsxs(o.Fragment,{children:[un!==null&&o.jsx(LN,{preview:US(Ct.events.find(X=>X.eventId===un.eventId)),files:HS(Ct.events,un.eventId,(oe==null?void 0:oe.cwd)??""),running:un.phase==="running",error:un.error,onConfirm:di.confirm,onClose:di.close}),sr!==null&&sr.statusLine!==null&&o.jsx(Lm,{info:sr.statusLine,agentLabel:sr.label,onRefresh:U,onClose:()=>kt(null)}),nl&&Ge!==null&&Ke!==null&&o.jsx(Lm,{info:Ge,agentLabel:Ke.label,purpose:"plan-limits",onRefresh:U,onClose:()=>Es(!1)}),Nt.create!==null&&o.jsx(oN,{dialog:Nt.create,agents:c,offerAgentChoice:i,agent:ai,moveBlock:vr,onSubmit:Nt.submitCreate,onClose:Nt.closeCreate}),Nt.remove!==null&&o.jsx(cN,{dialog:Nt.remove,onConfirm:Nt.confirmRemove,onDiscardFiles:Nt.discardFiles,onAskNotes:Nt.askNotes,onAskCommit:Nt.askCommit,onRetry:Nt.retryRemove,onClose:Nt.closeRemove,scheduledCountFor:X=>X.reduce((ge,et)=>ge+(xn.get(et)??[]).filter(Pt=>Pt.state!=="failed").length,0)}),zn!==null&&o.jsx(SN,{warning:zn.warning,onConfirm:()=>{O(zn.terminalId),pe(null)},onClose:()=>pe(null)}),It.review!==null&&o.jsx(uN,{dialog:It.review,agents:c,onSubmit:It.submitReview,onClose:It.closeReview}),It.integrate!==null&&o.jsx(aN,{dialog:It.integrate,agentLabel:sl,onConfirm:It.confirmIntegrate,onRemove:()=>{const X=It.integrate;It.closeIntegrate(),X!==null&&Nt.openRemove(X.worktreeId,X.branch)},onClose:It.closeIntegrate}),Nt.deleteBranch!==null&&o.jsx(lN,{dialog:Nt.deleteBranch,onConfirm:Nt.confirmDeleteBranch,onClose:Nt.closeDeleteBranch}),ut&&o.jsx(kN,{onClose:()=>wt(!1),terminalTheme:dt,panels:we,consoleCount:ke?0:v.length,onHideConsole:Ja,appSettings:Xr,agents:c,remoteClient:me,onOpenVault:()=>{wt(!1),fe(!0)},onOpenRemote:Ce.status!==null&&!me?()=>{wt(!1),rt(!0)}:null,onConfigureStatusLine:X=>{wt(!1),kt(X)}}),$i&&o.jsx(LE,{agent:Lk(Ae,c,y),onClose:()=>Ss(!1)}),ni==="project"&&o.jsx(xm,{connection:s,title:m("app.picker.project.title"),confirmLabel:m("app.picker.project.confirm"),confirmTitle:X=>m("app.picker.project.confirmTitle",{path:X}),onChoose:(X,ge)=>{Ar(null),T({cwd:ge,onOpened:eo})},onClose:()=>Ar(null)}),lt&&o.jsx(EN,{status:de.status,agents:c,indexReady:j.state==="ready",problem:de.problem,covered:ni==="vault",onMeasure:de.measure,onSetEnabled:de.setEnabled,onChangeDir:()=>Ar("vault"),onReveal:me?null:de.reveal,onDismissProblem:de.dismissProblem,onClose:()=>fe(!1)}),$e&&Ce.status!==null&&!me&&o.jsx(y2,{status:Ce.status,pairing:Ce.pairing,phonePairing:Ce.phonePairing,phoneStarted:Ce.phoneStarted,problem:Ce.problem,platform:d,onSetEnabled:Ce.setEnabled,onSetPort:Ce.setPort,onStartPairing:Ce.startPairing,onCancelPairing:Ce.cancelPairing,onStartPhonePairing:Ce.startPhonePairing,onCancelPhonePairing:Ce.cancelPhonePairing,onRenameDevice:Ce.renameDevice,onRevokeDevice:Ce.revokeDevice,onDismissProblem:Ce.dismissProblem,onClose:()=>rt(!1)}),ni==="vault"&&o.jsx(xm,{connection:s,title:m("app.picker.vault.title"),confirmLabel:m("app.picker.vault.confirm"),confirmTitle:X=>m("app.picker.vault.confirmTitle",{path:X}),onChoose:X=>{de.chooseDir(X),Ar(null)},onClose:()=>Ar(null)})]});return ke?o.jsxs("div",{className:"app app-narrow",children:[o.jsx(A2,{banners:Sl,status:l,statusLabel:m(dg[l]),terminals:w,activeTerminalId:p,activity:W,agents:c,offerAgentChoice:i,newTabAgent:Bt,platform:d,canOpen:a&&k.length>0,newTabBlockedTitle:Ne,onSelectTab:je,onCloseTab:Pe,scheduled:xn,onRenameTab:G,onNewTab:X=>T({cwd:yt,...X!==void 0?{agent:X}:{}}),drawer:oo,drawerOpen:Ue,onDrawerChange:se,menu:{cwd:(oe==null?void 0:oe.cwd)??null,cliVersion:f,themeIcon:Gm[Qe.preference],themeTitle:Vm(Qe.preference),onCycleTheme:Qe.cycle,sound:at,remote:Ce.status!==null&&!me?{title:`${m("app.header.remoteAccess")} — ${Ad(Ce.status.state,Ce.status.port)}`,active:rg(Ce.status),onOpen:()=>rt(!0)}:null,remoteClient:me,onShortcuts:()=>Ss(!0),onSettings:()=>wt(!0)},view:De,views:We,onViewChange:Je,badges:{changes:v_(ii.status),plans:Ms.plans.length,memory:((fo=ci.status)==null?void 0:fo.installed)===!0?ci.status.notes.length:0,cliUnseen:Zr},chat:o.jsxs(o.Fragment,{children:[lo,ao]}),panel:kl,notes:xl,console:Cl,onTerminalKey:ri===null?null:rl}),rs]}):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:m(dg[l])}),oe!==null&&o.jsx("span",{className:"meta",title:oe.cwd,children:oe.cwd}),o.jsx("span",{className:"header-spacer"}),f!==null&&o.jsx("span",{className:"meta meta-dim",children:m("app.header.cliVersion",{version:f})}),o.jsx("button",{className:"icon-button",onClick:Qe.cycle,title:Vm(Qe.preference),children:Gm[Qe.preference]}),o.jsx(N_,{sound:at}),o.jsx(R_,{notify:at.notify}),Ce.status!==null&&!me&&o.jsx("button",{className:`icon-button${rg(Ce.status)?" icon-button-on":""}`,onClick:()=>rt(!0),title:`${m("app.header.remoteAccess")} — ${Ad(Ce.status.state,Ce.status.port)}`,children:"⇄"}),me&&o.jsx("span",{className:"remote-badge",title:m("app.header.remoteBadgeTitle"),children:m("app.header.remoteBadge")}),o.jsx("button",{className:"icon-button",onClick:()=>wt(!0),title:m("settings.open"),"aria-label":m("settings.open"),children:"⚙"}),o.jsx("button",{className:"icon-button",onClick:()=>Ss(!0),title:m("app.header.shortcuts"),children:"?"})]}),Sl,o.jsxs("div",{className:"app-body",children:[!Nr&&o.jsxs("button",{className:"panel-peek panel-peek-left",onClick:dl,title:m("app.sidebar.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"»"}),o.jsx("span",{className:"panel-peek-label",children:m("app.sidebar.name")})]}),Nr&&oo,Nr&&o.jsx("div",{className:"divider",...bl,title:m("app.divider.width")}),o.jsxs("main",{className:`workspace${qn&&Sn?" workspace-narrow":""}`,children:[o.jsx(ML,{terminals:w,activeTerminalId:p,activity:W,attention:at.attention,canOpen:a&&k.length>0,onSelect:je,onClose:Pe,scheduled:xn,onRename:G,onReorder:q,onNew:X=>T({cwd:yt,...X!==void 0?{agent:X}:{}}),agents:c,offerAgentChoice:i,newTabAgent:Bt,pendingOpens:g,platform:d,newTabBlockedTitle:Ne,sessionTitles:_t}),lo,ao]}),o.jsxs(o.Fragment,{children:[!Sn&&o.jsxs("button",{className:"panel-peek",onClick:es,title:m("app.panel.show"),children:[o.jsx("span",{className:"panel-peek-arrow",children:"«"}),o.jsx("span",{className:"panel-peek-label",children:m("app.panel.name")})]}),Sn&&o.jsx("div",{className:"divider",...wl,title:m("app.divider.width")}),o.jsxs("div",{className:`panel-slot${Sn?"":" panel-slot-collapsed"}${Sn&&qn?" panel-slot-expanded":""}`,style:Sn&&!qn?{width:`${$n}px`}:void 0,children:[oe!==null&&o.jsxs(o.Fragment,{children:[kl,tc]}),xl]})]})]}),rs]})}const F_=document.getElementById("root");if(F_===null)throw new Error("Falta el contenedor #root.");const FN=Uw.createRoot(F_);dS().then(()=>FN.render(o.jsx(BN,{})));export{Iw as g};