claude-garage 0.3.4 → 0.4.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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var jd;function Bm(){if(jd)return ze;jd=1;var p=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),w=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),c=Symbol.iterator;function b(R){return R===null||typeof R!="object"?null:(R=c&&R[c]||R["@@iterator"],typeof R=="function"?R:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,y={};function g(R,G,X){this.props=R,this.context=G,this.refs=y,this.updater=X||C}g.prototype.isReactComponent={},g.prototype.setState=function(R,G){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,G,"setState")},g.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function _(){}_.prototype=g.prototype;function m(R,G,X){this.props=R,this.context=G,this.refs=y,this.updater=X||C}var v=m.prototype=new _;v.constructor=m,S(v,g.prototype),v.isPureReactComponent=!0;var D=Array.isArray,P=Object.prototype.hasOwnProperty,T={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function E(R,G,X){var oe,ae={},me=null,$=null;if(G!=null)for(oe in G.ref!==void 0&&($=G.ref),G.key!==void 0&&(me=""+G.key),G)P.call(G,oe)&&!A.hasOwnProperty(oe)&&(ae[oe]=G[oe]);var O=arguments.length-2;if(O===1)ae.children=X;else if(1<O){for(var le=Array(O),se=0;se<O;se++)le[se]=arguments[se+2];ae.children=le}if(R&&R.defaultProps)for(oe in O=R.defaultProps,O)ae[oe]===void 0&&(ae[oe]=O[oe]);return{$$typeof:p,type:R,key:me,ref:$,props:ae,_owner:T.current}}function I(R,G){return{$$typeof:p,type:R.type,key:G,ref:R.ref,props:R.props,_owner:R._owner}}function z(R){return typeof R=="object"&&R!==null&&R.$$typeof===p}function H(R){var G={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(X){return G[X]})}var V=/\/+/g;function F(R,G){return typeof R=="object"&&R!==null&&R.key!=null?H(""+R.key):G.toString(36)}function q(R,G,X,oe,ae){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var $=!1;if(R===null)$=!0;else switch(me){case"string":case"number":$=!0;break;case"object":switch(R.$$typeof){case p:case e:$=!0}}if($)return $=R,ae=ae($),R=oe===""?"."+F($,0):oe,D(ae)?(X="",R!=null&&(X=R.replace(V,"$&/")+"/"),q(ae,G,X,"",function(se){return se})):ae!=null&&(z(ae)&&(ae=I(ae,X+(!ae.key||$&&$.key===ae.key?"":(""+ae.key).replace(V,"$&/")+"/")+R)),G.push(ae)),1;if($=0,oe=oe===""?".":oe+":",D(R))for(var O=0;O<R.length;O++){me=R[O];var le=oe+F(me,O);$+=q(me,G,X,le,ae)}else if(le=b(R),typeof le=="function")for(R=le.call(R),O=0;!(me=R.next()).done;)me=me.value,le=oe+F(me,O++),$+=q(me,G,X,le,ae);else if(me==="object")throw G=String(R),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return $}function W(R,G,X){if(R==null)return R;var oe=[],ae=0;return q(R,oe,"","",function(me){return G.call(X,me,ae++)}),oe}function K(R){if(R._status===-1){var G=R._result;G=G(),G.then(function(X){(R._status===0||R._status===-1)&&(R._status=1,R._result=X)},function(X){(R._status===0||R._status===-1)&&(R._status=2,R._result=X)}),R._status===-1&&(R._status=0,R._result=G)}if(R._status===1)return R._result.default;throw R._result}var ie={current:null},J={transition:null},L={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:J,ReactCurrentOwner:T};function B(){throw Error("act(...) is not supported in production builds of React.")}return ze.Children={map:W,forEach:function(R,G,X){W(R,function(){G.apply(this,arguments)},X)},count:function(R){var G=0;return W(R,function(){G++}),G},toArray:function(R){return W(R,function(G){return G})||[]},only:function(R){if(!z(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},ze.Component=g,ze.Fragment=t,ze.Profiler=o,ze.PureComponent=m,ze.StrictMode=n,ze.Suspense=l,ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,ze.act=B,ze.cloneElement=function(R,G,X){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var oe=S({},R.props),ae=R.key,me=R.ref,$=R._owner;if(G!=null){if(G.ref!==void 0&&(me=G.ref,$=T.current),G.key!==void 0&&(ae=""+G.key),R.type&&R.type.defaultProps)var O=R.type.defaultProps;for(le in G)P.call(G,le)&&!A.hasOwnProperty(le)&&(oe[le]=G[le]===void 0&&O!==void 0?O[le]:G[le])}var le=arguments.length-2;if(le===1)oe.children=X;else if(1<le){O=Array(le);for(var se=0;se<le;se++)O[se]=arguments[se+2];oe.children=O}return{$$typeof:p,type:R.type,key:ae,ref:me,props:oe,_owner:$}},ze.createContext=function(R){return R={$$typeof:w,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:h,_context:R},R.Consumer=R},ze.createElement=E,ze.createFactory=function(R){var G=E.bind(null,R);return G.type=R,G},ze.createRef=function(){return{current:null}},ze.forwardRef=function(R){return{$$typeof:a,render:R}},ze.isValidElement=z,ze.lazy=function(R){return{$$typeof:d,_payload:{_status:-1,_result:R},_init:K}},ze.memo=function(R,G){return{$$typeof:u,type:R,compare:G===void 0?null:G}},ze.startTransition=function(R){var G=J.transition;J.transition={};try{R()}finally{J.transition=G}},ze.unstable_act=B,ze.useCallback=function(R,G){return ie.current.useCallback(R,G)},ze.useContext=function(R){return ie.current.useContext(R)},ze.useDebugValue=function(){},ze.useDeferredValue=function(R){return ie.current.useDeferredValue(R)},ze.useEffect=function(R,G){return ie.current.useEffect(R,G)},ze.useId=function(){return ie.current.useId()},ze.useImperativeHandle=function(R,G,X){return ie.current.useImperativeHandle(R,G,X)},ze.useInsertionEffect=function(R,G){return ie.current.useInsertionEffect(R,G)},ze.useLayoutEffect=function(R,G){return ie.current.useLayoutEffect(R,G)},ze.useMemo=function(R,G){return ie.current.useMemo(R,G)},ze.useReducer=function(R,G,X){return ie.current.useReducer(R,G,X)},ze.useRef=function(R){return ie.current.useRef(R)},ze.useState=function(R){return ie.current.useState(R)},ze.useSyncExternalStore=function(R,G,X){return ie.current.useSyncExternalStore(R,G,X)},ze.useTransition=function(){return ie.current.useTransition()},ze.version="18.3.1",ze}var $d;function th(){return $d||($d=1,yl.exports=Bm()),yl.exports}/**
9
+ */var jd;function Bm(){if(jd)return ze;jd=1;var p=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),w=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),c=Symbol.iterator;function b(R){return R===null||typeof R!="object"?null:(R=c&&R[c]||R["@@iterator"],typeof R=="function"?R:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,y={};function g(R,G,X){this.props=R,this.context=G,this.refs=y,this.updater=X||C}g.prototype.isReactComponent={},g.prototype.setState=function(R,G){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,G,"setState")},g.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function _(){}_.prototype=g.prototype;function m(R,G,X){this.props=R,this.context=G,this.refs=y,this.updater=X||C}var v=m.prototype=new _;v.constructor=m,S(v,g.prototype),v.isPureReactComponent=!0;var D=Array.isArray,P=Object.prototype.hasOwnProperty,T={current:null},A={key:!0,ref:!0,__self:!0,__source:!0};function E(R,G,X){var oe,ae={},me=null,$=null;if(G!=null)for(oe in G.ref!==void 0&&($=G.ref),G.key!==void 0&&(me=""+G.key),G)P.call(G,oe)&&!A.hasOwnProperty(oe)&&(ae[oe]=G[oe]);var O=arguments.length-2;if(O===1)ae.children=X;else if(1<O){for(var le=Array(O),se=0;se<O;se++)le[se]=arguments[se+2];ae.children=le}if(R&&R.defaultProps)for(oe in O=R.defaultProps,O)ae[oe]===void 0&&(ae[oe]=O[oe]);return{$$typeof:p,type:R,key:me,ref:$,props:ae,_owner:T.current}}function I(R,G){return{$$typeof:p,type:R.type,key:G,ref:R.ref,props:R.props,_owner:R._owner}}function B(R){return typeof R=="object"&&R!==null&&R.$$typeof===p}function N(R){var G={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(X){return G[X]})}var W=/\/+/g;function F(R,G){return typeof R=="object"&&R!==null&&R.key!=null?N(""+R.key):G.toString(36)}function q(R,G,X,oe,ae){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var $=!1;if(R===null)$=!0;else switch(me){case"string":case"number":$=!0;break;case"object":switch(R.$$typeof){case p:case e:$=!0}}if($)return $=R,ae=ae($),R=oe===""?"."+F($,0):oe,D(ae)?(X="",R!=null&&(X=R.replace(W,"$&/")+"/"),q(ae,G,X,"",function(se){return se})):ae!=null&&(B(ae)&&(ae=I(ae,X+(!ae.key||$&&$.key===ae.key?"":(""+ae.key).replace(W,"$&/")+"/")+R)),G.push(ae)),1;if($=0,oe=oe===""?".":oe+":",D(R))for(var O=0;O<R.length;O++){me=R[O];var le=oe+F(me,O);$+=q(me,G,X,le,ae)}else if(le=b(R),typeof le=="function")for(R=le.call(R),O=0;!(me=R.next()).done;)me=me.value,le=oe+F(me,O++),$+=q(me,G,X,le,ae);else if(me==="object")throw G=String(R),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.");return $}function V(R,G,X){if(R==null)return R;var oe=[],ae=0;return q(R,oe,"","",function(me){return G.call(X,me,ae++)}),oe}function K(R){if(R._status===-1){var G=R._result;G=G(),G.then(function(X){(R._status===0||R._status===-1)&&(R._status=1,R._result=X)},function(X){(R._status===0||R._status===-1)&&(R._status=2,R._result=X)}),R._status===-1&&(R._status=0,R._result=G)}if(R._status===1)return R._result.default;throw R._result}var ie={current:null},Z={transition:null},L={ReactCurrentDispatcher:ie,ReactCurrentBatchConfig:Z,ReactCurrentOwner:T};function H(){throw Error("act(...) is not supported in production builds of React.")}return ze.Children={map:V,forEach:function(R,G,X){V(R,function(){G.apply(this,arguments)},X)},count:function(R){var G=0;return V(R,function(){G++}),G},toArray:function(R){return V(R,function(G){return G})||[]},only:function(R){if(!B(R))throw Error("React.Children.only expected to receive a single React element child.");return R}},ze.Component=g,ze.Fragment=t,ze.Profiler=o,ze.PureComponent=m,ze.StrictMode=n,ze.Suspense=l,ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=L,ze.act=H,ze.cloneElement=function(R,G,X){if(R==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+R+".");var oe=S({},R.props),ae=R.key,me=R.ref,$=R._owner;if(G!=null){if(G.ref!==void 0&&(me=G.ref,$=T.current),G.key!==void 0&&(ae=""+G.key),R.type&&R.type.defaultProps)var O=R.type.defaultProps;for(le in G)P.call(G,le)&&!A.hasOwnProperty(le)&&(oe[le]=G[le]===void 0&&O!==void 0?O[le]:G[le])}var le=arguments.length-2;if(le===1)oe.children=X;else if(1<le){O=Array(le);for(var se=0;se<le;se++)O[se]=arguments[se+2];oe.children=O}return{$$typeof:p,type:R.type,key:ae,ref:me,props:oe,_owner:$}},ze.createContext=function(R){return R={$$typeof:w,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},R.Provider={$$typeof:h,_context:R},R.Consumer=R},ze.createElement=E,ze.createFactory=function(R){var G=E.bind(null,R);return G.type=R,G},ze.createRef=function(){return{current:null}},ze.forwardRef=function(R){return{$$typeof:a,render:R}},ze.isValidElement=B,ze.lazy=function(R){return{$$typeof:d,_payload:{_status:-1,_result:R},_init:K}},ze.memo=function(R,G){return{$$typeof:u,type:R,compare:G===void 0?null:G}},ze.startTransition=function(R){var G=Z.transition;Z.transition={};try{R()}finally{Z.transition=G}},ze.unstable_act=H,ze.useCallback=function(R,G){return ie.current.useCallback(R,G)},ze.useContext=function(R){return ie.current.useContext(R)},ze.useDebugValue=function(){},ze.useDeferredValue=function(R){return ie.current.useDeferredValue(R)},ze.useEffect=function(R,G){return ie.current.useEffect(R,G)},ze.useId=function(){return ie.current.useId()},ze.useImperativeHandle=function(R,G,X){return ie.current.useImperativeHandle(R,G,X)},ze.useInsertionEffect=function(R,G){return ie.current.useInsertionEffect(R,G)},ze.useLayoutEffect=function(R,G){return ie.current.useLayoutEffect(R,G)},ze.useMemo=function(R,G){return ie.current.useMemo(R,G)},ze.useReducer=function(R,G,X){return ie.current.useReducer(R,G,X)},ze.useRef=function(R){return ie.current.useRef(R)},ze.useState=function(R){return ie.current.useState(R)},ze.useSyncExternalStore=function(R,G,X){return ie.current.useSyncExternalStore(R,G,X)},ze.useTransition=function(){return ie.current.useTransition()},ze.version="18.3.1",ze}var $d;function th(){return $d||($d=1,yl.exports=Bm()),yl.exports}/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ud;function Hm(){if(Ud)return er;Ud=1;var p=th(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function w(a,l,u){var d,c={},b=null,C=null;u!==void 0&&(b=""+u),l.key!==void 0&&(b=""+l.key),l.ref!==void 0&&(C=l.ref);for(d in l)n.call(l,d)&&!h.hasOwnProperty(d)&&(c[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)c[d]===void 0&&(c[d]=l[d]);return{$$typeof:e,type:a,key:b,ref:C,props:c,_owner:o.current}}return er.Fragment=t,er.jsx=w,er.jsxs=w,er}var Kd;function Fm(){return Kd||(Kd=1,bl.exports=Hm()),bl.exports}var N=Fm(),Z=th();const Te=eh(Z);var bo={},Sl={exports:{}},Ft={},Cl={exports:{}},xl={};/**
17
+ */var Ud;function Hm(){if(Ud)return er;Ud=1;var p=th(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function w(a,l,u){var d,c={},b=null,C=null;u!==void 0&&(b=""+u),l.key!==void 0&&(b=""+l.key),l.ref!==void 0&&(C=l.ref);for(d in l)n.call(l,d)&&!h.hasOwnProperty(d)&&(c[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)c[d]===void 0&&(c[d]=l[d]);return{$$typeof:e,type:a,key:b,ref:C,props:c,_owner:o.current}}return er.Fragment=t,er.jsx=w,er.jsxs=w,er}var Kd;function Fm(){return Kd||(Kd=1,bl.exports=Hm()),bl.exports}var z=Fm(),J=th();const Te=eh(J);var bo={},Sl={exports:{}},Ft={},Cl={exports:{}},xl={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var Yd;function Wm(){return Yd||(Yd=1,(function(p){function e(J,L){var B=J.length;J.push(L);e:for(;0<B;){var R=B-1>>>1,G=J[R];if(0<o(G,L))J[R]=L,J[B]=G,B=R;else break e}}function t(J){return J.length===0?null:J[0]}function n(J){if(J.length===0)return null;var L=J[0],B=J.pop();if(B!==L){J[0]=B;e:for(var R=0,G=J.length,X=G>>>1;R<X;){var oe=2*(R+1)-1,ae=J[oe],me=oe+1,$=J[me];if(0>o(ae,B))me<G&&0>o($,ae)?(J[R]=$,J[me]=B,R=me):(J[R]=ae,J[oe]=B,R=oe);else if(me<G&&0>o($,B))J[R]=$,J[me]=B,R=me;else break e}}return L}function o(J,L){var B=J.sortIndex-L.sortIndex;return B!==0?B:J.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;p.unstable_now=function(){return h.now()}}else{var w=Date,a=w.now();p.unstable_now=function(){return w.now()-a}}var l=[],u=[],d=1,c=null,b=3,C=!1,S=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(J){for(var L=t(u);L!==null;){if(L.callback===null)n(u);else if(L.startTime<=J)n(u),L.sortIndex=L.expirationTime,e(l,L);else break;L=t(u)}}function D(J){if(y=!1,v(J),!S)if(t(l)!==null)S=!0,K(P);else{var L=t(u);L!==null&&ie(D,L.startTime-J)}}function P(J,L){S=!1,y&&(y=!1,_(E),E=-1),C=!0;var B=b;try{for(v(L),c=t(l);c!==null&&(!(c.expirationTime>L)||J&&!H());){var R=c.callback;if(typeof R=="function"){c.callback=null,b=c.priorityLevel;var G=R(c.expirationTime<=L);L=p.unstable_now(),typeof G=="function"?c.callback=G:c===t(l)&&n(l),v(L)}else n(l);c=t(l)}if(c!==null)var X=!0;else{var oe=t(u);oe!==null&&ie(D,oe.startTime-L),X=!1}return X}finally{c=null,b=B,C=!1}}var T=!1,A=null,E=-1,I=5,z=-1;function H(){return!(p.unstable_now()-z<I)}function V(){if(A!==null){var J=p.unstable_now();z=J;var L=!0;try{L=A(!0,J)}finally{L?F():(T=!1,A=null)}}else T=!1}var F;if(typeof m=="function")F=function(){m(V)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,W=q.port2;q.port1.onmessage=V,F=function(){W.postMessage(null)}}else F=function(){g(V,0)};function K(J){A=J,T||(T=!0,F())}function ie(J,L){E=g(function(){J(p.unstable_now())},L)}p.unstable_IdlePriority=5,p.unstable_ImmediatePriority=1,p.unstable_LowPriority=4,p.unstable_NormalPriority=3,p.unstable_Profiling=null,p.unstable_UserBlockingPriority=2,p.unstable_cancelCallback=function(J){J.callback=null},p.unstable_continueExecution=function(){S||C||(S=!0,K(P))},p.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<J?Math.floor(1e3/J):5},p.unstable_getCurrentPriorityLevel=function(){return b},p.unstable_getFirstCallbackNode=function(){return t(l)},p.unstable_next=function(J){switch(b){case 1:case 2:case 3:var L=3;break;default:L=b}var B=b;b=L;try{return J()}finally{b=B}},p.unstable_pauseExecution=function(){},p.unstable_requestPaint=function(){},p.unstable_runWithPriority=function(J,L){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var B=b;b=J;try{return L()}finally{b=B}},p.unstable_scheduleCallback=function(J,L,B){var R=p.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?R+B:R):B=R,J){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=B+G,J={id:d++,callback:L,priorityLevel:J,startTime:B,expirationTime:G,sortIndex:-1},B>R?(J.sortIndex=B,e(u,J),t(l)===null&&J===t(u)&&(y?(_(E),E=-1):y=!0,ie(D,B-R))):(J.sortIndex=G,e(l,J),S||C||(S=!0,K(P))),J},p.unstable_shouldYield=H,p.unstable_wrapCallback=function(J){var L=b;return function(){var B=b;b=L;try{return J.apply(this,arguments)}finally{b=B}}}})(xl)),xl}var Xd;function Vm(){return Xd||(Xd=1,Cl.exports=Wm()),Cl.exports}/**
25
+ */var Yd;function Wm(){return Yd||(Yd=1,(function(p){function e(Z,L){var H=Z.length;Z.push(L);e:for(;0<H;){var R=H-1>>>1,G=Z[R];if(0<o(G,L))Z[R]=L,Z[H]=G,H=R;else break e}}function t(Z){return Z.length===0?null:Z[0]}function n(Z){if(Z.length===0)return null;var L=Z[0],H=Z.pop();if(H!==L){Z[0]=H;e:for(var R=0,G=Z.length,X=G>>>1;R<X;){var oe=2*(R+1)-1,ae=Z[oe],me=oe+1,$=Z[me];if(0>o(ae,H))me<G&&0>o($,ae)?(Z[R]=$,Z[me]=H,R=me):(Z[R]=ae,Z[oe]=H,R=oe);else if(me<G&&0>o($,H))Z[R]=$,Z[me]=H,R=me;else break e}}return L}function o(Z,L){var H=Z.sortIndex-L.sortIndex;return H!==0?H:Z.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;p.unstable_now=function(){return h.now()}}else{var w=Date,a=w.now();p.unstable_now=function(){return w.now()-a}}var l=[],u=[],d=1,c=null,b=3,C=!1,S=!1,y=!1,g=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(Z){for(var L=t(u);L!==null;){if(L.callback===null)n(u);else if(L.startTime<=Z)n(u),L.sortIndex=L.expirationTime,e(l,L);else break;L=t(u)}}function D(Z){if(y=!1,v(Z),!S)if(t(l)!==null)S=!0,K(P);else{var L=t(u);L!==null&&ie(D,L.startTime-Z)}}function P(Z,L){S=!1,y&&(y=!1,_(E),E=-1),C=!0;var H=b;try{for(v(L),c=t(l);c!==null&&(!(c.expirationTime>L)||Z&&!N());){var R=c.callback;if(typeof R=="function"){c.callback=null,b=c.priorityLevel;var G=R(c.expirationTime<=L);L=p.unstable_now(),typeof G=="function"?c.callback=G:c===t(l)&&n(l),v(L)}else n(l);c=t(l)}if(c!==null)var X=!0;else{var oe=t(u);oe!==null&&ie(D,oe.startTime-L),X=!1}return X}finally{c=null,b=H,C=!1}}var T=!1,A=null,E=-1,I=5,B=-1;function N(){return!(p.unstable_now()-B<I)}function W(){if(A!==null){var Z=p.unstable_now();B=Z;var L=!0;try{L=A(!0,Z)}finally{L?F():(T=!1,A=null)}}else T=!1}var F;if(typeof m=="function")F=function(){m(W)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,V=q.port2;q.port1.onmessage=W,F=function(){V.postMessage(null)}}else F=function(){g(W,0)};function K(Z){A=Z,T||(T=!0,F())}function ie(Z,L){E=g(function(){Z(p.unstable_now())},L)}p.unstable_IdlePriority=5,p.unstable_ImmediatePriority=1,p.unstable_LowPriority=4,p.unstable_NormalPriority=3,p.unstable_Profiling=null,p.unstable_UserBlockingPriority=2,p.unstable_cancelCallback=function(Z){Z.callback=null},p.unstable_continueExecution=function(){S||C||(S=!0,K(P))},p.unstable_forceFrameRate=function(Z){0>Z||125<Z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<Z?Math.floor(1e3/Z):5},p.unstable_getCurrentPriorityLevel=function(){return b},p.unstable_getFirstCallbackNode=function(){return t(l)},p.unstable_next=function(Z){switch(b){case 1:case 2:case 3:var L=3;break;default:L=b}var H=b;b=L;try{return Z()}finally{b=H}},p.unstable_pauseExecution=function(){},p.unstable_requestPaint=function(){},p.unstable_runWithPriority=function(Z,L){switch(Z){case 1:case 2:case 3:case 4:case 5:break;default:Z=3}var H=b;b=Z;try{return L()}finally{b=H}},p.unstable_scheduleCallback=function(Z,L,H){var R=p.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?R+H:R):H=R,Z){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=H+G,Z={id:d++,callback:L,priorityLevel:Z,startTime:H,expirationTime:G,sortIndex:-1},H>R?(Z.sortIndex=H,e(u,Z),t(l)===null&&Z===t(u)&&(y?(_(E),E=-1):y=!0,ie(D,H-R))):(Z.sortIndex=G,e(l,Z),S||C||(S=!0,K(P))),Z},p.unstable_shouldYield=N,p.unstable_wrapCallback=function(Z){var L=b;return function(){var H=b;b=L;try{return Z.apply(this,arguments)}finally{b=H}}}})(xl)),xl}var Xd;function Vm(){return Xd||(Xd=1,Cl.exports=Wm()),Cl.exports}/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,19 +30,19 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var qd;function jm(){if(qd)return Ft;qd=1;var p=th(),e=Vm();function t(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,r=1;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,o={};function h(i,s){w(i,s),w(i+"Capture",s)}function w(i,s){for(o[i]=s,i=0;i<s.length;i++)n.add(s[i])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,u=/^[: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={},c={};function b(i){return l.call(c,i)?!0:l.call(d,i)?!1:u.test(i)?c[i]=!0:(d[i]=!0,!1)}function C(i,s,r,f){if(r!==null&&r.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:r!==null?!r.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function S(i,s,r,f){if(s===null||typeof s>"u"||C(i,s,r,f))return!0;if(f)return!1;if(r!==null)switch(r.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function y(i,s,r,f,x,k,M){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=x,this.mustUseProperty=r,this.propertyName=i,this.type=s,this.sanitizeURL=k,this.removeEmptyString=M}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){g[i]=new y(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];g[s]=new y(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){g[i]=new y(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){g[i]=new y(i,2,!1,i,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(i){g[i]=new y(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){g[i]=new y(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){g[i]=new y(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){g[i]=new y(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){g[i]=new y(i,5,!1,i.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function m(i){return i[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(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){g[i]=new y(i,1,!1,i.toLowerCase(),null,!1,!1)}),g.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){g[i]=new y(i,1,!1,i.toLowerCase(),null,!0,!0)});function v(i,s,r,f){var x=g.hasOwnProperty(s)?g[s]:null;(x!==null?x.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(S(s,r,x,f)&&(r=null),f||x===null?b(s)&&(r===null?i.removeAttribute(s):i.setAttribute(s,""+r)):x.mustUseProperty?i[x.propertyName]=r===null?x.type===3?!1:"":r:(s=x.attributeName,f=x.attributeNamespace,r===null?i.removeAttribute(s):(x=x.type,r=x===3||x===4&&r===!0?"":""+r,f?i.setAttributeNS(f,s,r):i.setAttribute(s,r))))}var D=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P=Symbol.for("react.element"),T=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),H=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),J=Symbol.iterator;function L(i){return i===null||typeof i!="object"?null:(i=J&&i[J]||i["@@iterator"],typeof i=="function"?i:null)}var B=Object.assign,R;function G(i){if(R===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return`
33
+ */var qd;function jm(){if(qd)return Ft;qd=1;var p=th(),e=Vm();function t(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,r=1;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,o={};function h(i,s){w(i,s),w(i+"Capture",s)}function w(i,s){for(o[i]=s,i=0;i<s.length;i++)n.add(s[i])}var a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,u=/^[: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={},c={};function b(i){return l.call(c,i)?!0:l.call(d,i)?!1:u.test(i)?c[i]=!0:(d[i]=!0,!1)}function C(i,s,r,f){if(r!==null&&r.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return f?!1:r!==null?!r.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function S(i,s,r,f){if(s===null||typeof s>"u"||C(i,s,r,f))return!0;if(f)return!1;if(r!==null)switch(r.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function y(i,s,r,f,x,k,M){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=f,this.attributeNamespace=x,this.mustUseProperty=r,this.propertyName=i,this.type=s,this.sanitizeURL=k,this.removeEmptyString=M}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){g[i]=new y(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];g[s]=new y(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){g[i]=new y(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){g[i]=new y(i,2,!1,i,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(i){g[i]=new y(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){g[i]=new y(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){g[i]=new y(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){g[i]=new y(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){g[i]=new y(i,5,!1,i.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function m(i){return i[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(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(_,m);g[s]=new y(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){g[i]=new y(i,1,!1,i.toLowerCase(),null,!1,!1)}),g.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){g[i]=new y(i,1,!1,i.toLowerCase(),null,!0,!0)});function v(i,s,r,f){var x=g.hasOwnProperty(s)?g[s]:null;(x!==null?x.type!==0:f||!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(S(s,r,x,f)&&(r=null),f||x===null?b(s)&&(r===null?i.removeAttribute(s):i.setAttribute(s,""+r)):x.mustUseProperty?i[x.propertyName]=r===null?x.type===3?!1:"":r:(s=x.attributeName,f=x.attributeNamespace,r===null?i.removeAttribute(s):(x=x.type,r=x===3||x===4&&r===!0?"":""+r,f?i.setAttributeNS(f,s,r):i.setAttribute(s,r))))}var D=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,P=Symbol.for("react.element"),T=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),B=Symbol.for("react.provider"),N=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),ie=Symbol.for("react.offscreen"),Z=Symbol.iterator;function L(i){return i===null||typeof i!="object"?null:(i=Z&&i[Z]||i["@@iterator"],typeof i=="function"?i:null)}var H=Object.assign,R;function G(i){if(R===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return`
34
34
  `+R+i}var X=!1;function oe(i,s){if(!i||X)return"";X=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(s)if(s=function(){throw Error()},Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(re){var f=re}Reflect.construct(i,[],s)}else{try{s.call()}catch(re){f=re}i.call(s.prototype)}else{try{throw Error()}catch(re){f=re}i()}}catch(re){if(re&&f&&typeof re.stack=="string"){for(var x=re.stack.split(`
35
35
  `),k=f.stack.split(`
36
36
  `),M=x.length-1,j=k.length-1;1<=M&&0<=j&&x[M]!==k[j];)j--;for(;1<=M&&0<=j;M--,j--)if(x[M]!==k[j]){if(M!==1||j!==1)do if(M--,j--,0>j||x[M]!==k[j]){var U=`
37
- `+x[M].replace(" at new "," at ");return i.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",i.displayName)),U}while(1<=M&&0<=j);break}}}finally{X=!1,Error.prepareStackTrace=r}return(i=i?i.displayName||i.name:"")?G(i):""}function ae(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=oe(i.type,!1),i;case 11:return i=oe(i.type.render,!1),i;case 1:return i=oe(i.type,!0),i;default:return""}}function me(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case T:return"Portal";case I:return"Profiler";case E:return"StrictMode";case F:return"Suspense";case q:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case H:return(i.displayName||"Context")+".Consumer";case z:return(i._context.displayName||"Context")+".Provider";case V:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case W:return s=i.displayName||null,s!==null?s:me(i.type)||"Memo";case K:s=i._payload,i=i._init;try{return me(i(s))}catch{}}return null}function $(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(s);case 8:return s===E?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function O(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function le(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function se(i){var s=le(i)?"checked":"value",r=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),f=""+i[s];if(!i.hasOwnProperty(s)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var x=r.get,k=r.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return x.call(this)},set:function(M){f=""+M,k.call(this,M)}}),Object.defineProperty(i,s,{enumerable:r.enumerable}),{getValue:function(){return f},setValue:function(M){f=""+M},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function ge(i){i._valueTracker||(i._valueTracker=se(i))}function fe(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),f="";return i&&(f=le(i)?i.checked?"true":"false":i.value),i=f,i!==r?(s.setValue(i),!0):!1}function Me(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function We(i,s){var r=s.checked;return B({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??i._wrapperState.initialChecked})}function je(i,s){var r=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;r=O(s.value!=null?s.value:r),i._wrapperState={initialChecked:f,initialValue:r,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function ot(i,s){s=s.checked,s!=null&&v(i,"checked",s,!1)}function Ae(i,s){ot(i,s);var r=O(s.value),f=s.type;if(r!=null)f==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+r):i.value!==""+r&&(i.value=""+r);else if(f==="submit"||f==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?Ie(i,s.type,r):s.hasOwnProperty("defaultValue")&&Ie(i,s.type,O(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function ve(i,s,r){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,r||s===i.value||(i.value=s),i.defaultValue=s}r=i.name,r!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,r!==""&&(i.name=r)}function Ie(i,s,r){(s!=="number"||Me(i.ownerDocument)!==i)&&(r==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+r&&(i.defaultValue=""+r))}var $e=Array.isArray;function st(i,s,r,f){if(i=i.options,s){s={};for(var x=0;x<r.length;x++)s["$"+r[x]]=!0;for(r=0;r<i.length;r++)x=s.hasOwnProperty("$"+i[r].value),i[r].selected!==x&&(i[r].selected=x),x&&f&&(i[r].defaultSelected=!0)}else{for(r=""+O(r),s=null,x=0;x<i.length;x++){if(i[x].value===r){i[x].selected=!0,f&&(i[x].defaultSelected=!0);return}s!==null||i[x].disabled||(s=i[x])}s!==null&&(s.selected=!0)}}function Dt(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(t(91));return B({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Ne(i,s){var r=s.value;if(r==null){if(r=s.children,s=s.defaultValue,r!=null){if(s!=null)throw Error(t(92));if($e(r)){if(1<r.length)throw Error(t(93));r=r[0]}s=r}s==null&&(s=""),r=s}i._wrapperState={initialValue:O(r)}}function Si(i,s){var r=O(s.value),f=O(s.defaultValue);r!=null&&(r=""+r,r!==i.value&&(i.value=r),s.defaultValue==null&&i.defaultValue!==r&&(i.defaultValue=r)),f!=null&&(i.defaultValue=""+f)}function At(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function mt(i){switch(i){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 ut(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?mt(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Ke,ai=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,r,f,x){MSApp.execUnsafeLocalFunction(function(){return i(s,r,f,x)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(Ke=Ke||document.createElement("div"),Ke.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ke.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function gt(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var Rt={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},Ye=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(i){Ye.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),Rt[s]=Rt[i]})});function Bs(i,s,r){return s==null||typeof s=="boolean"||s===""?"":r||typeof s!="number"||s===0||Rt.hasOwnProperty(i)&&Rt[i]?(""+s).trim():s+"px"}function dr(i,s){i=i.style;for(var r in s)if(s.hasOwnProperty(r)){var f=r.indexOf("--")===0,x=Bs(r,s[r],f);r==="float"&&(r="cssFloat"),f?i.setProperty(r,x):i[r]=x}}var gn=B({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 li(i,s){if(s){if(gn[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(t(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(t(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(t(61))}if(s.style!=null&&typeof s.style!="object")throw Error(t(62))}}function Hs(i,s){if(i.indexOf("-")===-1)return typeof s.is=="string";switch(i){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 _s=null;function ws(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Fs=null,Mt=null,Vt=null;function vn(i){if(i=Bn(i)){if(typeof Fs!="function")throw Error(t(280));var s=i.stateNode;s&&(s=Mr(s),Fs(i.stateNode,i.type,s))}}function bs(i){Mt?Vt?Vt.push(i):Vt=[i]:Mt=i}function _n(){if(Mt){var i=Mt,s=Vt;if(Vt=Mt=null,vn(i),s)for(i=0;i<s.length;i++)vn(s[i])}}function Yi(i,s){return i(s)}function Ws(){}var wn=!1;function ur(i,s,r){if(wn)return i(s,r);wn=!0;try{return Yi(i,s,r)}finally{wn=!1,(Mt!==null||Vt!==null)&&(Ws(),_n())}}function Ri(i,s){var r=i.stateNode;if(r===null)return null;var f=Mr(r);if(f===null)return null;r=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(t(231,s,typeof r));return r}var Mi=!1;if(a)try{var Xt={};Object.defineProperty(Xt,"passive",{get:function(){Mi=!0}}),window.addEventListener("test",Xt,Xt),window.removeEventListener("test",Xt,Xt)}catch{Mi=!1}function bn(i,s,r,f,x,k,M,j,U){var re=Array.prototype.slice.call(arguments,3);try{s.apply(r,re)}catch(de){this.onError(de)}}var Xi=!1,ys=null,Ss=!1,Cs=null,zo={onError:function(i){Xi=!0,ys=i}};function Bo(i,s,r,f,x,k,M,j,U){Xi=!1,ys=null,bn.apply(zo,arguments)}function pr(i,s,r,f,x,k,M,j,U){if(Bo.apply(this,arguments),Xi){if(Xi){var re=ys;Xi=!1,ys=null}else throw Error(t(198));Ss||(Ss=!0,Cs=re)}}function ne(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function he(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function ue(i){if(ne(i)!==i)throw Error(t(188))}function De(i){var s=i.alternate;if(!s){if(s=ne(i),s===null)throw Error(t(188));return s!==i?null:i}for(var r=i,f=s;;){var x=r.return;if(x===null)break;var k=x.alternate;if(k===null){if(f=x.return,f!==null){r=f;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===r)return ue(x),i;if(k===f)return ue(x),s;k=k.sibling}throw Error(t(188))}if(r.return!==f.return)r=x,f=k;else{for(var M=!1,j=x.child;j;){if(j===r){M=!0,r=x,f=k;break}if(j===f){M=!0,f=x,r=k;break}j=j.sibling}if(!M){for(j=k.child;j;){if(j===r){M=!0,r=k,f=x;break}if(j===f){M=!0,f=k,r=x;break}j=j.sibling}if(!M)throw Error(t(189))}}if(r.alternate!==f)throw Error(t(190))}if(r.tag!==3)throw Error(t(188));return r.stateNode.current===r?i:s}function Oe(i){return i=De(i),i!==null?Be(i):null}function Be(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Be(i);if(s!==null)return s;i=i.sibling}return null}var Xe=e.unstable_scheduleCallback,jt=e.unstable_cancelCallback,Ot=e.unstable_shouldYield,qp=e.unstable_requestPaint,ct=e.unstable_now,Jp=e.unstable_getCurrentPriorityLevel,Ho=e.unstable_ImmediatePriority,wh=e.unstable_UserBlockingPriority,fr=e.unstable_NormalPriority,Zp=e.unstable_LowPriority,bh=e.unstable_IdlePriority,mr=null,Ci=null;function Qp(i){if(Ci&&typeof Ci.onCommitFiberRoot=="function")try{Ci.onCommitFiberRoot(mr,i,void 0,(i.current.flags&128)===128)}catch{}}var hi=Math.clz32?Math.clz32:sf,ef=Math.log,tf=Math.LN2;function sf(i){return i>>>=0,i===0?32:31-(ef(i)/tf|0)|0}var gr=64,vr=4194304;function yn(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function _r(i,s){var r=i.pendingLanes;if(r===0)return 0;var f=0,x=i.suspendedLanes,k=i.pingedLanes,M=r&268435455;if(M!==0){var j=M&~x;j!==0?f=yn(j):(k&=M,k!==0&&(f=yn(k)))}else M=r&~x,M!==0?f=yn(M):k!==0&&(f=yn(k));if(f===0)return 0;if(s!==0&&s!==f&&(s&x)===0&&(x=f&-f,k=s&-s,x>=k||x===16&&(k&4194240)!==0))return s;if((f&4)!==0&&(f|=r&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=f;0<s;)r=31-hi(s),x=1<<r,f|=i[r],s&=~x;return f}function nf(i,s){switch(i){case 1:case 2:case 4:return s+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 s+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 rf(i,s){for(var r=i.suspendedLanes,f=i.pingedLanes,x=i.expirationTimes,k=i.pendingLanes;0<k;){var M=31-hi(k),j=1<<M,U=x[M];U===-1?((j&r)===0||(j&f)!==0)&&(x[M]=nf(j,s)):U<=s&&(i.expiredLanes|=j),k&=~j}}function Fo(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function yh(){var i=gr;return gr<<=1,(gr&4194240)===0&&(gr=64),i}function Wo(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Sn(i,s,r){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-hi(s),i[s]=r}function of(i,s){var r=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var f=i.eventTimes;for(i=i.expirationTimes;0<r;){var x=31-hi(r),k=1<<x;s[x]=0,f[x]=-1,i[x]=-1,r&=~k}}function Vo(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var f=31-hi(r),x=1<<f;x&s|i[f]&s&&(i[f]|=s),r&=~x}}var Ue=0;function Sh(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Ch,jo,xh,Dh,Eh,$o=!1,wr=[],qi=null,Ji=null,Zi=null,Cn=new Map,xn=new Map,Qi=[],af="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 kh(i,s){switch(i){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Ji=null;break;case"mouseover":case"mouseout":Zi=null;break;case"pointerover":case"pointerout":Cn.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":xn.delete(s.pointerId)}}function Dn(i,s,r,f,x,k){return i===null||i.nativeEvent!==k?(i={blockedOn:s,domEventName:r,eventSystemFlags:f,nativeEvent:k,targetContainers:[x]},s!==null&&(s=Bn(s),s!==null&&jo(s)),i):(i.eventSystemFlags|=f,s=i.targetContainers,x!==null&&s.indexOf(x)===-1&&s.push(x),i)}function lf(i,s,r,f,x){switch(s){case"focusin":return qi=Dn(qi,i,s,r,f,x),!0;case"dragenter":return Ji=Dn(Ji,i,s,r,f,x),!0;case"mouseover":return Zi=Dn(Zi,i,s,r,f,x),!0;case"pointerover":var k=x.pointerId;return Cn.set(k,Dn(Cn.get(k)||null,i,s,r,f,x)),!0;case"gotpointercapture":return k=x.pointerId,xn.set(k,Dn(xn.get(k)||null,i,s,r,f,x)),!0}return!1}function Ph(i){var s=xs(i.target);if(s!==null){var r=ne(s);if(r!==null){if(s=r.tag,s===13){if(s=he(r),s!==null){i.blockedOn=s,Eh(i.priority,function(){xh(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function br(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Ko(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(r===null){r=i.nativeEvent;var f=new r.constructor(r.type,r);_s=f,r.target.dispatchEvent(f),_s=null}else return s=Bn(r),s!==null&&jo(s),i.blockedOn=r,!1;s.shift()}return!0}function Th(i,s,r){br(i)&&r.delete(s)}function hf(){$o=!1,qi!==null&&br(qi)&&(qi=null),Ji!==null&&br(Ji)&&(Ji=null),Zi!==null&&br(Zi)&&(Zi=null),Cn.forEach(Th),xn.forEach(Th)}function En(i,s){i.blockedOn===s&&(i.blockedOn=null,$o||($o=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hf)))}function kn(i){function s(x){return En(x,i)}if(0<wr.length){En(wr[0],i);for(var r=1;r<wr.length;r++){var f=wr[r];f.blockedOn===i&&(f.blockedOn=null)}}for(qi!==null&&En(qi,i),Ji!==null&&En(Ji,i),Zi!==null&&En(Zi,i),Cn.forEach(s),xn.forEach(s),r=0;r<Qi.length;r++)f=Qi[r],f.blockedOn===i&&(f.blockedOn=null);for(;0<Qi.length&&(r=Qi[0],r.blockedOn===null);)Ph(r),r.blockedOn===null&&Qi.shift()}var Vs=D.ReactCurrentBatchConfig,yr=!0;function cf(i,s,r,f){var x=Ue,k=Vs.transition;Vs.transition=null;try{Ue=1,Uo(i,s,r,f)}finally{Ue=x,Vs.transition=k}}function df(i,s,r,f){var x=Ue,k=Vs.transition;Vs.transition=null;try{Ue=4,Uo(i,s,r,f)}finally{Ue=x,Vs.transition=k}}function Uo(i,s,r,f){if(yr){var x=Ko(i,s,r,f);if(x===null)ca(i,s,f,Sr,r),kh(i,f);else if(lf(x,i,s,r,f))f.stopPropagation();else if(kh(i,f),s&4&&-1<af.indexOf(i)){for(;x!==null;){var k=Bn(x);if(k!==null&&Ch(k),k=Ko(i,s,r,f),k===null&&ca(i,s,f,Sr,r),k===x)break;x=k}x!==null&&f.stopPropagation()}else ca(i,s,f,null,r)}}var Sr=null;function Ko(i,s,r,f){if(Sr=null,i=ws(f),i=xs(i),i!==null)if(s=ne(i),s===null)i=null;else if(r=s.tag,r===13){if(i=he(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return Sr=i,null}function Ah(i){switch(i){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(Jp()){case Ho:return 1;case wh:return 4;case fr:case Zp:return 16;case bh:return 536870912;default:return 16}default:return 16}}var es=null,Yo=null,Cr=null;function Ih(){if(Cr)return Cr;var i,s=Yo,r=s.length,f,x="value"in es?es.value:es.textContent,k=x.length;for(i=0;i<r&&s[i]===x[i];i++);var M=r-i;for(f=1;f<=M&&s[r-f]===x[k-f];f++);return Cr=x.slice(i,1<f?1-f:void 0)}function xr(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Dr(){return!0}function Lh(){return!1}function $t(i){function s(r,f,x,k,M){this._reactName=r,this._targetInst=x,this.type=f,this.nativeEvent=k,this.target=M,this.currentTarget=null;for(var j in i)i.hasOwnProperty(j)&&(r=i[j],this[j]=r?r(k):k[j]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Dr:Lh,this.isPropagationStopped=Lh,this}return B(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Dr)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),s}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xo=$t(js),Pn=B({},js,{view:0,detail:0}),uf=$t(Pn),qo,Jo,Tn,Er=B({},Pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qo,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Tn&&(Tn&&i.type==="mousemove"?(qo=i.screenX-Tn.screenX,Jo=i.screenY-Tn.screenY):Jo=qo=0,Tn=i),qo)},movementY:function(i){return"movementY"in i?i.movementY:Jo}}),Rh=$t(Er),pf=B({},Er,{dataTransfer:0}),ff=$t(pf),mf=B({},Pn,{relatedTarget:0}),Zo=$t(mf),gf=B({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),vf=$t(gf),_f=B({},js,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),wf=$t(_f),bf=B({},js,{data:0}),Mh=$t(bf),yf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sf={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"},Cf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xf(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Cf[i])?!!s[i]:!1}function Qo(){return xf}var Df=B({},Pn,{key:function(i){if(i.key){var s=yf[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=xr(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Sf[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qo,charCode:function(i){return i.type==="keypress"?xr(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?xr(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Ef=$t(Df),kf=B({},Er,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=$t(kf),Pf=B({},Pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qo}),Tf=$t(Pf),Af=B({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),If=$t(Af),Lf=B({},Er,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Rf=$t(Lf),Mf=[9,13,27,32],ea=a&&"CompositionEvent"in window,An=null;a&&"documentMode"in document&&(An=document.documentMode);var Of=a&&"TextEvent"in window&&!An,Gh=a&&(!ea||An&&8<An&&11>=An),Nh=" ",zh=!1;function Bh(i,s){switch(i){case"keyup":return Mf.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hh(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var $s=!1;function Gf(i,s){switch(i){case"compositionend":return Hh(s);case"keypress":return s.which!==32?null:(zh=!0,Nh);case"textInput":return i=s.data,i===Nh&&zh?null:i;default:return null}}function Nf(i,s){if($s)return i==="compositionend"||!ea&&Bh(i,s)?(i=Ih(),Cr=Yo=es=null,$s=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Gh&&s.locale!=="ko"?null:s.data;default:return null}}var zf={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 Fh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!zf[i.type]:s==="textarea"}function Wh(i,s,r,f){bs(f),s=Ir(s,"onChange"),0<s.length&&(r=new Xo("onChange","change",null,r,f),i.push({event:r,listeners:s}))}var In=null,Ln=null;function Bf(i){oc(i,0)}function kr(i){var s=qs(i);if(fe(s))return i}function Hf(i,s){if(i==="change")return s}var Vh=!1;if(a){var ta;if(a){var ia="oninput"in document;if(!ia){var jh=document.createElement("div");jh.setAttribute("oninput","return;"),ia=typeof jh.oninput=="function"}ta=ia}else ta=!1;Vh=ta&&(!document.documentMode||9<document.documentMode)}function $h(){In&&(In.detachEvent("onpropertychange",Uh),Ln=In=null)}function Uh(i){if(i.propertyName==="value"&&kr(Ln)){var s=[];Wh(s,Ln,i,ws(i)),ur(Bf,s)}}function Ff(i,s,r){i==="focusin"?($h(),In=s,Ln=r,In.attachEvent("onpropertychange",Uh)):i==="focusout"&&$h()}function Wf(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return kr(Ln)}function Vf(i,s){if(i==="click")return kr(s)}function jf(i,s){if(i==="input"||i==="change")return kr(s)}function $f(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var ci=typeof Object.is=="function"?Object.is:$f;function Rn(i,s){if(ci(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),f=Object.keys(s);if(r.length!==f.length)return!1;for(f=0;f<r.length;f++){var x=r[f];if(!l.call(s,x)||!ci(i[x],s[x]))return!1}return!0}function Kh(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Yh(i,s){var r=Kh(i);i=0;for(var f;r;){if(r.nodeType===3){if(f=i+r.textContent.length,i<=s&&f>=s)return{node:r,offset:s-i};i=f}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kh(r)}}function Xh(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Xh(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function qh(){for(var i=window,s=Me();s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=Me(i.document)}return s}function sa(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}function Uf(i){var s=qh(),r=i.focusedElem,f=i.selectionRange;if(s!==r&&r&&r.ownerDocument&&Xh(r.ownerDocument.documentElement,r)){if(f!==null&&sa(r)){if(s=f.start,i=f.end,i===void 0&&(i=s),"selectionStart"in r)r.selectionStart=s,r.selectionEnd=Math.min(i,r.value.length);else if(i=(s=r.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var x=r.textContent.length,k=Math.min(f.start,x);f=f.end===void 0?k:Math.min(f.end,x),!i.extend&&k>f&&(x=f,f=k,k=x),x=Yh(r,k);var M=Yh(r,f);x&&M&&(i.rangeCount!==1||i.anchorNode!==x.node||i.anchorOffset!==x.offset||i.focusNode!==M.node||i.focusOffset!==M.offset)&&(s=s.createRange(),s.setStart(x.node,x.offset),i.removeAllRanges(),k>f?(i.addRange(s),i.extend(M.node,M.offset)):(s.setEnd(M.node,M.offset),i.addRange(s)))}}for(s=[],i=r;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<s.length;r++)i=s[r],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Kf=a&&"documentMode"in document&&11>=document.documentMode,Us=null,na=null,Mn=null,ra=!1;function Jh(i,s,r){var f=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ra||Us==null||Us!==Me(f)||(f=Us,"selectionStart"in f&&sa(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Mn&&Rn(Mn,f)||(Mn=f,f=Ir(na,"onSelect"),0<f.length&&(s=new Xo("onSelect","select",null,s,r),i.push({event:s,listeners:f}),s.target=Us)))}function Pr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Ks={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionend:Pr("Transition","TransitionEnd")},oa={},Zh={};a&&(Zh=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function Tr(i){if(oa[i])return oa[i];if(!Ks[i])return i;var s=Ks[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in Zh)return oa[i]=s[r];return i}var Qh=Tr("animationend"),ec=Tr("animationiteration"),tc=Tr("animationstart"),ic=Tr("transitionend"),sc=new Map,nc="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 ts(i,s){sc.set(i,s),h(s,[i])}for(var aa=0;aa<nc.length;aa++){var la=nc[aa],Yf=la.toLowerCase(),Xf=la[0].toUpperCase()+la.slice(1);ts(Yf,"on"+Xf)}ts(Qh,"onAnimationEnd"),ts(ec,"onAnimationIteration"),ts(tc,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(ic,"onTransitionEnd"),w("onMouseEnter",["mouseout","mouseover"]),w("onMouseLeave",["mouseout","mouseover"]),w("onPointerEnter",["pointerout","pointerover"]),w("onPointerLeave",["pointerout","pointerover"]),h("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),h("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),h("onBeforeInput",["compositionend","keypress","textInput","paste"]),h("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var On="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(" "),qf=new Set("cancel close invalid load scroll toggle".split(" ").concat(On));function rc(i,s,r){var f=i.type||"unknown-event";i.currentTarget=r,pr(f,s,void 0,i),i.currentTarget=null}function oc(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var f=i[r],x=f.event;f=f.listeners;e:{var k=void 0;if(s)for(var M=f.length-1;0<=M;M--){var j=f[M],U=j.instance,re=j.currentTarget;if(j=j.listener,U!==k&&x.isPropagationStopped())break e;rc(x,j,re),k=U}else for(M=0;M<f.length;M++){if(j=f[M],U=j.instance,re=j.currentTarget,j=j.listener,U!==k&&x.isPropagationStopped())break e;rc(x,j,re),k=U}}}if(Ss)throw i=Cs,Ss=!1,Cs=null,i}function Ze(i,s){var r=s[ga];r===void 0&&(r=s[ga]=new Set);var f=i+"__bubble";r.has(f)||(ac(s,i,2,!1),r.add(f))}function ha(i,s,r){var f=0;s&&(f|=4),ac(r,i,f,s)}var Ar="_reactListening"+Math.random().toString(36).slice(2);function Gn(i){if(!i[Ar]){i[Ar]=!0,n.forEach(function(r){r!=="selectionchange"&&(qf.has(r)||ha(r,!1,i),ha(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Ar]||(s[Ar]=!0,ha("selectionchange",!1,s))}}function ac(i,s,r,f){switch(Ah(s)){case 1:var x=cf;break;case 4:x=df;break;default:x=Uo}r=x.bind(null,s,r,i),x=void 0,!Mi||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(x=!0),f?x!==void 0?i.addEventListener(s,r,{capture:!0,passive:x}):i.addEventListener(s,r,!0):x!==void 0?i.addEventListener(s,r,{passive:x}):i.addEventListener(s,r,!1)}function ca(i,s,r,f,x){var k=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var M=f.tag;if(M===3||M===4){var j=f.stateNode.containerInfo;if(j===x||j.nodeType===8&&j.parentNode===x)break;if(M===4)for(M=f.return;M!==null;){var U=M.tag;if((U===3||U===4)&&(U=M.stateNode.containerInfo,U===x||U.nodeType===8&&U.parentNode===x))return;M=M.return}for(;j!==null;){if(M=xs(j),M===null)return;if(U=M.tag,U===5||U===6){f=k=M;continue e}j=j.parentNode}}f=f.return}ur(function(){var re=k,de=ws(r),pe=[];e:{var ce=sc.get(i);if(ce!==void 0){var ye=Xo,xe=i;switch(i){case"keypress":if(xr(r)===0)break e;case"keydown":case"keyup":ye=Ef;break;case"focusin":xe="focus",ye=Zo;break;case"focusout":xe="blur",ye=Zo;break;case"beforeblur":case"afterblur":ye=Zo;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=Rh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=ff;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=Tf;break;case Qh:case ec:case tc:ye=vf;break;case ic:ye=If;break;case"scroll":ye=uf;break;case"wheel":ye=Rf;break;case"copy":case"cut":case"paste":ye=wf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=Oh}var Ee=(s&4)!==0,dt=!Ee&&i==="scroll",ee=Ee?ce!==null?ce+"Capture":null:ce;Ee=[];for(var Y=re,te;Y!==null;){te=Y;var _e=te.stateNode;if(te.tag===5&&_e!==null&&(te=_e,ee!==null&&(_e=Ri(Y,ee),_e!=null&&Ee.push(Nn(Y,_e,te)))),dt)break;Y=Y.return}0<Ee.length&&(ce=new ye(ce,xe,null,r,de),pe.push({event:ce,listeners:Ee}))}}if((s&7)===0){e:{if(ce=i==="mouseover"||i==="pointerover",ye=i==="mouseout"||i==="pointerout",ce&&r!==_s&&(xe=r.relatedTarget||r.fromElement)&&(xs(xe)||xe[Oi]))break e;if((ye||ce)&&(ce=de.window===de?de:(ce=de.ownerDocument)?ce.defaultView||ce.parentWindow:window,ye?(xe=r.relatedTarget||r.toElement,ye=re,xe=xe?xs(xe):null,xe!==null&&(dt=ne(xe),xe!==dt||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(ye=null,xe=re),ye!==xe)){if(Ee=Rh,_e="onMouseLeave",ee="onMouseEnter",Y="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=Oh,_e="onPointerLeave",ee="onPointerEnter",Y="pointer"),dt=ye==null?ce:qs(ye),te=xe==null?ce:qs(xe),ce=new Ee(_e,Y+"leave",ye,r,de),ce.target=dt,ce.relatedTarget=te,_e=null,xs(de)===re&&(Ee=new Ee(ee,Y+"enter",xe,r,de),Ee.target=te,Ee.relatedTarget=dt,_e=Ee),dt=_e,ye&&xe)t:{for(Ee=ye,ee=xe,Y=0,te=Ee;te;te=Ys(te))Y++;for(te=0,_e=ee;_e;_e=Ys(_e))te++;for(;0<Y-te;)Ee=Ys(Ee),Y--;for(;0<te-Y;)ee=Ys(ee),te--;for(;Y--;){if(Ee===ee||ee!==null&&Ee===ee.alternate)break t;Ee=Ys(Ee),ee=Ys(ee)}Ee=null}else Ee=null;ye!==null&&lc(pe,ce,ye,Ee,!1),xe!==null&&dt!==null&&lc(pe,dt,xe,Ee,!0)}}e:{if(ce=re?qs(re):window,ye=ce.nodeName&&ce.nodeName.toLowerCase(),ye==="select"||ye==="input"&&ce.type==="file")var ke=Hf;else if(Fh(ce))if(Vh)ke=jf;else{ke=Wf;var Le=Ff}else(ye=ce.nodeName)&&ye.toLowerCase()==="input"&&(ce.type==="checkbox"||ce.type==="radio")&&(ke=Vf);if(ke&&(ke=ke(i,re))){Wh(pe,ke,r,de);break e}Le&&Le(i,ce,re),i==="focusout"&&(Le=ce._wrapperState)&&Le.controlled&&ce.type==="number"&&Ie(ce,"number",ce.value)}switch(Le=re?qs(re):window,i){case"focusin":(Fh(Le)||Le.contentEditable==="true")&&(Us=Le,na=re,Mn=null);break;case"focusout":Mn=na=Us=null;break;case"mousedown":ra=!0;break;case"contextmenu":case"mouseup":case"dragend":ra=!1,Jh(pe,r,de);break;case"selectionchange":if(Kf)break;case"keydown":case"keyup":Jh(pe,r,de)}var Re;if(ea)e:{switch(i){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else $s?Bh(i,r)&&(Ge="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Ge="onCompositionStart");Ge&&(Gh&&r.locale!=="ko"&&($s||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&$s&&(Re=Ih()):(es=de,Yo="value"in es?es.value:es.textContent,$s=!0)),Le=Ir(re,Ge),0<Le.length&&(Ge=new Mh(Ge,i,null,r,de),pe.push({event:Ge,listeners:Le}),Re?Ge.data=Re:(Re=Hh(r),Re!==null&&(Ge.data=Re)))),(Re=Of?Gf(i,r):Nf(i,r))&&(re=Ir(re,"onBeforeInput"),0<re.length&&(de=new Mh("onBeforeInput","beforeinput",null,r,de),pe.push({event:de,listeners:re}),de.data=Re))}oc(pe,s)})}function Nn(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Ir(i,s){for(var r=s+"Capture",f=[];i!==null;){var x=i,k=x.stateNode;x.tag===5&&k!==null&&(x=k,k=Ri(i,r),k!=null&&f.unshift(Nn(i,k,x)),k=Ri(i,s),k!=null&&f.push(Nn(i,k,x))),i=i.return}return f}function Ys(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function lc(i,s,r,f,x){for(var k=s._reactName,M=[];r!==null&&r!==f;){var j=r,U=j.alternate,re=j.stateNode;if(U!==null&&U===f)break;j.tag===5&&re!==null&&(j=re,x?(U=Ri(r,k),U!=null&&M.unshift(Nn(r,U,j))):x||(U=Ri(r,k),U!=null&&M.push(Nn(r,U,j)))),r=r.return}M.length!==0&&i.push({event:s,listeners:M})}var Jf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function hc(i){return(typeof i=="string"?i:""+i).replace(Jf,`
38
- `).replace(Zf,"")}function Lr(i,s,r){if(s=hc(s),hc(i)!==s&&r)throw Error(t(425))}function Rr(){}var da=null,ua=null;function pa(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var fa=typeof setTimeout=="function"?setTimeout:void 0,Qf=typeof clearTimeout=="function"?clearTimeout:void 0,cc=typeof Promise=="function"?Promise:void 0,em=typeof queueMicrotask=="function"?queueMicrotask:typeof cc<"u"?function(i){return cc.resolve(null).then(i).catch(tm)}:fa;function tm(i){setTimeout(function(){throw i})}function ma(i,s){var r=s,f=0;do{var x=r.nextSibling;if(i.removeChild(r),x&&x.nodeType===8)if(r=x.data,r==="/$"){if(f===0){i.removeChild(x),kn(s);return}f--}else r!=="$"&&r!=="$?"&&r!=="$!"||f++;r=x}while(r);kn(s)}function is(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return i}function dc(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"){if(s===0)return i;s--}else r==="/$"&&s++}i=i.previousSibling}return null}var Xs=Math.random().toString(36).slice(2),xi="__reactFiber$"+Xs,zn="__reactProps$"+Xs,Oi="__reactContainer$"+Xs,ga="__reactEvents$"+Xs,im="__reactListeners$"+Xs,sm="__reactHandles$"+Xs;function xs(i){var s=i[xi];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Oi]||r[xi]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=dc(i);i!==null;){if(r=i[xi])return r;i=dc(i)}return s}i=r,r=i.parentNode}return null}function Bn(i){return i=i[xi]||i[Oi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function qs(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(t(33))}function Mr(i){return i[zn]||null}var va=[],Js=-1;function ss(i){return{current:i}}function Qe(i){0>Js||(i.current=va[Js],va[Js]=null,Js--)}function qe(i,s){Js++,va[Js]=i.current,i.current=s}var ns={},Et=ss(ns),Gt=ss(!1),Ds=ns;function Zs(i,s){var r=i.type.contextTypes;if(!r)return ns;var f=i.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var x={},k;for(k in r)x[k]=s[k];return f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=x),x}function Nt(i){return i=i.childContextTypes,i!=null}function Or(){Qe(Gt),Qe(Et)}function uc(i,s,r){if(Et.current!==ns)throw Error(t(168));qe(Et,s),qe(Gt,r)}function pc(i,s,r){var f=i.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return r;f=f.getChildContext();for(var x in f)if(!(x in s))throw Error(t(108,$(i)||"Unknown",x));return B({},r,f)}function Gr(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ns,Ds=Et.current,qe(Et,i),qe(Gt,Gt.current),!0}function fc(i,s,r){var f=i.stateNode;if(!f)throw Error(t(169));r?(i=pc(i,s,Ds),f.__reactInternalMemoizedMergedChildContext=i,Qe(Gt),Qe(Et),qe(Et,i)):Qe(Gt),qe(Gt,r)}var Gi=null,Nr=!1,_a=!1;function mc(i){Gi===null?Gi=[i]:Gi.push(i)}function nm(i){Nr=!0,mc(i)}function rs(){if(!_a&&Gi!==null){_a=!0;var i=0,s=Ue;try{var r=Gi;for(Ue=1;i<r.length;i++){var f=r[i];do f=f(!0);while(f!==null)}Gi=null,Nr=!1}catch(x){throw Gi!==null&&(Gi=Gi.slice(i+1)),Xe(Ho,rs),x}finally{Ue=s,_a=!1}}return null}var Qs=[],en=0,zr=null,Br=0,qt=[],Jt=0,Es=null,Ni=1,zi="";function ks(i,s){Qs[en++]=Br,Qs[en++]=zr,zr=i,Br=s}function gc(i,s,r){qt[Jt++]=Ni,qt[Jt++]=zi,qt[Jt++]=Es,Es=i;var f=Ni;i=zi;var x=32-hi(f)-1;f&=~(1<<x),r+=1;var k=32-hi(s)+x;if(30<k){var M=x-x%5;k=(f&(1<<M)-1).toString(32),f>>=M,x-=M,Ni=1<<32-hi(s)+x|r<<x|f,zi=k+i}else Ni=1<<k|r<<x|f,zi=i}function wa(i){i.return!==null&&(ks(i,1),gc(i,1,0))}function ba(i){for(;i===zr;)zr=Qs[--en],Qs[en]=null,Br=Qs[--en],Qs[en]=null;for(;i===Es;)Es=qt[--Jt],qt[Jt]=null,zi=qt[--Jt],qt[Jt]=null,Ni=qt[--Jt],qt[Jt]=null}var Ut=null,Kt=null,tt=!1,di=null;function vc(i,s){var r=ti(5,null,null,0);r.elementType="DELETED",r.stateNode=s,r.return=i,s=i.deletions,s===null?(i.deletions=[r],i.flags|=16):s.push(r)}function _c(i,s){switch(i.tag){case 5:var r=i.type;return s=s.nodeType!==1||r.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=is(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(r=Es!==null?{id:Ni,overflow:zi}:null,i.memoizedState={dehydrated:s,treeContext:r,retryLane:1073741824},r=ti(18,null,null,0),r.stateNode=s,r.return=i,i.child=r,Ut=i,Kt=null,!0):!1;default:return!1}}function ya(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Sa(i){if(tt){var s=Kt;if(s){var r=s;if(!_c(i,s)){if(ya(i))throw Error(t(418));s=is(r.nextSibling);var f=Ut;s&&_c(i,s)?vc(f,r):(i.flags=i.flags&-4097|2,tt=!1,Ut=i)}}else{if(ya(i))throw Error(t(418));i.flags=i.flags&-4097|2,tt=!1,Ut=i}}}function wc(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Ut=i}function Hr(i){if(i!==Ut)return!1;if(!tt)return wc(i),tt=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!pa(i.type,i.memoizedProps)),s&&(s=Kt)){if(ya(i))throw bc(),Error(t(418));for(;s;)vc(i,s),s=is(s.nextSibling)}if(wc(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(t(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"){if(s===0){Kt=is(i.nextSibling);break e}s--}else r!=="$"&&r!=="$!"&&r!=="$?"||s++}i=i.nextSibling}Kt=null}}else Kt=Ut?is(i.stateNode.nextSibling):null;return!0}function bc(){for(var i=Kt;i;)i=is(i.nextSibling)}function tn(){Kt=Ut=null,tt=!1}function Ca(i){di===null?di=[i]:di.push(i)}var rm=D.ReactCurrentBatchConfig;function Hn(i,s,r){if(i=r.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(t(309));var f=r.stateNode}if(!f)throw Error(t(147,i));var x=f,k=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===k?s.ref:(s=function(M){var j=x.refs;M===null?delete j[k]:j[k]=M},s._stringRef=k,s)}if(typeof i!="string")throw Error(t(284));if(!r._owner)throw Error(t(290,i))}return i}function Fr(i,s){throw i=Object.prototype.toString.call(s),Error(t(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function yc(i){var s=i._init;return s(i._payload)}function Sc(i){function s(ee,Y){if(i){var te=ee.deletions;te===null?(ee.deletions=[Y],ee.flags|=16):te.push(Y)}}function r(ee,Y){if(!i)return null;for(;Y!==null;)s(ee,Y),Y=Y.sibling;return null}function f(ee,Y){for(ee=new Map;Y!==null;)Y.key!==null?ee.set(Y.key,Y):ee.set(Y.index,Y),Y=Y.sibling;return ee}function x(ee,Y){return ee=ps(ee,Y),ee.index=0,ee.sibling=null,ee}function k(ee,Y,te){return ee.index=te,i?(te=ee.alternate,te!==null?(te=te.index,te<Y?(ee.flags|=2,Y):te):(ee.flags|=2,Y)):(ee.flags|=1048576,Y)}function M(ee){return i&&ee.alternate===null&&(ee.flags|=2),ee}function j(ee,Y,te,_e){return Y===null||Y.tag!==6?(Y=fl(te,ee.mode,_e),Y.return=ee,Y):(Y=x(Y,te),Y.return=ee,Y)}function U(ee,Y,te,_e){var ke=te.type;return ke===A?de(ee,Y,te.props.children,_e,te.key):Y!==null&&(Y.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===K&&yc(ke)===Y.type)?(_e=x(Y,te.props),_e.ref=Hn(ee,Y,te),_e.return=ee,_e):(_e=uo(te.type,te.key,te.props,null,ee.mode,_e),_e.ref=Hn(ee,Y,te),_e.return=ee,_e)}function re(ee,Y,te,_e){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=ml(te,ee.mode,_e),Y.return=ee,Y):(Y=x(Y,te.children||[]),Y.return=ee,Y)}function de(ee,Y,te,_e,ke){return Y===null||Y.tag!==7?(Y=Os(te,ee.mode,_e,ke),Y.return=ee,Y):(Y=x(Y,te),Y.return=ee,Y)}function pe(ee,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=fl(""+Y,ee.mode,te),Y.return=ee,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case P:return te=uo(Y.type,Y.key,Y.props,null,ee.mode,te),te.ref=Hn(ee,null,Y),te.return=ee,te;case T:return Y=ml(Y,ee.mode,te),Y.return=ee,Y;case K:var _e=Y._init;return pe(ee,_e(Y._payload),te)}if($e(Y)||L(Y))return Y=Os(Y,ee.mode,te,null),Y.return=ee,Y;Fr(ee,Y)}return null}function ce(ee,Y,te,_e){var ke=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return ke!==null?null:j(ee,Y,""+te,_e);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case P:return te.key===ke?U(ee,Y,te,_e):null;case T:return te.key===ke?re(ee,Y,te,_e):null;case K:return ke=te._init,ce(ee,Y,ke(te._payload),_e)}if($e(te)||L(te))return ke!==null?null:de(ee,Y,te,_e,null);Fr(ee,te)}return null}function ye(ee,Y,te,_e,ke){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return ee=ee.get(te)||null,j(Y,ee,""+_e,ke);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case P:return ee=ee.get(_e.key===null?te:_e.key)||null,U(Y,ee,_e,ke);case T:return ee=ee.get(_e.key===null?te:_e.key)||null,re(Y,ee,_e,ke);case K:var Le=_e._init;return ye(ee,Y,te,Le(_e._payload),ke)}if($e(_e)||L(_e))return ee=ee.get(te)||null,de(Y,ee,_e,ke,null);Fr(Y,_e)}return null}function xe(ee,Y,te,_e){for(var ke=null,Le=null,Re=Y,Ge=Y=0,yt=null;Re!==null&&Ge<te.length;Ge++){Re.index>Ge?(yt=Re,Re=null):yt=Re.sibling;var Fe=ce(ee,Re,te[Ge],_e);if(Fe===null){Re===null&&(Re=yt);break}i&&Re&&Fe.alternate===null&&s(ee,Re),Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe,Re=yt}if(Ge===te.length)return r(ee,Re),tt&&ks(ee,Ge),ke;if(Re===null){for(;Ge<te.length;Ge++)Re=pe(ee,te[Ge],_e),Re!==null&&(Y=k(Re,Y,Ge),Le===null?ke=Re:Le.sibling=Re,Le=Re);return tt&&ks(ee,Ge),ke}for(Re=f(ee,Re);Ge<te.length;Ge++)yt=ye(Re,ee,Ge,te[Ge],_e),yt!==null&&(i&&yt.alternate!==null&&Re.delete(yt.key===null?Ge:yt.key),Y=k(yt,Y,Ge),Le===null?ke=yt:Le.sibling=yt,Le=yt);return i&&Re.forEach(function(fs){return s(ee,fs)}),tt&&ks(ee,Ge),ke}function Ee(ee,Y,te,_e){var ke=L(te);if(typeof ke!="function")throw Error(t(150));if(te=ke.call(te),te==null)throw Error(t(151));for(var Le=ke=null,Re=Y,Ge=Y=0,yt=null,Fe=te.next();Re!==null&&!Fe.done;Ge++,Fe=te.next()){Re.index>Ge?(yt=Re,Re=null):yt=Re.sibling;var fs=ce(ee,Re,Fe.value,_e);if(fs===null){Re===null&&(Re=yt);break}i&&Re&&fs.alternate===null&&s(ee,Re),Y=k(fs,Y,Ge),Le===null?ke=fs:Le.sibling=fs,Le=fs,Re=yt}if(Fe.done)return r(ee,Re),tt&&ks(ee,Ge),ke;if(Re===null){for(;!Fe.done;Ge++,Fe=te.next())Fe=pe(ee,Fe.value,_e),Fe!==null&&(Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe);return tt&&ks(ee,Ge),ke}for(Re=f(ee,Re);!Fe.done;Ge++,Fe=te.next())Fe=ye(Re,ee,Ge,Fe.value,_e),Fe!==null&&(i&&Fe.alternate!==null&&Re.delete(Fe.key===null?Ge:Fe.key),Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe);return i&&Re.forEach(function(zm){return s(ee,zm)}),tt&&ks(ee,Ge),ke}function dt(ee,Y,te,_e){if(typeof te=="object"&&te!==null&&te.type===A&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case P:e:{for(var ke=te.key,Le=Y;Le!==null;){if(Le.key===ke){if(ke=te.type,ke===A){if(Le.tag===7){r(ee,Le.sibling),Y=x(Le,te.props.children),Y.return=ee,ee=Y;break e}}else if(Le.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===K&&yc(ke)===Le.type){r(ee,Le.sibling),Y=x(Le,te.props),Y.ref=Hn(ee,Le,te),Y.return=ee,ee=Y;break e}r(ee,Le);break}else s(ee,Le);Le=Le.sibling}te.type===A?(Y=Os(te.props.children,ee.mode,_e,te.key),Y.return=ee,ee=Y):(_e=uo(te.type,te.key,te.props,null,ee.mode,_e),_e.ref=Hn(ee,Y,te),_e.return=ee,ee=_e)}return M(ee);case T:e:{for(Le=te.key;Y!==null;){if(Y.key===Le)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){r(ee,Y.sibling),Y=x(Y,te.children||[]),Y.return=ee,ee=Y;break e}else{r(ee,Y);break}else s(ee,Y);Y=Y.sibling}Y=ml(te,ee.mode,_e),Y.return=ee,ee=Y}return M(ee);case K:return Le=te._init,dt(ee,Y,Le(te._payload),_e)}if($e(te))return xe(ee,Y,te,_e);if(L(te))return Ee(ee,Y,te,_e);Fr(ee,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,Y!==null&&Y.tag===6?(r(ee,Y.sibling),Y=x(Y,te),Y.return=ee,ee=Y):(r(ee,Y),Y=fl(te,ee.mode,_e),Y.return=ee,ee=Y),M(ee)):r(ee,Y)}return dt}var sn=Sc(!0),Cc=Sc(!1),Wr=ss(null),Vr=null,nn=null,xa=null;function Da(){xa=nn=Vr=null}function Ea(i){var s=Wr.current;Qe(Wr),i._currentValue=s}function ka(i,s,r){for(;i!==null;){var f=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),i===r)break;i=i.return}}function rn(i,s){Vr=i,xa=nn=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(zt=!0),i.firstContext=null)}function Zt(i){var s=i._currentValue;if(xa!==i)if(i={context:i,memoizedValue:s,next:null},nn===null){if(Vr===null)throw Error(t(308));nn=i,Vr.dependencies={lanes:0,firstContext:i}}else nn=nn.next=i;return s}var Ps=null;function Pa(i){Ps===null?Ps=[i]:Ps.push(i)}function xc(i,s,r,f){var x=s.interleaved;return x===null?(r.next=r,Pa(s)):(r.next=x.next,x.next=r),s.interleaved=r,Bi(i,f)}function Bi(i,s){i.lanes|=s;var r=i.alternate;for(r!==null&&(r.lanes|=s),r=i,i=i.return;i!==null;)i.childLanes|=s,r=i.alternate,r!==null&&(r.childLanes|=s),r=i,i=i.return;return r.tag===3?r.stateNode:null}var os=!1;function Ta(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dc(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Hi(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function as(i,s,r){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(He&2)!==0){var x=f.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),f.pending=s,Bi(i,r)}return x=f.interleaved,x===null?(s.next=s,Pa(f)):(s.next=x.next,x.next=s),f.interleaved=s,Bi(i,r)}function jr(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194240)!==0)){var f=s.lanes;f&=i.pendingLanes,r|=f,s.lanes=r,Vo(i,r)}}function Ec(i,s){var r=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,r===f)){var x=null,k=null;if(r=r.firstBaseUpdate,r!==null){do{var M={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};k===null?x=k=M:k=k.next=M,r=r.next}while(r!==null);k===null?x=k=s:k=k.next=s}else x=k=s;r={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:f.shared,effects:f.effects},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}function $r(i,s,r,f){var x=i.updateQueue;os=!1;var k=x.firstBaseUpdate,M=x.lastBaseUpdate,j=x.shared.pending;if(j!==null){x.shared.pending=null;var U=j,re=U.next;U.next=null,M===null?k=re:M.next=re,M=U;var de=i.alternate;de!==null&&(de=de.updateQueue,j=de.lastBaseUpdate,j!==M&&(j===null?de.firstBaseUpdate=re:j.next=re,de.lastBaseUpdate=U))}if(k!==null){var pe=x.baseState;M=0,de=re=U=null,j=k;do{var ce=j.lane,ye=j.eventTime;if((f&ce)===ce){de!==null&&(de=de.next={eventTime:ye,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var xe=i,Ee=j;switch(ce=s,ye=r,Ee.tag){case 1:if(xe=Ee.payload,typeof xe=="function"){pe=xe.call(ye,pe,ce);break e}pe=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ee.payload,ce=typeof xe=="function"?xe.call(ye,pe,ce):xe,ce==null)break e;pe=B({},pe,ce);break e;case 2:os=!0}}j.callback!==null&&j.lane!==0&&(i.flags|=64,ce=x.effects,ce===null?x.effects=[j]:ce.push(j))}else ye={eventTime:ye,lane:ce,tag:j.tag,payload:j.payload,callback:j.callback,next:null},de===null?(re=de=ye,U=pe):de=de.next=ye,M|=ce;if(j=j.next,j===null){if(j=x.shared.pending,j===null)break;ce=j,j=ce.next,ce.next=null,x.lastBaseUpdate=ce,x.shared.pending=null}}while(!0);if(de===null&&(U=pe),x.baseState=U,x.firstBaseUpdate=re,x.lastBaseUpdate=de,s=x.shared.interleaved,s!==null){x=s;do M|=x.lane,x=x.next;while(x!==s)}else k===null&&(x.shared.lanes=0);Is|=M,i.lanes=M,i.memoizedState=pe}}function kc(i,s,r){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var f=i[s],x=f.callback;if(x!==null){if(f.callback=null,f=r,typeof x!="function")throw Error(t(191,x));x.call(f)}}}var Fn={},Di=ss(Fn),Wn=ss(Fn),Vn=ss(Fn);function Ts(i){if(i===Fn)throw Error(t(174));return i}function Aa(i,s){switch(qe(Vn,s),qe(Wn,i),qe(Di,Fn),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ut(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=ut(s,i)}Qe(Di),qe(Di,s)}function on(){Qe(Di),Qe(Wn),Qe(Vn)}function Pc(i){Ts(Vn.current);var s=Ts(Di.current),r=ut(s,i.type);s!==r&&(qe(Wn,i),qe(Di,r))}function Ia(i){Wn.current===i&&(Qe(Di),Qe(Wn))}var nt=ss(0);function Ur(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var La=[];function Ra(){for(var i=0;i<La.length;i++)La[i]._workInProgressVersionPrimary=null;La.length=0}var Kr=D.ReactCurrentDispatcher,Ma=D.ReactCurrentBatchConfig,As=0,rt=null,vt=null,wt=null,Yr=!1,jn=!1,$n=0,om=0;function kt(){throw Error(t(321))}function Oa(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!ci(i[r],s[r]))return!1;return!0}function Ga(i,s,r,f,x,k){if(As=k,rt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Kr.current=i===null||i.memoizedState===null?cm:dm,i=r(f,x),jn){k=0;do{if(jn=!1,$n=0,25<=k)throw Error(t(301));k+=1,wt=vt=null,s.updateQueue=null,Kr.current=um,i=r(f,x)}while(jn)}if(Kr.current=Jr,s=vt!==null&&vt.next!==null,As=0,wt=vt=rt=null,Yr=!1,s)throw Error(t(300));return i}function Na(){var i=$n!==0;return $n=0,i}function Ei(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?rt.memoizedState=wt=i:wt=wt.next=i,wt}function Qt(){if(vt===null){var i=rt.alternate;i=i!==null?i.memoizedState:null}else i=vt.next;var s=wt===null?rt.memoizedState:wt.next;if(s!==null)wt=s,vt=i;else{if(i===null)throw Error(t(310));vt=i,i={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},wt===null?rt.memoizedState=wt=i:wt=wt.next=i}return wt}function Un(i,s){return typeof s=="function"?s(i):s}function za(i){var s=Qt(),r=s.queue;if(r===null)throw Error(t(311));r.lastRenderedReducer=i;var f=vt,x=f.baseQueue,k=r.pending;if(k!==null){if(x!==null){var M=x.next;x.next=k.next,k.next=M}f.baseQueue=x=k,r.pending=null}if(x!==null){k=x.next,f=f.baseState;var j=M=null,U=null,re=k;do{var de=re.lane;if((As&de)===de)U!==null&&(U=U.next={lane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),f=re.hasEagerState?re.eagerState:i(f,re.action);else{var pe={lane:de,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null};U===null?(j=U=pe,M=f):U=U.next=pe,rt.lanes|=de,Is|=de}re=re.next}while(re!==null&&re!==k);U===null?M=f:U.next=j,ci(f,s.memoizedState)||(zt=!0),s.memoizedState=f,s.baseState=M,s.baseQueue=U,r.lastRenderedState=f}if(i=r.interleaved,i!==null){x=i;do k=x.lane,rt.lanes|=k,Is|=k,x=x.next;while(x!==i)}else x===null&&(r.lanes=0);return[s.memoizedState,r.dispatch]}function Ba(i){var s=Qt(),r=s.queue;if(r===null)throw Error(t(311));r.lastRenderedReducer=i;var f=r.dispatch,x=r.pending,k=s.memoizedState;if(x!==null){r.pending=null;var M=x=x.next;do k=i(k,M.action),M=M.next;while(M!==x);ci(k,s.memoizedState)||(zt=!0),s.memoizedState=k,s.baseQueue===null&&(s.baseState=k),r.lastRenderedState=k}return[k,f]}function Tc(){}function Ac(i,s){var r=rt,f=Qt(),x=s(),k=!ci(f.memoizedState,x);if(k&&(f.memoizedState=x,zt=!0),f=f.queue,Ha(Rc.bind(null,r,f,i),[i]),f.getSnapshot!==s||k||wt!==null&&wt.memoizedState.tag&1){if(r.flags|=2048,Kn(9,Lc.bind(null,r,f,x,s),void 0,null),bt===null)throw Error(t(349));(As&30)!==0||Ic(r,s,x)}return x}function Ic(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=rt.updateQueue,s===null?(s={lastEffect:null,stores:null},rt.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function Lc(i,s,r,f){s.value=r,s.getSnapshot=f,Mc(s)&&Oc(i)}function Rc(i,s,r){return r(function(){Mc(s)&&Oc(i)})}function Mc(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!ci(i,r)}catch{return!0}}function Oc(i){var s=Bi(i,1);s!==null&&mi(s,i,1,-1)}function Gc(i){var s=Ei();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:i},s.queue=i,i=i.dispatch=hm.bind(null,rt,i),[s.memoizedState,i]}function Kn(i,s,r,f){return i={tag:i,create:s,destroy:r,deps:f,next:null},s=rt.updateQueue,s===null?(s={lastEffect:null,stores:null},rt.updateQueue=s,s.lastEffect=i.next=i):(r=s.lastEffect,r===null?s.lastEffect=i.next=i:(f=r.next,r.next=i,i.next=f,s.lastEffect=i)),i}function Nc(){return Qt().memoizedState}function Xr(i,s,r,f){var x=Ei();rt.flags|=i,x.memoizedState=Kn(1|s,r,void 0,f===void 0?null:f)}function qr(i,s,r,f){var x=Qt();f=f===void 0?null:f;var k=void 0;if(vt!==null){var M=vt.memoizedState;if(k=M.destroy,f!==null&&Oa(f,M.deps)){x.memoizedState=Kn(s,r,k,f);return}}rt.flags|=i,x.memoizedState=Kn(1|s,r,k,f)}function zc(i,s){return Xr(8390656,8,i,s)}function Ha(i,s){return qr(2048,8,i,s)}function Bc(i,s){return qr(4,2,i,s)}function Hc(i,s){return qr(4,4,i,s)}function Fc(i,s){if(typeof s=="function")return i=i(),s(i),function(){s(null)};if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Wc(i,s,r){return r=r!=null?r.concat([i]):null,qr(4,4,Fc.bind(null,s,i),r)}function Fa(){}function Vc(i,s){var r=Qt();s=s===void 0?null:s;var f=r.memoizedState;return f!==null&&s!==null&&Oa(s,f[1])?f[0]:(r.memoizedState=[i,s],i)}function jc(i,s){var r=Qt();s=s===void 0?null:s;var f=r.memoizedState;return f!==null&&s!==null&&Oa(s,f[1])?f[0]:(i=i(),r.memoizedState=[i,s],i)}function $c(i,s,r){return(As&21)===0?(i.baseState&&(i.baseState=!1,zt=!0),i.memoizedState=r):(ci(r,s)||(r=yh(),rt.lanes|=r,Is|=r,i.baseState=!0),s)}function am(i,s){var r=Ue;Ue=r!==0&&4>r?r:4,i(!0);var f=Ma.transition;Ma.transition={};try{i(!1),s()}finally{Ue=r,Ma.transition=f}}function Uc(){return Qt().memoizedState}function lm(i,s,r){var f=ds(i);if(r={lane:f,action:r,hasEagerState:!1,eagerState:null,next:null},Kc(i))Yc(s,r);else if(r=xc(i,s,r,f),r!==null){var x=Lt();mi(r,i,f,x),Xc(r,s,f)}}function hm(i,s,r){var f=ds(i),x={lane:f,action:r,hasEagerState:!1,eagerState:null,next:null};if(Kc(i))Yc(s,x);else{var k=i.alternate;if(i.lanes===0&&(k===null||k.lanes===0)&&(k=s.lastRenderedReducer,k!==null))try{var M=s.lastRenderedState,j=k(M,r);if(x.hasEagerState=!0,x.eagerState=j,ci(j,M)){var U=s.interleaved;U===null?(x.next=x,Pa(s)):(x.next=U.next,U.next=x),s.interleaved=x;return}}catch{}finally{}r=xc(i,s,x,f),r!==null&&(x=Lt(),mi(r,i,f,x),Xc(r,s,f))}}function Kc(i){var s=i.alternate;return i===rt||s!==null&&s===rt}function Yc(i,s){jn=Yr=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Xc(i,s,r){if((r&4194240)!==0){var f=s.lanes;f&=i.pendingLanes,r|=f,s.lanes=r,Vo(i,r)}}var Jr={readContext:Zt,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useInsertionEffect:kt,useLayoutEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useMutableSource:kt,useSyncExternalStore:kt,useId:kt,unstable_isNewReconciler:!1},cm={readContext:Zt,useCallback:function(i,s){return Ei().memoizedState=[i,s===void 0?null:s],i},useContext:Zt,useEffect:zc,useImperativeHandle:function(i,s,r){return r=r!=null?r.concat([i]):null,Xr(4194308,4,Fc.bind(null,s,i),r)},useLayoutEffect:function(i,s){return Xr(4194308,4,i,s)},useInsertionEffect:function(i,s){return Xr(4,2,i,s)},useMemo:function(i,s){var r=Ei();return s=s===void 0?null:s,i=i(),r.memoizedState=[i,s],i},useReducer:function(i,s,r){var f=Ei();return s=r!==void 0?r(s):s,f.memoizedState=f.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},f.queue=i,i=i.dispatch=lm.bind(null,rt,i),[f.memoizedState,i]},useRef:function(i){var s=Ei();return i={current:i},s.memoizedState=i},useState:Gc,useDebugValue:Fa,useDeferredValue:function(i){return Ei().memoizedState=i},useTransition:function(){var i=Gc(!1),s=i[0];return i=am.bind(null,i[1]),Ei().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,r){var f=rt,x=Ei();if(tt){if(r===void 0)throw Error(t(407));r=r()}else{if(r=s(),bt===null)throw Error(t(349));(As&30)!==0||Ic(f,s,r)}x.memoizedState=r;var k={value:r,getSnapshot:s};return x.queue=k,zc(Rc.bind(null,f,k,i),[i]),f.flags|=2048,Kn(9,Lc.bind(null,f,k,r,s),void 0,null),r},useId:function(){var i=Ei(),s=bt.identifierPrefix;if(tt){var r=zi,f=Ni;r=(f&~(1<<32-hi(f)-1)).toString(32)+r,s=":"+s+"R"+r,r=$n++,0<r&&(s+="H"+r.toString(32)),s+=":"}else r=om++,s=":"+s+"r"+r.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},dm={readContext:Zt,useCallback:Vc,useContext:Zt,useEffect:Ha,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:jc,useReducer:za,useRef:Nc,useState:function(){return za(Un)},useDebugValue:Fa,useDeferredValue:function(i){var s=Qt();return $c(s,vt.memoizedState,i)},useTransition:function(){var i=za(Un)[0],s=Qt().memoizedState;return[i,s]},useMutableSource:Tc,useSyncExternalStore:Ac,useId:Uc,unstable_isNewReconciler:!1},um={readContext:Zt,useCallback:Vc,useContext:Zt,useEffect:Ha,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:jc,useReducer:Ba,useRef:Nc,useState:function(){return Ba(Un)},useDebugValue:Fa,useDeferredValue:function(i){var s=Qt();return vt===null?s.memoizedState=i:$c(s,vt.memoizedState,i)},useTransition:function(){var i=Ba(Un)[0],s=Qt().memoizedState;return[i,s]},useMutableSource:Tc,useSyncExternalStore:Ac,useId:Uc,unstable_isNewReconciler:!1};function ui(i,s){if(i&&i.defaultProps){s=B({},s),i=i.defaultProps;for(var r in i)s[r]===void 0&&(s[r]=i[r]);return s}return s}function Wa(i,s,r,f){s=i.memoizedState,r=r(f,s),r=r==null?s:B({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var Zr={isMounted:function(i){return(i=i._reactInternals)?ne(i)===i:!1},enqueueSetState:function(i,s,r){i=i._reactInternals;var f=Lt(),x=ds(i),k=Hi(f,x);k.payload=s,r!=null&&(k.callback=r),s=as(i,k,x),s!==null&&(mi(s,i,x,f),jr(s,i,x))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var f=Lt(),x=ds(i),k=Hi(f,x);k.tag=1,k.payload=s,r!=null&&(k.callback=r),s=as(i,k,x),s!==null&&(mi(s,i,x,f),jr(s,i,x))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=Lt(),f=ds(i),x=Hi(r,f);x.tag=2,s!=null&&(x.callback=s),s=as(i,x,f),s!==null&&(mi(s,i,f,r),jr(s,i,f))}};function qc(i,s,r,f,x,k,M){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,k,M):s.prototype&&s.prototype.isPureReactComponent?!Rn(r,f)||!Rn(x,k):!0}function Jc(i,s,r){var f=!1,x=ns,k=s.contextType;return typeof k=="object"&&k!==null?k=Zt(k):(x=Nt(s)?Ds:Et.current,f=s.contextTypes,k=(f=f!=null)?Zs(i,x):ns),s=new s(r,k),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Zr,i.stateNode=s,s._reactInternals=i,f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=x,i.__reactInternalMemoizedMaskedChildContext=k),s}function Zc(i,s,r,f){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,f),s.state!==i&&Zr.enqueueReplaceState(s,s.state,null)}function Va(i,s,r,f){var x=i.stateNode;x.props=r,x.state=i.memoizedState,x.refs={},Ta(i);var k=s.contextType;typeof k=="object"&&k!==null?x.context=Zt(k):(k=Nt(s)?Ds:Et.current,x.context=Zs(i,k)),x.state=i.memoizedState,k=s.getDerivedStateFromProps,typeof k=="function"&&(Wa(i,s,k,r),x.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(s=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),s!==x.state&&Zr.enqueueReplaceState(x,x.state,null),$r(i,r,x,f),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308)}function an(i,s){try{var r="",f=s;do r+=ae(f),f=f.return;while(f);var x=r}catch(k){x=`
37
+ `+x[M].replace(" at new "," at ");return i.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",i.displayName)),U}while(1<=M&&0<=j);break}}}finally{X=!1,Error.prepareStackTrace=r}return(i=i?i.displayName||i.name:"")?G(i):""}function ae(i){switch(i.tag){case 5:return G(i.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return i=oe(i.type,!1),i;case 11:return i=oe(i.type.render,!1),i;case 1:return i=oe(i.type,!0),i;default:return""}}function me(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case A:return"Fragment";case T:return"Portal";case I:return"Profiler";case E:return"StrictMode";case F:return"Suspense";case q:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case N:return(i.displayName||"Context")+".Consumer";case B:return(i._context.displayName||"Context")+".Provider";case W:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case V:return s=i.displayName||null,s!==null?s:me(i.type)||"Memo";case K:s=i._payload,i=i._init;try{return me(i(s))}catch{}}return null}function $(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(s);case 8:return s===E?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function O(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function le(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function se(i){var s=le(i)?"checked":"value",r=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),f=""+i[s];if(!i.hasOwnProperty(s)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var x=r.get,k=r.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return x.call(this)},set:function(M){f=""+M,k.call(this,M)}}),Object.defineProperty(i,s,{enumerable:r.enumerable}),{getValue:function(){return f},setValue:function(M){f=""+M},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function ge(i){i._valueTracker||(i._valueTracker=se(i))}function fe(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var r=s.getValue(),f="";return i&&(f=le(i)?i.checked?"true":"false":i.value),i=f,i!==r?(s.setValue(i),!0):!1}function Me(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function We(i,s){var r=s.checked;return H({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??i._wrapperState.initialChecked})}function je(i,s){var r=s.defaultValue==null?"":s.defaultValue,f=s.checked!=null?s.checked:s.defaultChecked;r=O(s.value!=null?s.value:r),i._wrapperState={initialChecked:f,initialValue:r,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function ot(i,s){s=s.checked,s!=null&&v(i,"checked",s,!1)}function Ae(i,s){ot(i,s);var r=O(s.value),f=s.type;if(r!=null)f==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+r):i.value!==""+r&&(i.value=""+r);else if(f==="submit"||f==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?Ie(i,s.type,r):s.hasOwnProperty("defaultValue")&&Ie(i,s.type,O(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function ve(i,s,r){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var f=s.type;if(!(f!=="submit"&&f!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,r||s===i.value||(i.value=s),i.defaultValue=s}r=i.name,r!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,r!==""&&(i.name=r)}function Ie(i,s,r){(s!=="number"||Me(i.ownerDocument)!==i)&&(r==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+r&&(i.defaultValue=""+r))}var $e=Array.isArray;function st(i,s,r,f){if(i=i.options,s){s={};for(var x=0;x<r.length;x++)s["$"+r[x]]=!0;for(r=0;r<i.length;r++)x=s.hasOwnProperty("$"+i[r].value),i[r].selected!==x&&(i[r].selected=x),x&&f&&(i[r].defaultSelected=!0)}else{for(r=""+O(r),s=null,x=0;x<i.length;x++){if(i[x].value===r){i[x].selected=!0,f&&(i[x].defaultSelected=!0);return}s!==null||i[x].disabled||(s=i[x])}s!==null&&(s.selected=!0)}}function Dt(i,s){if(s.dangerouslySetInnerHTML!=null)throw Error(t(91));return H({},s,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Ne(i,s){var r=s.value;if(r==null){if(r=s.children,s=s.defaultValue,r!=null){if(s!=null)throw Error(t(92));if($e(r)){if(1<r.length)throw Error(t(93));r=r[0]}s=r}s==null&&(s=""),r=s}i._wrapperState={initialValue:O(r)}}function Si(i,s){var r=O(s.value),f=O(s.defaultValue);r!=null&&(r=""+r,r!==i.value&&(i.value=r),s.defaultValue==null&&i.defaultValue!==r&&(i.defaultValue=r)),f!=null&&(i.defaultValue=""+f)}function At(i){var s=i.textContent;s===i._wrapperState.initialValue&&s!==""&&s!==null&&(i.value=s)}function mt(i){switch(i){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 ut(i,s){return i==null||i==="http://www.w3.org/1999/xhtml"?mt(s):i==="http://www.w3.org/2000/svg"&&s==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Ke,li=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(s,r,f,x){MSApp.execUnsafeLocalFunction(function(){return i(s,r,f,x)})}:i})(function(i,s){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=s;else{for(Ke=Ke||document.createElement("div"),Ke.innerHTML="<svg>"+s.valueOf().toString()+"</svg>",s=Ke.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function gt(i,s){if(s){var r=i.firstChild;if(r&&r===i.lastChild&&r.nodeType===3){r.nodeValue=s;return}}i.textContent=s}var Rt={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},Ye=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(i){Ye.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),Rt[s]=Rt[i]})});function Bs(i,s,r){return s==null||typeof s=="boolean"||s===""?"":r||typeof s!="number"||s===0||Rt.hasOwnProperty(i)&&Rt[i]?(""+s).trim():s+"px"}function dr(i,s){i=i.style;for(var r in s)if(s.hasOwnProperty(r)){var f=r.indexOf("--")===0,x=Bs(r,s[r],f);r==="float"&&(r="cssFloat"),f?i.setProperty(r,x):i[r]=x}}var gn=H({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 hi(i,s){if(s){if(gn[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(t(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(t(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(t(61))}if(s.style!=null&&typeof s.style!="object")throw Error(t(62))}}function Hs(i,s){if(i.indexOf("-")===-1)return typeof s.is=="string";switch(i){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 ws=null;function bs(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Fs=null,Mt=null,Vt=null;function vn(i){if(i=Bn(i)){if(typeof Fs!="function")throw Error(t(280));var s=i.stateNode;s&&(s=Mr(s),Fs(i.stateNode,i.type,s))}}function ys(i){Mt?Vt?Vt.push(i):Vt=[i]:Mt=i}function _n(){if(Mt){var i=Mt,s=Vt;if(Vt=Mt=null,vn(i),s)for(i=0;i<s.length;i++)vn(s[i])}}function Yi(i,s){return i(s)}function Ws(){}var wn=!1;function ur(i,s,r){if(wn)return i(s,r);wn=!0;try{return Yi(i,s,r)}finally{wn=!1,(Mt!==null||Vt!==null)&&(Ws(),_n())}}function Ri(i,s){var r=i.stateNode;if(r===null)return null;var f=Mr(r);if(f===null)return null;r=f[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(r&&typeof r!="function")throw Error(t(231,s,typeof r));return r}var Mi=!1;if(a)try{var Xt={};Object.defineProperty(Xt,"passive",{get:function(){Mi=!0}}),window.addEventListener("test",Xt,Xt),window.removeEventListener("test",Xt,Xt)}catch{Mi=!1}function bn(i,s,r,f,x,k,M,j,U){var re=Array.prototype.slice.call(arguments,3);try{s.apply(r,re)}catch(de){this.onError(de)}}var Xi=!1,Ss=null,Cs=!1,xs=null,zo={onError:function(i){Xi=!0,Ss=i}};function Bo(i,s,r,f,x,k,M,j,U){Xi=!1,Ss=null,bn.apply(zo,arguments)}function pr(i,s,r,f,x,k,M,j,U){if(Bo.apply(this,arguments),Xi){if(Xi){var re=Ss;Xi=!1,Ss=null}else throw Error(t(198));Cs||(Cs=!0,xs=re)}}function ne(i){var s=i,r=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(r=s.return),i=s.return;while(i)}return s.tag===3?r:null}function he(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function ue(i){if(ne(i)!==i)throw Error(t(188))}function De(i){var s=i.alternate;if(!s){if(s=ne(i),s===null)throw Error(t(188));return s!==i?null:i}for(var r=i,f=s;;){var x=r.return;if(x===null)break;var k=x.alternate;if(k===null){if(f=x.return,f!==null){r=f;continue}break}if(x.child===k.child){for(k=x.child;k;){if(k===r)return ue(x),i;if(k===f)return ue(x),s;k=k.sibling}throw Error(t(188))}if(r.return!==f.return)r=x,f=k;else{for(var M=!1,j=x.child;j;){if(j===r){M=!0,r=x,f=k;break}if(j===f){M=!0,f=x,r=k;break}j=j.sibling}if(!M){for(j=k.child;j;){if(j===r){M=!0,r=k,f=x;break}if(j===f){M=!0,f=k,r=x;break}j=j.sibling}if(!M)throw Error(t(189))}}if(r.alternate!==f)throw Error(t(190))}if(r.tag!==3)throw Error(t(188));return r.stateNode.current===r?i:s}function Oe(i){return i=De(i),i!==null?Be(i):null}function Be(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var s=Be(i);if(s!==null)return s;i=i.sibling}return null}var Xe=e.unstable_scheduleCallback,jt=e.unstable_cancelCallback,Ot=e.unstable_shouldYield,qp=e.unstable_requestPaint,ct=e.unstable_now,Jp=e.unstable_getCurrentPriorityLevel,Ho=e.unstable_ImmediatePriority,wh=e.unstable_UserBlockingPriority,fr=e.unstable_NormalPriority,Zp=e.unstable_LowPriority,bh=e.unstable_IdlePriority,mr=null,Ci=null;function Qp(i){if(Ci&&typeof Ci.onCommitFiberRoot=="function")try{Ci.onCommitFiberRoot(mr,i,void 0,(i.current.flags&128)===128)}catch{}}var ci=Math.clz32?Math.clz32:sf,ef=Math.log,tf=Math.LN2;function sf(i){return i>>>=0,i===0?32:31-(ef(i)/tf|0)|0}var gr=64,vr=4194304;function yn(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function _r(i,s){var r=i.pendingLanes;if(r===0)return 0;var f=0,x=i.suspendedLanes,k=i.pingedLanes,M=r&268435455;if(M!==0){var j=M&~x;j!==0?f=yn(j):(k&=M,k!==0&&(f=yn(k)))}else M=r&~x,M!==0?f=yn(M):k!==0&&(f=yn(k));if(f===0)return 0;if(s!==0&&s!==f&&(s&x)===0&&(x=f&-f,k=s&-s,x>=k||x===16&&(k&4194240)!==0))return s;if((f&4)!==0&&(f|=r&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=f;0<s;)r=31-ci(s),x=1<<r,f|=i[r],s&=~x;return f}function nf(i,s){switch(i){case 1:case 2:case 4:return s+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 s+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 rf(i,s){for(var r=i.suspendedLanes,f=i.pingedLanes,x=i.expirationTimes,k=i.pendingLanes;0<k;){var M=31-ci(k),j=1<<M,U=x[M];U===-1?((j&r)===0||(j&f)!==0)&&(x[M]=nf(j,s)):U<=s&&(i.expiredLanes|=j),k&=~j}}function Fo(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function yh(){var i=gr;return gr<<=1,(gr&4194240)===0&&(gr=64),i}function Wo(i){for(var s=[],r=0;31>r;r++)s.push(i);return s}function Sn(i,s,r){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-ci(s),i[s]=r}function of(i,s){var r=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var f=i.eventTimes;for(i=i.expirationTimes;0<r;){var x=31-ci(r),k=1<<x;s[x]=0,f[x]=-1,i[x]=-1,r&=~k}}function Vo(i,s){var r=i.entangledLanes|=s;for(i=i.entanglements;r;){var f=31-ci(r),x=1<<f;x&s|i[f]&s&&(i[f]|=s),r&=~x}}var Ue=0;function Sh(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var Ch,jo,xh,Dh,Eh,$o=!1,wr=[],qi=null,Ji=null,Zi=null,Cn=new Map,xn=new Map,Qi=[],af="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 kh(i,s){switch(i){case"focusin":case"focusout":qi=null;break;case"dragenter":case"dragleave":Ji=null;break;case"mouseover":case"mouseout":Zi=null;break;case"pointerover":case"pointerout":Cn.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":xn.delete(s.pointerId)}}function Dn(i,s,r,f,x,k){return i===null||i.nativeEvent!==k?(i={blockedOn:s,domEventName:r,eventSystemFlags:f,nativeEvent:k,targetContainers:[x]},s!==null&&(s=Bn(s),s!==null&&jo(s)),i):(i.eventSystemFlags|=f,s=i.targetContainers,x!==null&&s.indexOf(x)===-1&&s.push(x),i)}function lf(i,s,r,f,x){switch(s){case"focusin":return qi=Dn(qi,i,s,r,f,x),!0;case"dragenter":return Ji=Dn(Ji,i,s,r,f,x),!0;case"mouseover":return Zi=Dn(Zi,i,s,r,f,x),!0;case"pointerover":var k=x.pointerId;return Cn.set(k,Dn(Cn.get(k)||null,i,s,r,f,x)),!0;case"gotpointercapture":return k=x.pointerId,xn.set(k,Dn(xn.get(k)||null,i,s,r,f,x)),!0}return!1}function Ph(i){var s=Ds(i.target);if(s!==null){var r=ne(s);if(r!==null){if(s=r.tag,s===13){if(s=he(r),s!==null){i.blockedOn=s,Eh(i.priority,function(){xh(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){i.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}i.blockedOn=null}function br(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var r=Ko(i.domEventName,i.eventSystemFlags,s[0],i.nativeEvent);if(r===null){r=i.nativeEvent;var f=new r.constructor(r.type,r);ws=f,r.target.dispatchEvent(f),ws=null}else return s=Bn(r),s!==null&&jo(s),i.blockedOn=r,!1;s.shift()}return!0}function Th(i,s,r){br(i)&&r.delete(s)}function hf(){$o=!1,qi!==null&&br(qi)&&(qi=null),Ji!==null&&br(Ji)&&(Ji=null),Zi!==null&&br(Zi)&&(Zi=null),Cn.forEach(Th),xn.forEach(Th)}function En(i,s){i.blockedOn===s&&(i.blockedOn=null,$o||($o=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hf)))}function kn(i){function s(x){return En(x,i)}if(0<wr.length){En(wr[0],i);for(var r=1;r<wr.length;r++){var f=wr[r];f.blockedOn===i&&(f.blockedOn=null)}}for(qi!==null&&En(qi,i),Ji!==null&&En(Ji,i),Zi!==null&&En(Zi,i),Cn.forEach(s),xn.forEach(s),r=0;r<Qi.length;r++)f=Qi[r],f.blockedOn===i&&(f.blockedOn=null);for(;0<Qi.length&&(r=Qi[0],r.blockedOn===null);)Ph(r),r.blockedOn===null&&Qi.shift()}var Vs=D.ReactCurrentBatchConfig,yr=!0;function cf(i,s,r,f){var x=Ue,k=Vs.transition;Vs.transition=null;try{Ue=1,Uo(i,s,r,f)}finally{Ue=x,Vs.transition=k}}function df(i,s,r,f){var x=Ue,k=Vs.transition;Vs.transition=null;try{Ue=4,Uo(i,s,r,f)}finally{Ue=x,Vs.transition=k}}function Uo(i,s,r,f){if(yr){var x=Ko(i,s,r,f);if(x===null)ca(i,s,f,Sr,r),kh(i,f);else if(lf(x,i,s,r,f))f.stopPropagation();else if(kh(i,f),s&4&&-1<af.indexOf(i)){for(;x!==null;){var k=Bn(x);if(k!==null&&Ch(k),k=Ko(i,s,r,f),k===null&&ca(i,s,f,Sr,r),k===x)break;x=k}x!==null&&f.stopPropagation()}else ca(i,s,f,null,r)}}var Sr=null;function Ko(i,s,r,f){if(Sr=null,i=bs(f),i=Ds(i),i!==null)if(s=ne(i),s===null)i=null;else if(r=s.tag,r===13){if(i=he(s),i!==null)return i;i=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null);return Sr=i,null}function Ah(i){switch(i){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(Jp()){case Ho:return 1;case wh:return 4;case fr:case Zp:return 16;case bh:return 536870912;default:return 16}default:return 16}}var es=null,Yo=null,Cr=null;function Ih(){if(Cr)return Cr;var i,s=Yo,r=s.length,f,x="value"in es?es.value:es.textContent,k=x.length;for(i=0;i<r&&s[i]===x[i];i++);var M=r-i;for(f=1;f<=M&&s[r-f]===x[k-f];f++);return Cr=x.slice(i,1<f?1-f:void 0)}function xr(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Dr(){return!0}function Lh(){return!1}function $t(i){function s(r,f,x,k,M){this._reactName=r,this._targetInst=x,this.type=f,this.nativeEvent=k,this.target=M,this.currentTarget=null;for(var j in i)i.hasOwnProperty(j)&&(r=i[j],this[j]=r?r(k):k[j]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Dr:Lh,this.isPropagationStopped=Lh,this}return H(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Dr)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Dr)},persist:function(){},isPersistent:Dr}),s}var js={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xo=$t(js),Pn=H({},js,{view:0,detail:0}),uf=$t(Pn),qo,Jo,Tn,Er=H({},Pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qo,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Tn&&(Tn&&i.type==="mousemove"?(qo=i.screenX-Tn.screenX,Jo=i.screenY-Tn.screenY):Jo=qo=0,Tn=i),qo)},movementY:function(i){return"movementY"in i?i.movementY:Jo}}),Rh=$t(Er),pf=H({},Er,{dataTransfer:0}),ff=$t(pf),mf=H({},Pn,{relatedTarget:0}),Zo=$t(mf),gf=H({},js,{animationName:0,elapsedTime:0,pseudoElement:0}),vf=$t(gf),_f=H({},js,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),wf=$t(_f),bf=H({},js,{data:0}),Mh=$t(bf),yf={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Sf={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"},Cf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xf(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=Cf[i])?!!s[i]:!1}function Qo(){return xf}var Df=H({},Pn,{key:function(i){if(i.key){var s=yf[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=xr(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?Sf[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qo,charCode:function(i){return i.type==="keypress"?xr(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?xr(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),Ef=$t(Df),kf=H({},Er,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Oh=$t(kf),Pf=H({},Pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qo}),Tf=$t(Pf),Af=H({},js,{propertyName:0,elapsedTime:0,pseudoElement:0}),If=$t(Af),Lf=H({},Er,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),Rf=$t(Lf),Mf=[9,13,27,32],ea=a&&"CompositionEvent"in window,An=null;a&&"documentMode"in document&&(An=document.documentMode);var Of=a&&"TextEvent"in window&&!An,Gh=a&&(!ea||An&&8<An&&11>=An),Nh=" ",zh=!1;function Bh(i,s){switch(i){case"keyup":return Mf.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hh(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var $s=!1;function Gf(i,s){switch(i){case"compositionend":return Hh(s);case"keypress":return s.which!==32?null:(zh=!0,Nh);case"textInput":return i=s.data,i===Nh&&zh?null:i;default:return null}}function Nf(i,s){if($s)return i==="compositionend"||!ea&&Bh(i,s)?(i=Ih(),Cr=Yo=es=null,$s=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Gh&&s.locale!=="ko"?null:s.data;default:return null}}var zf={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 Fh(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!zf[i.type]:s==="textarea"}function Wh(i,s,r,f){ys(f),s=Ir(s,"onChange"),0<s.length&&(r=new Xo("onChange","change",null,r,f),i.push({event:r,listeners:s}))}var In=null,Ln=null;function Bf(i){oc(i,0)}function kr(i){var s=qs(i);if(fe(s))return i}function Hf(i,s){if(i==="change")return s}var Vh=!1;if(a){var ta;if(a){var ia="oninput"in document;if(!ia){var jh=document.createElement("div");jh.setAttribute("oninput","return;"),ia=typeof jh.oninput=="function"}ta=ia}else ta=!1;Vh=ta&&(!document.documentMode||9<document.documentMode)}function $h(){In&&(In.detachEvent("onpropertychange",Uh),Ln=In=null)}function Uh(i){if(i.propertyName==="value"&&kr(Ln)){var s=[];Wh(s,Ln,i,bs(i)),ur(Bf,s)}}function Ff(i,s,r){i==="focusin"?($h(),In=s,Ln=r,In.attachEvent("onpropertychange",Uh)):i==="focusout"&&$h()}function Wf(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return kr(Ln)}function Vf(i,s){if(i==="click")return kr(s)}function jf(i,s){if(i==="input"||i==="change")return kr(s)}function $f(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var di=typeof Object.is=="function"?Object.is:$f;function Rn(i,s){if(di(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var r=Object.keys(i),f=Object.keys(s);if(r.length!==f.length)return!1;for(f=0;f<r.length;f++){var x=r[f];if(!l.call(s,x)||!di(i[x],s[x]))return!1}return!0}function Kh(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Yh(i,s){var r=Kh(i);i=0;for(var f;r;){if(r.nodeType===3){if(f=i+r.textContent.length,i<=s&&f>=s)return{node:r,offset:s-i};i=f}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Kh(r)}}function Xh(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Xh(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function qh(){for(var i=window,s=Me();s instanceof i.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)i=s.contentWindow;else break;s=Me(i.document)}return s}function sa(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}function Uf(i){var s=qh(),r=i.focusedElem,f=i.selectionRange;if(s!==r&&r&&r.ownerDocument&&Xh(r.ownerDocument.documentElement,r)){if(f!==null&&sa(r)){if(s=f.start,i=f.end,i===void 0&&(i=s),"selectionStart"in r)r.selectionStart=s,r.selectionEnd=Math.min(i,r.value.length);else if(i=(s=r.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var x=r.textContent.length,k=Math.min(f.start,x);f=f.end===void 0?k:Math.min(f.end,x),!i.extend&&k>f&&(x=f,f=k,k=x),x=Yh(r,k);var M=Yh(r,f);x&&M&&(i.rangeCount!==1||i.anchorNode!==x.node||i.anchorOffset!==x.offset||i.focusNode!==M.node||i.focusOffset!==M.offset)&&(s=s.createRange(),s.setStart(x.node,x.offset),i.removeAllRanges(),k>f?(i.addRange(s),i.extend(M.node,M.offset)):(s.setEnd(M.node,M.offset),i.addRange(s)))}}for(s=[],i=r;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<s.length;r++)i=s[r],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var Kf=a&&"documentMode"in document&&11>=document.documentMode,Us=null,na=null,Mn=null,ra=!1;function Jh(i,s,r){var f=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ra||Us==null||Us!==Me(f)||(f=Us,"selectionStart"in f&&sa(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Mn&&Rn(Mn,f)||(Mn=f,f=Ir(na,"onSelect"),0<f.length&&(s=new Xo("onSelect","select",null,s,r),i.push({event:s,listeners:f}),s.target=Us)))}function Pr(i,s){var r={};return r[i.toLowerCase()]=s.toLowerCase(),r["Webkit"+i]="webkit"+s,r["Moz"+i]="moz"+s,r}var Ks={animationend:Pr("Animation","AnimationEnd"),animationiteration:Pr("Animation","AnimationIteration"),animationstart:Pr("Animation","AnimationStart"),transitionend:Pr("Transition","TransitionEnd")},oa={},Zh={};a&&(Zh=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function Tr(i){if(oa[i])return oa[i];if(!Ks[i])return i;var s=Ks[i],r;for(r in s)if(s.hasOwnProperty(r)&&r in Zh)return oa[i]=s[r];return i}var Qh=Tr("animationend"),ec=Tr("animationiteration"),tc=Tr("animationstart"),ic=Tr("transitionend"),sc=new Map,nc="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 ts(i,s){sc.set(i,s),h(s,[i])}for(var aa=0;aa<nc.length;aa++){var la=nc[aa],Yf=la.toLowerCase(),Xf=la[0].toUpperCase()+la.slice(1);ts(Yf,"on"+Xf)}ts(Qh,"onAnimationEnd"),ts(ec,"onAnimationIteration"),ts(tc,"onAnimationStart"),ts("dblclick","onDoubleClick"),ts("focusin","onFocus"),ts("focusout","onBlur"),ts(ic,"onTransitionEnd"),w("onMouseEnter",["mouseout","mouseover"]),w("onMouseLeave",["mouseout","mouseover"]),w("onPointerEnter",["pointerout","pointerover"]),w("onPointerLeave",["pointerout","pointerover"]),h("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),h("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),h("onBeforeInput",["compositionend","keypress","textInput","paste"]),h("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var On="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(" "),qf=new Set("cancel close invalid load scroll toggle".split(" ").concat(On));function rc(i,s,r){var f=i.type||"unknown-event";i.currentTarget=r,pr(f,s,void 0,i),i.currentTarget=null}function oc(i,s){s=(s&4)!==0;for(var r=0;r<i.length;r++){var f=i[r],x=f.event;f=f.listeners;e:{var k=void 0;if(s)for(var M=f.length-1;0<=M;M--){var j=f[M],U=j.instance,re=j.currentTarget;if(j=j.listener,U!==k&&x.isPropagationStopped())break e;rc(x,j,re),k=U}else for(M=0;M<f.length;M++){if(j=f[M],U=j.instance,re=j.currentTarget,j=j.listener,U!==k&&x.isPropagationStopped())break e;rc(x,j,re),k=U}}}if(Cs)throw i=xs,Cs=!1,xs=null,i}function Ze(i,s){var r=s[ga];r===void 0&&(r=s[ga]=new Set);var f=i+"__bubble";r.has(f)||(ac(s,i,2,!1),r.add(f))}function ha(i,s,r){var f=0;s&&(f|=4),ac(r,i,f,s)}var Ar="_reactListening"+Math.random().toString(36).slice(2);function Gn(i){if(!i[Ar]){i[Ar]=!0,n.forEach(function(r){r!=="selectionchange"&&(qf.has(r)||ha(r,!1,i),ha(r,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Ar]||(s[Ar]=!0,ha("selectionchange",!1,s))}}function ac(i,s,r,f){switch(Ah(s)){case 1:var x=cf;break;case 4:x=df;break;default:x=Uo}r=x.bind(null,s,r,i),x=void 0,!Mi||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(x=!0),f?x!==void 0?i.addEventListener(s,r,{capture:!0,passive:x}):i.addEventListener(s,r,!0):x!==void 0?i.addEventListener(s,r,{passive:x}):i.addEventListener(s,r,!1)}function ca(i,s,r,f,x){var k=f;if((s&1)===0&&(s&2)===0&&f!==null)e:for(;;){if(f===null)return;var M=f.tag;if(M===3||M===4){var j=f.stateNode.containerInfo;if(j===x||j.nodeType===8&&j.parentNode===x)break;if(M===4)for(M=f.return;M!==null;){var U=M.tag;if((U===3||U===4)&&(U=M.stateNode.containerInfo,U===x||U.nodeType===8&&U.parentNode===x))return;M=M.return}for(;j!==null;){if(M=Ds(j),M===null)return;if(U=M.tag,U===5||U===6){f=k=M;continue e}j=j.parentNode}}f=f.return}ur(function(){var re=k,de=bs(r),pe=[];e:{var ce=sc.get(i);if(ce!==void 0){var ye=Xo,xe=i;switch(i){case"keypress":if(xr(r)===0)break e;case"keydown":case"keyup":ye=Ef;break;case"focusin":xe="focus",ye=Zo;break;case"focusout":xe="blur",ye=Zo;break;case"beforeblur":case"afterblur":ye=Zo;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ye=Rh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ye=ff;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ye=Tf;break;case Qh:case ec:case tc:ye=vf;break;case ic:ye=If;break;case"scroll":ye=uf;break;case"wheel":ye=Rf;break;case"copy":case"cut":case"paste":ye=wf;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ye=Oh}var Ee=(s&4)!==0,dt=!Ee&&i==="scroll",ee=Ee?ce!==null?ce+"Capture":null:ce;Ee=[];for(var Y=re,te;Y!==null;){te=Y;var _e=te.stateNode;if(te.tag===5&&_e!==null&&(te=_e,ee!==null&&(_e=Ri(Y,ee),_e!=null&&Ee.push(Nn(Y,_e,te)))),dt)break;Y=Y.return}0<Ee.length&&(ce=new ye(ce,xe,null,r,de),pe.push({event:ce,listeners:Ee}))}}if((s&7)===0){e:{if(ce=i==="mouseover"||i==="pointerover",ye=i==="mouseout"||i==="pointerout",ce&&r!==ws&&(xe=r.relatedTarget||r.fromElement)&&(Ds(xe)||xe[Oi]))break e;if((ye||ce)&&(ce=de.window===de?de:(ce=de.ownerDocument)?ce.defaultView||ce.parentWindow:window,ye?(xe=r.relatedTarget||r.toElement,ye=re,xe=xe?Ds(xe):null,xe!==null&&(dt=ne(xe),xe!==dt||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(ye=null,xe=re),ye!==xe)){if(Ee=Rh,_e="onMouseLeave",ee="onMouseEnter",Y="mouse",(i==="pointerout"||i==="pointerover")&&(Ee=Oh,_e="onPointerLeave",ee="onPointerEnter",Y="pointer"),dt=ye==null?ce:qs(ye),te=xe==null?ce:qs(xe),ce=new Ee(_e,Y+"leave",ye,r,de),ce.target=dt,ce.relatedTarget=te,_e=null,Ds(de)===re&&(Ee=new Ee(ee,Y+"enter",xe,r,de),Ee.target=te,Ee.relatedTarget=dt,_e=Ee),dt=_e,ye&&xe)t:{for(Ee=ye,ee=xe,Y=0,te=Ee;te;te=Ys(te))Y++;for(te=0,_e=ee;_e;_e=Ys(_e))te++;for(;0<Y-te;)Ee=Ys(Ee),Y--;for(;0<te-Y;)ee=Ys(ee),te--;for(;Y--;){if(Ee===ee||ee!==null&&Ee===ee.alternate)break t;Ee=Ys(Ee),ee=Ys(ee)}Ee=null}else Ee=null;ye!==null&&lc(pe,ce,ye,Ee,!1),xe!==null&&dt!==null&&lc(pe,dt,xe,Ee,!0)}}e:{if(ce=re?qs(re):window,ye=ce.nodeName&&ce.nodeName.toLowerCase(),ye==="select"||ye==="input"&&ce.type==="file")var ke=Hf;else if(Fh(ce))if(Vh)ke=jf;else{ke=Wf;var Le=Ff}else(ye=ce.nodeName)&&ye.toLowerCase()==="input"&&(ce.type==="checkbox"||ce.type==="radio")&&(ke=Vf);if(ke&&(ke=ke(i,re))){Wh(pe,ke,r,de);break e}Le&&Le(i,ce,re),i==="focusout"&&(Le=ce._wrapperState)&&Le.controlled&&ce.type==="number"&&Ie(ce,"number",ce.value)}switch(Le=re?qs(re):window,i){case"focusin":(Fh(Le)||Le.contentEditable==="true")&&(Us=Le,na=re,Mn=null);break;case"focusout":Mn=na=Us=null;break;case"mousedown":ra=!0;break;case"contextmenu":case"mouseup":case"dragend":ra=!1,Jh(pe,r,de);break;case"selectionchange":if(Kf)break;case"keydown":case"keyup":Jh(pe,r,de)}var Re;if(ea)e:{switch(i){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else $s?Bh(i,r)&&(Ge="onCompositionEnd"):i==="keydown"&&r.keyCode===229&&(Ge="onCompositionStart");Ge&&(Gh&&r.locale!=="ko"&&($s||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&$s&&(Re=Ih()):(es=de,Yo="value"in es?es.value:es.textContent,$s=!0)),Le=Ir(re,Ge),0<Le.length&&(Ge=new Mh(Ge,i,null,r,de),pe.push({event:Ge,listeners:Le}),Re?Ge.data=Re:(Re=Hh(r),Re!==null&&(Ge.data=Re)))),(Re=Of?Gf(i,r):Nf(i,r))&&(re=Ir(re,"onBeforeInput"),0<re.length&&(de=new Mh("onBeforeInput","beforeinput",null,r,de),pe.push({event:de,listeners:re}),de.data=Re))}oc(pe,s)})}function Nn(i,s,r){return{instance:i,listener:s,currentTarget:r}}function Ir(i,s){for(var r=s+"Capture",f=[];i!==null;){var x=i,k=x.stateNode;x.tag===5&&k!==null&&(x=k,k=Ri(i,r),k!=null&&f.unshift(Nn(i,k,x)),k=Ri(i,s),k!=null&&f.push(Nn(i,k,x))),i=i.return}return f}function Ys(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function lc(i,s,r,f,x){for(var k=s._reactName,M=[];r!==null&&r!==f;){var j=r,U=j.alternate,re=j.stateNode;if(U!==null&&U===f)break;j.tag===5&&re!==null&&(j=re,x?(U=Ri(r,k),U!=null&&M.unshift(Nn(r,U,j))):x||(U=Ri(r,k),U!=null&&M.push(Nn(r,U,j)))),r=r.return}M.length!==0&&i.push({event:s,listeners:M})}var Jf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function hc(i){return(typeof i=="string"?i:""+i).replace(Jf,`
38
+ `).replace(Zf,"")}function Lr(i,s,r){if(s=hc(s),hc(i)!==s&&r)throw Error(t(425))}function Rr(){}var da=null,ua=null;function pa(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var fa=typeof setTimeout=="function"?setTimeout:void 0,Qf=typeof clearTimeout=="function"?clearTimeout:void 0,cc=typeof Promise=="function"?Promise:void 0,em=typeof queueMicrotask=="function"?queueMicrotask:typeof cc<"u"?function(i){return cc.resolve(null).then(i).catch(tm)}:fa;function tm(i){setTimeout(function(){throw i})}function ma(i,s){var r=s,f=0;do{var x=r.nextSibling;if(i.removeChild(r),x&&x.nodeType===8)if(r=x.data,r==="/$"){if(f===0){i.removeChild(x),kn(s);return}f--}else r!=="$"&&r!=="$?"&&r!=="$!"||f++;r=x}while(r);kn(s)}function is(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?")break;if(s==="/$")return null}}return i}function dc(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="$"||r==="$!"||r==="$?"){if(s===0)return i;s--}else r==="/$"&&s++}i=i.previousSibling}return null}var Xs=Math.random().toString(36).slice(2),xi="__reactFiber$"+Xs,zn="__reactProps$"+Xs,Oi="__reactContainer$"+Xs,ga="__reactEvents$"+Xs,im="__reactListeners$"+Xs,sm="__reactHandles$"+Xs;function Ds(i){var s=i[xi];if(s)return s;for(var r=i.parentNode;r;){if(s=r[Oi]||r[xi]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(i=dc(i);i!==null;){if(r=i[xi])return r;i=dc(i)}return s}i=r,r=i.parentNode}return null}function Bn(i){return i=i[xi]||i[Oi],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function qs(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(t(33))}function Mr(i){return i[zn]||null}var va=[],Js=-1;function ss(i){return{current:i}}function Qe(i){0>Js||(i.current=va[Js],va[Js]=null,Js--)}function qe(i,s){Js++,va[Js]=i.current,i.current=s}var ns={},Et=ss(ns),Gt=ss(!1),Es=ns;function Zs(i,s){var r=i.type.contextTypes;if(!r)return ns;var f=i.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===s)return f.__reactInternalMemoizedMaskedChildContext;var x={},k;for(k in r)x[k]=s[k];return f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=x),x}function Nt(i){return i=i.childContextTypes,i!=null}function Or(){Qe(Gt),Qe(Et)}function uc(i,s,r){if(Et.current!==ns)throw Error(t(168));qe(Et,s),qe(Gt,r)}function pc(i,s,r){var f=i.stateNode;if(s=s.childContextTypes,typeof f.getChildContext!="function")return r;f=f.getChildContext();for(var x in f)if(!(x in s))throw Error(t(108,$(i)||"Unknown",x));return H({},r,f)}function Gr(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ns,Es=Et.current,qe(Et,i),qe(Gt,Gt.current),!0}function fc(i,s,r){var f=i.stateNode;if(!f)throw Error(t(169));r?(i=pc(i,s,Es),f.__reactInternalMemoizedMergedChildContext=i,Qe(Gt),Qe(Et),qe(Et,i)):Qe(Gt),qe(Gt,r)}var Gi=null,Nr=!1,_a=!1;function mc(i){Gi===null?Gi=[i]:Gi.push(i)}function nm(i){Nr=!0,mc(i)}function rs(){if(!_a&&Gi!==null){_a=!0;var i=0,s=Ue;try{var r=Gi;for(Ue=1;i<r.length;i++){var f=r[i];do f=f(!0);while(f!==null)}Gi=null,Nr=!1}catch(x){throw Gi!==null&&(Gi=Gi.slice(i+1)),Xe(Ho,rs),x}finally{Ue=s,_a=!1}}return null}var Qs=[],en=0,zr=null,Br=0,qt=[],Jt=0,ks=null,Ni=1,zi="";function Ps(i,s){Qs[en++]=Br,Qs[en++]=zr,zr=i,Br=s}function gc(i,s,r){qt[Jt++]=Ni,qt[Jt++]=zi,qt[Jt++]=ks,ks=i;var f=Ni;i=zi;var x=32-ci(f)-1;f&=~(1<<x),r+=1;var k=32-ci(s)+x;if(30<k){var M=x-x%5;k=(f&(1<<M)-1).toString(32),f>>=M,x-=M,Ni=1<<32-ci(s)+x|r<<x|f,zi=k+i}else Ni=1<<k|r<<x|f,zi=i}function wa(i){i.return!==null&&(Ps(i,1),gc(i,1,0))}function ba(i){for(;i===zr;)zr=Qs[--en],Qs[en]=null,Br=Qs[--en],Qs[en]=null;for(;i===ks;)ks=qt[--Jt],qt[Jt]=null,zi=qt[--Jt],qt[Jt]=null,Ni=qt[--Jt],qt[Jt]=null}var Ut=null,Kt=null,tt=!1,ui=null;function vc(i,s){var r=ti(5,null,null,0);r.elementType="DELETED",r.stateNode=s,r.return=i,s=i.deletions,s===null?(i.deletions=[r],i.flags|=16):s.push(r)}function _c(i,s){switch(i.tag){case 5:var r=i.type;return s=s.nodeType!==1||r.toLowerCase()!==s.nodeName.toLowerCase()?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=is(s.firstChild),!0):!1;case 6:return s=i.pendingProps===""||s.nodeType!==3?null:s,s!==null?(i.stateNode=s,Ut=i,Kt=null,!0):!1;case 13:return s=s.nodeType!==8?null:s,s!==null?(r=ks!==null?{id:Ni,overflow:zi}:null,i.memoizedState={dehydrated:s,treeContext:r,retryLane:1073741824},r=ti(18,null,null,0),r.stateNode=s,r.return=i,i.child=r,Ut=i,Kt=null,!0):!1;default:return!1}}function ya(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Sa(i){if(tt){var s=Kt;if(s){var r=s;if(!_c(i,s)){if(ya(i))throw Error(t(418));s=is(r.nextSibling);var f=Ut;s&&_c(i,s)?vc(f,r):(i.flags=i.flags&-4097|2,tt=!1,Ut=i)}}else{if(ya(i))throw Error(t(418));i.flags=i.flags&-4097|2,tt=!1,Ut=i}}}function wc(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;Ut=i}function Hr(i){if(i!==Ut)return!1;if(!tt)return wc(i),tt=!0,!1;var s;if((s=i.tag!==3)&&!(s=i.tag!==5)&&(s=i.type,s=s!=="head"&&s!=="body"&&!pa(i.type,i.memoizedProps)),s&&(s=Kt)){if(ya(i))throw bc(),Error(t(418));for(;s;)vc(i,s),s=is(s.nextSibling)}if(wc(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(t(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8){var r=i.data;if(r==="/$"){if(s===0){Kt=is(i.nextSibling);break e}s--}else r!=="$"&&r!=="$!"&&r!=="$?"||s++}i=i.nextSibling}Kt=null}}else Kt=Ut?is(i.stateNode.nextSibling):null;return!0}function bc(){for(var i=Kt;i;)i=is(i.nextSibling)}function tn(){Kt=Ut=null,tt=!1}function Ca(i){ui===null?ui=[i]:ui.push(i)}var rm=D.ReactCurrentBatchConfig;function Hn(i,s,r){if(i=r.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(t(309));var f=r.stateNode}if(!f)throw Error(t(147,i));var x=f,k=""+i;return s!==null&&s.ref!==null&&typeof s.ref=="function"&&s.ref._stringRef===k?s.ref:(s=function(M){var j=x.refs;M===null?delete j[k]:j[k]=M},s._stringRef=k,s)}if(typeof i!="string")throw Error(t(284));if(!r._owner)throw Error(t(290,i))}return i}function Fr(i,s){throw i=Object.prototype.toString.call(s),Error(t(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i))}function yc(i){var s=i._init;return s(i._payload)}function Sc(i){function s(ee,Y){if(i){var te=ee.deletions;te===null?(ee.deletions=[Y],ee.flags|=16):te.push(Y)}}function r(ee,Y){if(!i)return null;for(;Y!==null;)s(ee,Y),Y=Y.sibling;return null}function f(ee,Y){for(ee=new Map;Y!==null;)Y.key!==null?ee.set(Y.key,Y):ee.set(Y.index,Y),Y=Y.sibling;return ee}function x(ee,Y){return ee=ps(ee,Y),ee.index=0,ee.sibling=null,ee}function k(ee,Y,te){return ee.index=te,i?(te=ee.alternate,te!==null?(te=te.index,te<Y?(ee.flags|=2,Y):te):(ee.flags|=2,Y)):(ee.flags|=1048576,Y)}function M(ee){return i&&ee.alternate===null&&(ee.flags|=2),ee}function j(ee,Y,te,_e){return Y===null||Y.tag!==6?(Y=fl(te,ee.mode,_e),Y.return=ee,Y):(Y=x(Y,te),Y.return=ee,Y)}function U(ee,Y,te,_e){var ke=te.type;return ke===A?de(ee,Y,te.props.children,_e,te.key):Y!==null&&(Y.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===K&&yc(ke)===Y.type)?(_e=x(Y,te.props),_e.ref=Hn(ee,Y,te),_e.return=ee,_e):(_e=uo(te.type,te.key,te.props,null,ee.mode,_e),_e.ref=Hn(ee,Y,te),_e.return=ee,_e)}function re(ee,Y,te,_e){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==te.containerInfo||Y.stateNode.implementation!==te.implementation?(Y=ml(te,ee.mode,_e),Y.return=ee,Y):(Y=x(Y,te.children||[]),Y.return=ee,Y)}function de(ee,Y,te,_e,ke){return Y===null||Y.tag!==7?(Y=Gs(te,ee.mode,_e,ke),Y.return=ee,Y):(Y=x(Y,te),Y.return=ee,Y)}function pe(ee,Y,te){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=fl(""+Y,ee.mode,te),Y.return=ee,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case P:return te=uo(Y.type,Y.key,Y.props,null,ee.mode,te),te.ref=Hn(ee,null,Y),te.return=ee,te;case T:return Y=ml(Y,ee.mode,te),Y.return=ee,Y;case K:var _e=Y._init;return pe(ee,_e(Y._payload),te)}if($e(Y)||L(Y))return Y=Gs(Y,ee.mode,te,null),Y.return=ee,Y;Fr(ee,Y)}return null}function ce(ee,Y,te,_e){var ke=Y!==null?Y.key:null;if(typeof te=="string"&&te!==""||typeof te=="number")return ke!==null?null:j(ee,Y,""+te,_e);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case P:return te.key===ke?U(ee,Y,te,_e):null;case T:return te.key===ke?re(ee,Y,te,_e):null;case K:return ke=te._init,ce(ee,Y,ke(te._payload),_e)}if($e(te)||L(te))return ke!==null?null:de(ee,Y,te,_e,null);Fr(ee,te)}return null}function ye(ee,Y,te,_e,ke){if(typeof _e=="string"&&_e!==""||typeof _e=="number")return ee=ee.get(te)||null,j(Y,ee,""+_e,ke);if(typeof _e=="object"&&_e!==null){switch(_e.$$typeof){case P:return ee=ee.get(_e.key===null?te:_e.key)||null,U(Y,ee,_e,ke);case T:return ee=ee.get(_e.key===null?te:_e.key)||null,re(Y,ee,_e,ke);case K:var Le=_e._init;return ye(ee,Y,te,Le(_e._payload),ke)}if($e(_e)||L(_e))return ee=ee.get(te)||null,de(Y,ee,_e,ke,null);Fr(Y,_e)}return null}function xe(ee,Y,te,_e){for(var ke=null,Le=null,Re=Y,Ge=Y=0,yt=null;Re!==null&&Ge<te.length;Ge++){Re.index>Ge?(yt=Re,Re=null):yt=Re.sibling;var Fe=ce(ee,Re,te[Ge],_e);if(Fe===null){Re===null&&(Re=yt);break}i&&Re&&Fe.alternate===null&&s(ee,Re),Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe,Re=yt}if(Ge===te.length)return r(ee,Re),tt&&Ps(ee,Ge),ke;if(Re===null){for(;Ge<te.length;Ge++)Re=pe(ee,te[Ge],_e),Re!==null&&(Y=k(Re,Y,Ge),Le===null?ke=Re:Le.sibling=Re,Le=Re);return tt&&Ps(ee,Ge),ke}for(Re=f(ee,Re);Ge<te.length;Ge++)yt=ye(Re,ee,Ge,te[Ge],_e),yt!==null&&(i&&yt.alternate!==null&&Re.delete(yt.key===null?Ge:yt.key),Y=k(yt,Y,Ge),Le===null?ke=yt:Le.sibling=yt,Le=yt);return i&&Re.forEach(function(fs){return s(ee,fs)}),tt&&Ps(ee,Ge),ke}function Ee(ee,Y,te,_e){var ke=L(te);if(typeof ke!="function")throw Error(t(150));if(te=ke.call(te),te==null)throw Error(t(151));for(var Le=ke=null,Re=Y,Ge=Y=0,yt=null,Fe=te.next();Re!==null&&!Fe.done;Ge++,Fe=te.next()){Re.index>Ge?(yt=Re,Re=null):yt=Re.sibling;var fs=ce(ee,Re,Fe.value,_e);if(fs===null){Re===null&&(Re=yt);break}i&&Re&&fs.alternate===null&&s(ee,Re),Y=k(fs,Y,Ge),Le===null?ke=fs:Le.sibling=fs,Le=fs,Re=yt}if(Fe.done)return r(ee,Re),tt&&Ps(ee,Ge),ke;if(Re===null){for(;!Fe.done;Ge++,Fe=te.next())Fe=pe(ee,Fe.value,_e),Fe!==null&&(Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe);return tt&&Ps(ee,Ge),ke}for(Re=f(ee,Re);!Fe.done;Ge++,Fe=te.next())Fe=ye(Re,ee,Ge,Fe.value,_e),Fe!==null&&(i&&Fe.alternate!==null&&Re.delete(Fe.key===null?Ge:Fe.key),Y=k(Fe,Y,Ge),Le===null?ke=Fe:Le.sibling=Fe,Le=Fe);return i&&Re.forEach(function(zm){return s(ee,zm)}),tt&&Ps(ee,Ge),ke}function dt(ee,Y,te,_e){if(typeof te=="object"&&te!==null&&te.type===A&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case P:e:{for(var ke=te.key,Le=Y;Le!==null;){if(Le.key===ke){if(ke=te.type,ke===A){if(Le.tag===7){r(ee,Le.sibling),Y=x(Le,te.props.children),Y.return=ee,ee=Y;break e}}else if(Le.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===K&&yc(ke)===Le.type){r(ee,Le.sibling),Y=x(Le,te.props),Y.ref=Hn(ee,Le,te),Y.return=ee,ee=Y;break e}r(ee,Le);break}else s(ee,Le);Le=Le.sibling}te.type===A?(Y=Gs(te.props.children,ee.mode,_e,te.key),Y.return=ee,ee=Y):(_e=uo(te.type,te.key,te.props,null,ee.mode,_e),_e.ref=Hn(ee,Y,te),_e.return=ee,ee=_e)}return M(ee);case T:e:{for(Le=te.key;Y!==null;){if(Y.key===Le)if(Y.tag===4&&Y.stateNode.containerInfo===te.containerInfo&&Y.stateNode.implementation===te.implementation){r(ee,Y.sibling),Y=x(Y,te.children||[]),Y.return=ee,ee=Y;break e}else{r(ee,Y);break}else s(ee,Y);Y=Y.sibling}Y=ml(te,ee.mode,_e),Y.return=ee,ee=Y}return M(ee);case K:return Le=te._init,dt(ee,Y,Le(te._payload),_e)}if($e(te))return xe(ee,Y,te,_e);if(L(te))return Ee(ee,Y,te,_e);Fr(ee,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,Y!==null&&Y.tag===6?(r(ee,Y.sibling),Y=x(Y,te),Y.return=ee,ee=Y):(r(ee,Y),Y=fl(te,ee.mode,_e),Y.return=ee,ee=Y),M(ee)):r(ee,Y)}return dt}var sn=Sc(!0),Cc=Sc(!1),Wr=ss(null),Vr=null,nn=null,xa=null;function Da(){xa=nn=Vr=null}function Ea(i){var s=Wr.current;Qe(Wr),i._currentValue=s}function ka(i,s,r){for(;i!==null;){var f=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,f!==null&&(f.childLanes|=s)):f!==null&&(f.childLanes&s)!==s&&(f.childLanes|=s),i===r)break;i=i.return}}function rn(i,s){Vr=i,xa=nn=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(zt=!0),i.firstContext=null)}function Zt(i){var s=i._currentValue;if(xa!==i)if(i={context:i,memoizedValue:s,next:null},nn===null){if(Vr===null)throw Error(t(308));nn=i,Vr.dependencies={lanes:0,firstContext:i}}else nn=nn.next=i;return s}var Ts=null;function Pa(i){Ts===null?Ts=[i]:Ts.push(i)}function xc(i,s,r,f){var x=s.interleaved;return x===null?(r.next=r,Pa(s)):(r.next=x.next,x.next=r),s.interleaved=r,Bi(i,f)}function Bi(i,s){i.lanes|=s;var r=i.alternate;for(r!==null&&(r.lanes|=s),r=i,i=i.return;i!==null;)i.childLanes|=s,r=i.alternate,r!==null&&(r.childLanes|=s),r=i,i=i.return;return r.tag===3?r.stateNode:null}var os=!1;function Ta(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Dc(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Hi(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function as(i,s,r){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(He&2)!==0){var x=f.pending;return x===null?s.next=s:(s.next=x.next,x.next=s),f.pending=s,Bi(i,r)}return x=f.interleaved,x===null?(s.next=s,Pa(f)):(s.next=x.next,x.next=s),f.interleaved=s,Bi(i,r)}function jr(i,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194240)!==0)){var f=s.lanes;f&=i.pendingLanes,r|=f,s.lanes=r,Vo(i,r)}}function Ec(i,s){var r=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,r===f)){var x=null,k=null;if(r=r.firstBaseUpdate,r!==null){do{var M={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};k===null?x=k=M:k=k.next=M,r=r.next}while(r!==null);k===null?x=k=s:k=k.next=s}else x=k=s;r={baseState:f.baseState,firstBaseUpdate:x,lastBaseUpdate:k,shared:f.shared,effects:f.effects},i.updateQueue=r;return}i=r.lastBaseUpdate,i===null?r.firstBaseUpdate=s:i.next=s,r.lastBaseUpdate=s}function $r(i,s,r,f){var x=i.updateQueue;os=!1;var k=x.firstBaseUpdate,M=x.lastBaseUpdate,j=x.shared.pending;if(j!==null){x.shared.pending=null;var U=j,re=U.next;U.next=null,M===null?k=re:M.next=re,M=U;var de=i.alternate;de!==null&&(de=de.updateQueue,j=de.lastBaseUpdate,j!==M&&(j===null?de.firstBaseUpdate=re:j.next=re,de.lastBaseUpdate=U))}if(k!==null){var pe=x.baseState;M=0,de=re=U=null,j=k;do{var ce=j.lane,ye=j.eventTime;if((f&ce)===ce){de!==null&&(de=de.next={eventTime:ye,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var xe=i,Ee=j;switch(ce=s,ye=r,Ee.tag){case 1:if(xe=Ee.payload,typeof xe=="function"){pe=xe.call(ye,pe,ce);break e}pe=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=Ee.payload,ce=typeof xe=="function"?xe.call(ye,pe,ce):xe,ce==null)break e;pe=H({},pe,ce);break e;case 2:os=!0}}j.callback!==null&&j.lane!==0&&(i.flags|=64,ce=x.effects,ce===null?x.effects=[j]:ce.push(j))}else ye={eventTime:ye,lane:ce,tag:j.tag,payload:j.payload,callback:j.callback,next:null},de===null?(re=de=ye,U=pe):de=de.next=ye,M|=ce;if(j=j.next,j===null){if(j=x.shared.pending,j===null)break;ce=j,j=ce.next,ce.next=null,x.lastBaseUpdate=ce,x.shared.pending=null}}while(!0);if(de===null&&(U=pe),x.baseState=U,x.firstBaseUpdate=re,x.lastBaseUpdate=de,s=x.shared.interleaved,s!==null){x=s;do M|=x.lane,x=x.next;while(x!==s)}else k===null&&(x.shared.lanes=0);Ls|=M,i.lanes=M,i.memoizedState=pe}}function kc(i,s,r){if(i=s.effects,s.effects=null,i!==null)for(s=0;s<i.length;s++){var f=i[s],x=f.callback;if(x!==null){if(f.callback=null,f=r,typeof x!="function")throw Error(t(191,x));x.call(f)}}}var Fn={},Di=ss(Fn),Wn=ss(Fn),Vn=ss(Fn);function As(i){if(i===Fn)throw Error(t(174));return i}function Aa(i,s){switch(qe(Vn,s),qe(Wn,i),qe(Di,Fn),i=s.nodeType,i){case 9:case 11:s=(s=s.documentElement)?s.namespaceURI:ut(null,"");break;default:i=i===8?s.parentNode:s,s=i.namespaceURI||null,i=i.tagName,s=ut(s,i)}Qe(Di),qe(Di,s)}function on(){Qe(Di),Qe(Wn),Qe(Vn)}function Pc(i){As(Vn.current);var s=As(Di.current),r=ut(s,i.type);s!==r&&(qe(Wn,i),qe(Di,r))}function Ia(i){Wn.current===i&&(Qe(Di),Qe(Wn))}var nt=ss(0);function Ur(i){for(var s=i;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var La=[];function Ra(){for(var i=0;i<La.length;i++)La[i]._workInProgressVersionPrimary=null;La.length=0}var Kr=D.ReactCurrentDispatcher,Ma=D.ReactCurrentBatchConfig,Is=0,rt=null,vt=null,wt=null,Yr=!1,jn=!1,$n=0,om=0;function kt(){throw Error(t(321))}function Oa(i,s){if(s===null)return!1;for(var r=0;r<s.length&&r<i.length;r++)if(!di(i[r],s[r]))return!1;return!0}function Ga(i,s,r,f,x,k){if(Is=k,rt=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,Kr.current=i===null||i.memoizedState===null?cm:dm,i=r(f,x),jn){k=0;do{if(jn=!1,$n=0,25<=k)throw Error(t(301));k+=1,wt=vt=null,s.updateQueue=null,Kr.current=um,i=r(f,x)}while(jn)}if(Kr.current=Jr,s=vt!==null&&vt.next!==null,Is=0,wt=vt=rt=null,Yr=!1,s)throw Error(t(300));return i}function Na(){var i=$n!==0;return $n=0,i}function Ei(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?rt.memoizedState=wt=i:wt=wt.next=i,wt}function Qt(){if(vt===null){var i=rt.alternate;i=i!==null?i.memoizedState:null}else i=vt.next;var s=wt===null?rt.memoizedState:wt.next;if(s!==null)wt=s,vt=i;else{if(i===null)throw Error(t(310));vt=i,i={memoizedState:vt.memoizedState,baseState:vt.baseState,baseQueue:vt.baseQueue,queue:vt.queue,next:null},wt===null?rt.memoizedState=wt=i:wt=wt.next=i}return wt}function Un(i,s){return typeof s=="function"?s(i):s}function za(i){var s=Qt(),r=s.queue;if(r===null)throw Error(t(311));r.lastRenderedReducer=i;var f=vt,x=f.baseQueue,k=r.pending;if(k!==null){if(x!==null){var M=x.next;x.next=k.next,k.next=M}f.baseQueue=x=k,r.pending=null}if(x!==null){k=x.next,f=f.baseState;var j=M=null,U=null,re=k;do{var de=re.lane;if((Is&de)===de)U!==null&&(U=U.next={lane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),f=re.hasEagerState?re.eagerState:i(f,re.action);else{var pe={lane:de,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null};U===null?(j=U=pe,M=f):U=U.next=pe,rt.lanes|=de,Ls|=de}re=re.next}while(re!==null&&re!==k);U===null?M=f:U.next=j,di(f,s.memoizedState)||(zt=!0),s.memoizedState=f,s.baseState=M,s.baseQueue=U,r.lastRenderedState=f}if(i=r.interleaved,i!==null){x=i;do k=x.lane,rt.lanes|=k,Ls|=k,x=x.next;while(x!==i)}else x===null&&(r.lanes=0);return[s.memoizedState,r.dispatch]}function Ba(i){var s=Qt(),r=s.queue;if(r===null)throw Error(t(311));r.lastRenderedReducer=i;var f=r.dispatch,x=r.pending,k=s.memoizedState;if(x!==null){r.pending=null;var M=x=x.next;do k=i(k,M.action),M=M.next;while(M!==x);di(k,s.memoizedState)||(zt=!0),s.memoizedState=k,s.baseQueue===null&&(s.baseState=k),r.lastRenderedState=k}return[k,f]}function Tc(){}function Ac(i,s){var r=rt,f=Qt(),x=s(),k=!di(f.memoizedState,x);if(k&&(f.memoizedState=x,zt=!0),f=f.queue,Ha(Rc.bind(null,r,f,i),[i]),f.getSnapshot!==s||k||wt!==null&&wt.memoizedState.tag&1){if(r.flags|=2048,Kn(9,Lc.bind(null,r,f,x,s),void 0,null),bt===null)throw Error(t(349));(Is&30)!==0||Ic(r,s,x)}return x}function Ic(i,s,r){i.flags|=16384,i={getSnapshot:s,value:r},s=rt.updateQueue,s===null?(s={lastEffect:null,stores:null},rt.updateQueue=s,s.stores=[i]):(r=s.stores,r===null?s.stores=[i]:r.push(i))}function Lc(i,s,r,f){s.value=r,s.getSnapshot=f,Mc(s)&&Oc(i)}function Rc(i,s,r){return r(function(){Mc(s)&&Oc(i)})}function Mc(i){var s=i.getSnapshot;i=i.value;try{var r=s();return!di(i,r)}catch{return!0}}function Oc(i){var s=Bi(i,1);s!==null&&gi(s,i,1,-1)}function Gc(i){var s=Ei();return typeof i=="function"&&(i=i()),s.memoizedState=s.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Un,lastRenderedState:i},s.queue=i,i=i.dispatch=hm.bind(null,rt,i),[s.memoizedState,i]}function Kn(i,s,r,f){return i={tag:i,create:s,destroy:r,deps:f,next:null},s=rt.updateQueue,s===null?(s={lastEffect:null,stores:null},rt.updateQueue=s,s.lastEffect=i.next=i):(r=s.lastEffect,r===null?s.lastEffect=i.next=i:(f=r.next,r.next=i,i.next=f,s.lastEffect=i)),i}function Nc(){return Qt().memoizedState}function Xr(i,s,r,f){var x=Ei();rt.flags|=i,x.memoizedState=Kn(1|s,r,void 0,f===void 0?null:f)}function qr(i,s,r,f){var x=Qt();f=f===void 0?null:f;var k=void 0;if(vt!==null){var M=vt.memoizedState;if(k=M.destroy,f!==null&&Oa(f,M.deps)){x.memoizedState=Kn(s,r,k,f);return}}rt.flags|=i,x.memoizedState=Kn(1|s,r,k,f)}function zc(i,s){return Xr(8390656,8,i,s)}function Ha(i,s){return qr(2048,8,i,s)}function Bc(i,s){return qr(4,2,i,s)}function Hc(i,s){return qr(4,4,i,s)}function Fc(i,s){if(typeof s=="function")return i=i(),s(i),function(){s(null)};if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Wc(i,s,r){return r=r!=null?r.concat([i]):null,qr(4,4,Fc.bind(null,s,i),r)}function Fa(){}function Vc(i,s){var r=Qt();s=s===void 0?null:s;var f=r.memoizedState;return f!==null&&s!==null&&Oa(s,f[1])?f[0]:(r.memoizedState=[i,s],i)}function jc(i,s){var r=Qt();s=s===void 0?null:s;var f=r.memoizedState;return f!==null&&s!==null&&Oa(s,f[1])?f[0]:(i=i(),r.memoizedState=[i,s],i)}function $c(i,s,r){return(Is&21)===0?(i.baseState&&(i.baseState=!1,zt=!0),i.memoizedState=r):(di(r,s)||(r=yh(),rt.lanes|=r,Ls|=r,i.baseState=!0),s)}function am(i,s){var r=Ue;Ue=r!==0&&4>r?r:4,i(!0);var f=Ma.transition;Ma.transition={};try{i(!1),s()}finally{Ue=r,Ma.transition=f}}function Uc(){return Qt().memoizedState}function lm(i,s,r){var f=ds(i);if(r={lane:f,action:r,hasEagerState:!1,eagerState:null,next:null},Kc(i))Yc(s,r);else if(r=xc(i,s,r,f),r!==null){var x=Lt();gi(r,i,f,x),Xc(r,s,f)}}function hm(i,s,r){var f=ds(i),x={lane:f,action:r,hasEagerState:!1,eagerState:null,next:null};if(Kc(i))Yc(s,x);else{var k=i.alternate;if(i.lanes===0&&(k===null||k.lanes===0)&&(k=s.lastRenderedReducer,k!==null))try{var M=s.lastRenderedState,j=k(M,r);if(x.hasEagerState=!0,x.eagerState=j,di(j,M)){var U=s.interleaved;U===null?(x.next=x,Pa(s)):(x.next=U.next,U.next=x),s.interleaved=x;return}}catch{}finally{}r=xc(i,s,x,f),r!==null&&(x=Lt(),gi(r,i,f,x),Xc(r,s,f))}}function Kc(i){var s=i.alternate;return i===rt||s!==null&&s===rt}function Yc(i,s){jn=Yr=!0;var r=i.pending;r===null?s.next=s:(s.next=r.next,r.next=s),i.pending=s}function Xc(i,s,r){if((r&4194240)!==0){var f=s.lanes;f&=i.pendingLanes,r|=f,s.lanes=r,Vo(i,r)}}var Jr={readContext:Zt,useCallback:kt,useContext:kt,useEffect:kt,useImperativeHandle:kt,useInsertionEffect:kt,useLayoutEffect:kt,useMemo:kt,useReducer:kt,useRef:kt,useState:kt,useDebugValue:kt,useDeferredValue:kt,useTransition:kt,useMutableSource:kt,useSyncExternalStore:kt,useId:kt,unstable_isNewReconciler:!1},cm={readContext:Zt,useCallback:function(i,s){return Ei().memoizedState=[i,s===void 0?null:s],i},useContext:Zt,useEffect:zc,useImperativeHandle:function(i,s,r){return r=r!=null?r.concat([i]):null,Xr(4194308,4,Fc.bind(null,s,i),r)},useLayoutEffect:function(i,s){return Xr(4194308,4,i,s)},useInsertionEffect:function(i,s){return Xr(4,2,i,s)},useMemo:function(i,s){var r=Ei();return s=s===void 0?null:s,i=i(),r.memoizedState=[i,s],i},useReducer:function(i,s,r){var f=Ei();return s=r!==void 0?r(s):s,f.memoizedState=f.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},f.queue=i,i=i.dispatch=lm.bind(null,rt,i),[f.memoizedState,i]},useRef:function(i){var s=Ei();return i={current:i},s.memoizedState=i},useState:Gc,useDebugValue:Fa,useDeferredValue:function(i){return Ei().memoizedState=i},useTransition:function(){var i=Gc(!1),s=i[0];return i=am.bind(null,i[1]),Ei().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,r){var f=rt,x=Ei();if(tt){if(r===void 0)throw Error(t(407));r=r()}else{if(r=s(),bt===null)throw Error(t(349));(Is&30)!==0||Ic(f,s,r)}x.memoizedState=r;var k={value:r,getSnapshot:s};return x.queue=k,zc(Rc.bind(null,f,k,i),[i]),f.flags|=2048,Kn(9,Lc.bind(null,f,k,r,s),void 0,null),r},useId:function(){var i=Ei(),s=bt.identifierPrefix;if(tt){var r=zi,f=Ni;r=(f&~(1<<32-ci(f)-1)).toString(32)+r,s=":"+s+"R"+r,r=$n++,0<r&&(s+="H"+r.toString(32)),s+=":"}else r=om++,s=":"+s+"r"+r.toString(32)+":";return i.memoizedState=s},unstable_isNewReconciler:!1},dm={readContext:Zt,useCallback:Vc,useContext:Zt,useEffect:Ha,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:jc,useReducer:za,useRef:Nc,useState:function(){return za(Un)},useDebugValue:Fa,useDeferredValue:function(i){var s=Qt();return $c(s,vt.memoizedState,i)},useTransition:function(){var i=za(Un)[0],s=Qt().memoizedState;return[i,s]},useMutableSource:Tc,useSyncExternalStore:Ac,useId:Uc,unstable_isNewReconciler:!1},um={readContext:Zt,useCallback:Vc,useContext:Zt,useEffect:Ha,useImperativeHandle:Wc,useInsertionEffect:Bc,useLayoutEffect:Hc,useMemo:jc,useReducer:Ba,useRef:Nc,useState:function(){return Ba(Un)},useDebugValue:Fa,useDeferredValue:function(i){var s=Qt();return vt===null?s.memoizedState=i:$c(s,vt.memoizedState,i)},useTransition:function(){var i=Ba(Un)[0],s=Qt().memoizedState;return[i,s]},useMutableSource:Tc,useSyncExternalStore:Ac,useId:Uc,unstable_isNewReconciler:!1};function pi(i,s){if(i&&i.defaultProps){s=H({},s),i=i.defaultProps;for(var r in i)s[r]===void 0&&(s[r]=i[r]);return s}return s}function Wa(i,s,r,f){s=i.memoizedState,r=r(f,s),r=r==null?s:H({},s,r),i.memoizedState=r,i.lanes===0&&(i.updateQueue.baseState=r)}var Zr={isMounted:function(i){return(i=i._reactInternals)?ne(i)===i:!1},enqueueSetState:function(i,s,r){i=i._reactInternals;var f=Lt(),x=ds(i),k=Hi(f,x);k.payload=s,r!=null&&(k.callback=r),s=as(i,k,x),s!==null&&(gi(s,i,x,f),jr(s,i,x))},enqueueReplaceState:function(i,s,r){i=i._reactInternals;var f=Lt(),x=ds(i),k=Hi(f,x);k.tag=1,k.payload=s,r!=null&&(k.callback=r),s=as(i,k,x),s!==null&&(gi(s,i,x,f),jr(s,i,x))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var r=Lt(),f=ds(i),x=Hi(r,f);x.tag=2,s!=null&&(x.callback=s),s=as(i,x,f),s!==null&&(gi(s,i,f,r),jr(s,i,f))}};function qc(i,s,r,f,x,k,M){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,k,M):s.prototype&&s.prototype.isPureReactComponent?!Rn(r,f)||!Rn(x,k):!0}function Jc(i,s,r){var f=!1,x=ns,k=s.contextType;return typeof k=="object"&&k!==null?k=Zt(k):(x=Nt(s)?Es:Et.current,f=s.contextTypes,k=(f=f!=null)?Zs(i,x):ns),s=new s(r,k),i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,s.updater=Zr,i.stateNode=s,s._reactInternals=i,f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=x,i.__reactInternalMemoizedMaskedChildContext=k),s}function Zc(i,s,r,f){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,f),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,f),s.state!==i&&Zr.enqueueReplaceState(s,s.state,null)}function Va(i,s,r,f){var x=i.stateNode;x.props=r,x.state=i.memoizedState,x.refs={},Ta(i);var k=s.contextType;typeof k=="object"&&k!==null?x.context=Zt(k):(k=Nt(s)?Es:Et.current,x.context=Zs(i,k)),x.state=i.memoizedState,k=s.getDerivedStateFromProps,typeof k=="function"&&(Wa(i,s,k,r),x.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(s=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),s!==x.state&&Zr.enqueueReplaceState(x,x.state,null),$r(i,r,x,f),x.state=i.memoizedState),typeof x.componentDidMount=="function"&&(i.flags|=4194308)}function an(i,s){try{var r="",f=s;do r+=ae(f),f=f.return;while(f);var x=r}catch(k){x=`
39
39
  Error generating stack: `+k.message+`
40
- `+k.stack}return{value:i,source:s,stack:x,digest:null}}function ja(i,s,r){return{value:i,source:null,stack:r??null,digest:s??null}}function $a(i,s){try{console.error(s.value)}catch(r){setTimeout(function(){throw r})}}var pm=typeof WeakMap=="function"?WeakMap:Map;function Qc(i,s,r){r=Hi(-1,r),r.tag=3,r.payload={element:null};var f=s.value;return r.callback=function(){ro||(ro=!0,ol=f),$a(i,s)},r}function ed(i,s,r){r=Hi(-1,r),r.tag=3;var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var x=s.value;r.payload=function(){return f(x)},r.callback=function(){$a(i,s)}}var k=i.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(r.callback=function(){$a(i,s),typeof f!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var M=s.stack;this.componentDidCatch(s.value,{componentStack:M!==null?M:""})}),r}function td(i,s,r){var f=i.pingCache;if(f===null){f=i.pingCache=new pm;var x=new Set;f.set(s,x)}else x=f.get(s),x===void 0&&(x=new Set,f.set(s,x));x.has(r)||(x.add(r),i=km.bind(null,i,s,r),s.then(i,i))}function id(i){do{var s;if((s=i.tag===13)&&(s=i.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return i;i=i.return}while(i!==null);return null}function sd(i,s,r,f,x){return(i.mode&1)===0?(i===s?i.flags|=65536:(i.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(s=Hi(-1,1),s.tag=2,as(r,s,1))),r.lanes|=1),i):(i.flags|=65536,i.lanes=x,i)}var fm=D.ReactCurrentOwner,zt=!1;function It(i,s,r,f){s.child=i===null?Cc(s,null,r,f):sn(s,i.child,r,f)}function nd(i,s,r,f,x){r=r.render;var k=s.ref;return rn(s,x),f=Ga(i,s,r,f,k,x),r=Na(),i!==null&&!zt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~x,Fi(i,s,x)):(tt&&r&&wa(s),s.flags|=1,It(i,s,f,x),s.child)}function rd(i,s,r,f,x){if(i===null){var k=r.type;return typeof k=="function"&&!pl(k)&&k.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(s.tag=15,s.type=k,od(i,s,k,f,x)):(i=uo(r.type,null,f,s,s.mode,x),i.ref=s.ref,i.return=s,s.child=i)}if(k=i.child,(i.lanes&x)===0){var M=k.memoizedProps;if(r=r.compare,r=r!==null?r:Rn,r(M,f)&&i.ref===s.ref)return Fi(i,s,x)}return s.flags|=1,i=ps(k,f),i.ref=s.ref,i.return=s,s.child=i}function od(i,s,r,f,x){if(i!==null){var k=i.memoizedProps;if(Rn(k,f)&&i.ref===s.ref)if(zt=!1,s.pendingProps=f=k,(i.lanes&x)!==0)(i.flags&131072)!==0&&(zt=!0);else return s.lanes=i.lanes,Fi(i,s,x)}return Ua(i,s,r,f,x)}function ad(i,s,r){var f=s.pendingProps,x=f.children,k=i!==null?i.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(hn,Yt),Yt|=r;else{if((r&1073741824)===0)return i=k!==null?k.baseLanes|r:r,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,qe(hn,Yt),Yt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=k!==null?k.baseLanes:r,qe(hn,Yt),Yt|=f}else k!==null?(f=k.baseLanes|r,s.memoizedState=null):f=r,qe(hn,Yt),Yt|=f;return It(i,s,x,r),s.child}function ld(i,s){var r=s.ref;(i===null&&r!==null||i!==null&&i.ref!==r)&&(s.flags|=512,s.flags|=2097152)}function Ua(i,s,r,f,x){var k=Nt(r)?Ds:Et.current;return k=Zs(s,k),rn(s,x),r=Ga(i,s,r,f,k,x),f=Na(),i!==null&&!zt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~x,Fi(i,s,x)):(tt&&f&&wa(s),s.flags|=1,It(i,s,r,x),s.child)}function hd(i,s,r,f,x){if(Nt(r)){var k=!0;Gr(s)}else k=!1;if(rn(s,x),s.stateNode===null)eo(i,s),Jc(s,r,f),Va(s,r,f,x),f=!0;else if(i===null){var M=s.stateNode,j=s.memoizedProps;M.props=j;var U=M.context,re=r.contextType;typeof re=="object"&&re!==null?re=Zt(re):(re=Nt(r)?Ds:Et.current,re=Zs(s,re));var de=r.getDerivedStateFromProps,pe=typeof de=="function"||typeof M.getSnapshotBeforeUpdate=="function";pe||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(j!==f||U!==re)&&Zc(s,M,f,re),os=!1;var ce=s.memoizedState;M.state=ce,$r(s,f,M,x),U=s.memoizedState,j!==f||ce!==U||Gt.current||os?(typeof de=="function"&&(Wa(s,r,de,f),U=s.memoizedState),(j=os||qc(s,r,j,f,ce,U,re))?(pe||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(s.flags|=4194308)):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=U),M.props=f,M.state=U,M.context=re,f=j):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{M=s.stateNode,Dc(i,s),j=s.memoizedProps,re=s.type===s.elementType?j:ui(s.type,j),M.props=re,pe=s.pendingProps,ce=M.context,U=r.contextType,typeof U=="object"&&U!==null?U=Zt(U):(U=Nt(r)?Ds:Et.current,U=Zs(s,U));var ye=r.getDerivedStateFromProps;(de=typeof ye=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(j!==pe||ce!==U)&&Zc(s,M,f,U),os=!1,ce=s.memoizedState,M.state=ce,$r(s,f,M,x);var xe=s.memoizedState;j!==pe||ce!==xe||Gt.current||os?(typeof ye=="function"&&(Wa(s,r,ye,f),xe=s.memoizedState),(re=os||qc(s,r,re,f,ce,xe,U)||!1)?(de||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(f,xe,U),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(f,xe,U)),typeof M.componentDidUpdate=="function"&&(s.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof M.componentDidUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=xe),M.props=f,M.state=xe,M.context=U,f=re):(typeof M.componentDidUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=1024),f=!1)}return Ka(i,s,r,f,k,x)}function Ka(i,s,r,f,x,k){ld(i,s);var M=(s.flags&128)!==0;if(!f&&!M)return x&&fc(s,r,!1),Fi(i,s,k);f=s.stateNode,fm.current=s;var j=M&&typeof r.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,i!==null&&M?(s.child=sn(s,i.child,null,k),s.child=sn(s,null,j,k)):It(i,s,j,k),s.memoizedState=f.state,x&&fc(s,r,!0),s.child}function cd(i){var s=i.stateNode;s.pendingContext?uc(i,s.pendingContext,s.pendingContext!==s.context):s.context&&uc(i,s.context,!1),Aa(i,s.containerInfo)}function dd(i,s,r,f,x){return tn(),Ca(x),s.flags|=256,It(i,s,r,f),s.child}var Ya={dehydrated:null,treeContext:null,retryLane:0};function Xa(i){return{baseLanes:i,cachePool:null,transitions:null}}function ud(i,s,r){var f=s.pendingProps,x=nt.current,k=!1,M=(s.flags&128)!==0,j;if((j=M)||(j=i!==null&&i.memoizedState===null?!1:(x&2)!==0),j?(k=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(x|=1),qe(nt,x&1),i===null)return Sa(s),i=s.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((s.mode&1)===0?s.lanes=1:i.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(M=f.children,i=f.fallback,k?(f=s.mode,k=s.child,M={mode:"hidden",children:M},(f&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=M):k=po(M,f,0,null),i=Os(i,f,r,null),k.return=s,i.return=s,k.sibling=i,s.child=k,s.child.memoizedState=Xa(r),s.memoizedState=Ya,i):qa(s,M));if(x=i.memoizedState,x!==null&&(j=x.dehydrated,j!==null))return mm(i,s,M,f,j,x,r);if(k){k=f.fallback,M=s.mode,x=i.child,j=x.sibling;var U={mode:"hidden",children:f.children};return(M&1)===0&&s.child!==x?(f=s.child,f.childLanes=0,f.pendingProps=U,s.deletions=null):(f=ps(x,U),f.subtreeFlags=x.subtreeFlags&14680064),j!==null?k=ps(j,k):(k=Os(k,M,r,null),k.flags|=2),k.return=s,f.return=s,f.sibling=k,s.child=f,f=k,k=s.child,M=i.child.memoizedState,M=M===null?Xa(r):{baseLanes:M.baseLanes|r,cachePool:null,transitions:M.transitions},k.memoizedState=M,k.childLanes=i.childLanes&~r,s.memoizedState=Ya,f}return k=i.child,i=k.sibling,f=ps(k,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=r),f.return=s,f.sibling=null,i!==null&&(r=s.deletions,r===null?(s.deletions=[i],s.flags|=16):r.push(i)),s.child=f,s.memoizedState=null,f}function qa(i,s){return s=po({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function Qr(i,s,r,f){return f!==null&&Ca(f),sn(s,i.child,null,r),i=qa(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function mm(i,s,r,f,x,k,M){if(r)return s.flags&256?(s.flags&=-257,f=ja(Error(t(422))),Qr(i,s,M,f)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(k=f.fallback,x=s.mode,f=po({mode:"visible",children:f.children},x,0,null),k=Os(k,x,M,null),k.flags|=2,f.return=s,k.return=s,f.sibling=k,s.child=f,(s.mode&1)!==0&&sn(s,i.child,null,M),s.child.memoizedState=Xa(M),s.memoizedState=Ya,k);if((s.mode&1)===0)return Qr(i,s,M,null);if(x.data==="$!"){if(f=x.nextSibling&&x.nextSibling.dataset,f)var j=f.dgst;return f=j,k=Error(t(419)),f=ja(k,f,void 0),Qr(i,s,M,f)}if(j=(M&i.childLanes)!==0,zt||j){if(f=bt,f!==null){switch(M&-M){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(f.suspendedLanes|M))!==0?0:x,x!==0&&x!==k.retryLane&&(k.retryLane=x,Bi(i,x),mi(f,i,x,-1))}return ul(),f=ja(Error(t(421))),Qr(i,s,M,f)}return x.data==="$?"?(s.flags|=128,s.child=i.child,s=Pm.bind(null,i),x._reactRetry=s,null):(i=k.treeContext,Kt=is(x.nextSibling),Ut=s,tt=!0,di=null,i!==null&&(qt[Jt++]=Ni,qt[Jt++]=zi,qt[Jt++]=Es,Ni=i.id,zi=i.overflow,Es=s),s=qa(s,f.children),s.flags|=4096,s)}function pd(i,s,r){i.lanes|=s;var f=i.alternate;f!==null&&(f.lanes|=s),ka(i.return,s,r)}function Ja(i,s,r,f,x){var k=i.memoizedState;k===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:r,tailMode:x}:(k.isBackwards=s,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=r,k.tailMode=x)}function fd(i,s,r){var f=s.pendingProps,x=f.revealOrder,k=f.tail;if(It(i,s,f.children,r),f=nt.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&pd(i,r,s);else if(i.tag===19)pd(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}f&=1}if(qe(nt,f),(s.mode&1)===0)s.memoizedState=null;else switch(x){case"forwards":for(r=s.child,x=null;r!==null;)i=r.alternate,i!==null&&Ur(i)===null&&(x=r),r=r.sibling;r=x,r===null?(x=s.child,s.child=null):(x=r.sibling,r.sibling=null),Ja(s,!1,x,r,k);break;case"backwards":for(r=null,x=s.child,s.child=null;x!==null;){if(i=x.alternate,i!==null&&Ur(i)===null){s.child=x;break}i=x.sibling,x.sibling=r,r=x,x=i}Ja(s,!0,r,null,k);break;case"together":Ja(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function eo(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function Fi(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Is|=s.lanes,(r&s.childLanes)===0)return null;if(i!==null&&s.child!==i.child)throw Error(t(153));if(s.child!==null){for(i=s.child,r=ps(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=ps(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function gm(i,s,r){switch(s.tag){case 3:cd(s),tn();break;case 5:Pc(s);break;case 1:Nt(s.type)&&Gr(s);break;case 4:Aa(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,x=s.memoizedProps.value;qe(Wr,f._currentValue),f._currentValue=x;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(qe(nt,nt.current&1),s.flags|=128,null):(r&s.child.childLanes)!==0?ud(i,s,r):(qe(nt,nt.current&1),i=Fi(i,s,r),i!==null?i.sibling:null);qe(nt,nt.current&1);break;case 19:if(f=(r&s.childLanes)!==0,(i.flags&128)!==0){if(f)return fd(i,s,r);s.flags|=128}if(x=s.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),qe(nt,nt.current),f)break;return null;case 22:case 23:return s.lanes=0,ad(i,s,r)}return Fi(i,s,r)}var md,Za,gd,vd;md=function(i,s){for(var r=s.child;r!==null;){if(r.tag===5||r.tag===6)i.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Za=function(){},gd=function(i,s,r,f){var x=i.memoizedProps;if(x!==f){i=s.stateNode,Ts(Di.current);var k=null;switch(r){case"input":x=We(i,x),f=We(i,f),k=[];break;case"select":x=B({},x,{value:void 0}),f=B({},f,{value:void 0}),k=[];break;case"textarea":x=Dt(i,x),f=Dt(i,f),k=[];break;default:typeof x.onClick!="function"&&typeof f.onClick=="function"&&(i.onclick=Rr)}li(r,f);var M;r=null;for(re in x)if(!f.hasOwnProperty(re)&&x.hasOwnProperty(re)&&x[re]!=null)if(re==="style"){var j=x[re];for(M in j)j.hasOwnProperty(M)&&(r||(r={}),r[M]="")}else re!=="dangerouslySetInnerHTML"&&re!=="children"&&re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&re!=="autoFocus"&&(o.hasOwnProperty(re)?k||(k=[]):(k=k||[]).push(re,null));for(re in f){var U=f[re];if(j=x!=null?x[re]:void 0,f.hasOwnProperty(re)&&U!==j&&(U!=null||j!=null))if(re==="style")if(j){for(M in j)!j.hasOwnProperty(M)||U&&U.hasOwnProperty(M)||(r||(r={}),r[M]="");for(M in U)U.hasOwnProperty(M)&&j[M]!==U[M]&&(r||(r={}),r[M]=U[M])}else r||(k||(k=[]),k.push(re,r)),r=U;else re==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,j=j?j.__html:void 0,U!=null&&j!==U&&(k=k||[]).push(re,U)):re==="children"?typeof U!="string"&&typeof U!="number"||(k=k||[]).push(re,""+U):re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&(o.hasOwnProperty(re)?(U!=null&&re==="onScroll"&&Ze("scroll",i),k||j===U||(k=[])):(k=k||[]).push(re,U))}r&&(k=k||[]).push("style",r);var re=k;(s.updateQueue=re)&&(s.flags|=4)}},vd=function(i,s,r,f){r!==f&&(s.flags|=4)};function Yn(i,s){if(!tt)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var f=null;r!==null;)r.alternate!==null&&(f=r),r=r.sibling;f===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Pt(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,f=0;if(s)for(var x=i.child;x!==null;)r|=x.lanes|x.childLanes,f|=x.subtreeFlags&14680064,f|=x.flags&14680064,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)r|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=f,i.childLanes=r,s}function vm(i,s,r){var f=s.pendingProps;switch(ba(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(s),null;case 1:return Nt(s.type)&&Or(),Pt(s),null;case 3:return f=s.stateNode,on(),Qe(Gt),Qe(Et),Ra(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(i===null||i.child===null)&&(Hr(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,di!==null&&(hl(di),di=null))),Za(i,s),Pt(s),null;case 5:Ia(s);var x=Ts(Vn.current);if(r=s.type,i!==null&&s.stateNode!=null)gd(i,s,r,f,x),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(t(166));return Pt(s),null}if(i=Ts(Di.current),Hr(s)){f=s.stateNode,r=s.type;var k=s.memoizedProps;switch(f[xi]=s,f[zn]=k,i=(s.mode&1)!==0,r){case"dialog":Ze("cancel",f),Ze("close",f);break;case"iframe":case"object":case"embed":Ze("load",f);break;case"video":case"audio":for(x=0;x<On.length;x++)Ze(On[x],f);break;case"source":Ze("error",f);break;case"img":case"image":case"link":Ze("error",f),Ze("load",f);break;case"details":Ze("toggle",f);break;case"input":je(f,k),Ze("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!k.multiple},Ze("invalid",f);break;case"textarea":Ne(f,k),Ze("invalid",f)}li(r,k),x=null;for(var M in k)if(k.hasOwnProperty(M)){var j=k[M];M==="children"?typeof j=="string"?f.textContent!==j&&(k.suppressHydrationWarning!==!0&&Lr(f.textContent,j,i),x=["children",j]):typeof j=="number"&&f.textContent!==""+j&&(k.suppressHydrationWarning!==!0&&Lr(f.textContent,j,i),x=["children",""+j]):o.hasOwnProperty(M)&&j!=null&&M==="onScroll"&&Ze("scroll",f)}switch(r){case"input":ge(f),ve(f,k,!0);break;case"textarea":ge(f),At(f);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(f.onclick=Rr)}f=x,s.updateQueue=f,f!==null&&(s.flags|=4)}else{M=x.nodeType===9?x:x.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=mt(r)),i==="http://www.w3.org/1999/xhtml"?r==="script"?(i=M.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof f.is=="string"?i=M.createElement(r,{is:f.is}):(i=M.createElement(r),r==="select"&&(M=i,f.multiple?M.multiple=!0:f.size&&(M.size=f.size))):i=M.createElementNS(i,r),i[xi]=s,i[zn]=f,md(i,s,!1,!1),s.stateNode=i;e:{switch(M=Hs(r,f),r){case"dialog":Ze("cancel",i),Ze("close",i),x=f;break;case"iframe":case"object":case"embed":Ze("load",i),x=f;break;case"video":case"audio":for(x=0;x<On.length;x++)Ze(On[x],i);x=f;break;case"source":Ze("error",i),x=f;break;case"img":case"image":case"link":Ze("error",i),Ze("load",i),x=f;break;case"details":Ze("toggle",i),x=f;break;case"input":je(i,f),x=We(i,f),Ze("invalid",i);break;case"option":x=f;break;case"select":i._wrapperState={wasMultiple:!!f.multiple},x=B({},f,{value:void 0}),Ze("invalid",i);break;case"textarea":Ne(i,f),x=Dt(i,f),Ze("invalid",i);break;default:x=f}li(r,x),j=x;for(k in j)if(j.hasOwnProperty(k)){var U=j[k];k==="style"?dr(i,U):k==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,U!=null&&ai(i,U)):k==="children"?typeof U=="string"?(r!=="textarea"||U!=="")&&gt(i,U):typeof U=="number"&&gt(i,""+U):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(o.hasOwnProperty(k)?U!=null&&k==="onScroll"&&Ze("scroll",i):U!=null&&v(i,k,U,M))}switch(r){case"input":ge(i),ve(i,f,!1);break;case"textarea":ge(i),At(i);break;case"option":f.value!=null&&i.setAttribute("value",""+O(f.value));break;case"select":i.multiple=!!f.multiple,k=f.value,k!=null?st(i,!!f.multiple,k,!1):f.defaultValue!=null&&st(i,!!f.multiple,f.defaultValue,!0);break;default:typeof x.onClick=="function"&&(i.onclick=Rr)}switch(r){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Pt(s),null;case 6:if(i&&s.stateNode!=null)vd(i,s,i.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(t(166));if(r=Ts(Vn.current),Ts(Di.current),Hr(s)){if(f=s.stateNode,r=s.memoizedProps,f[xi]=s,(k=f.nodeValue!==r)&&(i=Ut,i!==null))switch(i.tag){case 3:Lr(f.nodeValue,r,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Lr(f.nodeValue,r,(i.mode&1)!==0)}k&&(s.flags|=4)}else f=(r.nodeType===9?r:r.ownerDocument).createTextNode(f),f[xi]=s,s.stateNode=f}return Pt(s),null;case 13:if(Qe(nt),f=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(tt&&Kt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)bc(),tn(),s.flags|=98560,k=!1;else if(k=Hr(s),f!==null&&f.dehydrated!==null){if(i===null){if(!k)throw Error(t(318));if(k=s.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(t(317));k[xi]=s}else tn(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),k=!1}else di!==null&&(hl(di),di=null),k=!0;if(!k)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=r,s):(f=f!==null,f!==(i!==null&&i.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(i===null||(nt.current&1)!==0?_t===0&&(_t=3):ul())),s.updateQueue!==null&&(s.flags|=4),Pt(s),null);case 4:return on(),Za(i,s),i===null&&Gn(s.stateNode.containerInfo),Pt(s),null;case 10:return Ea(s.type._context),Pt(s),null;case 17:return Nt(s.type)&&Or(),Pt(s),null;case 19:if(Qe(nt),k=s.memoizedState,k===null)return Pt(s),null;if(f=(s.flags&128)!==0,M=k.rendering,M===null)if(f)Yn(k,!1);else{if(_t!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(M=Ur(i),M!==null){for(s.flags|=128,Yn(k,!1),f=M.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=r,r=s.child;r!==null;)k=r,i=f,k.flags&=14680066,M=k.alternate,M===null?(k.childLanes=0,k.lanes=i,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=M.childLanes,k.lanes=M.lanes,k.child=M.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=M.memoizedProps,k.memoizedState=M.memoizedState,k.updateQueue=M.updateQueue,k.type=M.type,i=M.dependencies,k.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r=r.sibling;return qe(nt,nt.current&1|2),s.child}i=i.sibling}k.tail!==null&&ct()>cn&&(s.flags|=128,f=!0,Yn(k,!1),s.lanes=4194304)}else{if(!f)if(i=Ur(M),i!==null){if(s.flags|=128,f=!0,r=i.updateQueue,r!==null&&(s.updateQueue=r,s.flags|=4),Yn(k,!0),k.tail===null&&k.tailMode==="hidden"&&!M.alternate&&!tt)return Pt(s),null}else 2*ct()-k.renderingStartTime>cn&&r!==1073741824&&(s.flags|=128,f=!0,Yn(k,!1),s.lanes=4194304);k.isBackwards?(M.sibling=s.child,s.child=M):(r=k.last,r!==null?r.sibling=M:s.child=M,k.last=M)}return k.tail!==null?(s=k.tail,k.rendering=s,k.tail=s.sibling,k.renderingStartTime=ct(),s.sibling=null,r=nt.current,qe(nt,f?r&1|2:r&1),s):(Pt(s),null);case 22:case 23:return dl(),f=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(Yt&1073741824)!==0&&(Pt(s),s.subtreeFlags&6&&(s.flags|=8192)):Pt(s),null;case 24:return null;case 25:return null}throw Error(t(156,s.tag))}function _m(i,s){switch(ba(s),s.tag){case 1:return Nt(s.type)&&Or(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return on(),Qe(Gt),Qe(Et),Ra(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Ia(s),null;case 13:if(Qe(nt),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(t(340));tn()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Qe(nt),null;case 4:return on(),null;case 10:return Ea(s.type._context),null;case 22:case 23:return dl(),null;case 24:return null;default:return null}}var to=!1,Tt=!1,wm=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function ln(i,s){var r=i.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(f){at(i,s,f)}else r.current=null}function Qa(i,s,r){try{r()}catch(f){at(i,s,f)}}var _d=!1;function bm(i,s){if(da=yr,i=qh(),sa(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var f=r.getSelection&&r.getSelection();if(f&&f.rangeCount!==0){r=f.anchorNode;var x=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{r.nodeType,k.nodeType}catch{r=null;break e}var M=0,j=-1,U=-1,re=0,de=0,pe=i,ce=null;t:for(;;){for(var ye;pe!==r||x!==0&&pe.nodeType!==3||(j=M+x),pe!==k||f!==0&&pe.nodeType!==3||(U=M+f),pe.nodeType===3&&(M+=pe.nodeValue.length),(ye=pe.firstChild)!==null;)ce=pe,pe=ye;for(;;){if(pe===i)break t;if(ce===r&&++re===x&&(j=M),ce===k&&++de===f&&(U=M),(ye=pe.nextSibling)!==null)break;pe=ce,ce=pe.parentNode}pe=ye}r=j===-1||U===-1?null:{start:j,end:U}}else r=null}r=r||{start:0,end:0}}else r=null;for(ua={focusedElem:i,selectionRange:r},yr=!1,Ce=s;Ce!==null;)if(s=Ce,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Ce=i;else for(;Ce!==null;){s=Ce;try{var xe=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var Ee=xe.memoizedProps,dt=xe.memoizedState,ee=s.stateNode,Y=ee.getSnapshotBeforeUpdate(s.elementType===s.type?Ee:ui(s.type,Ee),dt);ee.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:var te=s.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(_e){at(s,s.return,_e)}if(i=s.sibling,i!==null){i.return=s.return,Ce=i;break}Ce=s.return}return xe=_d,_d=!1,xe}function Xn(i,s,r){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var x=f=f.next;do{if((x.tag&i)===i){var k=x.destroy;x.destroy=void 0,k!==void 0&&Qa(s,r,k)}x=x.next}while(x!==f)}}function io(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&i)===i){var f=r.create;r.destroy=f()}r=r.next}while(r!==s)}}function el(i){var s=i.ref;if(s!==null){var r=i.stateNode;switch(i.tag){case 5:i=r;break;default:i=r}typeof s=="function"?s(i):s.current=i}}function wd(i){var s=i.alternate;s!==null&&(i.alternate=null,wd(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[xi],delete s[zn],delete s[ga],delete s[im],delete s[sm])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function bd(i){return i.tag===5||i.tag===3||i.tag===4}function yd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||bd(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function tl(i,s,r){var f=i.tag;if(f===5||f===6)i=i.stateNode,s?r.nodeType===8?r.parentNode.insertBefore(i,s):r.insertBefore(i,s):(r.nodeType===8?(s=r.parentNode,s.insertBefore(i,r)):(s=r,s.appendChild(i)),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Rr));else if(f!==4&&(i=i.child,i!==null))for(tl(i,s,r),i=i.sibling;i!==null;)tl(i,s,r),i=i.sibling}function il(i,s,r){var f=i.tag;if(f===5||f===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(f!==4&&(i=i.child,i!==null))for(il(i,s,r),i=i.sibling;i!==null;)il(i,s,r),i=i.sibling}var Ct=null,pi=!1;function ls(i,s,r){for(r=r.child;r!==null;)Sd(i,s,r),r=r.sibling}function Sd(i,s,r){if(Ci&&typeof Ci.onCommitFiberUnmount=="function")try{Ci.onCommitFiberUnmount(mr,r)}catch{}switch(r.tag){case 5:Tt||ln(r,s);case 6:var f=Ct,x=pi;Ct=null,ls(i,s,r),Ct=f,pi=x,Ct!==null&&(pi?(i=Ct,r=r.stateNode,i.nodeType===8?i.parentNode.removeChild(r):i.removeChild(r)):Ct.removeChild(r.stateNode));break;case 18:Ct!==null&&(pi?(i=Ct,r=r.stateNode,i.nodeType===8?ma(i.parentNode,r):i.nodeType===1&&ma(i,r),kn(i)):ma(Ct,r.stateNode));break;case 4:f=Ct,x=pi,Ct=r.stateNode.containerInfo,pi=!0,ls(i,s,r),Ct=f,pi=x;break;case 0:case 11:case 14:case 15:if(!Tt&&(f=r.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){x=f=f.next;do{var k=x,M=k.destroy;k=k.tag,M!==void 0&&((k&2)!==0||(k&4)!==0)&&Qa(r,s,M),x=x.next}while(x!==f)}ls(i,s,r);break;case 1:if(!Tt&&(ln(r,s),f=r.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=r.memoizedProps,f.state=r.memoizedState,f.componentWillUnmount()}catch(j){at(r,s,j)}ls(i,s,r);break;case 21:ls(i,s,r);break;case 22:r.mode&1?(Tt=(f=Tt)||r.memoizedState!==null,ls(i,s,r),Tt=f):ls(i,s,r);break;default:ls(i,s,r)}}function Cd(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var r=i.stateNode;r===null&&(r=i.stateNode=new wm),s.forEach(function(f){var x=Tm.bind(null,i,f);r.has(f)||(r.add(f),f.then(x,x))})}}function fi(i,s){var r=s.deletions;if(r!==null)for(var f=0;f<r.length;f++){var x=r[f];try{var k=i,M=s,j=M;e:for(;j!==null;){switch(j.tag){case 5:Ct=j.stateNode,pi=!1;break e;case 3:Ct=j.stateNode.containerInfo,pi=!0;break e;case 4:Ct=j.stateNode.containerInfo,pi=!0;break e}j=j.return}if(Ct===null)throw Error(t(160));Sd(k,M,x),Ct=null,pi=!1;var U=x.alternate;U!==null&&(U.return=null),x.return=null}catch(re){at(x,s,re)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)xd(s,i),s=s.sibling}function xd(i,s){var r=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(fi(s,i),ki(i),f&4){try{Xn(3,i,i.return),io(3,i)}catch(Ee){at(i,i.return,Ee)}try{Xn(5,i,i.return)}catch(Ee){at(i,i.return,Ee)}}break;case 1:fi(s,i),ki(i),f&512&&r!==null&&ln(r,r.return);break;case 5:if(fi(s,i),ki(i),f&512&&r!==null&&ln(r,r.return),i.flags&32){var x=i.stateNode;try{gt(x,"")}catch(Ee){at(i,i.return,Ee)}}if(f&4&&(x=i.stateNode,x!=null)){var k=i.memoizedProps,M=r!==null?r.memoizedProps:k,j=i.type,U=i.updateQueue;if(i.updateQueue=null,U!==null)try{j==="input"&&k.type==="radio"&&k.name!=null&&ot(x,k),Hs(j,M);var re=Hs(j,k);for(M=0;M<U.length;M+=2){var de=U[M],pe=U[M+1];de==="style"?dr(x,pe):de==="dangerouslySetInnerHTML"?ai(x,pe):de==="children"?gt(x,pe):v(x,de,pe,re)}switch(j){case"input":Ae(x,k);break;case"textarea":Si(x,k);break;case"select":var ce=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!k.multiple;var ye=k.value;ye!=null?st(x,!!k.multiple,ye,!1):ce!==!!k.multiple&&(k.defaultValue!=null?st(x,!!k.multiple,k.defaultValue,!0):st(x,!!k.multiple,k.multiple?[]:"",!1))}x[zn]=k}catch(Ee){at(i,i.return,Ee)}}break;case 6:if(fi(s,i),ki(i),f&4){if(i.stateNode===null)throw Error(t(162));x=i.stateNode,k=i.memoizedProps;try{x.nodeValue=k}catch(Ee){at(i,i.return,Ee)}}break;case 3:if(fi(s,i),ki(i),f&4&&r!==null&&r.memoizedState.isDehydrated)try{kn(s.containerInfo)}catch(Ee){at(i,i.return,Ee)}break;case 4:fi(s,i),ki(i);break;case 13:fi(s,i),ki(i),x=i.child,x.flags&8192&&(k=x.memoizedState!==null,x.stateNode.isHidden=k,!k||x.alternate!==null&&x.alternate.memoizedState!==null||(rl=ct())),f&4&&Cd(i);break;case 22:if(de=r!==null&&r.memoizedState!==null,i.mode&1?(Tt=(re=Tt)||de,fi(s,i),Tt=re):fi(s,i),ki(i),f&8192){if(re=i.memoizedState!==null,(i.stateNode.isHidden=re)&&!de&&(i.mode&1)!==0)for(Ce=i,de=i.child;de!==null;){for(pe=Ce=de;Ce!==null;){switch(ce=Ce,ye=ce.child,ce.tag){case 0:case 11:case 14:case 15:Xn(4,ce,ce.return);break;case 1:ln(ce,ce.return);var xe=ce.stateNode;if(typeof xe.componentWillUnmount=="function"){f=ce,r=ce.return;try{s=f,xe.props=s.memoizedProps,xe.state=s.memoizedState,xe.componentWillUnmount()}catch(Ee){at(f,r,Ee)}}break;case 5:ln(ce,ce.return);break;case 22:if(ce.memoizedState!==null){kd(pe);continue}}ye!==null?(ye.return=ce,Ce=ye):kd(pe)}de=de.sibling}e:for(de=null,pe=i;;){if(pe.tag===5){if(de===null){de=pe;try{x=pe.stateNode,re?(k=x.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(j=pe.stateNode,U=pe.memoizedProps.style,M=U!=null&&U.hasOwnProperty("display")?U.display:null,j.style.display=Bs("display",M))}catch(Ee){at(i,i.return,Ee)}}}else if(pe.tag===6){if(de===null)try{pe.stateNode.nodeValue=re?"":pe.memoizedProps}catch(Ee){at(i,i.return,Ee)}}else if((pe.tag!==22&&pe.tag!==23||pe.memoizedState===null||pe===i)&&pe.child!==null){pe.child.return=pe,pe=pe.child;continue}if(pe===i)break e;for(;pe.sibling===null;){if(pe.return===null||pe.return===i)break e;de===pe&&(de=null),pe=pe.return}de===pe&&(de=null),pe.sibling.return=pe.return,pe=pe.sibling}}break;case 19:fi(s,i),ki(i),f&4&&Cd(i);break;case 21:break;default:fi(s,i),ki(i)}}function ki(i){var s=i.flags;if(s&2){try{e:{for(var r=i.return;r!==null;){if(bd(r)){var f=r;break e}r=r.return}throw Error(t(160))}switch(f.tag){case 5:var x=f.stateNode;f.flags&32&&(gt(x,""),f.flags&=-33);var k=yd(i);il(i,k,x);break;case 3:case 4:var M=f.stateNode.containerInfo,j=yd(i);tl(i,j,M);break;default:throw Error(t(161))}}catch(U){at(i,i.return,U)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function ym(i,s,r){Ce=i,Dd(i)}function Dd(i,s,r){for(var f=(i.mode&1)!==0;Ce!==null;){var x=Ce,k=x.child;if(x.tag===22&&f){var M=x.memoizedState!==null||to;if(!M){var j=x.alternate,U=j!==null&&j.memoizedState!==null||Tt;j=to;var re=Tt;if(to=M,(Tt=U)&&!re)for(Ce=x;Ce!==null;)M=Ce,U=M.child,M.tag===22&&M.memoizedState!==null?Pd(x):U!==null?(U.return=M,Ce=U):Pd(x);for(;k!==null;)Ce=k,Dd(k),k=k.sibling;Ce=x,to=j,Tt=re}Ed(i)}else(x.subtreeFlags&8772)!==0&&k!==null?(k.return=x,Ce=k):Ed(i)}}function Ed(i){for(;Ce!==null;){var s=Ce;if((s.flags&8772)!==0){var r=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Tt||io(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Tt)if(r===null)f.componentDidMount();else{var x=s.elementType===s.type?r.memoizedProps:ui(s.type,r.memoizedProps);f.componentDidUpdate(x,r.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var k=s.updateQueue;k!==null&&kc(s,k,f);break;case 3:var M=s.updateQueue;if(M!==null){if(r=null,s.child!==null)switch(s.child.tag){case 5:r=s.child.stateNode;break;case 1:r=s.child.stateNode}kc(s,M,r)}break;case 5:var j=s.stateNode;if(r===null&&s.flags&4){r=j;var U=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":U.autoFocus&&r.focus();break;case"img":U.src&&(r.src=U.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var re=s.alternate;if(re!==null){var de=re.memoizedState;if(de!==null){var pe=de.dehydrated;pe!==null&&kn(pe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}Tt||s.flags&512&&el(s)}catch(ce){at(s,s.return,ce)}}if(s===i){Ce=null;break}if(r=s.sibling,r!==null){r.return=s.return,Ce=r;break}Ce=s.return}}function kd(i){for(;Ce!==null;){var s=Ce;if(s===i){Ce=null;break}var r=s.sibling;if(r!==null){r.return=s.return,Ce=r;break}Ce=s.return}}function Pd(i){for(;Ce!==null;){var s=Ce;try{switch(s.tag){case 0:case 11:case 15:var r=s.return;try{io(4,s)}catch(U){at(s,r,U)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var x=s.return;try{f.componentDidMount()}catch(U){at(s,x,U)}}var k=s.return;try{el(s)}catch(U){at(s,k,U)}break;case 5:var M=s.return;try{el(s)}catch(U){at(s,M,U)}}}catch(U){at(s,s.return,U)}if(s===i){Ce=null;break}var j=s.sibling;if(j!==null){j.return=s.return,Ce=j;break}Ce=s.return}}var Sm=Math.ceil,so=D.ReactCurrentDispatcher,sl=D.ReactCurrentOwner,ei=D.ReactCurrentBatchConfig,He=0,bt=null,pt=null,xt=0,Yt=0,hn=ss(0),_t=0,qn=null,Is=0,no=0,nl=0,Jn=null,Bt=null,rl=0,cn=1/0,Wi=null,ro=!1,ol=null,hs=null,oo=!1,cs=null,ao=0,Zn=0,al=null,lo=-1,ho=0;function Lt(){return(He&6)!==0?ct():lo!==-1?lo:lo=ct()}function ds(i){return(i.mode&1)===0?1:(He&2)!==0&&xt!==0?xt&-xt:rm.transition!==null?(ho===0&&(ho=yh()),ho):(i=Ue,i!==0||(i=window.event,i=i===void 0?16:Ah(i.type)),i)}function mi(i,s,r,f){if(50<Zn)throw Zn=0,al=null,Error(t(185));Sn(i,r,f),((He&2)===0||i!==bt)&&(i===bt&&((He&2)===0&&(no|=r),_t===4&&us(i,xt)),Ht(i,f),r===1&&He===0&&(s.mode&1)===0&&(cn=ct()+500,Nr&&rs()))}function Ht(i,s){var r=i.callbackNode;rf(i,s);var f=_r(i,i===bt?xt:0);if(f===0)r!==null&&jt(r),i.callbackNode=null,i.callbackPriority=0;else if(s=f&-f,i.callbackPriority!==s){if(r!=null&&jt(r),s===1)i.tag===0?nm(Ad.bind(null,i)):mc(Ad.bind(null,i)),em(function(){(He&6)===0&&rs()}),r=null;else{switch(Sh(f)){case 1:r=Ho;break;case 4:r=wh;break;case 16:r=fr;break;case 536870912:r=bh;break;default:r=fr}r=zd(r,Td.bind(null,i))}i.callbackPriority=s,i.callbackNode=r}}function Td(i,s){if(lo=-1,ho=0,(He&6)!==0)throw Error(t(327));var r=i.callbackNode;if(dn()&&i.callbackNode!==r)return null;var f=_r(i,i===bt?xt:0);if(f===0)return null;if((f&30)!==0||(f&i.expiredLanes)!==0||s)s=co(i,f);else{s=f;var x=He;He|=2;var k=Ld();(bt!==i||xt!==s)&&(Wi=null,cn=ct()+500,Rs(i,s));do try{Dm();break}catch(j){Id(i,j)}while(!0);Da(),so.current=k,He=x,pt!==null?s=0:(bt=null,xt=0,s=_t)}if(s!==0){if(s===2&&(x=Fo(i),x!==0&&(f=x,s=ll(i,x))),s===1)throw r=qn,Rs(i,0),us(i,f),Ht(i,ct()),r;if(s===6)us(i,f);else{if(x=i.current.alternate,(f&30)===0&&!Cm(x)&&(s=co(i,f),s===2&&(k=Fo(i),k!==0&&(f=k,s=ll(i,k))),s===1))throw r=qn,Rs(i,0),us(i,f),Ht(i,ct()),r;switch(i.finishedWork=x,i.finishedLanes=f,s){case 0:case 1:throw Error(t(345));case 2:Ms(i,Bt,Wi);break;case 3:if(us(i,f),(f&130023424)===f&&(s=rl+500-ct(),10<s)){if(_r(i,0)!==0)break;if(x=i.suspendedLanes,(x&f)!==f){Lt(),i.pingedLanes|=i.suspendedLanes&x;break}i.timeoutHandle=fa(Ms.bind(null,i,Bt,Wi),s);break}Ms(i,Bt,Wi);break;case 4:if(us(i,f),(f&4194240)===f)break;for(s=i.eventTimes,x=-1;0<f;){var M=31-hi(f);k=1<<M,M=s[M],M>x&&(x=M),f&=~k}if(f=x,f=ct()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*Sm(f/1960))-f,10<f){i.timeoutHandle=fa(Ms.bind(null,i,Bt,Wi),f);break}Ms(i,Bt,Wi);break;case 5:Ms(i,Bt,Wi);break;default:throw Error(t(329))}}}return Ht(i,ct()),i.callbackNode===r?Td.bind(null,i):null}function ll(i,s){var r=Jn;return i.current.memoizedState.isDehydrated&&(Rs(i,s).flags|=256),i=co(i,s),i!==2&&(s=Bt,Bt=r,s!==null&&hl(s)),i}function hl(i){Bt===null?Bt=i:Bt.push.apply(Bt,i)}function Cm(i){for(var s=i;;){if(s.flags&16384){var r=s.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var f=0;f<r.length;f++){var x=r[f],k=x.getSnapshot;x=x.value;try{if(!ci(k(),x))return!1}catch{return!1}}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function us(i,s){for(s&=~nl,s&=~no,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var r=31-hi(s),f=1<<r;i[r]=-1,s&=~f}}function Ad(i){if((He&6)!==0)throw Error(t(327));dn();var s=_r(i,0);if((s&1)===0)return Ht(i,ct()),null;var r=co(i,s);if(i.tag!==0&&r===2){var f=Fo(i);f!==0&&(s=f,r=ll(i,f))}if(r===1)throw r=qn,Rs(i,0),us(i,s),Ht(i,ct()),r;if(r===6)throw Error(t(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Ms(i,Bt,Wi),Ht(i,ct()),null}function cl(i,s){var r=He;He|=1;try{return i(s)}finally{He=r,He===0&&(cn=ct()+500,Nr&&rs())}}function Ls(i){cs!==null&&cs.tag===0&&(He&6)===0&&dn();var s=He;He|=1;var r=ei.transition,f=Ue;try{if(ei.transition=null,Ue=1,i)return i()}finally{Ue=f,ei.transition=r,He=s,(He&6)===0&&rs()}}function dl(){Yt=hn.current,Qe(hn)}function Rs(i,s){i.finishedWork=null,i.finishedLanes=0;var r=i.timeoutHandle;if(r!==-1&&(i.timeoutHandle=-1,Qf(r)),pt!==null)for(r=pt.return;r!==null;){var f=r;switch(ba(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&Or();break;case 3:on(),Qe(Gt),Qe(Et),Ra();break;case 5:Ia(f);break;case 4:on();break;case 13:Qe(nt);break;case 19:Qe(nt);break;case 10:Ea(f.type._context);break;case 22:case 23:dl()}r=r.return}if(bt=i,pt=i=ps(i.current,null),xt=Yt=s,_t=0,qn=null,nl=no=Is=0,Bt=Jn=null,Ps!==null){for(s=0;s<Ps.length;s++)if(r=Ps[s],f=r.interleaved,f!==null){r.interleaved=null;var x=f.next,k=r.pending;if(k!==null){var M=k.next;k.next=x,f.next=M}r.pending=f}Ps=null}return i}function Id(i,s){do{var r=pt;try{if(Da(),Kr.current=Jr,Yr){for(var f=rt.memoizedState;f!==null;){var x=f.queue;x!==null&&(x.pending=null),f=f.next}Yr=!1}if(As=0,wt=vt=rt=null,jn=!1,$n=0,sl.current=null,r===null||r.return===null){_t=1,qn=s,pt=null;break}e:{var k=i,M=r.return,j=r,U=s;if(s=xt,j.flags|=32768,U!==null&&typeof U=="object"&&typeof U.then=="function"){var re=U,de=j,pe=de.tag;if((de.mode&1)===0&&(pe===0||pe===11||pe===15)){var ce=de.alternate;ce?(de.updateQueue=ce.updateQueue,de.memoizedState=ce.memoizedState,de.lanes=ce.lanes):(de.updateQueue=null,de.memoizedState=null)}var ye=id(M);if(ye!==null){ye.flags&=-257,sd(ye,M,j,k,s),ye.mode&1&&td(k,re,s),s=ye,U=re;var xe=s.updateQueue;if(xe===null){var Ee=new Set;Ee.add(U),s.updateQueue=Ee}else xe.add(U);break e}else{if((s&1)===0){td(k,re,s),ul();break e}U=Error(t(426))}}else if(tt&&j.mode&1){var dt=id(M);if(dt!==null){(dt.flags&65536)===0&&(dt.flags|=256),sd(dt,M,j,k,s),Ca(an(U,j));break e}}k=U=an(U,j),_t!==4&&(_t=2),Jn===null?Jn=[k]:Jn.push(k),k=M;do{switch(k.tag){case 3:k.flags|=65536,s&=-s,k.lanes|=s;var ee=Qc(k,U,s);Ec(k,ee);break e;case 1:j=U;var Y=k.type,te=k.stateNode;if((k.flags&128)===0&&(typeof Y.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(hs===null||!hs.has(te)))){k.flags|=65536,s&=-s,k.lanes|=s;var _e=ed(k,j,s);Ec(k,_e);break e}}k=k.return}while(k!==null)}Md(r)}catch(ke){s=ke,pt===r&&r!==null&&(pt=r=r.return);continue}break}while(!0)}function Ld(){var i=so.current;return so.current=Jr,i===null?Jr:i}function ul(){(_t===0||_t===3||_t===2)&&(_t=4),bt===null||(Is&268435455)===0&&(no&268435455)===0||us(bt,xt)}function co(i,s){var r=He;He|=2;var f=Ld();(bt!==i||xt!==s)&&(Wi=null,Rs(i,s));do try{xm();break}catch(x){Id(i,x)}while(!0);if(Da(),He=r,so.current=f,pt!==null)throw Error(t(261));return bt=null,xt=0,_t}function xm(){for(;pt!==null;)Rd(pt)}function Dm(){for(;pt!==null&&!Ot();)Rd(pt)}function Rd(i){var s=Nd(i.alternate,i,Yt);i.memoizedProps=i.pendingProps,s===null?Md(i):pt=s,sl.current=null}function Md(i){var s=i;do{var r=s.alternate;if(i=s.return,(s.flags&32768)===0){if(r=vm(r,s,Yt),r!==null){pt=r;return}}else{if(r=_m(r,s),r!==null){r.flags&=32767,pt=r;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{_t=6,pt=null;return}}if(s=s.sibling,s!==null){pt=s;return}pt=s=i}while(s!==null);_t===0&&(_t=5)}function Ms(i,s,r){var f=Ue,x=ei.transition;try{ei.transition=null,Ue=1,Em(i,s,r,f)}finally{ei.transition=x,Ue=f}return null}function Em(i,s,r,f){do dn();while(cs!==null);if((He&6)!==0)throw Error(t(327));r=i.finishedWork;var x=i.finishedLanes;if(r===null)return null;if(i.finishedWork=null,i.finishedLanes=0,r===i.current)throw Error(t(177));i.callbackNode=null,i.callbackPriority=0;var k=r.lanes|r.childLanes;if(of(i,k),i===bt&&(pt=bt=null,xt=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||oo||(oo=!0,zd(fr,function(){return dn(),null})),k=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||k){k=ei.transition,ei.transition=null;var M=Ue;Ue=1;var j=He;He|=4,sl.current=null,bm(i,r),xd(r,i),Uf(ua),yr=!!da,ua=da=null,i.current=r,ym(r),qp(),He=j,Ue=M,ei.transition=k}else i.current=r;if(oo&&(oo=!1,cs=i,ao=x),k=i.pendingLanes,k===0&&(hs=null),Qp(r.stateNode),Ht(i,ct()),s!==null)for(f=i.onRecoverableError,r=0;r<s.length;r++)x=s[r],f(x.value,{componentStack:x.stack,digest:x.digest});if(ro)throw ro=!1,i=ol,ol=null,i;return(ao&1)!==0&&i.tag!==0&&dn(),k=i.pendingLanes,(k&1)!==0?i===al?Zn++:(Zn=0,al=i):Zn=0,rs(),null}function dn(){if(cs!==null){var i=Sh(ao),s=ei.transition,r=Ue;try{if(ei.transition=null,Ue=16>i?16:i,cs===null)var f=!1;else{if(i=cs,cs=null,ao=0,(He&6)!==0)throw Error(t(331));var x=He;for(He|=4,Ce=i.current;Ce!==null;){var k=Ce,M=k.child;if((Ce.flags&16)!==0){var j=k.deletions;if(j!==null){for(var U=0;U<j.length;U++){var re=j[U];for(Ce=re;Ce!==null;){var de=Ce;switch(de.tag){case 0:case 11:case 15:Xn(8,de,k)}var pe=de.child;if(pe!==null)pe.return=de,Ce=pe;else for(;Ce!==null;){de=Ce;var ce=de.sibling,ye=de.return;if(wd(de),de===re){Ce=null;break}if(ce!==null){ce.return=ye,Ce=ce;break}Ce=ye}}}var xe=k.alternate;if(xe!==null){var Ee=xe.child;if(Ee!==null){xe.child=null;do{var dt=Ee.sibling;Ee.sibling=null,Ee=dt}while(Ee!==null)}}Ce=k}}if((k.subtreeFlags&2064)!==0&&M!==null)M.return=k,Ce=M;else e:for(;Ce!==null;){if(k=Ce,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Xn(9,k,k.return)}var ee=k.sibling;if(ee!==null){ee.return=k.return,Ce=ee;break e}Ce=k.return}}var Y=i.current;for(Ce=Y;Ce!==null;){M=Ce;var te=M.child;if((M.subtreeFlags&2064)!==0&&te!==null)te.return=M,Ce=te;else e:for(M=Y;Ce!==null;){if(j=Ce,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:io(9,j)}}catch(ke){at(j,j.return,ke)}if(j===M){Ce=null;break e}var _e=j.sibling;if(_e!==null){_e.return=j.return,Ce=_e;break e}Ce=j.return}}if(He=x,rs(),Ci&&typeof Ci.onPostCommitFiberRoot=="function")try{Ci.onPostCommitFiberRoot(mr,i)}catch{}f=!0}return f}finally{Ue=r,ei.transition=s}}return!1}function Od(i,s,r){s=an(r,s),s=Qc(i,s,1),i=as(i,s,1),s=Lt(),i!==null&&(Sn(i,1,s),Ht(i,s))}function at(i,s,r){if(i.tag===3)Od(i,i,r);else for(;s!==null;){if(s.tag===3){Od(s,i,r);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(hs===null||!hs.has(f))){i=an(r,i),i=ed(s,i,1),s=as(s,i,1),i=Lt(),s!==null&&(Sn(s,1,i),Ht(s,i));break}}s=s.return}}function km(i,s,r){var f=i.pingCache;f!==null&&f.delete(s),s=Lt(),i.pingedLanes|=i.suspendedLanes&r,bt===i&&(xt&r)===r&&(_t===4||_t===3&&(xt&130023424)===xt&&500>ct()-rl?Rs(i,0):nl|=r),Ht(i,s)}function Gd(i,s){s===0&&((i.mode&1)===0?s=1:(s=vr,vr<<=1,(vr&130023424)===0&&(vr=4194304)));var r=Lt();i=Bi(i,s),i!==null&&(Sn(i,s,r),Ht(i,r))}function Pm(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Gd(i,r)}function Tm(i,s){var r=0;switch(i.tag){case 13:var f=i.stateNode,x=i.memoizedState;x!==null&&(r=x.retryLane);break;case 19:f=i.stateNode;break;default:throw Error(t(314))}f!==null&&f.delete(s),Gd(i,r)}var Nd;Nd=function(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps||Gt.current)zt=!0;else{if((i.lanes&r)===0&&(s.flags&128)===0)return zt=!1,gm(i,s,r);zt=(i.flags&131072)!==0}else zt=!1,tt&&(s.flags&1048576)!==0&&gc(s,Br,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;eo(i,s),i=s.pendingProps;var x=Zs(s,Et.current);rn(s,r),x=Ga(null,s,f,i,x,r);var k=Na();return s.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Nt(f)?(k=!0,Gr(s)):k=!1,s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,Ta(s),x.updater=Zr,s.stateNode=x,x._reactInternals=s,Va(s,f,i,r),s=Ka(null,s,f,!0,k,r)):(s.tag=0,tt&&k&&wa(s),It(null,s,x,r),s=s.child),s;case 16:f=s.elementType;e:{switch(eo(i,s),i=s.pendingProps,x=f._init,f=x(f._payload),s.type=f,x=s.tag=Im(f),i=ui(f,i),x){case 0:s=Ua(null,s,f,i,r);break e;case 1:s=hd(null,s,f,i,r);break e;case 11:s=nd(null,s,f,i,r);break e;case 14:s=rd(null,s,f,ui(f.type,i),r);break e}throw Error(t(306,f,""))}return s;case 0:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:ui(f,x),Ua(i,s,f,x,r);case 1:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:ui(f,x),hd(i,s,f,x,r);case 3:e:{if(cd(s),i===null)throw Error(t(387));f=s.pendingProps,k=s.memoizedState,x=k.element,Dc(i,s),$r(s,f,null,r);var M=s.memoizedState;if(f=M.element,k.isDehydrated)if(k={element:f,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},s.updateQueue.baseState=k,s.memoizedState=k,s.flags&256){x=an(Error(t(423)),s),s=dd(i,s,f,r,x);break e}else if(f!==x){x=an(Error(t(424)),s),s=dd(i,s,f,r,x);break e}else for(Kt=is(s.stateNode.containerInfo.firstChild),Ut=s,tt=!0,di=null,r=Cc(s,null,f,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(tn(),f===x){s=Fi(i,s,r);break e}It(i,s,f,r)}s=s.child}return s;case 5:return Pc(s),i===null&&Sa(s),f=s.type,x=s.pendingProps,k=i!==null?i.memoizedProps:null,M=x.children,pa(f,x)?M=null:k!==null&&pa(f,k)&&(s.flags|=32),ld(i,s),It(i,s,M,r),s.child;case 6:return i===null&&Sa(s),null;case 13:return ud(i,s,r);case 4:return Aa(s,s.stateNode.containerInfo),f=s.pendingProps,i===null?s.child=sn(s,null,f,r):It(i,s,f,r),s.child;case 11:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:ui(f,x),nd(i,s,f,x,r);case 7:return It(i,s,s.pendingProps,r),s.child;case 8:return It(i,s,s.pendingProps.children,r),s.child;case 12:return It(i,s,s.pendingProps.children,r),s.child;case 10:e:{if(f=s.type._context,x=s.pendingProps,k=s.memoizedProps,M=x.value,qe(Wr,f._currentValue),f._currentValue=M,k!==null)if(ci(k.value,M)){if(k.children===x.children&&!Gt.current){s=Fi(i,s,r);break e}}else for(k=s.child,k!==null&&(k.return=s);k!==null;){var j=k.dependencies;if(j!==null){M=k.child;for(var U=j.firstContext;U!==null;){if(U.context===f){if(k.tag===1){U=Hi(-1,r&-r),U.tag=2;var re=k.updateQueue;if(re!==null){re=re.shared;var de=re.pending;de===null?U.next=U:(U.next=de.next,de.next=U),re.pending=U}}k.lanes|=r,U=k.alternate,U!==null&&(U.lanes|=r),ka(k.return,r,s),j.lanes|=r;break}U=U.next}}else if(k.tag===10)M=k.type===s.type?null:k.child;else if(k.tag===18){if(M=k.return,M===null)throw Error(t(341));M.lanes|=r,j=M.alternate,j!==null&&(j.lanes|=r),ka(M,r,s),M=k.sibling}else M=k.child;if(M!==null)M.return=k;else for(M=k;M!==null;){if(M===s){M=null;break}if(k=M.sibling,k!==null){k.return=M.return,M=k;break}M=M.return}k=M}It(i,s,x.children,r),s=s.child}return s;case 9:return x=s.type,f=s.pendingProps.children,rn(s,r),x=Zt(x),f=f(x),s.flags|=1,It(i,s,f,r),s.child;case 14:return f=s.type,x=ui(f,s.pendingProps),x=ui(f.type,x),rd(i,s,f,x,r);case 15:return od(i,s,s.type,s.pendingProps,r);case 17:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:ui(f,x),eo(i,s),s.tag=1,Nt(f)?(i=!0,Gr(s)):i=!1,rn(s,r),Jc(s,f,x),Va(s,f,x,r),Ka(null,s,f,!0,i,r);case 19:return fd(i,s,r);case 22:return ad(i,s,r)}throw Error(t(156,s.tag))};function zd(i,s){return Xe(i,s)}function Am(i,s,r,f){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(i,s,r,f){return new Am(i,s,r,f)}function pl(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Im(i){if(typeof i=="function")return pl(i)?1:0;if(i!=null){if(i=i.$$typeof,i===V)return 11;if(i===W)return 14}return 2}function ps(i,s){var r=i.alternate;return r===null?(r=ti(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&14680064,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r}function uo(i,s,r,f,x,k){var M=2;if(f=i,typeof i=="function")pl(i)&&(M=1);else if(typeof i=="string")M=5;else e:switch(i){case A:return Os(r.children,x,k,s);case E:M=8,x|=8;break;case I:return i=ti(12,r,s,x|2),i.elementType=I,i.lanes=k,i;case F:return i=ti(13,r,s,x),i.elementType=F,i.lanes=k,i;case q:return i=ti(19,r,s,x),i.elementType=q,i.lanes=k,i;case ie:return po(r,x,k,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case z:M=10;break e;case H:M=9;break e;case V:M=11;break e;case W:M=14;break e;case K:M=16,f=null;break e}throw Error(t(130,i==null?i:typeof i,""))}return s=ti(M,r,s,x),s.elementType=i,s.type=f,s.lanes=k,s}function Os(i,s,r,f){return i=ti(7,i,f,s),i.lanes=r,i}function po(i,s,r,f){return i=ti(22,i,f,s),i.elementType=ie,i.lanes=r,i.stateNode={isHidden:!1},i}function fl(i,s,r){return i=ti(6,i,null,s),i.lanes=r,i}function ml(i,s,r){return s=ti(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function Lm(i,s,r,f,x){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=f,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function gl(i,s,r,f,x,k,M,j,U){return i=new Lm(i,s,r,j,U),s===1?(s=1,k===!0&&(s|=8)):s=0,k=ti(3,null,null,s),i.current=k,k.stateNode=i,k.memoizedState={element:f,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ta(k),i}function Rm(i,s,r){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:f==null?null:""+f,children:i,containerInfo:s,implementation:r}}function Bd(i){if(!i)return ns;i=i._reactInternals;e:{if(ne(i)!==i||i.tag!==1)throw Error(t(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Nt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(t(171))}if(i.tag===1){var r=i.type;if(Nt(r))return pc(i,r,s)}return s}function Hd(i,s,r,f,x,k,M,j,U){return i=gl(r,f,!0,i,x,k,M,j,U),i.context=Bd(null),r=i.current,f=Lt(),x=ds(r),k=Hi(f,x),k.callback=s??null,as(r,k,x),i.current.lanes=x,Sn(i,x,f),Ht(i,f),i}function fo(i,s,r,f){var x=s.current,k=Lt(),M=ds(x);return r=Bd(r),s.context===null?s.context=r:s.pendingContext=r,s=Hi(k,M),s.payload={element:i},f=f===void 0?null:f,f!==null&&(s.callback=f),i=as(x,s,M),i!==null&&(mi(i,x,M,k),jr(i,x,M)),M}function mo(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Fd(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function vl(i,s){Fd(i,s),(i=i.alternate)&&Fd(i,s)}function Mm(){return null}var Wd=typeof reportError=="function"?reportError:function(i){console.error(i)};function _l(i){this._internalRoot=i}go.prototype.render=_l.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(t(409));fo(i,s,null,null)},go.prototype.unmount=_l.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Ls(function(){fo(null,i,null,null)}),s[Oi]=null}};function go(i){this._internalRoot=i}go.prototype.unstable_scheduleHydration=function(i){if(i){var s=Dh();i={blockedOn:null,target:i,priority:s};for(var r=0;r<Qi.length&&s!==0&&s<Qi[r].priority;r++);Qi.splice(r,0,i),r===0&&Ph(i)}};function wl(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function vo(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Vd(){}function Om(i,s,r,f,x){if(x){if(typeof f=="function"){var k=f;f=function(){var re=mo(M);k.call(re)}}var M=Hd(s,f,i,0,null,!1,!1,"",Vd);return i._reactRootContainer=M,i[Oi]=M.current,Gn(i.nodeType===8?i.parentNode:i),Ls(),M}for(;x=i.lastChild;)i.removeChild(x);if(typeof f=="function"){var j=f;f=function(){var re=mo(U);j.call(re)}}var U=gl(i,0,!1,null,null,!1,!1,"",Vd);return i._reactRootContainer=U,i[Oi]=U.current,Gn(i.nodeType===8?i.parentNode:i),Ls(function(){fo(s,U,r,f)}),U}function _o(i,s,r,f,x){var k=r._reactRootContainer;if(k){var M=k;if(typeof x=="function"){var j=x;x=function(){var U=mo(M);j.call(U)}}fo(s,M,i,x)}else M=Om(r,s,i,x,f);return mo(M)}Ch=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var r=yn(s.pendingLanes);r!==0&&(Vo(s,r|1),Ht(s,ct()),(He&6)===0&&(cn=ct()+500,rs()))}break;case 13:Ls(function(){var f=Bi(i,1);if(f!==null){var x=Lt();mi(f,i,1,x)}}),vl(i,1)}},jo=function(i){if(i.tag===13){var s=Bi(i,134217728);if(s!==null){var r=Lt();mi(s,i,134217728,r)}vl(i,134217728)}},xh=function(i){if(i.tag===13){var s=ds(i),r=Bi(i,s);if(r!==null){var f=Lt();mi(r,i,s,f)}vl(i,s)}},Dh=function(){return Ue},Eh=function(i,s){var r=Ue;try{return Ue=i,s()}finally{Ue=r}},Fs=function(i,s,r){switch(s){case"input":if(Ae(i,r),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<r.length;s++){var f=r[s];if(f!==i&&f.form===i.form){var x=Mr(f);if(!x)throw Error(t(90));fe(f),Ae(f,x)}}}break;case"textarea":Si(i,r);break;case"select":s=r.value,s!=null&&st(i,!!r.multiple,s,!1)}},Yi=cl,Ws=Ls;var Gm={usingClientEntryPoint:!1,Events:[Bn,qs,Mr,bs,_n,cl]},Qn={findFiberByHostInstance:xs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nm={bundleType:Qn.bundleType,version:Qn.version,rendererPackageName:Qn.rendererPackageName,rendererConfig:Qn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:D.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Oe(i),i===null?null:i.stateNode},findFiberByHostInstance:Qn.findFiberByHostInstance||Mm,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 wo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wo.isDisabled&&wo.supportsFiber)try{mr=wo.inject(Nm),Ci=wo}catch{}}return Ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gm,Ft.createPortal=function(i,s){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wl(s))throw Error(t(200));return Rm(i,s,null,r)},Ft.createRoot=function(i,s){if(!wl(i))throw Error(t(299));var r=!1,f="",x=Wd;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=gl(i,1,!1,null,null,r,!1,f,x),i[Oi]=s.current,Gn(i.nodeType===8?i.parentNode:i),new _l(s)},Ft.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(t(188)):(i=Object.keys(i).join(","),Error(t(268,i)));return i=Oe(s),i=i===null?null:i.stateNode,i},Ft.flushSync=function(i){return Ls(i)},Ft.hydrate=function(i,s,r){if(!vo(s))throw Error(t(200));return _o(null,i,s,!0,r)},Ft.hydrateRoot=function(i,s,r){if(!wl(i))throw Error(t(405));var f=r!=null&&r.hydratedSources||null,x=!1,k="",M=Wd;if(r!=null&&(r.unstable_strictMode===!0&&(x=!0),r.identifierPrefix!==void 0&&(k=r.identifierPrefix),r.onRecoverableError!==void 0&&(M=r.onRecoverableError)),s=Hd(s,null,i,1,r??null,x,!1,k,M),i[Oi]=s.current,Gn(i),f)for(i=0;i<f.length;i++)r=f[i],x=r._getVersion,x=x(r._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[r,x]:s.mutableSourceEagerHydrationData.push(r,x);return new go(s)},Ft.render=function(i,s,r){if(!vo(s))throw Error(t(200));return _o(null,i,s,!1,r)},Ft.unmountComponentAtNode=function(i){if(!vo(i))throw Error(t(40));return i._reactRootContainer?(Ls(function(){_o(null,null,i,!1,function(){i._reactRootContainer=null,i[Oi]=null})}),!0):!1},Ft.unstable_batchedUpdates=cl,Ft.unstable_renderSubtreeIntoContainer=function(i,s,r,f){if(!vo(r))throw Error(t(200));if(i==null||i._reactInternals===void 0)throw Error(t(38));return _o(i,s,r,!1,f)},Ft.version="18.3.1-next-f1338f8080-20240426",Ft}var Jd;function $u(){if(Jd)return Sl.exports;Jd=1;function p(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(p)}catch(e){console.error(e)}}return p(),Sl.exports=jm(),Sl.exports}var Zd;function $m(){if(Zd)return bo;Zd=1;var p=$u();return bo.createRoot=p.createRoot,bo.hydrateRoot=p.hydrateRoot,bo}var Um=$m();const Rl={"needs-input":"●",working:"●",done:"●",idle:"○",restorable:"○"},Ml={"needs-input":"text-garage-amber",done:"text-garage-green",working:"text-garage-dim",idle:"text-garage-faint",restorable:"text-garage-faint"},Qd={"needs-input":"needs input — Claude is waiting on you",done:"responded — finished since you last looked",working:"running — Claude is working",idle:"idle — waiting for your next prompt",restorable:"restorable — tmux died, the conversation can be resumed"};function Uu(p){return Rl[p]??Rl.idle}function Ku(p){return Qd[p]??Qd.idle}function Yu(p){return Ml[p]??Ml.idle}function Xu(p){if(p==null||Number.isNaN(p))return"—";const e=Math.max(0,Date.now()-p),t=Math.floor(e/1e3);if(t<3600){const o=Math.floor(t/60),h=t%60;return`${o}:${String(h).padStart(2,"0")}`}if(t<86400){const o=Math.floor(t/3600),h=Math.floor(t%3600/60);return`${o}h ${String(h).padStart(2,"0")}m`}return`${Math.floor(t/86400)}d`}function qu(p=1e3){const[e,t]=Z.useState(0);return Z.useEffect(()=>{const n=setInterval(()=>t(o=>o+1),p);return()=>clearInterval(n)},[p]),e}const zs={"content-type":"application/json"};async function yi(p){try{return await p.json()}catch{return{}}}async function eu(){const p=await fetch("/api/workspaces");if(!p.ok)throw new Error(`GET /api/workspaces failed (${p.status})`);return p.json()}async function Ao(){const p=await fetch("/api/sessions");if(!p.ok)throw new Error(`GET /api/sessions failed (${p.status})`);return p.json()}async function Km(p,e){const t=await fetch("/api/workspaces",{method:"PUT",headers:zs,body:JSON.stringify({name:p,dir:e})}),n=await yi(t);if(!t.ok)throw new Error(n.error||`could not register workspace (${t.status})`);return n}async function Ju(p,e,{worktree:t}={}){const n=await fetch("/api/sessions",{method:"POST",headers:zs,body:JSON.stringify(t?{workspace:p,label:e,worktree:!0}:{workspace:p,label:e})}),o=await yi(n);if(!n.ok)throw n.status===404?new Error(`unknown workspace "${p}"`):n.status===409?new Error(`session "${e}" already exists in ${p}`):new Error(o.error||`could not create session (${n.status})`);return o}async function Ym(p,e){const t=e?`?sessionId=${encodeURIComponent(e)}`:"",n=await fetch(`/api/diff/${encodeURIComponent(p)}${t}`);if(!n.ok){const o=await yi(n);throw n.status===404?new Error(`no diff — "${p}" isn't registered; add a workspace named "${p}" pointing at its project folder to enable diffs`):new Error(o.error||`GET /api/diff/${p} failed (${n.status})`)}return n.json()}async function ko(p,e,t){const o=await fetch("/api/open-editor",{method:"POST",headers:zs,body:JSON.stringify(e?{workspace:p,file:e,line:t??1}:{workspace:p})}),h=await yi(o);if(!o.ok)throw new Error(h.error||`could not open editor (${o.status})`);return h}async function Ol(p){const e=await fetch("/api/sessions/restore",{method:"POST",headers:zs,body:JSON.stringify(p)}),t=await yi(e);if(!e.ok)throw new Error(t.error||t.reason||`could not restore session (${e.status})`);return t}async function Xm(){const p=await fetch("/api/pick-directory",{method:"POST"}),e=await yi(p);if(!p.ok)throw new Error(e.error||`directory picker unavailable (${p.status})`);return e}async function qm(p,e){const t=await fetch(`/api/workspaces/${encodeURIComponent(p)}`,{method:"PATCH",headers:zs,body:JSON.stringify({name:e})}),n=await yi(t);if(!t.ok)throw t.status===404?new Error(n.error||`unknown workspace "${p}"`):t.status===409?new Error(n.error||`workspace name already taken: ${e}`):new Error(n.error||`could not rename workspace (${t.status})`);return n}async function Jm(){const p=await fetch("/api/hooks/install",{method:"POST"}),e=await yi(p);if(!p.ok)throw p.status===404?new Error("the running daemon is an older version — restart claude-garage (sessions survive; tmux owns them) and try again"):new Error(e.error||`hook install failed (${p.status})`);return e}function Zm(p,e){fetch("/api/ui/visibility",{method:"POST",headers:zs,body:JSON.stringify({clientId:p,visible:e}),keepalive:!0}).catch(()=>{})}async function Qm(p,{killSessions:e}={}){var h;const t=e?"?sessions=kill":"",n=await fetch(`/api/workspaces/${encodeURIComponent(p)}${t}`,{method:"DELETE"});if(n.status===404)throw new Error(`unknown workspace: ${p}`);if(!n.ok)throw new Error(`delete failed (${n.status})`);const o=n.status===204?{}:await yi(n);if((h=o.failedSessions)!=null&&h.length)throw new Error(`${o.failedSessions.length} session(s) failed to close — workspace unregistered anyway`);return o}async function eg(p){const e=await fetch(`/api/sessions/${encodeURIComponent(p)}`,{method:"DELETE"}),t=await yi(e);if(!e.ok)throw e.status===403?new Error(t.error||"refusing to close a non-garage session"):e.status===404?new Error(t.error||`no such session: ${p}`):new Error(t.error||`could not close session (${e.status})`);return t}async function tg(p,e){const t=await fetch("/api/worktrees/finish",{method:"POST",headers:zs,body:JSON.stringify({worktree:p,action:e})}),n=await yi(t);if(!t.ok)throw t.status===409?new Error(n.error||"merge conflict — resolve manually"):new Error(n.error||`could not finish worktree (${t.status})`);return n}const tu=p=>`garage-wt-default:${p}`;function ig({workspaceName:p,onCreated:e}){const[t,n]=Z.useState(!1),[o,h]=Z.useState(""),[w,a]=Z.useState(null),[l,u]=Z.useState(!1),[d,c]=Z.useState(()=>{try{return localStorage.getItem(tu(p))==="1"}catch{return!1}});function b(){n(!1),h(""),a(null),u(!1)}async function C(S){S.preventDefault();const y=o.trim();if(!(!y||l)){u(!0),a(null);try{await Ju(p,y,{worktree:d});try{localStorage.setItem(tu(p),d?"1":"0")}catch{}b(),e()}catch(g){a(g.message),u(!1)}}}return t?N.jsxs("form",{onSubmit:C,className:"flex shrink-0 flex-col gap-1",children:[N.jsxs("div",{className:"flex items-center gap-1.5",children:[N.jsx("input",{autoFocus:!0,value:o,onChange:S=>h(S.target.value),onKeyDown:S=>{S.stopPropagation(),S.key==="Escape"&&b()},placeholder:"label",className:"w-16 rounded-md border border-garage-line bg-garage-bg px-2 py-1 text-[13px] text-garage-ink outline-none focus:border-garage-dim focus:outline-none"}),N.jsxs("label",{title:"spawn in an isolated git worktree (garage/<label> branch)",className:"flex shrink-0 items-center gap-1 text-xs text-garage-dim",children:[N.jsx("input",{type:"checkbox",checked:d,onChange:S=>c(S.target.checked),onKeyDown:S=>S.stopPropagation(),className:"h-3 w-3 accent-garage-dim"}),"worktree"]}),N.jsx("button",{type:"submit",disabled:l,title:"create session",className:"rounded-md px-1.5 py-1 text-garage-green hover:bg-garage-sel disabled:opacity-40",children:"↵"})]}),w&&N.jsx("p",{role:"alert",className:"max-w-[200px] whitespace-normal text-xs leading-tight text-garage-red",children:w})]}):N.jsx("button",{type:"button",onClick:()=>n(!0),title:`new session in ${p}`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"+"})}const sg=14;function ng({groups:p,focusedWorkspace:e,focusedSessionId:t,onSelectWorkspace:n,onSelectSession:o,onSessionCreated:h,onOpenRoot:w,onBlurChrome:a,onSessionsRestored:l,onWorkspaceRenamed:u,hiddenIds:d,columnActive:c,onActivateColumn:b,viewsByWorkspace:C,onSelectView:S}){qu();const[y,g]=Z.useState(()=>new Set),[_,m]=Z.useState(null),[v,D]=Z.useState(null),[P,T]=Z.useState(null);function A(W){T(W),setTimeout(()=>T(K=>K===W?null:K),4e3)}async function E(W,K){T(null);try{await Qm(W,{killSessions:K}),u==null||u(W,null)}catch(ie){m(ie.message)}}function I(W){D({workspaceName:W,value:W,error:null,busy:!1})}function z(){D(null)}async function H(){if(!v||v.busy)return;const W=v.workspaceName,K=v.value.trim();if(!K||K===W){D(null);return}D(ie=>({...ie,busy:!0,error:null}));try{await qm(W,K),D(null),u==null||u(W,K)}catch(ie){D(J=>({...J,busy:!1,error:ie.message}))}}function V(W,K){g(ie=>{const J=new Set(ie);for(const L of W)K?J.add(L):J.delete(L);return J})}async function F(W){V([W],!0),m(null);try{await Ol({id:W}),l==null||l()}catch(K){m(K.message)}finally{V([W],!1)}}async function q(W){V(W,!0),m(null);const ie=(await Promise.allSettled(W.map(J=>Ol({id:J})))).filter(J=>J.status==="rejected");ie.length>0&&m(`${ie.length} of ${W.length} restore(s) failed`),l==null||l(),V(W,!1)}return N.jsxs("nav",{onMouseDown:a,onMouseDownCapture:b,"aria-label":"Workspaces",className:"min-h-0 overflow-y-auto border-r border-garage-line bg-garage-panel py-2",children:[p.length===0&&N.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no workspaces yet"}),p.map((W,K)=>{var oe;const ie=W.name===e,J=W.sessions.filter(ae=>ae.status==="restorable").map(ae=>ae.id),L=W.sessions.length>0&&J.length===W.sessions.length,B=J.some(ae=>y.has(ae)),R=W.depth??0,G=(v==null?void 0:v.workspaceName)===W.name,X=W.branch??((oe=W.sessions.find(ae=>ae.branch))==null?void 0:oe.branch)??null;return N.jsxs("div",{className:"mb-1",style:{marginLeft:R*sg},children:[N.jsxs("div",{className:`group/ws relative flex items-center gap-1 px-3 pt-4 pb-1.5 ${ie?"bg-garage-sel":""}`,children:[G?N.jsxs("form",{onSubmit:ae=>{ae.preventDefault(),H()},className:"flex min-w-0 flex-1 items-center gap-2",children:[K<9&&N.jsx("span",{className:"font-mono text-[11px] text-garage-faint",children:K+1}),N.jsx("input",{autoFocus:!0,value:v.value,disabled:v.busy,onChange:ae=>D(me=>me&&{...me,value:ae.target.value}),onKeyDown:ae=>{ae.stopPropagation(),ae.key==="Escape"&&z()},onBlur:z,className:"min-w-0 flex-1 rounded-md border border-garage-line bg-garage-bg px-2 py-1 text-[13px] text-garage-ink outline-none focus:border-garage-dim focus:outline-none"}),v.error&&N.jsx("span",{className:"shrink-0 truncate text-xs text-garage-red",title:v.error,children:v.error})]}):N.jsxs("button",{type:"button",onClick:()=>n(W.name),className:"flex min-w-0 flex-1 flex-col gap-0.5 text-left",children:[N.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[K<9&&N.jsx("span",{className:"shrink-0 font-mono text-[11px] text-garage-faint",children:K+1}),N.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-garage-ink",children:W.name}),!W.registered&&N.jsx("span",{className:"shrink-0 text-xs text-garage-faint",title:"workspace not registered — derived from session id",children:"?"})]}),N.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-garage-faint",children:[N.jsxs("span",{className:"shrink-0",children:[W.sessions.length," session",W.sessions.length===1?"":"s"]}),X&&N.jsx("span",{"aria-hidden":"true",children:"·"}),X&&N.jsxs("span",{className:"truncate",title:X,children:["⎇ ",X]})]})]}),!G&&N.jsxs("div",{className:"absolute right-2 top-3 z-10 flex shrink-0 items-center gap-0.5 rounded-md bg-garage-panel/95 px-1 py-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/ws:opacity-100",children:[W.registered&&N.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>I(W.name),title:`rename ${W.name}`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"✎"}),W.registered&&N.jsx("button",{type:"button",onClick:()=>w(W.name),title:`open ${W.name} root in editor`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"⧉"}),W.registered&&P!==W.name&&N.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>A(W.name),title:`remove ${W.name} — click to choose: unregister only, or close all sessions too`,className:"shrink-0 rounded-md p-1 text-xs text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"unreg"}),W.registered&&P===W.name&&N.jsxs(N.Fragment,{children:[N.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>E(W.name,!1),title:`unregister ${W.name} only — sessions keep running in tmux and reappear as an unregistered group`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel",children:"unreg"}),N.jsxs("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>E(W.name,!0),title:`close all ${W.sessions.filter(ae=>ae.status!=="restorable").length} live session(s) — kills their tmux sessions — then unregister ${W.name}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-red hover:bg-garage-red/10",children:["kill ",W.sessions.filter(ae=>ae.status!=="restorable").length,"×"]})]}),N.jsx(ig,{workspaceName:W.name,onCreated:h})]}),!G&&L&&N.jsx("button",{type:"button",onClick:()=>q(J),disabled:B,title:`restore all sessions in ${W.name}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore all"})]}),N.jsxs("div",{className:"ml-3 border-l border-garage-line pl-2",children:[(()=>{const ae=C==null?void 0:C[W.name],me=((ae==null?void 0:ae.views.length)??0)>1,$=O=>{const le=O.id===t,se=O.status==="restorable",ge=O.status==="needs-input",fe=(d==null?void 0:d.has(O.id))??!1,Me=y.has(O.id);return N.jsxs("div",{"data-dim-zone":!0,className:`mx-1.5 flex items-center gap-2.5 rounded-md px-3 py-2 text-[13px] ${le?"bg-garage-sel":"hover:bg-garage-sel"} ${ge?"bg-garage-amber/5":""} ${se||fe?"opacity-60":""} ${c?"dim-focused":""} ${ge?"dim-exempt":""}`,children:[N.jsxs("button",{type:"button",onClick:()=>o(W.name,O.id),"aria-current":le,title:fe?`${O.label} — hidden, click to bring back`:void 0,className:"flex min-w-0 flex-1 flex-col gap-0.5 text-left",children:[N.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[N.jsx("span",{className:`shrink-0 ${Yu(O.status)}`,title:Ku(O.status),children:Uu(O.status)}),N.jsx("span",{className:`truncate text-garage-ink ${le?"font-semibold":""} ${fe?"italic text-garage-faint":""}`,children:O.label}),fe&&N.jsx("span",{className:"shrink-0 text-xs text-garage-faint",children:"hidden"}),N.jsx("span",{className:`ml-auto shrink-0 font-mono text-xs tabular-nums ${ge?"font-semibold text-garage-amber":"text-garage-faint"}`,children:Xu(O.since)})]}),O.branch&&N.jsxs("span",{className:"min-w-0 truncate pl-[18px] font-mono text-[11px] text-garage-faint",title:O.branch,children:["⎇ ",O.branch]})]}),se&&N.jsx("button",{type:"button",onClick:()=>F(O.id),disabled:Me,title:`restore ${O.label}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore"})]},O.id)};return me?ae.views.map(O=>N.jsxs("div",{children:[N.jsxs("button",{type:"button",onClick:()=>S==null?void 0:S(W.name,O.name),title:`show view "${O.name}" in the grid`,className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs hover:bg-garage-sel",children:[N.jsx("span",{className:"text-garage-faint",children:"▸"}),N.jsx("span",{className:O.name===ae.focused?"font-semibold text-garage-ink":"text-garage-dim",children:O.name}),O.needsCount>0&&N.jsx("span",{className:"text-garage-amber",children:"●"}),N.jsxs("span",{className:"ml-auto text-garage-faint",children:[O.sessions.length,"×"]})]}),N.jsx("div",{className:"ml-2",children:O.sessions.map($)})]},O.name)):W.sessions.map($)})(),W.sessions.length===0&&N.jsx("p",{className:"px-2 py-1 text-xs text-garage-faint",children:"no sessions"})]})]},W.name)}),_&&N.jsx("p",{className:"px-3 py-1 text-xs text-garage-red",title:_,children:_})]})}var rg={};/**
40
+ `+k.stack}return{value:i,source:s,stack:x,digest:null}}function ja(i,s,r){return{value:i,source:null,stack:r??null,digest:s??null}}function $a(i,s){try{console.error(s.value)}catch(r){setTimeout(function(){throw r})}}var pm=typeof WeakMap=="function"?WeakMap:Map;function Qc(i,s,r){r=Hi(-1,r),r.tag=3,r.payload={element:null};var f=s.value;return r.callback=function(){ro||(ro=!0,ol=f),$a(i,s)},r}function ed(i,s,r){r=Hi(-1,r),r.tag=3;var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var x=s.value;r.payload=function(){return f(x)},r.callback=function(){$a(i,s)}}var k=i.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(r.callback=function(){$a(i,s),typeof f!="function"&&(hs===null?hs=new Set([this]):hs.add(this));var M=s.stack;this.componentDidCatch(s.value,{componentStack:M!==null?M:""})}),r}function td(i,s,r){var f=i.pingCache;if(f===null){f=i.pingCache=new pm;var x=new Set;f.set(s,x)}else x=f.get(s),x===void 0&&(x=new Set,f.set(s,x));x.has(r)||(x.add(r),i=km.bind(null,i,s,r),s.then(i,i))}function id(i){do{var s;if((s=i.tag===13)&&(s=i.memoizedState,s=s!==null?s.dehydrated!==null:!0),s)return i;i=i.return}while(i!==null);return null}function sd(i,s,r,f,x){return(i.mode&1)===0?(i===s?i.flags|=65536:(i.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(s=Hi(-1,1),s.tag=2,as(r,s,1))),r.lanes|=1),i):(i.flags|=65536,i.lanes=x,i)}var fm=D.ReactCurrentOwner,zt=!1;function It(i,s,r,f){s.child=i===null?Cc(s,null,r,f):sn(s,i.child,r,f)}function nd(i,s,r,f,x){r=r.render;var k=s.ref;return rn(s,x),f=Ga(i,s,r,f,k,x),r=Na(),i!==null&&!zt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~x,Fi(i,s,x)):(tt&&r&&wa(s),s.flags|=1,It(i,s,f,x),s.child)}function rd(i,s,r,f,x){if(i===null){var k=r.type;return typeof k=="function"&&!pl(k)&&k.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(s.tag=15,s.type=k,od(i,s,k,f,x)):(i=uo(r.type,null,f,s,s.mode,x),i.ref=s.ref,i.return=s,s.child=i)}if(k=i.child,(i.lanes&x)===0){var M=k.memoizedProps;if(r=r.compare,r=r!==null?r:Rn,r(M,f)&&i.ref===s.ref)return Fi(i,s,x)}return s.flags|=1,i=ps(k,f),i.ref=s.ref,i.return=s,s.child=i}function od(i,s,r,f,x){if(i!==null){var k=i.memoizedProps;if(Rn(k,f)&&i.ref===s.ref)if(zt=!1,s.pendingProps=f=k,(i.lanes&x)!==0)(i.flags&131072)!==0&&(zt=!0);else return s.lanes=i.lanes,Fi(i,s,x)}return Ua(i,s,r,f,x)}function ad(i,s,r){var f=s.pendingProps,x=f.children,k=i!==null?i.memoizedState:null;if(f.mode==="hidden")if((s.mode&1)===0)s.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(hn,Yt),Yt|=r;else{if((r&1073741824)===0)return i=k!==null?k.baseLanes|r:r,s.lanes=s.childLanes=1073741824,s.memoizedState={baseLanes:i,cachePool:null,transitions:null},s.updateQueue=null,qe(hn,Yt),Yt|=i,null;s.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=k!==null?k.baseLanes:r,qe(hn,Yt),Yt|=f}else k!==null?(f=k.baseLanes|r,s.memoizedState=null):f=r,qe(hn,Yt),Yt|=f;return It(i,s,x,r),s.child}function ld(i,s){var r=s.ref;(i===null&&r!==null||i!==null&&i.ref!==r)&&(s.flags|=512,s.flags|=2097152)}function Ua(i,s,r,f,x){var k=Nt(r)?Es:Et.current;return k=Zs(s,k),rn(s,x),r=Ga(i,s,r,f,k,x),f=Na(),i!==null&&!zt?(s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~x,Fi(i,s,x)):(tt&&f&&wa(s),s.flags|=1,It(i,s,r,x),s.child)}function hd(i,s,r,f,x){if(Nt(r)){var k=!0;Gr(s)}else k=!1;if(rn(s,x),s.stateNode===null)eo(i,s),Jc(s,r,f),Va(s,r,f,x),f=!0;else if(i===null){var M=s.stateNode,j=s.memoizedProps;M.props=j;var U=M.context,re=r.contextType;typeof re=="object"&&re!==null?re=Zt(re):(re=Nt(r)?Es:Et.current,re=Zs(s,re));var de=r.getDerivedStateFromProps,pe=typeof de=="function"||typeof M.getSnapshotBeforeUpdate=="function";pe||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(j!==f||U!==re)&&Zc(s,M,f,re),os=!1;var ce=s.memoizedState;M.state=ce,$r(s,f,M,x),U=s.memoizedState,j!==f||ce!==U||Gt.current||os?(typeof de=="function"&&(Wa(s,r,de,f),U=s.memoizedState),(j=os||qc(s,r,j,f,ce,U,re))?(pe||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(s.flags|=4194308)):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=f,s.memoizedState=U),M.props=f,M.state=U,M.context=re,f=j):(typeof M.componentDidMount=="function"&&(s.flags|=4194308),f=!1)}else{M=s.stateNode,Dc(i,s),j=s.memoizedProps,re=s.type===s.elementType?j:pi(s.type,j),M.props=re,pe=s.pendingProps,ce=M.context,U=r.contextType,typeof U=="object"&&U!==null?U=Zt(U):(U=Nt(r)?Es:Et.current,U=Zs(s,U));var ye=r.getDerivedStateFromProps;(de=typeof ye=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(j!==pe||ce!==U)&&Zc(s,M,f,U),os=!1,ce=s.memoizedState,M.state=ce,$r(s,f,M,x);var xe=s.memoizedState;j!==pe||ce!==xe||Gt.current||os?(typeof ye=="function"&&(Wa(s,r,ye,f),xe=s.memoizedState),(re=os||qc(s,r,re,f,ce,xe,U)||!1)?(de||typeof M.UNSAFE_componentWillUpdate!="function"&&typeof M.componentWillUpdate!="function"||(typeof M.componentWillUpdate=="function"&&M.componentWillUpdate(f,xe,U),typeof M.UNSAFE_componentWillUpdate=="function"&&M.UNSAFE_componentWillUpdate(f,xe,U)),typeof M.componentDidUpdate=="function"&&(s.flags|=4),typeof M.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof M.componentDidUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=1024),s.memoizedProps=f,s.memoizedState=xe),M.props=f,M.state=xe,M.context=U,f=re):(typeof M.componentDidUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=4),typeof M.getSnapshotBeforeUpdate!="function"||j===i.memoizedProps&&ce===i.memoizedState||(s.flags|=1024),f=!1)}return Ka(i,s,r,f,k,x)}function Ka(i,s,r,f,x,k){ld(i,s);var M=(s.flags&128)!==0;if(!f&&!M)return x&&fc(s,r,!1),Fi(i,s,k);f=s.stateNode,fm.current=s;var j=M&&typeof r.getDerivedStateFromError!="function"?null:f.render();return s.flags|=1,i!==null&&M?(s.child=sn(s,i.child,null,k),s.child=sn(s,null,j,k)):It(i,s,j,k),s.memoizedState=f.state,x&&fc(s,r,!0),s.child}function cd(i){var s=i.stateNode;s.pendingContext?uc(i,s.pendingContext,s.pendingContext!==s.context):s.context&&uc(i,s.context,!1),Aa(i,s.containerInfo)}function dd(i,s,r,f,x){return tn(),Ca(x),s.flags|=256,It(i,s,r,f),s.child}var Ya={dehydrated:null,treeContext:null,retryLane:0};function Xa(i){return{baseLanes:i,cachePool:null,transitions:null}}function ud(i,s,r){var f=s.pendingProps,x=nt.current,k=!1,M=(s.flags&128)!==0,j;if((j=M)||(j=i!==null&&i.memoizedState===null?!1:(x&2)!==0),j?(k=!0,s.flags&=-129):(i===null||i.memoizedState!==null)&&(x|=1),qe(nt,x&1),i===null)return Sa(s),i=s.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((s.mode&1)===0?s.lanes=1:i.data==="$!"?s.lanes=8:s.lanes=1073741824,null):(M=f.children,i=f.fallback,k?(f=s.mode,k=s.child,M={mode:"hidden",children:M},(f&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=M):k=po(M,f,0,null),i=Gs(i,f,r,null),k.return=s,i.return=s,k.sibling=i,s.child=k,s.child.memoizedState=Xa(r),s.memoizedState=Ya,i):qa(s,M));if(x=i.memoizedState,x!==null&&(j=x.dehydrated,j!==null))return mm(i,s,M,f,j,x,r);if(k){k=f.fallback,M=s.mode,x=i.child,j=x.sibling;var U={mode:"hidden",children:f.children};return(M&1)===0&&s.child!==x?(f=s.child,f.childLanes=0,f.pendingProps=U,s.deletions=null):(f=ps(x,U),f.subtreeFlags=x.subtreeFlags&14680064),j!==null?k=ps(j,k):(k=Gs(k,M,r,null),k.flags|=2),k.return=s,f.return=s,f.sibling=k,s.child=f,f=k,k=s.child,M=i.child.memoizedState,M=M===null?Xa(r):{baseLanes:M.baseLanes|r,cachePool:null,transitions:M.transitions},k.memoizedState=M,k.childLanes=i.childLanes&~r,s.memoizedState=Ya,f}return k=i.child,i=k.sibling,f=ps(k,{mode:"visible",children:f.children}),(s.mode&1)===0&&(f.lanes=r),f.return=s,f.sibling=null,i!==null&&(r=s.deletions,r===null?(s.deletions=[i],s.flags|=16):r.push(i)),s.child=f,s.memoizedState=null,f}function qa(i,s){return s=po({mode:"visible",children:s},i.mode,0,null),s.return=i,i.child=s}function Qr(i,s,r,f){return f!==null&&Ca(f),sn(s,i.child,null,r),i=qa(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function mm(i,s,r,f,x,k,M){if(r)return s.flags&256?(s.flags&=-257,f=ja(Error(t(422))),Qr(i,s,M,f)):s.memoizedState!==null?(s.child=i.child,s.flags|=128,null):(k=f.fallback,x=s.mode,f=po({mode:"visible",children:f.children},x,0,null),k=Gs(k,x,M,null),k.flags|=2,f.return=s,k.return=s,f.sibling=k,s.child=f,(s.mode&1)!==0&&sn(s,i.child,null,M),s.child.memoizedState=Xa(M),s.memoizedState=Ya,k);if((s.mode&1)===0)return Qr(i,s,M,null);if(x.data==="$!"){if(f=x.nextSibling&&x.nextSibling.dataset,f)var j=f.dgst;return f=j,k=Error(t(419)),f=ja(k,f,void 0),Qr(i,s,M,f)}if(j=(M&i.childLanes)!==0,zt||j){if(f=bt,f!==null){switch(M&-M){case 4:x=2;break;case 16:x=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:x=32;break;case 536870912:x=268435456;break;default:x=0}x=(x&(f.suspendedLanes|M))!==0?0:x,x!==0&&x!==k.retryLane&&(k.retryLane=x,Bi(i,x),gi(f,i,x,-1))}return ul(),f=ja(Error(t(421))),Qr(i,s,M,f)}return x.data==="$?"?(s.flags|=128,s.child=i.child,s=Pm.bind(null,i),x._reactRetry=s,null):(i=k.treeContext,Kt=is(x.nextSibling),Ut=s,tt=!0,ui=null,i!==null&&(qt[Jt++]=Ni,qt[Jt++]=zi,qt[Jt++]=ks,Ni=i.id,zi=i.overflow,ks=s),s=qa(s,f.children),s.flags|=4096,s)}function pd(i,s,r){i.lanes|=s;var f=i.alternate;f!==null&&(f.lanes|=s),ka(i.return,s,r)}function Ja(i,s,r,f,x){var k=i.memoizedState;k===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:f,tail:r,tailMode:x}:(k.isBackwards=s,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=r,k.tailMode=x)}function fd(i,s,r){var f=s.pendingProps,x=f.revealOrder,k=f.tail;if(It(i,s,f.children,r),f=nt.current,(f&2)!==0)f=f&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&pd(i,r,s);else if(i.tag===19)pd(i,r,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}f&=1}if(qe(nt,f),(s.mode&1)===0)s.memoizedState=null;else switch(x){case"forwards":for(r=s.child,x=null;r!==null;)i=r.alternate,i!==null&&Ur(i)===null&&(x=r),r=r.sibling;r=x,r===null?(x=s.child,s.child=null):(x=r.sibling,r.sibling=null),Ja(s,!1,x,r,k);break;case"backwards":for(r=null,x=s.child,s.child=null;x!==null;){if(i=x.alternate,i!==null&&Ur(i)===null){s.child=x;break}i=x.sibling,x.sibling=r,r=x,x=i}Ja(s,!0,r,null,k);break;case"together":Ja(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function eo(i,s){(s.mode&1)===0&&i!==null&&(i.alternate=null,s.alternate=null,s.flags|=2)}function Fi(i,s,r){if(i!==null&&(s.dependencies=i.dependencies),Ls|=s.lanes,(r&s.childLanes)===0)return null;if(i!==null&&s.child!==i.child)throw Error(t(153));if(s.child!==null){for(i=s.child,r=ps(i,i.pendingProps),s.child=r,r.return=s;i.sibling!==null;)i=i.sibling,r=r.sibling=ps(i,i.pendingProps),r.return=s;r.sibling=null}return s.child}function gm(i,s,r){switch(s.tag){case 3:cd(s),tn();break;case 5:Pc(s);break;case 1:Nt(s.type)&&Gr(s);break;case 4:Aa(s,s.stateNode.containerInfo);break;case 10:var f=s.type._context,x=s.memoizedProps.value;qe(Wr,f._currentValue),f._currentValue=x;break;case 13:if(f=s.memoizedState,f!==null)return f.dehydrated!==null?(qe(nt,nt.current&1),s.flags|=128,null):(r&s.child.childLanes)!==0?ud(i,s,r):(qe(nt,nt.current&1),i=Fi(i,s,r),i!==null?i.sibling:null);qe(nt,nt.current&1);break;case 19:if(f=(r&s.childLanes)!==0,(i.flags&128)!==0){if(f)return fd(i,s,r);s.flags|=128}if(x=s.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),qe(nt,nt.current),f)break;return null;case 22:case 23:return s.lanes=0,ad(i,s,r)}return Fi(i,s,r)}var md,Za,gd,vd;md=function(i,s){for(var r=s.child;r!==null;){if(r.tag===5||r.tag===6)i.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Za=function(){},gd=function(i,s,r,f){var x=i.memoizedProps;if(x!==f){i=s.stateNode,As(Di.current);var k=null;switch(r){case"input":x=We(i,x),f=We(i,f),k=[];break;case"select":x=H({},x,{value:void 0}),f=H({},f,{value:void 0}),k=[];break;case"textarea":x=Dt(i,x),f=Dt(i,f),k=[];break;default:typeof x.onClick!="function"&&typeof f.onClick=="function"&&(i.onclick=Rr)}hi(r,f);var M;r=null;for(re in x)if(!f.hasOwnProperty(re)&&x.hasOwnProperty(re)&&x[re]!=null)if(re==="style"){var j=x[re];for(M in j)j.hasOwnProperty(M)&&(r||(r={}),r[M]="")}else re!=="dangerouslySetInnerHTML"&&re!=="children"&&re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&re!=="autoFocus"&&(o.hasOwnProperty(re)?k||(k=[]):(k=k||[]).push(re,null));for(re in f){var U=f[re];if(j=x!=null?x[re]:void 0,f.hasOwnProperty(re)&&U!==j&&(U!=null||j!=null))if(re==="style")if(j){for(M in j)!j.hasOwnProperty(M)||U&&U.hasOwnProperty(M)||(r||(r={}),r[M]="");for(M in U)U.hasOwnProperty(M)&&j[M]!==U[M]&&(r||(r={}),r[M]=U[M])}else r||(k||(k=[]),k.push(re,r)),r=U;else re==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,j=j?j.__html:void 0,U!=null&&j!==U&&(k=k||[]).push(re,U)):re==="children"?typeof U!="string"&&typeof U!="number"||(k=k||[]).push(re,""+U):re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&(o.hasOwnProperty(re)?(U!=null&&re==="onScroll"&&Ze("scroll",i),k||j===U||(k=[])):(k=k||[]).push(re,U))}r&&(k=k||[]).push("style",r);var re=k;(s.updateQueue=re)&&(s.flags|=4)}},vd=function(i,s,r,f){r!==f&&(s.flags|=4)};function Yn(i,s){if(!tt)switch(i.tailMode){case"hidden":s=i.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?i.tail=null:r.sibling=null;break;case"collapsed":r=i.tail;for(var f=null;r!==null;)r.alternate!==null&&(f=r),r=r.sibling;f===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function Pt(i){var s=i.alternate!==null&&i.alternate.child===i.child,r=0,f=0;if(s)for(var x=i.child;x!==null;)r|=x.lanes|x.childLanes,f|=x.subtreeFlags&14680064,f|=x.flags&14680064,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)r|=x.lanes|x.childLanes,f|=x.subtreeFlags,f|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=f,i.childLanes=r,s}function vm(i,s,r){var f=s.pendingProps;switch(ba(s),s.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(s),null;case 1:return Nt(s.type)&&Or(),Pt(s),null;case 3:return f=s.stateNode,on(),Qe(Gt),Qe(Et),Ra(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(i===null||i.child===null)&&(Hr(s)?s.flags|=4:i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ui!==null&&(hl(ui),ui=null))),Za(i,s),Pt(s),null;case 5:Ia(s);var x=As(Vn.current);if(r=s.type,i!==null&&s.stateNode!=null)gd(i,s,r,f,x),i.ref!==s.ref&&(s.flags|=512,s.flags|=2097152);else{if(!f){if(s.stateNode===null)throw Error(t(166));return Pt(s),null}if(i=As(Di.current),Hr(s)){f=s.stateNode,r=s.type;var k=s.memoizedProps;switch(f[xi]=s,f[zn]=k,i=(s.mode&1)!==0,r){case"dialog":Ze("cancel",f),Ze("close",f);break;case"iframe":case"object":case"embed":Ze("load",f);break;case"video":case"audio":for(x=0;x<On.length;x++)Ze(On[x],f);break;case"source":Ze("error",f);break;case"img":case"image":case"link":Ze("error",f),Ze("load",f);break;case"details":Ze("toggle",f);break;case"input":je(f,k),Ze("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!k.multiple},Ze("invalid",f);break;case"textarea":Ne(f,k),Ze("invalid",f)}hi(r,k),x=null;for(var M in k)if(k.hasOwnProperty(M)){var j=k[M];M==="children"?typeof j=="string"?f.textContent!==j&&(k.suppressHydrationWarning!==!0&&Lr(f.textContent,j,i),x=["children",j]):typeof j=="number"&&f.textContent!==""+j&&(k.suppressHydrationWarning!==!0&&Lr(f.textContent,j,i),x=["children",""+j]):o.hasOwnProperty(M)&&j!=null&&M==="onScroll"&&Ze("scroll",f)}switch(r){case"input":ge(f),ve(f,k,!0);break;case"textarea":ge(f),At(f);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(f.onclick=Rr)}f=x,s.updateQueue=f,f!==null&&(s.flags|=4)}else{M=x.nodeType===9?x:x.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=mt(r)),i==="http://www.w3.org/1999/xhtml"?r==="script"?(i=M.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof f.is=="string"?i=M.createElement(r,{is:f.is}):(i=M.createElement(r),r==="select"&&(M=i,f.multiple?M.multiple=!0:f.size&&(M.size=f.size))):i=M.createElementNS(i,r),i[xi]=s,i[zn]=f,md(i,s,!1,!1),s.stateNode=i;e:{switch(M=Hs(r,f),r){case"dialog":Ze("cancel",i),Ze("close",i),x=f;break;case"iframe":case"object":case"embed":Ze("load",i),x=f;break;case"video":case"audio":for(x=0;x<On.length;x++)Ze(On[x],i);x=f;break;case"source":Ze("error",i),x=f;break;case"img":case"image":case"link":Ze("error",i),Ze("load",i),x=f;break;case"details":Ze("toggle",i),x=f;break;case"input":je(i,f),x=We(i,f),Ze("invalid",i);break;case"option":x=f;break;case"select":i._wrapperState={wasMultiple:!!f.multiple},x=H({},f,{value:void 0}),Ze("invalid",i);break;case"textarea":Ne(i,f),x=Dt(i,f),Ze("invalid",i);break;default:x=f}hi(r,x),j=x;for(k in j)if(j.hasOwnProperty(k)){var U=j[k];k==="style"?dr(i,U):k==="dangerouslySetInnerHTML"?(U=U?U.__html:void 0,U!=null&&li(i,U)):k==="children"?typeof U=="string"?(r!=="textarea"||U!=="")&&gt(i,U):typeof U=="number"&&gt(i,""+U):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(o.hasOwnProperty(k)?U!=null&&k==="onScroll"&&Ze("scroll",i):U!=null&&v(i,k,U,M))}switch(r){case"input":ge(i),ve(i,f,!1);break;case"textarea":ge(i),At(i);break;case"option":f.value!=null&&i.setAttribute("value",""+O(f.value));break;case"select":i.multiple=!!f.multiple,k=f.value,k!=null?st(i,!!f.multiple,k,!1):f.defaultValue!=null&&st(i,!!f.multiple,f.defaultValue,!0);break;default:typeof x.onClick=="function"&&(i.onclick=Rr)}switch(r){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(s.flags|=4)}s.ref!==null&&(s.flags|=512,s.flags|=2097152)}return Pt(s),null;case 6:if(i&&s.stateNode!=null)vd(i,s,i.memoizedProps,f);else{if(typeof f!="string"&&s.stateNode===null)throw Error(t(166));if(r=As(Vn.current),As(Di.current),Hr(s)){if(f=s.stateNode,r=s.memoizedProps,f[xi]=s,(k=f.nodeValue!==r)&&(i=Ut,i!==null))switch(i.tag){case 3:Lr(f.nodeValue,r,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Lr(f.nodeValue,r,(i.mode&1)!==0)}k&&(s.flags|=4)}else f=(r.nodeType===9?r:r.ownerDocument).createTextNode(f),f[xi]=s,s.stateNode=f}return Pt(s),null;case 13:if(Qe(nt),f=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(tt&&Kt!==null&&(s.mode&1)!==0&&(s.flags&128)===0)bc(),tn(),s.flags|=98560,k=!1;else if(k=Hr(s),f!==null&&f.dehydrated!==null){if(i===null){if(!k)throw Error(t(318));if(k=s.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(t(317));k[xi]=s}else tn(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pt(s),k=!1}else ui!==null&&(hl(ui),ui=null),k=!0;if(!k)return s.flags&65536?s:null}return(s.flags&128)!==0?(s.lanes=r,s):(f=f!==null,f!==(i!==null&&i.memoizedState!==null)&&f&&(s.child.flags|=8192,(s.mode&1)!==0&&(i===null||(nt.current&1)!==0?_t===0&&(_t=3):ul())),s.updateQueue!==null&&(s.flags|=4),Pt(s),null);case 4:return on(),Za(i,s),i===null&&Gn(s.stateNode.containerInfo),Pt(s),null;case 10:return Ea(s.type._context),Pt(s),null;case 17:return Nt(s.type)&&Or(),Pt(s),null;case 19:if(Qe(nt),k=s.memoizedState,k===null)return Pt(s),null;if(f=(s.flags&128)!==0,M=k.rendering,M===null)if(f)Yn(k,!1);else{if(_t!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(M=Ur(i),M!==null){for(s.flags|=128,Yn(k,!1),f=M.updateQueue,f!==null&&(s.updateQueue=f,s.flags|=4),s.subtreeFlags=0,f=r,r=s.child;r!==null;)k=r,i=f,k.flags&=14680066,M=k.alternate,M===null?(k.childLanes=0,k.lanes=i,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=M.childLanes,k.lanes=M.lanes,k.child=M.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=M.memoizedProps,k.memoizedState=M.memoizedState,k.updateQueue=M.updateQueue,k.type=M.type,i=M.dependencies,k.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r=r.sibling;return qe(nt,nt.current&1|2),s.child}i=i.sibling}k.tail!==null&&ct()>cn&&(s.flags|=128,f=!0,Yn(k,!1),s.lanes=4194304)}else{if(!f)if(i=Ur(M),i!==null){if(s.flags|=128,f=!0,r=i.updateQueue,r!==null&&(s.updateQueue=r,s.flags|=4),Yn(k,!0),k.tail===null&&k.tailMode==="hidden"&&!M.alternate&&!tt)return Pt(s),null}else 2*ct()-k.renderingStartTime>cn&&r!==1073741824&&(s.flags|=128,f=!0,Yn(k,!1),s.lanes=4194304);k.isBackwards?(M.sibling=s.child,s.child=M):(r=k.last,r!==null?r.sibling=M:s.child=M,k.last=M)}return k.tail!==null?(s=k.tail,k.rendering=s,k.tail=s.sibling,k.renderingStartTime=ct(),s.sibling=null,r=nt.current,qe(nt,f?r&1|2:r&1),s):(Pt(s),null);case 22:case 23:return dl(),f=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==f&&(s.flags|=8192),f&&(s.mode&1)!==0?(Yt&1073741824)!==0&&(Pt(s),s.subtreeFlags&6&&(s.flags|=8192)):Pt(s),null;case 24:return null;case 25:return null}throw Error(t(156,s.tag))}function _m(i,s){switch(ba(s),s.tag){case 1:return Nt(s.type)&&Or(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return on(),Qe(Gt),Qe(Et),Ra(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Ia(s),null;case 13:if(Qe(nt),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(t(340));tn()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return Qe(nt),null;case 4:return on(),null;case 10:return Ea(s.type._context),null;case 22:case 23:return dl(),null;case 24:return null;default:return null}}var to=!1,Tt=!1,wm=typeof WeakSet=="function"?WeakSet:Set,Ce=null;function ln(i,s){var r=i.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(f){at(i,s,f)}else r.current=null}function Qa(i,s,r){try{r()}catch(f){at(i,s,f)}}var _d=!1;function bm(i,s){if(da=yr,i=qh(),sa(i)){if("selectionStart"in i)var r={start:i.selectionStart,end:i.selectionEnd};else e:{r=(r=i.ownerDocument)&&r.defaultView||window;var f=r.getSelection&&r.getSelection();if(f&&f.rangeCount!==0){r=f.anchorNode;var x=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{r.nodeType,k.nodeType}catch{r=null;break e}var M=0,j=-1,U=-1,re=0,de=0,pe=i,ce=null;t:for(;;){for(var ye;pe!==r||x!==0&&pe.nodeType!==3||(j=M+x),pe!==k||f!==0&&pe.nodeType!==3||(U=M+f),pe.nodeType===3&&(M+=pe.nodeValue.length),(ye=pe.firstChild)!==null;)ce=pe,pe=ye;for(;;){if(pe===i)break t;if(ce===r&&++re===x&&(j=M),ce===k&&++de===f&&(U=M),(ye=pe.nextSibling)!==null)break;pe=ce,ce=pe.parentNode}pe=ye}r=j===-1||U===-1?null:{start:j,end:U}}else r=null}r=r||{start:0,end:0}}else r=null;for(ua={focusedElem:i,selectionRange:r},yr=!1,Ce=s;Ce!==null;)if(s=Ce,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,Ce=i;else for(;Ce!==null;){s=Ce;try{var xe=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var Ee=xe.memoizedProps,dt=xe.memoizedState,ee=s.stateNode,Y=ee.getSnapshotBeforeUpdate(s.elementType===s.type?Ee:pi(s.type,Ee),dt);ee.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:var te=s.stateNode.containerInfo;te.nodeType===1?te.textContent="":te.nodeType===9&&te.documentElement&&te.removeChild(te.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(_e){at(s,s.return,_e)}if(i=s.sibling,i!==null){i.return=s.return,Ce=i;break}Ce=s.return}return xe=_d,_d=!1,xe}function Xn(i,s,r){var f=s.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var x=f=f.next;do{if((x.tag&i)===i){var k=x.destroy;x.destroy=void 0,k!==void 0&&Qa(s,r,k)}x=x.next}while(x!==f)}}function io(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var r=s=s.next;do{if((r.tag&i)===i){var f=r.create;r.destroy=f()}r=r.next}while(r!==s)}}function el(i){var s=i.ref;if(s!==null){var r=i.stateNode;switch(i.tag){case 5:i=r;break;default:i=r}typeof s=="function"?s(i):s.current=i}}function wd(i){var s=i.alternate;s!==null&&(i.alternate=null,wd(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[xi],delete s[zn],delete s[ga],delete s[im],delete s[sm])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function bd(i){return i.tag===5||i.tag===3||i.tag===4}function yd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||bd(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function tl(i,s,r){var f=i.tag;if(f===5||f===6)i=i.stateNode,s?r.nodeType===8?r.parentNode.insertBefore(i,s):r.insertBefore(i,s):(r.nodeType===8?(s=r.parentNode,s.insertBefore(i,r)):(s=r,s.appendChild(i)),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Rr));else if(f!==4&&(i=i.child,i!==null))for(tl(i,s,r),i=i.sibling;i!==null;)tl(i,s,r),i=i.sibling}function il(i,s,r){var f=i.tag;if(f===5||f===6)i=i.stateNode,s?r.insertBefore(i,s):r.appendChild(i);else if(f!==4&&(i=i.child,i!==null))for(il(i,s,r),i=i.sibling;i!==null;)il(i,s,r),i=i.sibling}var Ct=null,fi=!1;function ls(i,s,r){for(r=r.child;r!==null;)Sd(i,s,r),r=r.sibling}function Sd(i,s,r){if(Ci&&typeof Ci.onCommitFiberUnmount=="function")try{Ci.onCommitFiberUnmount(mr,r)}catch{}switch(r.tag){case 5:Tt||ln(r,s);case 6:var f=Ct,x=fi;Ct=null,ls(i,s,r),Ct=f,fi=x,Ct!==null&&(fi?(i=Ct,r=r.stateNode,i.nodeType===8?i.parentNode.removeChild(r):i.removeChild(r)):Ct.removeChild(r.stateNode));break;case 18:Ct!==null&&(fi?(i=Ct,r=r.stateNode,i.nodeType===8?ma(i.parentNode,r):i.nodeType===1&&ma(i,r),kn(i)):ma(Ct,r.stateNode));break;case 4:f=Ct,x=fi,Ct=r.stateNode.containerInfo,fi=!0,ls(i,s,r),Ct=f,fi=x;break;case 0:case 11:case 14:case 15:if(!Tt&&(f=r.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){x=f=f.next;do{var k=x,M=k.destroy;k=k.tag,M!==void 0&&((k&2)!==0||(k&4)!==0)&&Qa(r,s,M),x=x.next}while(x!==f)}ls(i,s,r);break;case 1:if(!Tt&&(ln(r,s),f=r.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=r.memoizedProps,f.state=r.memoizedState,f.componentWillUnmount()}catch(j){at(r,s,j)}ls(i,s,r);break;case 21:ls(i,s,r);break;case 22:r.mode&1?(Tt=(f=Tt)||r.memoizedState!==null,ls(i,s,r),Tt=f):ls(i,s,r);break;default:ls(i,s,r)}}function Cd(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var r=i.stateNode;r===null&&(r=i.stateNode=new wm),s.forEach(function(f){var x=Tm.bind(null,i,f);r.has(f)||(r.add(f),f.then(x,x))})}}function mi(i,s){var r=s.deletions;if(r!==null)for(var f=0;f<r.length;f++){var x=r[f];try{var k=i,M=s,j=M;e:for(;j!==null;){switch(j.tag){case 5:Ct=j.stateNode,fi=!1;break e;case 3:Ct=j.stateNode.containerInfo,fi=!0;break e;case 4:Ct=j.stateNode.containerInfo,fi=!0;break e}j=j.return}if(Ct===null)throw Error(t(160));Sd(k,M,x),Ct=null,fi=!1;var U=x.alternate;U!==null&&(U.return=null),x.return=null}catch(re){at(x,s,re)}}if(s.subtreeFlags&12854)for(s=s.child;s!==null;)xd(s,i),s=s.sibling}function xd(i,s){var r=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(mi(s,i),ki(i),f&4){try{Xn(3,i,i.return),io(3,i)}catch(Ee){at(i,i.return,Ee)}try{Xn(5,i,i.return)}catch(Ee){at(i,i.return,Ee)}}break;case 1:mi(s,i),ki(i),f&512&&r!==null&&ln(r,r.return);break;case 5:if(mi(s,i),ki(i),f&512&&r!==null&&ln(r,r.return),i.flags&32){var x=i.stateNode;try{gt(x,"")}catch(Ee){at(i,i.return,Ee)}}if(f&4&&(x=i.stateNode,x!=null)){var k=i.memoizedProps,M=r!==null?r.memoizedProps:k,j=i.type,U=i.updateQueue;if(i.updateQueue=null,U!==null)try{j==="input"&&k.type==="radio"&&k.name!=null&&ot(x,k),Hs(j,M);var re=Hs(j,k);for(M=0;M<U.length;M+=2){var de=U[M],pe=U[M+1];de==="style"?dr(x,pe):de==="dangerouslySetInnerHTML"?li(x,pe):de==="children"?gt(x,pe):v(x,de,pe,re)}switch(j){case"input":Ae(x,k);break;case"textarea":Si(x,k);break;case"select":var ce=x._wrapperState.wasMultiple;x._wrapperState.wasMultiple=!!k.multiple;var ye=k.value;ye!=null?st(x,!!k.multiple,ye,!1):ce!==!!k.multiple&&(k.defaultValue!=null?st(x,!!k.multiple,k.defaultValue,!0):st(x,!!k.multiple,k.multiple?[]:"",!1))}x[zn]=k}catch(Ee){at(i,i.return,Ee)}}break;case 6:if(mi(s,i),ki(i),f&4){if(i.stateNode===null)throw Error(t(162));x=i.stateNode,k=i.memoizedProps;try{x.nodeValue=k}catch(Ee){at(i,i.return,Ee)}}break;case 3:if(mi(s,i),ki(i),f&4&&r!==null&&r.memoizedState.isDehydrated)try{kn(s.containerInfo)}catch(Ee){at(i,i.return,Ee)}break;case 4:mi(s,i),ki(i);break;case 13:mi(s,i),ki(i),x=i.child,x.flags&8192&&(k=x.memoizedState!==null,x.stateNode.isHidden=k,!k||x.alternate!==null&&x.alternate.memoizedState!==null||(rl=ct())),f&4&&Cd(i);break;case 22:if(de=r!==null&&r.memoizedState!==null,i.mode&1?(Tt=(re=Tt)||de,mi(s,i),Tt=re):mi(s,i),ki(i),f&8192){if(re=i.memoizedState!==null,(i.stateNode.isHidden=re)&&!de&&(i.mode&1)!==0)for(Ce=i,de=i.child;de!==null;){for(pe=Ce=de;Ce!==null;){switch(ce=Ce,ye=ce.child,ce.tag){case 0:case 11:case 14:case 15:Xn(4,ce,ce.return);break;case 1:ln(ce,ce.return);var xe=ce.stateNode;if(typeof xe.componentWillUnmount=="function"){f=ce,r=ce.return;try{s=f,xe.props=s.memoizedProps,xe.state=s.memoizedState,xe.componentWillUnmount()}catch(Ee){at(f,r,Ee)}}break;case 5:ln(ce,ce.return);break;case 22:if(ce.memoizedState!==null){kd(pe);continue}}ye!==null?(ye.return=ce,Ce=ye):kd(pe)}de=de.sibling}e:for(de=null,pe=i;;){if(pe.tag===5){if(de===null){de=pe;try{x=pe.stateNode,re?(k=x.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(j=pe.stateNode,U=pe.memoizedProps.style,M=U!=null&&U.hasOwnProperty("display")?U.display:null,j.style.display=Bs("display",M))}catch(Ee){at(i,i.return,Ee)}}}else if(pe.tag===6){if(de===null)try{pe.stateNode.nodeValue=re?"":pe.memoizedProps}catch(Ee){at(i,i.return,Ee)}}else if((pe.tag!==22&&pe.tag!==23||pe.memoizedState===null||pe===i)&&pe.child!==null){pe.child.return=pe,pe=pe.child;continue}if(pe===i)break e;for(;pe.sibling===null;){if(pe.return===null||pe.return===i)break e;de===pe&&(de=null),pe=pe.return}de===pe&&(de=null),pe.sibling.return=pe.return,pe=pe.sibling}}break;case 19:mi(s,i),ki(i),f&4&&Cd(i);break;case 21:break;default:mi(s,i),ki(i)}}function ki(i){var s=i.flags;if(s&2){try{e:{for(var r=i.return;r!==null;){if(bd(r)){var f=r;break e}r=r.return}throw Error(t(160))}switch(f.tag){case 5:var x=f.stateNode;f.flags&32&&(gt(x,""),f.flags&=-33);var k=yd(i);il(i,k,x);break;case 3:case 4:var M=f.stateNode.containerInfo,j=yd(i);tl(i,j,M);break;default:throw Error(t(161))}}catch(U){at(i,i.return,U)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function ym(i,s,r){Ce=i,Dd(i)}function Dd(i,s,r){for(var f=(i.mode&1)!==0;Ce!==null;){var x=Ce,k=x.child;if(x.tag===22&&f){var M=x.memoizedState!==null||to;if(!M){var j=x.alternate,U=j!==null&&j.memoizedState!==null||Tt;j=to;var re=Tt;if(to=M,(Tt=U)&&!re)for(Ce=x;Ce!==null;)M=Ce,U=M.child,M.tag===22&&M.memoizedState!==null?Pd(x):U!==null?(U.return=M,Ce=U):Pd(x);for(;k!==null;)Ce=k,Dd(k),k=k.sibling;Ce=x,to=j,Tt=re}Ed(i)}else(x.subtreeFlags&8772)!==0&&k!==null?(k.return=x,Ce=k):Ed(i)}}function Ed(i){for(;Ce!==null;){var s=Ce;if((s.flags&8772)!==0){var r=s.alternate;try{if((s.flags&8772)!==0)switch(s.tag){case 0:case 11:case 15:Tt||io(5,s);break;case 1:var f=s.stateNode;if(s.flags&4&&!Tt)if(r===null)f.componentDidMount();else{var x=s.elementType===s.type?r.memoizedProps:pi(s.type,r.memoizedProps);f.componentDidUpdate(x,r.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var k=s.updateQueue;k!==null&&kc(s,k,f);break;case 3:var M=s.updateQueue;if(M!==null){if(r=null,s.child!==null)switch(s.child.tag){case 5:r=s.child.stateNode;break;case 1:r=s.child.stateNode}kc(s,M,r)}break;case 5:var j=s.stateNode;if(r===null&&s.flags&4){r=j;var U=s.memoizedProps;switch(s.type){case"button":case"input":case"select":case"textarea":U.autoFocus&&r.focus();break;case"img":U.src&&(r.src=U.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(s.memoizedState===null){var re=s.alternate;if(re!==null){var de=re.memoizedState;if(de!==null){var pe=de.dehydrated;pe!==null&&kn(pe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}Tt||s.flags&512&&el(s)}catch(ce){at(s,s.return,ce)}}if(s===i){Ce=null;break}if(r=s.sibling,r!==null){r.return=s.return,Ce=r;break}Ce=s.return}}function kd(i){for(;Ce!==null;){var s=Ce;if(s===i){Ce=null;break}var r=s.sibling;if(r!==null){r.return=s.return,Ce=r;break}Ce=s.return}}function Pd(i){for(;Ce!==null;){var s=Ce;try{switch(s.tag){case 0:case 11:case 15:var r=s.return;try{io(4,s)}catch(U){at(s,r,U)}break;case 1:var f=s.stateNode;if(typeof f.componentDidMount=="function"){var x=s.return;try{f.componentDidMount()}catch(U){at(s,x,U)}}var k=s.return;try{el(s)}catch(U){at(s,k,U)}break;case 5:var M=s.return;try{el(s)}catch(U){at(s,M,U)}}}catch(U){at(s,s.return,U)}if(s===i){Ce=null;break}var j=s.sibling;if(j!==null){j.return=s.return,Ce=j;break}Ce=s.return}}var Sm=Math.ceil,so=D.ReactCurrentDispatcher,sl=D.ReactCurrentOwner,ei=D.ReactCurrentBatchConfig,He=0,bt=null,pt=null,xt=0,Yt=0,hn=ss(0),_t=0,qn=null,Ls=0,no=0,nl=0,Jn=null,Bt=null,rl=0,cn=1/0,Wi=null,ro=!1,ol=null,hs=null,oo=!1,cs=null,ao=0,Zn=0,al=null,lo=-1,ho=0;function Lt(){return(He&6)!==0?ct():lo!==-1?lo:lo=ct()}function ds(i){return(i.mode&1)===0?1:(He&2)!==0&&xt!==0?xt&-xt:rm.transition!==null?(ho===0&&(ho=yh()),ho):(i=Ue,i!==0||(i=window.event,i=i===void 0?16:Ah(i.type)),i)}function gi(i,s,r,f){if(50<Zn)throw Zn=0,al=null,Error(t(185));Sn(i,r,f),((He&2)===0||i!==bt)&&(i===bt&&((He&2)===0&&(no|=r),_t===4&&us(i,xt)),Ht(i,f),r===1&&He===0&&(s.mode&1)===0&&(cn=ct()+500,Nr&&rs()))}function Ht(i,s){var r=i.callbackNode;rf(i,s);var f=_r(i,i===bt?xt:0);if(f===0)r!==null&&jt(r),i.callbackNode=null,i.callbackPriority=0;else if(s=f&-f,i.callbackPriority!==s){if(r!=null&&jt(r),s===1)i.tag===0?nm(Ad.bind(null,i)):mc(Ad.bind(null,i)),em(function(){(He&6)===0&&rs()}),r=null;else{switch(Sh(f)){case 1:r=Ho;break;case 4:r=wh;break;case 16:r=fr;break;case 536870912:r=bh;break;default:r=fr}r=zd(r,Td.bind(null,i))}i.callbackPriority=s,i.callbackNode=r}}function Td(i,s){if(lo=-1,ho=0,(He&6)!==0)throw Error(t(327));var r=i.callbackNode;if(dn()&&i.callbackNode!==r)return null;var f=_r(i,i===bt?xt:0);if(f===0)return null;if((f&30)!==0||(f&i.expiredLanes)!==0||s)s=co(i,f);else{s=f;var x=He;He|=2;var k=Ld();(bt!==i||xt!==s)&&(Wi=null,cn=ct()+500,Ms(i,s));do try{Dm();break}catch(j){Id(i,j)}while(!0);Da(),so.current=k,He=x,pt!==null?s=0:(bt=null,xt=0,s=_t)}if(s!==0){if(s===2&&(x=Fo(i),x!==0&&(f=x,s=ll(i,x))),s===1)throw r=qn,Ms(i,0),us(i,f),Ht(i,ct()),r;if(s===6)us(i,f);else{if(x=i.current.alternate,(f&30)===0&&!Cm(x)&&(s=co(i,f),s===2&&(k=Fo(i),k!==0&&(f=k,s=ll(i,k))),s===1))throw r=qn,Ms(i,0),us(i,f),Ht(i,ct()),r;switch(i.finishedWork=x,i.finishedLanes=f,s){case 0:case 1:throw Error(t(345));case 2:Os(i,Bt,Wi);break;case 3:if(us(i,f),(f&130023424)===f&&(s=rl+500-ct(),10<s)){if(_r(i,0)!==0)break;if(x=i.suspendedLanes,(x&f)!==f){Lt(),i.pingedLanes|=i.suspendedLanes&x;break}i.timeoutHandle=fa(Os.bind(null,i,Bt,Wi),s);break}Os(i,Bt,Wi);break;case 4:if(us(i,f),(f&4194240)===f)break;for(s=i.eventTimes,x=-1;0<f;){var M=31-ci(f);k=1<<M,M=s[M],M>x&&(x=M),f&=~k}if(f=x,f=ct()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*Sm(f/1960))-f,10<f){i.timeoutHandle=fa(Os.bind(null,i,Bt,Wi),f);break}Os(i,Bt,Wi);break;case 5:Os(i,Bt,Wi);break;default:throw Error(t(329))}}}return Ht(i,ct()),i.callbackNode===r?Td.bind(null,i):null}function ll(i,s){var r=Jn;return i.current.memoizedState.isDehydrated&&(Ms(i,s).flags|=256),i=co(i,s),i!==2&&(s=Bt,Bt=r,s!==null&&hl(s)),i}function hl(i){Bt===null?Bt=i:Bt.push.apply(Bt,i)}function Cm(i){for(var s=i;;){if(s.flags&16384){var r=s.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var f=0;f<r.length;f++){var x=r[f],k=x.getSnapshot;x=x.value;try{if(!di(k(),x))return!1}catch{return!1}}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function us(i,s){for(s&=~nl,s&=~no,i.suspendedLanes|=s,i.pingedLanes&=~s,i=i.expirationTimes;0<s;){var r=31-ci(s),f=1<<r;i[r]=-1,s&=~f}}function Ad(i){if((He&6)!==0)throw Error(t(327));dn();var s=_r(i,0);if((s&1)===0)return Ht(i,ct()),null;var r=co(i,s);if(i.tag!==0&&r===2){var f=Fo(i);f!==0&&(s=f,r=ll(i,f))}if(r===1)throw r=qn,Ms(i,0),us(i,s),Ht(i,ct()),r;if(r===6)throw Error(t(345));return i.finishedWork=i.current.alternate,i.finishedLanes=s,Os(i,Bt,Wi),Ht(i,ct()),null}function cl(i,s){var r=He;He|=1;try{return i(s)}finally{He=r,He===0&&(cn=ct()+500,Nr&&rs())}}function Rs(i){cs!==null&&cs.tag===0&&(He&6)===0&&dn();var s=He;He|=1;var r=ei.transition,f=Ue;try{if(ei.transition=null,Ue=1,i)return i()}finally{Ue=f,ei.transition=r,He=s,(He&6)===0&&rs()}}function dl(){Yt=hn.current,Qe(hn)}function Ms(i,s){i.finishedWork=null,i.finishedLanes=0;var r=i.timeoutHandle;if(r!==-1&&(i.timeoutHandle=-1,Qf(r)),pt!==null)for(r=pt.return;r!==null;){var f=r;switch(ba(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&Or();break;case 3:on(),Qe(Gt),Qe(Et),Ra();break;case 5:Ia(f);break;case 4:on();break;case 13:Qe(nt);break;case 19:Qe(nt);break;case 10:Ea(f.type._context);break;case 22:case 23:dl()}r=r.return}if(bt=i,pt=i=ps(i.current,null),xt=Yt=s,_t=0,qn=null,nl=no=Ls=0,Bt=Jn=null,Ts!==null){for(s=0;s<Ts.length;s++)if(r=Ts[s],f=r.interleaved,f!==null){r.interleaved=null;var x=f.next,k=r.pending;if(k!==null){var M=k.next;k.next=x,f.next=M}r.pending=f}Ts=null}return i}function Id(i,s){do{var r=pt;try{if(Da(),Kr.current=Jr,Yr){for(var f=rt.memoizedState;f!==null;){var x=f.queue;x!==null&&(x.pending=null),f=f.next}Yr=!1}if(Is=0,wt=vt=rt=null,jn=!1,$n=0,sl.current=null,r===null||r.return===null){_t=1,qn=s,pt=null;break}e:{var k=i,M=r.return,j=r,U=s;if(s=xt,j.flags|=32768,U!==null&&typeof U=="object"&&typeof U.then=="function"){var re=U,de=j,pe=de.tag;if((de.mode&1)===0&&(pe===0||pe===11||pe===15)){var ce=de.alternate;ce?(de.updateQueue=ce.updateQueue,de.memoizedState=ce.memoizedState,de.lanes=ce.lanes):(de.updateQueue=null,de.memoizedState=null)}var ye=id(M);if(ye!==null){ye.flags&=-257,sd(ye,M,j,k,s),ye.mode&1&&td(k,re,s),s=ye,U=re;var xe=s.updateQueue;if(xe===null){var Ee=new Set;Ee.add(U),s.updateQueue=Ee}else xe.add(U);break e}else{if((s&1)===0){td(k,re,s),ul();break e}U=Error(t(426))}}else if(tt&&j.mode&1){var dt=id(M);if(dt!==null){(dt.flags&65536)===0&&(dt.flags|=256),sd(dt,M,j,k,s),Ca(an(U,j));break e}}k=U=an(U,j),_t!==4&&(_t=2),Jn===null?Jn=[k]:Jn.push(k),k=M;do{switch(k.tag){case 3:k.flags|=65536,s&=-s,k.lanes|=s;var ee=Qc(k,U,s);Ec(k,ee);break e;case 1:j=U;var Y=k.type,te=k.stateNode;if((k.flags&128)===0&&(typeof Y.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(hs===null||!hs.has(te)))){k.flags|=65536,s&=-s,k.lanes|=s;var _e=ed(k,j,s);Ec(k,_e);break e}}k=k.return}while(k!==null)}Md(r)}catch(ke){s=ke,pt===r&&r!==null&&(pt=r=r.return);continue}break}while(!0)}function Ld(){var i=so.current;return so.current=Jr,i===null?Jr:i}function ul(){(_t===0||_t===3||_t===2)&&(_t=4),bt===null||(Ls&268435455)===0&&(no&268435455)===0||us(bt,xt)}function co(i,s){var r=He;He|=2;var f=Ld();(bt!==i||xt!==s)&&(Wi=null,Ms(i,s));do try{xm();break}catch(x){Id(i,x)}while(!0);if(Da(),He=r,so.current=f,pt!==null)throw Error(t(261));return bt=null,xt=0,_t}function xm(){for(;pt!==null;)Rd(pt)}function Dm(){for(;pt!==null&&!Ot();)Rd(pt)}function Rd(i){var s=Nd(i.alternate,i,Yt);i.memoizedProps=i.pendingProps,s===null?Md(i):pt=s,sl.current=null}function Md(i){var s=i;do{var r=s.alternate;if(i=s.return,(s.flags&32768)===0){if(r=vm(r,s,Yt),r!==null){pt=r;return}}else{if(r=_m(r,s),r!==null){r.flags&=32767,pt=r;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{_t=6,pt=null;return}}if(s=s.sibling,s!==null){pt=s;return}pt=s=i}while(s!==null);_t===0&&(_t=5)}function Os(i,s,r){var f=Ue,x=ei.transition;try{ei.transition=null,Ue=1,Em(i,s,r,f)}finally{ei.transition=x,Ue=f}return null}function Em(i,s,r,f){do dn();while(cs!==null);if((He&6)!==0)throw Error(t(327));r=i.finishedWork;var x=i.finishedLanes;if(r===null)return null;if(i.finishedWork=null,i.finishedLanes=0,r===i.current)throw Error(t(177));i.callbackNode=null,i.callbackPriority=0;var k=r.lanes|r.childLanes;if(of(i,k),i===bt&&(pt=bt=null,xt=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||oo||(oo=!0,zd(fr,function(){return dn(),null})),k=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||k){k=ei.transition,ei.transition=null;var M=Ue;Ue=1;var j=He;He|=4,sl.current=null,bm(i,r),xd(r,i),Uf(ua),yr=!!da,ua=da=null,i.current=r,ym(r),qp(),He=j,Ue=M,ei.transition=k}else i.current=r;if(oo&&(oo=!1,cs=i,ao=x),k=i.pendingLanes,k===0&&(hs=null),Qp(r.stateNode),Ht(i,ct()),s!==null)for(f=i.onRecoverableError,r=0;r<s.length;r++)x=s[r],f(x.value,{componentStack:x.stack,digest:x.digest});if(ro)throw ro=!1,i=ol,ol=null,i;return(ao&1)!==0&&i.tag!==0&&dn(),k=i.pendingLanes,(k&1)!==0?i===al?Zn++:(Zn=0,al=i):Zn=0,rs(),null}function dn(){if(cs!==null){var i=Sh(ao),s=ei.transition,r=Ue;try{if(ei.transition=null,Ue=16>i?16:i,cs===null)var f=!1;else{if(i=cs,cs=null,ao=0,(He&6)!==0)throw Error(t(331));var x=He;for(He|=4,Ce=i.current;Ce!==null;){var k=Ce,M=k.child;if((Ce.flags&16)!==0){var j=k.deletions;if(j!==null){for(var U=0;U<j.length;U++){var re=j[U];for(Ce=re;Ce!==null;){var de=Ce;switch(de.tag){case 0:case 11:case 15:Xn(8,de,k)}var pe=de.child;if(pe!==null)pe.return=de,Ce=pe;else for(;Ce!==null;){de=Ce;var ce=de.sibling,ye=de.return;if(wd(de),de===re){Ce=null;break}if(ce!==null){ce.return=ye,Ce=ce;break}Ce=ye}}}var xe=k.alternate;if(xe!==null){var Ee=xe.child;if(Ee!==null){xe.child=null;do{var dt=Ee.sibling;Ee.sibling=null,Ee=dt}while(Ee!==null)}}Ce=k}}if((k.subtreeFlags&2064)!==0&&M!==null)M.return=k,Ce=M;else e:for(;Ce!==null;){if(k=Ce,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Xn(9,k,k.return)}var ee=k.sibling;if(ee!==null){ee.return=k.return,Ce=ee;break e}Ce=k.return}}var Y=i.current;for(Ce=Y;Ce!==null;){M=Ce;var te=M.child;if((M.subtreeFlags&2064)!==0&&te!==null)te.return=M,Ce=te;else e:for(M=Y;Ce!==null;){if(j=Ce,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:io(9,j)}}catch(ke){at(j,j.return,ke)}if(j===M){Ce=null;break e}var _e=j.sibling;if(_e!==null){_e.return=j.return,Ce=_e;break e}Ce=j.return}}if(He=x,rs(),Ci&&typeof Ci.onPostCommitFiberRoot=="function")try{Ci.onPostCommitFiberRoot(mr,i)}catch{}f=!0}return f}finally{Ue=r,ei.transition=s}}return!1}function Od(i,s,r){s=an(r,s),s=Qc(i,s,1),i=as(i,s,1),s=Lt(),i!==null&&(Sn(i,1,s),Ht(i,s))}function at(i,s,r){if(i.tag===3)Od(i,i,r);else for(;s!==null;){if(s.tag===3){Od(s,i,r);break}else if(s.tag===1){var f=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(hs===null||!hs.has(f))){i=an(r,i),i=ed(s,i,1),s=as(s,i,1),i=Lt(),s!==null&&(Sn(s,1,i),Ht(s,i));break}}s=s.return}}function km(i,s,r){var f=i.pingCache;f!==null&&f.delete(s),s=Lt(),i.pingedLanes|=i.suspendedLanes&r,bt===i&&(xt&r)===r&&(_t===4||_t===3&&(xt&130023424)===xt&&500>ct()-rl?Ms(i,0):nl|=r),Ht(i,s)}function Gd(i,s){s===0&&((i.mode&1)===0?s=1:(s=vr,vr<<=1,(vr&130023424)===0&&(vr=4194304)));var r=Lt();i=Bi(i,s),i!==null&&(Sn(i,s,r),Ht(i,r))}function Pm(i){var s=i.memoizedState,r=0;s!==null&&(r=s.retryLane),Gd(i,r)}function Tm(i,s){var r=0;switch(i.tag){case 13:var f=i.stateNode,x=i.memoizedState;x!==null&&(r=x.retryLane);break;case 19:f=i.stateNode;break;default:throw Error(t(314))}f!==null&&f.delete(s),Gd(i,r)}var Nd;Nd=function(i,s,r){if(i!==null)if(i.memoizedProps!==s.pendingProps||Gt.current)zt=!0;else{if((i.lanes&r)===0&&(s.flags&128)===0)return zt=!1,gm(i,s,r);zt=(i.flags&131072)!==0}else zt=!1,tt&&(s.flags&1048576)!==0&&gc(s,Br,s.index);switch(s.lanes=0,s.tag){case 2:var f=s.type;eo(i,s),i=s.pendingProps;var x=Zs(s,Et.current);rn(s,r),x=Ga(null,s,f,i,x,r);var k=Na();return s.flags|=1,typeof x=="object"&&x!==null&&typeof x.render=="function"&&x.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,Nt(f)?(k=!0,Gr(s)):k=!1,s.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,Ta(s),x.updater=Zr,s.stateNode=x,x._reactInternals=s,Va(s,f,i,r),s=Ka(null,s,f,!0,k,r)):(s.tag=0,tt&&k&&wa(s),It(null,s,x,r),s=s.child),s;case 16:f=s.elementType;e:{switch(eo(i,s),i=s.pendingProps,x=f._init,f=x(f._payload),s.type=f,x=s.tag=Im(f),i=pi(f,i),x){case 0:s=Ua(null,s,f,i,r);break e;case 1:s=hd(null,s,f,i,r);break e;case 11:s=nd(null,s,f,i,r);break e;case 14:s=rd(null,s,f,pi(f.type,i),r);break e}throw Error(t(306,f,""))}return s;case 0:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:pi(f,x),Ua(i,s,f,x,r);case 1:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:pi(f,x),hd(i,s,f,x,r);case 3:e:{if(cd(s),i===null)throw Error(t(387));f=s.pendingProps,k=s.memoizedState,x=k.element,Dc(i,s),$r(s,f,null,r);var M=s.memoizedState;if(f=M.element,k.isDehydrated)if(k={element:f,isDehydrated:!1,cache:M.cache,pendingSuspenseBoundaries:M.pendingSuspenseBoundaries,transitions:M.transitions},s.updateQueue.baseState=k,s.memoizedState=k,s.flags&256){x=an(Error(t(423)),s),s=dd(i,s,f,r,x);break e}else if(f!==x){x=an(Error(t(424)),s),s=dd(i,s,f,r,x);break e}else for(Kt=is(s.stateNode.containerInfo.firstChild),Ut=s,tt=!0,ui=null,r=Cc(s,null,f,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(tn(),f===x){s=Fi(i,s,r);break e}It(i,s,f,r)}s=s.child}return s;case 5:return Pc(s),i===null&&Sa(s),f=s.type,x=s.pendingProps,k=i!==null?i.memoizedProps:null,M=x.children,pa(f,x)?M=null:k!==null&&pa(f,k)&&(s.flags|=32),ld(i,s),It(i,s,M,r),s.child;case 6:return i===null&&Sa(s),null;case 13:return ud(i,s,r);case 4:return Aa(s,s.stateNode.containerInfo),f=s.pendingProps,i===null?s.child=sn(s,null,f,r):It(i,s,f,r),s.child;case 11:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:pi(f,x),nd(i,s,f,x,r);case 7:return It(i,s,s.pendingProps,r),s.child;case 8:return It(i,s,s.pendingProps.children,r),s.child;case 12:return It(i,s,s.pendingProps.children,r),s.child;case 10:e:{if(f=s.type._context,x=s.pendingProps,k=s.memoizedProps,M=x.value,qe(Wr,f._currentValue),f._currentValue=M,k!==null)if(di(k.value,M)){if(k.children===x.children&&!Gt.current){s=Fi(i,s,r);break e}}else for(k=s.child,k!==null&&(k.return=s);k!==null;){var j=k.dependencies;if(j!==null){M=k.child;for(var U=j.firstContext;U!==null;){if(U.context===f){if(k.tag===1){U=Hi(-1,r&-r),U.tag=2;var re=k.updateQueue;if(re!==null){re=re.shared;var de=re.pending;de===null?U.next=U:(U.next=de.next,de.next=U),re.pending=U}}k.lanes|=r,U=k.alternate,U!==null&&(U.lanes|=r),ka(k.return,r,s),j.lanes|=r;break}U=U.next}}else if(k.tag===10)M=k.type===s.type?null:k.child;else if(k.tag===18){if(M=k.return,M===null)throw Error(t(341));M.lanes|=r,j=M.alternate,j!==null&&(j.lanes|=r),ka(M,r,s),M=k.sibling}else M=k.child;if(M!==null)M.return=k;else for(M=k;M!==null;){if(M===s){M=null;break}if(k=M.sibling,k!==null){k.return=M.return,M=k;break}M=M.return}k=M}It(i,s,x.children,r),s=s.child}return s;case 9:return x=s.type,f=s.pendingProps.children,rn(s,r),x=Zt(x),f=f(x),s.flags|=1,It(i,s,f,r),s.child;case 14:return f=s.type,x=pi(f,s.pendingProps),x=pi(f.type,x),rd(i,s,f,x,r);case 15:return od(i,s,s.type,s.pendingProps,r);case 17:return f=s.type,x=s.pendingProps,x=s.elementType===f?x:pi(f,x),eo(i,s),s.tag=1,Nt(f)?(i=!0,Gr(s)):i=!1,rn(s,r),Jc(s,f,x),Va(s,f,x,r),Ka(null,s,f,!0,i,r);case 19:return fd(i,s,r);case 22:return ad(i,s,r)}throw Error(t(156,s.tag))};function zd(i,s){return Xe(i,s)}function Am(i,s,r,f){this.tag=i,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(i,s,r,f){return new Am(i,s,r,f)}function pl(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Im(i){if(typeof i=="function")return pl(i)?1:0;if(i!=null){if(i=i.$$typeof,i===W)return 11;if(i===V)return 14}return 2}function ps(i,s){var r=i.alternate;return r===null?(r=ti(i.tag,s,i.key,i.mode),r.elementType=i.elementType,r.type=i.type,r.stateNode=i.stateNode,r.alternate=i,i.alternate=r):(r.pendingProps=s,r.type=i.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=i.flags&14680064,r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=i.sibling,r.index=i.index,r.ref=i.ref,r}function uo(i,s,r,f,x,k){var M=2;if(f=i,typeof i=="function")pl(i)&&(M=1);else if(typeof i=="string")M=5;else e:switch(i){case A:return Gs(r.children,x,k,s);case E:M=8,x|=8;break;case I:return i=ti(12,r,s,x|2),i.elementType=I,i.lanes=k,i;case F:return i=ti(13,r,s,x),i.elementType=F,i.lanes=k,i;case q:return i=ti(19,r,s,x),i.elementType=q,i.lanes=k,i;case ie:return po(r,x,k,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case B:M=10;break e;case N:M=9;break e;case W:M=11;break e;case V:M=14;break e;case K:M=16,f=null;break e}throw Error(t(130,i==null?i:typeof i,""))}return s=ti(M,r,s,x),s.elementType=i,s.type=f,s.lanes=k,s}function Gs(i,s,r,f){return i=ti(7,i,f,s),i.lanes=r,i}function po(i,s,r,f){return i=ti(22,i,f,s),i.elementType=ie,i.lanes=r,i.stateNode={isHidden:!1},i}function fl(i,s,r){return i=ti(6,i,null,s),i.lanes=r,i}function ml(i,s,r){return s=ti(4,i.children!==null?i.children:[],i.key,s),s.lanes=r,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function Lm(i,s,r,f,x){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=f,this.onRecoverableError=x,this.mutableSourceEagerHydrationData=null}function gl(i,s,r,f,x,k,M,j,U){return i=new Lm(i,s,r,j,U),s===1?(s=1,k===!0&&(s|=8)):s=0,k=ti(3,null,null,s),i.current=k,k.stateNode=i,k.memoizedState={element:f,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ta(k),i}function Rm(i,s,r){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:f==null?null:""+f,children:i,containerInfo:s,implementation:r}}function Bd(i){if(!i)return ns;i=i._reactInternals;e:{if(ne(i)!==i||i.tag!==1)throw Error(t(170));var s=i;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Nt(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(s!==null);throw Error(t(171))}if(i.tag===1){var r=i.type;if(Nt(r))return pc(i,r,s)}return s}function Hd(i,s,r,f,x,k,M,j,U){return i=gl(r,f,!0,i,x,k,M,j,U),i.context=Bd(null),r=i.current,f=Lt(),x=ds(r),k=Hi(f,x),k.callback=s??null,as(r,k,x),i.current.lanes=x,Sn(i,x,f),Ht(i,f),i}function fo(i,s,r,f){var x=s.current,k=Lt(),M=ds(x);return r=Bd(r),s.context===null?s.context=r:s.pendingContext=r,s=Hi(k,M),s.payload={element:i},f=f===void 0?null:f,f!==null&&(s.callback=f),i=as(x,s,M),i!==null&&(gi(i,x,M,k),jr(i,x,M)),M}function mo(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return i.child.stateNode;default:return i.child.stateNode}}function Fd(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var r=i.retryLane;i.retryLane=r!==0&&r<s?r:s}}function vl(i,s){Fd(i,s),(i=i.alternate)&&Fd(i,s)}function Mm(){return null}var Wd=typeof reportError=="function"?reportError:function(i){console.error(i)};function _l(i){this._internalRoot=i}go.prototype.render=_l.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(t(409));fo(i,s,null,null)},go.prototype.unmount=_l.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Rs(function(){fo(null,i,null,null)}),s[Oi]=null}};function go(i){this._internalRoot=i}go.prototype.unstable_scheduleHydration=function(i){if(i){var s=Dh();i={blockedOn:null,target:i,priority:s};for(var r=0;r<Qi.length&&s!==0&&s<Qi[r].priority;r++);Qi.splice(r,0,i),r===0&&Ph(i)}};function wl(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function vo(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function Vd(){}function Om(i,s,r,f,x){if(x){if(typeof f=="function"){var k=f;f=function(){var re=mo(M);k.call(re)}}var M=Hd(s,f,i,0,null,!1,!1,"",Vd);return i._reactRootContainer=M,i[Oi]=M.current,Gn(i.nodeType===8?i.parentNode:i),Rs(),M}for(;x=i.lastChild;)i.removeChild(x);if(typeof f=="function"){var j=f;f=function(){var re=mo(U);j.call(re)}}var U=gl(i,0,!1,null,null,!1,!1,"",Vd);return i._reactRootContainer=U,i[Oi]=U.current,Gn(i.nodeType===8?i.parentNode:i),Rs(function(){fo(s,U,r,f)}),U}function _o(i,s,r,f,x){var k=r._reactRootContainer;if(k){var M=k;if(typeof x=="function"){var j=x;x=function(){var U=mo(M);j.call(U)}}fo(s,M,i,x)}else M=Om(r,s,i,x,f);return mo(M)}Ch=function(i){switch(i.tag){case 3:var s=i.stateNode;if(s.current.memoizedState.isDehydrated){var r=yn(s.pendingLanes);r!==0&&(Vo(s,r|1),Ht(s,ct()),(He&6)===0&&(cn=ct()+500,rs()))}break;case 13:Rs(function(){var f=Bi(i,1);if(f!==null){var x=Lt();gi(f,i,1,x)}}),vl(i,1)}},jo=function(i){if(i.tag===13){var s=Bi(i,134217728);if(s!==null){var r=Lt();gi(s,i,134217728,r)}vl(i,134217728)}},xh=function(i){if(i.tag===13){var s=ds(i),r=Bi(i,s);if(r!==null){var f=Lt();gi(r,i,s,f)}vl(i,s)}},Dh=function(){return Ue},Eh=function(i,s){var r=Ue;try{return Ue=i,s()}finally{Ue=r}},Fs=function(i,s,r){switch(s){case"input":if(Ae(i,r),s=r.name,r.type==="radio"&&s!=null){for(r=i;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+s)+'][type="radio"]'),s=0;s<r.length;s++){var f=r[s];if(f!==i&&f.form===i.form){var x=Mr(f);if(!x)throw Error(t(90));fe(f),Ae(f,x)}}}break;case"textarea":Si(i,r);break;case"select":s=r.value,s!=null&&st(i,!!r.multiple,s,!1)}},Yi=cl,Ws=Rs;var Gm={usingClientEntryPoint:!1,Events:[Bn,qs,Mr,ys,_n,cl]},Qn={findFiberByHostInstance:Ds,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Nm={bundleType:Qn.bundleType,version:Qn.version,rendererPackageName:Qn.rendererPackageName,rendererConfig:Qn.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:D.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Oe(i),i===null?null:i.stateNode},findFiberByHostInstance:Qn.findFiberByHostInstance||Mm,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 wo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wo.isDisabled&&wo.supportsFiber)try{mr=wo.inject(Nm),Ci=wo}catch{}}return Ft.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gm,Ft.createPortal=function(i,s){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wl(s))throw Error(t(200));return Rm(i,s,null,r)},Ft.createRoot=function(i,s){if(!wl(i))throw Error(t(299));var r=!1,f="",x=Wd;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onRecoverableError!==void 0&&(x=s.onRecoverableError)),s=gl(i,1,!1,null,null,r,!1,f,x),i[Oi]=s.current,Gn(i.nodeType===8?i.parentNode:i),new _l(s)},Ft.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(t(188)):(i=Object.keys(i).join(","),Error(t(268,i)));return i=Oe(s),i=i===null?null:i.stateNode,i},Ft.flushSync=function(i){return Rs(i)},Ft.hydrate=function(i,s,r){if(!vo(s))throw Error(t(200));return _o(null,i,s,!0,r)},Ft.hydrateRoot=function(i,s,r){if(!wl(i))throw Error(t(405));var f=r!=null&&r.hydratedSources||null,x=!1,k="",M=Wd;if(r!=null&&(r.unstable_strictMode===!0&&(x=!0),r.identifierPrefix!==void 0&&(k=r.identifierPrefix),r.onRecoverableError!==void 0&&(M=r.onRecoverableError)),s=Hd(s,null,i,1,r??null,x,!1,k,M),i[Oi]=s.current,Gn(i),f)for(i=0;i<f.length;i++)r=f[i],x=r._getVersion,x=x(r._source),s.mutableSourceEagerHydrationData==null?s.mutableSourceEagerHydrationData=[r,x]:s.mutableSourceEagerHydrationData.push(r,x);return new go(s)},Ft.render=function(i,s,r){if(!vo(s))throw Error(t(200));return _o(null,i,s,!1,r)},Ft.unmountComponentAtNode=function(i){if(!vo(i))throw Error(t(40));return i._reactRootContainer?(Rs(function(){_o(null,null,i,!1,function(){i._reactRootContainer=null,i[Oi]=null})}),!0):!1},Ft.unstable_batchedUpdates=cl,Ft.unstable_renderSubtreeIntoContainer=function(i,s,r,f){if(!vo(r))throw Error(t(200));if(i==null||i._reactInternals===void 0)throw Error(t(38));return _o(i,s,r,!1,f)},Ft.version="18.3.1-next-f1338f8080-20240426",Ft}var Jd;function $u(){if(Jd)return Sl.exports;Jd=1;function p(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(p)}catch(e){console.error(e)}}return p(),Sl.exports=jm(),Sl.exports}var Zd;function $m(){if(Zd)return bo;Zd=1;var p=$u();return bo.createRoot=p.createRoot,bo.hydrateRoot=p.hydrateRoot,bo}var Um=$m();const Rl={"needs-input":"●",working:"●",done:"●",idle:"○",restorable:"○"},Ml={"needs-input":"text-garage-amber",done:"text-garage-green",working:"text-garage-dim",idle:"text-garage-faint",restorable:"text-garage-faint"},Qd={"needs-input":"needs input — Claude is waiting on you",done:"responded — finished since you last looked",working:"running — Claude is working",idle:"idle — waiting for your next prompt",restorable:"restorable — tmux died, the conversation can be resumed"};function Uu(p){return Rl[p]??Rl.idle}function Ku(p){return Qd[p]??Qd.idle}function Yu(p){return Ml[p]??Ml.idle}function Xu(p){if(p==null||Number.isNaN(p))return"—";const e=Math.max(0,Date.now()-p),t=Math.floor(e/1e3);if(t<3600){const o=Math.floor(t/60),h=t%60;return`${o}:${String(h).padStart(2,"0")}`}if(t<86400){const o=Math.floor(t/3600),h=Math.floor(t%3600/60);return`${o}h ${String(h).padStart(2,"0")}m`}return`${Math.floor(t/86400)}d`}function qu(p=1e3){const[e,t]=J.useState(0);return J.useEffect(()=>{const n=setInterval(()=>t(o=>o+1),p);return()=>clearInterval(n)},[p]),e}const _s={"content-type":"application/json"};async function oi(p){try{return await p.json()}catch{return{}}}async function eu(){const p=await fetch("/api/workspaces");if(!p.ok)throw new Error(`GET /api/workspaces failed (${p.status})`);return p.json()}async function Ao(){const p=await fetch("/api/sessions");if(!p.ok)throw new Error(`GET /api/sessions failed (${p.status})`);return p.json()}async function Km(p,e){const t=await fetch("/api/workspaces",{method:"PUT",headers:_s,body:JSON.stringify({name:p,dir:e})}),n=await oi(t);if(!t.ok)throw new Error(n.error||`could not register workspace (${t.status})`);return n}async function Ju(p,e,{worktree:t}={}){const n=await fetch("/api/sessions",{method:"POST",headers:_s,body:JSON.stringify(t?{workspace:p,label:e,worktree:!0}:{workspace:p,label:e})}),o=await oi(n);if(!n.ok)throw n.status===404?new Error(`unknown workspace "${p}"`):n.status===409?new Error(`session "${e}" already exists in ${p}`):new Error(o.error||`could not create session (${n.status})`);return o}async function Ym(p,e){const t=e?`?sessionId=${encodeURIComponent(e)}`:"",n=await fetch(`/api/diff/${encodeURIComponent(p)}${t}`);if(!n.ok){const o=await oi(n);throw n.status===404?new Error(`no diff — "${p}" isn't registered; add a workspace named "${p}" pointing at its project folder to enable diffs`):new Error(o.error||`GET /api/diff/${p} failed (${n.status})`)}return n.json()}async function ko(p,e,t){const o=await fetch("/api/open-editor",{method:"POST",headers:_s,body:JSON.stringify(e?{workspace:p,file:e,line:t??1}:{workspace:p})}),h=await oi(o);if(!o.ok)throw new Error(h.error||`could not open editor (${o.status})`);return h}async function Ol(p){const e=await fetch("/api/sessions/restore",{method:"POST",headers:_s,body:JSON.stringify(p)}),t=await oi(e);if(!e.ok)throw new Error(t.error||t.reason||`could not restore session (${e.status})`);return t}async function Xm(){const p=await fetch("/api/pick-directory",{method:"POST"}),e=await oi(p);if(!p.ok)throw new Error(e.error||`directory picker unavailable (${p.status})`);return e}async function qm(p,e){const t=await fetch(`/api/workspaces/${encodeURIComponent(p)}`,{method:"PATCH",headers:_s,body:JSON.stringify({name:e})}),n=await oi(t);if(!t.ok)throw t.status===404?new Error(n.error||`unknown workspace "${p}"`):t.status===409?new Error(n.error||`workspace name already taken: ${e}`):new Error(n.error||`could not rename workspace (${t.status})`);return n}async function Jm(){const p=await fetch("/api/hooks/install",{method:"POST"}),e=await oi(p);if(!p.ok)throw p.status===404?new Error("the running daemon is an older version — restart claude-garage (sessions survive; tmux owns them) and try again"):new Error(e.error||`hook install failed (${p.status})`);return e}function Zm(p,e){fetch("/api/ui/visibility",{method:"POST",headers:_s,body:JSON.stringify({clientId:p,visible:e}),keepalive:!0}).catch(()=>{})}async function Qm(p,{killSessions:e}={}){var h;const t=e?"?sessions=kill":"",n=await fetch(`/api/workspaces/${encodeURIComponent(p)}${t}`,{method:"DELETE"});if(n.status===404)throw new Error(`unknown workspace: ${p}`);if(!n.ok)throw new Error(`delete failed (${n.status})`);const o=n.status===204?{}:await oi(n);if((h=o.failedSessions)!=null&&h.length)throw new Error(`${o.failedSessions.length} session(s) failed to close — workspace unregistered anyway`);return o}async function eg(p){const e=await fetch(`/api/sessions/${encodeURIComponent(p)}`,{method:"DELETE"}),t=await oi(e);if(!e.ok)throw e.status===403?new Error(t.error||"refusing to close a non-garage session"):e.status===404?new Error(t.error||`no such session: ${p}`):new Error(t.error||`could not close session (${e.status})`);return t}async function tg(p,e=!1){const t=await fetch("/api/sessions/restart",{method:"POST",headers:_s,body:JSON.stringify({id:p,force:e})}),n=await oi(t);if(!t.ok)throw t.status===404?new Error(n.error||`no live session: ${p}`):new Error(n.error||`could not restart session (${t.status})`);return n}async function ig(p,e){const t=await fetch("/api/worktrees/finish",{method:"POST",headers:_s,body:JSON.stringify({worktree:p,action:e})}),n=await oi(t);if(!t.ok)throw t.status===409?new Error(n.error||"merge conflict — resolve manually"):new Error(n.error||`could not finish worktree (${t.status})`);return n}const tu=p=>`garage-wt-default:${p}`;function sg({workspaceName:p,onCreated:e}){const[t,n]=J.useState(!1),[o,h]=J.useState(""),[w,a]=J.useState(null),[l,u]=J.useState(!1),[d,c]=J.useState(()=>{try{return localStorage.getItem(tu(p))==="1"}catch{return!1}});function b(){n(!1),h(""),a(null),u(!1)}async function C(S){S.preventDefault();const y=o.trim();if(!(!y||l)){u(!0),a(null);try{await Ju(p,y,{worktree:d});try{localStorage.setItem(tu(p),d?"1":"0")}catch{}b(),e()}catch(g){a(g.message),u(!1)}}}return t?z.jsxs("form",{onSubmit:C,className:"flex shrink-0 flex-col gap-1",children:[z.jsxs("div",{className:"flex items-center gap-1.5",children:[z.jsx("input",{autoFocus:!0,value:o,onChange:S=>h(S.target.value),onKeyDown:S=>{S.stopPropagation(),S.key==="Escape"&&b()},placeholder:"label",className:"w-16 rounded-md border border-garage-line bg-garage-bg px-2 py-1 text-[13px] text-garage-ink outline-none focus:border-garage-dim focus:outline-none"}),z.jsxs("label",{title:"spawn in an isolated git worktree (garage/<label> branch)",className:"flex shrink-0 items-center gap-1 text-xs text-garage-dim",children:[z.jsx("input",{type:"checkbox",checked:d,onChange:S=>c(S.target.checked),onKeyDown:S=>S.stopPropagation(),className:"h-3 w-3 accent-garage-dim"}),"worktree"]}),z.jsx("button",{type:"submit",disabled:l,title:"create session",className:"rounded-md px-1.5 py-1 text-garage-green hover:bg-garage-sel disabled:opacity-40",children:"↵"})]}),w&&z.jsx("p",{role:"alert",className:"max-w-[200px] whitespace-normal text-xs leading-tight text-garage-red",children:w})]}):z.jsx("button",{type:"button",onClick:()=>n(!0),title:`new session in ${p}`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"+"})}const ng=14;function rg({groups:p,focusedWorkspace:e,focusedSessionId:t,onSelectWorkspace:n,onSelectSession:o,onSessionCreated:h,onOpenRoot:w,onBlurChrome:a,onSessionsRestored:l,onWorkspaceRenamed:u,hiddenIds:d,columnActive:c,onActivateColumn:b,viewsByWorkspace:C,onSelectView:S}){qu();const[y,g]=J.useState(()=>new Set),[_,m]=J.useState(null),[v,D]=J.useState(null),[P,T]=J.useState(null);function A(V){T(V),setTimeout(()=>T(K=>K===V?null:K),4e3)}async function E(V,K){T(null);try{await Qm(V,{killSessions:K}),u==null||u(V,null)}catch(ie){m(ie.message)}}function I(V){D({workspaceName:V,value:V,error:null,busy:!1})}function B(){D(null)}async function N(){if(!v||v.busy)return;const V=v.workspaceName,K=v.value.trim();if(!K||K===V){D(null);return}D(ie=>({...ie,busy:!0,error:null}));try{await qm(V,K),D(null),u==null||u(V,K)}catch(ie){D(Z=>({...Z,busy:!1,error:ie.message}))}}function W(V,K){g(ie=>{const Z=new Set(ie);for(const L of V)K?Z.add(L):Z.delete(L);return Z})}async function F(V){W([V],!0),m(null);try{await Ol({id:V}),l==null||l()}catch(K){m(K.message)}finally{W([V],!1)}}async function q(V){W(V,!0),m(null);const ie=(await Promise.allSettled(V.map(Z=>Ol({id:Z})))).filter(Z=>Z.status==="rejected");ie.length>0&&m(`${ie.length} of ${V.length} restore(s) failed`),l==null||l(),W(V,!1)}return z.jsxs("nav",{onMouseDown:a,onMouseDownCapture:b,"aria-label":"Workspaces",className:"min-h-0 overflow-y-auto border-r border-garage-line bg-garage-panel py-2",children:[p.length===0&&z.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no workspaces yet"}),p.map((V,K)=>{var oe;const ie=V.name===e,Z=V.sessions.filter(ae=>ae.status==="restorable").map(ae=>ae.id),L=V.sessions.length>0&&Z.length===V.sessions.length,H=Z.some(ae=>y.has(ae)),R=V.depth??0,G=(v==null?void 0:v.workspaceName)===V.name,X=V.branch??((oe=V.sessions.find(ae=>ae.branch))==null?void 0:oe.branch)??null;return z.jsxs("div",{className:"mb-1",style:{marginLeft:R*ng},children:[z.jsxs("div",{className:`group/ws relative flex items-center gap-1 px-3 pt-4 pb-1.5 ${ie?"bg-garage-sel":""}`,children:[G?z.jsxs("form",{onSubmit:ae=>{ae.preventDefault(),N()},className:"flex min-w-0 flex-1 items-center gap-2",children:[K<9&&z.jsx("span",{className:"font-mono text-[11px] text-garage-faint",children:K+1}),z.jsx("input",{autoFocus:!0,value:v.value,disabled:v.busy,onChange:ae=>D(me=>me&&{...me,value:ae.target.value}),onKeyDown:ae=>{ae.stopPropagation(),ae.key==="Escape"&&B()},onBlur:B,className:"min-w-0 flex-1 rounded-md border border-garage-line bg-garage-bg px-2 py-1 text-[13px] text-garage-ink outline-none focus:border-garage-dim focus:outline-none"}),v.error&&z.jsx("span",{className:"shrink-0 truncate text-xs text-garage-red",title:v.error,children:v.error})]}):z.jsxs("button",{type:"button",onClick:()=>n(V.name),className:"flex min-w-0 flex-1 flex-col gap-0.5 text-left",children:[z.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[K<9&&z.jsx("span",{className:"shrink-0 font-mono text-[11px] text-garage-faint",children:K+1}),z.jsx("span",{className:"truncate text-[13px] font-semibold tracking-tight text-garage-ink",children:V.name}),!V.registered&&z.jsx("span",{className:"shrink-0 text-xs text-garage-faint",title:"workspace not registered — derived from session id",children:"?"})]}),z.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-garage-faint",children:[z.jsxs("span",{className:"shrink-0",children:[V.sessions.length," session",V.sessions.length===1?"":"s"]}),X&&z.jsx("span",{"aria-hidden":"true",children:"·"}),X&&z.jsxs("span",{className:"truncate",title:X,children:["⎇ ",X]})]})]}),!G&&z.jsxs("div",{className:"absolute right-2 top-3 z-10 flex shrink-0 items-center gap-0.5 rounded-md bg-garage-panel/95 px-1 py-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/ws:opacity-100",children:[V.registered&&z.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>I(V.name),title:`rename ${V.name}`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"✎"}),V.registered&&z.jsx("button",{type:"button",onClick:()=>w(V.name),title:`open ${V.name} root in editor`,className:"shrink-0 rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"⧉"}),V.registered&&P!==V.name&&z.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>A(V.name),title:`remove ${V.name} — click to choose: unregister only, or close all sessions too`,className:"shrink-0 rounded-md p-1 text-xs text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"unreg"}),V.registered&&P===V.name&&z.jsxs(z.Fragment,{children:[z.jsx("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>E(V.name,!1),title:`unregister ${V.name} only — sessions keep running in tmux and reappear as an unregistered group`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel",children:"unreg"}),z.jsxs("button",{type:"button",onMouseDown:ae=>ae.stopPropagation(),onClick:()=>E(V.name,!0),title:`close all ${V.sessions.filter(ae=>ae.status!=="restorable").length} live session(s) — kills their tmux sessions — then unregister ${V.name}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-red hover:bg-garage-red/10",children:["kill ",V.sessions.filter(ae=>ae.status!=="restorable").length,"×"]})]}),z.jsx(sg,{workspaceName:V.name,onCreated:h})]}),!G&&L&&z.jsx("button",{type:"button",onClick:()=>q(Z),disabled:H,title:`restore all sessions in ${V.name}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore all"})]}),z.jsxs("div",{className:"ml-3 border-l border-garage-line pl-2",children:[(()=>{const ae=C==null?void 0:C[V.name],me=((ae==null?void 0:ae.views.length)??0)>1,$=O=>{const le=O.id===t,se=O.status==="restorable",ge=O.status==="needs-input",fe=(d==null?void 0:d.has(O.id))??!1,Me=y.has(O.id);return z.jsxs("div",{"data-dim-zone":!0,className:`mx-1.5 flex items-center gap-2.5 rounded-md px-3 py-2 text-[13px] ${le?"bg-garage-sel":"hover:bg-garage-sel"} ${ge?"bg-garage-amber/5":""} ${se||fe?"opacity-60":""} ${c?"dim-focused":""} ${ge?"dim-exempt":""}`,children:[z.jsxs("button",{type:"button",onClick:()=>o(V.name,O.id),"aria-current":le,title:fe?`${O.label} — hidden, click to bring back`:void 0,className:"flex min-w-0 flex-1 flex-col gap-0.5 text-left",children:[z.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[z.jsx("span",{className:`shrink-0 ${Yu(O.status)}`,title:Ku(O.status),children:Uu(O.status)}),z.jsx("span",{className:`truncate text-garage-ink ${le?"font-semibold":""} ${fe?"italic text-garage-faint":""}`,children:O.label}),fe&&z.jsx("span",{className:"shrink-0 text-xs text-garage-faint",children:"hidden"}),z.jsx("span",{className:`ml-auto shrink-0 font-mono text-xs tabular-nums ${ge?"font-semibold text-garage-amber":"text-garage-faint"}`,children:Xu(O.since)})]}),O.branch&&z.jsxs("span",{className:"min-w-0 truncate pl-[18px] font-mono text-[11px] text-garage-faint",title:O.branch,children:["⎇ ",O.branch]})]}),se&&z.jsx("button",{type:"button",onClick:()=>F(O.id),disabled:Me,title:`restore ${O.label}`,className:"shrink-0 rounded-md px-2 py-1 text-[11px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore"})]},O.id)};return me?ae.views.map(O=>z.jsxs("div",{children:[z.jsxs("button",{type:"button",onClick:()=>S==null?void 0:S(V.name,O.name),title:`show view "${O.name}" in the grid`,className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-xs hover:bg-garage-sel",children:[z.jsx("span",{className:"text-garage-faint",children:"▸"}),z.jsx("span",{className:O.name===ae.focused?"font-semibold text-garage-ink":"text-garage-dim",children:O.name}),O.needsCount>0&&z.jsx("span",{className:"text-garage-amber",children:"●"}),z.jsxs("span",{className:"ml-auto text-garage-faint",children:[O.sessions.length,"×"]})]}),z.jsx("div",{className:"ml-2",children:O.sessions.map($)})]},O.name)):V.sessions.map($)})(),V.sessions.length===0&&z.jsx("p",{className:"px-2 py-1 text-xs text-garage-faint",children:"no sessions"})]})]},V.name)}),_&&z.jsx("p",{className:"px-3 py-1 text-xs text-garage-red",title:_,children:_})]})}var og={};/**
41
41
  * dockview-core
42
42
  * @version 7.0.2
43
43
  * @link https://github.com/mathuo/dockview
44
44
  * @license MIT
45
- */class Zu{}class ni extends Zu{constructor(e,t,n,o){super(),this.viewId=e,this.groupId=t,this.panelId=n,this.tabGroupId=o}}class or extends Zu{constructor(e,t){super(),this.viewId=e,this.paneId=t}}class _i{constructor(){}static getInstance(){return _i.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}_i.INSTANCE=new _i;function it(){const p=_i.getInstance();if(p.hasData(ni.prototype))return p.getData(ni.prototype)[0]}function tr(){const p=_i.getInstance();if(p.hasData(or.prototype))return p.getData(or.prototype)[0]}var Ve;(function(p){p.NONE={dispose:()=>{}};function e(t){return{dispose:()=>{t()}}}p.from=e})(Ve||(Ve={}));class Se{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach(t=>this._disposables.add(t))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables.clear())}}class ft{constructor(){this._disposable=Ve.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Ve.NONE)}}var ri;(function(p){p.any=(...e)=>t=>{const n=e.map(o=>o(t));return{dispose:()=>{n.forEach(o=>{o.dispose()})}}}})(ri||(ri={}));class ih{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class Qu{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class og{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Io{static create(){var e;return new Io((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class ag{constructor(e,t){this.callback=e,this.stacktrace=t}}class Q{static setLeakageMonitorEnabled(e){e!==Q.ENABLE_TRACKING&&Q.MEMORY_LEAK_WATCHER.clear(),Q.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1,this._pauseTokens=new Set}get event(){return this._event||(this._event=e=>{var t;!((t=this.options)===null||t===void 0)&&t.replay&&this._last!==void 0&&e(this._last);const n=new ag(e,Q.ENABLE_TRACKING?Io.create():void 0);return this._listeners.push(n),{dispose:()=>{const o=this._listeners.indexOf(n);o>-1&&this._listeners.splice(o,1)}}},Q.ENABLE_TRACKING&&Q.MEMORY_LEAK_WATCHER.add(this._event,Io.create())),this._event}fire(e){var t;if(!(this._pauseTokens.size>0)){!((t=this.options)===null||t===void 0)&&t.replay&&(this._last=e);for(const n of this._listeners)n.callback(e)}}pause(){const e={};return this._pauseTokens.add(e),Ve.from(()=>this._pauseTokens.delete(e))}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(Q.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const t of this._listeners)console.warn("dockview: stacktrace",(e=t.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),Q.ENABLE_TRACKING&&this._event&&Q.MEMORY_LEAK_WATCHER.delete(this._event))}}Q.ENABLE_TRACKING=!1;Q.MEMORY_LEAK_WATCHER=new og;function be(p,e,t,n){return p.addEventListener(e,t,n),{dispose:()=>{p.removeEventListener(e,t,n)}}}class iu{constructor(){this._onFired=new Q,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const t=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>t&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}class lg extends Se{constructor(e){super(),this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,cr(e,t=>{const n=t.target.scrollWidth>t.target.clientWidth,o=t.target.scrollHeight>t.target.clientHeight;this._value={hasScrollX:n,hasScrollY:o},this._onDidChange.fire(this._value)}))}}function cr(p,e){const t=new ResizeObserver(n=>{requestAnimationFrame(()=>{const o=n[0];e(o)})});return t.observe(p),{dispose:()=>{t.unobserve(p),t.disconnect()}}}const wi=(p,...e)=>{for(const t of e)p.classList.contains(t)&&p.classList.remove(t)},bi=(p,...e)=>{for(const t of e)p.classList.contains(t)||p.classList.add(t)},we=(p,e,t)=>{const n=p.classList.contains(e);t&&!n&&p.classList.add(e),!t&&n&&p.classList.remove(e)};function Gl(p,e){for(;p;){if(p===e)return!0;p=p.parentNode}return!1}function ep(p){return new hg(p)}class hg extends Se{constructor(e){super(),this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=Gl(document.activeElement,e),n=!1;const o=()=>{n=!1,t||(t=!0,this._onDidFocus.fire())},h=()=>{t&&(n=!0,window.setTimeout(()=>{n&&(n=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{Gl(document.activeElement,e)!==t&&(t?h():o())},this.addDisposables(be(e,"focus",o,!0)),this.addDisposables(be(e,"blur",h,!0))}refreshState(){this._refreshStateHandler()}}const tp="dv-quasiPreventDefault";function ip(p){p[tp]=!0}function su(p){return p[tp]}function cg(p,e,t={}){const n=Array.from(e),{nonce:o}=t,h=typeof o=="function"?o(p):o;for(const w of n){if(w.href){const u=p.createElement("link");u.href=w.href,u.type=w.type,u.rel="stylesheet",p.head.appendChild(u);continue}let a=[];try{w.cssRules&&(a=Array.from(w.cssRules).map(u=>u.cssText))}catch(u){console.warn("dockview: failed to access stylesheet rules due to security restrictions",u)}const l=p.createDocumentFragment();for(const u of a){const d=p.createElement("style");h&&d.setAttribute("nonce",h),d.appendChild(p.createTextNode(u)),l.appendChild(d)}p.head.appendChild(l)}}function Nl(p){const{left:e,top:t,width:n,height:o}=p.getBoundingClientRect();return{left:e+window.scrollX,top:t+window.scrollY,width:n,height:o}}function dg(p){let e=p;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function ug(p,e){p.setAttribute("data-testid",e)}function pg(p,e){const t=[];function n(h){if(h.nodeType===Node.ELEMENT_NODE){p.includes(h.tagName)&&t.push(h),h.shadowRoot&&n(h.shadowRoot);for(const w of h.children)n(w)}}const o=e instanceof Document?e.documentElement:e;return n(o),t}function ar(p=document){const e=pg(["IFRAME","WEBVIEW"],p),t=new WeakMap;for(const n of e)t.set(n,n.style.pointerEvents),n.style.pointerEvents="none";return{release:()=>{var n;for(const o of e)o.style.pointerEvents=(n=t.get(o))!==null&&n!==void 0?n:"auto";e.splice(0,e.length)}}}function fg(p){function e(o){const h=[];for(let w=0;w<o.classList.length;w++)h.push(o.classList.item(w));return h}let t,n=p;for(;n!==null&&(t=e(n).find(o=>o.startsWith("dockview-theme-")),typeof t!="string");)n=n.parentElement;return t}class Oo{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const t of this._classNames)we(this.element,t,!1);this._classNames=e.split(" ").filter(t=>t.trim().length>0);for(const t of this._classNames)we(this.element,t,!0)}}const sp=100;function nu(p,e){const t=Nl(p),n=Nl(e);return!(t.left<n.left||t.left+t.width>n.left+n.width||t.top<n.top||t.top+t.height>n.top+n.height)}function mg(p){const e=new Q;let t=p.screenX,n=p.screenY,o;const h=()=>{if(p.closed)return;const w=p.screenX,a=p.screenY;(w!==t||a!==n)&&(clearTimeout(o),o=setTimeout(()=>{e.fire()},sp),t=w,n=a),requestAnimationFrame(h)};return h(),e}function gg(p,e){let t;return new Se(be(p,"resize",()=>{clearTimeout(t),t=setTimeout(()=>{e()},sp)}))}function vg(p,e,t={buffer:10}){const n=t.buffer,o=p.getBoundingClientRect(),h=e.getBoundingClientRect();let w=0,a=0;const l=o.left-h.left,u=o.top-h.top,d=o.bottom-h.bottom,c=o.right-h.right;l<n?w=n-l:c>n&&(w=-n-c),u<n?a=n-u:d>n&&(a=-d-n),(w!==0||a!==0)&&(p.style.transform=`translate(${w}px, ${a}px)`)}function np(p){let e=p;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function ji(p){if(p.length===0)throw new Error("Invalid tail call");return[p.slice(0,p.length-1),p[p.length-1]]}function rp(p,e){if(p.length!==e.length)return!1;for(let t=0;t<p.length;t++)if(p[t]!==e[t])return!1;return!0}function Dl(p,e){const t=p.indexOf(e);t>-1&&(p.splice(t,1),p.unshift(e))}function yo(p,e){const t=p.indexOf(e);t>-1&&(p.splice(t,1),p.push(e))}function _g(p,e){for(let t=0;t<p.length;t++){const n=p[t];if(e(n))return t}return-1}function op(p,e){const t=p.findIndex(n=>n===e);return t>-1?(p.splice(t,1),!0):!1}const et=(p,e,t)=>e>t?e:Math.min(t,Math.max(p,e)),sh=()=>{let p=1;return{next:()=>(p++).toString()}},gi=(p,e)=>{const t=[];if(typeof e!="number"&&(e=p,p=0),p<=e)for(let n=p;n<e;n++)t.push(n);else for(let n=p;n>e;n--)t.push(n);return t};class wg{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,n,o){this.container=e,this.view=t,this.disposable=o,this._cachedVisibleSize=void 0,typeof n=="number"?(this._size=n,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=n.cachedVisibleSize)}setVisible(e,t){var n;e!==this.visible&&(e?(this.size=et((n=this._cachedVisibleSize)!==null&&n!==void 0?n:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var Pe;(function(p){p.HORIZONTAL="HORIZONTAL",p.VERTICAL="VERTICAL"})(Pe||(Pe={}));var ii;(function(p){p[p.MAXIMUM=0]="MAXIMUM",p[p.MINIMUM=1]="MINIMUM",p[p.DISABLED=2]="DISABLED",p[p.ENABLED=3]="ENABLED"})(ii||(ii={}));var ht;(function(p){p.Low="low",p.High="high",p.Normal="normal"})(ht||(ht={}));var Wt;(function(p){p.Distribute={type:"distribute"};function e(n){return{type:"split",index:n}}p.Split=e;function t(n){return{type:"invisible",cachedVisibleSize:n}}p.Invisible=t})(Wt||(Wt={}));class Ns{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,wi(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==Pe.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,we(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,we(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,t){var n,o;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new Q,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(h,w,a=this.viewItems.map(S=>S.size),l,u,d=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,b,C)=>{if(h<0||h>this.viewItems.length)return 0;const S=gi(h,-1),y=gi(h+1,this.viewItems.length);if(u)for(const W of u)Dl(S,W),Dl(y,W);if(l)for(const W of l)yo(S,W),yo(y,W);const g=S.map(W=>this.viewItems[W]),_=S.map(W=>a[W]),m=y.map(W=>this.viewItems[W]),v=y.map(W=>a[W]),D=S.reduce((W,K)=>W+this.viewItems[K].minimumSize-a[K],0),P=S.reduce((W,K)=>W+this.viewItems[K].maximumSize-a[K],0),T=y.length===0?Number.POSITIVE_INFINITY:y.reduce((W,K)=>W+a[K]-this.viewItems[K].minimumSize,0),A=y.length===0?Number.NEGATIVE_INFINITY:y.reduce((W,K)=>W+a[K]-this.viewItems[K].maximumSize,0),E=Math.max(D,A),I=Math.min(T,P);let z=!1;if(b){const W=this.viewItems[b.index],K=w>=b.limitDelta;z=K!==W.visible,W.setVisible(K,b.size)}if(!z&&C){const W=this.viewItems[C.index],K=w<C.limitDelta;z=K!==W.visible,W.setVisible(K,C.size)}if(z)return this.resize(h,w,a,l,u,d,c);const H=et(w,E,I);let V=0,F=H;for(let W=0;W<g.length;W++){const K=g[W],ie=et(_[W]+F,K.minimumSize,K.maximumSize),J=ie-_[W];V+=J,F-=J,K.size=ie}let q=V;for(let W=0;W<m.length;W++){const K=m[W],ie=et(v[W]-q,K.minimumSize,K.maximumSize),J=ie-v[W];q+=J,K.size=ie}return w},this._orientation=(n=t.orientation)!==null&&n!==void 0?n:Pe.VERTICAL,this.element=this.createContainer(),this.margin=(o=t.margin)!==null&&o!==void 0?o:0,this.proportionalLayout=t.proportionalLayout===void 0?!0:!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach((h,w)=>{const a=h.visible===void 0||h.visible?h.size:{type:"invisible",cachedVisibleSize:h.size},l=h.view;this.addView(l,a,w,!0)}),this._contentSize=this.viewItems.reduce((h,w)=>h+w.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(wi(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(bi(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const n=this.viewItems[e];n.setVisible(t,n.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;const n=gi(this.viewItems.length).filter(a=>a!==e),o=[...n.filter(a=>this.viewItems[a].priority===ht.Low),e],h=n.filter(a=>this.viewItems[a].priority===ht.High),w=this.viewItems[e];t=Math.round(t),t=et(t,w.minimumSize,Math.min(w.maximumSize,this._size)),w.size=t,this.relayout(o,h)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,t){const n=this.viewItems.indexOf(e);if(n<0||n>=this.viewItems.length)return;t=typeof t=="number"?t:e.size,t=et(t,e.minimumSize,e.maximumSize),e.size=t;const o=gi(this.viewItems.length).filter(a=>a!==n),h=[...o.filter(a=>this.viewItems[a].priority===ht.Low),n],w=o.filter(a=>this.viewItems[a].priority===ht.High);this.relayout([...h,n],w)}addView(e,t={type:"distribute"},n=this.viewItems.length,o){const h=document.createElement("div");h.className="dv-view",h.appendChild(e.element);let w;typeof t=="number"?w=t:t.type==="split"?w=this.getViewSize(t.index)/2:t.type==="invisible"?w={cachedVisibleSize:t.cachedVisibleSize}:w=e.minimumSize;const a=e.onDidChange(u=>this.onDidChange(l,u.size)),l=new wg(h,e,w,{dispose:()=>{a.dispose(),this.viewContainer.removeChild(h)}});if(n===this.viewItems.length?this.viewContainer.appendChild(h):this.viewContainer.insertBefore(h,this.viewContainer.children.item(n)),this.viewItems.splice(n,0,l),this.viewItems.length>1){const u=document.createElement("div");u.className="dv-sash";const d=b=>{for(const W of this.viewItems)W.enabled=!1;const C=ar(),S=this._orientation===Pe.HORIZONTAL?b.clientX:b.clientY,y=_g(this.sashes,W=>W.container===u),g=this.viewItems.map(W=>W.size);let _,m;const v=gi(y,-1),D=gi(y+1,this.viewItems.length),P=v.reduce((W,K)=>W+(this.viewItems[K].minimumSize-g[K]),0),T=v.reduce((W,K)=>W+(this.viewItems[K].viewMaximumSize-g[K]),0),A=D.length===0?Number.POSITIVE_INFINITY:D.reduce((W,K)=>W+(g[K]-this.viewItems[K].minimumSize),0),E=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((W,K)=>W+(g[K]-this.viewItems[K].viewMaximumSize),0),I=Math.max(P,E),z=Math.min(A,T),H=this.findFirstSnapIndex(v),V=this.findFirstSnapIndex(D);if(typeof H=="number"){const W=this.viewItems[H],K=Math.floor(W.viewMinimumSize/2);_={index:H,limitDelta:W.visible?I-K:I+K,size:W.size}}if(typeof V=="number"){const W=this.viewItems[V],K=Math.floor(W.viewMinimumSize/2);m={index:V,limitDelta:W.visible?z+K:z-K,size:W.size}}const F=W=>{const ie=(this._orientation===Pe.HORIZONTAL?W.clientX:W.clientY)-S;this.resize(y,ie,g,void 0,void 0,I,z,_,m),this.distributeEmptySpace(),this.layoutViews()},q=()=>{for(const W of this.viewItems)W.enabled=!0;C.release(),this.saveProportions(),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",q),document.removeEventListener("pointercancel",q),document.removeEventListener("contextmenu",q),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",F),document.addEventListener("pointerup",q),document.addEventListener("pointercancel",q),document.addEventListener("contextmenu",q)};u.addEventListener("pointerdown",d);const c={container:u,disposable:()=>{u.removeEventListener("pointerdown",d),this.sashContainer.removeChild(u)}};this.sashContainer.appendChild(u),this.sashes.push(c)}o||this.relayout([n]),!o&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const n=Math.floor(t/e.length);for(const a of e)a.size=et(n,a.minimumSize,a.maximumSize);const o=gi(this.viewItems.length),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);this.relayout(h,w)}removeView(e,t,n=!1){const o=this.viewItems.splice(e,1)[0];if(o.dispose(),this.viewItems.length>=1){const h=Math.max(e-1,0);this.sashes.splice(h,1)[0].disposable()}return n||this.relayout(),t&&t.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(o.view),o.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,t){const n=this.getViewCachedVisibleSize(e),o=typeof n>"u"?this.getViewSize(e):Wt.Invisible(n),h=this.removeView(e,void 0,!0);this.addView(h,o,t)}layout(e,t){const n=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let o=0;for(let h=0;h<this.viewItems.length;h++){const w=this.viewItems[h],a=this.proportions[h];typeof a=="number"?o+=a:e-=w.size}for(let h=0;h<this.viewItems.length;h++){const w=this.viewItems[h],a=this.proportions[h];typeof a=="number"&&o>0&&(w.size=et(Math.round(a*e/o),w.minimumSize,w.maximumSize))}}else{const o=gi(this.viewItems.length),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);this.resize(this.viewItems.length-1,e-n,void 0,h,w)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const n=this.viewItems.reduce((o,h)=>o+h.size,0);this.resize(this.viewItems.length-1,this._size-n,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const t=this.viewItems.reduce((a,l)=>a+l.size,0);let n=this.size-t;const o=gi(this.viewItems.length-1,-1),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);for(const a of w)Dl(o,a);for(const a of h)yo(o,a);typeof e=="number"&&yo(o,e);for(let a=0;n!==0&&a<o.length;a++){const l=this.viewItems[o[a]],u=et(l.size+n,l.minimumSize,l.maximumSize),d=u-l.size;n-=d,l.size=u}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((l,u)=>l+u.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(l=>l.visible),t=Math.max(0,e.length-1),n=this.margin*t/Math.max(1,e.length);let o=0;const h=[],w=4,a=this.viewItems.reduce((l,u,d)=>{const c=u.visible?1:0;return d===0?l.push(c):l.push(l[d-1]+c),l},[]);this.viewItems.forEach((l,u)=>{o+=this.viewItems[u].size,h.push(o);const d=l.visible?l.size-n:0,c=Math.max(0,a[u]-1),b=u===0||c===0?0:h[u-1]+c/t*n;if(u<this.viewItems.length-1){const C=l.visible?b+d-w/2+this.margin/2:b;this._orientation===Pe.HORIZONTAL&&(this.sashes[u].container.style.left=`${C}px`,this.sashes[u].container.style.top="0px"),this._orientation===Pe.VERTICAL&&(this.sashes[u].container.style.left="0px",this.sashes[u].container.style.top=`${C}px`)}this._orientation===Pe.HORIZONTAL&&(l.container.style.width=`${d}px`,l.container.style.left=`${b}px`,l.container.style.top="",l.container.style.height=""),this._orientation===Pe.VERTICAL&&(l.container.style.height=`${d}px`,l.container.style.top=`${b}px`,l.container.style.width="",l.container.style.left=""),l.view.layout(l.size-n,this._orthogonalSize)})}findFirstSnapIndex(e){for(const t of e){const n=this.viewItems[t];if(n.visible&&n.snap)return t}for(const t of e){const n=this.viewItems[t];if(n.visible&&n.maximumSize-n.minimumSize>0)return;if(!n.visible&&n.snap)return t}}updateSashEnablement(){let e=!1;const t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;const n=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),o=[...this.viewItems].reverse();e=!1;const h=o.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;const w=o.map(l=>e=l.maximumSize-l.size>0||e).reverse();let a=0;for(let l=0;l<this.sashes.length;l++){const u=this.sashes[l],d=this.viewItems[l];a+=d.size;const c=!(t[l]&&w[l+1]),b=!(n[l]&&h[l+1]);if(c&&b){const C=gi(l,-1),S=gi(l+1,this.viewItems.length),y=this.findFirstSnapIndex(C),g=this.findFirstSnapIndex(S),_=typeof y=="number"&&!this.viewItems[y].visible,m=typeof g=="number"&&!this.viewItems[g].visible;_&&h[l]&&(a>0||this.startSnappingEnabled)?this.updateSash(u,ii.MINIMUM):m&&t[l]&&(a<this._contentSize||this.endSnappingEnabled)?this.updateSash(u,ii.MAXIMUM):this.updateSash(u,ii.DISABLED)}else c&&!b?this.updateSash(u,ii.MINIMUM):!c&&b?this.updateSash(u,ii.MAXIMUM):this.updateSash(u,ii.ENABLED)}}updateSash(e,t){we(e.container,"dv-disabled",t===ii.DISABLED),we(e.container,"dv-enabled",t===ii.ENABLED),we(e.container,"dv-maximum",t===ii.MAXIMUM),we(e.container,"dv-minimum",t===ii.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),t=this._orientation===Pe.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${t}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const zl=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});class ru extends Se{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,t){var n;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orientation=(n=t.orientation)!==null&&n!==void 0?n:Pe.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new Ns(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:t.descriptor}),this.getPanes().forEach(o=>{const h=new Se(o.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),w={pane:o,disposable:{dispose:()=>{h.dispose()}}};this.paneItems.push(w),o.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,t){this.splitview.setViewVisible(e,t)}addPane(e,t,n=this.splitview.length,o=!1){const h=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),w={pane:e,disposable:{dispose:()=>{h.dispose()}}};this.paneItems.splice(n,0,w),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,n,o)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,t={skipDispose:!1}){const n=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.skipDispose||(n.disposable.dispose(),n.pane.dispose()),n}moveView(e,t){if(e===t)return;const n=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(n.pane,n.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),bi(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,wi(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class St{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===Pe.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===Pe.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===Pe.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===Pe.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===Pe.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===Pe.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,t,n,o=0){this.view=e,this.orientation=t,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orthogonalSize=n,this._size=o,this._disposable=this.view.onDidChange(h=>{h?this._onDidChange.fire({size:this.orientation===Pe.VERTICAL?h.width:h.height,orthogonalSize:this.orientation===Pe.VERTICAL?h.height:h.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class lt extends Se{get width(){return this.orientation===Pe.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===Pe.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===Pe.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===Pe.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===Pe.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===Pe.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return ht.Normal;const e=this.children.map(t=>typeof t.priority>"u"?ht.Normal:t.priority);return e.some(t=>t===ht.High)?ht.High:e.some(t=>t===ht.Low)?ht.Low:ht.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(t=>{t instanceof lt&&(t.margin=e)})}constructor(e,t,n,o,h,w,a,l){if(super(),this.orientation=e,this.proportionalLayout=t,this.styles=n,this._childrenDisposable=Ve.NONE,this.children=[],this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new Q,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=h,this._size=o,this.element=document.createElement("div"),this.element.className="dv-branch-node",!l)this.splitview=new Ns(this.element,{orientation:this.orientation,proportionalLayout:t,styles:n,margin:a}),this.splitview.layout(this.size,this.orthogonalSize);else{const u={views:l.map(d=>({view:d.node,size:d.node.size,visible:d.node instanceof St&&d.visible!==void 0?d.visible:!0})),size:this.orthogonalSize};this.children=l.map(d=>d.node),this.splitview=new Ns(this.element,{orientation:this.orientation,descriptor:u,proportionalLayout:t,styles:n,margin:a})}this.disabled=w,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===t)return;const n=this.splitview.contentSize===0;this.splitview.setViewVisible(e,t);const o=this.splitview.contentSize===0;(t&&n||!t&&o)&&this._onDidVisibilityChange.fire({visible:t})}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const n=this._removeChild(e);this._addChild(n,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(t,e)}addChild(e,t,n,o){if(n<0||n>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,n,o),this._addChild(e,n)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Se(ri.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,t)=>e instanceof lt?e.onDidVisibilityChange(({visible:n})=>{this.setChildVisible(t,n)}):Ve.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function Bl(p,e){if(p instanceof St)return p;if(p instanceof lt)return Bl(p.children[e?p.children.length-1:0],e);throw new Error("invalid node")}function ap(p,e,t){if(p instanceof lt){const n=new lt(p.orientation,p.proportionalLayout,p.styles,e,t,p.disabled,p.margin);for(let o=p.children.length-1;o>=0;o--){const h=p.children[o];n.addChild(ap(h,h.size,h.orthogonalSize),h.size,0,!0)}return n}else return new St(p.view,p.orientation,t)}function Hl(p,e,t){if(p instanceof lt){const n=new lt(Ti(p.orientation),p.proportionalLayout,p.styles,e,t,p.disabled,p.margin);let o=0;for(let h=p.children.length-1;h>=0;h--){const w=p.children[h],a=w instanceof lt?w.orthogonalSize:w.size;let l=p.size===0?0:Math.round(e*a/p.size);o+=l,h===0&&(l+=e-o),n.addChild(Hl(w,t,l),l,0,!0)}return n}else return new St(p.view,Ti(p.orientation),t)}function bg(p){const e=p.parentElement;if(!e)throw new Error("Invalid grid element");let t=e.firstElementChild,n=0;for(;t!==p&&t!==e.lastElementChild&&t;)t=t.nextElementSibling,n++;return n}function Je(p){const e=p.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const t=bg(e),n=e.parentElement.parentElement.parentElement;return[...Je(n),t]}function si(p,e,t){const n=Sg(p,e),o=yg(t);if(n===o){const[h,w]=ji(e);let a=w;return(t==="right"||t==="bottom")&&(a+=1),[...h,a]}else{const h=t==="right"||t==="bottom"?1:0;return[...e,h]}}function yg(p){return p==="top"||p==="bottom"?Pe.VERTICAL:Pe.HORIZONTAL}function Sg(p,e){return e.length%2===0?Ti(p):p}const Ti=p=>p===Pe.HORIZONTAL?Pe.VERTICAL:Pe.HORIZONTAL;function Cg(p){return!!p.children}const Fl=(p,e)=>{const t=e===Pe.VERTICAL?p.box.width:p.box.height;return Cg(p)?{type:"branch",data:p.children.map(n=>Fl(n,Ti(e))),size:t}:typeof p.cachedVisibleSize=="number"?{type:"leaf",data:p.view.toJSON(),size:p.cachedVisibleSize,visible:!1}:{type:"leaf",data:p.view.toJSON(),size:t}};class lp{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:n}=this.root;this.root=Hl(this.root,n,t),this.root.layout(t,n)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const t=[this.root];for(;t.length>0;){const n=t.pop();n instanceof lt&&(n.disabled=e,t.push(...n.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var t;const n=Je(e.element),[o,h]=this.getNode(n);if(!(h instanceof St)||((t=this._maximizedNode)===null||t===void 0?void 0:t.leaf)===h)return;this.hasMaximizedView()&&this.exitMaximizedView(),Fl(this.getView(),this.orientation);const w=[];function a(l,u){for(let d=0;d<l.children.length;d++){const c=l.children[d];c instanceof St?c!==u&&(l.isChildVisible(d)?l.setChildVisible(d,!1):w.push(c)):a(c,u)}}a(this.root,h),this._maximizedNode={leaf:h,hiddenOnMaximize:w},this._onDidMaximizedNodeChange.fire({view:h.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;function t(o){for(let h=o.children.length-1;h>=0;h--){const w=o.children[h];w instanceof St?e.includes(w)||o.setChildVisible(h,!0):t(w)}}t(this.root);const n=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:n.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let t;e&&(t=Je(e.element));const n=this._onDidMaximizedNodeChange.pause();try{this.hasMaximizedView()&&this.exitMaximizedView();const h={root:Fl(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(h.maximizedNode={location:t}),e&&this.maximizeView(e),h}finally{n.dispose()}}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new lt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){const n=e.orientation,o=n===Pe.VERTICAL?e.height:e.width;if(this._deserialize(e.root,n,t,o),this.layout(e.width,e.height),e.maximizedNode){const h=e.maximizedNode.location,[w,a]=this.getNode(h);if(!(a instanceof St))return;this.maximizeView(a.view)}}_deserialize(e,t,n,o){this.root=this._deserializeNode(e,t,n,o)}_deserializeNode(e,t,n,o){var h;let w;if(e.type==="branch"){const l=e.data.map(u=>({node:this._deserializeNode(u,Ti(t),n,e.size),visible:u.visible}));w=new lt(t,this.proportionalLayout,this.styles,e.size,o,this.locked,this.margin,l)}else{const a=n.fromJSON(e);typeof e.visible=="boolean"&&((h=a.setVisible)===null||h===void 0||h.call(a,e.visible)),w=new St(a,t,o,e.size)}return w}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,t=e.children[0];if(t instanceof St)return;e.element.remove();const n=e.removeChild(0);e.dispose(),n.dispose(),this._root=ap(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(o=>{this._onDidChange.fire(o)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new lt(Ti(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Hl(t,t.orthogonalSize,t.size),Wt.Distribute,0)}else this._root.addChild(e,Wt.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(t=>{this._onDidChange.fire(t)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,n){const o={height:e.height,width:e.width};if(e instanceof St)return{box:o,view:e.view,cachedVisibleSize:n};const h=[];for(let w=0;w<e.children.length;w++){const a=e.children[w],l=e.getChildCachedVisibleSize(w);h.push(this._getViews(a,Ti(t),l))}return{box:o,children:h}}progmaticSelect(e,t=!1){const[n,o]=this.getNode(e);if(!(o instanceof St))throw new Error("invalid location");for(let h=n.length-1;h>-1;h--){const w=n[h],a=e[h]||0;if(t?a-1>-1:a+1<w.children.length)return Bl(w.children[t?a-1:a+1],t)}return Bl(this.root,t)}constructor(e,t,n,o,h){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new ft,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new Q,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new Q,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=o??!1,this._margin=h??0,this.root=new lt(n,e,t,0,0,this.locked,this.margin)}isViewVisible(e){const[t,n]=ji(e),[,o]=this.getNode(t);if(!(o instanceof lt))throw new Error("Invalid from location");return o.isChildVisible(n)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[n,o]=ji(e),[,h]=this.getNode(n);if(!(h instanceof lt))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),h.setChildVisible(o,t)}moveView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[,o]=this.getNode(e);if(!(o instanceof lt))throw new Error("Invalid location");o.moveChild(t,n)}addView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[o,h]=ji(n),[w,a]=this.getNode(o);if(a instanceof lt){const l=new St(e,Ti(a.orientation),a.orthogonalSize);a.addChild(l,t,h)}else{const[l,...u]=[...w].reverse(),[d,...c]=[...o].reverse();let b=0;const C=l.getChildCachedVisibleSize(d);typeof C=="number"&&(b=Wt.Invisible(C)),l.removeChild(d).dispose();const y=new lt(a.orientation,this.proportionalLayout,this.styles,a.size,a.orthogonalSize,this.locked,this.margin);l.addChild(y,a.size,d);const g=new St(a.view,l.orientation,a.size);y.addChild(g,b,0),typeof t!="number"&&t.type==="split"&&(t={type:"split",index:0});const _=new St(e,l.orientation,a.size);y.addChild(_,t,h)}}remove(e,t){const n=Je(e.element);return this.removeView(n,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[n,o]=ji(e),[h,w]=this.getNode(n);if(!(w instanceof lt))throw new Error("Invalid location");const a=w.children[o];if(!(a instanceof St))throw new Error("Invalid location");if(w.removeChild(o,t),a.dispose(),w.children.length!==1)return a.view;const l=w.children[0];if(h.length===0)return l instanceof St||(w.removeChild(0,t),this.root=l),a.view;const[u,...d]=[...h].reverse(),[c,...b]=[...n].reverse(),C=w.isChildVisible(0);w.removeChild(0,t);const S=u.children.map((y,g)=>u.getChildSize(g));if(u.removeChild(c,t).dispose(),l instanceof lt){S.splice(c,1,...l.children.map(y=>y.size));for(let y=0;y<l.children.length;y++){const g=l.children[y];u.addChild(g,g.size,c+y)}for(;l.children.length>0;)l.removeChild(0)}else{const y=new St(l.view,Ti(l.orientation),l.size),g=C?l.orthogonalSize:Wt.Invisible(l.orthogonalSize);u.addChild(y,g,c)}l.dispose();for(let y=0;y<S.length;y++)u.resizeChild(y,S[y]);return a.view}layout(e,t){const[n,o]=this.root.orientation===Pe.HORIZONTAL?[t,e]:[e,t];this.root.layout(n,o)}getNode(e,t=this.root,n=[]){if(e.length===0)return[n,t];if(!(t instanceof lt))throw new Error("Invalid location");const[o,...h]=e;if(o<0||o>=t.children.length)throw new Error("Invalid location");const w=t.children[o];return n.push(t),this.getNode(h,w,n)}}const Wl=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class nh extends Se{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._lastWidth=-1,this._lastHeight=-1,this._disableResizing=t,this._element=e,this.addDisposables(cr(this._element,n=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!dg(this._element))return;const o=Math.round(n.contentRect.width),h=Math.round(n.contentRect.height);o===this._lastWidth&&h===this._lastHeight||(this._lastWidth=o,this._lastHeight=h,this.layout(o,h))}))}}const xg=sh();function Lo(p){switch(p){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class hp extends nh{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._id=xg.next(),this._groups=new Map,this._onDidRemove=new Q,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new Q,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new Q,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new Q,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new iu,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new iu,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this.gridview=new lp(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(o=>{this._onDidMaximizedChange.fire({panel:o.view,isMaximized:o.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.forceRelayout()}),Ve.from(()=>{var o;(o=this.element.parentElement)===null||o===void 0||o.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),ri.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(Je(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(Je(e.element))}updateOptions(e){var t,n,o,h;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(t=e.disableAutoResizing)!==null&&t!==void 0?t:!1),"locked"in e&&(this.locked=(n=e.locked)!==null&&n!==void 0?n:!1),"margin"in e&&(this.gridview.margin=(o=e.margin)!==null&&o!==void 0?o:0),"className"in e&&this._classNames.setClassNames((h=e.className)!==null&&h!==void 0?h:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],n,o=this.gridview){o.addView(e,n??Wt.Distribute,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw new Error("invalid operation");const n=this._groups.get(e.id),o=this.gridview.remove(e,Wt.Distribute);if(n&&!(t!=null&&t.skipDispose)&&(n.disposable.dispose(),n.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(t!=null&&t.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupActive(h.length>0?h[0].value:void 0)}return o}getPanel(e){var t;return(t=this._groups.get(e))===null||t===void 0?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const n=Je(e.group.element),o=(t=this.gridview.next(n))===null||t===void 0?void 0:t.view;this.doSetGroupActive(o)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const n=Je(e.group.element),o=(t=this.gridview.previous(n))===null||t===void 0?void 0:t.view;this.doSetGroupActive(o)}forceRelayout(){this.layout(this.width,this.height,!0)}layout(e,t,n){(n||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class cp{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,t){this.component.removePanel(e,t)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class lr{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class dp{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,t,n=!1){this.component.layout(e,t,n)}addPanel(e){return this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class rh{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get tabGroupColors(){return this.component.tabGroupColorPalette.entries()}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillMutateLayout(){return this.component.onWillMutateLayout}get onDidMutateLayout(){return this.component.onDidMutateLayout}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidAddPopoutGroup(){return this.component.onDidAddPopoutGroup}get onDidRemovePopoutGroup(){return this.component.onDidRemovePopoutGroup}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}getPopouts(){return this.component.getPopouts()}get onDidCreateTabGroup(){return this.component.onDidCreateTabGroup}get onDidDestroyTabGroup(){return this.component.onDidDestroyTabGroup}get onDidAddPanelToTabGroup(){return this.component.onDidAddPanelToTabGroup}get onDidRemovePanelFromTabGroup(){return this.component.onDidRemovePanelFromTabGroup}get onDidTabGroupChange(){return this.component.onDidTabGroupChange}get onDidTabGroupCollapsedChange(){return this.component.onDidTabGroupCollapsedChange}get panels(){return this.component.panels}get groups(){return this.component.groups}adjacentGroupInDirection(e,t){return this.component.adjacentGroupInDirection(e,t)}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,n=!1){this.component.layout(e,t,n)}addPanel(e){return this.component.withOrigin("api",()=>this.component.addPanel(e))}removePanel(e){this.component.withOrigin("api",()=>this.component.removePanel(e))}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.withOrigin("api",()=>this.component.closeAllGroups())}removeGroup(e){this.component.withOrigin("api",()=>this.component.removeGroup(e))}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.withOrigin("api",()=>this.component.addFloatingGroup(e,t))}fromJSON(e,t){this.component.withOrigin("api",()=>this.component.fromJSON(e,t))}toJSON(){return this.component.toJSON()}clear(){this.component.withOrigin("api",()=>this.component.clear())}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.withOrigin("api",()=>this.component.addPopoutGroup(e,t))}addEdgeGroup(e,t){return this.component.addEdgeGroup(e,t)}getEdgeGroup(e){return this.component.getEdgeGroup(e)}setEdgeGroupVisible(e,t){this.component.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this.component.isEdgeGroupVisible(e)}removeEdgeGroup(e){this.component.removeEdgeGroup(e)}updateOptions(e){this.component.updateOptions(e)}_getGroupModel(e){const t=this.component.getPanel(e);if(!t)throw new Error(`dockview: group '${e}' not found`);return t.model}createTabGroup(e){const t=this._getGroupModel(e.groupId);return this.component.withOrigin("api",()=>t.createTabGroup({label:e.label,color:e.color,componentParams:e.componentParams}))}dissolveTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.dissolveTabGroup(e.tabGroupId))}addPanelToTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.addPanelToTabGroup(e.tabGroupId,e.panelId,e.index))}removePanelFromTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.removePanelFromTabGroup(e.panelId))}getTabGroups(e){return this._getGroupModel(e.groupId).getTabGroups()}getTabGroupForPanel(e){return this._getGroupModel(e.groupId).getTabGroupForPanel(e.panelId)}moveTabGroup(e){this._getGroupModel(e.groupId).moveTabGroup(e.tabGroupId,e.index)}dispose(){this.component.dispose()}}class up extends Se{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(be(this.element,"drop",e=>{this.onDrop(e)}))}}const Dg={value:50,type:"percentage"},Eg=100,kg=100;function Vl(){const p=document.createElement("div");p.className="dv-drop-target-dropzone";const e=document.createElement("div");return e.className="dv-drop-target-selection",p.appendChild(e),{dropzone:p,selection:e}}function pp(p,e,t,n){var o,h,w;const a=(o=n==null?void 0:n.smallWidthBoundary)!==null&&o!==void 0?o:Eg,l=(h=n==null?void 0:n.smallHeightBoundary)!==null&&h!==void 0?h:kg,u=e<a,d=t<l,c=p==="left",b=p==="right",C=p==="top",S=p==="bottom",y=!u&&b,g=!u&&c,_=!d&&C,m=!d&&S;let v=1;const D=(w=n==null?void 0:n.size)!==null&&w!==void 0?w:Dg;return D.type==="percentage"?v=et(D.value,0,100)/100:((y||g)&&(v=et(0,D.value,e)/e),(_||m)&&(v=et(0,D.value,t)/t)),{isSmallX:u,isSmallY:d,isLeft:c,isRight:b,isTop:C,isBottom:S,rightClass:y,leftClass:g,topClass:_,bottomClass:m,size:v}}function fp(p,e,t,n,o){const h=pp(e,t,n,o),{rightClass:w,leftClass:a,topClass:l,bottomClass:u,size:d}=h,c={top:"0px",left:"0px",width:"100%",height:"100%"};w?(c.left=`${100*(1-d)}%`,c.width=`${100*d}%`):a?c.width=`${100*d}%`:l?c.height=`${100*d}%`:u&&(c.top=`${100*(1-d)}%`,c.height=`${100*d}%`),h.isSmallX&&h.isLeft&&(c.width="4px"),h.isSmallX&&h.isRight&&(c.left=`${t-4}px`,c.width="4px"),h.isSmallY&&h.isTop&&(c.height="4px"),h.isSmallY&&h.isBottom&&(c.top=`${n-4}px`,c.height="4px"),p.style.top=c.top,p.style.left=c.left,p.style.width=c.width,p.style.height=c.height,p.style.visibility="visible",(!p.style.transform||p.style.transform==="")&&(p.style.transform="translate3d(0, 0, 0)");const b=h.isSmallX&&(h.isLeft||h.isRight)||h.isSmallY&&(h.isTop||h.isBottom);we(p,"dv-drop-target-small-vertical",h.isSmallY),we(p,"dv-drop-target-small-horizontal",h.isSmallX),we(p,"dv-drop-target-selection-line",b),we(p,"dv-drop-target-left",h.isLeft),we(p,"dv-drop-target-right",h.isRight),we(p,"dv-drop-target-top",h.isTop),we(p,"dv-drop-target-bottom",h.isBottom),we(p,"dv-drop-target-center",e==="center")}function Pg(p,e){const t=`${Math.round(e.top)}px`,n=`${Math.round(e.left)}px`,o=`${Math.round(e.width)}px`,h=`${Math.round(e.height)}px`;return p.style.top!==t||p.style.left!==n||p.style.width!==o||p.style.height!==h}function Tg(p,e){p.style.top=`${Math.round(e.top)}px`,p.style.left=`${Math.round(e.left)}px`,p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.visibility="visible",(!p.style.transform||p.style.transform==="")&&(p.style.transform="translate3d(0, 0, 0)")}function mp(p){const e=pp(p.quadrant,p.width,p.height,p.overlayModel),{rightClass:t,leftClass:n,topClass:o,bottomClass:h,size:w}=e,a=p.outlineElement.getBoundingClientRect(),l=p.targetModel.getElements(void 0,p.outlineElement),u=l.root,d=l.overlay,c=u.getBoundingClientRect(),b=a.top-c.top,C=a.left-c.left,S={top:b,left:C,width:p.width,height:p.height};return t?(S.left=C+p.width*(1-w),S.width=p.width*w):n?S.width=p.width*w:o?S.height=p.height*w:h&&(S.top=b+p.height*(1-w),S.height=p.height*w),e.isSmallX&&e.isLeft&&(S.width=4),e.isSmallX&&e.isRight&&(S.left=C+p.width-4,S.width=4),e.isSmallY&&e.isTop&&(S.height=4),e.isSmallY&&e.isBottom&&(S.top=b+p.height-4,S.height=4),Pg(d,S)?(Tg(d,S),d.className=`dv-drop-target-anchor${p.className?` ${p.className}`:""}`,we(d,"dv-drop-target-left",e.isLeft),we(d,"dv-drop-target-right",e.isRight),we(d,"dv-drop-target-top",e.isTop),we(d,"dv-drop-target-bottom",e.isBottom),we(d,"dv-drop-target-anchor-line",e.isSmallX&&(e.isLeft||e.isRight)||e.isSmallY&&(e.isTop||e.isBottom)),we(d,"dv-drop-target-center",p.quadrant==="center"),l.changed&&(we(d,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{we(d,"dv-drop-target-anchor-container-changed",!1)},10)),{boundsChanged:!0,targetChanged:l.changed}):{boundsChanged:!1,targetChanged:l.changed}}class gp extends ih{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function ou(p){switch(p){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${p}'`)}}function Ag(p){switch(p){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${p}'`)}}const Ig={value:20,type:"percentage"};class $i extends Se{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new up(this.element,{onDragEnter:()=>{var n,o,h;(h=(o=(n=this.options).getOverrideTarget)===null||o===void 0?void 0:o.call(n))===null||h===void 0||h.getElements()},onDragOver:n=>{var o,h,w,a,l,u,d;$i.ACTUAL_TARGET=this;const c=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);if(this._acceptedTargetZonesSet.size===0){if(c)return;this.removeDropTarget();return}const b=(l=(a=(w=this.options).getOverlayOutline)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:this.element,C=b.offsetWidth,S=b.offsetHeight;if(C===0||S===0)return;const y=n.currentTarget.getBoundingClientRect(),g=((u=n.clientX)!==null&&u!==void 0?u:0)-y.left,_=((d=n.clientY)!==null&&d!==void 0?d:0)-y.top,m=this.calculateQuadrant(this._acceptedTargetZonesSet,g,_,C,S);if(this.isAlreadyUsed(n)||m===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(n,m)){if(c)return;this.removeDropTarget();return}const v=new gp({nativeEvent:n,position:m});if(this._onWillShowOverlay.fire(v),v.defaultPrevented){this.removeDropTarget();return}if(this.markAsUsed(n),!c){if(!this.targetElement){const D=Vl();this.targetElement=D.dropzone,this.overlayElement=D.selection,this._state="center",b.classList.add("dv-drop-target"),b.append(this.targetElement)}}this.toggleClasses(m,C,S),this._state=m},onDragLeave:()=>{var n,o;!((o=(n=this.options).getOverrideTarget)===null||o===void 0)&&o.call(n)||this.removeDropTarget()},onDragEnd:n=>{var o,h;const w=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);w&&$i.ACTUAL_TARGET===this&&this._state&&(n.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:n})),this.removeDropTarget(),w==null||w.clear()},onDrop:n=>{var o,h,w;n.preventDefault();const a=this._state;this.removeDropTarget(),(w=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o))===null||w===void 0||w.clear(),a&&(n.stopPropagation(),this._onDrop.fire({position:a,nativeEvent:n}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[$i.USED_EVENT_ID]=!0}isAlreadyUsed(e){const t=e[$i.USED_EVENT_ID];return typeof t=="boolean"&&t}toggleClasses(e,t,n){var o,h,w,a,l;const u=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);if(u){const d=(l=(a=(w=this.options).getOverlayOutline)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:this.element;mp({outlineElement:d,targetModel:u,quadrant:e,width:t,height:n,overlayModel:this.options.overlayModel,className:this.options.className});return}this.overlayElement&&fp(this.overlayElement,e,t,n,this.options.overlayModel)}calculateQuadrant(e,t,n,o,h){var w,a;const l=(a=(w=this.options.overlayModel)===null||w===void 0?void 0:w.activationSize)!==null&&a!==void 0?a:Ig;return l.type==="percentage"?vp(e,t,n,o,h,l.value):_p(e,t,n,o,h,l.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}showOverlay(e){var t,n,o,h,w;const a=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t),l=(w=(h=(o=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(o))!==null&&w!==void 0?w:this.element,u=l.offsetWidth,d=l.offsetHeight;if(!a&&!this.targetElement){const c=Vl();this.targetElement=c.dropzone,this.overlayElement=c.selection,l.classList.add("dv-drop-target"),l.append(this.targetElement)}this.toggleClasses(e,u,d),this._state=e}clearOverlay(){var e,t,n;this.removeDropTarget(),(n=(t=(e=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(e))===null||n===void 0||n.clear(),this._state=void 0}}$i.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function vp(p,e,t,n,o,h){const w=100*e/n,a=100*t/o;return p.has("left")&&w<h?"left":p.has("right")&&w>100-h?"right":p.has("top")&&a<h?"top":p.has("bottom")&&a>100-h?"bottom":p.has("center")?"center":null}function _p(p,e,t,n,o,h){return p.has("left")&&e<h?"left":p.has("right")&&e>n-h?"right":p.has("top")&&t<h?"top":p.has("bottom")&&t>o-h?"bottom":p.has("center")?"center":null}function Lg(p,e,t){var n,o;bi(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),p.setDragImage(e,(n=t==null?void 0:t.x)!==null&&n!==void 0?n:0,(o=t==null?void 0:t.y)!==null&&o!==void 0?o:0),setTimeout(()=>{wi(e,"dv-dragged"),e.remove()},0)}class Ui extends Se{static getInstance(){return Ui._instance||(Ui._instance=new Ui),Ui._instance}constructor(){super(),this._targets=new Set,this._targetByElement=new Map,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._onDragMove=new Q,this.onDragMove=this._onDragMove.event,this._onDragEnd=new Q,this.onDragEnd=this._onDragEnd.event,this.addDisposables(this._onDragStart,this._onDragMove,this._onDragEnd)}get active(){return this._active}registerTarget(e){return this._targets.add(e),this._targetByElement.set(e.element,e),{dispose:()=>{this._targets.delete(e),this._targetByElement.get(e.element)===e&&this._targetByElement.delete(e.element),this._currentTarget===e&&(this._currentTarget=void 0)}}}beginDrag(e){var t,n,o;this._active&&this.cancel();const{pointerEvent:h,source:w}=e,a=e.getData();this._active={pointerId:h.pointerId,startX:h.clientX,startY:h.clientY,source:w},this._onDragMoveCallback=e.onDragMove,this._onDragEndCallback=e.onDragEnd,this._dataDisposable=a,this._ghost=e.ghost,this._iframeShield=ar((t=w.ownerDocument)!==null&&t!==void 0?t:document);const l={clientX:h.clientX,clientY:h.clientY,pointerEvent:h};this._onDragStart.fire(l);const u=(o=(n=w.ownerDocument)===null||n===void 0?void 0:n.defaultView)!==null&&o!==void 0?o:window;this._moveListener=be(u,"pointermove",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleMove(d)}),this._upListener=be(u,"pointerup",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleEnd(d,!0)}),this._cancelListener=be(u,"pointercancel",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleEnd(d,!1)})}cancel(){var e,t;this._active&&((e=this._currentTarget)===null||e===void 0||e.handleDragLeave(),this._teardown(),(t=this._dataDisposable)===null||t===void 0||t.dispose(),this._dataDisposable=void 0)}_findTargetUnder(e,t){var n,o;const w=((o=(n=this._active)===null||n===void 0?void 0:n.source.ownerDocument)!==null&&o!==void 0?o:document).elementsFromPoint(e,t);for(const a of w){let l=a;for(;l;){const u=this._targetByElement.get(l);if(u)return u;l=l.parentElement}}}_handleMove(e){var t,n,o;(t=this._ghost)===null||t===void 0||t.update(e.clientX,e.clientY);const h={clientX:e.clientX,clientY:e.clientY,pointerEvent:e},w=this._findTargetUnder(e.clientX,e.clientY);w!==this._currentTarget&&((n=this._currentTarget)===null||n===void 0||n.handleDragLeave(),this._currentTarget=w),w&&w.handleDragOver(h),(o=this._onDragMoveCallback)===null||o===void 0||o.call(this,h),this._onDragMove.fire(h)}_handleEnd(e,t){var n;const o={clientX:e.clientX,clientY:e.clientY,pointerEvent:e};t&&this._currentTarget?this._currentTarget.handleDrop(o):(n=this._currentTarget)===null||n===void 0||n.handleDragLeave();const h=this._onDragEndCallback,w=this._dataDisposable;this._teardown(),this._dataDisposable=void 0,setTimeout(()=>w==null?void 0:w.dispose(),0),h==null||h(o,t),this._onDragEnd.fire(o)}_teardown(){var e,t,n,o,h;this._currentTarget=void 0,this._active=void 0,this._onDragMoveCallback=void 0,this._onDragEndCallback=void 0,(e=this._ghost)===null||e===void 0||e.dispose(),this._ghost=void 0,(t=this._iframeShield)===null||t===void 0||t.release(),this._iframeShield=void 0,(n=this._moveListener)===null||n===void 0||n.dispose(),(o=this._upListener)===null||o===void 0||o.dispose(),(h=this._cancelListener)===null||h===void 0||h.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}}const Rg={value:20,type:"percentage"};class Mg extends Se{get disabled(){return this._disabled}set disabled(e){this._disabled=e,e&&this._removeOverlay()}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(t.acceptedTargetZones);const n={element:this.element,handleDragOver:o=>this._onDragOver(o),handleDragLeave:()=>this._onDragLeave(),handleDrop:o=>this._onDropEvent(o)};this.addDisposables(this._onDrop,this._onWillShowOverlay,Ui.getInstance().registerTarget(n))}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this._removeOverlay(),super.dispose()}_onDragOver(e){var t,n,o,h,w;if(this._disabled){this._removeOverlay();return}const a=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t);if(this._acceptedTargetZonesSet.size===0){if(a)return;this._removeOverlay();return}const l=(w=(h=(o=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(o))!==null&&w!==void 0?w:this.element,u=l.offsetWidth,d=l.offsetHeight;if(u===0||d===0)return;const c=l.getBoundingClientRect(),b=e.clientX-c.left,C=e.clientY-c.top,S=this._calculateQuadrant(b,C,u,d);if(S===null){this._removeOverlay();return}if(!this.options.canDisplayOverlay(e.pointerEvent,S)){if(a)return;this._removeOverlay();return}const y=new gp({nativeEvent:e.pointerEvent,position:S});if(this._onWillShowOverlay.fire(y),y.defaultPrevented){this._removeOverlay();return}if(a){mp({outlineElement:l,targetModel:a,quadrant:S,width:u,height:d,overlayModel:this.options.overlayModel,className:this.options.className}),this._state=S;return}if(!this._targetElement){const g=Vl();this._targetElement=g.dropzone,this._overlayElement=g.selection,this._state="center",this.element.classList.add("dv-drop-target"),this.element.append(this._targetElement)}this._overlayElement&&fp(this._overlayElement,S,u,d,this.options.overlayModel),this._state=S}_onDragLeave(){var e,t;const n=(t=(e=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(e);if(n){this._state=void 0,n.clear();return}this._removeOverlay()}_onDropEvent(e){var t,n;const o=this._state,h=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t);this._removeOverlay(),h==null||h.clear(),o&&this._onDrop.fire({position:o,nativeEvent:e.pointerEvent})}_calculateQuadrant(e,t,n,o){var h,w;const a=(w=(h=this.options.overlayModel)===null||h===void 0?void 0:h.activationSize)!==null&&w!==void 0?w:Rg;return a.type==="percentage"?vp(this._acceptedTargetZonesSet,e,t,n,o,a.value):_p(this._acceptedTargetZonesSet,e,t,n,o,a.value)}_removeOverlay(){var e;this._targetElement?(this._state=void 0,(e=this._targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this._targetElement.remove(),this._targetElement=void 0,this._overlayElement=void 0):this._state=void 0}}const Og=5,Gg=250,Ng=8;class zg extends Se{constructor(e,t){var n;super(),this.element=e,this.options=t,this._disabled=!1,this._armed=!1,this._startX=0,this._startY=0,this._touchOnly=(n=t.touchOnly)!==null&&n!==void 0?n:!0,this.addDisposables(be(this.element,"pointerdown",o=>{this._onPointerDown(o)}))}setDisabled(e){this._disabled=e,e&&this._cancelPending()}setTouchOnly(e){this._touchOnly!==e&&(this._touchOnly=e,e&&this._cancelPending())}_shouldHandle(e){var t,n;return!(this._disabled||this._touchOnly&&e.pointerType!=="touch"&&e.pointerType!=="pen"||!((n=(t=this.options).isCancelled)===null||n===void 0)&&n.call(t,e))}_onPointerDown(e){var t,n,o,h,w;if(!this._shouldHandle(e))return;this._cancelPending(),this._pendingPointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY,this._startEvent=e;const a=e.pointerType==="touch"||e.pointerType==="pen",l=this.options.touchInitiationDelay,u=(t=typeof l=="function"?l():l)!==null&&t!==void 0?t:Gg;this._armed=!a||u<=0,a&&u>0&&isFinite(u)&&(this._armTimer=setTimeout(()=>{this._armTimer=void 0,this._armed=!0},u));const d=(n=this.options.threshold)!==null&&n!==void 0?n:Og,c=this.options.pressTolerance,b=(o=typeof c=="function"?c():c)!==null&&o!==void 0?o:Ng,C=(w=(h=this.element.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&w!==void 0?w:window;this._pendingMoveListener=be(C,"pointermove",S=>{if(S.pointerId!==this._pendingPointerId)return;const y=S.clientX-this._startX,g=S.clientY-this._startY,_=Math.hypot(y,g);if(this._armed){_>=d&&this._beginDrag(S);return}_>b&&this._beginDrag(S)}),this._pendingUpListener=be(C,"pointerup",S=>{S.pointerId===this._pendingPointerId&&this._cancelPending()}),this._pendingCancelListener=be(C,"pointercancel",S=>{S.pointerId===this._pendingPointerId&&this._cancelPending()})}cancelPending(){this._cancelPending()}_cancelPending(){var e,t,n;this._pendingPointerId=void 0,this._armTimer!==void 0&&(clearTimeout(this._armTimer),this._armTimer=void 0),this._armed=!1,(e=this._pendingMoveListener)===null||e===void 0||e.dispose(),(t=this._pendingUpListener)===null||t===void 0||t.dispose(),(n=this._pendingCancelListener)===null||n===void 0||n.dispose(),this._pendingMoveListener=void 0,this._pendingUpListener=void 0,this._pendingCancelListener=void 0,this._startEvent=void 0}_beginDrag(e){var t,n,o,h,w;const a=(t=this._startEvent)!==null&&t!==void 0?t:e;this._cancelPending(),(o=(n=this.options).onDragStart)===null||o===void 0||o.call(n,a);const l=(w=(h=this.options).createGhost)===null||w===void 0?void 0:w.call(h,a);Ui.getInstance().beginDrag({pointerEvent:e,source:this.element,getData:()=>this.options.getData(a),ghost:l,onDragMove:this.options.onDragMove,onDragEnd:this.options.onDragEnd})}dispose(){this._cancelPending(),super.dispose()}}class Bg{constructor(e){var t,n,o,h,w;this._disposed=!1,this.element=e.element,this.offsetX=(t=e.offsetX)!==null&&t!==void 0?t:0,this.offsetY=(n=e.offsetY)!==null&&n!==void 0?n:0,this.element.style.position="fixed",this.element.style.left="0px",this.element.style.top="0px",this.element.style.pointerEvents="none",this.element.style.zIndex="99999",this.element.style.opacity=String((o=e.opacity)!==null&&o!==void 0?o:.8),this.element.style.willChange="transform",this.element.style.transform=`translate3d(${e.initialX-this.offsetX}px, ${e.initialY-this.offsetY}px, 0)`,((w=(h=e.owner)===null||h===void 0?void 0:h.ownerDocument)!==null&&w!==void 0?w:document).body.appendChild(this.element)}update(e,t){this._disposed||(this.element.style.transform=`translate3d(${e-this.offsetX}px, ${t-this.offsetY}px, 0)`)}dispose(){this._disposed||(this._disposed=!0,this.element.remove())}}class Hg extends Se{constructor(e,t){super(),this.el=e,this.opts=t,this._dataDisposable=new ft,this._pointerEventsDisposable=new ft,this._disabled=!!t.disabled,this.addDisposables(this._dataDisposable,this._pointerEventsDisposable,be(this.el,"dragstart",n=>{var o,h,w,a,l,u,d,c,b;if(n.defaultPrevented||this._disabled||!((h=(o=this.opts).isCancelled)===null||h===void 0)&&h.call(o,n)){n.preventDefault();return}const C=ar((w=this.el.ownerDocument)!==null&&w!==void 0?w:document);this._pointerEventsDisposable.value={dispose:()=>C.release()},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this._dataDisposable.value=this.opts.getData(n);const S=(l=(a=this.opts).createGhost)===null||l===void 0?void 0:l.call(a,n);if(S&&n.dataTransfer&&(Lg(n.dataTransfer,S.element,{x:(u=S.offsetX)!==null&&u!==void 0?u:0,y:(d=S.offsetY)!==null&&d!==void 0?d:0}),S.dispose)){const y=S.dispose;setTimeout(()=>y(),0)}n.dataTransfer&&(n.dataTransfer.effectAllowed="move",n.dataTransfer.items.length===0&&n.dataTransfer.setData("text/plain","")),(b=(c=this.opts).onDragStart)===null||b===void 0||b.call(c,n)}),be(this.el,"dragend",n=>{var o,h;this._pointerEventsDisposable.dispose(),setTimeout(()=>this._dataDisposable.dispose(),0),(h=(o=this.opts).onDragEnd)===null||h===void 0||h.call(o,n)}))}setDisabled(e){this._disabled=e}setTouchOnly(e){}cancelPending(){}}class Fg{constructor(){this.kind="html5"}createDropTarget(e,t){return new $i(e,t)}createDragSource(e,t){return new Hg(e,t)}}class Wg{constructor(){this.kind="pointer"}createDropTarget(e,t){return new Mg(e,t)}createDragSource(e,t){const n=t.createGhost?h=>{const w=t.createGhost(h);if(!w)return;const a=new Bg({element:w.element,initialX:h.clientX,initialY:h.clientY,offsetX:w.offsetX,offsetY:w.offsetY,owner:e});if(w.dispose){const l=a.dispose.bind(a),u=w.dispose;a.dispose=()=>{l(),u()}}return a}:void 0,o=new zg(e,{getData:t.getData,isCancelled:t.isCancelled,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd?h=>t.onDragEnd(h.pointerEvent):void 0,createGhost:n,touchOnly:t.touchOnly,touchInitiationDelay:t.touchInitiationDelay,pressTolerance:t.pressTolerance,threshold:t.threshold});return t.disabled&&o.setDisabled(!0),o}}const vs=new Fg,Ki=new Wg,jl=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class Vg extends Qu{constructor(e,t,n,o){super(),this.nativeEvent=e,this.position=t,this.getData=n,this.panel=o}}class wp extends ih{constructor(){super()}}class bp extends Se{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new ft,this._onDidDimensionChange=new Q,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new Q,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new Q,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new Q,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new Q,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new Q,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new Q,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new Q,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(n=>{this._isFocused=n.isFocused}),this.onDidActiveChange(n=>{this._isActive=n.isActive}),this.onDidVisibilityChange(n=>{this._isVisible=n.isVisible}),this.onDidDimensionsChange(n=>{this._width=n.width,this._height=n.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(t=>{this._parameters=t,e.update({params:t})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class yp extends bp{constructor(e,t){super(e,t),this._onDidConstraintsChangeInternal=new Q,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new Q({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new Q,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class jg extends yp{set pane(e){this._pane=e}constructor(e,t){super(e,t),this._onDidExpansionChange=new Q({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new Q({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new Q({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var t;(t=this._pane)===null||t===void 0||t.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class oh extends Se{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,t,n){super(),this.id=e,this.component=t,this.api=n,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const o=ep(this._element);this.addDisposables(this.api,o.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),o.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),o)}focus(){const e=new wp;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,n;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(t=this._params)===null||t===void 0?void 0:t.params),e.params)});for(const o of Object.keys(e.params))e.params[o]===void 0&&delete this._params.params[o];(n=this.part)===null||n===void 0||n.update({params:this._params.params})}toJSON(){var e,t;const n=(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{};return{id:this.id,component:this.component,params:Object.keys(n).length>0?n:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class $g extends oh{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,n=this.isExpanded()?this._minimumBodySize:0;return e+n}get maximumSize(){const e=this.headerSize,n=this.isExpanded()?this._maximumBodySize:0;return e+n}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new jg(e.id,e.component)),this._onDidChangeExpansionState=new Q({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(t=>{const{isVisible:n}=t,{accessor:o}=this._params;o.setVisible(this,n)}),this.api.onDidSizeChange(t=>{this._onDidChange.fire({size:t.size})}),be(this.element,"mouseenter",t=>{this.api._onMouseEnter.fire(t)}),be(this.element,"mouseleave",t=>{this.api._onMouseLeave.fire(t)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(t=>{this.api._onDidExpansionChange.fire({isExpanded:t})}),this.api.onDidFocusChange(t=>{this.header&&(t.isFocused?bi(this.header,"focused"):wi(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var t;(t=this.body)===null||t===void 0||t.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,t){this._size=e,this._orthogonalSize=t;const[n,o]=this.orientation===Pe.HORIZONTAL?[e,t]:[t,e];super.layout(n,o)}init(e){var t,n;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(t=this.body)===null||t===void 0||t.append(this.bodyPart.element),(n=this.header)===null||n===void 0||n.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,n;(t=this.bodyPart)===null||t===void 0||t.update({params:e}),(n=this.headerPart)===null||n===void 0||n.update({params:e})},dispose:()=>{var e,t;(e=this.bodyPart)===null||e===void 0||e.dispose(),(t=this.headerPart)===null||t===void 0||t.dispose()}}}}class Ug extends $g{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOver),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,t=this.accessor.id;this.header.draggable=!0;const n={getData:()=>(_i.getInstance().setData([new or(t,e)],or.prototype),{dispose:()=>{_i.getInstance().clearData(or.prototype)}})};this.html5DragSource=vs.createDragSource(this.header,n),this.pointerDragSource=Ki.createDragSource(this.header,n);const h={acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(w,a)=>{const l=tr();if(l&&l.paneId!==this.id&&l.viewId===this.accessor.id)return!0;const u=new Vg(w,a,tr,this);return this._onUnhandledDragOver.fire(u),u.isAccepted}};this.target=vs.createDropTarget(this.element,h),this.pointerTarget=Ki.createDropTarget(this.element,h),this.addDisposables(this._onDidDrop,this.html5DragSource,this.pointerDragSource,this.target,this.pointerTarget,this.target.onDrop(w=>{this.onDrop(w)}),this.pointerTarget.onDrop(w=>{this.onDrop(w)}))}onDrop(e){const t=tr();if(!t||t.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new lr(this.accessor),getData:tr}));return}const n=this._params.containerApi,o=t.paneId,h=n.getPanel(o);if(!h){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:tr,api:new lr(this.accessor)}));return}const w=n.panels,a=w.indexOf(h);let l=n.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(l=Math.max(0,l-1)),(e.position==="right"||e.position==="bottom")&&(a>l&&l++,l=Math.min(w.length-1,l)),n.movePanel(a,l)}}let Kg=0;const Yg=()=>`dv-tabpanel-${Kg++}`;class Xg extends Se{get element(){return this._element}constructor(e,t){var n,o,h,w,a,l,u;super(),this.accessor=e,this.group=t,this.disposable=new ft,this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this._element.id=Yg(),this._element.setAttribute("role","tabpanel"),this.addDisposables(this._onDidFocus,this._onDidBlur);const d=()=>{var b;return(b=t.dropTargetContainer)===null||b===void 0?void 0:b.model},c=(b,C)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&C==="center")return!1;const S=it();return!S&&b.shiftKey&&this.group.location.type!=="floating"?!1:S&&S.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(b,C,"content")};this.dropTarget=new $i(this.element,{getOverlayOutline:()=>{var b;return((b=e.options.theme)===null||b===void 0?void 0:b.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:c,getOverrideTarget:d,overlayModel:(o=(n=this.accessor).resolveDropOverlayModel)===null||o===void 0?void 0:o.call(n,"content")}),this.pointerDropTarget=Ki.createDropTarget(this.element,{acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:c,getOverlayOutline:()=>{var b;return((b=e.options.theme)===null||b===void 0?void 0:b.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",getOverrideTarget:d,overlayModel:(w=(h=this.accessor).resolveDropOverlayModel)===null||w===void 0?void 0:w.call(h,"content")}),this.addDisposables(this.dropTarget,this.pointerDropTarget,(u=(l=(a=this.accessor).onDidOptionsChange)===null||l===void 0?void 0:l.call(a,()=>{var b,C,S;const y=(S=(C=(b=this.accessor).resolveDropOverlayModel)===null||C===void 0?void 0:C.call(b,"content"))!==null&&S!==void 0?S:{};this.dropTarget.setOverlayModel(y),this.pointerDropTarget.setOverlayModel(y)}))!==null&&u!==void 0?u:Ve.NONE)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}setLabelledBy(e){e?this._element.setAttribute("aria-labelledby",e):this._element.removeAttribute("aria-labelledby")}renderPanel(e,t={asActive:!0}){var n,o,h,w;const a=t.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&(this._element.removeChild(this.panel.view.content.element),(o=(n=this.panel.view.content).onHide)===null||o===void 0||o.call(n)),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&a&&(this._element.appendChild(this.panel.view.content.element),(w=(h=this.panel.view.content).onShow)===null||w===void 0||w.call(h)),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(a){const u=ep(l);this.focusTracker=u;const d=new Se;d.addDisposables(u,u.onDidFocus(()=>this._onDidFocus.fire()),u.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=d}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){var e,t,n;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element),(n=(t=this.panel.view.content).onHide)===null||n===void 0||n.call(t)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}const qg=500,Jg=8;class ah extends Se{constructor(e,t){super(),this.element=e,this.options=t,this._startX=0,this._startY=0,this.addDisposables(be(this.element,"pointerdown",n=>{this._onPointerDown(n)}))}_onPointerDown(e){var t,n,o,h,w;if(((t=this.options.touchOnly)!==null&&t!==void 0?t:!0)&&e.pointerType!=="touch"&&e.pointerType!=="pen")return;this._cancelPending(),this._pointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY;const l=(n=this.options.delay)!==null&&n!==void 0?n:qg,u=(o=this.options.tolerance)!==null&&o!==void 0?o:Jg,d=(w=(h=this.element.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&w!==void 0?w:window;this._timer=setTimeout(()=>{this._timer=void 0,this._cancelPending(),this._installContextMenuGuard(d),this._installClickGuard(d),this.options.onLongPress(e)},l),this._moveListener=be(d,"pointermove",c=>{if(c.pointerId!==this._pointerId)return;const b=c.clientX-this._startX,C=c.clientY-this._startY;Math.hypot(b,C)>u&&this._cancelPending()}),this._upListener=be(d,"pointerup",c=>{c.pointerId===this._pointerId&&this._cancelPending()}),this._cancelListener=be(d,"pointercancel",c=>{c.pointerId===this._pointerId&&this._cancelPending()})}_installContextMenuGuard(e){let t;const n=setTimeout(()=>t==null?void 0:t.dispose(),500);t=be(e,"contextmenu",o=>{o.preventDefault(),clearTimeout(n),t==null||t.dispose()},{capture:!0})}_installClickGuard(e){let t;const n=setTimeout(()=>t==null?void 0:t.dispose(),500);t=be(e,"click",o=>{const h=o.target;h&&this.element.contains(h)&&(o.preventDefault(),o.stopPropagation()),clearTimeout(n),t==null||t.dispose()},{capture:!0})}_cancelPending(){var e,t,n;this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0),this._pointerId=void 0,(e=this._moveListener)===null||e===void 0||e.dispose(),(t=this._upListener)===null||t===void 0||t.dispose(),(n=this._cancelListener)===null||n===void 0||n.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}dispose(){this._cancelPending(),super.dispose()}}function Ii(p){if(p.disableDnd)return{html5:!1,pointer:!1,pointerHandlesMouse:!1};switch(p.dndStrategy){case"pointer":return{html5:!1,pointer:!0,pointerHandlesMouse:!0};case"html5":return{html5:!0,pointer:!1,pointerHandlesMouse:!1};case"auto":case void 0:default:return Zg()?{html5:!1,pointer:!0,pointerHandlesMouse:!0}:{html5:!0,pointer:!0,pointerHandlesMouse:!1}}}function Zg(){if(typeof window>"u"||!window.matchMedia)return!1;const p=window.matchMedia("(pointer: coarse)").matches,e=window.matchMedia("(pointer: fine)").matches;return p&&!e}let Qg=0;const ev=()=>`dv-tab-${Qg++}`;class tv extends Se{get element(){return this._element}constructor(e,t,n){var o,h;super(),this.panel=e,this.accessor=t,this.group=n,this.content=void 0,this.panelTransfer=_i.getInstance(),this._direction="horizontal",this._onPointDown=new Q,this.onPointerDown=this._onPointDown.event,this._onTabClick=new Q,this.onTabClick=this._onTabClick.event,this._onDropped=new Q,this.onDrop=this._onDropped.event,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._onDragEnd=new Q,this.onDragEnd=this._onDragEnd.event;const w=Ii(this.accessor.options);this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=-1,this._element.draggable=w.html5,this._element.id=ev(),this._element.setAttribute("role","tab"),this._element.setAttribute("aria-selected","false");const a=(h=(o=this.group)===null||o===void 0?void 0:o.model)===null||h===void 0?void 0:h.contentContainerId;a&&this._element.setAttribute("aria-controls",a),we(this.element,"dv-inactive-tab",!0);const l=(d,c)=>{var b;if(this.group.locked)return!1;const C=it();return C&&this.accessor.id===C.viewId?((b=this.accessor.options.theme)===null||b===void 0?void 0:b.tabAnimation)!=="smooth":this.group.model.canDisplayOverlay(d,c,"tab")};this.dropTarget=vs.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:l,getOverrideTarget:()=>{var d;return(d=n.model.dropTargetContainer)===null||d===void 0?void 0:d.model}}),this.pointerDropTarget=Ki.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:l,getOverrideTarget:()=>{var d;return(d=n.model.dropTargetContainer)===null||d===void 0?void 0:d.model}});const u={getData:()=>(this.panelTransfer.setData([new ni(this.accessor.id,this.group.id,this.panel.id)],ni.prototype),{dispose:()=>{this.panelTransfer.clearData(ni.prototype)}}),createGhost:()=>({element:this._buildGhostElement(),offsetX:30,offsetY:-10}),onDragStart:d=>{var c;this._onDragStart.fire(d),!(d instanceof PointerEvent)&&((c=this.accessor.options.theme)===null||c===void 0?void 0:c.tabAnimation)==="smooth"&&requestAnimationFrame(()=>{we(this.element,"dv-tab--dragging",!0)})},onDragEnd:d=>{this._onDragEnd.fire(d)}};this.html5DragSource=vs.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.html5})),this.pointerDragSource=Ki.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.pointer,touchOnly:!w.pointerHandlesMouse,isCancelled:()=>!Ii(this.accessor.options).pointer})),this.onWillShowOverlay=ri.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this._onPointDown,this._onTabClick,this._onDropped,this._onDragStart,this._onDragEnd,this.accessor.onDidOptionsChange(()=>{const d=this._buildOverlayModel();this.dropTarget.setOverlayModel(d),this.pointerDropTarget.setOverlayModel(d)}),be(this._element,"dragend",()=>{we(this.element,"dv-tab--dragging",!1)}),this.html5DragSource,be(this._element,"pointerdown",d=>{this._onPointDown.fire(d)}),be(this._element,"click",d=>{this._onTabClick.fire(d)}),be(this._element,"contextmenu",d=>{var c;(c=this.accessor.contextMenuService)===null||c===void 0||c.show(this.panel,this.group,d)}),new ah(this._element,{onLongPress:d=>{var c;this.pointerDragSource.cancelPending(),(c=this.accessor.contextMenuService)===null||c===void 0||c.show(this.panel,this.group,d)}}),this.dropTarget.onDrop(d=>{this._onDropped.fire(d)}),this.pointerDropTarget.onDrop(d=>{this._onDropped.fire(d)}),this.dropTarget,this.pointerDropTarget,this.pointerDragSource)}setActive(e){we(this.element,"dv-active-tab",e),we(this.element,"dv-inactive-tab",!e),this._element.setAttribute("aria-selected",e?"true":"false"),this._element.tabIndex=e?0:-1}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}_buildOverlayModel(){var e,t,n;const o=(t=(e=this.accessor).resolveDropOverlayModel)===null||t===void 0?void 0:t.call(e,"tab",this.group);if(o)return o;const h=((n=this.accessor.options.theme)===null||n===void 0?void 0:n.dndTabIndicator)==="line"?Number.POSITIVE_INFINITY:0;return{activationSize:{value:50,type:"percentage"},smallWidthBoundary:h,smallHeightBoundary:h}}setDirection(e){this._direction=e;const t=e==="vertical"?["top","bottom"]:["left","right"];this.dropTarget.setTargetZones(t),this.pointerDropTarget.setTargetZones(t)}updateDragAndDropState(){const e=Ii(this.accessor.options);this._element.draggable=e.html5,this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}_buildGhostElement(){const e=getComputedStyle(this.element),t=this.element.cloneNode(!0),n=this._direction==="vertical",o=new Set(["writing-mode","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin-inline","margin-inline-start","margin-inline-end","margin-block","margin-block-start","margin-block-end","padding-inline","padding-inline-start","padding-inline-end","padding-block","padding-block-start","padding-block-end"]);return Array.from(e).forEach(h=>{n&&o.has(h)||t.style.setProperty(h,e.getPropertyValue(h),e.getPropertyPriority(h))}),n&&(t.style.setProperty("writing-mode","horizontal-tb"),t.style.setProperty("width",e.height),t.style.setProperty("height",e.width)),t.style.position="absolute",t.classList.add("dv-tab-ghost-drag"),t}}class hr{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}}const iv=500;class Sp extends Se{get group(){return this.groupAccessor()}constructor(e){var t,n,o;super(),this.panelTransfer=_i.getInstance(),this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._element=e.element,this.accessor=e.accessor;const h=e.group;this.groupAccessor=typeof h=="function"?h:()=>h,this.isFloatingMoveHandle=(t=e.isFloatingMoveHandle)!==null&&t!==void 0?t:(()=>!0);const w=Ii(this.accessor.options);this._element.draggable=w.html5,we(this._element,"dv-draggable",w.html5||w.pointer),this.addDisposables(this._onDragStart);const a=()=>{const S=document.createElement("div"),y=window.getComputedStyle(this._element),g=y.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),_=y.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");return S.style.backgroundColor=g,S.style.color=_,S.style.padding="2px 8px",S.style.height="24px",S.style.fontSize="11px",S.style.lineHeight="20px",S.style.borderRadius="12px",S.style.whiteSpace="nowrap",S.style.boxSizing="border-box",S.style.display="inline-block",S.textContent=`Multiple Panels (${this.group.size})`,S},u={getData:()=>(this.panelTransfer.setData([new ni(this.accessor.id,this.group.id,null)],ni.prototype),{dispose:()=>{this.panelTransfer.clearData(ni.prototype)}}),createGhost:()=>{var S,y;const g=(y=(S=this.accessor).buildGroupDragGhost)===null||y===void 0?void 0:y.call(S,this.group);return g||{element:a(),offsetX:30,offsetY:-10}},onDragStart:S=>{this._onDragStart.fire(S)}};this.html5DragSource=vs.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.html5,isCancelled:S=>!!(this.group.api.location.type==="floating"&&this.isFloatingMoveHandle()&&!S.shiftKey||this.group.api.location.type==="edge"&&this.group.size===0)}));const d=()=>{var S,y,g;return((g=(y=(S=this.group)===null||S===void 0?void 0:S.api)===null||y===void 0?void 0:y.location)===null||g===void 0?void 0:g.type)==="floating"&&this.isFloatingMoveHandle()};this.pointerDragSource=Ki.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.pointer,touchOnly:!w.pointerHandlesMouse,touchInitiationDelay:()=>d()?iv:250,pressTolerance:()=>d()?1/0:8,isCancelled:()=>!Ii(this.accessor.options).pointer||this.group.api.location.type==="edge"&&this.group.size===0,onDragStart:S=>{var y;(y=this.getFloatingOverlay())===null||y===void 0||y.cancelPendingDrag(),this._onDragStart.fire(S)}}));const c=new ft,b=()=>{const S=this.getFloatingOverlay();c.value=S?S.onDidStartMoving(()=>{this.pointerDragSource.cancelPending()}):Ve.NONE};b(),this.addDisposables(c);const C=(o=(n=this.group)===null||n===void 0?void 0:n.api)===null||o===void 0?void 0:o.onDidLocationChange;C&&this.addDisposables(C(b)),this.addDisposables(this.html5DragSource,this.pointerDragSource)}updateDragAndDropState(){const e=Ii(this.accessor.options);this._element.draggable=e.html5,we(this._element,"dv-draggable",e.html5||e.pointer),this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}getFloatingOverlay(){var e,t;if(this.group)return(t=(e=this.accessor.floatingGroups)===null||e===void 0?void 0:e.find(n=>n.group===this.group))===null||t===void 0?void 0:t.overlay}}class sv extends Se{get element(){return this._element}constructor(e,t){var n,o,h,w,a,l,u;super(),this.accessor=e,this.group=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this.addDisposables(this._onDrop,this._onDragStart,be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)}),be(this._element,"pointerdown",c=>{c.shiftKey&&ip(c)},!0)),this.dragSource=new Sp({element:this._element,accessor:this.accessor,group:this.group,isFloatingMoveHandle:()=>!this._element.closest(".dv-resize-container-with-titlebar")});const d=(c,b)=>{if(this.group.api.locked)return!1;const C=it();return C&&this.accessor.id===C.viewId?!0:t.model.canDisplayOverlay(c,b,"header_space")};this.dropTarget=vs.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:d,getOverrideTarget:()=>{var c;return(c=t.model.dropTargetContainer)===null||c===void 0?void 0:c.model},overlayModel:(o=(n=this.accessor).resolveDropOverlayModel)===null||o===void 0?void 0:o.call(n,"header_space",this.group)}),this.pointerDropTarget=Ki.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:d,getOverrideTarget:()=>{var c;return(c=t.model.dropTargetContainer)===null||c===void 0?void 0:c.model},overlayModel:(w=(h=this.accessor).resolveDropOverlayModel)===null||w===void 0?void 0:w.call(h,"header_space",this.group)}),this.onWillShowOverlay=ri.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this.dragSource,this.dragSource.onDragStart(c=>{this._onDragStart.fire(c)}),this.dropTarget.onDrop(c=>{this._onDrop.fire(c)}),this.pointerDropTarget.onDrop(c=>{this._onDrop.fire(c)}),this.dropTarget,this.pointerDropTarget,(u=(l=(a=this.accessor).onDidOptionsChange)===null||l===void 0?void 0:l.call(a,()=>{var c,b,C;const S=(C=(b=(c=this.accessor).resolveDropOverlayModel)===null||b===void 0?void 0:b.call(c,"header_space",this.group))!==null&&C!==void 0?C:{};this.dropTarget.setOverlayModel(S),this.pointerDropTarget.setOverlayModel(S)}))!==null&&u!==void 0?u:Ve.NONE)}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}}class Go extends Se{get element(){return this._element}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._scrollOffset=0,this._orientation=e,wi(this._scrollbar,"dv-scrollbar-vertical","dv-scrollbar-horizontal"),e==="vertical"?bi(this._scrollbar,"dv-scrollbar-vertical"):bi(this._scrollbar,"dv-scrollbar-horizontal"))}constructor(e){super(),this.scrollableElement=e,this._scrollOffset=0,this._orientation="horizontal",this._element=document.createElement("div"),this._element.className="dv-scrollable",this._scrollbar=document.createElement("div"),this._scrollbar.className="dv-scrollbar dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._scrollbar),this.addDisposables(be(this.element,"wheel",t=>{this._scrollOffset+=t.deltaY*Go.MouseWheelSpeed,this.calculateScrollbarStyles()}),be(this._scrollbar,"pointerdown",t=>{t.preventDefault(),we(this.element,"dv-scrollable-scrolling",!0);const n=this._orientation==="horizontal"?t.clientX:t.clientY,o=this._scrollOffset,h=a=>{const l=this._orientation==="horizontal"?a.clientX-n:a.clientY-n,u=this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight,d=this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight,c=u/d;this._scrollOffset=o+l/c,this.calculateScrollbarStyles()},w=()=>{we(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)}),be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),be(this.scrollableElement,"scroll",()=>{this._scrollOffset=this._orientation==="horizontal"?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.calculateScrollbarStyles()}),cr(this.element,()=>{we(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),we(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const e=this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight,t=this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(t>e){const o=e*(e/t);this._orientation==="horizontal"?(this._scrollbar.style.width=`${o}px`,this._scrollbar.style.height=""):(this._scrollbar.style.height=`${o}px`,this._scrollbar.style.width=""),this._scrollOffset=et(this._scrollOffset,0,t-e),this._orientation==="horizontal"?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;const h=this._scrollOffset/(t-e);this._orientation==="horizontal"?(this._scrollbar.style.left=`${(e-o)*h}px`,this._scrollbar.style.top=""):(this._scrollbar.style.top=`${(e-o)*h}px`,this._scrollbar.style.left="")}else this._orientation==="horizontal"?(this._scrollbar.style.width="0px",this._scrollbar.style.left="0px"):(this._scrollbar.style.height="0px",this._scrollbar.style.top="0px"),this._scrollOffset=0}}Go.MouseWheelSpeed=1;const lh=[{id:"grey",value:"var(--dv-tab-group-color-grey)",label:"Grey"},{id:"blue",value:"var(--dv-tab-group-color-blue)",label:"Blue"},{id:"red",value:"var(--dv-tab-group-color-red)",label:"Red"},{id:"yellow",value:"var(--dv-tab-group-color-yellow)",label:"Yellow"},{id:"green",value:"var(--dv-tab-group-color-green)",label:"Green"},{id:"pink",value:"var(--dv-tab-group-color-pink)",label:"Pink"},{id:"purple",value:"var(--dv-tab-group-color-purple)",label:"Purple"},{id:"cyan",value:"var(--dv-tab-group-color-cyan)",label:"Cyan"},{id:"orange",value:"var(--dv-tab-group-color-orange)",label:"Orange"}];class Cp{constructor(e,t=!0){this._entries=e.slice(),this._byId=new Map(e.map(n=>[n.id,n])),this._enabled=t}get enabled(){return this._enabled}set enabled(e){this._enabled=e}setEntries(e){this._entries=e.slice(),this._byId=new Map(e.map(t=>[t.id,t]))}entries(){return this._entries}has(e){return this._byId.has(e)}get(e){return this._byId.get(e)}defaultId(){var e;return(e=this._entries[0])===null||e===void 0?void 0:e.id}resolveValue(e){if(!this._enabled||!e)return;const t=this._byId.get(e);return t?t.value:e}}let El;function xp(){return El||(El=new Cp(lh,!0)),El}function hh(p,e,t){const n=(t??xp()).resolveValue(e);n===void 0?p.style.removeProperty("--dv-tab-group-color"):p.style.setProperty("--dv-tab-group-color",n)}function Dp(p,e){return(e??xp()).resolveValue(p)}class au extends Se{get element(){return this._element}constructor(e){super(),this._palette=e,this._onClick=new Q,this.onClick=this._onClick.event,this._onContextMenu=new Q,this.onContextMenu=this._onContextMenu.event,this._element=document.createElement("div"),this._element.className="dv-tab-group-chip",this._element.tabIndex=0,this._label=document.createElement("span"),this._label.className="dv-tab-group-chip-label",this._element.appendChild(this._label),this.addDisposables(this._onClick,this._onContextMenu,new ah(this._element,{onLongPress:t=>{this._onContextMenu.fire(t)}}),be(this._element,"click",t=>{this._onClick.fire(t)}),be(this._element,"contextmenu",t=>{this._onContextMenu.fire(t)}))}init(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed),this.addDisposables(e.tabGroup.onDidChange(()=>{this._tabGroup&&(this.updateColor(this._tabGroup.color),this.updateLabel(this._tabGroup.label))}),e.tabGroup.onDidCollapseChange(t=>{this.updateCollapsed(t)}),this._onClick.event(()=>{var t;(t=this._tabGroup)===null||t===void 0||t.toggle()}))}update(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed)}updateColor(e){var t;hh(this._element,e,this._palette),we(this._element,"dv-tab-group-chip--accent-off",((t=this._palette)===null||t===void 0?void 0:t.enabled)===!1)}updateLabel(e){this._label.textContent=e,we(this._label,"dv-tab-group-chip-label--empty",!e)}updateCollapsed(e){we(this._element,"dv-tab-group-chip--collapsed",e)}}class Ep{get underlines(){return this._underlines}constructor(e){this._ctx=e,this._underlines=new Map,this._rafId=null}positionUnderlines(){requestAnimationFrame(()=>{this._positionUnderlinesSync()})}trackUnderlines(){this._rafId!==null&&cancelAnimationFrame(this._rafId);const e=performance.now(),t=250,n=()=>{this._positionUnderlinesSync(),performance.now()-e<t?this._rafId=requestAnimationFrame(n):this._rafId=null};this._rafId=requestAnimationFrame(n)}syncUnderlineElements(e){for(const t of e)if(!this._underlines.has(t)){const n=document.createElement("div");n.className="dv-tab-group-underline",this._ctx.tabsList.appendChild(n),this._underlines.set(t,n)}for(const[t,n]of this._underlines)e.has(t)||(n.remove(),this._underlines.delete(t))}getUnderline(e){return this._underlines.get(e)}dispose(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null);for(const[,e]of this._underlines)e.remove();this._underlines.clear()}_positionUnderlinesSync(){const e=this._ctx.tabsList.getBoundingClientRect(),t=this._ctx.getTabGroups(),n=this._ctx.getDirection()==="vertical",o=n?e.width:e.height,h=this._ctx.getActivePanelId(),w=this._ctx.getTabMap();for(const a of t){const l=this._underlines.get(a.id);if(!l)continue;const u=a.panelIds;if(u.length===0){l.style.display="none";continue}l.style.display="";const d=this._ctx.getChipElement(a.id);let c;if(d){const m=d.getBoundingClientRect(),v=getComputedStyle(d),D=n?Number.parseFloat(v.marginTop)||0:Number.parseFloat(v.marginLeft)||0;c=n?m.top-e.top-D:m.left-e.left-D}else{const m=u[0],v=w.get(m);if(v){const D=v.value.element.getBoundingClientRect();c=n?D.top-e.top:D.left-e.left}else c=0}const b=u[u.length-1],C=w.get(b);if(!C){n?(l.style.top=`${c}px`,l.style.height="0px",l.style.left="",l.style.width=""):(l.style.left=`${c}px`,l.style.width="0px",l.style.top="",l.style.height="");continue}const S=C.value.element.getBoundingClientRect();let y=n?S.bottom-e.top:S.right-e.left,g=y-c;if((a.collapsed||a.panelIds.some(m=>{const v=w.get(m);return v&&v.value.element.classList.contains("dv-tab--group-expanding")}))&&d){const m=d.getBoundingClientRect(),v=n?m.top+m.height/2-e.top:m.left+m.width/2-e.left;let D=0,P=0;for(const A of a.panelIds){const E=w.get(A);if(!E)continue;const I=E.value.element;n?(D+=I.getBoundingClientRect().height,P+=I.scrollHeight):(D+=I.getBoundingClientRect().width,P+=I.scrollWidth)}const T=P>0?Math.min(1,D/P):0;c=v+(c-v)*T,y=v+(y-v)*T,g=Math.max(0,y-c)}n?(l.style.top=`${c}px`,l.style.height=`${Math.max(0,g)}px`,l.style.left="",l.style.width=""):(l.style.left=`${c}px`,l.style.width=`${Math.max(0,g)}px`,l.style.top="",l.style.height=""),this.applyShape(l,a,c,g,o,h,e,n)}}}class nv extends Ep{_applyStraightLine(e,t,n,o,h,w){w?(e.setAttribute("width",String(o)),e.setAttribute("height",String(h)),n.style.width=`${o}px`,n.style.height=`${h}px`,t.setAttribute("d",`M ${o/2},0 L ${o/2},${h}`)):(e.setAttribute("width",String(h)),e.setAttribute("height",String(o)),n.style.width=`${h}px`,n.style.height=`${o}px`,t.setAttribute("d",`M 0,${o/2} L ${h},${o/2}`))}applyShape(e,t,n,o,h,w,a,l){const d=h,c=o,b=Dp(t.color,this._ctx.getColorPalette());if(c<=0||d<=0||b===void 0){e.style.display="none";return}e.style.display="";let C;w&&t.panelIds.includes(w)&&(C=this._ctx.getTabMap().get(w));let S=e.firstElementChild,y;if(!S||S.tagName!=="svg"?(e.replaceChildren(),S=document.createElementNS("http://www.w3.org/2000/svg","svg"),S.style.display="block",y=document.createElementNS("http://www.w3.org/2000/svg","path"),y.setAttribute("fill","none"),S.appendChild(y),e.appendChild(S)):y=S.firstElementChild,y.setAttribute("stroke",b),y.setAttribute("stroke-width",String(2)),!C){this._applyStraightLine(S,y,e,2,c,l);return}const g=C.value.element.getBoundingClientRect();let _,m;if(l?(_=Math.max(0,g.top-a.top-n),m=Math.min(c,g.bottom-a.top-n)):(_=Math.max(0,g.left-a.left-n),m=Math.min(c,g.right-a.left-n)),m<=_){this._applyStraightLine(S,y,e,2,c,l);return}const v=6,D=2/2,P=this._ctx.getHeaderPosition();if(l){const T=d,A=c;S.setAttribute("width",String(T)),S.setAttribute("height",String(A)),e.style.width=`${T}px`,e.style.height=`${A}px`;const E=P==="right",I=E?T-D:D,z=E?D:T-D,H=E?-1:1,V=[`M ${I},0`,`L ${I},${_-v}`,`Q ${I},${_} ${I+H*v},${_}`,`L ${z-H*v},${_}`,`Q ${z},${_} ${z},${_+v}`,`L ${z},${m-v}`,`Q ${z},${m} ${z-H*v},${m}`,`L ${I+H*v},${m}`,`Q ${I},${m} ${I},${m+v}`,`L ${I},${A}`].join(" ");y.setAttribute("d",V)}else{const T=c,A=d;S.setAttribute("width",String(T)),S.setAttribute("height",String(A)),e.style.width=`${T}px`,e.style.height=`${A}px`;const E=P==="bottom",I=E?D:A-D,z=E?A-D:D,H=E?1:-1,V=[`M 0,${I}`,`L ${_-v},${I}`,`Q ${_},${I} ${_},${I+H*v}`,`L ${_},${z-H*v}`,`Q ${_},${z} ${_+v},${z}`,`L ${m-v},${z}`,`Q ${m},${z} ${m},${z-H*v}`,`L ${m},${I+H*v}`,`Q ${m},${I} ${m+v},${I}`,`L ${T},${I}`].join(" ");y.setAttribute("d",V)}}}class rv extends Ep{applyShape(e,t,n,o,h,w,a,l){const d=Dp(t.color,this._ctx.getColorPalette());if(o<=0||d===void 0){e.style.display="none";return}e.style.display="",e.firstElementChild&&e.replaceChildren(),e.style.backgroundColor=d,l?(e.style.width="2px",e.style.height=`${o}px`):(e.style.width=`${o}px`,e.style.height="2px")}}const ov=new Map;class av{get chipRenderers(){return this._chipRenderers}get groupUnderlines(){var e,t;return(t=(e=this._indicator)===null||e===void 0?void 0:e.underlines)!==null&&t!==void 0?t:ov}get skipNextCollapseAnimation(){return this._skipNextCollapseAnimation}set skipNextCollapseAnimation(e){this._skipNextCollapseAnimation=e}constructor(e,t){this._ctx=e,this._callbacks=t,this._chipRenderers=new Map,this._indicator=null,this._skipNextCollapseAnimation=!1,this._pendingTransitionCleanups=new Map}update(){const t=this._ctx.group.model.getTabGroups(),n=new Set;for(const o of t)n.add(o.id),this._ensureChipForGroup(o),this._positionChipForGroup(o);for(const[o,h]of this._chipRenderers)n.has(o)||(h.chip.element.remove(),h.chip.dispose(),h.disposable.dispose(),this._chipRenderers.delete(o));this._updateTabGroupClasses()}refreshAccents(){var e,t;for(const n of this._ctx.group.model.getTabGroups()){const o=this._chipRenderers.get(n.id);(t=o==null?void 0:(e=o.chip).update)===null||t===void 0||t.call(e,{tabGroup:n})}this._updateTabGroupClasses()}positionAllChips(){if(this._chipRenderers.size!==0)for(const e of this._ctx.group.model.getTabGroups())this._positionChipForGroup(e)}updateDirection(){const e=this._ctx.getDirection()==="vertical";for(const[,t]of this._chipRenderers)t.dropTarget.setTargetZones(e?["top"]:["left"])}snapshotChipWidths(){const e=new Map;for(const[t,n]of this._chipRenderers)e.set(t,n.chip.element.getBoundingClientRect().width);return e}positionUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.positionUnderlines()}trackUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.trackUnderlines()}setGroupDragImage(e,t,n){if(!e.dataTransfer)return;const o=this._ctx.getDirection()==="vertical",h=this._ctx.tabsList.cloneNode(!0);o?(h.classList.remove("dv-tabs-container-vertical","dv-vertical"),h.classList.add("dv-horizontal"),h.style.writingMode="horizontal-tb",h.style.height=`${this._ctx.tabsList.offsetWidth}px`):h.style.height=`${this._ctx.tabsList.offsetHeight}px`,h.style.width="auto",h.style.overflow="visible",h.style.pointerEvents="none";const w=Array.from(h.children),a=Array.from(this._ctx.tabsList.children);for(let S=w.length-1;S>=0;S--)a[S]!==n&&w[S].remove();const l=document.createElement("div");l.className="dv-groupview dv-active-group",l.style.position="fixed",l.style.top="-10000px",l.style.left="0px",l.style.height="auto",l.style.width="auto",l.style.pointerEvents="none";const u=document.createElement("div");u.className="dv-tabs-and-actions-container",u.style.height="auto",u.style.width="auto",l.appendChild(u),u.appendChild(h),this._ctx.accessor.element.appendChild(l);const d=h.querySelector(".dv-tab-group-chip"),c=n.getBoundingClientRect(),b=e.clientX-c.left,C=e.clientY-c.top;if(d){const S=d.getBoundingClientRect(),y=l.getBoundingClientRect(),g=S.left-y.left+b,_=S.top-y.top+C;e.dataTransfer.setDragImage(l,g,_)}else e.dataTransfer.setDragImage(l,b,C);requestAnimationFrame(()=>{l.remove()})}cleanupTransition(e){var t;(t=this._pendingTransitionCleanups.get(e))===null||t===void 0||t(),this._pendingTransitionCleanups.delete(e)}updateDragAndDropState(){const e=Ii(this._ctx.accessor.options);for(const t of this._chipRenderers.values())t.chip.element.draggable=e.html5,t.html5DragSource.setDisabled(!e.html5),t.pointerDragSource.setDisabled(!e.pointer),t.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}disposeChipDrag(e){var t,n;const o=this._chipRenderers.get(e);o&&((t=o.html5DragSource)===null||t===void 0||t.dispose(),(n=o.pointerDragSource)===null||n===void 0||n.dispose())}_buildChipGhostElement(e){const t=getComputedStyle(e),n=e.cloneNode(!0);return Array.from(t).forEach(o=>{n.style.setProperty(o,t.getPropertyValue(o),t.getPropertyPriority(o))}),n.style.position="absolute",n}disposeAll(){var e;(e=this._indicator)===null||e===void 0||e.dispose(),this._indicator=null;for(const[,t]of this._pendingTransitionCleanups)t();this._pendingTransitionCleanups.clear();for(const[,t]of this._chipRenderers)t.chip.element.remove(),t.chip.dispose(),t.disposable.dispose();this._chipRenderers.clear()}_ensureIndicator(){var e,t;const o=((t=(e=this._ctx.accessor.options.theme)===null||e===void 0?void 0:e.tabGroupIndicator)!==null&&t!==void 0?t:"wrap")==="none"?rv:nv;this._indicator&&!(this._indicator instanceof o)&&(this._indicator.dispose(),this._indicator=null),this._indicator||(this._indicator=new o({tabsList:this._ctx.tabsList,getTabGroups:()=>this._ctx.group.model.getTabGroups(),getActivePanelId:()=>{var h;return(h=this._ctx.group.activePanel)===null||h===void 0?void 0:h.id},getTabMap:()=>this._ctx.getTabMap(),getChipElement:h=>{var w;return(w=this._chipRenderers.get(h))===null||w===void 0?void 0:w.chip.element},getDirection:()=>this._ctx.getDirection(),getHeaderPosition:()=>this._ctx.group.model.headerPosition,getColorPalette:()=>this._ctx.accessor.tabGroupColorPalette}))}_ensureChipForGroup(e){if(this._chipRenderers.has(e.id))return;const t=this._ctx.accessor.options.createTabGroupChipComponent,n=t?t(e):new au(this._ctx.accessor.tabGroupColorPalette);n.init({tabGroup:e,api:this._ctx.accessor.api});const o=Ii(this._ctx.accessor.options);n.element.draggable=o.html5;const h=_i.getInstance(),w=()=>(h.setData([new ni(this._ctx.accessor.id,this._ctx.group.id,null,e.id)],ni.prototype),{dispose:()=>{h.clearData(ni.prototype)}}),a=vs.createDragSource(n.element,{getData:w,disabled:!o.html5,isCancelled:()=>!Ii(this._ctx.accessor.options).html5,onDragStart:S=>{"dataTransfer"in S&&S.dataTransfer&&this.setGroupDragImage(S,e,n.element),this._callbacks.onChipDragStart(e,n,S)},onDragEnd:S=>{var y,g;(g=(y=this._callbacks).onChipDragEnd)===null||g===void 0||g.call(y,e,n,S)}});n.element.addEventListener("dragend",()=>{h.clearData(ni.prototype)},{once:!0});const l=Ki.createDragSource(n.element,{getData:w,disabled:!o.pointer,touchOnly:!o.pointerHandlesMouse,isCancelled:()=>!Ii(this._ctx.accessor.options).pointer,createGhost:()=>({element:this._buildChipGhostElement(n.element),offsetX:8,offsetY:8}),onDragStart:S=>{this._callbacks.onChipDragStart(e,n,S)}}),u=[e.onDidChange(()=>{var S;(S=n.update)===null||S===void 0||S.call(n,{tabGroup:e}),this._updateTabGroupClasses()}),e.onDidPanelChange(()=>{this._positionChipForGroup(e),this._updateTabGroupClasses()}),e.onDidCollapseChange(()=>{this._updateTabGroupClasses()}),a,l],d=S=>{l.cancelPending(),this._callbacks.onChipContextMenu(e,S)};n instanceof au?u.push(n.onContextMenu(d)):u.push(new ah(n.element,{onLongPress:d}),be(n.element,"contextmenu",d));const c=this._ctx.getDirection()==="vertical",b=new $i(n.element,{acceptedTargetZones:c?["top"]:["left"],overlayModel:{activationSize:{value:100,type:"percentage"}},canDisplayOverlay:(S,y)=>{var g;if(this._ctx.group.locked||this._ctx.accessor.options.disableDnd)return!1;const _=it();return _&&this._ctx.accessor.id===_.viewId?((g=this._ctx.accessor.options.theme)===null||g===void 0?void 0:g.tabAnimation)!=="smooth":this._ctx.group.model.canDisplayOverlay(S,y,"tab")}});u.push(b,b.onDrop(S=>{this._callbacks.onChipDrop(e,S)}));const C=new Se(...u);this._chipRenderers.set(e.id,{chip:n,html5DragSource:a,pointerDragSource:l,disposable:C,dropTarget:b}),e.collapsed&&(this._skipNextCollapseAnimation=!0)}_positionChipForGroup(e){const t=this._chipRenderers.get(e.id);if(!t)return;const n=t.chip.element,o=e.panelIds;if(o.length===0){n.remove();return}const h=o[0],w=this._ctx.getTabMap().get(h);if(!w){n.remove();return}const a=w.value.element;n.nextSibling!==a&&this._ctx.tabsList.insertBefore(n,a)}_updateTabGroupClasses(){var e;const n=this._ctx.group.model.getTabGroups(),o=this._ctx.getTabs(),h=this._ctx.getTabMap();let w=!1;const a=new Map;for(const u of n)for(const d of u.panelIds)a.set(d,u);for(const u of o){const d=u.value,c=d.panel.id,b=a.get(c),C=!!b;if(we(d.element,"dv-tab--grouped",C),b){const S=b.panelIds,y=S[0]===c,g=S[S.length-1]===c;we(d.element,"dv-tab--group-first",y),we(d.element,"dv-tab--group-last",g),hh(d.element,b.color,this._ctx.accessor.tabGroupColorPalette);const _=d.element.classList.contains("dv-tab--group-collapsed");if(!b.collapsed&&_){w=!0,d.element.classList.remove("dv-tab--group-collapsed"),d.element.classList.add("dv-tab--group-expanding"),(e=this._pendingTransitionCleanups.get(c))===null||e===void 0||e();const m=()=>{d.element.classList.remove("dv-tab--group-expanding"),d.element.style.removeProperty("width"),d.element.removeEventListener("transitionend",m),clearTimeout(v),this._pendingTransitionCleanups.delete(c)},v=setTimeout(m,300);this._pendingTransitionCleanups.set(c,m),d.element.addEventListener("transitionend",m)}}else we(d.element,"dv-tab--group-first",!1),we(d.element,"dv-tab--group-last",!1),d.element.classList.remove("dv-tab--group-collapsed","dv-tab--group-expanding"),d.element.style.removeProperty("width"),d.element.style.removeProperty("--dv-tab-group-color")}const l=new Set;for(const u of n)if(l.add(u.id),u.collapsed&&u.panelIds.some(c=>{const b=h.get(c);return b&&!b.value.element.classList.contains("dv-tab--group-collapsed")}))if(this._skipNextCollapseAnimation){const c=[];for(const b of u.panelIds){const C=h.get(b);C&&(C.value.element.style.transition="none",C.value.element.classList.add("dv-tab--group-collapsed"),c.push(C.value.element))}if(c.length>0){c[0].offsetHeight;for(const b of c)b.style.removeProperty("transition")}}else{w=!0;const c=this._ctx.getDirection()==="vertical";for(const b of u.panelIds){const C=h.get(b);if(C&&!C.value.element.classList.contains("dv-tab--group-collapsed")){const S=C.value.element.getBoundingClientRect();c?C.value.element.style.height=`${S.height}px`:C.value.element.style.width=`${S.width}px`,C.value.element.offsetHeight,C.value.element.classList.add("dv-tab--group-collapsed")}}}this._skipNextCollapseAnimation=!1,this._ensureIndicator(),this._indicator&&(this._indicator.syncUnderlineElements(l),w?this._indicator.trackUnderlines():this._indicator.positionUnderlines())}}class lv extends Se{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const t=new lg(this._tabsList);this._observerDisposable.value=new Se(t,t.onDidChange(n=>{const o=n.hasScrollX||n.hasScrollY;this.toggleDropdown({reset:!o}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}),be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}))}}get element(){return this._element}set voidContainer(e){var t;(t=this._voidContainerListeners)===null||t===void 0||t.dispose(),this._voidContainerListeners=null,this._voidContainer=e,e&&(this._voidContainerListeners=new Se(be(e,"dragover",n=>{this._animState&&n.preventDefault()}),be(e,"drop",n=>{var o;!((o=this._animState)===null||o===void 0)&&o.sourceTabGroupId&&this._animState.currentInsertionIndex!==null&&(n.preventDefault(),n.stopPropagation(),this.handleVoidDrop())})))}handleVoidDrop(){var e,t;if(!(!((e=this._animState)===null||e===void 0)&&e.sourceTabGroupId))return!1;const n=this._animState.sourceTabGroupId,o=(t=this._animState.currentInsertionIndex)!==null&&t!==void 0?t:this._tabs.length;return this._animState=null,this._commitGroupMove(n,o),!0}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}get direction(){return this._direction}set direction(e){if(this._direction!==e){this._direction=e,this._tabsList.setAttribute("aria-orientation",e==="vertical"?"vertical":"horizontal"),this._scrollbar&&(this._scrollbar.orientation=e),wi(this._tabsList,"dv-horizontal","dv-vertical"),e==="vertical"?bi(this._tabsList,"dv-tabs-container-vertical","dv-vertical"):(wi(this._tabsList,"dv-tabs-container-vertical"),bi(this._tabsList,"dv-horizontal"));for(const t of this._tabs)t.value.setDirection(e);this._tabGroupManager.updateDirection()}}constructor(e,t,n){super(),this.group=e,this.accessor=t,this._observerDisposable=new ft,this._scrollbar=null,this._tabs=[],this._tabMap=new Map,this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._direction="horizontal",this._animState=null,this._pendingMarginCleanups=new Map,this._pendingCollapse=!1,this._flipTransitionCleanup=null,this._voidContainer=null,this._voidContainerListeners=null,this._extendedDropZone=null,this._pointerInsideTabsList=!1,this._onTabDragStart=new Q,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new Q,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container",this._tabsList.setAttribute("role","tablist"),this._tabsList.setAttribute("aria-orientation",this._direction==="vertical"?"vertical":"horizontal"),this.showTabsOverflowControl=n.showTabsOverflowControl,t.options.scrollbars==="native"?this._element=this._tabsList:(this._scrollbar=new Go(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this._tabGroupManager=new av({group:this.group,accessor:this.accessor,tabsList:this._tabsList,getTabs:()=>this._tabs,getTabMap:()=>this._tabMap,getDirection:()=>this._direction},{onChipContextMenu:(o,h)=>{var w;(w=this.accessor.contextMenuService)===null||w===void 0||w.showForChip(o,this.group,h)},onChipDragStart:(o,h,w)=>{this._handleChipDragStart(o,h,w)},onChipDragEnd:()=>{this.resetDragAnimation()},onChipDrop:(o,h)=>{this._handleChipDrop(o,h)}}),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,{dispose:()=>{var o;(o=this._flipTransitionCleanup)===null||o===void 0||o.call(this)}},Ui.getInstance().onDragEnd(()=>{this._pointerInsideTabsList=!1,this.resetDragAnimation()}),Ui.getInstance().onDragMove(o=>{this._handlePointerDragMove(o.clientX,o.clientY)}),be(this.element,"pointerdown",o=>{if(o.defaultPrevented)return;o.button===0&&this.accessor.doSetGroupActive(this.group)}),be(this._tabsList,"wheel",o=>{const h=this._direction==="vertical",w=h?o.deltaY||o.deltaX:o.deltaX||o.deltaY;if(w===0)return;const a=h?this._tabsList.scrollHeight-this._tabsList.clientHeight:this._tabsList.scrollWidth-this._tabsList.clientWidth;if(a<=0)return;const l=h?this._tabsList.scrollTop:this._tabsList.scrollLeft;w<0&&l<=0||w>0&&l>=a||(o.preventDefault(),o.stopPropagation(),h?this._tabsList.scrollTop=l+w:this._tabsList.scrollLeft=l+w)},{passive:!1}),be(this._tabsList,"keydown",o=>{this._onKeyDown(o)}),be(this._tabsList,"dragover",o=>{this._processDragOver(o.clientX)&&o.preventDefault()},!0),be(this._tabsList,"dragleave",o=>{this._processDragLeave(o.relatedTarget)},!0),be(this._tabsList,"dragend",()=>{this.resetDragAnimation()}),be(this._tabsList,"drop",o=>{var h,w,a;if(!this._animState||this._animState.currentInsertionIndex===null||((h=this.accessor.options.theme)===null||h===void 0?void 0:h.tabAnimation)!=="smooth"&&!this._animState.sourceTabGroupId)return;o.stopPropagation(),o.preventDefault(),(a=(w=this.group.model.dropTargetContainer)===null||w===void 0?void 0:w.model)===null||a===void 0||a.clear();const l=this._animState;if(this._animState=null,this._pendingCollapse=!1,l.sourceTabGroupId){this._commitGroupMove(l.sourceTabGroupId,l.currentInsertionIndex);return}const u=l.currentInsertionIndex,d=l.sourceIndex,c=u-(d!==-1&&d<u?1:0),b=this.group.model.getTabGroupForPanel(l.sourceTabId);if(c===d&&!l.targetTabGroupId&&!b){this._uncollapsSourceTab(l.sourceTabId),this.resetTabTransforms();return}this._uncollapsSourceTab(l.sourceTabId);const C=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:o,index:c,targetTabGroupId:l.targetTabGroupId}),this.runFlipAnimation(C,l.sourceTabId,l.sourceIndex===-1,{from:Math.min(d,c),to:Math.max(d,c)})},!0),Ve.from(()=>{var o;(o=this._voidContainerListeners)===null||o===void 0||o.dispose(),this.resetDragAnimation(),this._tabGroupManager.disposeAll();for(const{value:h,disposable:w}of this._tabs)w.dispose(),h.dispose();this._tabs=[],this._tabMap.clear()}))}indexOf(e){return this._tabs.findIndex(t=>t.value.panel.id===e)}getTabId(e){var t;return(t=this._tabMap.get(e))===null||t===void 0?void 0:t.value.element.id}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}_onKeyDown(e){const t=this._tabs.findIndex(a=>a.value.element===e.target);if(t===-1)return;const n=this._direction==="vertical",o=n?"ArrowDown":"ArrowRight",h=n?"ArrowUp":"ArrowLeft",w=this._tabs.length-1;switch(e.key){case o:e.preventDefault(),this._focusTab(Math.min(t+1,w));break;case h:e.preventDefault(),this._focusTab(Math.max(t-1,0));break;case"Home":e.preventDefault(),this._focusTab(0);break;case"End":e.preventDefault(),this._focusTab(w);break;case"Enter":case" ":e.preventDefault(),this.accessor.withOrigin("user",()=>this._tabs[t].value.panel.api.setActive());break;case"Delete":case"Backspace":e.preventDefault(),this._closeTab(t);break}}_closeTab(e){var t,n,o,h,w;const a=(t=this._tabs[e])===null||t===void 0?void 0:t.value;if(!a)return;const l=(w=(o=(n=this._tabs[e+1])===null||n===void 0?void 0:n.value)!==null&&o!==void 0?o:(h=this._tabs[e-1])===null||h===void 0?void 0:h.value)===null||w===void 0?void 0:w.panel.id;if(a.panel.api.close(),l!==void 0){const u=this._tabs.findIndex(d=>d.value.panel.id===l);u>-1&&this._focusTab(u)}}_focusTab(e){for(let t=0;t<this._tabs.length;t++)this._tabs[t].value.element.tabIndex=t===e?0:-1;this._tabs[e].value.element.focus()}focusActiveTab(){var e;if(this._tabs.length===0)return;const t=(e=this.group.activePanel)===null||e===void 0?void 0:e.id,n=t?this._tabs.findIndex(o=>o.value.panel.id===t):-1;this._focusTab(n>-1?n:0)}setActivePanel(e){const t=this._direction==="vertical";let n=0;for(const o of this._tabs){const h=e.id===o.value.panel.id;if(o.value.setActive(h),h){const w=o.value.element,a=w.parentElement;t?(n<a.scrollTop||n+w.clientHeight>a.scrollTop+a.clientHeight)&&(a.scrollTop=n):(n<a.scrollLeft||n+w.clientWidth>a.scrollLeft+a.clientWidth)&&(a.scrollLeft=n)}n+=t?o.value.element.clientHeight:o.value.element.clientWidth}this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}openPanel(e,t=this._tabs.length){if(this._tabMap.has(e.id))return;const n=new tv(e,this.accessor,this.group);n.setContent(e.view.tab),this._direction!=="horizontal"&&n.setDirection(this._direction);const o=new Se(n.onDragStart(w=>{var a;if(this._onTabDragStart.fire({nativeEvent:w,panel:e}),((a=this.accessor.options.theme)===null||a===void 0?void 0:a.tabAnimation)==="smooth"){const l=n.element.getBoundingClientRect().width,u=this._tabs.findIndex(d=>d.value===n);this._animState={sourceTabId:e.id,sourceIndex:u,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:l/2,sourceGapWidth:l,containerLeft:this._tabsList.getBoundingClientRect().left},this._pendingCollapse=!0,requestAnimationFrame(()=>{var d,c;this._pendingCollapse=!1,this._animState&&(n.element.style.transition="none",we(n.element,"dv-tab--dragging",!0),n.element.offsetHeight,(d=(c=this._animState).currentInsertionIndex)!==null&&d!==void 0||(c.currentInsertionIndex=u),this.applyDragOverTransforms(!0),n.element.style.removeProperty("transition"))})}}),n.onTabClick(w=>{w.defaultPrevented||this.group.api.location.type==="edge"&&(this.group.activePanel===e?this.group.api.isCollapsed()?this.group.api.expand():this.group.api.collapse():(this.group.model.openPanel(e),this.group.api.isCollapsed()&&this.group.api.expand()))}),n.onPointerDown(w=>{if(w.defaultPrevented)return;const a=!this.accessor.options.disableFloatingGroups,l=this.group.api.location.type==="floating"&&this.size===1;if(a&&!l&&w.shiftKey){w.preventDefault();const u=this.accessor.getGroupPanel(n.panel.id),{top:d,left:c}=n.element.getBoundingClientRect(),{top:b,left:C}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(u,{x:c-C,y:d-b,inDragMode:!0});return}switch(w.button){case 0:this.group.api.location.type==="edge"||this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),n.onDrop(w=>{var a,l,u,d;const c=this._animState;this._animState=null,this._pendingCollapse=!1;const b=this._tabs.findIndex(C=>C.value===n);if(c){const C=w.position==="right"?b+1:b;if(c.sourceTabGroupId){this._commitGroupMove(c.sourceTabGroupId,(a=c.currentInsertionIndex)!==null&&a!==void 0?a:C);return}this._uncollapsSourceTab(c.sourceTabId);const S=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:w.nativeEvent,index:C,targetTabGroupId:c.targetTabGroupId}),((l=this.accessor.options.theme)===null||l===void 0?void 0:l.tabAnimation)==="smooth"&&this.runFlipAnimation(S,c.sourceTabId,c.sourceIndex===-1,c.sourceIndex!==-1?{from:Math.min(c.sourceIndex,C),to:Math.max(c.sourceIndex,C)}:void 0)}else{const C=this._direction==="vertical"?"bottom":"right",S=w.position===C?b+1:b,y=it(),g=y?this._tabs.findIndex(v=>v.value.panel.id===y.panelId):-1,_=S-(g!==-1&&g<S?1:0),m=(d=(u=this.group.model.getTabGroupForPanel(n.panel.id))===null||u===void 0?void 0:u.id)!==null&&d!==void 0?d:null;this._onDrop.fire({event:w.nativeEvent,index:_,targetTabGroupId:m})}}),n.onWillShowOverlay(w=>{this._onWillShowOverlay.fire(new hr(w,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:it}))})),h={value:n,disposable:o};this.addTab(h,t),this._tabGroupManager.positionAllChips(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}delete(e){var t;((t=this._animState)===null||t===void 0?void 0:t.sourceTabId)===e&&(this.resetTabTransforms(),this._animState=null),this._tabGroupManager.cleanupTransition(e);const n=this.indexOf(e),o=this._tabs.splice(n,1)[0];if(this._tabMap.delete(e),o){const{value:h,disposable:w}=o;w.dispose(),h.dispose(),h.element.remove()}this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw new Error("invalid location");const n=t<this._tabs.length?this._tabs[t].value.element:null;this._tabsList.insertBefore(e.value.element,n),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this._tabMap.set(e.value.panel.id,e),this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){if(e.reset){this._onOverflowTabsChange.fire({tabs:[],tabGroups:[],reset:!0});return}const t=this._tabs.filter(h=>!nu(h.value.element,this._tabsList)).map(h=>h.value.panel.id),n=new Set(t),o=[];for(const h of this.group.model.getTabGroups()){const w=this._tabGroupManager.chipRenderers.get(h.id),a=w&&!nu(w.chip.element,this._tabsList),l=h.panelIds.length>0&&h.panelIds.every(u=>n.has(u));if((a||l)&&(o.push(h.id),h.collapsed))for(const u of h.panelIds)n.has(u)||(n.add(u),t.push(u))}this._onOverflowTabsChange.fire({tabs:t,tabGroups:o,reset:!1})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState();this._tabGroupManager.updateDragAndDropState()}updateTabGroups(){this._tabGroupManager.update()}refreshTabGroupAccent(){this._tabGroupManager.refreshAccents()}_handleChipDragStart(e,t,n){var o;const h=e.panelIds[0],w=h?this._tabs.findIndex(d=>d.value.panel.id===h):-1,a=t.element.getBoundingClientRect();let l=a.width;for(const d of e.panelIds){const c=this._tabMap.get(d);c&&(l+=c.value.element.getBoundingClientRect().width)}if(this._animState={sourceTabId:"",sourceIndex:w,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.id,sourceGroupPanelIds:new Set(e.panelIds),sourceChipWidth:a.width,cursorOffsetFromDragLeft:n.clientX-a.left,sourceGapWidth:l,containerLeft:this._tabsList.getBoundingClientRect().left},((o=this.accessor.options.theme)===null||o===void 0?void 0:o.tabAnimation)!=="smooth")return;const u=new Set(e.panelIds);this._pendingCollapse=!0,requestAnimationFrame(()=>{var d,c;if(this._pendingCollapse=!1,!this._animState)return;for(const S of this._tabs)u.has(S.value.panel.id)&&(S.value.element.style.transition="none",we(S.value.element,"dv-tab--dragging",!0));const b=this._tabGroupManager.chipRenderers.get(e.id);b&&(b.chip.element.style.transition="none",we(b.chip.element,"dv-tab-group-chip--dragging",!0)),this._tabsList.offsetHeight;const C=this._tabGroupManager.groupUnderlines.get(e.id);C&&(C.style.display="none"),(d=(c=this._animState).currentInsertionIndex)!==null&&d!==void 0||(c.currentInsertionIndex=w),this.applyDragOverTransforms(!0);for(const S of this._tabs)u.has(S.value.panel.id)&&S.value.element.style.removeProperty("transition");b&&b.chip.element.style.removeProperty("transition")})}_handleChipDrop(e,t){const n=e.panelIds[0];if(!n)return;const o=this._tabs.findIndex(l=>l.value.panel.id===n);if(o===-1)return;const h=it(),w=h&&h.groupId===this.group.id&&h.panelId?this._tabs.findIndex(l=>l.value.panel.id===h.panelId):-1,a=o-(w!==-1&&w<o?1:0);this._onDrop.fire({event:t.nativeEvent,index:a,targetTabGroupId:null})}setExtendedDropZone(e){this._extendedDropZone=e}setExternalInsertionIndex(e){this._animState&&e!==this._animState.currentInsertionIndex&&(this._animState.currentInsertionIndex=e,this.applyDragOverTransforms())}clearExternalAnimState(){this._animState&&(this.resetTabTransforms(),this._animState.sourceIndex===-1?this._animState=null:this._animState.currentInsertionIndex=null)}snapshotTabPositions(){const e=new Map;for(const t of this._tabs)e.set(t.value.panel.id,t.value.element.getBoundingClientRect());return e}getAverageTabWidth(){if(this._tabs.length===0)return 0;const e=this._direction==="vertical";let t=0;for(const n of this._tabs){const o=n.value.element.getBoundingClientRect();t+=e?o.height:o.width}return t/this._tabs.length}_handlePointerDragMove(e,t){var n;const h=((n=this._tabsList.ownerDocument)!==null&&n!==void 0?n:document).elementFromPoint(e,t);if(!(!!h&&(this._tabsList.contains(h)||!!this._extendedDropZone&&this._extendedDropZone.contains(h)))){this._pointerInsideTabsList&&(this._pointerInsideTabsList=!1,this._processDragLeave(h));return}this._pointerInsideTabsList=!0,this._processDragOver(e)}_processDragOver(e){var t,n,o,h;if(this.accessor.options.disableDnd)return!1;if(this._animState){const w=it();w!=null&&w.tabGroupId&&w.groupId!==this.group.id&&this._animState.sourceTabGroupId!==w.tabGroupId&&(this._animState=null)}if(!this._animState){const w=it();if(((t=this.accessor.options.theme)===null||t===void 0?void 0:t.tabAnimation)==="default"&&!(w!=null&&w.tabGroupId))return!1;if(w&&(w.panelId||w.tabGroupId)&&w.groupId!==this.group.id){const a=this.getAverageTabWidth();if(w.tabGroupId){const l=this.accessor.getPanel(w.groupId),u=l==null?void 0:l.model.getTabGroups().find(b=>b.id===w.tabGroupId),d=(n=u==null?void 0:u.panelIds.length)!==null&&n!==void 0?n:1,c=a*d+a;this._animState={sourceTabId:"",sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:w.tabGroupId,sourceGroupPanelIds:u?new Set(u.panelIds):new Set,sourceChipWidth:a,cursorOffsetFromDragLeft:c/2,sourceGapWidth:c,containerLeft:this._tabsList.getBoundingClientRect().left}}else this._animState={sourceTabId:w.panelId,sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:a/2,sourceGapWidth:a,containerLeft:this._tabsList.getBoundingClientRect().left}}else return!1}return this._animState.sourceIndex!==-1&&((h=(o=this.group.model.dropTargetContainer)===null||o===void 0?void 0:o.model)===null||h===void 0||h.clear()),this.handleDragOver({clientX:e}),!0}_processDragLeave(e){var t,n,o;if(!this._animState||e&&this._tabsList.contains(e))return;if(e&&(!((t=this._extendedDropZone)===null||t===void 0)&&t.contains(e))){this.resetTabTransforms(),this._animState.currentInsertionIndex=null;return}this._voidContainer&&e&&(e===this._voidContainer||this._voidContainer.contains(e))||(this.resetTabTransforms(),this._animState.sourceIndex===-1?((o=(n=this.group.model.dropTargetContainer)===null||n===void 0?void 0:n.model)===null||o===void 0||o.clear(),this._animState=null):this._animState.currentInsertionIndex=null)}handleDragOver(e){var t,n,o,h,w;if(!this._animState)return;const a=e.clientX;let l=null,u=null;const d=this._animState.sourceGroupPanelIds,b=a-this._animState.cursorOffsetFromDragLeft-this._animState.containerLeft;let C=0;const S=new Map;if(this._tabGroupManager.chipRenderers.size>0){const y=this.group.model.getTabGroups();for(const g of y)g.id!==this._animState.sourceTabGroupId&&g.panelIds.length>0&&S.set(g.panelIds[0],g.id)}for(let y=0;y<this._tabs.length;y++){const g=this._tabs[y].value;if(g.panel.id===this._animState.sourceTabId||d!=null&&d.has(g.panel.id))continue;const _=S.get(g.panel.id);if(_){const D=(t=this._animState.chipPositions.get(_))!==null&&t!==void 0?t:0;if(C+D>b){l??(l=y);break}C+=D}const m=this._animState.tabPositions.get(g.panel.id),v=m?m.width:g.element.getBoundingClientRect().width;if(C+v/2<=b)C+=v,l=y+1;else{l??(l=y);break}}if(l!==null&&this._tabGroupManager.chipRenderers.size>0){const y=!!this._animState.sourceTabGroupId,g=this.group.model.getTabGroups();let _=0;for(let m=0;m<this._tabs.length;m++){const v=this._tabs[m].value;if(v.panel.id===this._animState.sourceTabId||d!=null&&d.has(v.panel.id))continue;if(m>=l)break;const D=S.get(v.panel.id);D&&(_+=(n=this._animState.chipPositions.get(D))!==null&&n!==void 0?n:0);const P=this._animState.tabPositions.get(v.panel.id);_+=P?P.width:v.element.getBoundingClientRect().width}for(const m of g){const v=m.panelIds.filter(E=>E!==this._animState.sourceTabId&&!(d!=null&&d.has(E)));if(v.length===0)continue;const D=this._tabs.findIndex(E=>E.value.panel.id===v[0]),P=this._tabs.findIndex(E=>E.value.panel.id===v[v.length-1]);if(D===-1||P===-1)continue;const T=l>=D&&l<=P,A=!T&&l===D-1;if(!(!T&&!A)){if(y&&T){const E=(D+P+1)/2;l<E?l=D:l=P+1;break}if(y&&A)break;if(A){let E=!0;for(let H=l;H<D;H++){const V=this._tabs[H].value.panel.id;if(V!==this._animState.sourceTabId&&!(d!=null&&d.has(V))){E=!1;break}}if(!E)continue;const I=(o=this._animState.chipPositions.get(m.id))!==null&&o!==void 0?o:0,z=m.collapsed?this._animState.containerLeft+_+I/2:this._animState.containerLeft+_+I;a>=z&&(l=D,u=m.id);break}if(T){const E=(h=this._animState.chipPositions.get(m.id))!==null&&h!==void 0?h:0,I=this._animState.containerLeft+_+E;l===D?a>=I&&(u=m.id):u=m.id;break}}}}l===this._animState.currentInsertionIndex&&u===this._animState.targetTabGroupId||(this._animState.currentInsertionIndex=l,this._animState.targetTabGroupId=u,((w=this.accessor.options.theme)===null||w===void 0?void 0:w.tabAnimation)==="smooth"&&this.applyDragOverTransforms())}_removeClassInstantlyBatch(e,t){const n=[];for(const o of e)o.classList.contains(t)&&(o.style.transition="none",we(o,t,!1),n.push(o));if(n.length>0){n[0].offsetHeight;for(const o of n)o.style.removeProperty("transition")}}_uncollapsSourceTab(e){const t=this._tabMap.get(e);t&&this._removeClassInstantlyBatch([t.value.element],"dv-tab--dragging")}applyDragOverTransforms(e=!1){if(!this._animState||this._animState.currentInsertionIndex===null){this.resetTabTransforms();return}if(this._pendingCollapse)return;const t=this._animState.currentInsertionIndex;let n;const o=this._animState.sourceGroupPanelIds;if(this._animState.sourceTabGroupId&&o)n=this._animState.sourceGapWidth;else{const d=this._animState.tabPositions.get(this._animState.sourceTabId);n=d?d.width:this.getAverageTabWidth()}let h=null;if(this._tabGroupManager.chipRenderers.size>0){const d=this.group.model.getTabGroups();for(const c of d){if(c.id===this._animState.sourceTabGroupId||c.panelIds.includes(this._animState.sourceTabId))continue;const b=c.panelIds.filter(y=>y!==this._animState.sourceTabId&&!(o!=null&&o.has(y)));if(b.length===0)continue;const C=this._tabs.findIndex(y=>y.value.panel.id===b[0]);if((!this._animState.targetTabGroupId||this._animState.targetTabGroupId===c.id&&c.collapsed)&&C>=t){let y=!1;for(let g=t;g<C;g++){const _=this._tabs[g].value.panel.id;if(_!==this._animState.sourceTabId&&!(o!=null&&o.has(_))){y=!0;break}}if(!y){const g=this._tabGroupManager.chipRenderers.get(c.id);g&&(h=g.chip.element)}break}}}const w=d=>d.classList.contains("dv-tab-group-chip")?"dv-tab-group-chip--shifting":"dv-tab--shifting",a=(d,c)=>{e?(d.style.transition="none",d.style.marginLeft=c,d.offsetHeight,d.style.removeProperty("transition")):d.style.marginLeft=c,we(d,w(d),!0)},l=d=>{const c=w(d),b=this._pendingMarginCleanups.get(d);if(b&&b(),e||!d.style.marginLeft)d.style.removeProperty("margin-left"),we(d,c,!1);else{d.style.marginLeft="0px",we(d,c,!0);const C=()=>{d.style.removeProperty("margin-left"),we(d,c,!1),d.removeEventListener("transitionend",C),clearTimeout(S),this._pendingMarginCleanups.delete(d)},S=setTimeout(C,300);this._pendingMarginCleanups.set(d,C),d.addEventListener("transitionend",C)}};let u=!1;for(const[d,c]of this._tabGroupManager.chipRenderers)d!==this._animState.sourceTabGroupId&&l(c.chip.element);h&&(a(h,`${n}px`),u=!0);for(let d=0;d<this._tabs.length;d++){const c=this._tabs[d].value;c.panel.id!==this._animState.sourceTabId&&(o!=null&&o.has(c.panel.id)||(!u&&d>=t?(a(c.element,`${n}px`),u=!0):l(c.element)))}this._tabGroupManager.trackUnderlines()}resetTabTransforms(){for(const[,e]of this._pendingMarginCleanups)e();this._pendingMarginCleanups.clear();for(const e of this._tabs)e.value.element.style.removeProperty("margin-left"),e.value.element.style.removeProperty("margin-right"),e.value.element.style.removeProperty("margin-top"),e.value.element.style.removeProperty("margin-bottom"),e.value.element.style.removeProperty("transform"),we(e.value.element,"dv-tab--shifting",!1);for(const[,e]of this._tabGroupManager.chipRenderers)e.chip.element.style.removeProperty("margin-left"),we(e.chip.element,"dv-tab-group-chip--shifting",!1);this._tabGroupManager.positionUnderlines()}_commitGroupMove(e,t){var n,o;const h=it();if(this._tabGroupManager.disposeChipDrag(e),this.group.model.getTabGroups().some(a=>a.id===e))if(((n=this.accessor.options.theme)===null||n===void 0?void 0:n.tabAnimation)==="smooth"){this._clearGroupDragClasses(e);const a=this.snapshotTabPositions();this.resetTabTransforms(),this.group.model.moveTabGroup(e,t),this.runFlipAnimation(a,"",!1)}else this._tabGroupManager.skipNextCollapseAnimation=!0,this.group.model.moveTabGroup(e,t);else h&&(this.resetTabTransforms(),this.accessor.moveGroupOrPanel({from:{groupId:h.groupId,tabGroupId:(o=h.tabGroupId)!==null&&o!==void 0?o:e},to:{group:this.group,position:"center",index:t}}))}_clearGroupDragClasses(e){const t=this._tabGroupManager.chipRenderers.get(e);t&&this._removeClassInstantlyBatch([t.chip.element],"dv-tab-group-chip--dragging"),this._removeClassInstantlyBatch(this._tabs.map(o=>o.value.element),"dv-tab--dragging");const n=this._tabGroupManager.groupUnderlines.get(e);n&&n.style.removeProperty("display"),this._tabGroupManager.skipNextCollapseAnimation=!0}resetDragAnimation(){if(this._pendingCollapse=!1,this._animState){this.resetTabTransforms(),this._animState.sourceTabGroupId?this._clearGroupDragClasses(this._animState.sourceTabGroupId):this._removeClassInstantlyBatch(this._tabs.map(e=>e.value.element),"dv-tab--dragging"),this._animState=null;for(const[,e]of this._tabGroupManager.groupUnderlines)e.style.removeProperty("display")}}runFlipAnimation(e,t,n=!1,o){const h=this._direction==="vertical";let w=!1;for(let a=0;a<this._tabs.length;a++){const l=this._tabs[a],u=l.value.panel.id;if(u===t){if(n){const C=l.value.element.getBoundingClientRect();l.value.element.style.transform=h?`translateY(${C.height}px)`:`translateX(${C.width}px)`,we(l.value.element,"dv-tab--shifting",!0),w=!0}continue}if(o!==void 0&&(a<o.from||a>o.to))continue;const d=e.get(u);if(!d)continue;const c=l.value.element.getBoundingClientRect(),b=h?d.top-c.top:d.left-c.left;Math.abs(b)<1||(l.value.element.style.transform=h?`translateY(${b}px)`:`translateX(${b}px)`,we(l.value.element,"dv-tab--shifting",!0),w=!0)}w&&requestAnimationFrame(()=>{var a;for(const d of this._tabs)d.value.element.style.transform&&(d.value.element.style.transform="");this._tabGroupManager.trackUnderlines(),(a=this._flipTransitionCleanup)===null||a===void 0||a.call(this);const l=d=>{if(d.propertyName==="transform"){u();for(const c of this._tabs)we(c.value.element,"dv-tab--shifting",!1);this._tabGroupManager.positionUnderlines()}},u=()=>{this._tabsList.removeEventListener("transitionend",l),this._flipTransitionCleanup=null};this._flipTransitionCleanup=u,this._tabsList.addEventListener("transitionend",l)})}}const ch=p=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",p.height),e.setAttributeNS(null,"width",p.width),e.setAttributeNS(null,"viewBox",p.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttributeNS(null,"d",p.path),e.appendChild(t),e},hv=()=>ch({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),cv=()=>ch({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),kp=()=>ch({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function dv(){const p=document.createElement("div");p.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const t=kp();return p.appendChild(t),p.appendChild(e),{element:p,update:n=>{e.textContent=`${n.tabs}`}}}class uv extends Se{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get direction(){return this._direction}set direction(e){this._direction=e,e==="vertical"?(bi(this._element,"dv-groupview-header-vertical"),bi(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e):(wi(this._element,"dv-groupview-header-vertical"),wi(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e)}get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction="horizontal",this.dropdownPart=null,this._overflowTabs=[],this._overflowTabGroups=[],this._dropdownDisposable=new ft,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onGroupDragStart=new Q,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",we(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new lv(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new sv(this.accessor,this.group),this.tabs.voidContainer=this.voidContainer.element,this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.tabs.setExtendedDropZone(this._element),this.addDisposables(this.tabs.onDrop(n=>this._onDrop.fire(n)),this.tabs.onWillShowOverlay(n=>this._onWillShowOverlay.fire(n)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(n=>{this.toggleDropdown(n)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(n=>{this._onGroupDragStart.fire({nativeEvent:n,group:this.group})}),this.voidContainer.onDrop(n=>{this.tabs.handleVoidDrop()||this._onDrop.fire({event:n.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(n=>{this._onWillShowOverlay.fire(new hr(n,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:it}))}),be(this.leftActionsContainer,"dragleave",n=>{const o=n.relatedTarget;!this.leftActionsContainer.contains(o)&&!this._element.contains(o)&&this.tabs.clearExternalAnimState()}),be(this.voidContainer.element,"dragleave",n=>{const o=n.relatedTarget;this.voidContainer.element.contains(o)||(this._element.contains(o)?this.tabs.setExternalInsertionIndex(null):this.tabs.clearExternalAnimState())}),be(this.voidContainer.element,"pointerdown",n=>{if(n.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&n.shiftKey&&this.group.api.location.type!=="floating"&&this.group.api.location.type!=="edge"){n.preventDefault();const{top:h,left:w}=this.element.getBoundingClientRect(),{top:a,left:l}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:w-l+20,y:h-a+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}getTabId(e){return this.tabs.getTabId(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}focusActiveTab(){this.tabs.focusActiveTab()}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){we(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const t=e.reset?[]:e.tabs,n=e.reset?[]:e.tabGroups;this._overflowTabs=t,this._overflowTabGroups=n;const o=this._overflowTabs.length;if(o>0&&this.dropdownPart){this.dropdownPart.update({tabs:o});return}if(o===0){this._dropdownDisposable.dispose();return}const h=document.createElement("div");h.className="dv-tabs-overflow-dropdown-root";const w=dv();w.update({tabs:o}),this.dropdownPart=w,h.appendChild(w.element),this.rightActionsContainer.prepend(h),this._dropdownDisposable.value=new Se(Ve.from(()=>{var a,l;h.remove(),(l=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||l===void 0||l.call(a),this.dropdownPart=null}),be(h,"pointerdown",a=>{a.preventDefault()},{capture:!0}),be(h,"click",a=>{const l=document.createElement("div");l.style.overflow="auto",l.className="dv-tabs-overflow-container";const u=new Set(this._overflowTabGroups),d=this.group.model.getTabGroups(),c=new Map;for(const S of d)if(u.has(S.id))for(const y of S.panelIds)c.set(y,S);const b=new Set;for(const S of this.tabs.tabs.filter(y=>this._overflowTabs.includes(y.panel.id))){const y=c.get(S.panel.id);if(y&&!b.has(y.id)){b.add(y.id);const D=document.createElement("div");D.className="dv-tabs-overflow-group-header";const P=document.createElement("span");P.className="dv-tabs-overflow-group-color",hh(P,y.color,this.accessor.tabGroupColorPalette),D.appendChild(P);const T=document.createElement("span");if(T.className="dv-tabs-overflow-group-label",T.textContent=y.label||y.id,D.appendChild(T),y.collapsed){const A=document.createElement("span");A.className="dv-tabs-overflow-group-collapsed-badge",A.textContent=`${y.panelIds.length}`,D.appendChild(A)}D.addEventListener("click",()=>{this.accessor.getPopupServiceForGroup(this.group).close(),y.collapsed&&y.expand();const A=y.panelIds[0];if(A){const E=this.group.panels.find(I=>I.id===A);this.accessor.withOrigin("user",()=>E==null?void 0:E.api.setActive())}}),l.appendChild(D)}const g=this.group.panels.find(D=>D===S.panel),m=g.view.createTabRenderer("headerOverflow").element,v=document.createElement("div");we(v,"dv-tab",!0),we(v,"dv-active-tab",g.api.isActive),we(v,"dv-inactive-tab",!g.api.isActive),y&&we(v,"dv-tab--grouped",!0),v.addEventListener("click",D=>{this.accessor.getPopupServiceForGroup(this.group).close(),!D.defaultPrevented&&(y!=null&&y.collapsed&&y.expand(),S.element.scrollIntoView(),this.accessor.withOrigin("user",()=>S.panel.api.setActive()))}),v.appendChild(m),l.appendChild(v)}const C=np(h);this.accessor.getPopupServiceForGroup(this.group).openPopover(l,{x:a.clientX,y:a.clientY,zIndex:C!=null&&C.style.zIndex?`calc(${C.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}updateTabGroups(){this.tabs.updateTabGroups()}refreshTabGroupAccent(){this.tabs.refreshTabGroupAccent()}}class Pp extends Qu{constructor(e,t,n,o,h){super(),this.nativeEvent=e,this.target=t,this.position=n,this.getData=o,this.group=h}}const $l=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,transformFloatingGroupDrag:void 0,floatingGroupDragHandle:void 0,popoutUrl:void 0,nonce:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,locked:void 0,disableDnd:void 0,dndStrategy:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0,getTabContextMenuItems:void 0,getTabGroupChipContextMenuItems:void 0,createTabGroupChipComponent:void 0,createGroupDragGhostComponent:void 0,dropOverlayModel:void 0,announcements:void 0,getAnnouncement:void 0,announcer:void 0,messages:void 0,keyboardNavigation:void 0,tabGroupColors:void 0,tabGroupAccent:void 0});function pv(p){return!!p.referencePanel}function fv(p){return!!p.referenceGroup}function mv(p){return!!p.referencePanel}function gv(p){return!!p.referenceGroup}class vv extends Se{get label(){return this._label}get color(){return this._color}get componentParams(){return this._componentParams}setLabel(e){this.isDisposed||this._label===e||(this._label=e,this._onDidChange.fire())}setColor(e){if(this.isDisposed)return;const t=e===""?void 0:e;this._color!==t&&(this._color=t,this._onDidChange.fire())}setComponentParams(e){this.isDisposed||(this._componentParams=e,this._onDidChange.fire())}get collapsed(){return this._collapsed}get panelIds(){return this._panelIds}get size(){return this._panelIds.length}get isEmpty(){return this._panelIds.length===0}constructor(e,t){var n,o;super(),this.id=e,this._collapsed=!1,this._panelIds=[],this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidPanelChange=new Q,this.onDidPanelChange=this._onDidPanelChange.event,this._onDidCollapseChange=new Q,this.onDidCollapseChange=this._onDidCollapseChange.event,this._onDidDestroy=new Q,this.onDidDestroy=this._onDidDestroy.event,this._label=(n=t==null?void 0:t.label)!==null&&n!==void 0?n:"",this._color=(t==null?void 0:t.color)===""||t==null?void 0:t.color,this._collapsed=(o=t==null?void 0:t.collapsed)!==null&&o!==void 0?o:!1,this._componentParams=t==null?void 0:t.componentParams,this.addDisposables(this._onDidChange,this._onDidPanelChange,this._onDidCollapseChange,this._onDidDestroy)}addPanel(e,t){if(this.isDisposed||this._panelIds.includes(e))return;const n=t!==void 0?Math.max(0,Math.min(t,this._panelIds.length)):this._panelIds.length;this._panelIds.splice(n,0,e),this._onDidPanelChange.fire({panelId:e,type:"add"})}removePanel(e){if(this.isDisposed)return!1;const t=this._panelIds.indexOf(e);return t===-1?!1:(this._panelIds.splice(t,1),this._onDidPanelChange.fire({panelId:e,type:"remove"}),!0)}indexOfPanel(e){return this._panelIds.indexOf(e)}containsPanel(e){return this._panelIds.includes(e)}collapse(){this.isDisposed||this._collapsed||(this._collapsed=!0,this._onDidCollapseChange.fire(!0))}expand(){this.isDisposed||!this._collapsed||(this._collapsed=!1,this._onDidCollapseChange.fire(!1))}toggle(){this._collapsed?this.expand():this.collapse()}toJSON(){const e={id:this.id,collapsed:this._collapsed,panelIds:[...this._panelIds]};return this._label&&(e.label=this._label),this._color!==void 0&&(e.color=this._color),this._componentParams!==void 0&&(e.componentParams=this._componentParams),e}dispose(){this._onDidDestroy.fire(),super.dispose()}}class dh extends ih{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class Tp extends dh{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class _v extends Se{get tabGroups(){return this._tabGroups}get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get contentContainerId(){return this.contentContainer.element.id}get contentDropTarget(){return this.contentContainer.dropTarget}get locked(){return this._locked}set locked(e){this._locked=e,we(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?Gl(document.activeElement,this.contentContainer.element):!1}get headerPosition(){var e;return(e=this._headerPosition)!==null&&e!==void 0?e:"top"}set headerPosition(e){var t;this._headerPosition=e,wi(this.container,"dv-groupview-header-top","dv-groupview-header-bottom","dv-groupview-header-left","dv-groupview-header-right"),bi(this.container,`dv-groupview-header-${e}`);const n=e==="top"||e==="bottom"?"horizontal":"vertical";this.tabsContainer.direction=n,this.header.direction=n,!((t=this._activePanel)===null||t===void 0)&&t.layout&&this._activePanel.layout(this._width,this._height),this.updateHeaderActions()}get location(){return this._location}set location(e){this._location=e,we(this.container,"dv-groupview-floating",!1),we(this.container,"dv-groupview-popout",!1),we(this.container,"dv-groupview-edge",!1);const t=n=>{this.contentContainer.dropTarget.setTargetZones(n),this.contentContainer.pointerDropTarget.setTargetZones(n)};switch(e.type){case"grid":t(["top","bottom","left","right","center"]);break;case"floating":t(["top","bottom","left","right","center"]),we(this.container,"dv-groupview-floating",!0);break;case"popout":t(["top","bottom","left","right","center"]),we(this.container,"dv-groupview-popout",!0);break;case"edge":t(["center"]),we(this.container,"dv-groupview-edge",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,n,o,h){var w,a;super(),this.container=e,this.accessor=t,this.id=n,this.options=o,this.groupPanel=h,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._tabGroupDisposables=new Map,this._pendingMicrotaskDisposables=new Set,this._onMove=new Q,this.onMove=this._onMove.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new Q,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new Q,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new Q,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new Q,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new Q,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new Q,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new Q,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new Q,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this._tabGroups=[],this._tabGroupMap=new Map,this._panelToTabGroup=new Map,this._tabGroupIdCounter=0,this._pendingTabGroupUpdate=!1,this._onDidCreateTabGroup=new Q,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new Q,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new Q,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new Q,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new Q,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new Q,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,we(this.container,"dv-groupview",!0),this.container.setAttribute("role","region"),this._api=new rh(this.accessor),this.tabsContainer=new uv(this.accessor,this.groupPanel),this.contentContainer=new Xg(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!o.hideHeader,this.locked=(w=o.locked)!==null&&w!==void 0?w:!1,this.headerPosition=(a=o.headerPosition)!==null&&a!==void 0?a:t.defaultHeaderPosition,this.addDisposables(this._onDidPanelTitleChange.event(()=>this.updateAccessibleLabel()),this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(l=>{this._onTabDragStart.fire(l)}),this.tabsContainer.onGroupDragStart(l=>{this._onGroupDragStart.fire(l)}),this.tabsContainer.onDrop(l=>{var u;const d=it(),c=(u=d==null?void 0:d.panelId)!==null&&u!==void 0?u:null;if(this.handleDropEvent("header",l.event,"center",l.index),c&&l.targetTabGroupId){const b=this._tabGroupMap.get(l.targetTabGroupId);let C;if(b){const S=this._panels.findIndex(y=>y.id===c);if(S!==-1){C=0;for(const y of b.panelIds)this._panels.findIndex(_=>_.id===y)<S&&C++}}this.addPanelToTabGroup(l.targetTabGroupId,c,C)}else c&&l.targetTabGroupId===null&&this.removePanelFromTabGroup(c)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(l=>{this.handleDropEvent("content",l.nativeEvent,l.position)}),this.contentContainer.pointerDropTarget.onDrop(l=>{this.handleDropEvent("content",l.nativeEvent,l.position)}),this.tabsContainer.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(l)}),this.contentContainer.dropTarget.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(new hr(l,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:it}))}),this.contentContainer.pointerDropTarget.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(new hr(l,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:it}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOver,this._onDidPanelTitleChange,this._onDidPanelParametersChange,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,this._onDidCreateTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidDestroyTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidAddPanelToTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidRemovePanelFromTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupChange.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupCollapsedChange.event(()=>{this._scheduleTabGroupUpdate()}))}_scheduleTabGroupUpdate(){this._pendingTabGroupUpdate||(this._pendingTabGroupUpdate=!0,queueMicrotask(()=>{this._pendingTabGroupUpdate=!1,this.isDisposed||this.tabsContainer.updateTabGroups()}))}_bracketTabGroupMutation(e){return this.accessor.mutation?this.accessor.mutation("tab-group",e):e()}createTabGroup(e){return this._bracketTabGroupMutation(()=>this._doCreateTabGroup(e))}_doCreateTabGroup(e){var t;const n=(t=e==null?void 0:e.id)!==null&&t!==void 0?t:`tg-${this.id}-${this._tabGroupIdCounter++}`,o=new vv(n,{label:e==null?void 0:e.label,color:e==null?void 0:e.color,collapsed:e==null?void 0:e.collapsed,componentParams:e==null?void 0:e.componentParams});return this._tabGroups.push(o),this._tabGroupMap.set(n,o),this._tabGroupDisposables.set(n,new Se(o.onDidChange(()=>{this._onDidTabGroupChange.fire({tabGroup:o})}),o.onDidCollapseChange(h=>{h?this._handleGroupCollapse(o):this._handleGroupExpand(o),this._onDidTabGroupCollapsedChange.fire({tabGroup:o})}),o.onDidDestroy(()=>{this._removeTabGroupInternal(o)}))),this._onDidCreateTabGroup.fire({tabGroup:o}),o}dissolveTabGroup(e){const t=this._tabGroupMap.get(e);t&&this._bracketTabGroupMutation(()=>{const n=[...t.panelIds];for(const o of n)t.removePanel(o),this._panelToTabGroup.delete(o),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:o});t.dispose()})}addPanelToTabGroup(e,t,n){const o=this._tabGroupMap.get(e);if(!o||!this._panels.some(w=>w.id===t))return;const h=this.getTabGroupForPanel(t);h&&h.id===e||this._bracketTabGroupMutation(()=>{h&&this.removePanelFromTabGroup(t),o.addPanel(t,n),this._panelToTabGroup.set(t,o),this._enforceContiguity(o,t),this._onDidAddPanelToTabGroup.fire({tabGroup:o,panelId:t})})}movePanelWithinGroup(e,t,n){const o=this._tabGroupMap.get(e);!o||!o.containsPanel(t)||(o.removePanel(t),o.addPanel(t,n),this._enforceContiguity(o,t),this.tabsContainer.updateTabGroups())}movePanelBetweenGroups(e,t,n){const o=this._findTabGroupForPanel(e),h=this._tabGroupMap.get(t);h&&(o&&(o.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:o,panelId:e}),o.isEmpty&&o.dispose()),h.addPanel(e,n),this._panelToTabGroup.set(e,h),this._enforceContiguity(h,e),this._onDidAddPanelToTabGroup.fire({tabGroup:h,panelId:e}))}moveTabGroup(e,t){const n=this._tabGroupMap.get(e);if(!n||n.panelIds.length===0)return;const o=new Set(n.panelIds),h=n.panelIds.map(u=>this._panels.find(d=>d.id===u)).filter(u=>u!==void 0);if(h.length===0)return;let w=0;for(let u=0;u<Math.min(t,this._panels.length);u++)o.has(this._panels[u].id)&&w++;for(const u of h){const d=this._panels.indexOf(u);d!==-1&&this._panels.splice(d,1)}const a=t-w,l=Math.max(0,Math.min(a,this._panels.length));this._panels.splice(l,0,...h);for(const u of this._panels)this.tabsContainer.delete(u.id);for(let u=0;u<this._panels.length;u++)this.tabsContainer.openPanel(this._panels[u],u);this.tabsContainer.updateTabGroups()}_enforceContiguity(e,t){const n=this._panels.find(l=>l.id===t);if(!n)return;const o=e.indexOfPanel(t),h=this._computeGlobalIndex(e,o),w=this._panels.indexOf(n);if(w===h)return;this._panels.splice(w,1);const a=h>w?h-1:h;this._panels.splice(a,0,n),this.tabsContainer.delete(t),this.tabsContainer.openPanel(n,a)}_computeGlobalIndex(e,t){const n=e.panelIds;if(n.length<=1){const o=this._panels.find(h=>h.id===n[0]);return o?this._panels.indexOf(o):this._panels.length}for(let o=0;o<n.length;o++){if(o===t)continue;const h=this._panels.find(w=>w.id===n[o]);if(h){const w=this._panels.indexOf(h);return Math.max(0,w+(t-o))}}return this._panels.length}removePanelFromTabGroup(e){const t=this._findTabGroupForPanel(e);t&&this._bracketTabGroupMutation(()=>{t.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:e}),t.isEmpty&&t.dispose()})}getTabGroups(){return this._tabGroups}updateTabGroups(){this.tabsContainer.updateTabGroups()}refreshTabGroupAccent(){this.tabsContainer.refreshTabGroupAccent()}refreshWatermark(){var e,t;this.watermark&&(this.watermark.element.remove(),(t=(e=this.watermark).dispose)===null||t===void 0||t.call(e),this.watermark=void 0),this.updateContainer()}getTabGroupForPanel(e){return this._findTabGroupForPanel(e)}_findTabGroupForPanel(e){return this._panelToTabGroup.get(e)}_removeTabGroupInternal(e){const t=this._tabGroups.indexOf(e);if(t!==-1){this._tabGroups.splice(t,1),this._tabGroupMap.delete(e.id);for(const o of e.panelIds)this._panelToTabGroup.delete(o);this._onDidDestroyTabGroup.fire({tabGroup:e});const n=this._tabGroupDisposables.get(e.id);this._tabGroupDisposables.delete(e.id),n&&(this._pendingMicrotaskDisposables.add(n),queueMicrotask(()=>{this._pendingMicrotaskDisposables.delete(n),n.dispose()}))}}_handleGroupCollapse(e){if(!this._activePanel||!e.containsPanel(this._activePanel.id))return;const t=this._panels.indexOf(this._activePanel);for(let n=t+1;n<this._panels.length;n++){const o=this._panels[n],h=this._findTabGroupForPanel(o.id);if(!h||!h.collapsed){this.doSetActivePanel(o),this.updateContainer();return}}for(let n=t-1;n>=0;n--){const o=this._panels[n],h=this._findTabGroupForPanel(o.id);if(!h||!h.collapsed){this.doSetActivePanel(o),this.updateContainer();return}}this.contentContainer.closePanel(),this.doSetActivePanel(void 0),this.updateContainer()}_handleGroupExpand(e){if(this._activePanel)return;const t=e.panelIds[0];if(t){const n=this._panels.find(o=>o.id===t);n&&(this.doSetActivePanel(n),this.updateContainer())}}restoreTabGroups(e){for(const t of e){const n=t.id.match(/-(\d+)$/);if(n){const o=parseInt(n[1],10)+1;o>this._tabGroupIdCounter&&(this._tabGroupIdCounter=o)}}for(const t of e){const n=this.createTabGroup({id:t.id,label:t.label,color:t.color,componentParams:t.componentParams}),o=this._tabGroupMap.get(n.id);for(const h of t.panelIds)this._panels.some(w=>w.id===h)&&(n.addPanel(h),this._panelToTabGroup.set(h,o),this._enforceContiguity(o,h));t.collapsed&&n.collapse(),n.isEmpty&&n.dispose()}}focusContent(){this.contentContainer.element.focus()}focusActiveTab(){this.tabsContainer.focusActiveTab()}set renderContainer(e){this.panels.forEach(t=>{this.renderContainer.detatch(t)}),this._overwriteRenderContainer=e,this.panels.forEach(t=>{this.rerender(t)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){var e;(e=this.accessor.headerActionsService)===null||e===void 0||e.refresh(this.groupPanel)}attachHeaderAction(e,t){switch(e){case"left":this.tabsContainer.setLeftActionsElement(t);break;case"right":this.tabsContainer.setRightActionsElement(t);break;case"prefix":this.tabsContainer.setPrefixActionsElement(t);break}}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const t={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),this.headerPosition!=="top"&&(t.headerPosition=this.headerPosition),this._tabGroups.length>0&&(t.tabGroups=this._tabGroups.map(n=>n.toJSON())),t}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let n;if(t<this.panels.length-1)n=t+1;else if(!e.suppressRoll)n=0;else return;this.openPanel(this.panels[n])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let n;if(t>0)n=t-1;else if(!e.suppressRoll)n=this.panels.length-1;else return;this.openPanel(this.panels[n])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,t={}){(typeof t.index!="number"||t.index>this.panels.length)&&(t.index=this.panels.length);const n=!!t.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:n}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}n||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()}removePanel(e,t={skipSetActive:!1}){const n=typeof e=="string"?e:e.id,o=this._panels.find(h=>h.id===n);if(!o)throw new Error("invalid operation");return this._removePanel(o,t)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const t=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,t&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){if(!(!t&&this.isActive===e)){if(this._isGroupActive=e,we(this.container,"dv-active-group",e),we(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0){const n=this._panels.find(o=>{const h=this._findTabGroupForPanel(o.id);return!h||!h.collapsed});n&&this.doSetActivePanel(n)}this.updateContainer()}}layout(e,t){var n;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),!((n=this._activePanel)===null||n===void 0)&&n.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,t){const n=this._activePanel===e;if(this.doRemovePanel(e),n&&this.panels.length>0){const o=this.mostRecentlyUsed[0];this.openPanel(o,{skipSetActive:t.skipSetActive,skipSetGroupActive:t.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),t.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){const o=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(o,1)}const n=this._panelDisposables.get(e.id);n&&(n.dispose(),this._panelDisposables.delete(e.id)),this.removePanelFromTabGroup(e.id),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,n={skipSetActive:!1}){const h=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),n.skipSetActive?e.api.renderer==="always"&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),!h&&(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new Se(e.api.onDidTitleChange(w=>this._onDidPanelTitleChange.fire(w)),e.api.onDidParametersChange(w=>this._onDidPanelParametersChange.fire(w)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){var t,n,o;this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(e.id)),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e,origin:(o=(n=(t=this.accessor).currentOrigin)===null||n===void 0?void 0:n.call(t))!==null&&o!==void 0?o:"user"})),this.updateAccessibleLabel())}updateAccessibleLabel(){var e;const t=(e=this._activePanel)===null||e===void 0?void 0:e.title;t?this.container.setAttribute("aria-label",t):this.container.removeAttribute("aria-label")}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,t;this.panels.forEach(o=>o.runEvents());const n=this.isEmpty||!this._activePanel;if(n&&!this.watermark){const o=this.accessor.createWatermarkComponent();o.init({containerApi:this._api,group:this.groupPanel}),this.watermark=o,be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!n&&this.watermark&&(this.watermark.element.remove(),(t=(e=this.watermark).dispose)===null||t===void 0||t.call(e),this.watermark=void 0)}canDisplayOverlay(e,t,n){const o=new Pp(e,n,t,it,this.accessor.getPanel(this.id));return this._onUnhandledDragOver.fire(o),o.isAccepted}handleDropEvent(e,t,n,o){if(this.locked==="no-drop-target")return;function h(){switch(e){case"header":return typeof o=="number"?"tab":"header_space";case"content":return"content"}}const w=typeof o=="number"?this.panels[o]:void 0,a=new Tp({nativeEvent:t,position:n,panel:w,getData:()=>it(),kind:h(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(a),a.defaultPrevented)return;const l=it();if(l&&l.viewId===this.accessor.id){if(e==="content"&&l.groupId===this.id&&(n==="center"||l.panelId===null&&!l.tabGroupId)||e==="header"&&l.groupId===this.id&&l.panelId===null&&!l.tabGroupId)return;if(l.panelId===null){const{groupId:C}=l;this._onMove.fire({target:n,groupId:C,index:o,tabGroupId:l.tabGroupId});return}if(this.tabsContainer.indexOf(l.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:d,panelId:c}=l;if(this.id===d&&!n&&this.tabsContainer.indexOf(c)===o)return;this._onMove.fire({target:n,groupId:l.groupId,itemId:l.panelId,index:o})}else this._onDidDrop.fire(new dh({nativeEvent:t,position:n,panel:w,getData:()=>it(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,n;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(n=(t=this.watermark)===null||t===void 0?void 0:t.dispose)===null||n===void 0||n.call(t),this.watermark=void 0;for(const o of[...this._tabGroups])o.dispose();for(const o of this._tabGroupDisposables.values())o.dispose();this._tabGroupDisposables.clear();for(const o of this._pendingMicrotaskDisposables)o.dispose();this._pendingMicrotaskDisposables.clear();for(const o of this.panels)o.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class uh extends bp{constructor(e,t,n){super(e,t),this._onDidConstraintsChangeInternal=new Q,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new Q,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new Q,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),n&&this.initialize(n)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Ap extends oh{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,n,o){super(e,t,o??new uh(e,t)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,typeof(n==null?void 0:n.minimumWidth)=="number"&&(this._minimumWidth=n.minimumWidth),typeof(n==null?void 0:n.maximumWidth)=="number"&&(this._maximumWidth=n.maximumWidth),typeof(n==null?void 0:n.minimumHeight)=="number"&&(this._minimumHeight=n.minimumHeight),typeof(n==null?void 0:n.maximumHeight)=="number"&&(this._maximumHeight=n.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(h=>{const{isVisible:w}=h,{accessor:a}=this._params;a.setVisible(this,w)}),this.api.onActiveChange(()=>{const{accessor:h}=this._params;h.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(h=>{(typeof h.minimumWidth=="number"||typeof h.minimumWidth=="function")&&(this._minimumWidth=h.minimumWidth),(typeof h.minimumHeight=="number"||typeof h.minimumHeight=="function")&&(this._minimumHeight=h.minimumHeight),(typeof h.maximumWidth=="number"||typeof h.maximumWidth=="function")&&(this._maximumWidth=h.maximumWidth),(typeof h.maximumHeight=="number"||typeof h.maximumHeight=="function")&&(this._maximumHeight=h.maximumHeight)}),this.api.onDidSizeChange(h=>{this._onDidChange.fire({height:h.height,width:h.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=o=>o===Number.MAX_SAFE_INTEGER?void 0:o,n=o=>o<=0?void 0:o;return Object.assign(Object.assign({},e),{minimumHeight:n(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:n(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Vi="dockview: DockviewGroupPanelApiImpl not initialized";class wv extends uh{get location(){if(!this._group)throw new Error(Vi);return this._group.model.location}get boundingBox(){if(!this._group||this._group.model.location.type==="popout")return;const e=this.accessor.element.getBoundingClientRect(),t=this._group.element.getBoundingClientRect();return{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}}get locked(){if(!this._group)throw new Error(Vi);return this._group.locked}set locked(e){if(!this._group)throw new Error(Vi);this._group.locked=e}constructor(e,t){super(e,"__dockviewgroup__"),this.accessor=t,this._onDidLocationChange=new Q,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new Q,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidCollapsedChange=new Q,this.onDidCollapsedChange=this._onDidCollapsedChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidCollapsedChange,this._onDidVisibilityChange.event(n=>{n.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}setHeaderPosition(e){if(!this._group)throw new Error(Vi);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw new Error(Vi);return this._group.model.headerPosition}moveTo(e){var t,n,o,h;if(!this._group)throw new Error(Vi);const w=(t=e.group)!==null&&t!==void 0?t:this.accessor.addGroup({direction:Ag((n=e.position)!==null&&n!==void 0?n:"right"),skipSetActive:(o=e.skipSetActive)!==null&&o!==void 0?o:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:w,position:e.group&&(h=e.position)!==null&&h!==void 0?h:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Vi);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Vi);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Vi);this.isMaximized()&&this.accessor.exitMaximizedGroup()}collapse(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!0)}expand(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!1)}isCollapsed(){return this._group?this.accessor.isEdgeGroupCollapsed(this._group):!1}initialize(e){this._group=e}}const bv=100,yv=100;class So extends Ap{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof t=="number"?t:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof t=="number"?t:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof t=="number"?t:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof t=="number"?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,n){var o,h,w,a,l,u;super(t,"groupview_default",{minimumHeight:(h=(o=n.constraints)===null||o===void 0?void 0:o.minimumHeight)!==null&&h!==void 0?h:yv,minimumWidth:(a=(w=n.constraints)===null||w===void 0?void 0:w.minimumWidth)!==null&&a!==void 0?a:bv,maximumHeight:(l=n.constraints)===null||l===void 0?void 0:l.maximumHeight,maximumWidth:(u=n.constraints)===null||u===void 0?void 0:u.maximumWidth},new wv(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new _v(this.element,e,t,n,this),this.addDisposables(this.model.onDidActivePanelChange(d=>{this.api._onDidActivePanelChange.fire(d)}),this.api.onDidConstraintsChangeInternal(d=>{d.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof d.minimumWidth=="function"?d.minimumWidth():d.minimumWidth),d.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof d.minimumHeight=="function"?d.minimumHeight():d.minimumHeight),d.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof d.maximumWidth=="function"?d.maximumWidth():d.maximumWidth),d.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof d.maximumHeight=="function"?d.maximumHeight():d.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const Sv={name:"dark",className:"dockview-theme-dark",colorScheme:"dark"},Cv={name:"light",className:"dockview-theme-light",colorScheme:"light"},xv={className:"dockview-theme-abyss",tabGroupIndicator:"none"};class Dv extends uh{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,n,o,h){super(e.id,o),this.panel=e,this.accessor=n,this._onDidTitleChange=new Q,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new Q,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new Q,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new Q,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new ft,this._tabComponent=h,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}setActive(){this.accessor.withOrigin("api",()=>super.setActive())}moveTo(e){var t,n;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(t=e.group)!==null&&t!==void 0?t:this._group,position:e.group&&(n=e.position)!==null&&n!==void 0?n:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var t;let n=(t=e==null?void 0:e.isActive)!==null&&t!==void 0?t:!1;this.groupEventsDisposable.value=new Se(this.group.api.onDidVisibilityChange(o=>{const h=!o.isVisible&&this.isVisible,w=o.isVisible&&!this.isVisible,a=this.group.model.isPanelActive(this.panel);(h||w&&a)&&this._onDidVisibilityChange.fire(o)}),this.group.api.onDidLocationChange(o=>{this.group===this.panel.group&&this._onDidLocationChange.fire(o)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&n!==this.isGroupActive&&(n=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class pn extends Se{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,n,o,h,w,a,l){super(),this.id=e,this.accessor=o,this.containerApi=h,this.view=a,this._renderer=l.renderer,this._group=w,this._minimumWidth=l.minimumWidth,this._minimumHeight=l.minimumHeight,this._maximumWidth=l.maximumWidth,this._maximumHeight=l.maximumHeight,this.api=new Dv(this,this._group,o,t,n),this.addDisposables(this.api.onActiveChange(()=>{o.setActivePanel(this)}),this.api.onDidSizeChange(u=>{this.group.api.setSize(u)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new wp;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.view.setTitle(e),this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var t;this._params=Object.assign(Object.assign({},(t=this._params)!==null&&t!==void 0?t:{}),e.params);for(const n of Object.keys(e.params))e.params[n]===void 0&&delete this._params[n];this.view.update({params:this._params})}updateFromStateModel(e){var t,n,o;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(t=e.params)!==null&&t!==void 0?t:{}}),this.setTitle((n=e.title)!==null&&n!==void 0?n:this.id),this.setRenderer((o=e.renderer)!==null&&o!==void 0?o:this.accessor.renderer)}updateParentGroup(e,t){this._group=e,this.api.group=this._group;const n=this._group.model.isPanelActive(this),o=this.group.api.isActive&&n;t!=null&&t.skipSetActive||this.api.isActive!==o&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&n}),this.api.isVisible!==n&&this.api._onDidVisibilityChange.fire({isVisible:n})}runEvents(){const e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}}class lu extends Se{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(hv()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(t=>{this._title=t.title,this.render()}),be(this.action,"pointerdown",t=>{t.preventDefault()}),be(this.action,"click",t=>{t.defaultPrevented||(t.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class Ip{get content(){return this._content}get tab(){return this._tab}constructor(e,t,n,o){this.accessor=e,this.id=t,this.contentComponent=n,this.tabComponent=o,this._content=this.createContentComponent(this.id,n),this._tab=this.createTabComponent(this.id,o)}createTabRenderer(e){var t;const n=this.createTabComponent(this.id,this.tabComponent);return this._params&&n.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((t=n.update)===null||t===void 0||t.call(n,this._updateEvent)),n}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}setTitle(e){this._params&&(this._params.title=e)}layout(e,t){var n,o;(o=(n=this.content).layout)===null||o===void 0||o.call(n,e,t)}update(e){var t,n,o,h;this._updateEvent=e,(n=(t=this.content).update)===null||n===void 0||n.call(t,e),(h=(o=this.tab).update)===null||h===void 0||h.call(o,e)}dispose(){var e,t,n,o;(t=(e=this.content).dispose)===null||t===void 0||t.call(e),(o=(n=this.tab).dispose)===null||o===void 0||o.call(n)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){const n=t??this.accessor.options.defaultTabComponent;if(n){if(this.accessor.options.createTabComponent){const o=this.accessor.options.createTabComponent({id:e,name:n});return o||new lu}console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new lu}}class Ev{constructor(e){this.accessor=e}fromJSON(e,t){var n,o;const h=e.id,w=e.params,a=e.title,l=e.view,u=l?l.content.id:(n=e.contentComponent)!==null&&n!==void 0?n:"unknown",d=l?(o=l.tab)===null||o===void 0?void 0:o.id:e.tabComponent,c=new Ip(this.accessor,h,u,d),b=new pn(h,u,d,this.accessor,new rh(this.accessor),t,c,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return b.init({title:a??h,params:w??{}}),b}}class kv extends Se{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class Pv{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(t=>t!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(t=>t!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}}const Co=new Pv;class Pi extends Se{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}get headerHeight(){var e,t;return(t=(e=this.options.header)===null||e===void 0?void 0:e.offsetHeight)!==null&&t!==void 0?t:0}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new Q,this.onDidChangeEnd=this._onDidChangeEnd.event,this._onDidStartMoving=new Q,this.onDidStartMoving=this._onDidStartMoving.event,this._dragMove=new ft,this._dragCancelled=!1,this.addDisposables(this._onDidChange,this._onDidChangeEnd,this._onDidStartMoving,this._dragMove),this._element.className="dv-resize-container",this._element.setAttribute("role","dialog"),this._element.setAttribute("aria-modal","false"),this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this.options.header&&(we(this._element,"dv-resize-container-with-titlebar",!0),this._element.appendChild(this.options.header)),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),Co.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,we(this.element,"dv-hidden",!this.isVisible))}bringToFront(){Co.push(this._element)}setBounds(e={}){typeof e.height=="number"&&(this._element.style.height=`${e.height}px`),typeof e.width=="number"&&(this._element.style.width=`${e.width}px`),"top"in e&&typeof e.top=="number"&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&typeof e.bottom=="number"&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&typeof e.left=="number"&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&typeof e.right=="number"&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const t=this.options.container.getBoundingClientRect(),n=this._element.getBoundingClientRect(),o=Math.max(0,this.getMinimumWidth(n.width)),h=Math.max(0,this.getMinimumHeight(n.height));if(this.verticalAlignment==="top"){const w=et(n.top-t.top,-h,Math.max(0,t.height-n.height+h));this._element.style.top=`${w}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const w=et(t.bottom-n.bottom,-h,Math.max(0,t.height-n.height+h));this._element.style.bottom=`${w}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const w=et(n.left-t.left,-o,Math.max(0,t.width-n.width+o));this._element.style.left=`${w}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const w=et(t.right-n.right,-o,Math.max(0,t.width-n.width+o));this._element.style.right=`${w}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),t=this._element.getBoundingClientRect(),n={};return this.verticalAlignment==="top"?n.top=parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?n.bottom=parseFloat(this._element.style.bottom):n.top=t.top-e.top,this.horiziontalAlignment==="left"?n.left=parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?n.right=parseFloat(this._element.style.right):n.left=t.left-e.left,n.width=t.width,n.height=t.height,n}cancelPendingDrag(){this._dragMove.value&&(this._dragCancelled=!0,we(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=Ve.NONE)}setupDrag(e,t={inDragMode:!1}){const n=(o,h)=>{var w,a,l;let u=null,d=!1;this._dragCancelled=!1;const c=this.options.transformDragPosition?(l=(a=(w=this.options).getSiblingBoxes)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:[]:[],b=ar();if(o&&typeof h=="number"&&typeof o.setPointerCapture=="function")try{o.setPointerCapture(h)}catch{}const C=()=>{we(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=Ve.NONE,this._onDidChangeEnd.fire()};this._dragMove.value=new Se({dispose:()=>{if(b.release(),o&&typeof h=="number"&&typeof o.releasePointerCapture=="function")try{o.releasePointerCapture(h)}catch{}}},be(window,"pointermove",S=>{if(this._dragCancelled)return;const y=this.options.container.getBoundingClientRect(),g=S.clientX-y.left,_=S.clientY-y.top;we(this._element,"dv-resize-container-dragging",!0);const m=this._element.getBoundingClientRect();u===null&&(u={x:S.clientX-m.left,y:S.clientY-m.top});const v=Math.max(0,this.getMinimumWidth(m.width)),D=Math.max(0,this.getMinimumHeight(m.height));let P=_-u.y,T=g-u.x;if(this.options.transformDragPosition){const q=this.options.transformDragPosition({proposed:{top:P,left:T,width:m.width,height:m.height},container:{width:y.width,height:y.height},others:c});q&&(P=q.top,T=q.left)}const A=Math.max(0,y.height-m.height+D),E=Math.max(0,y.width-m.width+v),I=et(P,-D,A),z=et(y.height-m.height-P,-D,A),H=et(T,-v,E),V=et(y.width-m.width-T,-v,E),F={};I<=z?F.top=I:F.bottom=z,H<=V?F.left=H:F.right=V,this.setBounds(F),d||(d=!0,this._onDidStartMoving.fire())}),be(window,"pointerup",C),be(window,"pointercancel",C))};this.addDisposables(be(e,"pointerdown",o=>{if(o.defaultPrevented){o.preventDefault();return}su(o)||n(e,o.pointerId)}),be(this.options.content,"pointerdown",o=>{o.defaultPrevented||su(o)||o.shiftKey&&n(this.options.content,o.pointerId)}),be(this.options.content,"pointerdown",()=>{Co.push(this._element)},!0)),t.inDragMode&&n()}setupResize(e){const t=document.createElement("div");t.className=`dv-resize-handle-${e}`,this._element.appendChild(t);const n=new ft;this.addDisposables(n,be(t,"pointerdown",o=>{o.preventDefault();let h=null;const w=ar(),a=o.pointerId;if(typeof t.setPointerCapture=="function")try{t.setPointerCapture(a)}catch{}const l=()=>{n.dispose(),this._onDidChangeEnd.fire()};n.value=new Se(be(window,"pointermove",u=>{const d=this.options.container.getBoundingClientRect(),c=this._element.getBoundingClientRect(),b=u.clientY-d.top,C=u.clientX-d.left;h===null&&(h={originalY:b,originalHeight:c.height,originalX:C,originalWidth:c.width});let S,y,g,_,m,v;const D=()=>{const I=h.originalY+h.originalHeight>d.height?Math.max(0,d.height-Pi.MINIMUM_HEIGHT):Math.max(0,h.originalY+h.originalHeight-Pi.MINIMUM_HEIGHT);S=et(b,0,I),g=h.originalY+h.originalHeight-S,y=d.height-S-g},P=()=>{S=h.originalY-h.originalHeight;const I=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:Pi.MINIMUM_HEIGHT,z=d.height-Math.max(0,S);g=et(b-S,I,z),y=d.height-S-g},T=()=>{const I=h.originalX+h.originalWidth>d.width?Math.max(0,d.width-Pi.MINIMUM_WIDTH):Math.max(0,h.originalX+h.originalWidth-Pi.MINIMUM_WIDTH);_=et(C,0,I),v=h.originalX+h.originalWidth-_,m=d.width-_-v},A=()=>{_=h.originalX-h.originalWidth;const I=_<0&&typeof this.options.minimumInViewportWidth=="number"?-_+this.options.minimumInViewportWidth:Pi.MINIMUM_WIDTH,z=d.width-Math.max(0,_);v=et(C-_,I,z),m=d.width-_-v};switch(e){case"top":D();break;case"bottom":P();break;case"left":T();break;case"right":A();break;case"topleft":D(),T();break;case"topright":D(),A();break;case"bottomleft":P(),T();break;case"bottomright":P(),A();break}const E={};S<=y?E.top=S:E.bottom=y,_<=m?E.left=_:E.right=m,E.height=g,E.width=v,this.setBounds(E)}),{dispose:()=>{if(w.release(),typeof t.releasePointerCapture=="function")try{t.releasePointerCapture(a)}catch{}}},be(window,"pointerup",l),be(window,"pointercancel",l))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Co.destroy(this._element),this._element.remove(),super.dispose()}}Pi.MINIMUM_HEIGHT=20;Pi.MINIMUM_WIDTH=20;class Tv extends Se{get element(){return this._element}get group(){return this._group}setGroup(e){this._group=e}constructor(e,t){super(),this.accessor=e,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._group=t,this._element=document.createElement("div"),this._element.className="dv-floating-titlebar",this.addDisposables(this._onDragStart,be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this._group)}),be(this._element,"pointerdown",n=>{n.shiftKey&&ip(n)},!0)),this.dragSource=new Sp({element:this._element,accessor:this.accessor,group:()=>this._group}),this.addDisposables(this.dragSource,this.dragSource.onDragStart(n=>{this._onDragStart.fire(n)}))}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}}function oi(p){return{moduleName:p.name,services:{[p.serviceKey]:p.create},init:p.init?(e,t)=>p.init(e,t[p.serviceKey]):void 0,dependsOn:p.dependsOn}}const hu=new Set;function Gs(p,e,t){if(p!==void 0)return p;const n=`${e}|${t??""}`;if(hu.has(n))return;hu.add(n);const o=t?` for ${t}`:"";console.error(`dockview: module "${e}" is not registered${o}.`)}class Av{constructor(){this._modules=new Map,this._services={},this._initDisposables=[]}get services(){return this._services}register(e){if(!this._modules.has(e.moduleName)){if(e.dependsOn)for(const t of e.dependsOn)this.register(t);this._modules.set(e.moduleName,e)}}initialize(e){for(const t of this._modules.values())if(t.services)for(const[n,o]of Object.entries(t.services))this._services[n]=o(e)}postConstruct(e){for(const t of this._modules.values())t.init&&this._initDisposables.push(t.init(e,this._services))}has(e){return this._modules.has(e)}dispose(){for(const e of this._initDisposables)e.dispose();this._initDisposables.length=0;for(const e of Object.values(this._services))e!==void 0&&typeof e.dispose=="function"&&e.dispose()}}const Ul=[];function Iv(p){for(const e of p)Ul.some(t=>t.moduleName===e.moduleName)||Ul.push(e)}function Lv(){return[...Ul]}let Lp=!1;function Rv(){Lp=!0}function Mv(){return Lp}const Ro=100,ms={left:100,top:100,width:300,height:300},Ov=100;class Gv extends Se{get group(){return this._group}setTitleBar(e){this._titleBar=e}setAnchorGroup(e){var t;this._group=e,(t=this._titleBar)===null||t===void 0||t.setGroup(e)}constructor(e,t,n){super(),this.overlay=t,this.gridview=n,this._group=e,this.addDisposables(t,{dispose:()=>this.gridview.dispose()})}position(e){this.overlay.setBounds(e)}}class Nv{get floatingGroups(){return this._floatingGroups}constructor(e){this._floatingGroups=[],this._host=e}add(e,t,n){const o=new Gv(e,t,n),h=new Se(e.api.onDidActiveChange(a=>{a.isActive&&t.bringToFront()}),(()=>{let a=-1,l=-1;return cr(n.element,u=>{const d=Math.round(u.contentRect.width),c=Math.round(u.contentRect.height);d===a&&c===l||(a=d,l=c,n.layout(d,c))})})()),w=()=>{var a;const l=(a=e.activePanel)===null||a===void 0?void 0:a.title;l?t.element.setAttribute("aria-label",l):t.element.removeAttribute("aria-label")};return w(),o.addDisposables(e.api.onDidActivePanelChange(()=>w()),t.onDidChange(()=>{n.layout(n.width,n.height)}),t.onDidChangeEnd(()=>{this._host.fireLayoutChange()}),e.onDidChange(a=>{t.setBounds({height:typeof(a==null?void 0:a.height)=="number"?a.height+t.headerHeight:a==null?void 0:a.height,width:a==null?void 0:a.width})}),{dispose:()=>{h.dispose(),op(this._floatingGroups,o),e.model.location={type:"grid"}}}),this._floatingGroups.push(o),o}findByGroup(e){return this._floatingGroups.find(t=>t.group===e||t.gridview.element.contains(e.element))}serialize(){return this._floatingGroups.map(e=>{const t=e.gridview.serialize(),n=e.overlay.toJSON(),o=t.root;return o.type==="branch"&&o.data.length===1&&o.data[0].type==="leaf"?{data:o.data[0].data,position:n}:{grid:t,position:n}})}constrainBounds(){for(const e of this._floatingGroups)e.overlay.setBounds()}updateBounds(e){var t,n;if("floatingGroupBounds"in e)for(const o of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":o.overlay.minimumInViewportHeight=void 0,o.overlay.minimumInViewportWidth=void 0;break;case void 0:o.overlay.minimumInViewportHeight=Ro,o.overlay.minimumInViewportWidth=Ro;break;default:o.overlay.minimumInViewportHeight=(t=e.floatingGroupBounds)===null||t===void 0?void 0:t.minimumHeightWithinViewport,o.overlay.minimumInViewportWidth=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumWidthWithinViewport}o.overlay.setBounds()}}disposeAll(){for(const e of[...this._floatingGroups])e.dispose()}dispose(){this.disposeAll()}}const zv=oi({name:"FloatingGroup",serviceKey:"floatingGroupService",create:p=>new Nv(p)});class Bv{constructor(e){this._entries=[],this._popupServices=new Map,this._restorationCleanups=new Set,this._restorationPromise=Promise.resolve(),this._onDidRemove=new Q,this.onDidRemove=this._onDidRemove.event,this._host=e}get entries(){return this._entries}get restorationPromise(){return this._restorationPromise}add(e){this._entries.push(e)}remove(e){op(this._entries,e)&&!this._host.isDisposed&&this._onDidRemove.fire(e)}findByGroup(e){return this._entries.find(t=>t.popoutGroup===e||t.gridview.element.contains(e.element))}findReferenceGroupId(e){var t;return(t=this._entries.find(n=>n.popoutGroup===e))===null||t===void 0?void 0:t.referenceGroup}observeGridviewSize(e,t,n){var o;const h=(o=e.window)===null||o===void 0?void 0:o.ResizeObserver;if(!h)return;let w=-1,a=-1;const l=()=>{const d=e.window;if(this._host.isDisposed||!d||d.closed)return;const c=Math.round(t.element.clientWidth),b=Math.round(t.element.clientHeight);c===w&&b===a||(w=c,a=b,c>0&&b>0&&t.layout(c,b),n.updateAllPositions())},u=new h(()=>{var d;const c=(d=e.window)===null||d===void 0?void 0:d.requestAnimationFrame;c?c.call(e.window,l):l()});return u.observe(t.element),{dispose:()=>u.disconnect()}}getPopupService(e){return this._popupServices.get(e)}setPopupService(e,t){this._popupServices.set(e,t)}deletePopupService(e){this._popupServices.delete(e)}scheduleRestoration(e,t,n){return new Promise(o=>{const h=()=>{this._restorationCleanups.delete(h),clearTimeout(w),n==null||n(),o()},w=setTimeout(()=>{if(this._restorationCleanups.delete(h),this._host.isDisposed){o();return}t(),o()},e);this._restorationCleanups.add(h)})}finishRestoration(e){this._restorationPromise=Promise.all(e).then(()=>{})}cancelPendingRestorations(){for(const e of[...this._restorationCleanups])e();this._restorationCleanups.clear()}serialize(){return this._entries.map(e=>{const t=e.gridview.serialize(),n=t.root,o=e.popoutGroup.api.location.type==="popout"?e.popoutGroup.api.location.popoutUrl:void 0,h={gridReferenceGroup:e.referenceGroup,position:e.window.dimensions(),url:o};return n.type==="branch"&&n.data.length===1&&n.data[0].type==="leaf"?Object.assign(Object.assign({},h),{data:n.data[0].data}):Object.assign(Object.assign({},h),{grid:t})})}disposeAll(){for(const e of[...this._entries])e.disposable.dispose()}dispose(){this.cancelPendingRestorations(),this.disposeAll(),this._onDidRemove.dispose()}}const Hv=oi({name:"PopoutWindow",serviceKey:"popoutWindowService",create:p=>new Bv(p)});class Fv{constructor(e){this._watermark=null,this._host=e}update(){if(this._host.hasVisibleGridGroup()){this._unmount();return}if(this._watermark)return;this._watermark=this._host.createWatermarkComponent(),this._watermark.init({containerApi:this._host.api});const e=document.createElement("div");e.className="dv-watermark-container",ug(e,"watermark-component"),e.appendChild(this._watermark.element),this._host.mountElement.appendChild(e)}refresh(){this._unmount(),this.update()}_unmount(){var e,t;this._watermark&&(this._watermark.element.parentElement.remove(),(t=(e=this._watermark).dispose)===null||t===void 0||t.call(e),this._watermark=null)}dispose(){this._unmount()}}const Wv=oi({name:"Watermark",serviceKey:"watermarkService",create:p=>new Fv(p),init:(p,e)=>(e.update(),new Se(ri.any(p.onDidAdd,p.onDidRemove)(()=>{e.update()}),p.onDidViewVisibilityChangeMicroTaskQueue(()=>{e.update()})))});class Vv{constructor(){this._edgeGroups=new Map,this._edgeGroupDisposables=new Map}add(e,t,n){this._edgeGroups.set(e,t),this._edgeGroupDisposables.set(e,n)}remove(e){var t;(t=this._edgeGroupDisposables.get(e))===null||t===void 0||t.dispose(),this._edgeGroupDisposables.delete(e),this._edgeGroups.delete(e)}get(e){return this._edgeGroups.get(e)}has(e){return this._edgeGroups.has(e)}hasAny(){return this._edgeGroups.size>0}entries(){return this._edgeGroups.entries()}includes(e){for(const t of this._edgeGroups.values())if(t===e)return!0;return!1}findPositionOf(e){for(const[t,n]of this._edgeGroups)if(n===e)return t}disposeAll(){for(const e of this._edgeGroupDisposables.values())e.dispose();this._edgeGroupDisposables.clear(),this._edgeGroups.clear()}dispose(){this.disposeAll()}}const jv=oi({name:"EdgeGroup",serviceKey:"edgeGroupService",create:()=>new Vv}),kl={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};class $v{constructor(e){const t=(o,h)=>{const w=it();return w?w.viewId!==e.id?!1:h==="center"?e.isGridEmpty():!0:h==="center"&&!e.isGridEmpty()?!1:e.dispatchUnhandledDragOver(o,h)},n=typeof e.options.dndEdges=="object"&&e.options.dndEdges!==null?e.options.dndEdges:kl;this._html5Target=vs.createDropTarget(e.element,{className:"dv-drop-target-edge",canDisplayOverlay:t,acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:n,getOverrideTarget:()=>e.rootDropTargetOverrideTarget()}),this._pointerTarget=Ki.createDropTarget(e.element,{className:"dv-drop-target-edge",canDisplayOverlay:t,acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:n,getOverrideTarget:()=>e.rootDropTargetOverrideTarget()}),this.onWillShowOverlay=ri.any(this._html5Target.onWillShowOverlay,this._pointerTarget.onWillShowOverlay),this.onDrop=ri.any(this._html5Target.onDrop,this._pointerTarget.onDrop),this.setOptions(e.options)}setOptions(e){if("dndEdges"in e){const t=typeof e.dndEdges=="boolean"&&e.dndEdges===!1;this._html5Target.disabled=t,this._pointerTarget.disabled=t,typeof e.dndEdges=="object"&&e.dndEdges!==null?(this._html5Target.setOverlayModel(e.dndEdges),this._pointerTarget.setOverlayModel(e.dndEdges)):(this._html5Target.setOverlayModel(kl),this._pointerTarget.setOverlayModel(kl))}}dispose(){this._html5Target.dispose(),this._pointerTarget.dispose()}}const Uv=oi({name:"RootDropTarget",serviceKey:"rootDropTargetService",create:p=>new $v(p)}),Kv={left:"createLeftHeaderActionComponent",right:"createRightHeaderActionComponent",prefix:"createPrefixHeaderActionComponent"};class Yv{constructor(e){this._perGroup=new Map,this._host=e}refresh(e){if(!(e!=null&&e.model))return;const t=this._ensureState(e);this._refreshSlot("left",e,t.left),this._refreshSlot("right",e,t.right),this._refreshSlot("prefix",e,t.prefix)}refreshAll(){for(const e of this._host.groups)this.refresh(e)}disposeGroup(e){const t=this._perGroup.get(e);t&&(t.left.dispose(),t.right.dispose(),t.prefix.dispose(),this._perGroup.delete(e))}dispose(){for(const e of[...this._perGroup.keys()])this.disposeGroup(e)}_ensureState(e){let t=this._perGroup.get(e);return t||(t={left:new ft,right:new ft,prefix:new ft},this._perGroup.set(e,t)),t}_refreshSlot(e,t,n){const o=this._host.options[Kv[e]];if(o){const h=o(t);n.value=h,h.init({containerApi:this._host.api,api:t.api,group:t}),t.model.attachHeaderAction(e,h.element)}else n.dispose(),t.model.attachHeaderAction(e,void 0)}}const Xv=oi({name:"HeaderActions",serviceKey:"headerActionsService",create:p=>new Yv(p),init:(p,e)=>new Se(p.onDidRemoveGroup(t=>{e.disposeGroup(t)}))});function qv(p,e){return p==="center"?`Tab into ${e}`:`Split ${p} of ${e}`}function Jv(p,e){return p==="center"?`docked into ${e}`:`split ${p} of ${e}`}const cu={panelOpened:p=>`${p} opened`,panelClosed:p=>`${p} closed`,groupMaximized:p=>`${p} maximized`,groupRestored:p=>`${p} restored`,groupFloated:p=>`${p} floated`,groupDocked:p=>`${p} docked`,groupPoppedOut:p=>`${p} opened in a new window`,movePickTarget:(p,e,t,n)=>`Moving ${p}. Target ${e}, ${t} of ${n}. Enter to choose where, Escape to cancel.`,movePickEdge:(p,e)=>`${qv(p,e)}. Arrows to change, Enter to confirm, Escape to go back.`,moveCommitted:(p,e,t)=>`${p} ${Jv(t,e)}.`,moveCancelled:()=>"Move cancelled.",moveNotAllowed:()=>"That move is not allowed."};function Rp(p){return p?Object.assign(Object.assign({},cu),p):cu}const du=p=>p==="load"||p==="clear";function uu(p){const e=document.createElement("div");return e.className=p==="assertive"?"dv-live-region-assertive":"dv-live-region",e.setAttribute("role",p==="assertive"?"alert":"status"),e.setAttribute("aria-live",p),e.setAttribute("aria-atomic","true"),Object.assign(e.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),e}class Zv extends Se{constructor(e){super(),this._suppressDepth=0,this._locationSubs=new Map,this._host=e,this._polite=uu("polite"),this._assertive=uu("assertive"),e.element.appendChild(this._polite),e.element.appendChild(this._assertive),this.addDisposables({dispose:()=>this._polite.remove()},{dispose:()=>this._assertive.remove()},e.onDidAddPanel(t=>this._announce(t,"open")),e.onDidRemovePanel(t=>this._announce(t,"close")),e.onWillMutateLayout(t=>{du(t.kind)&&this._suppressDepth++}),e.onDidMutateLayout(t=>{du(t.kind)&&(this._suppressDepth=Math.max(0,this._suppressDepth-1))}),e.onDidMaximizedGroupChange(t=>{const n=t.group.activePanel;n&&this._announce(n,t.isMaximized?"maximize":"restore")}),e.onDidAddGroup(t=>this._trackLocation(t)),e.onDidRemoveGroup(t=>{var n;(n=this._locationSubs.get(t.id))===null||n===void 0||n.dispose(),this._locationSubs.delete(t.id)}),{dispose:()=>{this._locationSubs.forEach(t=>t.dispose()),this._locationSubs.clear()}})}_trackLocation(e){let t=e.api.location.type;const n=e.api.onDidLocationChange(o=>{const h=o.location.type;if(h===t)return;t=h;const w=e.activePanel;if(!w)return;const a=h==="floating"?"float":h==="popout"?"popout":"dock";this._announce(w,a)});this._locationSubs.set(e.id,n)}announce(e,t="polite"){if(this._host.options.announcements===!1||this._suppressDepth>0||!e)return;const n=this._host.options.announcer;if(n){n({message:e,politeness:t});return}const o=t==="assertive"?this._assertive:this._polite;o.textContent="",o.textContent=e}_announce(e,t){var n,o;const h=(o=(n=this._host.options).getAnnouncement)===null||o===void 0?void 0:o.call(n,{kind:t,panel:e});h===null||h===""||this.announce(h??this._defaultMessage(e,t))}_defaultMessage(e,t){var n;const o=Rp(this._host.options.messages),h=(n=e.title)!==null&&n!==void 0?n:e.id;switch(t){case"open":return o.panelOpened(h);case"close":return o.panelClosed(h);case"maximize":return o.groupMaximized(h);case"restore":return o.groupRestored(h);case"float":return o.groupFloated(h);case"dock":return o.groupDocked(h);case"popout":return o.groupPoppedOut(h)}}}const Mp=oi({name:"LiveRegion",serviceKey:"liveRegionService",create:p=>new Zv(p)}),Qv=[zv,Hv,Wv,jv,Uv,Xv,Mp];class e_{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const t=this.cache.get(e);if(t&&t.frameId===this.currentFrameId)return t.rect;this.scheduleFrameUpdate();const n=Nl(e);return this.cache.set(e,{rect:n,frameId:this.currentFrameId}),n}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function t_(){const p=document.createElement("div");return p.tabIndex=-1,p}class pu extends Se{constructor(e,t){super(),this.element=e,this.accessor=t,this.map={},this._disposed=!1,this.positionCache=new e_,this.pendingUpdates=new Set,this.addDisposables(Ve.from(()=>{for(const n of Object.values(this.map))n.disposable.dispose(),n.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:t,destroy:n}=this.map[e.api.id];return t.dispose(),n.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:t,referenceContainer:n}=e;if(!this.map[t.api.id]){const c=t_();c.className="dv-render-overlay",c.style.visibility="hidden",this.map[t.api.id]={panel:t,disposable:Ve.NONE,destroy:Ve.NONE,element:c}}const o=this.map[t.api.id].element,h=t.view.content.element;h.parentElement!==o&&o.appendChild(h),o.parentElement!==this.element&&this.element.appendChild(o);const w=()=>{const c=t.api.id;this.pendingUpdates.has(c)||(this.pendingUpdates.add(c),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(c),this.isDisposed||!this.map[c])return;const b=this.positionCache.getPosition(n.element),C=this.positionCache.getPosition(this.element),S=b.left-C.left,y=b.top-C.top,g=b.width,_=b.height;o.style.left=`${S}px`,o.style.top=`${y}px`,o.style.width=`${g}px`,o.style.height=`${_}px`,t.api.isVisible?(o.style.visibility="",o.style.pointerEvents=""):(o.style.visibility="hidden",o.style.pointerEvents="none"),we(o,"dv-render-overlay-float",t.group.api.location.type==="floating")}))},a=()=>{t.api.isVisible?(this.positionCache.invalidate(),w(),o.style.pointerEvents=""):(o.style.visibility="hidden",o.style.pointerEvents="none")},l=new ft,u=()=>{t.api.location.type==="floating"?queueMicrotask(()=>{const c=this.accessor.floatingGroups.find(y=>y.group===t.api.group);if(!c)return;const b=c.overlay.element,C=()=>{const y=Number(b.getAttribute("aria-level"));o.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${y*2+1})`},S=new MutationObserver(()=>{C()});l.value=Ve.from(()=>S.disconnect()),S.observe(b,{attributeFilter:["aria-level"],attributes:!0}),C()}):o.style.zIndex=""},d=new Se(l,new up(o,{onDragEnd:c=>{n.dropTarget.dnd.onDragEnd(c)},onDragEnter:c=>{n.dropTarget.dnd.onDragEnter(c)},onDragLeave:c=>{n.dropTarget.dnd.onDragLeave(c)},onDrop:c=>{n.dropTarget.dnd.onDrop(c)},onDragOver:c=>{n.dropTarget.dnd.onDragOver(c)}}),t.api.onDidVisibilityChange(()=>{a()}),t.api.onDidDimensionsChange(()=>{t.api.isVisible&&w()}),t.api.onDidLocationChange(()=>{u()}));return this.map[t.api.id].destroy=Ve.from(()=>{var c;h.parentElement===o&&o.removeChild(h),(c=o.parentElement)===null||c===void 0||c.removeChild(o)}),u(),queueMicrotask(()=>{this.isDisposed||a()}),this.map[t.api.id].disposable.dispose(),this.map[t.api.id].disposable=d,this.map[t.api.id].resize=w,o}}function i_(p,e,t,n){function o(h){return h instanceof t?h:new t(function(w){w(h)})}return new(t||(t=Promise))(function(h,w){function a(d){try{u(n.next(d))}catch(c){w(c)}}function l(d){try{u(n.throw(d))}catch(c){w(c)}}function u(d){d.done?h(d.value):o(d.value).then(a,l)}u((n=n.apply(p,[])).next())})}function s_(p){let e;try{e=new URL(p,window.location.href)}catch{throw new Error(`dockview: invalid popout URL: ${p}`)}if(!(e.protocol==="http:"||e.protocol==="https:")||e.origin!==window.location.origin)throw new Error(`dockview: popout URL must be same-origin http(s); got: ${p}`)}class n_ extends Se{get window(){var e,t;return(t=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:null}constructor(e,t,n){super(),this.target=e,this.className=t,this.options=n,this._onWillClose=new Q,this.onWillClose=this._onWillClose.event,this._onDidClose=new Q,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,t=this._window.value.screenY,n=this._window.value.innerWidth,o=this._window.value.innerHeight;return{top:t,left:e,width:n,height:o}}close(){var e,t;this._window&&(this._onWillClose.fire(),(t=(e=this.options).onWillClose)===null||t===void 0||t.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){return i_(this,void 0,void 0,function*(){var e,t;if(this._window)throw new Error("instance of popout window is already open");const n=`${this.options.url}`;s_(n);const o=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([l,u])=>`${l}=${u}`).join(","),h=window.open(n,this.target,o);if(!h)return null;const w=new Se;this._window={value:h,disposable:w},w.addDisposables(Ve.from(()=>{h.close()}),be(window,"beforeunload",()=>{this.close()}));const a=this.createPopoutWindowContainer();return this.className&&a.classList.add(this.className),(t=(e=this.options).onDidOpen)===null||t===void 0||t.call(e,{id:this.target,window:h}),new Promise((l,u)=>{h.addEventListener("unload",d=>{}),h.addEventListener("load",()=>{try{const d=h.document;d.title=document.title,d.body.appendChild(a),cg(d,window.document.styleSheets,{nonce:this.options.nonce}),be(h,"beforeunload",()=>{this.close()}),l(a)}catch(d){u(d)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class r_ extends Se{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,t=new Set;this.addDisposables(this.accessor.onDidAddPanel(n=>{if(e.has(n.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${n.api.id} but panel already exists`);e.add(n.api.id)}),this.accessor.onDidRemovePanel(n=>{if(e.has(n.api.id))e.delete(n.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${n.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(n=>{if(t.has(n.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${n.api.id} but group already exists`);t.add(n.api.id)}),this.accessor.onDidRemoveGroup(n=>{if(t.has(n.api.id))t.delete(n.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${n.api.id} but group does not exists`)}))}}function o_(p){if(!p.matchMedia)return!1;const e=p.matchMedia("(pointer: coarse)").matches,t=p.matchMedia("(pointer: fine)").matches;return e&&!t}class fu extends Se{constructor(e,t=window){super(),this._active=null,this._activeDisposable=new ft,this._root=e,this._window=t,this._element=t.document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this._root.prepend(this._element),this.addDisposables(Ve.from(()=>{this.close()}),this._activeDisposable)}updateRoot(e){e.prepend(this._element),this._root=e}openPopover(e,t){var n;this.close();const o=this._window.document.createElement("div");o.style.position="absolute",o.style.zIndex=(n=t.zIndex)!==null&&n!==void 0?n:"var(--dv-overlay-z-index)",o.appendChild(e);const h=this._element.getBoundingClientRect(),w=h.left,a=h.top;o.style.top=`${t.y-a}px`,o.style.left=`${t.x-w}px`,this._element.appendChild(o),this._active=o;const l=Date.now(),u=200;this._activeDisposable.value=new Se(be(this._window,"pointerdown",d=>{var c;if(Date.now()-l<u)return;const b=d.target;if(!(b instanceof HTMLElement))return;let C=b;for(;C&&C!==o;)C=(c=C==null?void 0:C.parentElement)!==null&&c!==void 0?c:null;C||this.close()}),be(this._window,"keydown",d=>{(d.key==="Escape"||d.key==="Enter")&&this.close()}),be(this._window,"resize",()=>{o_(this._window)||this.close()})),this._window.requestAnimationFrame(()=>{vg(o,this._root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class mu extends Se{get disabled(){return this._disabled}set disabled(e){var t;this.disabled!==e&&(this._disabled=e,e&&((t=this.model)===null||t===void 0||t.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,t)=>{const n=this._outline!==t;if(this._outline=t,this._model)return this._model.changed=n,this._model;const o=this.createContainer(),h=this.createAnchor();if(this._model={root:o,overlay:h,changed:n},o.appendChild(h),this.element.appendChild(o),(e==null?void 0:e.target)instanceof HTMLElement){const w=e.target.getBoundingClientRect(),a=this.element.getBoundingClientRect();h.style.left=`${w.left-a.left}px`,h.style.top=`${w.top-a.top}px`}return this._model}}}constructor(e,t){super(),this.element=e,this._disabled=!1,this._disabled=t.disabled,this.addDisposables(Ve.from(()=>{var n;(n=this.model)===null||n===void 0||n.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}class a_{get minimumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMinimumSize}get maximumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMaximumSize}get element(){return this._group.element}get isCollapsed(){return this._isCollapsed}get lastExpandedSize(){return this._lastExpandedSize}get collapsedSize(){return this._collapsedSize}constructor(e,t,n){var o,h,w;this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.snap=!1,this.priority=ht.Low,this._isCollapsed=!1,this._group=t,this._orientation=n,t.element.classList.add("dv-edge-group"),t.element.dataset.testid=`dv-edge-group-${e.id}`,this._collapsedSize=(o=e.collapsedSize)!==null&&o!==void 0?o:35,this._expandedMaximumSize=(h=e.maximumSize)!==null&&h!==void 0?h:Number.POSITIVE_INFINITY,this._expandedMinimumSize=e.minimumSize!==void 0?e.minimumSize:this._collapsedSize+50,this._lastExpandedSize=(w=e.initialSize)!==null&&w!==void 0?w:200,e.collapsed&&(this._isCollapsed=!0,t.element.classList.add("dv-edge-collapsed"))}layout(e,t){this._isCollapsed||(this._lastExpandedSize=e),this._orientation==="horizontal"?this._group.layout(e,t):this._group.layout(t,e)}setCollapsed(e){this._isCollapsed!==e&&(this._isCollapsed=e,this._group.element.classList.toggle("dv-edge-collapsed",e))}setVisible(e){}restoreExpandedSize(e){this._lastExpandedSize=e}updateCollapsedSize(e,t){this._collapsedSize=e,this._expandedMinimumSize=t}dispose(){this._onDidChange.dispose()}}class l_{get element(){return this._dockviewElement}constructor(e,t){this._dockviewElement=e,this._layoutDockview=t,this.priority=ht.High,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event}layout(e,t){this._layoutDockview(t,e)}setVisible(e){}dispose(){this._onDidChange.dispose()}}class h_{get element(){return this._element}constructor(e,t=0){this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this.priority=ht.High,this._element=document.createElement("div"),this._element.className="dv-shell-middle-column",this._element.style.height="100%",this._element.style.width="100%",this._splitview=new Ns(this._element,{orientation:Pe.VERTICAL,proportionalLayout:!1,margin:t}),this._centerIndex=0,this._splitview.addView(e,{type:"distribute"},0)}addTopView(e,t){this._splitview.addView(e,t,0),this._topIndex=0,this._centerIndex+=1,this._bottomIndex!==void 0&&(this._bottomIndex+=1)}addBottomView(e,t){const n=this._splitview.length;this._splitview.addView(e,t,n),this._bottomIndex=n}removeView(e){const t=e==="top"?this._topIndex:this._bottomIndex;t!==void 0&&(this._splitview.removeView(t),e==="top"?(this._topIndex=void 0,this._centerIndex-=1,this._bottomIndex!==void 0&&(this._bottomIndex-=1)):this._bottomIndex=void 0)}layout(e,t){this._splitview.layout(t,e)}setVisible(e){}setViewVisible(e,t){const n=e==="top"?this._topIndex:this._bottomIndex;n!==void 0&&this._splitview.setViewVisible(n,t)}isViewVisible(e){const t=e==="top"?this._topIndex:this._bottomIndex;return t!==void 0?this._splitview.isViewVisible(t):!1}getViewSize(e){const t=e==="top"?this._topIndex:this._bottomIndex;return t!==void 0?this._splitview.getViewSize(t):0}resizeView(e,t){const n=e==="top"?this._topIndex:this._bottomIndex;n!==void 0&&this._splitview.resizeView(n,t)}updateMargin(e){this._splitview.margin=e}dispose(){this._onDidChange.dispose(),this._splitview.dispose()}}function c_(p,e,t){var n;const o=((n=p.collapsedSize)!==null&&n!==void 0?n:e)+t,h=Object.assign(Object.assign({},p),{collapsedSize:o});return p.minimumSize!==void 0&&(h.minimumSize=p.minimumSize+t),h}class d_{constructor(e,t,n,o=0,h=35){this._disposables=new Se,this._viewConfigs=new Map,this._currentWidth=0,this._currentHeight=0,this._gap=o,this._defaultCollapsedSize=h,this._shellElement=document.createElement("div"),this._shellElement.className="dv-shell",this._shellElement.style.height="100%",this._shellElement.style.width="100%",this._shellElement.style.position="relative",e.appendChild(this._shellElement);const w=new l_(t,n);this._middleColumn=new h_(w,o),this._outerSplitview=new Ns(this._shellElement,{orientation:Pe.HORIZONTAL,proportionalLayout:!1,margin:o}),this._middleIndex=0,this._outerSplitview.addView(this._middleColumn,{type:"distribute"},0),this._disposables.addDisposables(cr(this._shellElement,a=>{const l=Math.round(a.contentRect.width),u=Math.round(a.contentRect.height);l===this._currentWidth&&u===this._currentHeight||(this._currentWidth=l,this._currentHeight=u,this.layout(l,u))}),this._outerSplitview,this._middleColumn,w)}get element(){return this._shellElement}addEdgeView(e,t,n){if(this.hasEdgeGroup(e))throw new Error(`dockview: edge group already registered at position '${e}'`);this._viewConfigs.set(e,t);const o=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),h=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),w=o>1?this._gap*(o-1)/o:0,a=h>1?this._gap*(h-1)/h:0,l=e==="left"||e==="right",u=l?w:a,d=l?"horizontal":"vertical",c=new a_(c_(Object.assign({collapsedSize:this._defaultCollapsedSize},t),this._defaultCollapsedSize,u),n,d),b=c.isCollapsed?c.collapsedSize:c.lastExpandedSize;switch(e){case"left":this._outerSplitview.addView(c,b,0),this._leftIndex=0,this._middleIndex+=1,this._rightIndex!==void 0&&(this._rightIndex+=1),this._leftView=c;break;case"right":{const C=this._outerSplitview.length;this._outerSplitview.addView(c,b,C),this._rightIndex=C,this._rightView=c}break;case"top":this._middleColumn.addTopView(c,b),this._topView=c;break;case"bottom":this._middleColumn.addBottomView(c,b),this._bottomView=c;break}return this._disposables.addDisposables(c),this.updateTheme(this._gap,this._defaultCollapsedSize),c}layout(e,t){this._outerSplitview.layout(e,t)}updateTheme(e,t){var n,o,h,w;this._gap=e,this._defaultCollapsedSize=t;const a=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),l=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),u=a>1?e*(a-1)/a:0,d=l>1?e*(l-1)/l:0;this._outerSplitview.margin=e,this._middleColumn.updateMargin(e);const c=(g,_,m)=>{var v;const P=((v=_.collapsedSize)!==null&&v!==void 0?v:t)+m,T=_.minimumSize,A=T!==void 0?T+m:P+50;g.updateCollapsedSize(P,A)},b=this._viewConfigs.get("top");this._topView&&b&&c(this._topView,b,d);const C=this._viewConfigs.get("bottom");this._bottomView&&C&&c(this._bottomView,C,d);const S=this._viewConfigs.get("left");this._leftView&&S&&c(this._leftView,S,u);const y=this._viewConfigs.get("right");this._rightView&&y&&c(this._rightView,y,u),!((n=this._leftView)===null||n===void 0)&&n.isCollapsed&&this._leftIndex!==void 0&&this._outerSplitview.resizeView(this._leftIndex,this._leftView.collapsedSize),!((o=this._rightView)===null||o===void 0)&&o.isCollapsed&&this._rightIndex!==void 0&&this._outerSplitview.resizeView(this._rightIndex,this._rightView.collapsedSize),!((h=this._topView)===null||h===void 0)&&h.isCollapsed&&this._middleColumn.resizeView("top",this._topView.collapsedSize),!((w=this._bottomView)===null||w===void 0)&&w.isCollapsed&&this._middleColumn.resizeView("bottom",this._bottomView.collapsedSize),this._currentWidth>0&&this._currentHeight>0&&this.layout(this._currentWidth,this._currentHeight)}removeEdgeView(e){const t=this._getView(e);if(t){switch(e){case"left":this._outerSplitview.removeView(this._leftIndex),this._leftIndex=void 0,this._leftView=void 0,this._middleIndex-=1,this._rightIndex!==void 0&&(this._rightIndex-=1);break;case"right":this._outerSplitview.removeView(this._rightIndex),this._rightIndex=void 0,this._rightView=void 0;break;case"top":this._middleColumn.removeView("top"),this._topView=void 0;break;case"bottom":this._middleColumn.removeView("bottom"),this._bottomView=void 0;break}this._disposables.removeDisposable(t),t.dispose(),this._viewConfigs.delete(e),this.updateTheme(this._gap,this._defaultCollapsedSize)}}hasEdgeGroup(e){switch(e){case"top":return this._topView!==void 0;case"bottom":return this._bottomView!==void 0;case"left":return this._leftView!==void 0;case"right":return this._rightView!==void 0}}setEdgeGroupVisible(e,t){switch(e){case"left":this._leftIndex!==void 0&&this._outerSplitview.setViewVisible(this._leftIndex,t);break;case"right":this._rightIndex!==void 0&&this._outerSplitview.setViewVisible(this._rightIndex,t);break;case"top":case"bottom":this._middleColumn.setViewVisible(e,t);break}}isEdgeGroupVisible(e){switch(e){case"left":return this._leftIndex!==void 0?this._outerSplitview.isViewVisible(this._leftIndex):!1;case"right":return this._rightIndex!==void 0?this._outerSplitview.isViewVisible(this._rightIndex):!1;case"top":case"bottom":return this._middleColumn.isViewVisible(e)}}setEdgeGroupCollapsed(e,t){const n=this._getView(e);if(!n)return;n.setCollapsed(t);const o=t?n.collapsedSize:n.lastExpandedSize;switch(e){case"left":this._leftIndex!==void 0&&this._outerSplitview.resizeView(this._leftIndex,o);break;case"right":this._rightIndex!==void 0&&this._outerSplitview.resizeView(this._rightIndex,o);break;case"top":case"bottom":this._middleColumn.resizeView(e,o);break}}isEdgeGroupCollapsed(e){var t,n;return(n=(t=this._getView(e))===null||t===void 0?void 0:t.isCollapsed)!==null&&n!==void 0?n:!1}_getView(e){switch(e){case"top":return this._topView;case"bottom":return this._bottomView;case"left":return this._leftView;case"right":return this._rightView}}toJSON(){const e={};return this._leftView&&this._leftIndex!==void 0&&(e.left={size:this._leftView.isCollapsed?this._leftView.lastExpandedSize:this._outerSplitview.getViewSize(this._leftIndex),visible:this._outerSplitview.isViewVisible(this._leftIndex),collapsed:this._leftView.isCollapsed||void 0}),this._rightView&&this._rightIndex!==void 0&&(e.right={size:this._rightView.isCollapsed?this._rightView.lastExpandedSize:this._outerSplitview.getViewSize(this._rightIndex),visible:this._outerSplitview.isViewVisible(this._rightIndex),collapsed:this._rightView.isCollapsed||void 0}),this._topView&&(e.top={size:this._topView.isCollapsed?this._topView.lastExpandedSize:this._middleColumn.getViewSize("top"),visible:this._middleColumn.isViewVisible("top"),collapsed:this._topView.isCollapsed||void 0}),this._bottomView&&(e.bottom={size:this._bottomView.isCollapsed?this._bottomView.lastExpandedSize:this._middleColumn.getViewSize("bottom"),visible:this._middleColumn.isViewVisible("bottom"),collapsed:this._bottomView.isCollapsed||void 0}),e}fromJSON(e){var t,n,o,h,w,a,l,u,d,c,b,C,S,y,g,_,m,v,D,P;e.left&&this._leftIndex!==void 0&&((t=this._leftView)===null||t===void 0||t.restoreExpandedSize(e.left.size),(n=this._leftView)===null||n===void 0||n.setCollapsed((o=e.left.collapsed)!==null&&o!==void 0?o:!1),this._outerSplitview.resizeView(this._leftIndex,e.left.collapsed&&(w=(h=this._leftView)===null||h===void 0?void 0:h.collapsedSize)!==null&&w!==void 0?w:e.left.size),e.left.visible||this._outerSplitview.setViewVisible(this._leftIndex,!1)),e.right&&this._rightIndex!==void 0&&((a=this._rightView)===null||a===void 0||a.restoreExpandedSize(e.right.size),(l=this._rightView)===null||l===void 0||l.setCollapsed((u=e.right.collapsed)!==null&&u!==void 0?u:!1),this._outerSplitview.resizeView(this._rightIndex,e.right.collapsed&&(c=(d=this._rightView)===null||d===void 0?void 0:d.collapsedSize)!==null&&c!==void 0?c:e.right.size),e.right.visible||this._outerSplitview.setViewVisible(this._rightIndex,!1)),e.top&&((b=this._topView)===null||b===void 0||b.restoreExpandedSize(e.top.size),(C=this._topView)===null||C===void 0||C.setCollapsed((S=e.top.collapsed)!==null&&S!==void 0?S:!1),this._middleColumn.resizeView("top",e.top.collapsed&&(g=(y=this._topView)===null||y===void 0?void 0:y.collapsedSize)!==null&&g!==void 0?g:e.top.size),e.top.visible||this._middleColumn.setViewVisible("top",!1)),e.bottom&&((_=this._bottomView)===null||_===void 0||_.restoreExpandedSize(e.bottom.size),(m=this._bottomView)===null||m===void 0||m.setCollapsed((v=e.bottom.collapsed)!==null&&v!==void 0?v:!1),this._middleColumn.resizeView("bottom",e.bottom.collapsed&&(P=(D=this._bottomView)===null||D===void 0?void 0:D.collapsedSize)!==null&&P!==void 0?P:e.bottom.size),e.bottom.visible||this._middleColumn.setViewVisible("bottom",!1))}dispose(){var e;this._disposables.dispose(),(e=this._shellElement.parentElement)===null||e===void 0||e.removeChild(this._shellElement)}}function u_(p){var e;const t=(e=p.tabGroupColors)!==null&&e!==void 0?e:lh,n=p.tabGroupAccent!=="off";return new Cp(t,n)}function xo(p){const e=p.from.activePanel;[...p.from.panels].map(n=>{const o=p.from.model.removePanel(n);return p.from.model.renderContainer.detatch(n),o}).forEach(n=>{p.to.model.openPanel(n,{skipSetActive:e!==n,skipSetGroupActive:!0})})}let gu=!1;function p_(){typeof process<"u"&&rg||gu||Mv()||(gu=!0,console.warn('dockview: do not use "dockview-core" directly — it is an internal package. Use the "dockview" package, the JavaScript version of dockview, instead. This notice is shown once.'))}class f_ extends hp{fireDidCreateTabGroup(e){this._onDidCreateTabGroup.fire(e)}fireDidDestroyTabGroup(e){this._onDidDestroyTabGroup.fire(e)}fireDidAddPanelToTabGroup(e){this._onDidAddPanelToTabGroup.fire(e)}fireDidRemovePanelFromTabGroup(e){this._onDidRemovePanelFromTabGroup.fire(e)}fireDidTabGroupChange(e){this._onDidTabGroupChange.fire(e)}fireDidTabGroupCollapsedChange(e){this._onDidTabGroupCollapsedChange.fire(e)}get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get tabGroupColorPalette(){return this._tabGroupColorPalette}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get defaultHeaderPosition(){var e;return(e=this.options.defaultHeaderPosition)!==null&&e!==void 0?e:"top"}get api(){return this._api}get floatingGroups(){var e,t,n;return(n=(t=(e=this._moduleRegistry)===null||e===void 0?void 0:e.services.floatingGroupService)===null||t===void 0?void 0:t.floatingGroups)!==null&&n!==void 0?n:[]}_gatherFloatingGroupBoxes(e){var t;const o=((t=this._floatingOverlayHost)!==null&&t!==void 0?t:this.gridview.element).getBoundingClientRect();return this.floatingGroups.filter(h=>h.group!==e).map(h=>{const w=h.overlay.element.getBoundingClientRect();return{left:w.left-o.left,top:w.top-o.top,width:w.width,height:w.height}})}get _floatingGroupService(){return this._moduleRegistry.services.floatingGroupService}get _popoutWindowService(){return this._moduleRegistry.services.popoutWindowService}get _watermarkService(){return this._moduleRegistry.services.watermarkService}get _edgeGroupService(){return this._moduleRegistry.services.edgeGroupService}get _rootDropTargetService(){return this._moduleRegistry.services.rootDropTargetService}get _advancedDnDService(){return this._moduleRegistry.services.advancedDnDService}get headerActionsService(){return this._moduleRegistry.services.headerActionsService}isGridEmpty(){return this.gridview.length===0}rootDropTargetOverrideTarget(){var e;return(e=this.rootDropTargetContainer)===null||e===void 0?void 0:e.model}dispatchUnhandledDragOver(e,t){const n=new Pp(e,"edge",t,it);return this._onUnhandledDragOver.fire(n),n.isAccepted}fireWillDragPanel(e){this._onWillDragPanel.fire(e)}fireWillDragGroup(e){this._onWillDragGroup.fire(e)}fireWillDrop(e){this._onWillDrop.fire(e)}fireWillShowOverlay(e){this._onWillShowOverlay.fire(e)}buildGroupDragGhost(e){var t;return(t=this._advancedDnDService)===null||t===void 0?void 0:t.buildGroupDragGhost(e)}resolveDropOverlayModel(e,t){var n;return(n=this._advancedDnDService)===null||n===void 0?void 0:n.resolveOverlayModel(e,t)}get rootElement(){var e,t;return(t=(e=this._shellManager)===null||e===void 0?void 0:e.element)!==null&&t!==void 0?t:this.element}adjacentGroup(e,t){var n;if(e.api.location.type!=="grid")return;const o=Je(e.element);return(n=t?this.gridview.previous(o):this.gridview.next(o))===null||n===void 0?void 0:n.view}adjacentGroupInDirection(e,t){if(e.api.location.type!=="grid")return;const n=e.element.getBoundingClientRect(),o=n.left+n.width/2,h=n.top+n.height/2;let w,a=Number.POSITIVE_INFINITY;for(const l of this.groups){if(l===e||l.api.location.type!=="grid")continue;const u=l.element.getBoundingClientRect(),d=u.left+u.width/2-o,c=u.top+u.height/2-h;if(!(t==="left"?d<0&&Math.abs(d)>=Math.abs(c):t==="right"?d>0&&Math.abs(d)>=Math.abs(c):t==="up"?c<0&&Math.abs(c)>=Math.abs(d):c>0&&Math.abs(c)>=Math.abs(d)))continue;const C=d*d+c*c;C<a&&(a=C,w=l)}return w}showDropPreview(e,t){var n,o;return(o=(n=this._advancedDnDService)===null||n===void 0?void 0:n.showPreviewOverlay(e,t))!==null&&o!==void 0?o:Ve.NONE}announce(e){var t;(t=this._moduleRegistry.services.liveRegionService)===null||t===void 0||t.announce(e)}dockPanel(e,t,n){this.moveGroupOrPanel({from:{groupId:e.group.id,panelId:e.id},to:{group:t,position:n}})}get contextMenuService(){return this._moduleRegistry.services.contextMenuService}get mountElement(){return this.gridview.element}hasVisibleGridGroup(){return this.groups.some(e=>e.api.location.type==="grid"&&e.api.isVisible)}fireLayoutChange(){this._bufferOnDidLayoutChange.fire()}get popoutRestorationPromise(){var e,t;return(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.restorationPromise)!==null&&t!==void 0?t:Promise.resolve()}constructor(e,t){var n,o,h,w,a;super(e,{proportionalLayout:!0,orientation:Pe.HORIZONTAL,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,locked:t.locked,margin:(o=(n=t.theme)===null||n===void 0?void 0:n.gap)!==null&&o!==void 0?o:0,className:t.className}),this.nextGroupId=sh(),this._deserializer=new Ev(this),this._moduleRegistry=new Av,this._onWillDragPanel=new Q,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new Q,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new Q,this.onWillDrop=this._onWillDrop.event,this._mutationDepth=0,this._origin="user",this._originDepth=0,this._onWillMutateLayout=new Q,this.onWillMutateLayout=this._onWillMutateLayout.event,this._onDidMutateLayout=new Q,this.onDidMutateLayout=this._onDidMutateLayout.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this._onDidRemovePanel=new Q,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new Q,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new Q,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new Q,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidAddPopoutGroup=new Q,this.onDidAddPopoutGroup=this._onDidAddPopoutGroup.event,this._onDidRemovePopoutGroup=new Q,this.onDidRemovePopoutGroup=this._onDidRemovePopoutGroup.event,this._onDidOpenPopoutWindowFail=new Q,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new Q({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new Q,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidCreateTabGroup=new Q,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new Q,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new Q,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new Q,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new Q,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new Q,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,this._onDidMaximizedGroupChange=new Q,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._inShellLayout=!1,this._onDidRemoveGroup=new Q,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new Q,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new Q,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=t,this._tabGroupColorPalette=u_(t);const l=t.modules,u=l??[...Qv,...Lv()];for(const b of u)this._moduleRegistry.register(b);this._moduleRegistry.initialize(this);const d=this._popoutWindowService;d&&this.addDisposables(d.onDidRemove(b=>{this._onDidRemovePopoutGroup.fire({id:b.popoutGroup.id,group:b.popoutGroup,window:b.getWindow()})})),p_(),this.popupService=new fu(this.element),this._api=new rh(this),this.disableResizing=!0,e.removeChild(this.element),this._shellManager=new d_(e,this.element,(b,C)=>this._layoutFromShell(b,C),(w=(h=t.theme)===null||h===void 0?void 0:h.gap)!==null&&w!==void 0?w:0,(a=t.theme)===null||a===void 0?void 0:a.edgeGroupCollapsedSize),this.popupService.updateRoot(this._shellManager.element),this._shellThemeClassnames=new Oo(this._shellManager.element),this.rootDropTargetContainer=new mu(this._shellManager.element,{disabled:!0}),this.overlayRenderContainer=new pu(this._shellManager.element,this),this._floatingOverlayHost=document.createElement("div"),this._floatingOverlayHost.className="dv-floating-overlay-host",this._shellManager.element.appendChild(this._floatingOverlayHost),we(this.gridview.element,"dv-dockview",!0),we(this.element,"dv-debug",!!t.debug),this.updateTheme(),t.debug&&this.addDisposables(new r_(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onWillMutateLayout,this._onDidMutateLayout,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOver,this._onDidMaximizedGroupChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidAddPopoutGroup,this._onDidRemovePopoutGroup,this._onDidOpenPopoutWindowFail,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,ri.any(this.onDidPopoutGroupSizeChange,this.onDidPopoutGroupPositionChange,this.onDidCreateTabGroup,this.onDidDestroyTabGroup,this.onDidAddPanelToTabGroup,this.onDidRemovePanelFromTabGroup,this.onDidTabGroupChange,this.onDidTabGroupCollapsedChange)(()=>{this.fireLayoutChange()}),this._onDidOptionsChange,this.onDidAdd(b=>{this._moving||this._onDidAddGroup.fire(b)}),this.onDidRemove(b=>{this._moving||this._onDidRemoveGroup.fire(b)}),this.onDidActiveChange(b=>{this._moving||this._onDidActiveGroupChange.fire(b)}),this.onDidMaximizedChange(b=>{this._onDidMaximizedGroupChange.fire({group:b.panel,isMaximized:b.isMaximized})}),ri.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidRemoveGroup,this.onDidMovePanel,this.onDidActivePanelChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Ve.from(()=>{var b;this._moduleRegistry.dispose(),(b=this._shellManager)===null||b===void 0||b.dispose()}));const c=this._rootDropTargetService;c&&this.addDisposables(c.onWillShowOverlay(b=>{this.gridview.length>0&&b.position==="center"||this._onWillShowOverlay.fire(new hr(b,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:it}))}),c.onDrop(b=>{var C;const S=new Tp({nativeEvent:b.nativeEvent,position:b.position,panel:void 0,api:this._api,group:void 0,getData:it,kind:"edge"});if(this._onWillDrop.fire(S),S.defaultPrevented)return;const y=it();y?this.moveGroupOrPanel({from:{groupId:y.groupId,panelId:(C=y.panelId)!==null&&C!==void 0?C:void 0},to:{group:this.orthogonalize(b.position),position:"center"}}):this._onDidDrop.fire(new dh({nativeEvent:b.nativeEvent,position:b.position,panel:void 0,api:this._api,group:void 0,getData:it}))})),this._moduleRegistry.postConstruct(this)}setVisible(e,t){switch(e.api.location.type){case"grid":super.setVisible(e,t);break;case"floating":{const n=this.floatingGroups.find(o=>o.group===e);n&&(n.overlay.setVisible(t),e.api._onDidVisibilityChange.fire({isVisible:t}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}getPopupServiceForGroup(e){var t,n;return(n=(t=this._popoutWindowService)===null||t===void 0?void 0:t.getPopupService(e.id))!==null&&n!==void 0?n:this.popupService}addPopoutGroup(e,t){return this.mutation("popout",()=>this._doAddPopoutGroup(e,t))}getPopouts(){var e,t;return(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.entries.map(n=>({id:n.popoutGroup.id,group:n.popoutGroup,window:n.getWindow()})))!==null&&t!==void 0?t:[]}_doAddPopoutGroup(e,t){var n,o,h,w,a;const l=Gs(this._popoutWindowService,"PopoutWindow","api.addPopoutGroup");if(!l||e instanceof So&&e.model.location.type==="edge")return Promise.resolve(!1);if(e instanceof pn&&e.group.size===1)return this.addPopoutGroup(e.group,t);const u=fg(this.gridview.element),d=this.element;function c(){return t!=null&&t.position?t.position:e instanceof So?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():d.getBoundingClientRect()}const b=c(),C=(o=(n=t==null?void 0:t.overridePopoutGroup)===null||n===void 0?void 0:n.id)!==null&&o!==void 0?o:this.getNextGroupId(),S=(h=t==null?void 0:t.popoutUrl)!==null&&h!==void 0?h:(w=this.options)===null||w===void 0?void 0:w.popoutUrl,y=new n_(`${this.id}-${C}`,u??"",{url:S??"/popout.html",left:window.screenX+b.left,top:window.screenY+b.top,width:b.width,height:b.height,onDidOpen:t==null?void 0:t.onDidOpen,onWillClose:t==null?void 0:t.onWillClose,nonce:(a=this.options)===null||a===void 0?void 0:a.nonce}),g=new Se(y,y.onDidClose(()=>{g.dispose()}));return y.open().then(_=>{var m,v,D;if(y.isDisposed)return!1;const P=t!=null&&t.referenceGroup?t.referenceGroup:e instanceof pn?e.group:e,T=e.api.location.type,A=P.element.parentElement!==null;let E;if(t!=null&&t.overridePopoutGridview?E=(m=t.overridePopoutGroup)!==null&&m!==void 0?m:P:A?t!=null&&t.overridePopoutGroup?E=t.overridePopoutGroup:(E=this.createGroup({id:C}),_&&this._onDidAddGroup.fire(E)):E=P,_===null)return this.handleBlockedPopout({group:E,referenceGroup:P,options:t,popoutWindowDisposable:g}),!1;const I=document.createElement("div");I.className="dv-overlay-render-container";const z=new pu(I,this);E.model.renderContainer=z;const H=(v=t==null?void 0:t.overridePopoutGridview)!==null&&v!==void 0?v:this.createNestedGridview();t!=null&&t.overridePopoutGridview||H.addView(E,Wt.Distribute,[0]),H.element.style.width="100%",H.element.style.height="100%",H.layout(y.window.innerWidth,y.window.innerHeight);let V=!1;const F=()=>{V||(V=!0,H.dispose())};let q;if(!(t!=null&&t.overridePopoutGroup)&&!(t!=null&&t.overridePopoutGridview)&&A)if(e instanceof pn)this.movingLock(()=>{const X=P.model.removePanel(e);E.model.openPanel(X)});else switch(this.movingLock(()=>xo({from:P,to:E})),T){case"grid":P.api.setVisible(!1);break;case"floating":case"popout":q=(D=this.floatingGroups.find(X=>X.group.api.id===e.api.id))===null||D===void 0?void 0:D.overlay.toJSON(),this.removeGroup(P);break}_.classList.add("dv-dockview"),_.style.overflow="hidden",_.appendChild(I),_.appendChild(H.element);const W=document.createElement("div"),K=new mu(W,{disabled:this.rootDropTargetContainer.disabled});_.appendChild(W),E.model.dropTargetContainer=K;const ie=new fu(_,y.window);if(l.setPopupService(E.id,ie),g.addDisposables(ie,Ve.from(()=>{l.deletePopupService(E.id)})),E.model.location={type:"popout",getWindow:()=>y.window,popoutUrl:S},t!=null&&t.overridePopoutGridview){const X=this.groups.filter(oe=>H.element.contains(oe.element));for(const oe of X)oe.model.renderContainer=z,oe.model.dropTargetContainer=K,oe.model.location={type:"popout",getWindow:()=>y.window,popoutUrl:S}}A&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(E);const J=l.observeGridviewSize(y,H,z);J&&g.addDisposables(J),g.addDisposables(E.api.onDidActiveChange(X=>{var oe;X.isActive&&((oe=y.window)===null||oe===void 0||oe.focus())}),E.api.onWillFocus(()=>{var X;(X=y.window)===null||X===void 0||X.focus()}));const L={},B=A&&P&&this.getPanel(P.id),R={window:y,popoutGroup:E,gridview:H,overlayRenderContainer:z,dropTargetContainer:K,getWindow:()=>y.window,popoutUrl:S,referenceGroup:B?P.id:void 0,disposable:{dispose:()=>(g.dispose(),L.returnedGroup)}},G=mg(y.window);return g.addDisposables(G,gg(y.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:y.window.innerWidth,height:y.window.innerHeight,group:E})}),G.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:y.window.screenX,screenY:y.window.screenX,group:E})}),be(y.window,"resize",()=>{H.layout(y.window.innerWidth,y.window.innerHeight)}),z,Ve.from(()=>this.disposePopoutWindow({group:E,referenceGroup:P,popoutGridview:H,isGroupAddedToDom:A,floatingBox:q,disposePopoutGridview:F,closeResult:L}))),l.add(R),this._onDidAddPopoutGroup.fire({id:R.popoutGroup.id,group:R.popoutGroup,window:R.getWindow()}),!0}).catch(_=>(console.error("dockview: failed to create popout.",_),!1))}handleBlockedPopout(e){const{group:t,referenceGroup:n,options:o,popoutWindowDisposable:h}=e;if(console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),h.dispose(),this._onDidOpenPopoutWindowFail.fire(),o!=null&&o.overridePopoutGridview){const w=o.overridePopoutGridview,a=this.groups.filter(l=>w.element.contains(l.element));for(const l of a)this.movingLock(()=>{w.remove(l),this.redockGroupToMainGrid(l)});w.dispose(),n&&!n.api.isVisible&&n.api.setVisible(!0);return}t===n?this.gridview.element.contains(t.element)||(this.movingLock(()=>this.doAddGroup(t,[0])),t.model.location={type:"grid"}):(this.movingLock(()=>xo({from:t,to:n})),t.model.size===0&&this._groups.has(t.id)&&(t.dispose(),this._groups.delete(t.id),this._onDidRemoveGroup.fire(t))),n.api.isVisible||n.api.setVisible(!0)}redockGroupToMainGrid(e){e.model.renderContainer=this.overlayRenderContainer,e.model.dropTargetContainer=this.rootDropTargetContainer,e.model.location={type:"grid"},this.doAddGroup(e,[0])}disposePopoutWindow(e){var t;const{group:n,referenceGroup:o,popoutGridview:h,isGroupAddedToDom:w,floatingBox:a,disposePopoutGridview:l,closeResult:u}=e;if(this.isDisposed){l();return}const d=!!(!((t=this._popoutWindowService)===null||t===void 0)&&t.entries.find(S=>S.gridview===h)),c=this.groups.filter(S=>h.element.contains(S.element)),b=c.includes(n),C=b&&c.length===1;if(d)for(const S of c)S!==n&&this.movingLock(()=>{this.doRemoveGroup(S,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),this.redockGroupToMainGrid(S)});if(b&&w&&this.getPanel(o.id))this.movingLock(()=>xo({from:n,to:o})),o.api.isVisible||o.api.setVisible(!0),this.getPanel(n.id)&&this.doRemoveGroup(n,{skipPopoutAssociated:!0});else if(b&&this.getPanel(n.id)){if(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,u.returnedGroup=n,!d){l();return}a&&C?this.addFloatingGroup(n,{height:a.height,width:a.width,position:a}):(this.doRemoveGroup(n,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),n.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(n,[0])})),this.doSetGroupAndPanelActive(n)}l()}addFloatingGroup(e,t){this.mutation("float",()=>this._doAddFloatingGroup(e,t))}_doAddFloatingGroup(e,t){var n;if(!Gs(this._floatingGroupService,"FloatingGroup","api.addFloatingGroup")||e instanceof So&&e.model.location.type==="edge")return;let h;if(e instanceof pn)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const u=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findReferenceGroupId(h),d=u?this.getPanel(u):void 0;typeof(t==null?void 0:t.skipRemoveGroup)=="boolean"&&t.skipRemoveGroup||(d?(this.movingLock(()=>xo({from:e,to:d})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(d,{skipDispose:!0}),h=d):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function w(){if(t!=null&&t.position){const u={};return"left"in t.position?u.left=Math.max(t.position.left,0):"right"in t.position?u.right=Math.max(t.position.right,0):u.left=ms.left,"top"in t.position?u.top=Math.max(t.position.top,0):"bottom"in t.position?u.bottom=Math.max(t.position.bottom,0):u.top=ms.top,typeof t.width=="number"?u.width=Math.max(t.width,0):u.width=ms.width,typeof t.height=="number"?u.height=Math.max(t.height,0):u.height=ms.height,u}return{left:typeof(t==null?void 0:t.x)=="number"?Math.max(t.x,0):ms.left,top:typeof(t==null?void 0:t.y)=="number"?Math.max(t.y,0):ms.top,width:typeof(t==null?void 0:t.width)=="number"?Math.max(t.width,0):ms.width,height:typeof(t==null?void 0:t.height)=="number"?Math.max(t.height,0):ms.height}}const a=w(),l=this.createNestedGridview();l.addView(h,Wt.Distribute,[0]),this.mountFloatingWindow(l,h,[h],a,{dragHandle:t==null?void 0:t.dragHandle,inDragMode:t==null?void 0:t.inDragMode,skipActiveGroup:t==null?void 0:t.skipActiveGroup})}createNestedGridview(e=Pe.HORIZONTAL){var t,n;return new lp(!0,this.options.hideBorders?{separatorBorder:"transparent"}:void 0,e,!1,(n=(t=this.options.theme)===null||t===void 0?void 0:t.gap)!==null&&n!==void 0?n:0)}mountFloatingWindow(e,t,n,o,h){var w,a,l,u,d,c,b,C;const S=Gs(this._floatingGroupService,"FloatingGroup","api.addFloatingGroup");if(!S)return;const g=((a=(w=h==null?void 0:h.dragHandle)!==null&&w!==void 0?w:this.options.floatingGroupDragHandle)!==null&&a!==void 0?a:"titlebar")==="titlebar"?new Tv(this,t):void 0,_=new Pi(Object.assign(Object.assign({container:(l=this._floatingOverlayHost)!==null&&l!==void 0?l:this.gridview.element,content:e.element,header:g==null?void 0:g.element},o),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(u=this.options.floatingGroupBounds)===null||u===void 0?void 0:u.minimumWidthWithinViewport)!==null&&d!==void 0?d:Ro,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(b=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&b!==void 0?b:Ro,transformDragPosition:this.options.transformFloatingGroupDrag?D=>this.options.transformFloatingGroupDrag({group:t,proposed:D.proposed,container:D.container,others:D.others}):void 0,getSiblingBoxes:()=>this._gatherFloatingGroupBoxes(t)})),m=(C=g==null?void 0:g.element)!==null&&C!==void 0?C:t.element.querySelector(".dv-void-container");if(!m)throw new Error("dockview: failed to find drag handle");_.setupDrag(m,{inDragMode:typeof(h==null?void 0:h.inDragMode)=="boolean"?h.inDragMode:!1});const v=S.add(t,_,e);g&&(v.setTitleBar(g),v.addDisposables(g,Ve.from(()=>v.setTitleBar(void 0)),g.onDragStart(D=>{this._onWillDragGroup.fire({nativeEvent:D,group:v.group})})));for(const D of n)D.model.location={type:"floating"};h!=null&&h.skipActiveGroup||this.doSetGroupAndPanelActive(t)}orthogonalize(e,t){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===Pe.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===Pe.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,t);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,t);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var t,n,o,h,w;super.updateOptions(e),(t=this._floatingGroupService)===null||t===void 0||t.updateBounds(e),(n=this._rootDropTargetService)===null||n===void 0||n.setOptions(e);const a=this.options.disableDnd,l=this.options.dndStrategy;this._options=Object.assign(Object.assign({},this.options),e);const u=this.options.disableDnd,d=this.options.dndStrategy;if((a!==u||l!==d)&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),("createRightHeaderActionComponent"in e||"createLeftHeaderActionComponent"in e||"createPrefixHeaderActionComponent"in e)&&((o=this.headerActionsService)===null||o===void 0||o.refreshAll()),"createWatermarkComponent"in e){(h=this._watermarkService)===null||h===void 0||h.refresh();for(const c of this.groups)c.model.refreshWatermark()}if("tabGroupColors"in e||"tabGroupAccent"in e){this._tabGroupColorPalette.setEntries((w=this._options.tabGroupColors)!==null&&w!==void 0?w:lh),this._tabGroupColorPalette.enabled=this._options.tabGroupAccent!=="off";for(const c of this.groups)c.model.refreshTabGroupAccent()}this._onDidOptionsChange.fire(),this._layoutFromShell(this.gridview.width,this.gridview.height)}layout(e,t,n){var o,h;this._shellManager&&!this._inShellLayout?this._shellManager.layout(e,t):super.layout(e,t,n),this._syncFloatingOverlayHost(),(h=(o=this._moduleRegistry)===null||o===void 0?void 0:o.services.floatingGroupService)===null||h===void 0||h.constrainBounds()}_syncFloatingOverlayHost(){if(!this._floatingOverlayHost||!this._shellManager)return;const e=this._shellManager.element.getBoundingClientRect(),t=this.element.getBoundingClientRect(),n=this._floatingOverlayHost;n.style.left=`${t.left-e.left}px`,n.style.top=`${t.top-e.top}px`,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`}_layoutFromShell(e,t){this._inShellLayout=!0,this.layout(e,t,!0),this._inShellLayout=!1}forceRelayout(){this._shellManager?this._layoutFromShell(this.width,this.height):super.forceRelayout()}addEdgeGroup(e,t){const n=Gs(this._edgeGroupService,"EdgeGroup","api.addEdgeGroup");if(!n)throw new Error("dockview: EdgeGroup module is not registered");if(n.has(e))throw new Error(`dockview: edge group already exists at position '${e}'`);return this.mutation("add",()=>{const o=this.createGroup({id:t.id});o.model.location={type:"edge",position:e},o.model.headerPosition=e;const h=o.model.onDidRemovePanel(()=>{o.model.isEmpty&&this.setEdgeGroupCollapsed(o,!0)});return n.add(e,o,h),this._onDidAddGroup.fire(o),this._shellManager.addEdgeView(e,t,o),o.api})}getEdgeGroup(e){var t,n;return(n=(t=this._edgeGroupService)===null||t===void 0?void 0:t.get(e))===null||n===void 0?void 0:n.api}setEdgeGroupVisible(e,t){this._shellManager.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this._shellManager.isEdgeGroupVisible(e)}removeEdgeGroup(e){const t=Gs(this._edgeGroupService,"EdgeGroup","api.removeEdgeGroup");if(!t)return;const n=t.get(e);if(!n)throw new Error(`dockview: no edge group exists at position '${e}'`);this.mutation("remove",()=>{for(const o of[...n.panels])this.removePanel(o,{removeEmptyGroup:!1,skipDispose:!1});this._shellManager.removeEdgeView(e),t.remove(e),n.dispose(),this._groups.delete(n.id),this._onDidRemoveGroup.fire(n)})}setEdgeGroupCollapsed(e,t){var n;const o=(n=this._edgeGroupService)===null||n===void 0?void 0:n.findPositionOf(e);o&&this._shellManager.isEdgeGroupCollapsed(o)!==t&&(this._shellManager.setEdgeGroupCollapsed(o,t),e.api._onDidCollapsedChange.fire({isCollapsed:t}))}isEdgeGroupCollapsed(e){var t;const n=(t=this._edgeGroupService)===null||t===void 0?void 0:t.findPositionOf(e);return n?this._shellManager.isEdgeGroupCollapsed(n):!1}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(t=>t.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const n=Je(e.group.element),o=(t=this.gridview.next(n))===null||t===void 0?void 0:t.view;this.doSetGroupAndPanelActive(o)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const n=Je(e.group.element),o=(t=this.gridview.previous(n))===null||t===void 0?void 0:t.view;o&&this.doSetGroupAndPanelActive(o)}toJSON(){var e,t,n,o,h,w,a,l;const u=this.gridview.serialize(),d=this.panels.reduce((y,g)=>(y[g.id]=g.toJSON(),y),{}),c=(t=(e=this._floatingGroupService)===null||e===void 0?void 0:e.serialize())!==null&&t!==void 0?t:[],b=(o=(n=this._popoutWindowService)===null||n===void 0?void 0:n.serialize())!==null&&o!==void 0?o:[],C={grid:u,panels:d,activeGroup:(h=this.activeGroup)===null||h===void 0?void 0:h.id};c.length>0&&(C.floatingGroups=c),b.length>0&&(C.popoutGroups=b);const S=(a=(w=this._edgeGroupService)===null||w===void 0?void 0:w.entries())!==null&&a!==void 0?a:[];if(!((l=this._edgeGroupService)===null||l===void 0)&&l.hasAny()){const y=this._shellManager.toJSON();for(const[g,_]of S){const m=y[g];m&&(m.group=_.toJSON())}C.edgeGroups=y}return C}fromJSON(e,t){this.mutation("load",()=>this._doFromJSON(e,t))}_doFromJSON(e,t){var n,o,h,w,a,l,u;(n=this._popoutWindowService)===null||n===void 0||n.cancelPendingRestorations();const d=new Map;let c;if(t!=null&&t.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const y=Object.keys(e.panels);for(const g of this.panels)y.includes(g.api.id)&&d.set(g.api.id,g);this.movingLock(()=>{Array.from(d.values()).forEach(g=>{this.moveGroupOrPanel({from:{groupId:g.api.group.api.id,panelId:g.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:b,panels:C,activeGroup:S}=e;if(b.root.type!=="branch"||!Array.isArray(b.root.data))throw new Error("dockview: root must be of type branch");try{const y=this.width,g=this.height,_=v=>{const{id:D,locked:P,hideHeader:T,headerPosition:A,views:E,activeView:I}=v;if(typeof D!="string")throw new Error("dockview: group id must be of type string");const z=this.createGroup({id:D,locked:!!P,hideHeader:!!T,headerPosition:A});this._onDidAddGroup.fire(z);const H=[];for(const V of E){const F=d.get(V);if(c&&F)this.movingLock(()=>{c.model.removePanel(F)}),H.push(F),F.updateFromStateModel(C[V]);else{const q=this._deserializer.fromJSON(C[V],z);H.push(q)}}for(let V=0;V<E.length;V++){const F=H[V],q=typeof I=="string"&&I===F.id;d.has(F.api.id)?this.movingLock(()=>{z.model.openPanel(F,{skipSetActive:!q,skipSetGroupActive:!0})}):z.model.openPanel(F,{skipSetActive:!q,skipSetGroupActive:!0})}return v.tabGroups&&v.tabGroups.length>0&&z.model.restoreTabGroups(v.tabGroups),!z.activePanel&&z.panels.length>0&&z.model.openPanel(z.panels[z.panels.length-1],{skipSetGroupActive:!0}),z};this.gridview.deserialize(b,{fromJSON:v=>_(v.data)}),this._layoutFromShell(y,g),e.edgeGroups&&this.deserializeEdgeGroups(e.edgeGroups,C),this.deserializeFloatingWindows((o=e.floatingGroups)!==null&&o!==void 0?o:[],_);const m=this.deserializePopoutWindows((h=e.popoutGroups)!==null&&h!==void 0?h:[],_);if((w=this._popoutWindowService)===null||w===void 0||w.finishRestoration(m),(a=this._floatingGroupService)===null||a===void 0||a.constrainBounds(),typeof S=="string"){const v=this.getPanel(S);v&&this.doSetGroupAndPanelActive(v)}(l=this._watermarkService)===null||l===void 0||l.update()}catch(y){console.error("dockview: failed to deserialize layout. Reverting changes",y);for(const g of this.groups)for(const _ of g.panels)this.removePanel(_,{removeEmptyGroup:!1,skipDispose:!1});for(const g of this.groups)g.dispose(),this._groups.delete(g.id),this._onDidRemoveGroup.fire(g);throw(u=this._floatingGroupService)===null||u===void 0||u.disposeAll(),this.clear(),y}this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}deserializeNestedGridview(e,t){const n=this.createNestedGridview(e.orientation),o=[];return n.deserialize(e,{fromJSON:h=>{const w=t(h.data);return o.push(w),w}}),{gridview:n,members:o}}deserializeEdgeGroups(e,t){var n;const o=Gs(this._edgeGroupService,"EdgeGroup","fromJSON edge restoration");if(o){for(const h of["top","bottom","left","right"]){const w=e[h];if(w&&!o.has(h)){const a=w.group,l=(n=a==null?void 0:a.id)!==null&&n!==void 0?n:`${h}-group`;this.addEdgeGroup(h,{id:l})}}for(const[h,w]of o.entries()){const a=e[h],l=a==null?void 0:a.group;if(l){const{views:u,activeView:d}=l,c=[];for(const b of u)if(t[b]){const C=this._deserializer.fromJSON(t[b],w);c.push(C)}for(let b=0;b<c.length;b++){const C=c[b],S=d===C.id;w.model.openPanel(C,{skipSetActive:!S,skipSetGroupActive:!0})}l.tabGroups&&l.tabGroups.length>0&&w.model.restoreTabGroups(l.tabGroups),!w.activePanel&&w.panels.length>0&&w.model.openPanel(w.panels[w.panels.length-1],{skipSetGroupActive:!0})}}this._shellManager.fromJSON(e)}}deserializeFloatingWindows(e,t){for(const n of e){const{data:o,grid:h,position:w}=n;if(h){const{gridview:a,members:l}=this.deserializeNestedGridview(h,t);if(l.length===0)continue;this.mountFloatingWindow(a,l[0],l,w,{inDragMode:!1})}else if(o){const a=t(o);this.addFloatingGroup(a,{position:w,width:w.width,height:w.height,skipRemoveGroup:!0,inDragMode:!1})}}}deserializePopoutWindows(e,t){const n=e.length>0?Gs(this._popoutWindowService,"PopoutWindow","fromJSON popout restoration"):this._popoutWindowService;return n?e.flatMap((o,h)=>{const{data:w,grid:a,position:l,gridReferenceGroup:u,url:d}=o;let c,b=[];if(a){const S=this.deserializeNestedGridview(a,t);if(c=S.gridview,b=S.members,b.length===0)return c.dispose(),[]}const C=a?b[0]:t(w);return n.scheduleRestoration(h*Ov,()=>{this.addPopoutGroup(C,{position:l??void 0,overridePopoutGroup:u?C:void 0,overridePopoutGridview:c,referenceGroup:u?this.getPanel(u):void 0,popoutUrl:d})},()=>{for(const S of b.length>0?b:[C])if(!this.isDisposed&&this._groups.has(S.id)&&S.element.parentElement===null){for(const y of[...S.panels])this.removePanel(y,{removeEmptyGroup:!1});S.dispose(),this._groups.delete(S.id),this._onDidRemoveGroup.fire(S)}})}):[]}clear(){this.mutation("clear",()=>this._doClear())}_doClear(){var e;const t=Array.from(this._groups.values()).map(o=>o.value),n=!!this.activeGroup;for(const o of t){if(!((e=this._edgeGroupService)===null||e===void 0)&&e.includes(o)){const h=[...o.panels];for(const w of h)this.removePanel(w,{removeEmptyGroup:!1});continue}this.removeGroup(o,{skipActive:!0})}n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){this.mutation("remove",()=>{for(const e of this._groups.entries()){const[t,n]=e;n.value.model.closeAllPanels()}})}addPanel(e){return this.mutation("add",()=>this._doAddPanel(e))}_doAddPanel(e){var t,n;if(this.panels.find(l=>l.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let o;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const h={width:e.initialWidth,height:e.initialHeight};let w;if(e.position)if(pv(e.position)){const l=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(w=e.position.index,!l)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);o=this.findGroup(l)}else if(fv(e.position)){if(o=typeof e.position.referenceGroup=="string"?(t=this._groups.get(e.position.referenceGroup))===null||t===void 0?void 0:t.value:e.position.referenceGroup,w=e.position.index,!o)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const l=this.orthogonalize(ou(e.position.direction)),u=this.createPanel(e,l);return l.model.openPanel(u,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(l),l.api.setSize({height:h==null?void 0:h.height,width:h==null?void 0:h.width}),u}else o=this.activeGroup;let a;if(o){const l=Lo(((n=e.position)===null||n===void 0?void 0:n.direction)||"within");if(e.floating){const u=this.createGroup();this._onDidAddGroup.fire(u);const d=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(u,Object.assign(Object.assign({},d),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),a=this.createPanel(e,u),u.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w})}else if(o.api.location.type==="floating"||o.api.location.type==="edge"||l==="center")a=this.createPanel(e,o),o.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),o.api.setSize({width:h==null?void 0:h.width,height:h==null?void 0:h.height}),e.inactive||this.doSetGroupAndPanelActive(o);else{const u=Je(o.element),d=si(this.gridview.orientation,u,l),c=this.createGroupAtLocation(d,this.orientationAtLocation(d)===Pe.VERTICAL?h==null?void 0:h.height:h==null?void 0:h.width);a=this.createPanel(e,c),c.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(c)}}else if(e.floating){const l=this.createGroup();this._onDidAddGroup.fire(l);const u=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(l,Object.assign(Object.assign({},u),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),a=this.createPanel(e,l),l.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w})}else{const l=this.createGroupAtLocation([0],this.gridview.orientation===Pe.VERTICAL?h==null?void 0:h.height:h==null?void 0:h.width);a=this.createPanel(e,l),l.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(l)}return a}removePanel(e,t={removeEmptyGroup:!0}){this.mutation("remove",()=>this._doRemovePanel(e,t))}_doRemovePanel(e,t={removeEmptyGroup:!0}){const n=e.group;if(!n)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);n.model.removePanel(e,{skipSetActiveGroup:t.skipSetActiveGroup}),t.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),n.size===0&&t.removeEmptyGroup&&this.removeGroup(n,{skipActive:t.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new kv}addGroup(e){return this.mutation("add",()=>this._doAddGroup(e))}_doAddGroup(e){var t;if(e){let n;if(mv(e)){const u=typeof e.referencePanel=="string"?this.panels.find(d=>d.id===e.referencePanel):e.referencePanel;if(!u)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(n=this.findGroup(u),!n)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(gv(e)){if(n=typeof e.referenceGroup=="string"?(t=this._groups.get(e.referenceGroup))===null||t===void 0?void 0:t.value:e.referenceGroup,!n)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const u=this.orthogonalize(ou(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(u),u}const o=Lo(e.direction||"within"),h=Je(n.element),w=si(this.gridview.orientation,h,o),a=this.createGroup(e),l=this.getLocationOrientation(w)===Pe.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(a,w,l),e.skipSetActive||this.doSetGroupAndPanelActive(a),a}else{const n=this.createGroup(e);return this.doAddGroup(n),this.doSetGroupAndPanelActive(n),n}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===Pe.HORIZONTAL?Pe.HORIZONTAL:Pe.VERTICAL}removeGroup(e,t){this.mutation("remove",()=>this.doRemoveGroup(e,t))}detachFromNestedWindow(e){var t,n;const o=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(e);if(o){const w=this.nestedWindowMembers(e);return w.length<=1?!1:(o.gridview.remove(e),o.group===e&&o.setAnchorGroup(w.find(a=>a!==e)),!0)}const h=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(e);if(h){const w=this.nestedWindowMembers(e);return w.length<=1?!1:(h.gridview.remove(e),h.popoutGroup===e&&(h.popoutGroup=w.find(a=>a!==e)),!0)}return!1}disposeGroupRecord(e){e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}activateFallbackGroupIfRemoved(e,t){if(!t&&this._activeGroup===e){const n=Array.from(this._groups.values());this.doSetGroupAndPanelActive(n.length>0?n[0].value:void 0)}}doRemoveGroup(e,t){var n,o,h,w,a;if(!((n=this._edgeGroupService)===null||n===void 0)&&n.includes(e))return e;const l=[...e.panels];if(!(t!=null&&t.skipDispose))for(const c of l)this.removePanel(c,{removeEmptyGroup:!1,skipDispose:(o=t==null?void 0:t.skipDispose)!==null&&o!==void 0?o:!1});const u=this.activePanel;if(e.api.location.type==="floating"){const c=(h=this._floatingGroupService)===null||h===void 0?void 0:h.findByGroup(e);if(!c)throw new Error("dockview: failed to find floating group");return this.detachFromNestedWindow(e)?(t!=null&&t.skipDispose?e.model.location={type:"grid"}:this.disposeGroupRecord(e),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e):(t!=null&&t.skipDispose||this.disposeGroupRecord(e),c.dispose(),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e)}if(e.api.location.type==="popout"){const c=(w=this._popoutWindowService)===null||w===void 0?void 0:w.findByGroup(e);if(!c)throw new Error("dockview: failed to find popout group");if(this.detachFromNestedWindow(e))return t!=null&&t.skipDispose?e.model.location={type:"grid"}:this.disposeGroupRecord(e),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e;if(!(t!=null&&t.skipDispose)){if(!(t!=null&&t.skipPopoutAssociated)){const C=c.referenceGroup?this.getPanel(c.referenceGroup):void 0;C&&C.panels.length===0&&this.removeGroup(C)}c.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}(a=this._popoutWindowService)===null||a===void 0||a.remove(c);const b=c.disposable.dispose();return!(t!=null&&t.skipPopoutReturn)&&b&&(this.doAddGroup(b,[0]),this.doSetGroupAndPanelActive(b)),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),c.popoutGroup}if(!this.gridview.element.contains(e.element)){if(!(t!=null&&t.skipDispose)){const c=this._groups.get(e.id);c==null||c.disposable.dispose(),this.disposeGroupRecord(e)}return this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e}const d=super.doRemoveGroup(e,t);return t!=null&&t.skipActive||this.activePanel!==u&&this.fireActivePanelChange(this.activePanel),d}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{var e,t;this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions();for(const n of(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.entries)!==null&&t!==void 0?t:[])n.overlayRenderContainer.updateAllPositions()})}movingLock(e){const t=this._moving;try{return this._moving=!0,e()}finally{this._moving=t}}mutation(e,t){const n=this._mutationDepth===0,o=this._origin;n&&this._onWillMutateLayout.fire({kind:e,origin:o}),this._mutationDepth++;try{return t()}finally{this._mutationDepth--,n&&this._onDidMutateLayout.fire({kind:e,origin:o})}}currentOrigin(){return this._origin}withOrigin(e,t){if(this._originDepth>0||this._mutationDepth>0)return t();const n=this._origin;this._origin=e,this._originDepth++;try{return t()}finally{this._originDepth--,this._origin=n}}fireActivePanelChange(e){this._onDidActivePanelChange.fire({panel:e,origin:this._origin})}moveGroupOrPanel(e){this.mutation("move",()=>this._doMoveGroupOrPanel(e))}_doMoveGroupOrPanel(e){var t,n;const o=e.to.group,h=e.from.groupId,w=e.from.panelId,a=e.to.position,l=e.to.index,u=h?(t=this._groups.get(h))===null||t===void 0?void 0:t.value:void 0;if(!u)throw new Error(`dockview: Failed to find group id ${h}`);if(w===void 0){e.from.tabGroupId?this.moveTabGroupToGroup({sourceGroup:u,tabGroupId:e.from.tabGroupId,destinationGroup:o,destinationTarget:a,destinationIndex:l,skipSetActive:e.skipSetActive,keepEmptyGroups:e.keepEmptyGroups}):this.moveGroup({from:{group:u},to:{group:o,position:a},skipSetActive:e.skipSetActive});return}if(!a||a==="center"){const d=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!d)throw new Error(`dockview: No panel with id ${w}`);!e.keepEmptyGroups&&u.model.size===0&&this.doRemoveGroup(u,{skipActive:!0});const c=o.model.size===0;this.movingLock(()=>{var b;return o.model.openPanel(d,{index:l,skipSetActive:((b=e.skipSetActive)!==null&&b!==void 0?b:!1)&&!c,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(o),this._onDidMovePanel.fire({panel:d,from:u})}else{const d=this.getGridviewForGroup(o),c=Je(o.element),b=si(d.orientation,c,a);if(u.size<2){const[C,S]=ji(b);if(u.api.location.type==="grid"&&d===this.gridview){const m=Je(u.element),[v,D]=ji(m);if(rp(v,C)){this.gridview.moveView(v,D,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u});return}}if(u.api.location.type==="popout"&&this.nestedWindowMembers(u).length<=1){const m=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(u);if(!m)return;const v=this.movingLock(()=>m.popoutGroup.model.removePanel(m.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(u,{skipActive:!0});const D=si(d.orientation,Je(o.element),a),P=this.createGroupAtLocation(D,void 0,void 0,d);this.movingLock(()=>P.model.openPanel(v,{skipSetActive:!0})),this.doSetGroupAndPanelActive(P),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u});return}if(u.api.location.type==="edge"){const m=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${w}`);const v=this.createGroupAtLocation(b,void 0,void 0,d);this.movingLock(()=>v.model.openPanel(m,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(v),this._onDidMovePanel.fire({panel:m,from:u});return}const y=this.movingLock(()=>this.doRemoveGroup(u,{skipActive:!0,skipDispose:!0})),g=Je(o.element),_=si(d.orientation,g,a);this.movingLock(()=>this.doAddGroup(y,_,void 0,d)),this.setGroupLocationForRoot(y,d),this.doSetGroupAndPanelActive(y),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u})}else{const C=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!C)throw new Error(`dockview: No panel with id ${w}`);const S=si(d.orientation,c,a),y=this.createGroupAtLocation(S,void 0,void 0,d);this.movingLock(()=>y.model.openPanel(C,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(y),this._onDidMovePanel.fire({panel:C,from:u})}}}moveTabGroupToGroup(e){const{sourceGroup:t,tabGroupId:n,destinationGroup:o,destinationTarget:h,destinationIndex:w}=e,a=t.model.getTabGroups().find(_=>_.id===n);if(!a||a.panelIds.length===0)return;const l=a.label,u=a.color,d=a.collapsed,c=a.componentParams,b=[...a.panelIds],C=h&&h!=="center"?Je(o.element):void 0,S=this.movingLock(()=>b.map(_=>t.model.removePanel(_,{skipSetActive:!1,skipSetActiveGroup:!0})).filter(_=>_!==void 0));if(S.length===0)return;const y=_=>{this.movingLock(()=>{for(const v of S)_.model.openPanel(v,{index:w,skipSetActive:!0,skipSetGroupActive:!0})});const m=_.model.createTabGroup({label:l,color:u,collapsed:d,componentParams:c});for(const v of S)_.model.addPanelToTabGroup(m.id,v.id);e.skipSetActive||this.doSetGroupAndPanelActive(_);for(const v of S)this._onDidMovePanel.fire({panel:v,from:t})};let g;if(!h||h==="center"||!C)g=o;else{const _=si(this.gridview.orientation,C,h);g=this.createGroupAtLocation(_)}!e.keepEmptyGroups&&t.model.size===0&&t!==g&&this.doRemoveGroup(t,{skipActive:!0}),y(g)}moveGroup(e){this.mutation("move",()=>this._doMoveGroup(e))}maximizeGroup(e){this.mutation("maximize",()=>super.maximizeGroup(e))}exitMaximizedGroup(){this.mutation("maximize",()=>super.exitMaximizedGroup())}_doMoveGroup(e){var t,n,o;const h=e.from.group,w=e.to.group,a=e.to.position;let l=h;if(a==="center"){const u=h.activePanel,d=h.model.getTabGroups().map(b=>({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams,panelIds:[...b.panelIds]})),c=this.movingLock(()=>[...h.panels].map(b=>h.model.removePanel(b.id,{skipSetActive:!0})));(h==null?void 0:h.model.size)===0&&this.doRemoveGroup(h,{skipActive:!0}),this.movingLock(()=>{for(const b of c)w.model.openPanel(b,{skipSetActive:b!==u,skipSetGroupActive:!0})});for(const b of d){const C=w.model.createTabGroup({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams});for(const S of b.panelIds)w.model.addPanelToTabGroup(C.id,S)}e.skipSetActive!==!0?this.doSetGroupAndPanelActive(w):this.activePanel||this.doSetGroupAndPanelActive(w)}else{if(h.api.location.type==="edge"){const u=h.activePanel,d=h.model.getTabGroups().map(b=>({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams,panelIds:[...b.panelIds]})),c=this.movingLock(()=>[...h.panels].map(b=>h.model.removePanel(b.id,{skipSetActive:!0})));l=this.createGroup(),this._onDidAddGroup.fire(l),this.movingLock(()=>{for(const b of c)l.model.openPanel(b,{skipSetActive:b!==u,skipSetGroupActive:!0})});for(const b of d){const C=l.model.createTabGroup({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams});for(const S of b.panelIds)l.model.addPanelToTabGroup(C.id,S)}}else switch(h.api.location.type){case"grid":this.gridview.removeView(Je(h.element));break;case"floating":{const u=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(h);if(!u)throw new Error("dockview: failed to find floating group");this.detachFromNestedWindow(h)||u.dispose();break}case"popout":{const u=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(h);if(!u)throw new Error("dockview: failed to find popout group");if(this.detachFromNestedWindow(h))break;if((o=this._popoutWindowService)===null||o===void 0||o.remove(u),u.referenceGroup){const d=this.getPanel(u.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}u.window.dispose();break}}if(w.api.location.type==="grid"||w.api.location.type==="floating"||w.api.location.type==="popout"){const u=this.getGridviewForGroup(w),d=Je(w.element),c=si(u.orientation,d,a);let b;switch(u.orientation){case Pe.VERTICAL:b=d.length%2==0?h.api.width:h.api.height;break;case Pe.HORIZONTAL:b=d.length%2==0?h.api.height:h.api.width;break}u.addView(l,b,c),this.setGroupLocationForRoot(l,u)}}if(l.panels.forEach(u=>{this._onDidMovePanel.fire({panel:u,from:h})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const u=w??h;this.doSetGroupAndPanelActive(u)}else l!==h&&e.skipSetActive!==!0&&this.doSetGroupAndPanelActive(l)}doSetGroupActive(e){var t;super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==((t=this._onDidActivePanelChange.value)===null||t===void 0?void 0:t.panel)&&this.fireActivePanelChange(n)}doSetGroupAndPanelActive(e){var t;super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==((t=this._onDidActivePanelChange.value)===null||t===void 0?void 0:t.panel)&&this.fireActivePanelChange(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let t=e==null?void 0:e.id;if(t&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),t=void 0),!t)for(t=this.nextGroupId.next();this._groups.has(t);)t=this.nextGroupId.next();const n=new So(this,t,e);if(n.init({params:{},accessor:this}),!this._groups.has(n.id)){const o=new Se(n.model.onTabDragStart(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDragPanel(h)}),n.model.onGroupDragStart(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDragGroup(h)}),n.model.onMove(h=>{const{groupId:w,itemId:a,target:l,index:u,tabGroupId:d}=h;this.moveGroupOrPanel({from:{groupId:w,panelId:a,tabGroupId:d},to:{group:n,position:l,index:u}})}),n.model.onDidDrop(h=>{this._onDidDrop.fire(h)}),n.model.onWillDrop(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDrop(h)}),n.model.onWillShowOverlay(h=>{var w;if(this.options.disableDnd){h.preventDefault();return}(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillShowOverlay(h)}),n.model.onUnhandledDragOver(h=>{this._onUnhandledDragOver.fire(h)}),n.model.onDidAddPanel(h=>{this._moving||this._onDidAddPanel.fire(h.panel)}),n.model.onDidRemovePanel(h=>{this._moving||this._onDidRemovePanel.fire(h.panel)}),n.model.onDidActivePanelChange(h=>{var w;this._moving||h.panel===this.activePanel&&((w=this._onDidActivePanelChange.value)===null||w===void 0?void 0:w.panel)!==h.panel&&this.fireActivePanelChange(h.panel)}),ri.any(n.model.onDidPanelTitleChange,n.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(n.id,{value:n,disposable:o})}return n.initialize(),n}createPanel(e,t){var n,o,h;const w=e.component,a=(n=e.tabComponent)!==null&&n!==void 0?n:this.options.defaultTabComponent,l=new Ip(this,e.id,w,a),u=new pn(e.id,w,a,this,this._api,t,l,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return u.init({title:(o=e.title)!==null&&o!==void 0?o:e.id,params:(h=e==null?void 0:e.params)!==null&&h!==void 0?h:{}}),u}createGroupAtLocation(e,t,n,o=this.gridview){const h=this.createGroup(n);return this.doAddGroup(h,e,t,o),this.setGroupLocationForRoot(h,o),h}setGroupLocationForRoot(e,t){var n;const o=(n=this._popoutWindowService)===null||n===void 0?void 0:n.entries.find(h=>h.gridview===t);if(o){e.model.renderContainer!==o.overlayRenderContainer&&(e.model.renderContainer=o.overlayRenderContainer),e.model.dropTargetContainer=o.dropTargetContainer,e.model.location={type:"popout",getWindow:o.getWindow,popoutUrl:o.popoutUrl};return}e.model.renderContainer!==this.overlayRenderContainer&&(e.model.renderContainer=this.overlayRenderContainer),e.model.dropTargetContainer=this.rootDropTargetContainer,e.model.location=t===this.gridview?{type:"grid"}:{type:"floating"}}getGridviewForGroup(e){var t,n;const o=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(e);if(o)return o.gridview;const h=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(e);return h?h.gridview:this.gridview}nestedWindowMembers(e){const t=this.getGridviewForGroup(e);return t===this.gridview?[]:this.groups.filter(n=>t.element.contains(n.element))}findGroup(e){var t;return(t=Array.from(this._groups.values()).find(n=>n.value.model.containsPanel(e)))===null||t===void 0?void 0:t.value}orientationAtLocation(e){const t=this.gridview.orientation;return e.length%2==1?t:Ti(t)}updateTheme(){var e,t,n,o,h,w,a,l,u,d;const c=(e=this._options.theme)!==null&&e!==void 0?e:xv;(t=this._shellThemeClassnames)===null||t===void 0||t.setClassNames(c.className);const b=(n=c.gap)!==null&&n!==void 0?n:0;this.gridview.margin=b;for(const S of this.floatingGroups)S.gridview.margin=b;for(const S of(h=(o=this._popoutWindowService)===null||o===void 0?void 0:o.entries)!==null&&h!==void 0?h:[])S.gridview.margin=b;switch((w=this._shellManager)===null||w===void 0||w.updateTheme(b,(a=c.edgeGroupCollapsedSize)!==null&&a!==void 0?a:35),c.dndOverlayBorder!==void 0?(this.element.style.setProperty("--dv-drag-over-border",c.dndOverlayBorder),(l=this._shellManager)===null||l===void 0||l.element.style.setProperty("--dv-drag-over-border",c.dndOverlayBorder)):(this.element.style.removeProperty("--dv-drag-over-border"),(u=this._shellManager)===null||u===void 0||u.element.style.removeProperty("--dv-drag-over-border")),c.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}const C=((d=c.tabGroupIndicator)!==null&&d!==void 0?d:"wrap")==="none";we(this.element,"dv-tab-group-indicator-none",C),this._shellManager&&we(this._shellManager.element,"dv-tab-group-indicator-none",C);for(const S of this.groups)S.model.updateTabGroups()}}class m_ extends hp{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,t){var n;super(e,{proportionalLayout:(n=t.proportionalLayout)!==null&&n!==void 0?n:!0,orientation:t.orientation,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,className:t.className}),this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new Q,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new Q,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=t,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(o=>{this._onDidAddGroup.fire(o)}),this.onDidRemove(o=>{this._onDidRemoveGroup.fire(o)}),this.onDidActiveChange(o=>{this._onDidActiveGroupChange.fire(o)}))}updateOptions(e){super.updateOptions(e);const t=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(Je(e.element),t)}setActive(e){this._groups.forEach((t,n)=>{t.value.setActive(e===t.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:t,activePanel:n}=e;try{const o=[],h=this.width,w=this.height;if(this.gridview.deserialize(t,{fromJSON:a=>{const{data:l}=a,u=this.options.createComponent({id:l.id,name:l.component});return o.push(()=>u.init({params:l.params,minimumWidth:l.minimumWidth,maximumWidth:l.maximumWidth,minimumHeight:l.minimumHeight,maximumHeight:l.maximumHeight,priority:l.priority,snap:!!l.snap,accessor:this,isVisible:a.visible})),this._onDidAddGroup.fire(u),this.registerPanel(u),u}}),this.layout(h,w,!0),o.forEach(a=>a()),typeof n=="string"){const a=this.getPanel(n);a&&this.doSetGroupActive(a)}}catch(o){for(const h of this.groups)h.dispose(),this._groups.delete(h.id),this._onDidRemoveGroup.fire(h);throw this.clear(),o}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,t=Array.from(this._groups.values());for(const n of t)n.disposable.dispose(),this.doRemoveGroup(n.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,t){var n;let o;const h=this.gridview.remove(e),w=(n=this._groups.get(t.reference))===null||n===void 0?void 0:n.value;if(!w)throw new Error(`reference group ${t.reference} does not exist`);const a=Lo(t.direction);if(a==="center")throw new Error(`${a} not supported as an option`);{const l=Je(w.element);o=si(this.gridview.orientation,l,a)}this.doAddGroup(h,o,t.size)}addPanel(e){var t,n,o,h;let w=(t=e.location)!==null&&t!==void 0?t:[0];if(!((n=e.position)===null||n===void 0)&&n.referencePanel){const l=(o=this._groups.get(e.position.referencePanel))===null||o===void 0?void 0:o.value;if(!l)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const u=Lo(e.position.direction);if(u==="center")throw new Error(`${u} not supported as an option`);{const d=Je(l.element);w=si(this.gridview.orientation,d,u)}}const a=this.options.createComponent({id:e.id,name:e.component});return a.init({params:(h=e.params)!==null&&h!==void 0?h:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(a,w,e.size),this.registerPanel(a),this.doSetGroupActive(a),a}registerPanel(e){const t=new Se(e.api.onDidFocusChange(n=>{n.isFocused&&this._groups.forEach(o=>{const h=o.value;h!==e?h.setActive(!1):h.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,n){const o=this.getPanel(t);if(!o)throw new Error("invalid operation");const h=Je(e.element),w=si(this.gridview.orientation,h,n),[a,l]=ji(w),u=Je(o.element),[d,c]=ji(u);if(rp(d,a)){this.gridview.moveView(d,c,l);return}const b=this.doRemoveGroup(o,{skipActive:!0,skipDispose:!0}),C=Je(e.element),S=si(this.gridview.orientation,C,n);this.doAddGroup(b,S)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class g_ extends nh{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Se(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(t=>this._onDidAddView.fire(t)),this._splitview.onDidRemoveView(t=>this._onDidRemoveView.fire(t)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===Pe.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===Pe.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._splitviewChangeDisposable=new ft,this._panels=new Map,this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new Q,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this._options=t,this.splitview=new Ns(this.element,t),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var t,n;"className"in e&&this._classNames.setClassNames((t=e.className)!==null&&t!==void 0?t:""),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const n=this.panels.indexOf(e);this.splitview.setViewVisible(n,t)}setActive(e,t){this._activePanel=e,this.panels.filter(n=>n!==e).forEach(n=>{n.api._onDidActiveChange.fire({isActive:!1}),t||n.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}removePanel(e,t){const n=this._panels.get(e.id);if(!n)throw new Error(`unknown splitview panel ${e.id}`);n.dispose(),this._panels.delete(e.id);const o=this.panels.findIndex(a=>a===e);this.splitview.removeView(o,t).dispose();const w=this.panels;w.length>0&&this.setActive(w[w.length-1])}getPanel(e){return this.panels.find(t=>t.id===e)}addPanel(e){var t;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const n=this.options.createComponent({id:e.id,name:e.component});n.orientation=this.splitview.orientation,n.init({params:(t=e.params)!==null&&t!==void 0?t:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const o=typeof e.size=="number"?e.size:Wt.Distribute,h=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(n,o,h),this.doAddView(n),this.setActive(n),n}layout(e,t){const[n,o]=this.splitview.orientation===Pe.HORIZONTAL?[e,t]:[t,e];this.splitview.layout(n,o)}doAddView(e){const t=e.api.onDidFocusChange(n=>{n.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map((n,o)=>({size:this.splitview.getViewSize(o),data:n.toJSON(),snap:!!n.snap,priority:n.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:t,orientation:n,size:o,activeView:h}=e,w=[],a=this.width,l=this.height;if(this.splitview=new Ns(this.element,{orientation:n,proportionalLayout:this.options.proportionalLayout,descriptor:{size:o,views:t.map(u=>{const d=u.data;if(this._panels.has(d.id))throw new Error(`panel ${d.id} already exists`);const c=this.options.createComponent({id:d.id,name:d.component});return w.push(()=>{var b;c.init({params:(b=d.params)!==null&&b!==void 0?b:{},minimumSize:d.minimumSize,maximumSize:d.maximumSize,snap:u.snap,priority:u.priority,accessor:this})}),c.orientation=n,this.doAddView(c),setTimeout(()=>{this._onDidAddView.fire(c)},0),{size:u.size,view:c}})}}),this.layout(a,l),w.forEach(u=>u()),typeof h=="string"){const u=this.getPanel(h);u&&this.setActive(u)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,Wt.Distribute,!0).dispose()}dispose(){for(const t of this._panels.values())t.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const t of e)t.dispose();this.element.remove(),super.dispose()}}class vu extends Se{get element(){return this._element}constructor(){super(),this._expandedIcon=cv(),this._collapsedIcon=kp(),this.disposable=new ft,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const t=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);we(this._expander,"collapsed",!t),t?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const v_=sh(),_u=22,wu=0,bu=Number.MAX_SAFE_INTEGER;class yu extends Ug{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class __ extends nh{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Se(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(t=>this._onDidAddView.fire(t)),this._paneview.onDidRemoveView(t=>this._onDidRemoveView.fire(t)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===Pe.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===Pe.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._id=v_.next(),this._disposable=new ft,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new Q,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOver),this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this._options=t,this.paneview=new ru(this.element,{orientation:Pe.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,t){const n=this.panels.indexOf(e);this.paneview.setViewVisible(n,t)}focus(){}updateOptions(e){var t,n;"className"in e&&this._classNames.setClassNames((t=e.className)!==null&&t!==void 0?t:""),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var t,n;const o=this.options.createComponent({id:e.id,name:e.component});let h;e.headerComponent&&this.options.createHeaderComponent&&(h=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),h||(h=new vu);const w=new yu({id:e.id,component:e.component,headerComponent:e.headerComponent,header:h,body:o,orientation:Pe.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(t=e.headerSize)!==null&&t!==void 0?t:_u,minimumBodySize:wu,maximumBodySize:bu});this.doAddPanel(w);const a=typeof e.size=="number"?e.size:Wt.Distribute,l=typeof e.index=="number"?e.index:void 0;return w.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new lr(this),accessor:this}),this.paneview.addPane(w,a,l),w.orientation=this.paneview.orientation,w}removePanel(e){const n=this.panels.findIndex(o=>o===e);this.paneview.removePane(n),this.doRemovePanel(e)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.panels.find(t=>t.id===e)}layout(e,t){const[n,o]=this.paneview.orientation===Pe.HORIZONTAL?[e,t]:[t,e];this.paneview.layout(n,o)}toJSON(){const e=o=>o===Number.MAX_SAFE_INTEGER||o===Number.POSITIVE_INFINITY?void 0:o,t=o=>o<=0?void 0:o;return{views:this.paneview.getPanes().map((o,h)=>({size:this.paneview.getViewSize(h),data:o.toJSON(),minimumSize:t(o.minimumBodySize),maximumSize:e(o.maximumBodySize),headerSize:o.headerSize,expanded:o.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:t,size:n}=e,o=[],h=this.width,w=this.height;this.paneview=new ru(this.element,{orientation:Pe.VERTICAL,descriptor:{size:n,views:t.map(a=>{var l,u,d;const c=a.data,b=this.options.createComponent({id:c.id,name:c.component});let C;c.headerComponent&&this.options.createHeaderComponent&&(C=this.options.createHeaderComponent({id:c.id,name:c.headerComponent})),C||(C=new vu);const S=new yu({id:c.id,component:c.component,headerComponent:c.headerComponent,header:C,body:b,orientation:Pe.VERTICAL,isExpanded:!!a.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(l=a.headerSize)!==null&&l!==void 0?l:_u,minimumBodySize:(u=a.minimumSize)!==null&&u!==void 0?u:wu,maximumBodySize:(d=a.maximumSize)!==null&&d!==void 0?d:bu});return this.doAddPanel(S),o.push(()=>{var y;S.init({params:(y=c.params)!==null&&y!==void 0?y:{},minimumBodySize:a.minimumSize,maximumBodySize:a.maximumSize,title:c.title,isExpanded:!!a.expanded,containerApi:new lr(this),accessor:this}),S.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(S)},0),{size:a.size,view:S}})}}),this.layout(h,w),o.forEach(a=>a()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const t=new Se(e.onDidDrop(n=>{this._onDidDrop.fire(n)}),e.onUnhandledDragOver(n=>{this._onUnhandledDragOver.fire(n)}));this._viewDisposables.set(e.id,t)}doRemovePanel(e){const t=this._viewDisposables.get(e.id);t&&(t.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class w_ extends oh{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,t){super(e,t,new yp(e,t)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(n=>{const{isVisible:o}=n,{accessor:h}=this._params;h.setVisible(this,o)}),this.api.onActiveChange(()=>{const{accessor:n}=this._params;n.setActive(this)}),this.api.onDidConstraintsChangeInternal(n=>{(typeof n.minimumSize=="number"||typeof n.minimumSize=="function")&&(this._minimumSize=n.minimumSize),(typeof n.maximumSize=="number"||typeof n.maximumSize=="function")&&(this._maximumSize=n.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,t){const[n,o]=this.orientation===Pe.HORIZONTAL?[e,t]:[t,e];super.layout(n,o)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=n=>n===Number.MAX_SAFE_INTEGER||n===Number.POSITIVE_INFINITY?void 0:n,t=n=>n<=0?void 0:n;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:t(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function b_(p,e){return new f_(p,e).api}function y_(p,e){const t=new g_(p,e);return new cp(t)}function S_(p,e){const t=new m_(p,e);return new dp(t)}function C_(p,e){const t=new __(p,e);return new lr(t)}/**
45
+ */class Zu{}class ni extends Zu{constructor(e,t,n,o){super(),this.viewId=e,this.groupId=t,this.panelId=n,this.tabGroupId=o}}class or extends Zu{constructor(e,t){super(),this.viewId=e,this.paneId=t}}class wi{constructor(){}static getInstance(){return wi.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,t){t&&(this.data=e,this.proto=t)}}wi.INSTANCE=new wi;function it(){const p=wi.getInstance();if(p.hasData(ni.prototype))return p.getData(ni.prototype)[0]}function tr(){const p=wi.getInstance();if(p.hasData(or.prototype))return p.getData(or.prototype)[0]}var Ve;(function(p){p.NONE={dispose:()=>{}};function e(t){return{dispose:()=>{t()}}}p.from=e})(Ve||(Ve={}));class Se{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=new Set(e)}addDisposables(...e){e.forEach(t=>this._disposables.add(t))}removeDisposable(e){this._disposables.delete(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables.clear())}}class ft{constructor(){this._disposable=Ve.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Ve.NONE)}}var ri;(function(p){p.any=(...e)=>t=>{const n=e.map(o=>o(t));return{dispose:()=>{n.forEach(o=>{o.dispose()})}}}})(ri||(ri={}));class ih{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class Qu{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class ag{constructor(){this.events=new Map}get size(){return this.events.size}add(e,t){this.events.set(e,t)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Io{static create(){var e;return new Io((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class lg{constructor(e,t){this.callback=e,this.stacktrace=t}}class Q{static setLeakageMonitorEnabled(e){e!==Q.ENABLE_TRACKING&&Q.MEMORY_LEAK_WATCHER.clear(),Q.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1,this._pauseTokens=new Set}get event(){return this._event||(this._event=e=>{var t;!((t=this.options)===null||t===void 0)&&t.replay&&this._last!==void 0&&e(this._last);const n=new lg(e,Q.ENABLE_TRACKING?Io.create():void 0);return this._listeners.push(n),{dispose:()=>{const o=this._listeners.indexOf(n);o>-1&&this._listeners.splice(o,1)}}},Q.ENABLE_TRACKING&&Q.MEMORY_LEAK_WATCHER.add(this._event,Io.create())),this._event}fire(e){var t;if(!(this._pauseTokens.size>0)){!((t=this.options)===null||t===void 0)&&t.replay&&(this._last=e);for(const n of this._listeners)n.callback(e)}}pause(){const e={};return this._pauseTokens.add(e),Ve.from(()=>this._pauseTokens.delete(e))}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(Q.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const t of this._listeners)console.warn("dockview: stacktrace",(e=t.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),Q.ENABLE_TRACKING&&this._event&&Q.MEMORY_LEAK_WATCHER.delete(this._event))}}Q.ENABLE_TRACKING=!1;Q.MEMORY_LEAK_WATCHER=new ag;function be(p,e,t,n){return p.addEventListener(e,t,n),{dispose:()=>{p.removeEventListener(e,t,n)}}}class iu{constructor(){this._onFired=new Q,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const t=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>t&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}class hg extends Se{constructor(e){super(),this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,cr(e,t=>{const n=t.target.scrollWidth>t.target.clientWidth,o=t.target.scrollHeight>t.target.clientHeight;this._value={hasScrollX:n,hasScrollY:o},this._onDidChange.fire(this._value)}))}}function cr(p,e){const t=new ResizeObserver(n=>{requestAnimationFrame(()=>{const o=n[0];e(o)})});return t.observe(p),{dispose:()=>{t.unobserve(p),t.disconnect()}}}const bi=(p,...e)=>{for(const t of e)p.classList.contains(t)&&p.classList.remove(t)},yi=(p,...e)=>{for(const t of e)p.classList.contains(t)||p.classList.add(t)},we=(p,e,t)=>{const n=p.classList.contains(e);t&&!n&&p.classList.add(e),!t&&n&&p.classList.remove(e)};function Gl(p,e){for(;p;){if(p===e)return!0;p=p.parentNode}return!1}function ep(p){return new cg(p)}class cg extends Se{constructor(e){super(),this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let t=Gl(document.activeElement,e),n=!1;const o=()=>{n=!1,t||(t=!0,this._onDidFocus.fire())},h=()=>{t&&(n=!0,window.setTimeout(()=>{n&&(n=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{Gl(document.activeElement,e)!==t&&(t?h():o())},this.addDisposables(be(e,"focus",o,!0)),this.addDisposables(be(e,"blur",h,!0))}refreshState(){this._refreshStateHandler()}}const tp="dv-quasiPreventDefault";function ip(p){p[tp]=!0}function su(p){return p[tp]}function dg(p,e,t={}){const n=Array.from(e),{nonce:o}=t,h=typeof o=="function"?o(p):o;for(const w of n){if(w.href){const u=p.createElement("link");u.href=w.href,u.type=w.type,u.rel="stylesheet",p.head.appendChild(u);continue}let a=[];try{w.cssRules&&(a=Array.from(w.cssRules).map(u=>u.cssText))}catch(u){console.warn("dockview: failed to access stylesheet rules due to security restrictions",u)}const l=p.createDocumentFragment();for(const u of a){const d=p.createElement("style");h&&d.setAttribute("nonce",h),d.appendChild(p.createTextNode(u)),l.appendChild(d)}p.head.appendChild(l)}}function Nl(p){const{left:e,top:t,width:n,height:o}=p.getBoundingClientRect();return{left:e+window.scrollX,top:t+window.scrollY,width:n,height:o}}function ug(p){let e=p;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function pg(p,e){p.setAttribute("data-testid",e)}function fg(p,e){const t=[];function n(h){if(h.nodeType===Node.ELEMENT_NODE){p.includes(h.tagName)&&t.push(h),h.shadowRoot&&n(h.shadowRoot);for(const w of h.children)n(w)}}const o=e instanceof Document?e.documentElement:e;return n(o),t}function ar(p=document){const e=fg(["IFRAME","WEBVIEW"],p),t=new WeakMap;for(const n of e)t.set(n,n.style.pointerEvents),n.style.pointerEvents="none";return{release:()=>{var n;for(const o of e)o.style.pointerEvents=(n=t.get(o))!==null&&n!==void 0?n:"auto";e.splice(0,e.length)}}}function mg(p){function e(o){const h=[];for(let w=0;w<o.classList.length;w++)h.push(o.classList.item(w));return h}let t,n=p;for(;n!==null&&(t=e(n).find(o=>o.startsWith("dockview-theme-")),typeof t!="string");)n=n.parentElement;return t}class Oo{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const t of this._classNames)we(this.element,t,!1);this._classNames=e.split(" ").filter(t=>t.trim().length>0);for(const t of this._classNames)we(this.element,t,!0)}}const sp=100;function nu(p,e){const t=Nl(p),n=Nl(e);return!(t.left<n.left||t.left+t.width>n.left+n.width||t.top<n.top||t.top+t.height>n.top+n.height)}function gg(p){const e=new Q;let t=p.screenX,n=p.screenY,o;const h=()=>{if(p.closed)return;const w=p.screenX,a=p.screenY;(w!==t||a!==n)&&(clearTimeout(o),o=setTimeout(()=>{e.fire()},sp),t=w,n=a),requestAnimationFrame(h)};return h(),e}function vg(p,e){let t;return new Se(be(p,"resize",()=>{clearTimeout(t),t=setTimeout(()=>{e()},sp)}))}function _g(p,e,t={buffer:10}){const n=t.buffer,o=p.getBoundingClientRect(),h=e.getBoundingClientRect();let w=0,a=0;const l=o.left-h.left,u=o.top-h.top,d=o.bottom-h.bottom,c=o.right-h.right;l<n?w=n-l:c>n&&(w=-n-c),u<n?a=n-u:d>n&&(a=-d-n),(w!==0||a!==0)&&(p.style.transform=`translate(${w}px, ${a}px)`)}function np(p){let e=p;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function ji(p){if(p.length===0)throw new Error("Invalid tail call");return[p.slice(0,p.length-1),p[p.length-1]]}function rp(p,e){if(p.length!==e.length)return!1;for(let t=0;t<p.length;t++)if(p[t]!==e[t])return!1;return!0}function Dl(p,e){const t=p.indexOf(e);t>-1&&(p.splice(t,1),p.unshift(e))}function yo(p,e){const t=p.indexOf(e);t>-1&&(p.splice(t,1),p.push(e))}function wg(p,e){for(let t=0;t<p.length;t++){const n=p[t];if(e(n))return t}return-1}function op(p,e){const t=p.findIndex(n=>n===e);return t>-1?(p.splice(t,1),!0):!1}const et=(p,e,t)=>e>t?e:Math.min(t,Math.max(p,e)),sh=()=>{let p=1;return{next:()=>(p++).toString()}},vi=(p,e)=>{const t=[];if(typeof e!="number"&&(e=p,p=0),p<=e)for(let n=p;n<e;n++)t.push(n);else for(let n=p;n>e;n--)t.push(n);return t};class bg{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,n,o){this.container=e,this.view=t,this.disposable=o,this._cachedVisibleSize=void 0,typeof n=="number"?(this._size=n,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=n.cachedVisibleSize)}setVisible(e,t){var n;e!==this.visible&&(e?(this.size=et((n=this._cachedVisibleSize)!==null&&n!==void 0?n:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var Pe;(function(p){p.HORIZONTAL="HORIZONTAL",p.VERTICAL="VERTICAL"})(Pe||(Pe={}));var ii;(function(p){p[p.MAXIMUM=0]="MAXIMUM",p[p.MINIMUM=1]="MINIMUM",p[p.DISABLED=2]="DISABLED",p[p.ENABLED=3]="ENABLED"})(ii||(ii={}));var ht;(function(p){p.Low="low",p.High="high",p.Normal="normal"})(ht||(ht={}));var Wt;(function(p){p.Distribute={type:"distribute"};function e(n){return{type:"split",index:n}}p.Split=e;function t(n){return{type:"invisible",cachedVisibleSize:n}}p.Invisible=t})(Wt||(Wt={}));class zs{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const t=this.size;this.size=this.orthogonalSize,this.orthogonalSize=t,bi(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==Pe.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,we(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,we(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,t){var n,o;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new Q,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(h,w,a=this.viewItems.map(S=>S.size),l,u,d=Number.NEGATIVE_INFINITY,c=Number.POSITIVE_INFINITY,b,C)=>{if(h<0||h>this.viewItems.length)return 0;const S=vi(h,-1),y=vi(h+1,this.viewItems.length);if(u)for(const V of u)Dl(S,V),Dl(y,V);if(l)for(const V of l)yo(S,V),yo(y,V);const g=S.map(V=>this.viewItems[V]),_=S.map(V=>a[V]),m=y.map(V=>this.viewItems[V]),v=y.map(V=>a[V]),D=S.reduce((V,K)=>V+this.viewItems[K].minimumSize-a[K],0),P=S.reduce((V,K)=>V+this.viewItems[K].maximumSize-a[K],0),T=y.length===0?Number.POSITIVE_INFINITY:y.reduce((V,K)=>V+a[K]-this.viewItems[K].minimumSize,0),A=y.length===0?Number.NEGATIVE_INFINITY:y.reduce((V,K)=>V+a[K]-this.viewItems[K].maximumSize,0),E=Math.max(D,A),I=Math.min(T,P);let B=!1;if(b){const V=this.viewItems[b.index],K=w>=b.limitDelta;B=K!==V.visible,V.setVisible(K,b.size)}if(!B&&C){const V=this.viewItems[C.index],K=w<C.limitDelta;B=K!==V.visible,V.setVisible(K,C.size)}if(B)return this.resize(h,w,a,l,u,d,c);const N=et(w,E,I);let W=0,F=N;for(let V=0;V<g.length;V++){const K=g[V],ie=et(_[V]+F,K.minimumSize,K.maximumSize),Z=ie-_[V];W+=Z,F-=Z,K.size=ie}let q=W;for(let V=0;V<m.length;V++){const K=m[V],ie=et(v[V]-q,K.minimumSize,K.maximumSize),Z=ie-v[V];q+=Z,K.size=ie}return w},this._orientation=(n=t.orientation)!==null&&n!==void 0?n:Pe.VERTICAL,this.element=this.createContainer(),this.margin=(o=t.margin)!==null&&o!==void 0?o:0,this.proportionalLayout=t.proportionalLayout===void 0?!0:!!t.proportionalLayout,this.viewContainer=this.createViewContainer(),this.sashContainer=this.createSashContainer(),this.element.appendChild(this.sashContainer),this.element.appendChild(this.viewContainer),this.container.appendChild(this.element),this.style(t.styles),t.descriptor&&(this._size=t.descriptor.size,t.descriptor.views.forEach((h,w)=>{const a=h.visible===void 0||h.visible?h.size:{type:"invisible",cachedVisibleSize:h.size},l=h.view;this.addView(l,a,w,!0)}),this._contentSize=this.viewItems.reduce((h,w)=>h+w.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(bi(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(yi(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const n=this.viewItems[e];n.setVisible(t,n.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,t){if(e<0||e>=this.viewItems.length)return;const n=vi(this.viewItems.length).filter(a=>a!==e),o=[...n.filter(a=>this.viewItems[a].priority===ht.Low),e],h=n.filter(a=>this.viewItems[a].priority===ht.High),w=this.viewItems[e];t=Math.round(t),t=et(t,w.minimumSize,Math.min(w.maximumSize,this._size)),w.size=t,this.relayout(o,h)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,t){const n=this.viewItems.indexOf(e);if(n<0||n>=this.viewItems.length)return;t=typeof t=="number"?t:e.size,t=et(t,e.minimumSize,e.maximumSize),e.size=t;const o=vi(this.viewItems.length).filter(a=>a!==n),h=[...o.filter(a=>this.viewItems[a].priority===ht.Low),n],w=o.filter(a=>this.viewItems[a].priority===ht.High);this.relayout([...h,n],w)}addView(e,t={type:"distribute"},n=this.viewItems.length,o){const h=document.createElement("div");h.className="dv-view",h.appendChild(e.element);let w;typeof t=="number"?w=t:t.type==="split"?w=this.getViewSize(t.index)/2:t.type==="invisible"?w={cachedVisibleSize:t.cachedVisibleSize}:w=e.minimumSize;const a=e.onDidChange(u=>this.onDidChange(l,u.size)),l=new bg(h,e,w,{dispose:()=>{a.dispose(),this.viewContainer.removeChild(h)}});if(n===this.viewItems.length?this.viewContainer.appendChild(h):this.viewContainer.insertBefore(h,this.viewContainer.children.item(n)),this.viewItems.splice(n,0,l),this.viewItems.length>1){const u=document.createElement("div");u.className="dv-sash";const d=b=>{for(const V of this.viewItems)V.enabled=!1;const C=ar(),S=this._orientation===Pe.HORIZONTAL?b.clientX:b.clientY,y=wg(this.sashes,V=>V.container===u),g=this.viewItems.map(V=>V.size);let _,m;const v=vi(y,-1),D=vi(y+1,this.viewItems.length),P=v.reduce((V,K)=>V+(this.viewItems[K].minimumSize-g[K]),0),T=v.reduce((V,K)=>V+(this.viewItems[K].viewMaximumSize-g[K]),0),A=D.length===0?Number.POSITIVE_INFINITY:D.reduce((V,K)=>V+(g[K]-this.viewItems[K].minimumSize),0),E=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((V,K)=>V+(g[K]-this.viewItems[K].viewMaximumSize),0),I=Math.max(P,E),B=Math.min(A,T),N=this.findFirstSnapIndex(v),W=this.findFirstSnapIndex(D);if(typeof N=="number"){const V=this.viewItems[N],K=Math.floor(V.viewMinimumSize/2);_={index:N,limitDelta:V.visible?I-K:I+K,size:V.size}}if(typeof W=="number"){const V=this.viewItems[W],K=Math.floor(V.viewMinimumSize/2);m={index:W,limitDelta:V.visible?B+K:B-K,size:V.size}}const F=V=>{const ie=(this._orientation===Pe.HORIZONTAL?V.clientX:V.clientY)-S;this.resize(y,ie,g,void 0,void 0,I,B,_,m),this.distributeEmptySpace(),this.layoutViews()},q=()=>{for(const V of this.viewItems)V.enabled=!0;C.release(),this.saveProportions(),document.removeEventListener("pointermove",F),document.removeEventListener("pointerup",q),document.removeEventListener("pointercancel",q),document.removeEventListener("contextmenu",q),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",F),document.addEventListener("pointerup",q),document.addEventListener("pointercancel",q),document.addEventListener("contextmenu",q)};u.addEventListener("pointerdown",d);const c={container:u,disposable:()=>{u.removeEventListener("pointerdown",d),this.sashContainer.removeChild(u)}};this.sashContainer.appendChild(u),this.sashes.push(c)}o||this.relayout([n]),!o&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const n=Math.floor(t/e.length);for(const a of e)a.size=et(n,a.minimumSize,a.maximumSize);const o=vi(this.viewItems.length),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);this.relayout(h,w)}removeView(e,t,n=!1){const o=this.viewItems.splice(e,1)[0];if(o.dispose(),this.viewItems.length>=1){const h=Math.max(e-1,0);this.sashes.splice(h,1)[0].disposable()}return n||this.relayout(),t&&t.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(o.view),o.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,t){const n=this.getViewCachedVisibleSize(e),o=typeof n>"u"?this.getViewSize(e):Wt.Invisible(n),h=this.removeView(e,void 0,!0);this.addView(h,o,t)}layout(e,t){const n=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=t,this.proportions){let o=0;for(let h=0;h<this.viewItems.length;h++){const w=this.viewItems[h],a=this.proportions[h];typeof a=="number"?o+=a:e-=w.size}for(let h=0;h<this.viewItems.length;h++){const w=this.viewItems[h],a=this.proportions[h];typeof a=="number"&&o>0&&(w.size=et(Math.round(a*e/o),w.minimumSize,w.maximumSize))}}else{const o=vi(this.viewItems.length),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);this.resize(this.viewItems.length-1,e-n,void 0,h,w)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,t){const n=this.viewItems.reduce((o,h)=>o+h.size,0);this.resize(this.viewItems.length-1,this._size-n,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const t=this.viewItems.reduce((a,l)=>a+l.size,0);let n=this.size-t;const o=vi(this.viewItems.length-1,-1),h=o.filter(a=>this.viewItems[a].priority===ht.Low),w=o.filter(a=>this.viewItems[a].priority===ht.High);for(const a of w)Dl(o,a);for(const a of h)yo(o,a);typeof e=="number"&&yo(o,e);for(let a=0;n!==0&&a<o.length;a++){const l=this.viewItems[o[a]],u=et(l.size+n,l.minimumSize,l.maximumSize),d=u-l.size;n-=d,l.size=u}}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((l,u)=>l+u.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(l=>l.visible),t=Math.max(0,e.length-1),n=this.margin*t/Math.max(1,e.length);let o=0;const h=[],w=4,a=this.viewItems.reduce((l,u,d)=>{const c=u.visible?1:0;return d===0?l.push(c):l.push(l[d-1]+c),l},[]);this.viewItems.forEach((l,u)=>{o+=this.viewItems[u].size,h.push(o);const d=l.visible?l.size-n:0,c=Math.max(0,a[u]-1),b=u===0||c===0?0:h[u-1]+c/t*n;if(u<this.viewItems.length-1){const C=l.visible?b+d-w/2+this.margin/2:b;this._orientation===Pe.HORIZONTAL&&(this.sashes[u].container.style.left=`${C}px`,this.sashes[u].container.style.top="0px"),this._orientation===Pe.VERTICAL&&(this.sashes[u].container.style.left="0px",this.sashes[u].container.style.top=`${C}px`)}this._orientation===Pe.HORIZONTAL&&(l.container.style.width=`${d}px`,l.container.style.left=`${b}px`,l.container.style.top="",l.container.style.height=""),this._orientation===Pe.VERTICAL&&(l.container.style.height=`${d}px`,l.container.style.top=`${b}px`,l.container.style.width="",l.container.style.left=""),l.view.layout(l.size-n,this._orthogonalSize)})}findFirstSnapIndex(e){for(const t of e){const n=this.viewItems[t];if(n.visible&&n.snap)return t}for(const t of e){const n=this.viewItems[t];if(n.visible&&n.maximumSize-n.minimumSize>0)return;if(!n.visible&&n.snap)return t}}updateSashEnablement(){let e=!1;const t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;const n=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),o=[...this.viewItems].reverse();e=!1;const h=o.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;const w=o.map(l=>e=l.maximumSize-l.size>0||e).reverse();let a=0;for(let l=0;l<this.sashes.length;l++){const u=this.sashes[l],d=this.viewItems[l];a+=d.size;const c=!(t[l]&&w[l+1]),b=!(n[l]&&h[l+1]);if(c&&b){const C=vi(l,-1),S=vi(l+1,this.viewItems.length),y=this.findFirstSnapIndex(C),g=this.findFirstSnapIndex(S),_=typeof y=="number"&&!this.viewItems[y].visible,m=typeof g=="number"&&!this.viewItems[g].visible;_&&h[l]&&(a>0||this.startSnappingEnabled)?this.updateSash(u,ii.MINIMUM):m&&t[l]&&(a<this._contentSize||this.endSnappingEnabled)?this.updateSash(u,ii.MAXIMUM):this.updateSash(u,ii.DISABLED)}else c&&!b?this.updateSash(u,ii.MINIMUM):!c&&b?this.updateSash(u,ii.MAXIMUM):this.updateSash(u,ii.ENABLED)}}updateSash(e,t){we(e.container,"dv-disabled",t===ii.DISABLED),we(e.container,"dv-enabled",t===ii.ENABLED),we(e.container,"dv-maximum",t===ii.MAXIMUM),we(e.container,"dv-minimum",t===ii.MINIMUM)}createViewContainer(){const e=document.createElement("div");return e.className="dv-view-container",e}createSashContainer(){const e=document.createElement("div");return e.className="dv-sash-container",e}createContainer(){const e=document.createElement("div"),t=this._orientation===Pe.HORIZONTAL?"dv-horizontal":"dv-vertical";return e.className=`dv-split-view-container ${t}`,e}dispose(){this._onDidSashEnd.dispose(),this._onDidAddView.dispose(),this._onDidRemoveView.dispose();for(let e=0;e<this.element.children.length;e++)if(this.element.children.item(e)===this.element){this.element.removeChild(this.element);break}for(const e of this.viewItems)e.dispose();this.element.remove()}}const zl=Object.keys({orientation:void 0,descriptor:void 0,proportionalLayout:void 0,styles:void 0,margin:void 0,disableAutoResizing:void 0,className:void 0});class ru extends Se{get onDidAddView(){return this.splitview.onDidAddView}get onDidRemoveView(){return this.splitview.onDidRemoveView}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get orientation(){return this.splitview.orientation}get size(){return this.splitview.size}get orthogonalSize(){return this.splitview.orthogonalSize}constructor(e,t){var n;super(),this.paneItems=[],this.skipAnimation=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orientation=(n=t.orientation)!==null&&n!==void 0?n:Pe.VERTICAL,this.element=document.createElement("div"),this.element.className="dv-pane-container",e.appendChild(this.element),this.splitview=new zs(this.element,{orientation:this._orientation,proportionalLayout:!1,descriptor:t.descriptor}),this.getPanes().forEach(o=>{const h=new Se(o.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),w={pane:o,disposable:{dispose:()=>{h.dispose()}}};this.paneItems.push(w),o.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,t){this.splitview.setViewVisible(e,t)}addPane(e,t,n=this.splitview.length,o=!1){const h=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),w={pane:e,disposable:{dispose:()=>{h.dispose()}}};this.paneItems.splice(n,0,w),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,t,n,o)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,t={skipDispose:!1}){const n=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),t.skipDispose||(n.disposable.dispose(),n.pane.dispose()),n}moveView(e,t){if(e===t)return;const n=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(n.pane,n.pane.size,t,!1)}finally{this.skipAnimation=!1}}layout(e,t){this.splitview.layout(e,t)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),yi(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,bi(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class St{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===Pe.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===Pe.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===Pe.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===Pe.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===Pe.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===Pe.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,t,n,o=0){this.view=e,this.orientation=t,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orthogonalSize=n,this._size=o,this._disposable=this.view.onDidChange(h=>{h?this._onDidChange.fire({size:this.orientation===Pe.VERTICAL?h.width:h.height,orthogonalSize:this.orientation===Pe.VERTICAL?h.height:h.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,t){this._size=e,this._orthogonalSize=t,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class lt extends Se{get width(){return this.orientation===Pe.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===Pe.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,t)=>this.splitview.isViewVisible(t)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===Pe.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===Pe.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===Pe.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===Pe.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return ht.Normal;const e=this.children.map(t=>typeof t.priority>"u"?ht.Normal:t.priority);return e.some(t=>t===ht.High)?ht.High:e.some(t=>t===ht.Low)?ht.Low:ht.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(t=>{t instanceof lt&&(t.margin=e)})}constructor(e,t,n,o,h,w,a,l){if(super(),this.orientation=e,this.proportionalLayout=t,this.styles=n,this._childrenDisposable=Ve.NONE,this.children=[],this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new Q,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=h,this._size=o,this.element=document.createElement("div"),this.element.className="dv-branch-node",!l)this.splitview=new zs(this.element,{orientation:this.orientation,proportionalLayout:t,styles:n,margin:a}),this.splitview.layout(this.size,this.orthogonalSize);else{const u={views:l.map(d=>({view:d.node,size:d.node.size,visible:d.node instanceof St&&d.visible!==void 0?d.visible:!0})),size:this.orthogonalSize};this.children=l.map(d=>d.node),this.splitview=new zs(this.element,{orientation:this.orientation,descriptor:u,proportionalLayout:t,styles:n,margin:a})}this.disabled=w,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===t)return;const n=this.splitview.contentSize===0;this.splitview.setViewVisible(e,t);const o=this.splitview.contentSize===0;(t&&n||!t&&o)&&this._onDidVisibilityChange.fire({visible:t})}moveChild(e,t){if(e===t)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e<t&&t--,this.splitview.moveView(e,t);const n=this._removeChild(e);this._addChild(n,t)}getChildSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,t)}layout(e,t){this._size=t,this._orthogonalSize=e,this.splitview.layout(t,e)}addChild(e,t,n,o){if(n<0||n>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,t,n,o),this._addChild(e,n)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,t){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,t),this._removeChild(e)}_addChild(e,t){this.children.splice(t,0,e),this.setupChildrenEvents()}_removeChild(e){const[t]=this.children.splice(e,1);return this.setupChildrenEvents(),t}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Se(ri.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,t)=>e instanceof lt?e.onDidVisibilityChange(({visible:n})=>{this.setChildVisible(t,n)}):Ve.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function Bl(p,e){if(p instanceof St)return p;if(p instanceof lt)return Bl(p.children[e?p.children.length-1:0],e);throw new Error("invalid node")}function ap(p,e,t){if(p instanceof lt){const n=new lt(p.orientation,p.proportionalLayout,p.styles,e,t,p.disabled,p.margin);for(let o=p.children.length-1;o>=0;o--){const h=p.children[o];n.addChild(ap(h,h.size,h.orthogonalSize),h.size,0,!0)}return n}else return new St(p.view,p.orientation,t)}function Hl(p,e,t){if(p instanceof lt){const n=new lt(Ti(p.orientation),p.proportionalLayout,p.styles,e,t,p.disabled,p.margin);let o=0;for(let h=p.children.length-1;h>=0;h--){const w=p.children[h],a=w instanceof lt?w.orthogonalSize:w.size;let l=p.size===0?0:Math.round(e*a/p.size);o+=l,h===0&&(l+=e-o),n.addChild(Hl(w,t,l),l,0,!0)}return n}else return new St(p.view,Ti(p.orientation),t)}function yg(p){const e=p.parentElement;if(!e)throw new Error("Invalid grid element");let t=e.firstElementChild,n=0;for(;t!==p&&t!==e.lastElementChild&&t;)t=t.nextElementSibling,n++;return n}function Je(p){const e=p.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const t=yg(e),n=e.parentElement.parentElement.parentElement;return[...Je(n),t]}function si(p,e,t){const n=Cg(p,e),o=Sg(t);if(n===o){const[h,w]=ji(e);let a=w;return(t==="right"||t==="bottom")&&(a+=1),[...h,a]}else{const h=t==="right"||t==="bottom"?1:0;return[...e,h]}}function Sg(p){return p==="top"||p==="bottom"?Pe.VERTICAL:Pe.HORIZONTAL}function Cg(p,e){return e.length%2===0?Ti(p):p}const Ti=p=>p===Pe.HORIZONTAL?Pe.VERTICAL:Pe.HORIZONTAL;function xg(p){return!!p.children}const Fl=(p,e)=>{const t=e===Pe.VERTICAL?p.box.width:p.box.height;return xg(p)?{type:"branch",data:p.children.map(n=>Fl(n,Ti(e))),size:t}:typeof p.cachedVisibleSize=="number"?{type:"leaf",data:p.view.toJSON(),size:p.cachedVisibleSize,visible:!1}:{type:"leaf",data:p.view.toJSON(),size:t}};class lp{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:t,orthogonalSize:n}=this.root;this.root=Hl(this.root,n,t),this.root.layout(t,n)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const t=[this.root];for(;t.length>0;){const n=t.pop();n instanceof lt&&(n.disabled=e,t.push(...n.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var t;const n=Je(e.element),[o,h]=this.getNode(n);if(!(h instanceof St)||((t=this._maximizedNode)===null||t===void 0?void 0:t.leaf)===h)return;this.hasMaximizedView()&&this.exitMaximizedView(),Fl(this.getView(),this.orientation);const w=[];function a(l,u){for(let d=0;d<l.children.length;d++){const c=l.children[d];c instanceof St?c!==u&&(l.isChildVisible(d)?l.setChildVisible(d,!1):w.push(c)):a(c,u)}}a(this.root,h),this._maximizedNode={leaf:h,hiddenOnMaximize:w},this._onDidMaximizedNodeChange.fire({view:h.view,isMaximized:!0})}exitMaximizedView(){if(!this._maximizedNode)return;const e=this._maximizedNode.hiddenOnMaximize;function t(o){for(let h=o.children.length-1;h>=0;h--){const w=o.children[h];w instanceof St?e.includes(w)||o.setChildVisible(h,!0):t(w)}}t(this.root);const n=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:n.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let t;e&&(t=Je(e.element));const n=this._onDidMaximizedNodeChange.pause();try{this.hasMaximizedView()&&this.exitMaximizedView();const h={root:Fl(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return t&&(h.maximizedNode={location:t}),e&&this.maximizeView(e),h}finally{n.dispose()}}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new lt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,t){const n=e.orientation,o=n===Pe.VERTICAL?e.height:e.width;if(this._deserialize(e.root,n,t,o),this.layout(e.width,e.height),e.maximizedNode){const h=e.maximizedNode.location,[w,a]=this.getNode(h);if(!(a instanceof St))return;this.maximizeView(a.view)}}_deserialize(e,t,n,o){this.root=this._deserializeNode(e,t,n,o)}_deserializeNode(e,t,n,o){var h;let w;if(e.type==="branch"){const l=e.data.map(u=>({node:this._deserializeNode(u,Ti(t),n,e.size),visible:u.visible}));w=new lt(t,this.proportionalLayout,this.styles,e.size,o,this.locked,this.margin,l)}else{const a=n.fromJSON(e);typeof e.visible=="boolean"&&((h=a.setVisible)===null||h===void 0||h.call(a,e.visible)),w=new St(a,t,o,e.size)}return w}get root(){return this._root}set root(e){const t=this._root;t&&(t.dispose(),this._maximizedNode=void 0,this.element.removeChild(t.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,t=e.children[0];if(t instanceof St)return;e.element.remove();const n=e.removeChild(0);e.dispose(),n.dispose(),this._root=ap(t,t.size,t.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(o=>{this._onDidChange.fire(o)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new lt(Ti(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const t=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Hl(t,t.orthogonalSize,t.size),Wt.Distribute,0)}else this._root.addChild(e,Wt.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(t=>{this._onDidChange.fire(t)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const t=e?this.getNode(e)[1]:this.root;return this._getViews(t,this.orientation)}_getViews(e,t,n){const o={height:e.height,width:e.width};if(e instanceof St)return{box:o,view:e.view,cachedVisibleSize:n};const h=[];for(let w=0;w<e.children.length;w++){const a=e.children[w],l=e.getChildCachedVisibleSize(w);h.push(this._getViews(a,Ti(t),l))}return{box:o,children:h}}progmaticSelect(e,t=!1){const[n,o]=this.getNode(e);if(!(o instanceof St))throw new Error("invalid location");for(let h=n.length-1;h>-1;h--){const w=n[h],a=e[h]||0;if(t?a-1>-1:a+1<w.children.length)return Bl(w.children[t?a-1:a+1],t)}return Bl(this.root,t)}constructor(e,t,n,o,h){this.proportionalLayout=e,this.styles=t,this._locked=!1,this._margin=0,this._maximizedNode=void 0,this.disposable=new ft,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidViewVisibilityChange=new Q,this.onDidViewVisibilityChange=this._onDidViewVisibilityChange.event,this._onDidMaximizedNodeChange=new Q,this.onDidMaximizedNodeChange=this._onDidMaximizedNodeChange.event,this.element=document.createElement("div"),this.element.className="dv-grid-view",this._locked=o??!1,this._margin=h??0,this.root=new lt(n,e,t,0,0,this.locked,this.margin)}isViewVisible(e){const[t,n]=ji(e),[,o]=this.getNode(t);if(!(o instanceof lt))throw new Error("Invalid from location");return o.isChildVisible(n)}setViewVisible(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[n,o]=ji(e),[,h]=this.getNode(n);if(!(h instanceof lt))throw new Error("Invalid from location");this._onDidViewVisibilityChange.fire(),h.setChildVisible(o,t)}moveView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[,o]=this.getNode(e);if(!(o instanceof lt))throw new Error("Invalid location");o.moveChild(t,n)}addView(e,t,n){this.hasMaximizedView()&&this.exitMaximizedView();const[o,h]=ji(n),[w,a]=this.getNode(o);if(a instanceof lt){const l=new St(e,Ti(a.orientation),a.orthogonalSize);a.addChild(l,t,h)}else{const[l,...u]=[...w].reverse(),[d,...c]=[...o].reverse();let b=0;const C=l.getChildCachedVisibleSize(d);typeof C=="number"&&(b=Wt.Invisible(C)),l.removeChild(d).dispose();const y=new lt(a.orientation,this.proportionalLayout,this.styles,a.size,a.orthogonalSize,this.locked,this.margin);l.addChild(y,a.size,d);const g=new St(a.view,l.orientation,a.size);y.addChild(g,b,0),typeof t!="number"&&t.type==="split"&&(t={type:"split",index:0});const _=new St(e,l.orientation,a.size);y.addChild(_,t,h)}}remove(e,t){const n=Je(e.element);return this.removeView(n,t)}removeView(e,t){this.hasMaximizedView()&&this.exitMaximizedView();const[n,o]=ji(e),[h,w]=this.getNode(n);if(!(w instanceof lt))throw new Error("Invalid location");const a=w.children[o];if(!(a instanceof St))throw new Error("Invalid location");if(w.removeChild(o,t),a.dispose(),w.children.length!==1)return a.view;const l=w.children[0];if(h.length===0)return l instanceof St||(w.removeChild(0,t),this.root=l),a.view;const[u,...d]=[...h].reverse(),[c,...b]=[...n].reverse(),C=w.isChildVisible(0);w.removeChild(0,t);const S=u.children.map((y,g)=>u.getChildSize(g));if(u.removeChild(c,t).dispose(),l instanceof lt){S.splice(c,1,...l.children.map(y=>y.size));for(let y=0;y<l.children.length;y++){const g=l.children[y];u.addChild(g,g.size,c+y)}for(;l.children.length>0;)l.removeChild(0)}else{const y=new St(l.view,Ti(l.orientation),l.size),g=C?l.orthogonalSize:Wt.Invisible(l.orthogonalSize);u.addChild(y,g,c)}l.dispose();for(let y=0;y<S.length;y++)u.resizeChild(y,S[y]);return a.view}layout(e,t){const[n,o]=this.root.orientation===Pe.HORIZONTAL?[t,e]:[e,t];this.root.layout(n,o)}getNode(e,t=this.root,n=[]){if(e.length===0)return[n,t];if(!(t instanceof lt))throw new Error("Invalid location");const[o,...h]=e;if(o<0||o>=t.children.length)throw new Error("Invalid location");const w=t.children[o];return n.push(t),this.getNode(h,w,n)}}const Wl=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class nh extends Se{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,t=!1){super(),this._lastWidth=-1,this._lastHeight=-1,this._disableResizing=t,this._element=e,this.addDisposables(cr(this._element,n=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!ug(this._element))return;const o=Math.round(n.contentRect.width),h=Math.round(n.contentRect.height);o===this._lastWidth&&h===this._lastHeight||(this._lastWidth=o,this._lastHeight=h,this.layout(o,h))}))}}const Dg=sh();function Lo(p){switch(p){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class hp extends nh{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._id=Dg.next(),this._groups=new Map,this._onDidRemove=new Q,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new Q,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new Q,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new Q,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new iu,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new iu,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this.gridview=new lp(!!t.proportionalLayout,t.styles,t.orientation,t.locked,t.margin),this.gridview.locked=!!t.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(o=>{this._onDidMaximizedChange.fire({panel:o.view,isMaximized:o.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.forceRelayout()}),Ve.from(()=>{var o;(o=this.element.parentElement)===null||o===void 0||o.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),ri.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,t){this.gridview.setViewVisible(Je(e.element),t),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(Je(e.element))}updateOptions(e){var t,n,o,h;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(t=e.disableAutoResizing)!==null&&t!==void 0?t:!1),"locked"in e&&(this.locked=(n=e.locked)!==null&&n!==void 0?n:!1),"margin"in e&&(this.gridview.margin=(o=e.margin)!==null&&o!==void 0?o:0),"className"in e&&this._classNames.setClassNames((h=e.className)!==null&&h!==void 0?h:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,t=[0],n,o=this.gridview){o.addView(e,n??Wt.Distribute,t),this._onDidAdd.fire(e)}doRemoveGroup(e,t){if(!this._groups.has(e.id))throw new Error("invalid operation");const n=this._groups.get(e.id),o=this.gridview.remove(e,Wt.Distribute);if(n&&!(t!=null&&t.skipDispose)&&(n.disposable.dispose(),n.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(t!=null&&t.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupActive(h.length>0?h[0].value:void 0)}return o}getPanel(e){var t;return(t=this._groups.get(e))===null||t===void 0?void 0:t.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const n=Je(e.group.element),o=(t=this.gridview.next(n))===null||t===void 0?void 0:t.view;this.doSetGroupActive(o)}moveToPrevious(e){var t;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const n=Je(e.group.element),o=(t=this.gridview.previous(n))===null||t===void 0?void 0:t.view;this.doSetGroupActive(o)}forceRelayout(){this.layout(this.width,this.height,!0)}layout(e,t,n){(n||e!==this.width||t!==this.height)&&(this.gridview.element.style.height=`${t}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,t))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class cp{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,t){this.component.removePanel(e,t)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,t){return this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class lr{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,t){this.component.movePanel(e,t)}focus(){this.component.focus()}layout(e,t){this.component.layout(e,t)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class dp{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,t,n=!1){this.component.layout(e,t,n)}addPanel(e){return this.component.addPanel(e)}removePanel(e,t){this.component.removePanel(e,t)}movePanel(e,t){this.component.movePanel(e,t)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class rh{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get tabGroupColors(){return this.component.tabGroupColorPalette.entries()}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillMutateLayout(){return this.component.onWillMutateLayout}get onDidMutateLayout(){return this.component.onDidMutateLayout}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOver(){return this.component.onUnhandledDragOver}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidAddPopoutGroup(){return this.component.onDidAddPopoutGroup}get onDidRemovePopoutGroup(){return this.component.onDidRemovePopoutGroup}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}getPopouts(){return this.component.getPopouts()}get onDidCreateTabGroup(){return this.component.onDidCreateTabGroup}get onDidDestroyTabGroup(){return this.component.onDidDestroyTabGroup}get onDidAddPanelToTabGroup(){return this.component.onDidAddPanelToTabGroup}get onDidRemovePanelFromTabGroup(){return this.component.onDidRemovePanelFromTabGroup}get onDidTabGroupChange(){return this.component.onDidTabGroupChange}get onDidTabGroupCollapsedChange(){return this.component.onDidTabGroupCollapsedChange}get panels(){return this.component.panels}get groups(){return this.component.groups}adjacentGroupInDirection(e,t){return this.component.adjacentGroupInDirection(e,t)}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,t,n=!1){this.component.layout(e,t,n)}addPanel(e){return this.component.withOrigin("api",()=>this.component.addPanel(e))}removePanel(e){this.component.withOrigin("api",()=>this.component.removePanel(e))}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.withOrigin("api",()=>this.component.closeAllGroups())}removeGroup(e){this.component.withOrigin("api",()=>this.component.removeGroup(e))}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,t){return this.component.withOrigin("api",()=>this.component.addFloatingGroup(e,t))}fromJSON(e,t){this.component.withOrigin("api",()=>this.component.fromJSON(e,t))}toJSON(){return this.component.toJSON()}clear(){this.component.withOrigin("api",()=>this.component.clear())}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,t){return this.component.withOrigin("api",()=>this.component.addPopoutGroup(e,t))}addEdgeGroup(e,t){return this.component.addEdgeGroup(e,t)}getEdgeGroup(e){return this.component.getEdgeGroup(e)}setEdgeGroupVisible(e,t){this.component.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this.component.isEdgeGroupVisible(e)}removeEdgeGroup(e){this.component.removeEdgeGroup(e)}updateOptions(e){this.component.updateOptions(e)}_getGroupModel(e){const t=this.component.getPanel(e);if(!t)throw new Error(`dockview: group '${e}' not found`);return t.model}createTabGroup(e){const t=this._getGroupModel(e.groupId);return this.component.withOrigin("api",()=>t.createTabGroup({label:e.label,color:e.color,componentParams:e.componentParams}))}dissolveTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.dissolveTabGroup(e.tabGroupId))}addPanelToTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.addPanelToTabGroup(e.tabGroupId,e.panelId,e.index))}removePanelFromTabGroup(e){const t=this._getGroupModel(e.groupId);this.component.withOrigin("api",()=>t.removePanelFromTabGroup(e.panelId))}getTabGroups(e){return this._getGroupModel(e.groupId).getTabGroups()}getTabGroupForPanel(e){return this._getGroupModel(e.groupId).getTabGroupForPanel(e.panelId)}moveTabGroup(e){this._getGroupModel(e.groupId).moveTabGroup(e.tabGroupId,e.index)}dispose(){this.component.dispose()}}class up extends Se{constructor(e,t){super(),this.element=e,this.callbacks=t,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(be(this.element,"drop",e=>{this.onDrop(e)}))}}const Eg={value:50,type:"percentage"},kg=100,Pg=100;function Vl(){const p=document.createElement("div");p.className="dv-drop-target-dropzone";const e=document.createElement("div");return e.className="dv-drop-target-selection",p.appendChild(e),{dropzone:p,selection:e}}function pp(p,e,t,n){var o,h,w;const a=(o=n==null?void 0:n.smallWidthBoundary)!==null&&o!==void 0?o:kg,l=(h=n==null?void 0:n.smallHeightBoundary)!==null&&h!==void 0?h:Pg,u=e<a,d=t<l,c=p==="left",b=p==="right",C=p==="top",S=p==="bottom",y=!u&&b,g=!u&&c,_=!d&&C,m=!d&&S;let v=1;const D=(w=n==null?void 0:n.size)!==null&&w!==void 0?w:Eg;return D.type==="percentage"?v=et(D.value,0,100)/100:((y||g)&&(v=et(0,D.value,e)/e),(_||m)&&(v=et(0,D.value,t)/t)),{isSmallX:u,isSmallY:d,isLeft:c,isRight:b,isTop:C,isBottom:S,rightClass:y,leftClass:g,topClass:_,bottomClass:m,size:v}}function fp(p,e,t,n,o){const h=pp(e,t,n,o),{rightClass:w,leftClass:a,topClass:l,bottomClass:u,size:d}=h,c={top:"0px",left:"0px",width:"100%",height:"100%"};w?(c.left=`${100*(1-d)}%`,c.width=`${100*d}%`):a?c.width=`${100*d}%`:l?c.height=`${100*d}%`:u&&(c.top=`${100*(1-d)}%`,c.height=`${100*d}%`),h.isSmallX&&h.isLeft&&(c.width="4px"),h.isSmallX&&h.isRight&&(c.left=`${t-4}px`,c.width="4px"),h.isSmallY&&h.isTop&&(c.height="4px"),h.isSmallY&&h.isBottom&&(c.top=`${n-4}px`,c.height="4px"),p.style.top=c.top,p.style.left=c.left,p.style.width=c.width,p.style.height=c.height,p.style.visibility="visible",(!p.style.transform||p.style.transform==="")&&(p.style.transform="translate3d(0, 0, 0)");const b=h.isSmallX&&(h.isLeft||h.isRight)||h.isSmallY&&(h.isTop||h.isBottom);we(p,"dv-drop-target-small-vertical",h.isSmallY),we(p,"dv-drop-target-small-horizontal",h.isSmallX),we(p,"dv-drop-target-selection-line",b),we(p,"dv-drop-target-left",h.isLeft),we(p,"dv-drop-target-right",h.isRight),we(p,"dv-drop-target-top",h.isTop),we(p,"dv-drop-target-bottom",h.isBottom),we(p,"dv-drop-target-center",e==="center")}function Tg(p,e){const t=`${Math.round(e.top)}px`,n=`${Math.round(e.left)}px`,o=`${Math.round(e.width)}px`,h=`${Math.round(e.height)}px`;return p.style.top!==t||p.style.left!==n||p.style.width!==o||p.style.height!==h}function Ag(p,e){p.style.top=`${Math.round(e.top)}px`,p.style.left=`${Math.round(e.left)}px`,p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.visibility="visible",(!p.style.transform||p.style.transform==="")&&(p.style.transform="translate3d(0, 0, 0)")}function mp(p){const e=pp(p.quadrant,p.width,p.height,p.overlayModel),{rightClass:t,leftClass:n,topClass:o,bottomClass:h,size:w}=e,a=p.outlineElement.getBoundingClientRect(),l=p.targetModel.getElements(void 0,p.outlineElement),u=l.root,d=l.overlay,c=u.getBoundingClientRect(),b=a.top-c.top,C=a.left-c.left,S={top:b,left:C,width:p.width,height:p.height};return t?(S.left=C+p.width*(1-w),S.width=p.width*w):n?S.width=p.width*w:o?S.height=p.height*w:h&&(S.top=b+p.height*(1-w),S.height=p.height*w),e.isSmallX&&e.isLeft&&(S.width=4),e.isSmallX&&e.isRight&&(S.left=C+p.width-4,S.width=4),e.isSmallY&&e.isTop&&(S.height=4),e.isSmallY&&e.isBottom&&(S.top=b+p.height-4,S.height=4),Tg(d,S)?(Ag(d,S),d.className=`dv-drop-target-anchor${p.className?` ${p.className}`:""}`,we(d,"dv-drop-target-left",e.isLeft),we(d,"dv-drop-target-right",e.isRight),we(d,"dv-drop-target-top",e.isTop),we(d,"dv-drop-target-bottom",e.isBottom),we(d,"dv-drop-target-anchor-line",e.isSmallX&&(e.isLeft||e.isRight)||e.isSmallY&&(e.isTop||e.isBottom)),we(d,"dv-drop-target-center",p.quadrant==="center"),l.changed&&(we(d,"dv-drop-target-anchor-container-changed",!0),setTimeout(()=>{we(d,"dv-drop-target-anchor-container-changed",!1)},10)),{boundsChanged:!0,targetChanged:l.changed}):{boundsChanged:!1,targetChanged:l.changed}}class gp extends ih{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function ou(p){switch(p){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${p}'`)}}function Ig(p){switch(p){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${p}'`)}}const Lg={value:20,type:"percentage"};class $i extends Se{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new up(this.element,{onDragEnter:()=>{var n,o,h;(h=(o=(n=this.options).getOverrideTarget)===null||o===void 0?void 0:o.call(n))===null||h===void 0||h.getElements()},onDragOver:n=>{var o,h,w,a,l,u,d;$i.ACTUAL_TARGET=this;const c=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);if(this._acceptedTargetZonesSet.size===0){if(c)return;this.removeDropTarget();return}const b=(l=(a=(w=this.options).getOverlayOutline)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:this.element,C=b.offsetWidth,S=b.offsetHeight;if(C===0||S===0)return;const y=n.currentTarget.getBoundingClientRect(),g=((u=n.clientX)!==null&&u!==void 0?u:0)-y.left,_=((d=n.clientY)!==null&&d!==void 0?d:0)-y.top,m=this.calculateQuadrant(this._acceptedTargetZonesSet,g,_,C,S);if(this.isAlreadyUsed(n)||m===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(n,m)){if(c)return;this.removeDropTarget();return}const v=new gp({nativeEvent:n,position:m});if(this._onWillShowOverlay.fire(v),v.defaultPrevented){this.removeDropTarget();return}if(this.markAsUsed(n),!c){if(!this.targetElement){const D=Vl();this.targetElement=D.dropzone,this.overlayElement=D.selection,this._state="center",b.classList.add("dv-drop-target"),b.append(this.targetElement)}}this.toggleClasses(m,C,S),this._state=m},onDragLeave:()=>{var n,o;!((o=(n=this.options).getOverrideTarget)===null||o===void 0)&&o.call(n)||this.removeDropTarget()},onDragEnd:n=>{var o,h;const w=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);w&&$i.ACTUAL_TARGET===this&&this._state&&(n.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:n})),this.removeDropTarget(),w==null||w.clear()},onDrop:n=>{var o,h,w;n.preventDefault();const a=this._state;this.removeDropTarget(),(w=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o))===null||w===void 0||w.clear(),a&&(n.stopPropagation(),this._onDrop.fire({position:a,nativeEvent:n}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[$i.USED_EVENT_ID]=!0}isAlreadyUsed(e){const t=e[$i.USED_EVENT_ID];return typeof t=="boolean"&&t}toggleClasses(e,t,n){var o,h,w,a,l;const u=(h=(o=this.options).getOverrideTarget)===null||h===void 0?void 0:h.call(o);if(u){const d=(l=(a=(w=this.options).getOverlayOutline)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:this.element;mp({outlineElement:d,targetModel:u,quadrant:e,width:t,height:n,overlayModel:this.options.overlayModel,className:this.options.className});return}this.overlayElement&&fp(this.overlayElement,e,t,n,this.options.overlayModel)}calculateQuadrant(e,t,n,o,h){var w,a;const l=(a=(w=this.options.overlayModel)===null||w===void 0?void 0:w.activationSize)!==null&&a!==void 0?a:Lg;return l.type==="percentage"?vp(e,t,n,o,h,l.value):_p(e,t,n,o,h,l.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}showOverlay(e){var t,n,o,h,w;const a=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t),l=(w=(h=(o=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(o))!==null&&w!==void 0?w:this.element,u=l.offsetWidth,d=l.offsetHeight;if(!a&&!this.targetElement){const c=Vl();this.targetElement=c.dropzone,this.overlayElement=c.selection,l.classList.add("dv-drop-target"),l.append(this.targetElement)}this.toggleClasses(e,u,d),this._state=e}clearOverlay(){var e,t,n;this.removeDropTarget(),(n=(t=(e=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(e))===null||n===void 0||n.clear(),this._state=void 0}}$i.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function vp(p,e,t,n,o,h){const w=100*e/n,a=100*t/o;return p.has("left")&&w<h?"left":p.has("right")&&w>100-h?"right":p.has("top")&&a<h?"top":p.has("bottom")&&a>100-h?"bottom":p.has("center")?"center":null}function _p(p,e,t,n,o,h){return p.has("left")&&e<h?"left":p.has("right")&&e>n-h?"right":p.has("top")&&t<h?"top":p.has("bottom")&&t>o-h?"bottom":p.has("center")?"center":null}function Rg(p,e,t){var n,o;yi(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),p.setDragImage(e,(n=t==null?void 0:t.x)!==null&&n!==void 0?n:0,(o=t==null?void 0:t.y)!==null&&o!==void 0?o:0),setTimeout(()=>{bi(e,"dv-dragged"),e.remove()},0)}class Ui extends Se{static getInstance(){return Ui._instance||(Ui._instance=new Ui),Ui._instance}constructor(){super(),this._targets=new Set,this._targetByElement=new Map,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._onDragMove=new Q,this.onDragMove=this._onDragMove.event,this._onDragEnd=new Q,this.onDragEnd=this._onDragEnd.event,this.addDisposables(this._onDragStart,this._onDragMove,this._onDragEnd)}get active(){return this._active}registerTarget(e){return this._targets.add(e),this._targetByElement.set(e.element,e),{dispose:()=>{this._targets.delete(e),this._targetByElement.get(e.element)===e&&this._targetByElement.delete(e.element),this._currentTarget===e&&(this._currentTarget=void 0)}}}beginDrag(e){var t,n,o;this._active&&this.cancel();const{pointerEvent:h,source:w}=e,a=e.getData();this._active={pointerId:h.pointerId,startX:h.clientX,startY:h.clientY,source:w},this._onDragMoveCallback=e.onDragMove,this._onDragEndCallback=e.onDragEnd,this._dataDisposable=a,this._ghost=e.ghost,this._iframeShield=ar((t=w.ownerDocument)!==null&&t!==void 0?t:document);const l={clientX:h.clientX,clientY:h.clientY,pointerEvent:h};this._onDragStart.fire(l);const u=(o=(n=w.ownerDocument)===null||n===void 0?void 0:n.defaultView)!==null&&o!==void 0?o:window;this._moveListener=be(u,"pointermove",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleMove(d)}),this._upListener=be(u,"pointerup",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleEnd(d,!0)}),this._cancelListener=be(u,"pointercancel",d=>{!this._active||d.pointerId!==this._active.pointerId||this._handleEnd(d,!1)})}cancel(){var e,t;this._active&&((e=this._currentTarget)===null||e===void 0||e.handleDragLeave(),this._teardown(),(t=this._dataDisposable)===null||t===void 0||t.dispose(),this._dataDisposable=void 0)}_findTargetUnder(e,t){var n,o;const w=((o=(n=this._active)===null||n===void 0?void 0:n.source.ownerDocument)!==null&&o!==void 0?o:document).elementsFromPoint(e,t);for(const a of w){let l=a;for(;l;){const u=this._targetByElement.get(l);if(u)return u;l=l.parentElement}}}_handleMove(e){var t,n,o;(t=this._ghost)===null||t===void 0||t.update(e.clientX,e.clientY);const h={clientX:e.clientX,clientY:e.clientY,pointerEvent:e},w=this._findTargetUnder(e.clientX,e.clientY);w!==this._currentTarget&&((n=this._currentTarget)===null||n===void 0||n.handleDragLeave(),this._currentTarget=w),w&&w.handleDragOver(h),(o=this._onDragMoveCallback)===null||o===void 0||o.call(this,h),this._onDragMove.fire(h)}_handleEnd(e,t){var n;const o={clientX:e.clientX,clientY:e.clientY,pointerEvent:e};t&&this._currentTarget?this._currentTarget.handleDrop(o):(n=this._currentTarget)===null||n===void 0||n.handleDragLeave();const h=this._onDragEndCallback,w=this._dataDisposable;this._teardown(),this._dataDisposable=void 0,setTimeout(()=>w==null?void 0:w.dispose(),0),h==null||h(o,t),this._onDragEnd.fire(o)}_teardown(){var e,t,n,o,h;this._currentTarget=void 0,this._active=void 0,this._onDragMoveCallback=void 0,this._onDragEndCallback=void 0,(e=this._ghost)===null||e===void 0||e.dispose(),this._ghost=void 0,(t=this._iframeShield)===null||t===void 0||t.release(),this._iframeShield=void 0,(n=this._moveListener)===null||n===void 0||n.dispose(),(o=this._upListener)===null||o===void 0||o.dispose(),(h=this._cancelListener)===null||h===void 0||h.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}}const Mg={value:20,type:"percentage"};class Og extends Se{get disabled(){return this._disabled}set disabled(e){this._disabled=e,e&&this._removeOverlay()}get state(){return this._state}constructor(e,t){super(),this.element=e,this.options=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(t.acceptedTargetZones);const n={element:this.element,handleDragOver:o=>this._onDragOver(o),handleDragLeave:()=>this._onDragLeave(),handleDrop:o=>this._onDropEvent(o)};this.addDisposables(this._onDrop,this._onWillShowOverlay,Ui.getInstance().registerTarget(n))}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this._removeOverlay(),super.dispose()}_onDragOver(e){var t,n,o,h,w;if(this._disabled){this._removeOverlay();return}const a=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t);if(this._acceptedTargetZonesSet.size===0){if(a)return;this._removeOverlay();return}const l=(w=(h=(o=this.options).getOverlayOutline)===null||h===void 0?void 0:h.call(o))!==null&&w!==void 0?w:this.element,u=l.offsetWidth,d=l.offsetHeight;if(u===0||d===0)return;const c=l.getBoundingClientRect(),b=e.clientX-c.left,C=e.clientY-c.top,S=this._calculateQuadrant(b,C,u,d);if(S===null){this._removeOverlay();return}if(!this.options.canDisplayOverlay(e.pointerEvent,S)){if(a)return;this._removeOverlay();return}const y=new gp({nativeEvent:e.pointerEvent,position:S});if(this._onWillShowOverlay.fire(y),y.defaultPrevented){this._removeOverlay();return}if(a){mp({outlineElement:l,targetModel:a,quadrant:S,width:u,height:d,overlayModel:this.options.overlayModel,className:this.options.className}),this._state=S;return}if(!this._targetElement){const g=Vl();this._targetElement=g.dropzone,this._overlayElement=g.selection,this._state="center",this.element.classList.add("dv-drop-target"),this.element.append(this._targetElement)}this._overlayElement&&fp(this._overlayElement,S,u,d,this.options.overlayModel),this._state=S}_onDragLeave(){var e,t;const n=(t=(e=this.options).getOverrideTarget)===null||t===void 0?void 0:t.call(e);if(n){this._state=void 0,n.clear();return}this._removeOverlay()}_onDropEvent(e){var t,n;const o=this._state,h=(n=(t=this.options).getOverrideTarget)===null||n===void 0?void 0:n.call(t);this._removeOverlay(),h==null||h.clear(),o&&this._onDrop.fire({position:o,nativeEvent:e.pointerEvent})}_calculateQuadrant(e,t,n,o){var h,w;const a=(w=(h=this.options.overlayModel)===null||h===void 0?void 0:h.activationSize)!==null&&w!==void 0?w:Mg;return a.type==="percentage"?vp(this._acceptedTargetZonesSet,e,t,n,o,a.value):_p(this._acceptedTargetZonesSet,e,t,n,o,a.value)}_removeOverlay(){var e;this._targetElement?(this._state=void 0,(e=this._targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this._targetElement.remove(),this._targetElement=void 0,this._overlayElement=void 0):this._state=void 0}}const Gg=5,Ng=250,zg=8;class Bg extends Se{constructor(e,t){var n;super(),this.element=e,this.options=t,this._disabled=!1,this._armed=!1,this._startX=0,this._startY=0,this._touchOnly=(n=t.touchOnly)!==null&&n!==void 0?n:!0,this.addDisposables(be(this.element,"pointerdown",o=>{this._onPointerDown(o)}))}setDisabled(e){this._disabled=e,e&&this._cancelPending()}setTouchOnly(e){this._touchOnly!==e&&(this._touchOnly=e,e&&this._cancelPending())}_shouldHandle(e){var t,n;return!(this._disabled||this._touchOnly&&e.pointerType!=="touch"&&e.pointerType!=="pen"||!((n=(t=this.options).isCancelled)===null||n===void 0)&&n.call(t,e))}_onPointerDown(e){var t,n,o,h,w;if(!this._shouldHandle(e))return;this._cancelPending(),this._pendingPointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY,this._startEvent=e;const a=e.pointerType==="touch"||e.pointerType==="pen",l=this.options.touchInitiationDelay,u=(t=typeof l=="function"?l():l)!==null&&t!==void 0?t:Ng;this._armed=!a||u<=0,a&&u>0&&isFinite(u)&&(this._armTimer=setTimeout(()=>{this._armTimer=void 0,this._armed=!0},u));const d=(n=this.options.threshold)!==null&&n!==void 0?n:Gg,c=this.options.pressTolerance,b=(o=typeof c=="function"?c():c)!==null&&o!==void 0?o:zg,C=(w=(h=this.element.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&w!==void 0?w:window;this._pendingMoveListener=be(C,"pointermove",S=>{if(S.pointerId!==this._pendingPointerId)return;const y=S.clientX-this._startX,g=S.clientY-this._startY,_=Math.hypot(y,g);if(this._armed){_>=d&&this._beginDrag(S);return}_>b&&this._beginDrag(S)}),this._pendingUpListener=be(C,"pointerup",S=>{S.pointerId===this._pendingPointerId&&this._cancelPending()}),this._pendingCancelListener=be(C,"pointercancel",S=>{S.pointerId===this._pendingPointerId&&this._cancelPending()})}cancelPending(){this._cancelPending()}_cancelPending(){var e,t,n;this._pendingPointerId=void 0,this._armTimer!==void 0&&(clearTimeout(this._armTimer),this._armTimer=void 0),this._armed=!1,(e=this._pendingMoveListener)===null||e===void 0||e.dispose(),(t=this._pendingUpListener)===null||t===void 0||t.dispose(),(n=this._pendingCancelListener)===null||n===void 0||n.dispose(),this._pendingMoveListener=void 0,this._pendingUpListener=void 0,this._pendingCancelListener=void 0,this._startEvent=void 0}_beginDrag(e){var t,n,o,h,w;const a=(t=this._startEvent)!==null&&t!==void 0?t:e;this._cancelPending(),(o=(n=this.options).onDragStart)===null||o===void 0||o.call(n,a);const l=(w=(h=this.options).createGhost)===null||w===void 0?void 0:w.call(h,a);Ui.getInstance().beginDrag({pointerEvent:e,source:this.element,getData:()=>this.options.getData(a),ghost:l,onDragMove:this.options.onDragMove,onDragEnd:this.options.onDragEnd})}dispose(){this._cancelPending(),super.dispose()}}class Hg{constructor(e){var t,n,o,h,w;this._disposed=!1,this.element=e.element,this.offsetX=(t=e.offsetX)!==null&&t!==void 0?t:0,this.offsetY=(n=e.offsetY)!==null&&n!==void 0?n:0,this.element.style.position="fixed",this.element.style.left="0px",this.element.style.top="0px",this.element.style.pointerEvents="none",this.element.style.zIndex="99999",this.element.style.opacity=String((o=e.opacity)!==null&&o!==void 0?o:.8),this.element.style.willChange="transform",this.element.style.transform=`translate3d(${e.initialX-this.offsetX}px, ${e.initialY-this.offsetY}px, 0)`,((w=(h=e.owner)===null||h===void 0?void 0:h.ownerDocument)!==null&&w!==void 0?w:document).body.appendChild(this.element)}update(e,t){this._disposed||(this.element.style.transform=`translate3d(${e-this.offsetX}px, ${t-this.offsetY}px, 0)`)}dispose(){this._disposed||(this._disposed=!0,this.element.remove())}}class Fg extends Se{constructor(e,t){super(),this.el=e,this.opts=t,this._dataDisposable=new ft,this._pointerEventsDisposable=new ft,this._disabled=!!t.disabled,this.addDisposables(this._dataDisposable,this._pointerEventsDisposable,be(this.el,"dragstart",n=>{var o,h,w,a,l,u,d,c,b;if(n.defaultPrevented||this._disabled||!((h=(o=this.opts).isCancelled)===null||h===void 0)&&h.call(o,n)){n.preventDefault();return}const C=ar((w=this.el.ownerDocument)!==null&&w!==void 0?w:document);this._pointerEventsDisposable.value={dispose:()=>C.release()},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this._dataDisposable.value=this.opts.getData(n);const S=(l=(a=this.opts).createGhost)===null||l===void 0?void 0:l.call(a,n);if(S&&n.dataTransfer&&(Rg(n.dataTransfer,S.element,{x:(u=S.offsetX)!==null&&u!==void 0?u:0,y:(d=S.offsetY)!==null&&d!==void 0?d:0}),S.dispose)){const y=S.dispose;setTimeout(()=>y(),0)}n.dataTransfer&&(n.dataTransfer.effectAllowed="move",n.dataTransfer.items.length===0&&n.dataTransfer.setData("text/plain","")),(b=(c=this.opts).onDragStart)===null||b===void 0||b.call(c,n)}),be(this.el,"dragend",n=>{var o,h;this._pointerEventsDisposable.dispose(),setTimeout(()=>this._dataDisposable.dispose(),0),(h=(o=this.opts).onDragEnd)===null||h===void 0||h.call(o,n)}))}setDisabled(e){this._disabled=e}setTouchOnly(e){}cancelPending(){}}class Wg{constructor(){this.kind="html5"}createDropTarget(e,t){return new $i(e,t)}createDragSource(e,t){return new Fg(e,t)}}class Vg{constructor(){this.kind="pointer"}createDropTarget(e,t){return new Og(e,t)}createDragSource(e,t){const n=t.createGhost?h=>{const w=t.createGhost(h);if(!w)return;const a=new Hg({element:w.element,initialX:h.clientX,initialY:h.clientY,offsetX:w.offsetX,offsetY:w.offsetY,owner:e});if(w.dispose){const l=a.dispose.bind(a),u=w.dispose;a.dispose=()=>{l(),u()}}return a}:void 0,o=new Bg(e,{getData:t.getData,isCancelled:t.isCancelled,onDragStart:t.onDragStart,onDragEnd:t.onDragEnd?h=>t.onDragEnd(h.pointerEvent):void 0,createGhost:n,touchOnly:t.touchOnly,touchInitiationDelay:t.touchInitiationDelay,pressTolerance:t.pressTolerance,threshold:t.threshold});return t.disabled&&o.setDisabled(!0),o}}const vs=new Wg,Ki=new Vg,jl=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class jg extends Qu{constructor(e,t,n,o){super(),this.nativeEvent=e,this.position=t,this.getData=n,this.panel=o}}class wp extends ih{constructor(){super()}}class bp extends Se{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,t){super(),this.id=e,this.component=t,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new ft,this._onDidDimensionChange=new Q,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new Q,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new Q,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new Q,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new Q,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new Q,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new Q,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new Q,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(n=>{this._isFocused=n.isFocused}),this.onDidActiveChange(n=>{this._isActive=n.isActive}),this.onDidVisibilityChange(n=>{this._isVisible=n.isVisible}),this.onDidDimensionsChange(n=>{this._width=n.width,this._height=n.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(t=>{this._parameters=t,e.update({params:t})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class yp extends bp{constructor(e,t){super(e,t),this._onDidConstraintsChangeInternal=new Q,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new Q({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new Q,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class $g extends yp{set pane(e){this._pane=e}constructor(e,t){super(e,t),this._onDidExpansionChange=new Q({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new Q({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new Q({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var t;(t=this._pane)===null||t===void 0||t.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class oh extends Se{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,t,n){super(),this.id=e,this.component=t,this.api=n,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const o=ep(this._element);this.addDisposables(this.api,o.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),o.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),o)}focus(){const e=new wp;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,t){this._width=e,this._height=t,this.api._onDidDimensionChange.fire({width:e,height:t}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var t,n;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(t=this._params)===null||t===void 0?void 0:t.params),e.params)});for(const o of Object.keys(e.params))e.params[o]===void 0&&delete this._params.params[o];(n=this.part)===null||n===void 0||n.update({params:this._params.params})}toJSON(){var e,t;const n=(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{};return{id:this.id,component:this.component,params:Object.keys(n).length>0?n:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class Ug extends oh{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,n=this.isExpanded()?this._minimumBodySize:0;return e+n}get maximumSize(){const e=this.headerSize,n=this.isExpanded()?this._maximumBodySize:0;return e+n}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new $g(e.id,e.component)),this._onDidChangeExpansionState=new Q({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(t=>{const{isVisible:n}=t,{accessor:o}=this._params;o.setVisible(this,n)}),this.api.onDidSizeChange(t=>{this._onDidChange.fire({size:t.size})}),be(this.element,"mouseenter",t=>{this.api._onMouseEnter.fire(t)}),be(this.element,"mouseleave",t=>{this.api._onMouseLeave.fire(t)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(t=>{this.api._onDidExpansionChange.fire({isExpanded:t})}),this.api.onDidFocusChange(t=>{this.header&&(t.isFocused?yi(this.header,"focused"):bi(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var t;(t=this.body)===null||t===void 0||t.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,t){this._size=e,this._orthogonalSize=t;const[n,o]=this.orientation===Pe.HORIZONTAL?[e,t]:[t,e];super.layout(n,o)}init(e){var t,n;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(t=this.body)===null||t===void 0||t.append(this.bodyPart.element),(n=this.header)===null||n===void 0||n.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var t,n;(t=this.bodyPart)===null||t===void 0||t.update({params:e}),(n=this.headerPart)===null||n===void 0||n.update({params:e})},dispose:()=>{var e,t;(e=this.bodyPart)===null||e===void 0||e.dispose(),(t=this.headerPart)===null||t===void 0||t.dispose()}}}}class Kg extends Ug{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOver),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,t=this.accessor.id;this.header.draggable=!0;const n={getData:()=>(wi.getInstance().setData([new or(t,e)],or.prototype),{dispose:()=>{wi.getInstance().clearData(or.prototype)}})};this.html5DragSource=vs.createDragSource(this.header,n),this.pointerDragSource=Ki.createDragSource(this.header,n);const h={acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(w,a)=>{const l=tr();if(l&&l.paneId!==this.id&&l.viewId===this.accessor.id)return!0;const u=new jg(w,a,tr,this);return this._onUnhandledDragOver.fire(u),u.isAccepted}};this.target=vs.createDropTarget(this.element,h),this.pointerTarget=Ki.createDropTarget(this.element,h),this.addDisposables(this._onDidDrop,this.html5DragSource,this.pointerDragSource,this.target,this.pointerTarget,this.target.onDrop(w=>{this.onDrop(w)}),this.pointerTarget.onDrop(w=>{this.onDrop(w)}))}onDrop(e){const t=tr();if(!t||t.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new lr(this.accessor),getData:tr}));return}const n=this._params.containerApi,o=t.paneId,h=n.getPanel(o);if(!h){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:tr,api:new lr(this.accessor)}));return}const w=n.panels,a=w.indexOf(h);let l=n.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(l=Math.max(0,l-1)),(e.position==="right"||e.position==="bottom")&&(a>l&&l++,l=Math.min(w.length-1,l)),n.movePanel(a,l)}}let Yg=0;const Xg=()=>`dv-tabpanel-${Yg++}`;class qg extends Se{get element(){return this._element}constructor(e,t){var n,o,h,w,a,l,u;super(),this.accessor=e,this.group=t,this.disposable=new ft,this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this._element.id=Xg(),this._element.setAttribute("role","tabpanel"),this.addDisposables(this._onDidFocus,this._onDidBlur);const d=()=>{var b;return(b=t.dropTargetContainer)===null||b===void 0?void 0:b.model},c=(b,C)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&C==="center")return!1;const S=it();return!S&&b.shiftKey&&this.group.location.type!=="floating"?!1:S&&S.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(b,C,"content")};this.dropTarget=new $i(this.element,{getOverlayOutline:()=>{var b;return((b=e.options.theme)===null||b===void 0?void 0:b.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:c,getOverrideTarget:d,overlayModel:(o=(n=this.accessor).resolveDropOverlayModel)===null||o===void 0?void 0:o.call(n,"content")}),this.pointerDropTarget=Ki.createDropTarget(this.element,{acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:c,getOverlayOutline:()=>{var b;return((b=e.options.theme)===null||b===void 0?void 0:b.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",getOverrideTarget:d,overlayModel:(w=(h=this.accessor).resolveDropOverlayModel)===null||w===void 0?void 0:w.call(h,"content")}),this.addDisposables(this.dropTarget,this.pointerDropTarget,(u=(l=(a=this.accessor).onDidOptionsChange)===null||l===void 0?void 0:l.call(a,()=>{var b,C,S;const y=(S=(C=(b=this.accessor).resolveDropOverlayModel)===null||C===void 0?void 0:C.call(b,"content"))!==null&&S!==void 0?S:{};this.dropTarget.setOverlayModel(y),this.pointerDropTarget.setOverlayModel(y)}))!==null&&u!==void 0?u:Ve.NONE)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}setLabelledBy(e){e?this._element.setAttribute("aria-labelledby",e):this._element.removeAttribute("aria-labelledby")}renderPanel(e,t={asActive:!0}){var n,o,h,w;const a=t.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&(this._element.removeChild(this.panel.view.content.element),(o=(n=this.panel.view.content).onHide)===null||o===void 0||o.call(n)),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&a&&(this._element.appendChild(this.panel.view.content.element),(w=(h=this.panel.view.content).onShow)===null||w===void 0||w.call(h)),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(a){const u=ep(l);this.focusTracker=u;const d=new Se;d.addDisposables(u,u.onDidFocus(()=>this._onDidFocus.fire()),u.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=d}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,t){}closePanel(){var e,t,n;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element),(n=(t=this.panel.view.content).onHide)===null||n===void 0||n.call(t)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}const Jg=500,Zg=8;class ah extends Se{constructor(e,t){super(),this.element=e,this.options=t,this._startX=0,this._startY=0,this.addDisposables(be(this.element,"pointerdown",n=>{this._onPointerDown(n)}))}_onPointerDown(e){var t,n,o,h,w;if(((t=this.options.touchOnly)!==null&&t!==void 0?t:!0)&&e.pointerType!=="touch"&&e.pointerType!=="pen")return;this._cancelPending(),this._pointerId=e.pointerId,this._startX=e.clientX,this._startY=e.clientY;const l=(n=this.options.delay)!==null&&n!==void 0?n:Jg,u=(o=this.options.tolerance)!==null&&o!==void 0?o:Zg,d=(w=(h=this.element.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&w!==void 0?w:window;this._timer=setTimeout(()=>{this._timer=void 0,this._cancelPending(),this._installContextMenuGuard(d),this._installClickGuard(d),this.options.onLongPress(e)},l),this._moveListener=be(d,"pointermove",c=>{if(c.pointerId!==this._pointerId)return;const b=c.clientX-this._startX,C=c.clientY-this._startY;Math.hypot(b,C)>u&&this._cancelPending()}),this._upListener=be(d,"pointerup",c=>{c.pointerId===this._pointerId&&this._cancelPending()}),this._cancelListener=be(d,"pointercancel",c=>{c.pointerId===this._pointerId&&this._cancelPending()})}_installContextMenuGuard(e){let t;const n=setTimeout(()=>t==null?void 0:t.dispose(),500);t=be(e,"contextmenu",o=>{o.preventDefault(),clearTimeout(n),t==null||t.dispose()},{capture:!0})}_installClickGuard(e){let t;const n=setTimeout(()=>t==null?void 0:t.dispose(),500);t=be(e,"click",o=>{const h=o.target;h&&this.element.contains(h)&&(o.preventDefault(),o.stopPropagation()),clearTimeout(n),t==null||t.dispose()},{capture:!0})}_cancelPending(){var e,t,n;this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0),this._pointerId=void 0,(e=this._moveListener)===null||e===void 0||e.dispose(),(t=this._upListener)===null||t===void 0||t.dispose(),(n=this._cancelListener)===null||n===void 0||n.dispose(),this._moveListener=void 0,this._upListener=void 0,this._cancelListener=void 0}dispose(){this._cancelPending(),super.dispose()}}function Ii(p){if(p.disableDnd)return{html5:!1,pointer:!1,pointerHandlesMouse:!1};switch(p.dndStrategy){case"pointer":return{html5:!1,pointer:!0,pointerHandlesMouse:!0};case"html5":return{html5:!0,pointer:!1,pointerHandlesMouse:!1};case"auto":case void 0:default:return Qg()?{html5:!1,pointer:!0,pointerHandlesMouse:!0}:{html5:!0,pointer:!0,pointerHandlesMouse:!1}}}function Qg(){if(typeof window>"u"||!window.matchMedia)return!1;const p=window.matchMedia("(pointer: coarse)").matches,e=window.matchMedia("(pointer: fine)").matches;return p&&!e}let ev=0;const tv=()=>`dv-tab-${ev++}`;class iv extends Se{get element(){return this._element}constructor(e,t,n){var o,h;super(),this.panel=e,this.accessor=t,this.group=n,this.content=void 0,this.panelTransfer=wi.getInstance(),this._direction="horizontal",this._onPointDown=new Q,this.onPointerDown=this._onPointDown.event,this._onTabClick=new Q,this.onTabClick=this._onTabClick.event,this._onDropped=new Q,this.onDrop=this._onDropped.event,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._onDragEnd=new Q,this.onDragEnd=this._onDragEnd.event;const w=Ii(this.accessor.options);this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=-1,this._element.draggable=w.html5,this._element.id=tv(),this._element.setAttribute("role","tab"),this._element.setAttribute("aria-selected","false");const a=(h=(o=this.group)===null||o===void 0?void 0:o.model)===null||h===void 0?void 0:h.contentContainerId;a&&this._element.setAttribute("aria-controls",a),we(this.element,"dv-inactive-tab",!0);const l=(d,c)=>{var b;if(this.group.locked)return!1;const C=it();return C&&this.accessor.id===C.viewId?((b=this.accessor.options.theme)===null||b===void 0?void 0:b.tabAnimation)!=="smooth":this.group.model.canDisplayOverlay(d,c,"tab")};this.dropTarget=vs.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:l,getOverrideTarget:()=>{var d;return(d=n.model.dropTargetContainer)===null||d===void 0?void 0:d.model}}),this.pointerDropTarget=Ki.createDropTarget(this._element,{acceptedTargetZones:["left","right"],overlayModel:this._buildOverlayModel(),canDisplayOverlay:l,getOverrideTarget:()=>{var d;return(d=n.model.dropTargetContainer)===null||d===void 0?void 0:d.model}});const u={getData:()=>(this.panelTransfer.setData([new ni(this.accessor.id,this.group.id,this.panel.id)],ni.prototype),{dispose:()=>{this.panelTransfer.clearData(ni.prototype)}}),createGhost:()=>({element:this._buildGhostElement(),offsetX:30,offsetY:-10}),onDragStart:d=>{var c;this._onDragStart.fire(d),!(d instanceof PointerEvent)&&((c=this.accessor.options.theme)===null||c===void 0?void 0:c.tabAnimation)==="smooth"&&requestAnimationFrame(()=>{we(this.element,"dv-tab--dragging",!0)})},onDragEnd:d=>{this._onDragEnd.fire(d)}};this.html5DragSource=vs.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.html5})),this.pointerDragSource=Ki.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.pointer,touchOnly:!w.pointerHandlesMouse,isCancelled:()=>!Ii(this.accessor.options).pointer})),this.onWillShowOverlay=ri.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this._onPointDown,this._onTabClick,this._onDropped,this._onDragStart,this._onDragEnd,this.accessor.onDidOptionsChange(()=>{const d=this._buildOverlayModel();this.dropTarget.setOverlayModel(d),this.pointerDropTarget.setOverlayModel(d)}),be(this._element,"dragend",()=>{we(this.element,"dv-tab--dragging",!1)}),this.html5DragSource,be(this._element,"pointerdown",d=>{this._onPointDown.fire(d)}),be(this._element,"click",d=>{this._onTabClick.fire(d)}),be(this._element,"contextmenu",d=>{var c;(c=this.accessor.contextMenuService)===null||c===void 0||c.show(this.panel,this.group,d)}),new ah(this._element,{onLongPress:d=>{var c;this.pointerDragSource.cancelPending(),(c=this.accessor.contextMenuService)===null||c===void 0||c.show(this.panel,this.group,d)}}),this.dropTarget.onDrop(d=>{this._onDropped.fire(d)}),this.pointerDropTarget.onDrop(d=>{this._onDropped.fire(d)}),this.dropTarget,this.pointerDropTarget,this.pointerDragSource)}setActive(e){we(this.element,"dv-active-tab",e),we(this.element,"dv-inactive-tab",!e),this._element.setAttribute("aria-selected",e?"true":"false"),this._element.tabIndex=e?0:-1}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}_buildOverlayModel(){var e,t,n;const o=(t=(e=this.accessor).resolveDropOverlayModel)===null||t===void 0?void 0:t.call(e,"tab",this.group);if(o)return o;const h=((n=this.accessor.options.theme)===null||n===void 0?void 0:n.dndTabIndicator)==="line"?Number.POSITIVE_INFINITY:0;return{activationSize:{value:50,type:"percentage"},smallWidthBoundary:h,smallHeightBoundary:h}}setDirection(e){this._direction=e;const t=e==="vertical"?["top","bottom"]:["left","right"];this.dropTarget.setTargetZones(t),this.pointerDropTarget.setTargetZones(t)}updateDragAndDropState(){const e=Ii(this.accessor.options);this._element.draggable=e.html5,this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}_buildGhostElement(){const e=getComputedStyle(this.element),t=this.element.cloneNode(!0),n=this._direction==="vertical",o=new Set(["writing-mode","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin-inline","margin-inline-start","margin-inline-end","margin-block","margin-block-start","margin-block-end","padding-inline","padding-inline-start","padding-inline-end","padding-block","padding-block-start","padding-block-end"]);return Array.from(e).forEach(h=>{n&&o.has(h)||t.style.setProperty(h,e.getPropertyValue(h),e.getPropertyPriority(h))}),n&&(t.style.setProperty("writing-mode","horizontal-tb"),t.style.setProperty("width",e.height),t.style.setProperty("height",e.width)),t.style.position="absolute",t.classList.add("dv-tab-ghost-drag"),t}}class hr{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,t){this.event=e,this.options=t}}const sv=500;class Sp extends Se{get group(){return this.groupAccessor()}constructor(e){var t,n,o;super(),this.panelTransfer=wi.getInstance(),this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._element=e.element,this.accessor=e.accessor;const h=e.group;this.groupAccessor=typeof h=="function"?h:()=>h,this.isFloatingMoveHandle=(t=e.isFloatingMoveHandle)!==null&&t!==void 0?t:(()=>!0);const w=Ii(this.accessor.options);this._element.draggable=w.html5,we(this._element,"dv-draggable",w.html5||w.pointer),this.addDisposables(this._onDragStart);const a=()=>{const S=document.createElement("div"),y=window.getComputedStyle(this._element),g=y.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),_=y.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");return S.style.backgroundColor=g,S.style.color=_,S.style.padding="2px 8px",S.style.height="24px",S.style.fontSize="11px",S.style.lineHeight="20px",S.style.borderRadius="12px",S.style.whiteSpace="nowrap",S.style.boxSizing="border-box",S.style.display="inline-block",S.textContent=`Multiple Panels (${this.group.size})`,S},u={getData:()=>(this.panelTransfer.setData([new ni(this.accessor.id,this.group.id,null)],ni.prototype),{dispose:()=>{this.panelTransfer.clearData(ni.prototype)}}),createGhost:()=>{var S,y;const g=(y=(S=this.accessor).buildGroupDragGhost)===null||y===void 0?void 0:y.call(S,this.group);return g||{element:a(),offsetX:30,offsetY:-10}},onDragStart:S=>{this._onDragStart.fire(S)}};this.html5DragSource=vs.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.html5,isCancelled:S=>!!(this.group.api.location.type==="floating"&&this.isFloatingMoveHandle()&&!S.shiftKey||this.group.api.location.type==="edge"&&this.group.size===0)}));const d=()=>{var S,y,g;return((g=(y=(S=this.group)===null||S===void 0?void 0:S.api)===null||y===void 0?void 0:y.location)===null||g===void 0?void 0:g.type)==="floating"&&this.isFloatingMoveHandle()};this.pointerDragSource=Ki.createDragSource(this._element,Object.assign(Object.assign({},u),{disabled:!w.pointer,touchOnly:!w.pointerHandlesMouse,touchInitiationDelay:()=>d()?sv:250,pressTolerance:()=>d()?1/0:8,isCancelled:()=>!Ii(this.accessor.options).pointer||this.group.api.location.type==="edge"&&this.group.size===0,onDragStart:S=>{var y;(y=this.getFloatingOverlay())===null||y===void 0||y.cancelPendingDrag(),this._onDragStart.fire(S)}}));const c=new ft,b=()=>{const S=this.getFloatingOverlay();c.value=S?S.onDidStartMoving(()=>{this.pointerDragSource.cancelPending()}):Ve.NONE};b(),this.addDisposables(c);const C=(o=(n=this.group)===null||n===void 0?void 0:n.api)===null||o===void 0?void 0:o.onDidLocationChange;C&&this.addDisposables(C(b)),this.addDisposables(this.html5DragSource,this.pointerDragSource)}updateDragAndDropState(){const e=Ii(this.accessor.options);this._element.draggable=e.html5,we(this._element,"dv-draggable",e.html5||e.pointer),this.html5DragSource.setDisabled(!e.html5),this.pointerDragSource.setDisabled(!e.pointer),this.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}getFloatingOverlay(){var e,t;if(this.group)return(t=(e=this.accessor.floatingGroups)===null||e===void 0?void 0:e.find(n=>n.group===this.group))===null||t===void 0?void 0:t.overlay}}class nv extends Se{get element(){return this._element}constructor(e,t){var n,o,h,w,a,l,u;super(),this.accessor=e,this.group=t,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this.addDisposables(this._onDrop,this._onDragStart,be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)}),be(this._element,"pointerdown",c=>{c.shiftKey&&ip(c)},!0)),this.dragSource=new Sp({element:this._element,accessor:this.accessor,group:this.group,isFloatingMoveHandle:()=>!this._element.closest(".dv-resize-container-with-titlebar")});const d=(c,b)=>{if(this.group.api.locked)return!1;const C=it();return C&&this.accessor.id===C.viewId?!0:t.model.canDisplayOverlay(c,b,"header_space")};this.dropTarget=vs.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:d,getOverrideTarget:()=>{var c;return(c=t.model.dropTargetContainer)===null||c===void 0?void 0:c.model},overlayModel:(o=(n=this.accessor).resolveDropOverlayModel)===null||o===void 0?void 0:o.call(n,"header_space",this.group)}),this.pointerDropTarget=Ki.createDropTarget(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:d,getOverrideTarget:()=>{var c;return(c=t.model.dropTargetContainer)===null||c===void 0?void 0:c.model},overlayModel:(w=(h=this.accessor).resolveDropOverlayModel)===null||w===void 0?void 0:w.call(h,"header_space",this.group)}),this.onWillShowOverlay=ri.any(this.dropTarget.onWillShowOverlay,this.pointerDropTarget.onWillShowOverlay),this.addDisposables(this.dragSource,this.dragSource.onDragStart(c=>{this._onDragStart.fire(c)}),this.dropTarget.onDrop(c=>{this._onDrop.fire(c)}),this.pointerDropTarget.onDrop(c=>{this._onDrop.fire(c)}),this.dropTarget,this.pointerDropTarget,(u=(l=(a=this.accessor).onDidOptionsChange)===null||l===void 0?void 0:l.call(a,()=>{var c,b,C;const S=(C=(b=(c=this.accessor).resolveDropOverlayModel)===null||b===void 0?void 0:b.call(c,"header_space",this.group))!==null&&C!==void 0?C:{};this.dropTarget.setOverlayModel(S),this.pointerDropTarget.setOverlayModel(S)}))!==null&&u!==void 0?u:Ve.NONE)}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}}class Go extends Se{get element(){return this._element}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._scrollOffset=0,this._orientation=e,bi(this._scrollbar,"dv-scrollbar-vertical","dv-scrollbar-horizontal"),e==="vertical"?yi(this._scrollbar,"dv-scrollbar-vertical"):yi(this._scrollbar,"dv-scrollbar-horizontal"))}constructor(e){super(),this.scrollableElement=e,this._scrollOffset=0,this._orientation="horizontal",this._element=document.createElement("div"),this._element.className="dv-scrollable",this._scrollbar=document.createElement("div"),this._scrollbar.className="dv-scrollbar dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._scrollbar),this.addDisposables(be(this.element,"wheel",t=>{this._scrollOffset+=t.deltaY*Go.MouseWheelSpeed,this.calculateScrollbarStyles()}),be(this._scrollbar,"pointerdown",t=>{t.preventDefault(),we(this.element,"dv-scrollable-scrolling",!0);const n=this._orientation==="horizontal"?t.clientX:t.clientY,o=this._scrollOffset,h=a=>{const l=this._orientation==="horizontal"?a.clientX-n:a.clientY-n,u=this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight,d=this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight,c=u/d;this._scrollOffset=o+l/c,this.calculateScrollbarStyles()},w=()=>{we(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w)}),be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),be(this.scrollableElement,"scroll",()=>{this._scrollOffset=this._orientation==="horizontal"?this.scrollableElement.scrollLeft:this.scrollableElement.scrollTop,this.calculateScrollbarStyles()}),cr(this.element,()=>{we(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),we(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const e=this._orientation==="horizontal"?this.element.clientWidth:this.element.clientHeight,t=this._orientation==="horizontal"?this.scrollableElement.scrollWidth:this.scrollableElement.scrollHeight;if(t>e){const o=e*(e/t);this._orientation==="horizontal"?(this._scrollbar.style.width=`${o}px`,this._scrollbar.style.height=""):(this._scrollbar.style.height=`${o}px`,this._scrollbar.style.width=""),this._scrollOffset=et(this._scrollOffset,0,t-e),this._orientation==="horizontal"?this.scrollableElement.scrollLeft=this._scrollOffset:this.scrollableElement.scrollTop=this._scrollOffset;const h=this._scrollOffset/(t-e);this._orientation==="horizontal"?(this._scrollbar.style.left=`${(e-o)*h}px`,this._scrollbar.style.top=""):(this._scrollbar.style.top=`${(e-o)*h}px`,this._scrollbar.style.left="")}else this._orientation==="horizontal"?(this._scrollbar.style.width="0px",this._scrollbar.style.left="0px"):(this._scrollbar.style.height="0px",this._scrollbar.style.top="0px"),this._scrollOffset=0}}Go.MouseWheelSpeed=1;const lh=[{id:"grey",value:"var(--dv-tab-group-color-grey)",label:"Grey"},{id:"blue",value:"var(--dv-tab-group-color-blue)",label:"Blue"},{id:"red",value:"var(--dv-tab-group-color-red)",label:"Red"},{id:"yellow",value:"var(--dv-tab-group-color-yellow)",label:"Yellow"},{id:"green",value:"var(--dv-tab-group-color-green)",label:"Green"},{id:"pink",value:"var(--dv-tab-group-color-pink)",label:"Pink"},{id:"purple",value:"var(--dv-tab-group-color-purple)",label:"Purple"},{id:"cyan",value:"var(--dv-tab-group-color-cyan)",label:"Cyan"},{id:"orange",value:"var(--dv-tab-group-color-orange)",label:"Orange"}];class Cp{constructor(e,t=!0){this._entries=e.slice(),this._byId=new Map(e.map(n=>[n.id,n])),this._enabled=t}get enabled(){return this._enabled}set enabled(e){this._enabled=e}setEntries(e){this._entries=e.slice(),this._byId=new Map(e.map(t=>[t.id,t]))}entries(){return this._entries}has(e){return this._byId.has(e)}get(e){return this._byId.get(e)}defaultId(){var e;return(e=this._entries[0])===null||e===void 0?void 0:e.id}resolveValue(e){if(!this._enabled||!e)return;const t=this._byId.get(e);return t?t.value:e}}let El;function xp(){return El||(El=new Cp(lh,!0)),El}function hh(p,e,t){const n=(t??xp()).resolveValue(e);n===void 0?p.style.removeProperty("--dv-tab-group-color"):p.style.setProperty("--dv-tab-group-color",n)}function Dp(p,e){return(e??xp()).resolveValue(p)}class au extends Se{get element(){return this._element}constructor(e){super(),this._palette=e,this._onClick=new Q,this.onClick=this._onClick.event,this._onContextMenu=new Q,this.onContextMenu=this._onContextMenu.event,this._element=document.createElement("div"),this._element.className="dv-tab-group-chip",this._element.tabIndex=0,this._label=document.createElement("span"),this._label.className="dv-tab-group-chip-label",this._element.appendChild(this._label),this.addDisposables(this._onClick,this._onContextMenu,new ah(this._element,{onLongPress:t=>{this._onContextMenu.fire(t)}}),be(this._element,"click",t=>{this._onClick.fire(t)}),be(this._element,"contextmenu",t=>{this._onContextMenu.fire(t)}))}init(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed),this.addDisposables(e.tabGroup.onDidChange(()=>{this._tabGroup&&(this.updateColor(this._tabGroup.color),this.updateLabel(this._tabGroup.label))}),e.tabGroup.onDidCollapseChange(t=>{this.updateCollapsed(t)}),this._onClick.event(()=>{var t;(t=this._tabGroup)===null||t===void 0||t.toggle()}))}update(e){this._tabGroup=e.tabGroup,this.updateColor(e.tabGroup.color),this.updateLabel(e.tabGroup.label),this.updateCollapsed(e.tabGroup.collapsed)}updateColor(e){var t;hh(this._element,e,this._palette),we(this._element,"dv-tab-group-chip--accent-off",((t=this._palette)===null||t===void 0?void 0:t.enabled)===!1)}updateLabel(e){this._label.textContent=e,we(this._label,"dv-tab-group-chip-label--empty",!e)}updateCollapsed(e){we(this._element,"dv-tab-group-chip--collapsed",e)}}class Ep{get underlines(){return this._underlines}constructor(e){this._ctx=e,this._underlines=new Map,this._rafId=null}positionUnderlines(){requestAnimationFrame(()=>{this._positionUnderlinesSync()})}trackUnderlines(){this._rafId!==null&&cancelAnimationFrame(this._rafId);const e=performance.now(),t=250,n=()=>{this._positionUnderlinesSync(),performance.now()-e<t?this._rafId=requestAnimationFrame(n):this._rafId=null};this._rafId=requestAnimationFrame(n)}syncUnderlineElements(e){for(const t of e)if(!this._underlines.has(t)){const n=document.createElement("div");n.className="dv-tab-group-underline",this._ctx.tabsList.appendChild(n),this._underlines.set(t,n)}for(const[t,n]of this._underlines)e.has(t)||(n.remove(),this._underlines.delete(t))}getUnderline(e){return this._underlines.get(e)}dispose(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null);for(const[,e]of this._underlines)e.remove();this._underlines.clear()}_positionUnderlinesSync(){const e=this._ctx.tabsList.getBoundingClientRect(),t=this._ctx.getTabGroups(),n=this._ctx.getDirection()==="vertical",o=n?e.width:e.height,h=this._ctx.getActivePanelId(),w=this._ctx.getTabMap();for(const a of t){const l=this._underlines.get(a.id);if(!l)continue;const u=a.panelIds;if(u.length===0){l.style.display="none";continue}l.style.display="";const d=this._ctx.getChipElement(a.id);let c;if(d){const m=d.getBoundingClientRect(),v=getComputedStyle(d),D=n?Number.parseFloat(v.marginTop)||0:Number.parseFloat(v.marginLeft)||0;c=n?m.top-e.top-D:m.left-e.left-D}else{const m=u[0],v=w.get(m);if(v){const D=v.value.element.getBoundingClientRect();c=n?D.top-e.top:D.left-e.left}else c=0}const b=u[u.length-1],C=w.get(b);if(!C){n?(l.style.top=`${c}px`,l.style.height="0px",l.style.left="",l.style.width=""):(l.style.left=`${c}px`,l.style.width="0px",l.style.top="",l.style.height="");continue}const S=C.value.element.getBoundingClientRect();let y=n?S.bottom-e.top:S.right-e.left,g=y-c;if((a.collapsed||a.panelIds.some(m=>{const v=w.get(m);return v&&v.value.element.classList.contains("dv-tab--group-expanding")}))&&d){const m=d.getBoundingClientRect(),v=n?m.top+m.height/2-e.top:m.left+m.width/2-e.left;let D=0,P=0;for(const A of a.panelIds){const E=w.get(A);if(!E)continue;const I=E.value.element;n?(D+=I.getBoundingClientRect().height,P+=I.scrollHeight):(D+=I.getBoundingClientRect().width,P+=I.scrollWidth)}const T=P>0?Math.min(1,D/P):0;c=v+(c-v)*T,y=v+(y-v)*T,g=Math.max(0,y-c)}n?(l.style.top=`${c}px`,l.style.height=`${Math.max(0,g)}px`,l.style.left="",l.style.width=""):(l.style.left=`${c}px`,l.style.width=`${Math.max(0,g)}px`,l.style.top="",l.style.height=""),this.applyShape(l,a,c,g,o,h,e,n)}}}class rv extends Ep{_applyStraightLine(e,t,n,o,h,w){w?(e.setAttribute("width",String(o)),e.setAttribute("height",String(h)),n.style.width=`${o}px`,n.style.height=`${h}px`,t.setAttribute("d",`M ${o/2},0 L ${o/2},${h}`)):(e.setAttribute("width",String(h)),e.setAttribute("height",String(o)),n.style.width=`${h}px`,n.style.height=`${o}px`,t.setAttribute("d",`M 0,${o/2} L ${h},${o/2}`))}applyShape(e,t,n,o,h,w,a,l){const d=h,c=o,b=Dp(t.color,this._ctx.getColorPalette());if(c<=0||d<=0||b===void 0){e.style.display="none";return}e.style.display="";let C;w&&t.panelIds.includes(w)&&(C=this._ctx.getTabMap().get(w));let S=e.firstElementChild,y;if(!S||S.tagName!=="svg"?(e.replaceChildren(),S=document.createElementNS("http://www.w3.org/2000/svg","svg"),S.style.display="block",y=document.createElementNS("http://www.w3.org/2000/svg","path"),y.setAttribute("fill","none"),S.appendChild(y),e.appendChild(S)):y=S.firstElementChild,y.setAttribute("stroke",b),y.setAttribute("stroke-width",String(2)),!C){this._applyStraightLine(S,y,e,2,c,l);return}const g=C.value.element.getBoundingClientRect();let _,m;if(l?(_=Math.max(0,g.top-a.top-n),m=Math.min(c,g.bottom-a.top-n)):(_=Math.max(0,g.left-a.left-n),m=Math.min(c,g.right-a.left-n)),m<=_){this._applyStraightLine(S,y,e,2,c,l);return}const v=6,D=2/2,P=this._ctx.getHeaderPosition();if(l){const T=d,A=c;S.setAttribute("width",String(T)),S.setAttribute("height",String(A)),e.style.width=`${T}px`,e.style.height=`${A}px`;const E=P==="right",I=E?T-D:D,B=E?D:T-D,N=E?-1:1,W=[`M ${I},0`,`L ${I},${_-v}`,`Q ${I},${_} ${I+N*v},${_}`,`L ${B-N*v},${_}`,`Q ${B},${_} ${B},${_+v}`,`L ${B},${m-v}`,`Q ${B},${m} ${B-N*v},${m}`,`L ${I+N*v},${m}`,`Q ${I},${m} ${I},${m+v}`,`L ${I},${A}`].join(" ");y.setAttribute("d",W)}else{const T=c,A=d;S.setAttribute("width",String(T)),S.setAttribute("height",String(A)),e.style.width=`${T}px`,e.style.height=`${A}px`;const E=P==="bottom",I=E?D:A-D,B=E?A-D:D,N=E?1:-1,W=[`M 0,${I}`,`L ${_-v},${I}`,`Q ${_},${I} ${_},${I+N*v}`,`L ${_},${B-N*v}`,`Q ${_},${B} ${_+v},${B}`,`L ${m-v},${B}`,`Q ${m},${B} ${m},${B-N*v}`,`L ${m},${I+N*v}`,`Q ${m},${I} ${m+v},${I}`,`L ${T},${I}`].join(" ");y.setAttribute("d",W)}}}class ov extends Ep{applyShape(e,t,n,o,h,w,a,l){const d=Dp(t.color,this._ctx.getColorPalette());if(o<=0||d===void 0){e.style.display="none";return}e.style.display="",e.firstElementChild&&e.replaceChildren(),e.style.backgroundColor=d,l?(e.style.width="2px",e.style.height=`${o}px`):(e.style.width=`${o}px`,e.style.height="2px")}}const av=new Map;class lv{get chipRenderers(){return this._chipRenderers}get groupUnderlines(){var e,t;return(t=(e=this._indicator)===null||e===void 0?void 0:e.underlines)!==null&&t!==void 0?t:av}get skipNextCollapseAnimation(){return this._skipNextCollapseAnimation}set skipNextCollapseAnimation(e){this._skipNextCollapseAnimation=e}constructor(e,t){this._ctx=e,this._callbacks=t,this._chipRenderers=new Map,this._indicator=null,this._skipNextCollapseAnimation=!1,this._pendingTransitionCleanups=new Map}update(){const t=this._ctx.group.model.getTabGroups(),n=new Set;for(const o of t)n.add(o.id),this._ensureChipForGroup(o),this._positionChipForGroup(o);for(const[o,h]of this._chipRenderers)n.has(o)||(h.chip.element.remove(),h.chip.dispose(),h.disposable.dispose(),this._chipRenderers.delete(o));this._updateTabGroupClasses()}refreshAccents(){var e,t;for(const n of this._ctx.group.model.getTabGroups()){const o=this._chipRenderers.get(n.id);(t=o==null?void 0:(e=o.chip).update)===null||t===void 0||t.call(e,{tabGroup:n})}this._updateTabGroupClasses()}positionAllChips(){if(this._chipRenderers.size!==0)for(const e of this._ctx.group.model.getTabGroups())this._positionChipForGroup(e)}updateDirection(){const e=this._ctx.getDirection()==="vertical";for(const[,t]of this._chipRenderers)t.dropTarget.setTargetZones(e?["top"]:["left"])}snapshotChipWidths(){const e=new Map;for(const[t,n]of this._chipRenderers)e.set(t,n.chip.element.getBoundingClientRect().width);return e}positionUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.positionUnderlines()}trackUnderlines(){var e;(e=this._indicator)===null||e===void 0||e.trackUnderlines()}setGroupDragImage(e,t,n){if(!e.dataTransfer)return;const o=this._ctx.getDirection()==="vertical",h=this._ctx.tabsList.cloneNode(!0);o?(h.classList.remove("dv-tabs-container-vertical","dv-vertical"),h.classList.add("dv-horizontal"),h.style.writingMode="horizontal-tb",h.style.height=`${this._ctx.tabsList.offsetWidth}px`):h.style.height=`${this._ctx.tabsList.offsetHeight}px`,h.style.width="auto",h.style.overflow="visible",h.style.pointerEvents="none";const w=Array.from(h.children),a=Array.from(this._ctx.tabsList.children);for(let S=w.length-1;S>=0;S--)a[S]!==n&&w[S].remove();const l=document.createElement("div");l.className="dv-groupview dv-active-group",l.style.position="fixed",l.style.top="-10000px",l.style.left="0px",l.style.height="auto",l.style.width="auto",l.style.pointerEvents="none";const u=document.createElement("div");u.className="dv-tabs-and-actions-container",u.style.height="auto",u.style.width="auto",l.appendChild(u),u.appendChild(h),this._ctx.accessor.element.appendChild(l);const d=h.querySelector(".dv-tab-group-chip"),c=n.getBoundingClientRect(),b=e.clientX-c.left,C=e.clientY-c.top;if(d){const S=d.getBoundingClientRect(),y=l.getBoundingClientRect(),g=S.left-y.left+b,_=S.top-y.top+C;e.dataTransfer.setDragImage(l,g,_)}else e.dataTransfer.setDragImage(l,b,C);requestAnimationFrame(()=>{l.remove()})}cleanupTransition(e){var t;(t=this._pendingTransitionCleanups.get(e))===null||t===void 0||t(),this._pendingTransitionCleanups.delete(e)}updateDragAndDropState(){const e=Ii(this._ctx.accessor.options);for(const t of this._chipRenderers.values())t.chip.element.draggable=e.html5,t.html5DragSource.setDisabled(!e.html5),t.pointerDragSource.setDisabled(!e.pointer),t.pointerDragSource.setTouchOnly(!e.pointerHandlesMouse)}disposeChipDrag(e){var t,n;const o=this._chipRenderers.get(e);o&&((t=o.html5DragSource)===null||t===void 0||t.dispose(),(n=o.pointerDragSource)===null||n===void 0||n.dispose())}_buildChipGhostElement(e){const t=getComputedStyle(e),n=e.cloneNode(!0);return Array.from(t).forEach(o=>{n.style.setProperty(o,t.getPropertyValue(o),t.getPropertyPriority(o))}),n.style.position="absolute",n}disposeAll(){var e;(e=this._indicator)===null||e===void 0||e.dispose(),this._indicator=null;for(const[,t]of this._pendingTransitionCleanups)t();this._pendingTransitionCleanups.clear();for(const[,t]of this._chipRenderers)t.chip.element.remove(),t.chip.dispose(),t.disposable.dispose();this._chipRenderers.clear()}_ensureIndicator(){var e,t;const o=((t=(e=this._ctx.accessor.options.theme)===null||e===void 0?void 0:e.tabGroupIndicator)!==null&&t!==void 0?t:"wrap")==="none"?ov:rv;this._indicator&&!(this._indicator instanceof o)&&(this._indicator.dispose(),this._indicator=null),this._indicator||(this._indicator=new o({tabsList:this._ctx.tabsList,getTabGroups:()=>this._ctx.group.model.getTabGroups(),getActivePanelId:()=>{var h;return(h=this._ctx.group.activePanel)===null||h===void 0?void 0:h.id},getTabMap:()=>this._ctx.getTabMap(),getChipElement:h=>{var w;return(w=this._chipRenderers.get(h))===null||w===void 0?void 0:w.chip.element},getDirection:()=>this._ctx.getDirection(),getHeaderPosition:()=>this._ctx.group.model.headerPosition,getColorPalette:()=>this._ctx.accessor.tabGroupColorPalette}))}_ensureChipForGroup(e){if(this._chipRenderers.has(e.id))return;const t=this._ctx.accessor.options.createTabGroupChipComponent,n=t?t(e):new au(this._ctx.accessor.tabGroupColorPalette);n.init({tabGroup:e,api:this._ctx.accessor.api});const o=Ii(this._ctx.accessor.options);n.element.draggable=o.html5;const h=wi.getInstance(),w=()=>(h.setData([new ni(this._ctx.accessor.id,this._ctx.group.id,null,e.id)],ni.prototype),{dispose:()=>{h.clearData(ni.prototype)}}),a=vs.createDragSource(n.element,{getData:w,disabled:!o.html5,isCancelled:()=>!Ii(this._ctx.accessor.options).html5,onDragStart:S=>{"dataTransfer"in S&&S.dataTransfer&&this.setGroupDragImage(S,e,n.element),this._callbacks.onChipDragStart(e,n,S)},onDragEnd:S=>{var y,g;(g=(y=this._callbacks).onChipDragEnd)===null||g===void 0||g.call(y,e,n,S)}});n.element.addEventListener("dragend",()=>{h.clearData(ni.prototype)},{once:!0});const l=Ki.createDragSource(n.element,{getData:w,disabled:!o.pointer,touchOnly:!o.pointerHandlesMouse,isCancelled:()=>!Ii(this._ctx.accessor.options).pointer,createGhost:()=>({element:this._buildChipGhostElement(n.element),offsetX:8,offsetY:8}),onDragStart:S=>{this._callbacks.onChipDragStart(e,n,S)}}),u=[e.onDidChange(()=>{var S;(S=n.update)===null||S===void 0||S.call(n,{tabGroup:e}),this._updateTabGroupClasses()}),e.onDidPanelChange(()=>{this._positionChipForGroup(e),this._updateTabGroupClasses()}),e.onDidCollapseChange(()=>{this._updateTabGroupClasses()}),a,l],d=S=>{l.cancelPending(),this._callbacks.onChipContextMenu(e,S)};n instanceof au?u.push(n.onContextMenu(d)):u.push(new ah(n.element,{onLongPress:d}),be(n.element,"contextmenu",d));const c=this._ctx.getDirection()==="vertical",b=new $i(n.element,{acceptedTargetZones:c?["top"]:["left"],overlayModel:{activationSize:{value:100,type:"percentage"}},canDisplayOverlay:(S,y)=>{var g;if(this._ctx.group.locked||this._ctx.accessor.options.disableDnd)return!1;const _=it();return _&&this._ctx.accessor.id===_.viewId?((g=this._ctx.accessor.options.theme)===null||g===void 0?void 0:g.tabAnimation)!=="smooth":this._ctx.group.model.canDisplayOverlay(S,y,"tab")}});u.push(b,b.onDrop(S=>{this._callbacks.onChipDrop(e,S)}));const C=new Se(...u);this._chipRenderers.set(e.id,{chip:n,html5DragSource:a,pointerDragSource:l,disposable:C,dropTarget:b}),e.collapsed&&(this._skipNextCollapseAnimation=!0)}_positionChipForGroup(e){const t=this._chipRenderers.get(e.id);if(!t)return;const n=t.chip.element,o=e.panelIds;if(o.length===0){n.remove();return}const h=o[0],w=this._ctx.getTabMap().get(h);if(!w){n.remove();return}const a=w.value.element;n.nextSibling!==a&&this._ctx.tabsList.insertBefore(n,a)}_updateTabGroupClasses(){var e;const n=this._ctx.group.model.getTabGroups(),o=this._ctx.getTabs(),h=this._ctx.getTabMap();let w=!1;const a=new Map;for(const u of n)for(const d of u.panelIds)a.set(d,u);for(const u of o){const d=u.value,c=d.panel.id,b=a.get(c),C=!!b;if(we(d.element,"dv-tab--grouped",C),b){const S=b.panelIds,y=S[0]===c,g=S[S.length-1]===c;we(d.element,"dv-tab--group-first",y),we(d.element,"dv-tab--group-last",g),hh(d.element,b.color,this._ctx.accessor.tabGroupColorPalette);const _=d.element.classList.contains("dv-tab--group-collapsed");if(!b.collapsed&&_){w=!0,d.element.classList.remove("dv-tab--group-collapsed"),d.element.classList.add("dv-tab--group-expanding"),(e=this._pendingTransitionCleanups.get(c))===null||e===void 0||e();const m=()=>{d.element.classList.remove("dv-tab--group-expanding"),d.element.style.removeProperty("width"),d.element.removeEventListener("transitionend",m),clearTimeout(v),this._pendingTransitionCleanups.delete(c)},v=setTimeout(m,300);this._pendingTransitionCleanups.set(c,m),d.element.addEventListener("transitionend",m)}}else we(d.element,"dv-tab--group-first",!1),we(d.element,"dv-tab--group-last",!1),d.element.classList.remove("dv-tab--group-collapsed","dv-tab--group-expanding"),d.element.style.removeProperty("width"),d.element.style.removeProperty("--dv-tab-group-color")}const l=new Set;for(const u of n)if(l.add(u.id),u.collapsed&&u.panelIds.some(c=>{const b=h.get(c);return b&&!b.value.element.classList.contains("dv-tab--group-collapsed")}))if(this._skipNextCollapseAnimation){const c=[];for(const b of u.panelIds){const C=h.get(b);C&&(C.value.element.style.transition="none",C.value.element.classList.add("dv-tab--group-collapsed"),c.push(C.value.element))}if(c.length>0){c[0].offsetHeight;for(const b of c)b.style.removeProperty("transition")}}else{w=!0;const c=this._ctx.getDirection()==="vertical";for(const b of u.panelIds){const C=h.get(b);if(C&&!C.value.element.classList.contains("dv-tab--group-collapsed")){const S=C.value.element.getBoundingClientRect();c?C.value.element.style.height=`${S.height}px`:C.value.element.style.width=`${S.width}px`,C.value.element.offsetHeight,C.value.element.classList.add("dv-tab--group-collapsed")}}}this._skipNextCollapseAnimation=!1,this._ensureIndicator(),this._indicator&&(this._indicator.syncUnderlineElements(l),w?this._indicator.trackUnderlines():this._indicator.positionUnderlines())}}class hv extends Se{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const t=new hg(this._tabsList);this._observerDisposable.value=new Se(t,t.onDidChange(n=>{const o=n.hasScrollX||n.hasScrollY;this.toggleDropdown({reset:!o}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}),be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1}),this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}))}}get element(){return this._element}set voidContainer(e){var t;(t=this._voidContainerListeners)===null||t===void 0||t.dispose(),this._voidContainerListeners=null,this._voidContainer=e,e&&(this._voidContainerListeners=new Se(be(e,"dragover",n=>{this._animState&&n.preventDefault()}),be(e,"drop",n=>{var o;!((o=this._animState)===null||o===void 0)&&o.sourceTabGroupId&&this._animState.currentInsertionIndex!==null&&(n.preventDefault(),n.stopPropagation(),this.handleVoidDrop())})))}handleVoidDrop(){var e,t;if(!(!((e=this._animState)===null||e===void 0)&&e.sourceTabGroupId))return!1;const n=this._animState.sourceTabGroupId,o=(t=this._animState.currentInsertionIndex)!==null&&t!==void 0?t:this._tabs.length;return this._animState=null,this._commitGroupMove(n,o),!0}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}get direction(){return this._direction}set direction(e){if(this._direction!==e){this._direction=e,this._tabsList.setAttribute("aria-orientation",e==="vertical"?"vertical":"horizontal"),this._scrollbar&&(this._scrollbar.orientation=e),bi(this._tabsList,"dv-horizontal","dv-vertical"),e==="vertical"?yi(this._tabsList,"dv-tabs-container-vertical","dv-vertical"):(bi(this._tabsList,"dv-tabs-container-vertical"),yi(this._tabsList,"dv-horizontal"));for(const t of this._tabs)t.value.setDirection(e);this._tabGroupManager.updateDirection()}}constructor(e,t,n){super(),this.group=e,this.accessor=t,this._observerDisposable=new ft,this._scrollbar=null,this._tabs=[],this._tabMap=new Map,this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._direction="horizontal",this._animState=null,this._pendingMarginCleanups=new Map,this._pendingCollapse=!1,this._flipTransitionCleanup=null,this._voidContainer=null,this._voidContainerListeners=null,this._extendedDropZone=null,this._pointerInsideTabsList=!1,this._onTabDragStart=new Q,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new Q,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container",this._tabsList.setAttribute("role","tablist"),this._tabsList.setAttribute("aria-orientation",this._direction==="vertical"?"vertical":"horizontal"),this.showTabsOverflowControl=n.showTabsOverflowControl,t.options.scrollbars==="native"?this._element=this._tabsList:(this._scrollbar=new Go(this._tabsList),this._scrollbar.orientation=this.direction,this._element=this._scrollbar.element,this.addDisposables(this._scrollbar)),this._tabGroupManager=new lv({group:this.group,accessor:this.accessor,tabsList:this._tabsList,getTabs:()=>this._tabs,getTabMap:()=>this._tabMap,getDirection:()=>this._direction},{onChipContextMenu:(o,h)=>{var w;(w=this.accessor.contextMenuService)===null||w===void 0||w.showForChip(o,this.group,h)},onChipDragStart:(o,h,w)=>{this._handleChipDragStart(o,h,w)},onChipDragEnd:()=>{this.resetDragAnimation()},onChipDrop:(o,h)=>{this._handleChipDrop(o,h)}}),this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,{dispose:()=>{var o;(o=this._flipTransitionCleanup)===null||o===void 0||o.call(this)}},Ui.getInstance().onDragEnd(()=>{this._pointerInsideTabsList=!1,this.resetDragAnimation()}),Ui.getInstance().onDragMove(o=>{this._handlePointerDragMove(o.clientX,o.clientY)}),be(this.element,"pointerdown",o=>{if(o.defaultPrevented)return;o.button===0&&this.accessor.doSetGroupActive(this.group)}),be(this._tabsList,"wheel",o=>{const h=this._direction==="vertical",w=h?o.deltaY||o.deltaX:o.deltaX||o.deltaY;if(w===0)return;const a=h?this._tabsList.scrollHeight-this._tabsList.clientHeight:this._tabsList.scrollWidth-this._tabsList.clientWidth;if(a<=0)return;const l=h?this._tabsList.scrollTop:this._tabsList.scrollLeft;w<0&&l<=0||w>0&&l>=a||(o.preventDefault(),o.stopPropagation(),h?this._tabsList.scrollTop=l+w:this._tabsList.scrollLeft=l+w)},{passive:!1}),be(this._tabsList,"keydown",o=>{this._onKeyDown(o)}),be(this._tabsList,"dragover",o=>{this._processDragOver(o.clientX)&&o.preventDefault()},!0),be(this._tabsList,"dragleave",o=>{this._processDragLeave(o.relatedTarget)},!0),be(this._tabsList,"dragend",()=>{this.resetDragAnimation()}),be(this._tabsList,"drop",o=>{var h,w,a;if(!this._animState||this._animState.currentInsertionIndex===null||((h=this.accessor.options.theme)===null||h===void 0?void 0:h.tabAnimation)!=="smooth"&&!this._animState.sourceTabGroupId)return;o.stopPropagation(),o.preventDefault(),(a=(w=this.group.model.dropTargetContainer)===null||w===void 0?void 0:w.model)===null||a===void 0||a.clear();const l=this._animState;if(this._animState=null,this._pendingCollapse=!1,l.sourceTabGroupId){this._commitGroupMove(l.sourceTabGroupId,l.currentInsertionIndex);return}const u=l.currentInsertionIndex,d=l.sourceIndex,c=u-(d!==-1&&d<u?1:0),b=this.group.model.getTabGroupForPanel(l.sourceTabId);if(c===d&&!l.targetTabGroupId&&!b){this._uncollapsSourceTab(l.sourceTabId),this.resetTabTransforms();return}this._uncollapsSourceTab(l.sourceTabId);const C=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:o,index:c,targetTabGroupId:l.targetTabGroupId}),this.runFlipAnimation(C,l.sourceTabId,l.sourceIndex===-1,{from:Math.min(d,c),to:Math.max(d,c)})},!0),Ve.from(()=>{var o;(o=this._voidContainerListeners)===null||o===void 0||o.dispose(),this.resetDragAnimation(),this._tabGroupManager.disposeAll();for(const{value:h,disposable:w}of this._tabs)w.dispose(),h.dispose();this._tabs=[],this._tabMap.clear()}))}indexOf(e){return this._tabs.findIndex(t=>t.value.panel.id===e)}getTabId(e){var t;return(t=this._tabMap.get(e))===null||t===void 0?void 0:t.value.element.id}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}_onKeyDown(e){const t=this._tabs.findIndex(a=>a.value.element===e.target);if(t===-1)return;const n=this._direction==="vertical",o=n?"ArrowDown":"ArrowRight",h=n?"ArrowUp":"ArrowLeft",w=this._tabs.length-1;switch(e.key){case o:e.preventDefault(),this._focusTab(Math.min(t+1,w));break;case h:e.preventDefault(),this._focusTab(Math.max(t-1,0));break;case"Home":e.preventDefault(),this._focusTab(0);break;case"End":e.preventDefault(),this._focusTab(w);break;case"Enter":case" ":e.preventDefault(),this.accessor.withOrigin("user",()=>this._tabs[t].value.panel.api.setActive());break;case"Delete":case"Backspace":e.preventDefault(),this._closeTab(t);break}}_closeTab(e){var t,n,o,h,w;const a=(t=this._tabs[e])===null||t===void 0?void 0:t.value;if(!a)return;const l=(w=(o=(n=this._tabs[e+1])===null||n===void 0?void 0:n.value)!==null&&o!==void 0?o:(h=this._tabs[e-1])===null||h===void 0?void 0:h.value)===null||w===void 0?void 0:w.panel.id;if(a.panel.api.close(),l!==void 0){const u=this._tabs.findIndex(d=>d.value.panel.id===l);u>-1&&this._focusTab(u)}}_focusTab(e){for(let t=0;t<this._tabs.length;t++)this._tabs[t].value.element.tabIndex=t===e?0:-1;this._tabs[e].value.element.focus()}focusActiveTab(){var e;if(this._tabs.length===0)return;const t=(e=this.group.activePanel)===null||e===void 0?void 0:e.id,n=t?this._tabs.findIndex(o=>o.value.panel.id===t):-1;this._focusTab(n>-1?n:0)}setActivePanel(e){const t=this._direction==="vertical";let n=0;for(const o of this._tabs){const h=e.id===o.value.panel.id;if(o.value.setActive(h),h){const w=o.value.element,a=w.parentElement;t?(n<a.scrollTop||n+w.clientHeight>a.scrollTop+a.clientHeight)&&(a.scrollTop=n):(n<a.scrollLeft||n+w.clientWidth>a.scrollLeft+a.clientWidth)&&(a.scrollLeft=n)}n+=t?o.value.element.clientHeight:o.value.element.clientWidth}this._tabGroupManager.groupUnderlines.size>0&&this._tabGroupManager.positionUnderlines()}openPanel(e,t=this._tabs.length){if(this._tabMap.has(e.id))return;const n=new iv(e,this.accessor,this.group);n.setContent(e.view.tab),this._direction!=="horizontal"&&n.setDirection(this._direction);const o=new Se(n.onDragStart(w=>{var a;if(this._onTabDragStart.fire({nativeEvent:w,panel:e}),((a=this.accessor.options.theme)===null||a===void 0?void 0:a.tabAnimation)==="smooth"){const l=n.element.getBoundingClientRect().width,u=this._tabs.findIndex(d=>d.value===n);this._animState={sourceTabId:e.id,sourceIndex:u,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:l/2,sourceGapWidth:l,containerLeft:this._tabsList.getBoundingClientRect().left},this._pendingCollapse=!0,requestAnimationFrame(()=>{var d,c;this._pendingCollapse=!1,this._animState&&(n.element.style.transition="none",we(n.element,"dv-tab--dragging",!0),n.element.offsetHeight,(d=(c=this._animState).currentInsertionIndex)!==null&&d!==void 0||(c.currentInsertionIndex=u),this.applyDragOverTransforms(!0),n.element.style.removeProperty("transition"))})}}),n.onTabClick(w=>{w.defaultPrevented||this.group.api.location.type==="edge"&&(this.group.activePanel===e?this.group.api.isCollapsed()?this.group.api.expand():this.group.api.collapse():(this.group.model.openPanel(e),this.group.api.isCollapsed()&&this.group.api.expand()))}),n.onPointerDown(w=>{if(w.defaultPrevented)return;const a=!this.accessor.options.disableFloatingGroups,l=this.group.api.location.type==="floating"&&this.size===1;if(a&&!l&&w.shiftKey){w.preventDefault();const u=this.accessor.getGroupPanel(n.panel.id),{top:d,left:c}=n.element.getBoundingClientRect(),{top:b,left:C}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(u,{x:c-C,y:d-b,inDragMode:!0});return}switch(w.button){case 0:this.group.api.location.type==="edge"||this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),n.onDrop(w=>{var a,l,u,d;const c=this._animState;this._animState=null,this._pendingCollapse=!1;const b=this._tabs.findIndex(C=>C.value===n);if(c){const C=w.position==="right"?b+1:b;if(c.sourceTabGroupId){this._commitGroupMove(c.sourceTabGroupId,(a=c.currentInsertionIndex)!==null&&a!==void 0?a:C);return}this._uncollapsSourceTab(c.sourceTabId);const S=this.snapshotTabPositions();this.resetTabTransforms(),this._onDrop.fire({event:w.nativeEvent,index:C,targetTabGroupId:c.targetTabGroupId}),((l=this.accessor.options.theme)===null||l===void 0?void 0:l.tabAnimation)==="smooth"&&this.runFlipAnimation(S,c.sourceTabId,c.sourceIndex===-1,c.sourceIndex!==-1?{from:Math.min(c.sourceIndex,C),to:Math.max(c.sourceIndex,C)}:void 0)}else{const C=this._direction==="vertical"?"bottom":"right",S=w.position===C?b+1:b,y=it(),g=y?this._tabs.findIndex(v=>v.value.panel.id===y.panelId):-1,_=S-(g!==-1&&g<S?1:0),m=(d=(u=this.group.model.getTabGroupForPanel(n.panel.id))===null||u===void 0?void 0:u.id)!==null&&d!==void 0?d:null;this._onDrop.fire({event:w.nativeEvent,index:_,targetTabGroupId:m})}}),n.onWillShowOverlay(w=>{this._onWillShowOverlay.fire(new hr(w,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:it}))})),h={value:n,disposable:o};this.addTab(h,t),this._tabGroupManager.positionAllChips(),this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}delete(e){var t;((t=this._animState)===null||t===void 0?void 0:t.sourceTabId)===e&&(this.resetTabTransforms(),this._animState=null),this._tabGroupManager.cleanupTransition(e);const n=this.indexOf(e),o=this._tabs.splice(n,1)[0];if(this._tabMap.delete(e),o){const{value:h,disposable:w}=o;w.dispose(),h.dispose(),h.element.remove()}this._animState&&(this._animState.tabPositions=this.snapshotTabPositions(),this._animState.chipPositions=this._tabGroupManager.snapshotChipWidths(),this.applyDragOverTransforms())}addTab(e,t=this._tabs.length){if(t<0||t>this._tabs.length)throw new Error("invalid location");const n=t<this._tabs.length?this._tabs[t].value.element:null;this._tabsList.insertBefore(e.value.element,n),this._tabs=[...this._tabs.slice(0,t),e,...this._tabs.slice(t)],this._tabMap.set(e.value.panel.id,e),this.selectedIndex<0&&(this.selectedIndex=t)}toggleDropdown(e){if(e.reset){this._onOverflowTabsChange.fire({tabs:[],tabGroups:[],reset:!0});return}const t=this._tabs.filter(h=>!nu(h.value.element,this._tabsList)).map(h=>h.value.panel.id),n=new Set(t),o=[];for(const h of this.group.model.getTabGroups()){const w=this._tabGroupManager.chipRenderers.get(h.id),a=w&&!nu(w.chip.element,this._tabsList),l=h.panelIds.length>0&&h.panelIds.every(u=>n.has(u));if((a||l)&&(o.push(h.id),h.collapsed))for(const u of h.panelIds)n.has(u)||(n.add(u),t.push(u))}this._onOverflowTabsChange.fire({tabs:t,tabGroups:o,reset:!1})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState();this._tabGroupManager.updateDragAndDropState()}updateTabGroups(){this._tabGroupManager.update()}refreshTabGroupAccent(){this._tabGroupManager.refreshAccents()}_handleChipDragStart(e,t,n){var o;const h=e.panelIds[0],w=h?this._tabs.findIndex(d=>d.value.panel.id===h):-1,a=t.element.getBoundingClientRect();let l=a.width;for(const d of e.panelIds){const c=this._tabMap.get(d);c&&(l+=c.value.element.getBoundingClientRect().width)}if(this._animState={sourceTabId:"",sourceIndex:w,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:e.id,sourceGroupPanelIds:new Set(e.panelIds),sourceChipWidth:a.width,cursorOffsetFromDragLeft:n.clientX-a.left,sourceGapWidth:l,containerLeft:this._tabsList.getBoundingClientRect().left},((o=this.accessor.options.theme)===null||o===void 0?void 0:o.tabAnimation)!=="smooth")return;const u=new Set(e.panelIds);this._pendingCollapse=!0,requestAnimationFrame(()=>{var d,c;if(this._pendingCollapse=!1,!this._animState)return;for(const S of this._tabs)u.has(S.value.panel.id)&&(S.value.element.style.transition="none",we(S.value.element,"dv-tab--dragging",!0));const b=this._tabGroupManager.chipRenderers.get(e.id);b&&(b.chip.element.style.transition="none",we(b.chip.element,"dv-tab-group-chip--dragging",!0)),this._tabsList.offsetHeight;const C=this._tabGroupManager.groupUnderlines.get(e.id);C&&(C.style.display="none"),(d=(c=this._animState).currentInsertionIndex)!==null&&d!==void 0||(c.currentInsertionIndex=w),this.applyDragOverTransforms(!0);for(const S of this._tabs)u.has(S.value.panel.id)&&S.value.element.style.removeProperty("transition");b&&b.chip.element.style.removeProperty("transition")})}_handleChipDrop(e,t){const n=e.panelIds[0];if(!n)return;const o=this._tabs.findIndex(l=>l.value.panel.id===n);if(o===-1)return;const h=it(),w=h&&h.groupId===this.group.id&&h.panelId?this._tabs.findIndex(l=>l.value.panel.id===h.panelId):-1,a=o-(w!==-1&&w<o?1:0);this._onDrop.fire({event:t.nativeEvent,index:a,targetTabGroupId:null})}setExtendedDropZone(e){this._extendedDropZone=e}setExternalInsertionIndex(e){this._animState&&e!==this._animState.currentInsertionIndex&&(this._animState.currentInsertionIndex=e,this.applyDragOverTransforms())}clearExternalAnimState(){this._animState&&(this.resetTabTransforms(),this._animState.sourceIndex===-1?this._animState=null:this._animState.currentInsertionIndex=null)}snapshotTabPositions(){const e=new Map;for(const t of this._tabs)e.set(t.value.panel.id,t.value.element.getBoundingClientRect());return e}getAverageTabWidth(){if(this._tabs.length===0)return 0;const e=this._direction==="vertical";let t=0;for(const n of this._tabs){const o=n.value.element.getBoundingClientRect();t+=e?o.height:o.width}return t/this._tabs.length}_handlePointerDragMove(e,t){var n;const h=((n=this._tabsList.ownerDocument)!==null&&n!==void 0?n:document).elementFromPoint(e,t);if(!(!!h&&(this._tabsList.contains(h)||!!this._extendedDropZone&&this._extendedDropZone.contains(h)))){this._pointerInsideTabsList&&(this._pointerInsideTabsList=!1,this._processDragLeave(h));return}this._pointerInsideTabsList=!0,this._processDragOver(e)}_processDragOver(e){var t,n,o,h;if(this.accessor.options.disableDnd)return!1;if(this._animState){const w=it();w!=null&&w.tabGroupId&&w.groupId!==this.group.id&&this._animState.sourceTabGroupId!==w.tabGroupId&&(this._animState=null)}if(!this._animState){const w=it();if(((t=this.accessor.options.theme)===null||t===void 0?void 0:t.tabAnimation)==="default"&&!(w!=null&&w.tabGroupId))return!1;if(w&&(w.panelId||w.tabGroupId)&&w.groupId!==this.group.id){const a=this.getAverageTabWidth();if(w.tabGroupId){const l=this.accessor.getPanel(w.groupId),u=l==null?void 0:l.model.getTabGroups().find(b=>b.id===w.tabGroupId),d=(n=u==null?void 0:u.panelIds.length)!==null&&n!==void 0?n:1,c=a*d+a;this._animState={sourceTabId:"",sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:w.tabGroupId,sourceGroupPanelIds:u?new Set(u.panelIds):new Set,sourceChipWidth:a,cursorOffsetFromDragLeft:c/2,sourceGapWidth:c,containerLeft:this._tabsList.getBoundingClientRect().left}}else this._animState={sourceTabId:w.panelId,sourceIndex:-1,tabPositions:this.snapshotTabPositions(),chipPositions:this._tabGroupManager.snapshotChipWidths(),currentInsertionIndex:null,targetTabGroupId:null,sourceTabGroupId:null,sourceGroupPanelIds:null,sourceChipWidth:0,cursorOffsetFromDragLeft:a/2,sourceGapWidth:a,containerLeft:this._tabsList.getBoundingClientRect().left}}else return!1}return this._animState.sourceIndex!==-1&&((h=(o=this.group.model.dropTargetContainer)===null||o===void 0?void 0:o.model)===null||h===void 0||h.clear()),this.handleDragOver({clientX:e}),!0}_processDragLeave(e){var t,n,o;if(!this._animState||e&&this._tabsList.contains(e))return;if(e&&(!((t=this._extendedDropZone)===null||t===void 0)&&t.contains(e))){this.resetTabTransforms(),this._animState.currentInsertionIndex=null;return}this._voidContainer&&e&&(e===this._voidContainer||this._voidContainer.contains(e))||(this.resetTabTransforms(),this._animState.sourceIndex===-1?((o=(n=this.group.model.dropTargetContainer)===null||n===void 0?void 0:n.model)===null||o===void 0||o.clear(),this._animState=null):this._animState.currentInsertionIndex=null)}handleDragOver(e){var t,n,o,h,w;if(!this._animState)return;const a=e.clientX;let l=null,u=null;const d=this._animState.sourceGroupPanelIds,b=a-this._animState.cursorOffsetFromDragLeft-this._animState.containerLeft;let C=0;const S=new Map;if(this._tabGroupManager.chipRenderers.size>0){const y=this.group.model.getTabGroups();for(const g of y)g.id!==this._animState.sourceTabGroupId&&g.panelIds.length>0&&S.set(g.panelIds[0],g.id)}for(let y=0;y<this._tabs.length;y++){const g=this._tabs[y].value;if(g.panel.id===this._animState.sourceTabId||d!=null&&d.has(g.panel.id))continue;const _=S.get(g.panel.id);if(_){const D=(t=this._animState.chipPositions.get(_))!==null&&t!==void 0?t:0;if(C+D>b){l??(l=y);break}C+=D}const m=this._animState.tabPositions.get(g.panel.id),v=m?m.width:g.element.getBoundingClientRect().width;if(C+v/2<=b)C+=v,l=y+1;else{l??(l=y);break}}if(l!==null&&this._tabGroupManager.chipRenderers.size>0){const y=!!this._animState.sourceTabGroupId,g=this.group.model.getTabGroups();let _=0;for(let m=0;m<this._tabs.length;m++){const v=this._tabs[m].value;if(v.panel.id===this._animState.sourceTabId||d!=null&&d.has(v.panel.id))continue;if(m>=l)break;const D=S.get(v.panel.id);D&&(_+=(n=this._animState.chipPositions.get(D))!==null&&n!==void 0?n:0);const P=this._animState.tabPositions.get(v.panel.id);_+=P?P.width:v.element.getBoundingClientRect().width}for(const m of g){const v=m.panelIds.filter(E=>E!==this._animState.sourceTabId&&!(d!=null&&d.has(E)));if(v.length===0)continue;const D=this._tabs.findIndex(E=>E.value.panel.id===v[0]),P=this._tabs.findIndex(E=>E.value.panel.id===v[v.length-1]);if(D===-1||P===-1)continue;const T=l>=D&&l<=P,A=!T&&l===D-1;if(!(!T&&!A)){if(y&&T){const E=(D+P+1)/2;l<E?l=D:l=P+1;break}if(y&&A)break;if(A){let E=!0;for(let N=l;N<D;N++){const W=this._tabs[N].value.panel.id;if(W!==this._animState.sourceTabId&&!(d!=null&&d.has(W))){E=!1;break}}if(!E)continue;const I=(o=this._animState.chipPositions.get(m.id))!==null&&o!==void 0?o:0,B=m.collapsed?this._animState.containerLeft+_+I/2:this._animState.containerLeft+_+I;a>=B&&(l=D,u=m.id);break}if(T){const E=(h=this._animState.chipPositions.get(m.id))!==null&&h!==void 0?h:0,I=this._animState.containerLeft+_+E;l===D?a>=I&&(u=m.id):u=m.id;break}}}}l===this._animState.currentInsertionIndex&&u===this._animState.targetTabGroupId||(this._animState.currentInsertionIndex=l,this._animState.targetTabGroupId=u,((w=this.accessor.options.theme)===null||w===void 0?void 0:w.tabAnimation)==="smooth"&&this.applyDragOverTransforms())}_removeClassInstantlyBatch(e,t){const n=[];for(const o of e)o.classList.contains(t)&&(o.style.transition="none",we(o,t,!1),n.push(o));if(n.length>0){n[0].offsetHeight;for(const o of n)o.style.removeProperty("transition")}}_uncollapsSourceTab(e){const t=this._tabMap.get(e);t&&this._removeClassInstantlyBatch([t.value.element],"dv-tab--dragging")}applyDragOverTransforms(e=!1){if(!this._animState||this._animState.currentInsertionIndex===null){this.resetTabTransforms();return}if(this._pendingCollapse)return;const t=this._animState.currentInsertionIndex;let n;const o=this._animState.sourceGroupPanelIds;if(this._animState.sourceTabGroupId&&o)n=this._animState.sourceGapWidth;else{const d=this._animState.tabPositions.get(this._animState.sourceTabId);n=d?d.width:this.getAverageTabWidth()}let h=null;if(this._tabGroupManager.chipRenderers.size>0){const d=this.group.model.getTabGroups();for(const c of d){if(c.id===this._animState.sourceTabGroupId||c.panelIds.includes(this._animState.sourceTabId))continue;const b=c.panelIds.filter(y=>y!==this._animState.sourceTabId&&!(o!=null&&o.has(y)));if(b.length===0)continue;const C=this._tabs.findIndex(y=>y.value.panel.id===b[0]);if((!this._animState.targetTabGroupId||this._animState.targetTabGroupId===c.id&&c.collapsed)&&C>=t){let y=!1;for(let g=t;g<C;g++){const _=this._tabs[g].value.panel.id;if(_!==this._animState.sourceTabId&&!(o!=null&&o.has(_))){y=!0;break}}if(!y){const g=this._tabGroupManager.chipRenderers.get(c.id);g&&(h=g.chip.element)}break}}}const w=d=>d.classList.contains("dv-tab-group-chip")?"dv-tab-group-chip--shifting":"dv-tab--shifting",a=(d,c)=>{e?(d.style.transition="none",d.style.marginLeft=c,d.offsetHeight,d.style.removeProperty("transition")):d.style.marginLeft=c,we(d,w(d),!0)},l=d=>{const c=w(d),b=this._pendingMarginCleanups.get(d);if(b&&b(),e||!d.style.marginLeft)d.style.removeProperty("margin-left"),we(d,c,!1);else{d.style.marginLeft="0px",we(d,c,!0);const C=()=>{d.style.removeProperty("margin-left"),we(d,c,!1),d.removeEventListener("transitionend",C),clearTimeout(S),this._pendingMarginCleanups.delete(d)},S=setTimeout(C,300);this._pendingMarginCleanups.set(d,C),d.addEventListener("transitionend",C)}};let u=!1;for(const[d,c]of this._tabGroupManager.chipRenderers)d!==this._animState.sourceTabGroupId&&l(c.chip.element);h&&(a(h,`${n}px`),u=!0);for(let d=0;d<this._tabs.length;d++){const c=this._tabs[d].value;c.panel.id!==this._animState.sourceTabId&&(o!=null&&o.has(c.panel.id)||(!u&&d>=t?(a(c.element,`${n}px`),u=!0):l(c.element)))}this._tabGroupManager.trackUnderlines()}resetTabTransforms(){for(const[,e]of this._pendingMarginCleanups)e();this._pendingMarginCleanups.clear();for(const e of this._tabs)e.value.element.style.removeProperty("margin-left"),e.value.element.style.removeProperty("margin-right"),e.value.element.style.removeProperty("margin-top"),e.value.element.style.removeProperty("margin-bottom"),e.value.element.style.removeProperty("transform"),we(e.value.element,"dv-tab--shifting",!1);for(const[,e]of this._tabGroupManager.chipRenderers)e.chip.element.style.removeProperty("margin-left"),we(e.chip.element,"dv-tab-group-chip--shifting",!1);this._tabGroupManager.positionUnderlines()}_commitGroupMove(e,t){var n,o;const h=it();if(this._tabGroupManager.disposeChipDrag(e),this.group.model.getTabGroups().some(a=>a.id===e))if(((n=this.accessor.options.theme)===null||n===void 0?void 0:n.tabAnimation)==="smooth"){this._clearGroupDragClasses(e);const a=this.snapshotTabPositions();this.resetTabTransforms(),this.group.model.moveTabGroup(e,t),this.runFlipAnimation(a,"",!1)}else this._tabGroupManager.skipNextCollapseAnimation=!0,this.group.model.moveTabGroup(e,t);else h&&(this.resetTabTransforms(),this.accessor.moveGroupOrPanel({from:{groupId:h.groupId,tabGroupId:(o=h.tabGroupId)!==null&&o!==void 0?o:e},to:{group:this.group,position:"center",index:t}}))}_clearGroupDragClasses(e){const t=this._tabGroupManager.chipRenderers.get(e);t&&this._removeClassInstantlyBatch([t.chip.element],"dv-tab-group-chip--dragging"),this._removeClassInstantlyBatch(this._tabs.map(o=>o.value.element),"dv-tab--dragging");const n=this._tabGroupManager.groupUnderlines.get(e);n&&n.style.removeProperty("display"),this._tabGroupManager.skipNextCollapseAnimation=!0}resetDragAnimation(){if(this._pendingCollapse=!1,this._animState){this.resetTabTransforms(),this._animState.sourceTabGroupId?this._clearGroupDragClasses(this._animState.sourceTabGroupId):this._removeClassInstantlyBatch(this._tabs.map(e=>e.value.element),"dv-tab--dragging"),this._animState=null;for(const[,e]of this._tabGroupManager.groupUnderlines)e.style.removeProperty("display")}}runFlipAnimation(e,t,n=!1,o){const h=this._direction==="vertical";let w=!1;for(let a=0;a<this._tabs.length;a++){const l=this._tabs[a],u=l.value.panel.id;if(u===t){if(n){const C=l.value.element.getBoundingClientRect();l.value.element.style.transform=h?`translateY(${C.height}px)`:`translateX(${C.width}px)`,we(l.value.element,"dv-tab--shifting",!0),w=!0}continue}if(o!==void 0&&(a<o.from||a>o.to))continue;const d=e.get(u);if(!d)continue;const c=l.value.element.getBoundingClientRect(),b=h?d.top-c.top:d.left-c.left;Math.abs(b)<1||(l.value.element.style.transform=h?`translateY(${b}px)`:`translateX(${b}px)`,we(l.value.element,"dv-tab--shifting",!0),w=!0)}w&&requestAnimationFrame(()=>{var a;for(const d of this._tabs)d.value.element.style.transform&&(d.value.element.style.transform="");this._tabGroupManager.trackUnderlines(),(a=this._flipTransitionCleanup)===null||a===void 0||a.call(this);const l=d=>{if(d.propertyName==="transform"){u();for(const c of this._tabs)we(c.value.element,"dv-tab--shifting",!1);this._tabGroupManager.positionUnderlines()}},u=()=>{this._tabsList.removeEventListener("transitionend",l),this._flipTransitionCleanup=null};this._flipTransitionCleanup=u,this._tabsList.addEventListener("transitionend",l)})}}const ch=p=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",p.height),e.setAttributeNS(null,"width",p.width),e.setAttributeNS(null,"viewBox",p.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttributeNS(null,"d",p.path),e.appendChild(t),e},cv=()=>ch({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),dv=()=>ch({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),kp=()=>ch({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function uv(){const p=document.createElement("div");p.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const t=kp();return p.appendChild(t),p.appendChild(e),{element:p,update:n=>{e.textContent=`${n.tabs}`}}}class pv extends Se{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get direction(){return this._direction}set direction(e){this._direction=e,e==="vertical"?(yi(this._element,"dv-groupview-header-vertical"),yi(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e):(bi(this._element,"dv-groupview-header-vertical"),bi(this.rightActionsContainer,"dv-right-actions-container-vertical"),this.tabs.direction=e)}get element(){return this._element}constructor(e,t){super(),this.accessor=e,this.group=t,this._hidden=!1,this._direction="horizontal",this.dropdownPart=null,this._overflowTabs=[],this._overflowTabGroups=[],this._dropdownDisposable=new ft,this._onDrop=new Q,this.onDrop=this._onDrop.event,this._onGroupDragStart=new Q,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",we(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new hv(t,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new nv(this.accessor,this.group),this.tabs.voidContainer=this.voidContainer.element,this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.tabs.setExtendedDropZone(this._element),this.addDisposables(this.tabs.onDrop(n=>this._onDrop.fire(n)),this.tabs.onWillShowOverlay(n=>this._onWillShowOverlay.fire(n)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(n=>{this.toggleDropdown(n)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(n=>{this._onGroupDragStart.fire({nativeEvent:n,group:this.group})}),this.voidContainer.onDrop(n=>{this.tabs.handleVoidDrop()||this._onDrop.fire({event:n.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(n=>{this._onWillShowOverlay.fire(new hr(n,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:it}))}),be(this.leftActionsContainer,"dragleave",n=>{const o=n.relatedTarget;!this.leftActionsContainer.contains(o)&&!this._element.contains(o)&&this.tabs.clearExternalAnimState()}),be(this.voidContainer.element,"dragleave",n=>{const o=n.relatedTarget;this.voidContainer.element.contains(o)||(this._element.contains(o)?this.tabs.setExternalInsertionIndex(null):this.tabs.clearExternalAnimState())}),be(this.voidContainer.element,"pointerdown",n=>{if(n.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&n.shiftKey&&this.group.api.location.type!=="floating"&&this.group.api.location.type!=="edge"){n.preventDefault();const{top:h,left:w}=this.element.getBoundingClientRect(),{top:a,left:l}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:w-l+20,y:h-a+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}getTabId(e){return this.tabs.getTabId(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}focusActiveTab(){this.tabs.focusActiveTab()}openPanel(e,t=this.tabs.size){this.tabs.openPanel(e,t),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){we(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const t=e.reset?[]:e.tabs,n=e.reset?[]:e.tabGroups;this._overflowTabs=t,this._overflowTabGroups=n;const o=this._overflowTabs.length;if(o>0&&this.dropdownPart){this.dropdownPart.update({tabs:o});return}if(o===0){this._dropdownDisposable.dispose();return}const h=document.createElement("div");h.className="dv-tabs-overflow-dropdown-root";const w=uv();w.update({tabs:o}),this.dropdownPart=w,h.appendChild(w.element),this.rightActionsContainer.prepend(h),this._dropdownDisposable.value=new Se(Ve.from(()=>{var a,l;h.remove(),(l=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||l===void 0||l.call(a),this.dropdownPart=null}),be(h,"pointerdown",a=>{a.preventDefault()},{capture:!0}),be(h,"click",a=>{const l=document.createElement("div");l.style.overflow="auto",l.className="dv-tabs-overflow-container";const u=new Set(this._overflowTabGroups),d=this.group.model.getTabGroups(),c=new Map;for(const S of d)if(u.has(S.id))for(const y of S.panelIds)c.set(y,S);const b=new Set;for(const S of this.tabs.tabs.filter(y=>this._overflowTabs.includes(y.panel.id))){const y=c.get(S.panel.id);if(y&&!b.has(y.id)){b.add(y.id);const D=document.createElement("div");D.className="dv-tabs-overflow-group-header";const P=document.createElement("span");P.className="dv-tabs-overflow-group-color",hh(P,y.color,this.accessor.tabGroupColorPalette),D.appendChild(P);const T=document.createElement("span");if(T.className="dv-tabs-overflow-group-label",T.textContent=y.label||y.id,D.appendChild(T),y.collapsed){const A=document.createElement("span");A.className="dv-tabs-overflow-group-collapsed-badge",A.textContent=`${y.panelIds.length}`,D.appendChild(A)}D.addEventListener("click",()=>{this.accessor.getPopupServiceForGroup(this.group).close(),y.collapsed&&y.expand();const A=y.panelIds[0];if(A){const E=this.group.panels.find(I=>I.id===A);this.accessor.withOrigin("user",()=>E==null?void 0:E.api.setActive())}}),l.appendChild(D)}const g=this.group.panels.find(D=>D===S.panel),m=g.view.createTabRenderer("headerOverflow").element,v=document.createElement("div");we(v,"dv-tab",!0),we(v,"dv-active-tab",g.api.isActive),we(v,"dv-inactive-tab",!g.api.isActive),y&&we(v,"dv-tab--grouped",!0),v.addEventListener("click",D=>{this.accessor.getPopupServiceForGroup(this.group).close(),!D.defaultPrevented&&(y!=null&&y.collapsed&&y.expand(),S.element.scrollIntoView(),this.accessor.withOrigin("user",()=>S.panel.api.setActive()))}),v.appendChild(m),l.appendChild(v)}const C=np(h);this.accessor.getPopupServiceForGroup(this.group).openPopover(l,{x:a.clientX,y:a.clientY,zIndex:C!=null&&C.style.zIndex?`calc(${C.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}updateTabGroups(){this.tabs.updateTabGroups()}refreshTabGroupAccent(){this.tabs.refreshTabGroupAccent()}}class Pp extends Qu{constructor(e,t,n,o,h){super(),this.nativeEvent=e,this.target=t,this.position=n,this.getData=o,this.group=h}}const $l=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,transformFloatingGroupDrag:void 0,floatingGroupDragHandle:void 0,popoutUrl:void 0,nonce:void 0,defaultRenderer:void 0,defaultHeaderPosition:void 0,debug:void 0,locked:void 0,disableDnd:void 0,dndStrategy:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0,getTabContextMenuItems:void 0,getTabGroupChipContextMenuItems:void 0,createTabGroupChipComponent:void 0,createGroupDragGhostComponent:void 0,dropOverlayModel:void 0,announcements:void 0,getAnnouncement:void 0,announcer:void 0,messages:void 0,keyboardNavigation:void 0,tabGroupColors:void 0,tabGroupAccent:void 0});function fv(p){return!!p.referencePanel}function mv(p){return!!p.referenceGroup}function gv(p){return!!p.referencePanel}function vv(p){return!!p.referenceGroup}class _v extends Se{get label(){return this._label}get color(){return this._color}get componentParams(){return this._componentParams}setLabel(e){this.isDisposed||this._label===e||(this._label=e,this._onDidChange.fire())}setColor(e){if(this.isDisposed)return;const t=e===""?void 0:e;this._color!==t&&(this._color=t,this._onDidChange.fire())}setComponentParams(e){this.isDisposed||(this._componentParams=e,this._onDidChange.fire())}get collapsed(){return this._collapsed}get panelIds(){return this._panelIds}get size(){return this._panelIds.length}get isEmpty(){return this._panelIds.length===0}constructor(e,t){var n,o;super(),this.id=e,this._collapsed=!1,this._panelIds=[],this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidPanelChange=new Q,this.onDidPanelChange=this._onDidPanelChange.event,this._onDidCollapseChange=new Q,this.onDidCollapseChange=this._onDidCollapseChange.event,this._onDidDestroy=new Q,this.onDidDestroy=this._onDidDestroy.event,this._label=(n=t==null?void 0:t.label)!==null&&n!==void 0?n:"",this._color=(t==null?void 0:t.color)===""||t==null?void 0:t.color,this._collapsed=(o=t==null?void 0:t.collapsed)!==null&&o!==void 0?o:!1,this._componentParams=t==null?void 0:t.componentParams,this.addDisposables(this._onDidChange,this._onDidPanelChange,this._onDidCollapseChange,this._onDidDestroy)}addPanel(e,t){if(this.isDisposed||this._panelIds.includes(e))return;const n=t!==void 0?Math.max(0,Math.min(t,this._panelIds.length)):this._panelIds.length;this._panelIds.splice(n,0,e),this._onDidPanelChange.fire({panelId:e,type:"add"})}removePanel(e){if(this.isDisposed)return!1;const t=this._panelIds.indexOf(e);return t===-1?!1:(this._panelIds.splice(t,1),this._onDidPanelChange.fire({panelId:e,type:"remove"}),!0)}indexOfPanel(e){return this._panelIds.indexOf(e)}containsPanel(e){return this._panelIds.includes(e)}collapse(){this.isDisposed||this._collapsed||(this._collapsed=!0,this._onDidCollapseChange.fire(!0))}expand(){this.isDisposed||!this._collapsed||(this._collapsed=!1,this._onDidCollapseChange.fire(!1))}toggle(){this._collapsed?this.expand():this.collapse()}toJSON(){const e={id:this.id,collapsed:this._collapsed,panelIds:[...this._panelIds]};return this._label&&(e.label=this._label),this._color!==void 0&&(e.color=this._color),this._componentParams!==void 0&&(e.componentParams=this._componentParams),e}dispose(){this._onDidDestroy.fire(),super.dispose()}}class dh extends ih{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class Tp extends dh{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class wv extends Se{get tabGroups(){return this._tabGroups}get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get contentContainerId(){return this.contentContainer.element.id}get contentDropTarget(){return this.contentContainer.dropTarget}get locked(){return this._locked}set locked(e){this._locked=e,we(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?Gl(document.activeElement,this.contentContainer.element):!1}get headerPosition(){var e;return(e=this._headerPosition)!==null&&e!==void 0?e:"top"}set headerPosition(e){var t;this._headerPosition=e,bi(this.container,"dv-groupview-header-top","dv-groupview-header-bottom","dv-groupview-header-left","dv-groupview-header-right"),yi(this.container,`dv-groupview-header-${e}`);const n=e==="top"||e==="bottom"?"horizontal":"vertical";this.tabsContainer.direction=n,this.header.direction=n,!((t=this._activePanel)===null||t===void 0)&&t.layout&&this._activePanel.layout(this._width,this._height),this.updateHeaderActions()}get location(){return this._location}set location(e){this._location=e,we(this.container,"dv-groupview-floating",!1),we(this.container,"dv-groupview-popout",!1),we(this.container,"dv-groupview-edge",!1);const t=n=>{this.contentContainer.dropTarget.setTargetZones(n),this.contentContainer.pointerDropTarget.setTargetZones(n)};switch(e.type){case"grid":t(["top","bottom","left","right","center"]);break;case"floating":t(["top","bottom","left","right","center"]),we(this.container,"dv-groupview-floating",!0);break;case"popout":t(["top","bottom","left","right","center"]),we(this.container,"dv-groupview-popout",!0);break;case"edge":t(["center"]),we(this.container,"dv-groupview-edge",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,t,n,o,h){var w,a;super(),this.container=e,this.accessor=t,this.id=n,this.options=o,this.groupPanel=h,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._tabGroupDisposables=new Map,this._pendingMicrotaskDisposables=new Set,this._onMove=new Q,this.onMove=this._onMove.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new Q,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new Q,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new Q,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new Q,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new Q,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new Q,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new Q,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new Q,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this._tabGroups=[],this._tabGroupMap=new Map,this._panelToTabGroup=new Map,this._tabGroupIdCounter=0,this._pendingTabGroupUpdate=!1,this._onDidCreateTabGroup=new Q,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new Q,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new Q,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new Q,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new Q,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new Q,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,we(this.container,"dv-groupview",!0),this.container.setAttribute("role","region"),this._api=new rh(this.accessor),this.tabsContainer=new pv(this.accessor,this.groupPanel),this.contentContainer=new qg(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!o.hideHeader,this.locked=(w=o.locked)!==null&&w!==void 0?w:!1,this.headerPosition=(a=o.headerPosition)!==null&&a!==void 0?a:t.defaultHeaderPosition,this.addDisposables(this._onDidPanelTitleChange.event(()=>this.updateAccessibleLabel()),this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(l=>{this._onTabDragStart.fire(l)}),this.tabsContainer.onGroupDragStart(l=>{this._onGroupDragStart.fire(l)}),this.tabsContainer.onDrop(l=>{var u;const d=it(),c=(u=d==null?void 0:d.panelId)!==null&&u!==void 0?u:null;if(this.handleDropEvent("header",l.event,"center",l.index),c&&l.targetTabGroupId){const b=this._tabGroupMap.get(l.targetTabGroupId);let C;if(b){const S=this._panels.findIndex(y=>y.id===c);if(S!==-1){C=0;for(const y of b.panelIds)this._panels.findIndex(_=>_.id===y)<S&&C++}}this.addPanelToTabGroup(l.targetTabGroupId,c,C)}else c&&l.targetTabGroupId===null&&this.removePanelFromTabGroup(c)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(l=>{this.handleDropEvent("content",l.nativeEvent,l.position)}),this.contentContainer.pointerDropTarget.onDrop(l=>{this.handleDropEvent("content",l.nativeEvent,l.position)}),this.tabsContainer.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(l)}),this.contentContainer.dropTarget.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(new hr(l,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:it}))}),this.contentContainer.pointerDropTarget.onWillShowOverlay(l=>{this._onWillShowOverlay.fire(new hr(l,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:it}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOver,this._onDidPanelTitleChange,this._onDidPanelParametersChange,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,this._onDidCreateTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidDestroyTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidAddPanelToTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidRemovePanelFromTabGroup.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupChange.event(()=>{this._scheduleTabGroupUpdate()}),this._onDidTabGroupCollapsedChange.event(()=>{this._scheduleTabGroupUpdate()}))}_scheduleTabGroupUpdate(){this._pendingTabGroupUpdate||(this._pendingTabGroupUpdate=!0,queueMicrotask(()=>{this._pendingTabGroupUpdate=!1,this.isDisposed||this.tabsContainer.updateTabGroups()}))}_bracketTabGroupMutation(e){return this.accessor.mutation?this.accessor.mutation("tab-group",e):e()}createTabGroup(e){return this._bracketTabGroupMutation(()=>this._doCreateTabGroup(e))}_doCreateTabGroup(e){var t;const n=(t=e==null?void 0:e.id)!==null&&t!==void 0?t:`tg-${this.id}-${this._tabGroupIdCounter++}`,o=new _v(n,{label:e==null?void 0:e.label,color:e==null?void 0:e.color,collapsed:e==null?void 0:e.collapsed,componentParams:e==null?void 0:e.componentParams});return this._tabGroups.push(o),this._tabGroupMap.set(n,o),this._tabGroupDisposables.set(n,new Se(o.onDidChange(()=>{this._onDidTabGroupChange.fire({tabGroup:o})}),o.onDidCollapseChange(h=>{h?this._handleGroupCollapse(o):this._handleGroupExpand(o),this._onDidTabGroupCollapsedChange.fire({tabGroup:o})}),o.onDidDestroy(()=>{this._removeTabGroupInternal(o)}))),this._onDidCreateTabGroup.fire({tabGroup:o}),o}dissolveTabGroup(e){const t=this._tabGroupMap.get(e);t&&this._bracketTabGroupMutation(()=>{const n=[...t.panelIds];for(const o of n)t.removePanel(o),this._panelToTabGroup.delete(o),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:o});t.dispose()})}addPanelToTabGroup(e,t,n){const o=this._tabGroupMap.get(e);if(!o||!this._panels.some(w=>w.id===t))return;const h=this.getTabGroupForPanel(t);h&&h.id===e||this._bracketTabGroupMutation(()=>{h&&this.removePanelFromTabGroup(t),o.addPanel(t,n),this._panelToTabGroup.set(t,o),this._enforceContiguity(o,t),this._onDidAddPanelToTabGroup.fire({tabGroup:o,panelId:t})})}movePanelWithinGroup(e,t,n){const o=this._tabGroupMap.get(e);!o||!o.containsPanel(t)||(o.removePanel(t),o.addPanel(t,n),this._enforceContiguity(o,t),this.tabsContainer.updateTabGroups())}movePanelBetweenGroups(e,t,n){const o=this._findTabGroupForPanel(e),h=this._tabGroupMap.get(t);h&&(o&&(o.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:o,panelId:e}),o.isEmpty&&o.dispose()),h.addPanel(e,n),this._panelToTabGroup.set(e,h),this._enforceContiguity(h,e),this._onDidAddPanelToTabGroup.fire({tabGroup:h,panelId:e}))}moveTabGroup(e,t){const n=this._tabGroupMap.get(e);if(!n||n.panelIds.length===0)return;const o=new Set(n.panelIds),h=n.panelIds.map(u=>this._panels.find(d=>d.id===u)).filter(u=>u!==void 0);if(h.length===0)return;let w=0;for(let u=0;u<Math.min(t,this._panels.length);u++)o.has(this._panels[u].id)&&w++;for(const u of h){const d=this._panels.indexOf(u);d!==-1&&this._panels.splice(d,1)}const a=t-w,l=Math.max(0,Math.min(a,this._panels.length));this._panels.splice(l,0,...h);for(const u of this._panels)this.tabsContainer.delete(u.id);for(let u=0;u<this._panels.length;u++)this.tabsContainer.openPanel(this._panels[u],u);this.tabsContainer.updateTabGroups()}_enforceContiguity(e,t){const n=this._panels.find(l=>l.id===t);if(!n)return;const o=e.indexOfPanel(t),h=this._computeGlobalIndex(e,o),w=this._panels.indexOf(n);if(w===h)return;this._panels.splice(w,1);const a=h>w?h-1:h;this._panels.splice(a,0,n),this.tabsContainer.delete(t),this.tabsContainer.openPanel(n,a)}_computeGlobalIndex(e,t){const n=e.panelIds;if(n.length<=1){const o=this._panels.find(h=>h.id===n[0]);return o?this._panels.indexOf(o):this._panels.length}for(let o=0;o<n.length;o++){if(o===t)continue;const h=this._panels.find(w=>w.id===n[o]);if(h){const w=this._panels.indexOf(h);return Math.max(0,w+(t-o))}}return this._panels.length}removePanelFromTabGroup(e){const t=this._findTabGroupForPanel(e);t&&this._bracketTabGroupMutation(()=>{t.removePanel(e),this._panelToTabGroup.delete(e),this._onDidRemovePanelFromTabGroup.fire({tabGroup:t,panelId:e}),t.isEmpty&&t.dispose()})}getTabGroups(){return this._tabGroups}updateTabGroups(){this.tabsContainer.updateTabGroups()}refreshTabGroupAccent(){this.tabsContainer.refreshTabGroupAccent()}refreshWatermark(){var e,t;this.watermark&&(this.watermark.element.remove(),(t=(e=this.watermark).dispose)===null||t===void 0||t.call(e),this.watermark=void 0),this.updateContainer()}getTabGroupForPanel(e){return this._findTabGroupForPanel(e)}_findTabGroupForPanel(e){return this._panelToTabGroup.get(e)}_removeTabGroupInternal(e){const t=this._tabGroups.indexOf(e);if(t!==-1){this._tabGroups.splice(t,1),this._tabGroupMap.delete(e.id);for(const o of e.panelIds)this._panelToTabGroup.delete(o);this._onDidDestroyTabGroup.fire({tabGroup:e});const n=this._tabGroupDisposables.get(e.id);this._tabGroupDisposables.delete(e.id),n&&(this._pendingMicrotaskDisposables.add(n),queueMicrotask(()=>{this._pendingMicrotaskDisposables.delete(n),n.dispose()}))}}_handleGroupCollapse(e){if(!this._activePanel||!e.containsPanel(this._activePanel.id))return;const t=this._panels.indexOf(this._activePanel);for(let n=t+1;n<this._panels.length;n++){const o=this._panels[n],h=this._findTabGroupForPanel(o.id);if(!h||!h.collapsed){this.doSetActivePanel(o),this.updateContainer();return}}for(let n=t-1;n>=0;n--){const o=this._panels[n],h=this._findTabGroupForPanel(o.id);if(!h||!h.collapsed){this.doSetActivePanel(o),this.updateContainer();return}}this.contentContainer.closePanel(),this.doSetActivePanel(void 0),this.updateContainer()}_handleGroupExpand(e){if(this._activePanel)return;const t=e.panelIds[0];if(t){const n=this._panels.find(o=>o.id===t);n&&(this.doSetActivePanel(n),this.updateContainer())}}restoreTabGroups(e){for(const t of e){const n=t.id.match(/-(\d+)$/);if(n){const o=parseInt(n[1],10)+1;o>this._tabGroupIdCounter&&(this._tabGroupIdCounter=o)}}for(const t of e){const n=this.createTabGroup({id:t.id,label:t.label,color:t.color,componentParams:t.componentParams}),o=this._tabGroupMap.get(n.id);for(const h of t.panelIds)this._panels.some(w=>w.id===h)&&(n.addPanel(h),this._panelToTabGroup.set(h,o),this._enforceContiguity(o,h));t.collapsed&&n.collapse(),n.isEmpty&&n.dispose()}}focusContent(){this.contentContainer.element.focus()}focusActiveTab(){this.tabsContainer.focusActiveTab()}set renderContainer(e){this.panels.forEach(t=>{this.renderContainer.detatch(t)}),this._overwriteRenderContainer=e,this.panels.forEach(t=>{this.rerender(t)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.updateHeaderActions()}updateHeaderActions(){var e;(e=this.accessor.headerActionsService)===null||e===void 0||e.refresh(this.groupPanel)}attachHeaderAction(e,t){switch(e){case"left":this.tabsContainer.setLeftActionsElement(t);break;case"right":this.tabsContainer.setRightActionsElement(t);break;case"prefix":this.tabsContainer.setPrefixActionsElement(t);break}}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const t={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(t.locked=this.locked),this.header.hidden&&(t.hideHeader=!0),this.headerPosition!=="top"&&(t.headerPosition=this.headerPosition),this._tabGroups.length>0&&(t.tabGroups=this._tabGroups.map(n=>n.toJSON())),t}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const t=e.panel?this.panels.indexOf(e.panel):-1;let n;if(t<this.panels.length-1)n=t+1;else if(!e.suppressRoll)n=0;else return;this.openPanel(this.panels[n])}moveToPrevious(e){if(e||(e={}),e.panel||(e.panel=this.activePanel),!e.panel)return;const t=this.panels.indexOf(e.panel);let n;if(t>0)n=t-1;else if(!e.suppressRoll)n=this.panels.length-1;else return;this.openPanel(this.panels[n])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,t={}){(typeof t.index!="number"||t.index>this.panels.length)&&(t.index=this.panels.length);const n=!!t.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:t.skipSetActive}),this.doAddPanel(e,t.index,{skipSetActive:n}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}n||this.doSetActivePanel(e),t.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),t.skipSetActive||this.updateContainer()}removePanel(e,t={skipSetActive:!1}){const n=typeof e=="string"?e:e.id,o=this._panels.find(h=>h.id===n);if(!o)throw new Error("invalid operation");return this._removePanel(o,t)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const t of e)this.doClose(t)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const t=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,t&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,t=!1){if(!(!t&&this.isActive===e)){if(this._isGroupActive=e,we(this.container,"dv-active-group",e),we(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0){const n=this._panels.find(o=>{const h=this._findTabGroupForPanel(o.id);return!h||!h.collapsed});n&&this.doSetActivePanel(n)}this.updateContainer()}}layout(e,t){var n;this._width=e,this._height=t,this.contentContainer.layout(this._width,this._height),!((n=this._activePanel)===null||n===void 0)&&n.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,t){const n=this._activePanel===e;if(this.doRemovePanel(e),n&&this.panels.length>0){const o=this.mostRecentlyUsed[0];this.openPanel(o,{skipSetActive:t.skipSetActive,skipSetGroupActive:t.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),t.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const t=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(t,1),this.mostRecentlyUsed.includes(e)){const o=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(o,1)}const n=this._panelDisposables.get(e.id);n&&(n.dispose(),this._panelDisposables.delete(e.id)),this.removePanelFromTabGroup(e.id),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,t=this.panels.length,n={skipSetActive:!1}){const h=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,t),n.skipSetActive?e.api.renderer==="always"&&this.contentContainer.renderPanel(e,{asActive:!1}):this.contentContainer.openPanel(e),!h&&(this.updateMru(e),this.panels.splice(t,0,e),this._panelDisposables.set(e.id,new Se(e.api.onDidTitleChange(w=>this._onDidPanelTitleChange.fire(w)),e.api.onDidParametersChange(w=>this._onDidPanelParametersChange.fire(w)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){var t,n,o;this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.setLabelledBy(this.tabsContainer.getTabId(e.id)),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e,origin:(o=(n=(t=this.accessor).currentOrigin)===null||n===void 0?void 0:n.call(t))!==null&&o!==void 0?o:"user"})),this.updateAccessibleLabel())}updateAccessibleLabel(){var e;const t=(e=this._activePanel)===null||e===void 0?void 0:e.title;t?this.container.setAttribute("aria-label",t):this.container.removeAttribute("aria-label")}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,t;this.panels.forEach(o=>o.runEvents());const n=this.isEmpty||!this._activePanel;if(n&&!this.watermark){const o=this.accessor.createWatermarkComponent();o.init({containerApi:this._api,group:this.groupPanel}),this.watermark=o,be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!n&&this.watermark&&(this.watermark.element.remove(),(t=(e=this.watermark).dispose)===null||t===void 0||t.call(e),this.watermark=void 0)}canDisplayOverlay(e,t,n){const o=new Pp(e,n,t,it,this.accessor.getPanel(this.id));return this._onUnhandledDragOver.fire(o),o.isAccepted}handleDropEvent(e,t,n,o){if(this.locked==="no-drop-target")return;function h(){switch(e){case"header":return typeof o=="number"?"tab":"header_space";case"content":return"content"}}const w=typeof o=="number"?this.panels[o]:void 0,a=new Tp({nativeEvent:t,position:n,panel:w,getData:()=>it(),kind:h(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(a),a.defaultPrevented)return;const l=it();if(l&&l.viewId===this.accessor.id){if(e==="content"&&l.groupId===this.id&&(n==="center"||l.panelId===null&&!l.tabGroupId)||e==="header"&&l.groupId===this.id&&l.panelId===null&&!l.tabGroupId)return;if(l.panelId===null){const{groupId:C}=l;this._onMove.fire({target:n,groupId:C,index:o,tabGroupId:l.tabGroupId});return}if(this.tabsContainer.indexOf(l.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:d,panelId:c}=l;if(this.id===d&&!n&&this.tabsContainer.indexOf(c)===o)return;this._onMove.fire({target:n,groupId:l.groupId,itemId:l.panelId,index:o})}else this._onDidDrop.fire(new dh({nativeEvent:t,position:n,panel:w,getData:()=>it(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,t,n;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(n=(t=this.watermark)===null||t===void 0?void 0:t.dispose)===null||n===void 0||n.call(t),this.watermark=void 0;for(const o of[...this._tabGroups])o.dispose();for(const o of this._tabGroupDisposables.values())o.dispose();this._tabGroupDisposables.clear();for(const o of this._pendingMicrotaskDisposables)o.dispose();this._pendingMicrotaskDisposables.clear();for(const o of this.panels)o.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class uh extends bp{constructor(e,t,n){super(e,t),this._onDidConstraintsChangeInternal=new Q,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new Q,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new Q,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),n&&this.initialize(n)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Ap extends oh{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,t,n,o){super(e,t,o??new uh(e,t)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,typeof(n==null?void 0:n.minimumWidth)=="number"&&(this._minimumWidth=n.minimumWidth),typeof(n==null?void 0:n.maximumWidth)=="number"&&(this._maximumWidth=n.maximumWidth),typeof(n==null?void 0:n.minimumHeight)=="number"&&(this._minimumHeight=n.minimumHeight),typeof(n==null?void 0:n.maximumHeight)=="number"&&(this._maximumHeight=n.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(h=>{const{isVisible:w}=h,{accessor:a}=this._params;a.setVisible(this,w)}),this.api.onActiveChange(()=>{const{accessor:h}=this._params;h.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(h=>{(typeof h.minimumWidth=="number"||typeof h.minimumWidth=="function")&&(this._minimumWidth=h.minimumWidth),(typeof h.minimumHeight=="number"||typeof h.minimumHeight=="function")&&(this._minimumHeight=h.minimumHeight),(typeof h.maximumWidth=="number"||typeof h.maximumWidth=="function")&&(this._maximumWidth=h.maximumWidth),(typeof h.maximumHeight=="number"||typeof h.maximumHeight=="function")&&(this._maximumHeight=h.maximumHeight)}),this.api.onDidSizeChange(h=>{this._onDidChange.fire({height:h.height,width:h.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),t=o=>o===Number.MAX_SAFE_INTEGER?void 0:o,n=o=>o<=0?void 0:o;return Object.assign(Object.assign({},e),{minimumHeight:n(this.minimumHeight),maximumHeight:t(this.maximumHeight),minimumWidth:n(this.minimumWidth),maximumWidth:t(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Vi="dockview: DockviewGroupPanelApiImpl not initialized";class bv extends uh{get location(){if(!this._group)throw new Error(Vi);return this._group.model.location}get boundingBox(){if(!this._group||this._group.model.location.type==="popout")return;const e=this.accessor.element.getBoundingClientRect(),t=this._group.element.getBoundingClientRect();return{left:t.left-e.left,top:t.top-e.top,width:t.width,height:t.height}}get locked(){if(!this._group)throw new Error(Vi);return this._group.locked}set locked(e){if(!this._group)throw new Error(Vi);this._group.locked=e}constructor(e,t){super(e,"__dockviewgroup__"),this.accessor=t,this._onDidLocationChange=new Q,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new Q,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidCollapsedChange=new Q,this.onDidCollapsedChange=this._onDidCollapsedChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidCollapsedChange,this._onDidVisibilityChange.event(n=>{n.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}setHeaderPosition(e){if(!this._group)throw new Error(Vi);this._group.model.headerPosition=e}getHeaderPosition(){if(!this._group)throw new Error(Vi);return this._group.model.headerPosition}moveTo(e){var t,n,o,h;if(!this._group)throw new Error(Vi);const w=(t=e.group)!==null&&t!==void 0?t:this.accessor.addGroup({direction:Ig((n=e.position)!==null&&n!==void 0?n:"right"),skipSetActive:(o=e.skipSetActive)!==null&&o!==void 0?o:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:w,position:e.group&&(h=e.position)!==null&&h!==void 0?h:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Vi);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Vi);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Vi);this.isMaximized()&&this.accessor.exitMaximizedGroup()}collapse(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!0)}expand(){this._group&&this.accessor.setEdgeGroupCollapsed(this._group,!1)}isCollapsed(){return this._group?this.accessor.isEdgeGroupCollapsed(this._group):!1}initialize(e){this._group=e}}const yv=100,Sv=100;class So extends Ap{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof t=="number"?t:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof t=="number"?t:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof t=="number"?t:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const t=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof t=="number"?t:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,t,n){var o,h,w,a,l,u;super(t,"groupview_default",{minimumHeight:(h=(o=n.constraints)===null||o===void 0?void 0:o.minimumHeight)!==null&&h!==void 0?h:Sv,minimumWidth:(a=(w=n.constraints)===null||w===void 0?void 0:w.minimumWidth)!==null&&a!==void 0?a:yv,maximumHeight:(l=n.constraints)===null||l===void 0?void 0:l.maximumHeight,maximumWidth:(u=n.constraints)===null||u===void 0?void 0:u.maximumWidth},new bv(t,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new wv(this.element,e,t,n,this),this.addDisposables(this.model.onDidActivePanelChange(d=>{this.api._onDidActivePanelChange.fire(d)}),this.api.onDidConstraintsChangeInternal(d=>{d.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof d.minimumWidth=="function"?d.minimumWidth():d.minimumWidth),d.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof d.minimumHeight=="function"?d.minimumHeight():d.minimumHeight),d.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof d.maximumWidth=="function"?d.maximumWidth():d.maximumWidth),d.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof d.maximumHeight=="function"?d.maximumHeight():d.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,t){super.layout(e,t),this.model.layout(e,t)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const Cv={name:"dark",className:"dockview-theme-dark",colorScheme:"dark"},xv={name:"light",className:"dockview-theme-light",colorScheme:"light"},Dv={className:"dockview-theme-abyss",tabGroupIndicator:"none"};class Ev extends uh{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const t=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(t),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,t,n,o,h){super(e.id,o),this.panel=e,this.accessor=n,this._onDidTitleChange=new Q,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new Q,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new Q,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new Q,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new ft,this._tabComponent=h,this.initialize(e),this._group=t,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}setActive(){this.accessor.withOrigin("api",()=>super.setActive())}moveTo(e){var t,n;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(t=e.group)!==null&&t!==void 0?t:this._group,position:e.group&&(n=e.position)!==null&&n!==void 0?n:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var t;let n=(t=e==null?void 0:e.isActive)!==null&&t!==void 0?t:!1;this.groupEventsDisposable.value=new Se(this.group.api.onDidVisibilityChange(o=>{const h=!o.isVisible&&this.isVisible,w=o.isVisible&&!this.isVisible,a=this.group.model.isPanelActive(this.panel);(h||w&&a)&&this._onDidVisibilityChange.fire(o)}),this.group.api.onDidLocationChange(o=>{this.group===this.panel.group&&this._onDidLocationChange.fire(o)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&n!==this.isGroupActive&&(n=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class pn extends Se{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,t,n,o,h,w,a,l){super(),this.id=e,this.accessor=o,this.containerApi=h,this.view=a,this._renderer=l.renderer,this._group=w,this._minimumWidth=l.minimumWidth,this._minimumHeight=l.minimumHeight,this._maximumWidth=l.maximumWidth,this._maximumHeight=l.maximumHeight,this.api=new Ev(this,this._group,o,t,n),this.addDisposables(this.api.onActiveChange(()=>{o.setActivePanel(this)}),this.api.onDidSizeChange(u=>{this.group.api.setSize(u)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new wp;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.view.setTitle(e),this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var t;this._params=Object.assign(Object.assign({},(t=this._params)!==null&&t!==void 0?t:{}),e.params);for(const n of Object.keys(e.params))e.params[n]===void 0&&delete this._params[n];this.view.update({params:this._params})}updateFromStateModel(e){var t,n,o;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(t=e.params)!==null&&t!==void 0?t:{}}),this.setTitle((n=e.title)!==null&&n!==void 0?n:this.id),this.setRenderer((o=e.renderer)!==null&&o!==void 0?o:this.accessor.renderer)}updateParentGroup(e,t){this._group=e,this.api.group=this._group;const n=this._group.model.isPanelActive(this),o=this.group.api.isActive&&n;t!=null&&t.skipSetActive||this.api.isActive!==o&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&n}),this.api.isVisible!==n&&this.api._onDidVisibilityChange.fire({isVisible:n})}runEvents(){const e=this._group.model.isPanelActive(this),t=this.group.api.isActive&&e;this.api.isActive!==t&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,t){this.api._onDidDimensionChange.fire({width:e,height:t}),this.view.layout(e,t)}dispose(){this.api.dispose(),this.view.dispose()}}class lu extends Se{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(cv()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(t=>{this._title=t.title,this.render()}),be(this.action,"pointerdown",t=>{t.preventDefault()}),be(this.action,"click",t=>{t.defaultPrevented||(t.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class Ip{get content(){return this._content}get tab(){return this._tab}constructor(e,t,n,o){this.accessor=e,this.id=t,this.contentComponent=n,this.tabComponent=o,this._content=this.createContentComponent(this.id,n),this._tab=this.createTabComponent(this.id,o)}createTabRenderer(e){var t;const n=this.createTabComponent(this.id,this.tabComponent);return this._params&&n.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((t=n.update)===null||t===void 0||t.call(n,this._updateEvent)),n}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}setTitle(e){this._params&&(this._params.title=e)}layout(e,t){var n,o;(o=(n=this.content).layout)===null||o===void 0||o.call(n,e,t)}update(e){var t,n,o,h;this._updateEvent=e,(n=(t=this.content).update)===null||n===void 0||n.call(t,e),(h=(o=this.tab).update)===null||h===void 0||h.call(o,e)}dispose(){var e,t,n,o;(t=(e=this.content).dispose)===null||t===void 0||t.call(e),(o=(n=this.tab).dispose)===null||o===void 0||o.call(n)}createContentComponent(e,t){return this.accessor.options.createComponent({id:e,name:t})}createTabComponent(e,t){const n=t??this.accessor.options.defaultTabComponent;if(n){if(this.accessor.options.createTabComponent){const o=this.accessor.options.createTabComponent({id:e,name:n});return o||new lu}console.warn(`dockview: tabComponent '${t}' was not found. falling back to the default tab.`)}return new lu}}class kv{constructor(e){this.accessor=e}fromJSON(e,t){var n,o;const h=e.id,w=e.params,a=e.title,l=e.view,u=l?l.content.id:(n=e.contentComponent)!==null&&n!==void 0?n:"unknown",d=l?(o=l.tab)===null||o===void 0?void 0:o.id:e.tabComponent,c=new Ip(this.accessor,h,u,d),b=new pn(h,u,d,this.accessor,new rh(this.accessor),t,c,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return b.init({title:a??h,params:w??{}}),b}}class Pv extends Se{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class Tv{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(t=>t!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(t=>t!==e),this.update()}update(){for(let e=0;e<this._orderedList.length;e++)this._orderedList[e].setAttribute("aria-level",`${e}`),this._orderedList[e].style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${e*2})`}}const Co=new Tv;class Pi extends Se{set minimumInViewportWidth(e){this.options.minimumInViewportWidth=e}set minimumInViewportHeight(e){this.options.minimumInViewportHeight=e}get element(){return this._element}get isVisible(){return this._isVisible}get headerHeight(){var e,t;return(t=(e=this.options.header)===null||e===void 0?void 0:e.offsetHeight)!==null&&t!==void 0?t:0}constructor(e){super(),this.options=e,this._element=document.createElement("div"),this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this._onDidChangeEnd=new Q,this.onDidChangeEnd=this._onDidChangeEnd.event,this._onDidStartMoving=new Q,this.onDidStartMoving=this._onDidStartMoving.event,this._dragMove=new ft,this._dragCancelled=!1,this.addDisposables(this._onDidChange,this._onDidChangeEnd,this._onDidStartMoving,this._dragMove),this._element.className="dv-resize-container",this._element.setAttribute("role","dialog"),this._element.setAttribute("aria-modal","false"),this._isVisible=!0,this.setupResize("top"),this.setupResize("bottom"),this.setupResize("left"),this.setupResize("right"),this.setupResize("topleft"),this.setupResize("topright"),this.setupResize("bottomleft"),this.setupResize("bottomright"),this.options.header&&(we(this._element,"dv-resize-container-with-titlebar",!0),this._element.appendChild(this.options.header)),this._element.appendChild(this.options.content),this.options.container.appendChild(this._element),this.setBounds(Object.assign(Object.assign(Object.assign(Object.assign({height:this.options.height,width:this.options.width},"top"in this.options&&{top:this.options.top}),"bottom"in this.options&&{bottom:this.options.bottom}),"left"in this.options&&{left:this.options.left}),"right"in this.options&&{right:this.options.right})),Co.push(this._element)}setVisible(e){e!==this.isVisible&&(this._isVisible=e,we(this.element,"dv-hidden",!this.isVisible))}bringToFront(){Co.push(this._element)}setBounds(e={}){typeof e.height=="number"&&(this._element.style.height=`${e.height}px`),typeof e.width=="number"&&(this._element.style.width=`${e.width}px`),"top"in e&&typeof e.top=="number"&&(this._element.style.top=`${e.top}px`,this._element.style.bottom="auto",this.verticalAlignment="top"),"bottom"in e&&typeof e.bottom=="number"&&(this._element.style.bottom=`${e.bottom}px`,this._element.style.top="auto",this.verticalAlignment="bottom"),"left"in e&&typeof e.left=="number"&&(this._element.style.left=`${e.left}px`,this._element.style.right="auto",this.horiziontalAlignment="left"),"right"in e&&typeof e.right=="number"&&(this._element.style.right=`${e.right}px`,this._element.style.left="auto",this.horiziontalAlignment="right");const t=this.options.container.getBoundingClientRect(),n=this._element.getBoundingClientRect(),o=Math.max(0,this.getMinimumWidth(n.width)),h=Math.max(0,this.getMinimumHeight(n.height));if(this.verticalAlignment==="top"){const w=et(n.top-t.top,-h,Math.max(0,t.height-n.height+h));this._element.style.top=`${w}px`,this._element.style.bottom="auto"}if(this.verticalAlignment==="bottom"){const w=et(t.bottom-n.bottom,-h,Math.max(0,t.height-n.height+h));this._element.style.bottom=`${w}px`,this._element.style.top="auto"}if(this.horiziontalAlignment==="left"){const w=et(n.left-t.left,-o,Math.max(0,t.width-n.width+o));this._element.style.left=`${w}px`,this._element.style.right="auto"}if(this.horiziontalAlignment==="right"){const w=et(t.right-n.right,-o,Math.max(0,t.width-n.width+o));this._element.style.right=`${w}px`,this._element.style.left="auto"}this._onDidChange.fire()}toJSON(){const e=this.options.container.getBoundingClientRect(),t=this._element.getBoundingClientRect(),n={};return this.verticalAlignment==="top"?n.top=parseFloat(this._element.style.top):this.verticalAlignment==="bottom"?n.bottom=parseFloat(this._element.style.bottom):n.top=t.top-e.top,this.horiziontalAlignment==="left"?n.left=parseFloat(this._element.style.left):this.horiziontalAlignment==="right"?n.right=parseFloat(this._element.style.right):n.left=t.left-e.left,n.width=t.width,n.height=t.height,n}cancelPendingDrag(){this._dragMove.value&&(this._dragCancelled=!0,we(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=Ve.NONE)}setupDrag(e,t={inDragMode:!1}){const n=(o,h)=>{var w,a,l;let u=null,d=!1;this._dragCancelled=!1;const c=this.options.transformDragPosition?(l=(a=(w=this.options).getSiblingBoxes)===null||a===void 0?void 0:a.call(w))!==null&&l!==void 0?l:[]:[],b=ar();if(o&&typeof h=="number"&&typeof o.setPointerCapture=="function")try{o.setPointerCapture(h)}catch{}const C=()=>{we(this._element,"dv-resize-container-dragging",!1),this._dragMove.value=Ve.NONE,this._onDidChangeEnd.fire()};this._dragMove.value=new Se({dispose:()=>{if(b.release(),o&&typeof h=="number"&&typeof o.releasePointerCapture=="function")try{o.releasePointerCapture(h)}catch{}}},be(window,"pointermove",S=>{if(this._dragCancelled)return;const y=this.options.container.getBoundingClientRect(),g=S.clientX-y.left,_=S.clientY-y.top;we(this._element,"dv-resize-container-dragging",!0);const m=this._element.getBoundingClientRect();u===null&&(u={x:S.clientX-m.left,y:S.clientY-m.top});const v=Math.max(0,this.getMinimumWidth(m.width)),D=Math.max(0,this.getMinimumHeight(m.height));let P=_-u.y,T=g-u.x;if(this.options.transformDragPosition){const q=this.options.transformDragPosition({proposed:{top:P,left:T,width:m.width,height:m.height},container:{width:y.width,height:y.height},others:c});q&&(P=q.top,T=q.left)}const A=Math.max(0,y.height-m.height+D),E=Math.max(0,y.width-m.width+v),I=et(P,-D,A),B=et(y.height-m.height-P,-D,A),N=et(T,-v,E),W=et(y.width-m.width-T,-v,E),F={};I<=B?F.top=I:F.bottom=B,N<=W?F.left=N:F.right=W,this.setBounds(F),d||(d=!0,this._onDidStartMoving.fire())}),be(window,"pointerup",C),be(window,"pointercancel",C))};this.addDisposables(be(e,"pointerdown",o=>{if(o.defaultPrevented){o.preventDefault();return}su(o)||n(e,o.pointerId)}),be(this.options.content,"pointerdown",o=>{o.defaultPrevented||su(o)||o.shiftKey&&n(this.options.content,o.pointerId)}),be(this.options.content,"pointerdown",()=>{Co.push(this._element)},!0)),t.inDragMode&&n()}setupResize(e){const t=document.createElement("div");t.className=`dv-resize-handle-${e}`,this._element.appendChild(t);const n=new ft;this.addDisposables(n,be(t,"pointerdown",o=>{o.preventDefault();let h=null;const w=ar(),a=o.pointerId;if(typeof t.setPointerCapture=="function")try{t.setPointerCapture(a)}catch{}const l=()=>{n.dispose(),this._onDidChangeEnd.fire()};n.value=new Se(be(window,"pointermove",u=>{const d=this.options.container.getBoundingClientRect(),c=this._element.getBoundingClientRect(),b=u.clientY-d.top,C=u.clientX-d.left;h===null&&(h={originalY:b,originalHeight:c.height,originalX:C,originalWidth:c.width});let S,y,g,_,m,v;const D=()=>{const I=h.originalY+h.originalHeight>d.height?Math.max(0,d.height-Pi.MINIMUM_HEIGHT):Math.max(0,h.originalY+h.originalHeight-Pi.MINIMUM_HEIGHT);S=et(b,0,I),g=h.originalY+h.originalHeight-S,y=d.height-S-g},P=()=>{S=h.originalY-h.originalHeight;const I=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:Pi.MINIMUM_HEIGHT,B=d.height-Math.max(0,S);g=et(b-S,I,B),y=d.height-S-g},T=()=>{const I=h.originalX+h.originalWidth>d.width?Math.max(0,d.width-Pi.MINIMUM_WIDTH):Math.max(0,h.originalX+h.originalWidth-Pi.MINIMUM_WIDTH);_=et(C,0,I),v=h.originalX+h.originalWidth-_,m=d.width-_-v},A=()=>{_=h.originalX-h.originalWidth;const I=_<0&&typeof this.options.minimumInViewportWidth=="number"?-_+this.options.minimumInViewportWidth:Pi.MINIMUM_WIDTH,B=d.width-Math.max(0,_);v=et(C-_,I,B),m=d.width-_-v};switch(e){case"top":D();break;case"bottom":P();break;case"left":T();break;case"right":A();break;case"topleft":D(),T();break;case"topright":D(),A();break;case"bottomleft":P(),T();break;case"bottomright":P(),A();break}const E={};S<=y?E.top=S:E.bottom=y,_<=m?E.left=_:E.right=m,E.height=g,E.width=v,this.setBounds(E)}),{dispose:()=>{if(w.release(),typeof t.releasePointerCapture=="function")try{t.releasePointerCapture(a)}catch{}}},be(window,"pointerup",l),be(window,"pointercancel",l))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Co.destroy(this._element),this._element.remove(),super.dispose()}}Pi.MINIMUM_HEIGHT=20;Pi.MINIMUM_WIDTH=20;class Av extends Se{get element(){return this._element}get group(){return this._group}setGroup(e){this._group=e}constructor(e,t){super(),this.accessor=e,this._onDragStart=new Q,this.onDragStart=this._onDragStart.event,this._group=t,this._element=document.createElement("div"),this._element.className="dv-floating-titlebar",this.addDisposables(this._onDragStart,be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this._group)}),be(this._element,"pointerdown",n=>{n.shiftKey&&ip(n)},!0)),this.dragSource=new Sp({element:this._element,accessor:this.accessor,group:()=>this._group}),this.addDisposables(this.dragSource,this.dragSource.onDragStart(n=>{this._onDragStart.fire(n)}))}updateDragAndDropState(){this.dragSource.updateDragAndDropState()}}function ai(p){return{moduleName:p.name,services:{[p.serviceKey]:p.create},init:p.init?(e,t)=>p.init(e,t[p.serviceKey]):void 0,dependsOn:p.dependsOn}}const hu=new Set;function Ns(p,e,t){if(p!==void 0)return p;const n=`${e}|${t??""}`;if(hu.has(n))return;hu.add(n);const o=t?` for ${t}`:"";console.error(`dockview: module "${e}" is not registered${o}.`)}class Iv{constructor(){this._modules=new Map,this._services={},this._initDisposables=[]}get services(){return this._services}register(e){if(!this._modules.has(e.moduleName)){if(e.dependsOn)for(const t of e.dependsOn)this.register(t);this._modules.set(e.moduleName,e)}}initialize(e){for(const t of this._modules.values())if(t.services)for(const[n,o]of Object.entries(t.services))this._services[n]=o(e)}postConstruct(e){for(const t of this._modules.values())t.init&&this._initDisposables.push(t.init(e,this._services))}has(e){return this._modules.has(e)}dispose(){for(const e of this._initDisposables)e.dispose();this._initDisposables.length=0;for(const e of Object.values(this._services))e!==void 0&&typeof e.dispose=="function"&&e.dispose()}}const Ul=[];function Lv(p){for(const e of p)Ul.some(t=>t.moduleName===e.moduleName)||Ul.push(e)}function Rv(){return[...Ul]}let Lp=!1;function Mv(){Lp=!0}function Ov(){return Lp}const Ro=100,ms={left:100,top:100,width:300,height:300},Gv=100;class Nv extends Se{get group(){return this._group}setTitleBar(e){this._titleBar=e}setAnchorGroup(e){var t;this._group=e,(t=this._titleBar)===null||t===void 0||t.setGroup(e)}constructor(e,t,n){super(),this.overlay=t,this.gridview=n,this._group=e,this.addDisposables(t,{dispose:()=>this.gridview.dispose()})}position(e){this.overlay.setBounds(e)}}class zv{get floatingGroups(){return this._floatingGroups}constructor(e){this._floatingGroups=[],this._host=e}add(e,t,n){const o=new Nv(e,t,n),h=new Se(e.api.onDidActiveChange(a=>{a.isActive&&t.bringToFront()}),(()=>{let a=-1,l=-1;return cr(n.element,u=>{const d=Math.round(u.contentRect.width),c=Math.round(u.contentRect.height);d===a&&c===l||(a=d,l=c,n.layout(d,c))})})()),w=()=>{var a;const l=(a=e.activePanel)===null||a===void 0?void 0:a.title;l?t.element.setAttribute("aria-label",l):t.element.removeAttribute("aria-label")};return w(),o.addDisposables(e.api.onDidActivePanelChange(()=>w()),t.onDidChange(()=>{n.layout(n.width,n.height)}),t.onDidChangeEnd(()=>{this._host.fireLayoutChange()}),e.onDidChange(a=>{t.setBounds({height:typeof(a==null?void 0:a.height)=="number"?a.height+t.headerHeight:a==null?void 0:a.height,width:a==null?void 0:a.width})}),{dispose:()=>{h.dispose(),op(this._floatingGroups,o),e.model.location={type:"grid"}}}),this._floatingGroups.push(o),o}findByGroup(e){return this._floatingGroups.find(t=>t.group===e||t.gridview.element.contains(e.element))}serialize(){return this._floatingGroups.map(e=>{const t=e.gridview.serialize(),n=e.overlay.toJSON(),o=t.root;return o.type==="branch"&&o.data.length===1&&o.data[0].type==="leaf"?{data:o.data[0].data,position:n}:{grid:t,position:n}})}constrainBounds(){for(const e of this._floatingGroups)e.overlay.setBounds()}updateBounds(e){var t,n;if("floatingGroupBounds"in e)for(const o of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":o.overlay.minimumInViewportHeight=void 0,o.overlay.minimumInViewportWidth=void 0;break;case void 0:o.overlay.minimumInViewportHeight=Ro,o.overlay.minimumInViewportWidth=Ro;break;default:o.overlay.minimumInViewportHeight=(t=e.floatingGroupBounds)===null||t===void 0?void 0:t.minimumHeightWithinViewport,o.overlay.minimumInViewportWidth=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumWidthWithinViewport}o.overlay.setBounds()}}disposeAll(){for(const e of[...this._floatingGroups])e.dispose()}dispose(){this.disposeAll()}}const Bv=ai({name:"FloatingGroup",serviceKey:"floatingGroupService",create:p=>new zv(p)});class Hv{constructor(e){this._entries=[],this._popupServices=new Map,this._restorationCleanups=new Set,this._restorationPromise=Promise.resolve(),this._onDidRemove=new Q,this.onDidRemove=this._onDidRemove.event,this._host=e}get entries(){return this._entries}get restorationPromise(){return this._restorationPromise}add(e){this._entries.push(e)}remove(e){op(this._entries,e)&&!this._host.isDisposed&&this._onDidRemove.fire(e)}findByGroup(e){return this._entries.find(t=>t.popoutGroup===e||t.gridview.element.contains(e.element))}findReferenceGroupId(e){var t;return(t=this._entries.find(n=>n.popoutGroup===e))===null||t===void 0?void 0:t.referenceGroup}observeGridviewSize(e,t,n){var o;const h=(o=e.window)===null||o===void 0?void 0:o.ResizeObserver;if(!h)return;let w=-1,a=-1;const l=()=>{const d=e.window;if(this._host.isDisposed||!d||d.closed)return;const c=Math.round(t.element.clientWidth),b=Math.round(t.element.clientHeight);c===w&&b===a||(w=c,a=b,c>0&&b>0&&t.layout(c,b),n.updateAllPositions())},u=new h(()=>{var d;const c=(d=e.window)===null||d===void 0?void 0:d.requestAnimationFrame;c?c.call(e.window,l):l()});return u.observe(t.element),{dispose:()=>u.disconnect()}}getPopupService(e){return this._popupServices.get(e)}setPopupService(e,t){this._popupServices.set(e,t)}deletePopupService(e){this._popupServices.delete(e)}scheduleRestoration(e,t,n){return new Promise(o=>{const h=()=>{this._restorationCleanups.delete(h),clearTimeout(w),n==null||n(),o()},w=setTimeout(()=>{if(this._restorationCleanups.delete(h),this._host.isDisposed){o();return}t(),o()},e);this._restorationCleanups.add(h)})}finishRestoration(e){this._restorationPromise=Promise.all(e).then(()=>{})}cancelPendingRestorations(){for(const e of[...this._restorationCleanups])e();this._restorationCleanups.clear()}serialize(){return this._entries.map(e=>{const t=e.gridview.serialize(),n=t.root,o=e.popoutGroup.api.location.type==="popout"?e.popoutGroup.api.location.popoutUrl:void 0,h={gridReferenceGroup:e.referenceGroup,position:e.window.dimensions(),url:o};return n.type==="branch"&&n.data.length===1&&n.data[0].type==="leaf"?Object.assign(Object.assign({},h),{data:n.data[0].data}):Object.assign(Object.assign({},h),{grid:t})})}disposeAll(){for(const e of[...this._entries])e.disposable.dispose()}dispose(){this.cancelPendingRestorations(),this.disposeAll(),this._onDidRemove.dispose()}}const Fv=ai({name:"PopoutWindow",serviceKey:"popoutWindowService",create:p=>new Hv(p)});class Wv{constructor(e){this._watermark=null,this._host=e}update(){if(this._host.hasVisibleGridGroup()){this._unmount();return}if(this._watermark)return;this._watermark=this._host.createWatermarkComponent(),this._watermark.init({containerApi:this._host.api});const e=document.createElement("div");e.className="dv-watermark-container",pg(e,"watermark-component"),e.appendChild(this._watermark.element),this._host.mountElement.appendChild(e)}refresh(){this._unmount(),this.update()}_unmount(){var e,t;this._watermark&&(this._watermark.element.parentElement.remove(),(t=(e=this._watermark).dispose)===null||t===void 0||t.call(e),this._watermark=null)}dispose(){this._unmount()}}const Vv=ai({name:"Watermark",serviceKey:"watermarkService",create:p=>new Wv(p),init:(p,e)=>(e.update(),new Se(ri.any(p.onDidAdd,p.onDidRemove)(()=>{e.update()}),p.onDidViewVisibilityChangeMicroTaskQueue(()=>{e.update()})))});class jv{constructor(){this._edgeGroups=new Map,this._edgeGroupDisposables=new Map}add(e,t,n){this._edgeGroups.set(e,t),this._edgeGroupDisposables.set(e,n)}remove(e){var t;(t=this._edgeGroupDisposables.get(e))===null||t===void 0||t.dispose(),this._edgeGroupDisposables.delete(e),this._edgeGroups.delete(e)}get(e){return this._edgeGroups.get(e)}has(e){return this._edgeGroups.has(e)}hasAny(){return this._edgeGroups.size>0}entries(){return this._edgeGroups.entries()}includes(e){for(const t of this._edgeGroups.values())if(t===e)return!0;return!1}findPositionOf(e){for(const[t,n]of this._edgeGroups)if(n===e)return t}disposeAll(){for(const e of this._edgeGroupDisposables.values())e.dispose();this._edgeGroupDisposables.clear(),this._edgeGroups.clear()}dispose(){this.disposeAll()}}const $v=ai({name:"EdgeGroup",serviceKey:"edgeGroupService",create:()=>new jv}),kl={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};class Uv{constructor(e){const t=(o,h)=>{const w=it();return w?w.viewId!==e.id?!1:h==="center"?e.isGridEmpty():!0:h==="center"&&!e.isGridEmpty()?!1:e.dispatchUnhandledDragOver(o,h)},n=typeof e.options.dndEdges=="object"&&e.options.dndEdges!==null?e.options.dndEdges:kl;this._html5Target=vs.createDropTarget(e.element,{className:"dv-drop-target-edge",canDisplayOverlay:t,acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:n,getOverrideTarget:()=>e.rootDropTargetOverrideTarget()}),this._pointerTarget=Ki.createDropTarget(e.element,{className:"dv-drop-target-edge",canDisplayOverlay:t,acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:n,getOverrideTarget:()=>e.rootDropTargetOverrideTarget()}),this.onWillShowOverlay=ri.any(this._html5Target.onWillShowOverlay,this._pointerTarget.onWillShowOverlay),this.onDrop=ri.any(this._html5Target.onDrop,this._pointerTarget.onDrop),this.setOptions(e.options)}setOptions(e){if("dndEdges"in e){const t=typeof e.dndEdges=="boolean"&&e.dndEdges===!1;this._html5Target.disabled=t,this._pointerTarget.disabled=t,typeof e.dndEdges=="object"&&e.dndEdges!==null?(this._html5Target.setOverlayModel(e.dndEdges),this._pointerTarget.setOverlayModel(e.dndEdges)):(this._html5Target.setOverlayModel(kl),this._pointerTarget.setOverlayModel(kl))}}dispose(){this._html5Target.dispose(),this._pointerTarget.dispose()}}const Kv=ai({name:"RootDropTarget",serviceKey:"rootDropTargetService",create:p=>new Uv(p)}),Yv={left:"createLeftHeaderActionComponent",right:"createRightHeaderActionComponent",prefix:"createPrefixHeaderActionComponent"};class Xv{constructor(e){this._perGroup=new Map,this._host=e}refresh(e){if(!(e!=null&&e.model))return;const t=this._ensureState(e);this._refreshSlot("left",e,t.left),this._refreshSlot("right",e,t.right),this._refreshSlot("prefix",e,t.prefix)}refreshAll(){for(const e of this._host.groups)this.refresh(e)}disposeGroup(e){const t=this._perGroup.get(e);t&&(t.left.dispose(),t.right.dispose(),t.prefix.dispose(),this._perGroup.delete(e))}dispose(){for(const e of[...this._perGroup.keys()])this.disposeGroup(e)}_ensureState(e){let t=this._perGroup.get(e);return t||(t={left:new ft,right:new ft,prefix:new ft},this._perGroup.set(e,t)),t}_refreshSlot(e,t,n){const o=this._host.options[Yv[e]];if(o){const h=o(t);n.value=h,h.init({containerApi:this._host.api,api:t.api,group:t}),t.model.attachHeaderAction(e,h.element)}else n.dispose(),t.model.attachHeaderAction(e,void 0)}}const qv=ai({name:"HeaderActions",serviceKey:"headerActionsService",create:p=>new Xv(p),init:(p,e)=>new Se(p.onDidRemoveGroup(t=>{e.disposeGroup(t)}))});function Jv(p,e){return p==="center"?`Tab into ${e}`:`Split ${p} of ${e}`}function Zv(p,e){return p==="center"?`docked into ${e}`:`split ${p} of ${e}`}const cu={panelOpened:p=>`${p} opened`,panelClosed:p=>`${p} closed`,groupMaximized:p=>`${p} maximized`,groupRestored:p=>`${p} restored`,groupFloated:p=>`${p} floated`,groupDocked:p=>`${p} docked`,groupPoppedOut:p=>`${p} opened in a new window`,movePickTarget:(p,e,t,n)=>`Moving ${p}. Target ${e}, ${t} of ${n}. Enter to choose where, Escape to cancel.`,movePickEdge:(p,e)=>`${Jv(p,e)}. Arrows to change, Enter to confirm, Escape to go back.`,moveCommitted:(p,e,t)=>`${p} ${Zv(t,e)}.`,moveCancelled:()=>"Move cancelled.",moveNotAllowed:()=>"That move is not allowed."};function Rp(p){return p?Object.assign(Object.assign({},cu),p):cu}const du=p=>p==="load"||p==="clear";function uu(p){const e=document.createElement("div");return e.className=p==="assertive"?"dv-live-region-assertive":"dv-live-region",e.setAttribute("role",p==="assertive"?"alert":"status"),e.setAttribute("aria-live",p),e.setAttribute("aria-atomic","true"),Object.assign(e.style,{position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:"0"}),e}class Qv extends Se{constructor(e){super(),this._suppressDepth=0,this._locationSubs=new Map,this._host=e,this._polite=uu("polite"),this._assertive=uu("assertive"),e.element.appendChild(this._polite),e.element.appendChild(this._assertive),this.addDisposables({dispose:()=>this._polite.remove()},{dispose:()=>this._assertive.remove()},e.onDidAddPanel(t=>this._announce(t,"open")),e.onDidRemovePanel(t=>this._announce(t,"close")),e.onWillMutateLayout(t=>{du(t.kind)&&this._suppressDepth++}),e.onDidMutateLayout(t=>{du(t.kind)&&(this._suppressDepth=Math.max(0,this._suppressDepth-1))}),e.onDidMaximizedGroupChange(t=>{const n=t.group.activePanel;n&&this._announce(n,t.isMaximized?"maximize":"restore")}),e.onDidAddGroup(t=>this._trackLocation(t)),e.onDidRemoveGroup(t=>{var n;(n=this._locationSubs.get(t.id))===null||n===void 0||n.dispose(),this._locationSubs.delete(t.id)}),{dispose:()=>{this._locationSubs.forEach(t=>t.dispose()),this._locationSubs.clear()}})}_trackLocation(e){let t=e.api.location.type;const n=e.api.onDidLocationChange(o=>{const h=o.location.type;if(h===t)return;t=h;const w=e.activePanel;if(!w)return;const a=h==="floating"?"float":h==="popout"?"popout":"dock";this._announce(w,a)});this._locationSubs.set(e.id,n)}announce(e,t="polite"){if(this._host.options.announcements===!1||this._suppressDepth>0||!e)return;const n=this._host.options.announcer;if(n){n({message:e,politeness:t});return}const o=t==="assertive"?this._assertive:this._polite;o.textContent="",o.textContent=e}_announce(e,t){var n,o;const h=(o=(n=this._host.options).getAnnouncement)===null||o===void 0?void 0:o.call(n,{kind:t,panel:e});h===null||h===""||this.announce(h??this._defaultMessage(e,t))}_defaultMessage(e,t){var n;const o=Rp(this._host.options.messages),h=(n=e.title)!==null&&n!==void 0?n:e.id;switch(t){case"open":return o.panelOpened(h);case"close":return o.panelClosed(h);case"maximize":return o.groupMaximized(h);case"restore":return o.groupRestored(h);case"float":return o.groupFloated(h);case"dock":return o.groupDocked(h);case"popout":return o.groupPoppedOut(h)}}}const Mp=ai({name:"LiveRegion",serviceKey:"liveRegionService",create:p=>new Qv(p)}),e_=[Bv,Fv,Vv,$v,Kv,qv,Mp];class t_{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const t=this.cache.get(e);if(t&&t.frameId===this.currentFrameId)return t.rect;this.scheduleFrameUpdate();const n=Nl(e);return this.cache.set(e,{rect:n,frameId:this.currentFrameId}),n}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function i_(){const p=document.createElement("div");return p.tabIndex=-1,p}class pu extends Se{constructor(e,t){super(),this.element=e,this.accessor=t,this.map={},this._disposed=!1,this.positionCache=new t_,this.pendingUpdates=new Set,this.addDisposables(Ve.from(()=>{for(const n of Object.values(this.map))n.disposable.dispose(),n.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:t,destroy:n}=this.map[e.api.id];return t.dispose(),n.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:t,referenceContainer:n}=e;if(!this.map[t.api.id]){const c=i_();c.className="dv-render-overlay",c.style.visibility="hidden",this.map[t.api.id]={panel:t,disposable:Ve.NONE,destroy:Ve.NONE,element:c}}const o=this.map[t.api.id].element,h=t.view.content.element;h.parentElement!==o&&o.appendChild(h),o.parentElement!==this.element&&this.element.appendChild(o);const w=()=>{const c=t.api.id;this.pendingUpdates.has(c)||(this.pendingUpdates.add(c),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(c),this.isDisposed||!this.map[c])return;const b=this.positionCache.getPosition(n.element),C=this.positionCache.getPosition(this.element),S=b.left-C.left,y=b.top-C.top,g=b.width,_=b.height;o.style.left=`${S}px`,o.style.top=`${y}px`,o.style.width=`${g}px`,o.style.height=`${_}px`,t.api.isVisible?(o.style.visibility="",o.style.pointerEvents=""):(o.style.visibility="hidden",o.style.pointerEvents="none"),we(o,"dv-render-overlay-float",t.group.api.location.type==="floating")}))},a=()=>{t.api.isVisible?(this.positionCache.invalidate(),w(),o.style.pointerEvents=""):(o.style.visibility="hidden",o.style.pointerEvents="none")},l=new ft,u=()=>{t.api.location.type==="floating"?queueMicrotask(()=>{const c=this.accessor.floatingGroups.find(y=>y.group===t.api.group);if(!c)return;const b=c.overlay.element,C=()=>{const y=Number(b.getAttribute("aria-level"));o.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${y*2+1})`},S=new MutationObserver(()=>{C()});l.value=Ve.from(()=>S.disconnect()),S.observe(b,{attributeFilter:["aria-level"],attributes:!0}),C()}):o.style.zIndex=""},d=new Se(l,new up(o,{onDragEnd:c=>{n.dropTarget.dnd.onDragEnd(c)},onDragEnter:c=>{n.dropTarget.dnd.onDragEnter(c)},onDragLeave:c=>{n.dropTarget.dnd.onDragLeave(c)},onDrop:c=>{n.dropTarget.dnd.onDrop(c)},onDragOver:c=>{n.dropTarget.dnd.onDragOver(c)}}),t.api.onDidVisibilityChange(()=>{a()}),t.api.onDidDimensionsChange(()=>{t.api.isVisible&&w()}),t.api.onDidLocationChange(()=>{u()}));return this.map[t.api.id].destroy=Ve.from(()=>{var c;h.parentElement===o&&o.removeChild(h),(c=o.parentElement)===null||c===void 0||c.removeChild(o)}),u(),queueMicrotask(()=>{this.isDisposed||a()}),this.map[t.api.id].disposable.dispose(),this.map[t.api.id].disposable=d,this.map[t.api.id].resize=w,o}}function s_(p,e,t,n){function o(h){return h instanceof t?h:new t(function(w){w(h)})}return new(t||(t=Promise))(function(h,w){function a(d){try{u(n.next(d))}catch(c){w(c)}}function l(d){try{u(n.throw(d))}catch(c){w(c)}}function u(d){d.done?h(d.value):o(d.value).then(a,l)}u((n=n.apply(p,[])).next())})}function n_(p){let e;try{e=new URL(p,window.location.href)}catch{throw new Error(`dockview: invalid popout URL: ${p}`)}if(!(e.protocol==="http:"||e.protocol==="https:")||e.origin!==window.location.origin)throw new Error(`dockview: popout URL must be same-origin http(s); got: ${p}`)}class r_ extends Se{get window(){var e,t;return(t=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&t!==void 0?t:null}constructor(e,t,n){super(),this.target=e,this.className=t,this.options=n,this._onWillClose=new Q,this.onWillClose=this._onWillClose.event,this._onDidClose=new Q,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,t=this._window.value.screenY,n=this._window.value.innerWidth,o=this._window.value.innerHeight;return{top:t,left:e,width:n,height:o}}close(){var e,t;this._window&&(this._onWillClose.fire(),(t=(e=this.options).onWillClose)===null||t===void 0||t.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){return s_(this,void 0,void 0,function*(){var e,t;if(this._window)throw new Error("instance of popout window is already open");const n=`${this.options.url}`;n_(n);const o=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([l,u])=>`${l}=${u}`).join(","),h=window.open(n,this.target,o);if(!h)return null;const w=new Se;this._window={value:h,disposable:w},w.addDisposables(Ve.from(()=>{h.close()}),be(window,"beforeunload",()=>{this.close()}));const a=this.createPopoutWindowContainer();return this.className&&a.classList.add(this.className),(t=(e=this.options).onDidOpen)===null||t===void 0||t.call(e,{id:this.target,window:h}),new Promise((l,u)=>{h.addEventListener("unload",d=>{}),h.addEventListener("load",()=>{try{const d=h.document;d.title=document.title,d.body.appendChild(a),dg(d,window.document.styleSheets,{nonce:this.options.nonce}),be(h,"beforeunload",()=>{this.close()}),l(a)}catch(d){u(d)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class o_ extends Se{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,t=new Set;this.addDisposables(this.accessor.onDidAddPanel(n=>{if(e.has(n.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${n.api.id} but panel already exists`);e.add(n.api.id)}),this.accessor.onDidRemovePanel(n=>{if(e.has(n.api.id))e.delete(n.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${n.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(n=>{if(t.has(n.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${n.api.id} but group already exists`);t.add(n.api.id)}),this.accessor.onDidRemoveGroup(n=>{if(t.has(n.api.id))t.delete(n.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${n.api.id} but group does not exists`)}))}}function a_(p){if(!p.matchMedia)return!1;const e=p.matchMedia("(pointer: coarse)").matches,t=p.matchMedia("(pointer: fine)").matches;return e&&!t}class fu extends Se{constructor(e,t=window){super(),this._active=null,this._activeDisposable=new ft,this._root=e,this._window=t,this._element=t.document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this._root.prepend(this._element),this.addDisposables(Ve.from(()=>{this.close()}),this._activeDisposable)}updateRoot(e){e.prepend(this._element),this._root=e}openPopover(e,t){var n;this.close();const o=this._window.document.createElement("div");o.style.position="absolute",o.style.zIndex=(n=t.zIndex)!==null&&n!==void 0?n:"var(--dv-overlay-z-index)",o.appendChild(e);const h=this._element.getBoundingClientRect(),w=h.left,a=h.top;o.style.top=`${t.y-a}px`,o.style.left=`${t.x-w}px`,this._element.appendChild(o),this._active=o;const l=Date.now(),u=200;this._activeDisposable.value=new Se(be(this._window,"pointerdown",d=>{var c;if(Date.now()-l<u)return;const b=d.target;if(!(b instanceof HTMLElement))return;let C=b;for(;C&&C!==o;)C=(c=C==null?void 0:C.parentElement)!==null&&c!==void 0?c:null;C||this.close()}),be(this._window,"keydown",d=>{(d.key==="Escape"||d.key==="Enter")&&this.close()}),be(this._window,"resize",()=>{a_(this._window)||this.close()})),this._window.requestAnimationFrame(()=>{_g(o,this._root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class mu extends Se{get disabled(){return this._disabled}set disabled(e){var t;this.disabled!==e&&(this._disabled=e,e&&((t=this.model)===null||t===void 0||t.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,t)=>{const n=this._outline!==t;if(this._outline=t,this._model)return this._model.changed=n,this._model;const o=this.createContainer(),h=this.createAnchor();if(this._model={root:o,overlay:h,changed:n},o.appendChild(h),this.element.appendChild(o),(e==null?void 0:e.target)instanceof HTMLElement){const w=e.target.getBoundingClientRect(),a=this.element.getBoundingClientRect();h.style.left=`${w.left-a.left}px`,h.style.top=`${w.top-a.top}px`}return this._model}}}constructor(e,t){super(),this.element=e,this._disabled=!1,this._disabled=t.disabled,this.addDisposables(Ve.from(()=>{var n;(n=this.model)===null||n===void 0||n.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}class l_{get minimumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMinimumSize}get maximumSize(){return this._isCollapsed?this._collapsedSize:this._expandedMaximumSize}get element(){return this._group.element}get isCollapsed(){return this._isCollapsed}get lastExpandedSize(){return this._lastExpandedSize}get collapsedSize(){return this._collapsedSize}constructor(e,t,n){var o,h,w;this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.snap=!1,this.priority=ht.Low,this._isCollapsed=!1,this._group=t,this._orientation=n,t.element.classList.add("dv-edge-group"),t.element.dataset.testid=`dv-edge-group-${e.id}`,this._collapsedSize=(o=e.collapsedSize)!==null&&o!==void 0?o:35,this._expandedMaximumSize=(h=e.maximumSize)!==null&&h!==void 0?h:Number.POSITIVE_INFINITY,this._expandedMinimumSize=e.minimumSize!==void 0?e.minimumSize:this._collapsedSize+50,this._lastExpandedSize=(w=e.initialSize)!==null&&w!==void 0?w:200,e.collapsed&&(this._isCollapsed=!0,t.element.classList.add("dv-edge-collapsed"))}layout(e,t){this._isCollapsed||(this._lastExpandedSize=e),this._orientation==="horizontal"?this._group.layout(e,t):this._group.layout(t,e)}setCollapsed(e){this._isCollapsed!==e&&(this._isCollapsed=e,this._group.element.classList.toggle("dv-edge-collapsed",e))}setVisible(e){}restoreExpandedSize(e){this._lastExpandedSize=e}updateCollapsedSize(e,t){this._collapsedSize=e,this._expandedMinimumSize=t}dispose(){this._onDidChange.dispose()}}class h_{get element(){return this._dockviewElement}constructor(e,t){this._dockviewElement=e,this._layoutDockview=t,this.priority=ht.High,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event}layout(e,t){this._layoutDockview(t,e)}setVisible(e){}dispose(){this._onDidChange.dispose()}}class c_{get element(){return this._element}constructor(e,t=0){this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.minimumSize=100,this.maximumSize=Number.POSITIVE_INFINITY,this.priority=ht.High,this._element=document.createElement("div"),this._element.className="dv-shell-middle-column",this._element.style.height="100%",this._element.style.width="100%",this._splitview=new zs(this._element,{orientation:Pe.VERTICAL,proportionalLayout:!1,margin:t}),this._centerIndex=0,this._splitview.addView(e,{type:"distribute"},0)}addTopView(e,t){this._splitview.addView(e,t,0),this._topIndex=0,this._centerIndex+=1,this._bottomIndex!==void 0&&(this._bottomIndex+=1)}addBottomView(e,t){const n=this._splitview.length;this._splitview.addView(e,t,n),this._bottomIndex=n}removeView(e){const t=e==="top"?this._topIndex:this._bottomIndex;t!==void 0&&(this._splitview.removeView(t),e==="top"?(this._topIndex=void 0,this._centerIndex-=1,this._bottomIndex!==void 0&&(this._bottomIndex-=1)):this._bottomIndex=void 0)}layout(e,t){this._splitview.layout(t,e)}setVisible(e){}setViewVisible(e,t){const n=e==="top"?this._topIndex:this._bottomIndex;n!==void 0&&this._splitview.setViewVisible(n,t)}isViewVisible(e){const t=e==="top"?this._topIndex:this._bottomIndex;return t!==void 0?this._splitview.isViewVisible(t):!1}getViewSize(e){const t=e==="top"?this._topIndex:this._bottomIndex;return t!==void 0?this._splitview.getViewSize(t):0}resizeView(e,t){const n=e==="top"?this._topIndex:this._bottomIndex;n!==void 0&&this._splitview.resizeView(n,t)}updateMargin(e){this._splitview.margin=e}dispose(){this._onDidChange.dispose(),this._splitview.dispose()}}function d_(p,e,t){var n;const o=((n=p.collapsedSize)!==null&&n!==void 0?n:e)+t,h=Object.assign(Object.assign({},p),{collapsedSize:o});return p.minimumSize!==void 0&&(h.minimumSize=p.minimumSize+t),h}class u_{constructor(e,t,n,o=0,h=35){this._disposables=new Se,this._viewConfigs=new Map,this._currentWidth=0,this._currentHeight=0,this._gap=o,this._defaultCollapsedSize=h,this._shellElement=document.createElement("div"),this._shellElement.className="dv-shell",this._shellElement.style.height="100%",this._shellElement.style.width="100%",this._shellElement.style.position="relative",e.appendChild(this._shellElement);const w=new h_(t,n);this._middleColumn=new c_(w,o),this._outerSplitview=new zs(this._shellElement,{orientation:Pe.HORIZONTAL,proportionalLayout:!1,margin:o}),this._middleIndex=0,this._outerSplitview.addView(this._middleColumn,{type:"distribute"},0),this._disposables.addDisposables(cr(this._shellElement,a=>{const l=Math.round(a.contentRect.width),u=Math.round(a.contentRect.height);l===this._currentWidth&&u===this._currentHeight||(this._currentWidth=l,this._currentHeight=u,this.layout(l,u))}),this._outerSplitview,this._middleColumn,w)}get element(){return this._shellElement}addEdgeView(e,t,n){if(this.hasEdgeGroup(e))throw new Error(`dockview: edge group already registered at position '${e}'`);this._viewConfigs.set(e,t);const o=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),h=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),w=o>1?this._gap*(o-1)/o:0,a=h>1?this._gap*(h-1)/h:0,l=e==="left"||e==="right",u=l?w:a,d=l?"horizontal":"vertical",c=new l_(d_(Object.assign({collapsedSize:this._defaultCollapsedSize},t),this._defaultCollapsedSize,u),n,d),b=c.isCollapsed?c.collapsedSize:c.lastExpandedSize;switch(e){case"left":this._outerSplitview.addView(c,b,0),this._leftIndex=0,this._middleIndex+=1,this._rightIndex!==void 0&&(this._rightIndex+=1),this._leftView=c;break;case"right":{const C=this._outerSplitview.length;this._outerSplitview.addView(c,b,C),this._rightIndex=C,this._rightView=c}break;case"top":this._middleColumn.addTopView(c,b),this._topView=c;break;case"bottom":this._middleColumn.addBottomView(c,b),this._bottomView=c;break}return this._disposables.addDisposables(c),this.updateTheme(this._gap,this._defaultCollapsedSize),c}layout(e,t){this._outerSplitview.layout(e,t)}updateTheme(e,t){var n,o,h,w;this._gap=e,this._defaultCollapsedSize=t;const a=1+(this._viewConfigs.has("left")?1:0)+(this._viewConfigs.has("right")?1:0),l=1+(this._viewConfigs.has("top")?1:0)+(this._viewConfigs.has("bottom")?1:0),u=a>1?e*(a-1)/a:0,d=l>1?e*(l-1)/l:0;this._outerSplitview.margin=e,this._middleColumn.updateMargin(e);const c=(g,_,m)=>{var v;const P=((v=_.collapsedSize)!==null&&v!==void 0?v:t)+m,T=_.minimumSize,A=T!==void 0?T+m:P+50;g.updateCollapsedSize(P,A)},b=this._viewConfigs.get("top");this._topView&&b&&c(this._topView,b,d);const C=this._viewConfigs.get("bottom");this._bottomView&&C&&c(this._bottomView,C,d);const S=this._viewConfigs.get("left");this._leftView&&S&&c(this._leftView,S,u);const y=this._viewConfigs.get("right");this._rightView&&y&&c(this._rightView,y,u),!((n=this._leftView)===null||n===void 0)&&n.isCollapsed&&this._leftIndex!==void 0&&this._outerSplitview.resizeView(this._leftIndex,this._leftView.collapsedSize),!((o=this._rightView)===null||o===void 0)&&o.isCollapsed&&this._rightIndex!==void 0&&this._outerSplitview.resizeView(this._rightIndex,this._rightView.collapsedSize),!((h=this._topView)===null||h===void 0)&&h.isCollapsed&&this._middleColumn.resizeView("top",this._topView.collapsedSize),!((w=this._bottomView)===null||w===void 0)&&w.isCollapsed&&this._middleColumn.resizeView("bottom",this._bottomView.collapsedSize),this._currentWidth>0&&this._currentHeight>0&&this.layout(this._currentWidth,this._currentHeight)}removeEdgeView(e){const t=this._getView(e);if(t){switch(e){case"left":this._outerSplitview.removeView(this._leftIndex),this._leftIndex=void 0,this._leftView=void 0,this._middleIndex-=1,this._rightIndex!==void 0&&(this._rightIndex-=1);break;case"right":this._outerSplitview.removeView(this._rightIndex),this._rightIndex=void 0,this._rightView=void 0;break;case"top":this._middleColumn.removeView("top"),this._topView=void 0;break;case"bottom":this._middleColumn.removeView("bottom"),this._bottomView=void 0;break}this._disposables.removeDisposable(t),t.dispose(),this._viewConfigs.delete(e),this.updateTheme(this._gap,this._defaultCollapsedSize)}}hasEdgeGroup(e){switch(e){case"top":return this._topView!==void 0;case"bottom":return this._bottomView!==void 0;case"left":return this._leftView!==void 0;case"right":return this._rightView!==void 0}}setEdgeGroupVisible(e,t){switch(e){case"left":this._leftIndex!==void 0&&this._outerSplitview.setViewVisible(this._leftIndex,t);break;case"right":this._rightIndex!==void 0&&this._outerSplitview.setViewVisible(this._rightIndex,t);break;case"top":case"bottom":this._middleColumn.setViewVisible(e,t);break}}isEdgeGroupVisible(e){switch(e){case"left":return this._leftIndex!==void 0?this._outerSplitview.isViewVisible(this._leftIndex):!1;case"right":return this._rightIndex!==void 0?this._outerSplitview.isViewVisible(this._rightIndex):!1;case"top":case"bottom":return this._middleColumn.isViewVisible(e)}}setEdgeGroupCollapsed(e,t){const n=this._getView(e);if(!n)return;n.setCollapsed(t);const o=t?n.collapsedSize:n.lastExpandedSize;switch(e){case"left":this._leftIndex!==void 0&&this._outerSplitview.resizeView(this._leftIndex,o);break;case"right":this._rightIndex!==void 0&&this._outerSplitview.resizeView(this._rightIndex,o);break;case"top":case"bottom":this._middleColumn.resizeView(e,o);break}}isEdgeGroupCollapsed(e){var t,n;return(n=(t=this._getView(e))===null||t===void 0?void 0:t.isCollapsed)!==null&&n!==void 0?n:!1}_getView(e){switch(e){case"top":return this._topView;case"bottom":return this._bottomView;case"left":return this._leftView;case"right":return this._rightView}}toJSON(){const e={};return this._leftView&&this._leftIndex!==void 0&&(e.left={size:this._leftView.isCollapsed?this._leftView.lastExpandedSize:this._outerSplitview.getViewSize(this._leftIndex),visible:this._outerSplitview.isViewVisible(this._leftIndex),collapsed:this._leftView.isCollapsed||void 0}),this._rightView&&this._rightIndex!==void 0&&(e.right={size:this._rightView.isCollapsed?this._rightView.lastExpandedSize:this._outerSplitview.getViewSize(this._rightIndex),visible:this._outerSplitview.isViewVisible(this._rightIndex),collapsed:this._rightView.isCollapsed||void 0}),this._topView&&(e.top={size:this._topView.isCollapsed?this._topView.lastExpandedSize:this._middleColumn.getViewSize("top"),visible:this._middleColumn.isViewVisible("top"),collapsed:this._topView.isCollapsed||void 0}),this._bottomView&&(e.bottom={size:this._bottomView.isCollapsed?this._bottomView.lastExpandedSize:this._middleColumn.getViewSize("bottom"),visible:this._middleColumn.isViewVisible("bottom"),collapsed:this._bottomView.isCollapsed||void 0}),e}fromJSON(e){var t,n,o,h,w,a,l,u,d,c,b,C,S,y,g,_,m,v,D,P;e.left&&this._leftIndex!==void 0&&((t=this._leftView)===null||t===void 0||t.restoreExpandedSize(e.left.size),(n=this._leftView)===null||n===void 0||n.setCollapsed((o=e.left.collapsed)!==null&&o!==void 0?o:!1),this._outerSplitview.resizeView(this._leftIndex,e.left.collapsed&&(w=(h=this._leftView)===null||h===void 0?void 0:h.collapsedSize)!==null&&w!==void 0?w:e.left.size),e.left.visible||this._outerSplitview.setViewVisible(this._leftIndex,!1)),e.right&&this._rightIndex!==void 0&&((a=this._rightView)===null||a===void 0||a.restoreExpandedSize(e.right.size),(l=this._rightView)===null||l===void 0||l.setCollapsed((u=e.right.collapsed)!==null&&u!==void 0?u:!1),this._outerSplitview.resizeView(this._rightIndex,e.right.collapsed&&(c=(d=this._rightView)===null||d===void 0?void 0:d.collapsedSize)!==null&&c!==void 0?c:e.right.size),e.right.visible||this._outerSplitview.setViewVisible(this._rightIndex,!1)),e.top&&((b=this._topView)===null||b===void 0||b.restoreExpandedSize(e.top.size),(C=this._topView)===null||C===void 0||C.setCollapsed((S=e.top.collapsed)!==null&&S!==void 0?S:!1),this._middleColumn.resizeView("top",e.top.collapsed&&(g=(y=this._topView)===null||y===void 0?void 0:y.collapsedSize)!==null&&g!==void 0?g:e.top.size),e.top.visible||this._middleColumn.setViewVisible("top",!1)),e.bottom&&((_=this._bottomView)===null||_===void 0||_.restoreExpandedSize(e.bottom.size),(m=this._bottomView)===null||m===void 0||m.setCollapsed((v=e.bottom.collapsed)!==null&&v!==void 0?v:!1),this._middleColumn.resizeView("bottom",e.bottom.collapsed&&(P=(D=this._bottomView)===null||D===void 0?void 0:D.collapsedSize)!==null&&P!==void 0?P:e.bottom.size),e.bottom.visible||this._middleColumn.setViewVisible("bottom",!1))}dispose(){var e;this._disposables.dispose(),(e=this._shellElement.parentElement)===null||e===void 0||e.removeChild(this._shellElement)}}function p_(p){var e;const t=(e=p.tabGroupColors)!==null&&e!==void 0?e:lh,n=p.tabGroupAccent!=="off";return new Cp(t,n)}function xo(p){const e=p.from.activePanel;[...p.from.panels].map(n=>{const o=p.from.model.removePanel(n);return p.from.model.renderContainer.detatch(n),o}).forEach(n=>{p.to.model.openPanel(n,{skipSetActive:e!==n,skipSetGroupActive:!0})})}let gu=!1;function f_(){typeof process<"u"&&og||gu||Ov()||(gu=!0,console.warn('dockview: do not use "dockview-core" directly — it is an internal package. Use the "dockview" package, the JavaScript version of dockview, instead. This notice is shown once.'))}class m_ extends hp{fireDidCreateTabGroup(e){this._onDidCreateTabGroup.fire(e)}fireDidDestroyTabGroup(e){this._onDidDestroyTabGroup.fire(e)}fireDidAddPanelToTabGroup(e){this._onDidAddPanelToTabGroup.fire(e)}fireDidRemovePanelFromTabGroup(e){this._onDidRemovePanelFromTabGroup.fire(e)}fireDidTabGroupChange(e){this._onDidTabGroupChange.fire(e)}fireDidTabGroupCollapsedChange(e){this._onDidTabGroupCollapsedChange.fire(e)}get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get tabGroupColorPalette(){return this._tabGroupColorPalette}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get defaultHeaderPosition(){var e;return(e=this.options.defaultHeaderPosition)!==null&&e!==void 0?e:"top"}get api(){return this._api}get floatingGroups(){var e,t,n;return(n=(t=(e=this._moduleRegistry)===null||e===void 0?void 0:e.services.floatingGroupService)===null||t===void 0?void 0:t.floatingGroups)!==null&&n!==void 0?n:[]}_gatherFloatingGroupBoxes(e){var t;const o=((t=this._floatingOverlayHost)!==null&&t!==void 0?t:this.gridview.element).getBoundingClientRect();return this.floatingGroups.filter(h=>h.group!==e).map(h=>{const w=h.overlay.element.getBoundingClientRect();return{left:w.left-o.left,top:w.top-o.top,width:w.width,height:w.height}})}get _floatingGroupService(){return this._moduleRegistry.services.floatingGroupService}get _popoutWindowService(){return this._moduleRegistry.services.popoutWindowService}get _watermarkService(){return this._moduleRegistry.services.watermarkService}get _edgeGroupService(){return this._moduleRegistry.services.edgeGroupService}get _rootDropTargetService(){return this._moduleRegistry.services.rootDropTargetService}get _advancedDnDService(){return this._moduleRegistry.services.advancedDnDService}get headerActionsService(){return this._moduleRegistry.services.headerActionsService}isGridEmpty(){return this.gridview.length===0}rootDropTargetOverrideTarget(){var e;return(e=this.rootDropTargetContainer)===null||e===void 0?void 0:e.model}dispatchUnhandledDragOver(e,t){const n=new Pp(e,"edge",t,it);return this._onUnhandledDragOver.fire(n),n.isAccepted}fireWillDragPanel(e){this._onWillDragPanel.fire(e)}fireWillDragGroup(e){this._onWillDragGroup.fire(e)}fireWillDrop(e){this._onWillDrop.fire(e)}fireWillShowOverlay(e){this._onWillShowOverlay.fire(e)}buildGroupDragGhost(e){var t;return(t=this._advancedDnDService)===null||t===void 0?void 0:t.buildGroupDragGhost(e)}resolveDropOverlayModel(e,t){var n;return(n=this._advancedDnDService)===null||n===void 0?void 0:n.resolveOverlayModel(e,t)}get rootElement(){var e,t;return(t=(e=this._shellManager)===null||e===void 0?void 0:e.element)!==null&&t!==void 0?t:this.element}adjacentGroup(e,t){var n;if(e.api.location.type!=="grid")return;const o=Je(e.element);return(n=t?this.gridview.previous(o):this.gridview.next(o))===null||n===void 0?void 0:n.view}adjacentGroupInDirection(e,t){if(e.api.location.type!=="grid")return;const n=e.element.getBoundingClientRect(),o=n.left+n.width/2,h=n.top+n.height/2;let w,a=Number.POSITIVE_INFINITY;for(const l of this.groups){if(l===e||l.api.location.type!=="grid")continue;const u=l.element.getBoundingClientRect(),d=u.left+u.width/2-o,c=u.top+u.height/2-h;if(!(t==="left"?d<0&&Math.abs(d)>=Math.abs(c):t==="right"?d>0&&Math.abs(d)>=Math.abs(c):t==="up"?c<0&&Math.abs(c)>=Math.abs(d):c>0&&Math.abs(c)>=Math.abs(d)))continue;const C=d*d+c*c;C<a&&(a=C,w=l)}return w}showDropPreview(e,t){var n,o;return(o=(n=this._advancedDnDService)===null||n===void 0?void 0:n.showPreviewOverlay(e,t))!==null&&o!==void 0?o:Ve.NONE}announce(e){var t;(t=this._moduleRegistry.services.liveRegionService)===null||t===void 0||t.announce(e)}dockPanel(e,t,n){this.moveGroupOrPanel({from:{groupId:e.group.id,panelId:e.id},to:{group:t,position:n}})}get contextMenuService(){return this._moduleRegistry.services.contextMenuService}get mountElement(){return this.gridview.element}hasVisibleGridGroup(){return this.groups.some(e=>e.api.location.type==="grid"&&e.api.isVisible)}fireLayoutChange(){this._bufferOnDidLayoutChange.fire()}get popoutRestorationPromise(){var e,t;return(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.restorationPromise)!==null&&t!==void 0?t:Promise.resolve()}constructor(e,t){var n,o,h,w,a;super(e,{proportionalLayout:!0,orientation:Pe.HORIZONTAL,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,locked:t.locked,margin:(o=(n=t.theme)===null||n===void 0?void 0:n.gap)!==null&&o!==void 0?o:0,className:t.className}),this.nextGroupId=sh(),this._deserializer=new kv(this),this._moduleRegistry=new Iv,this._onWillDragPanel=new Q,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new Q,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new Q,this.onWillDrop=this._onWillDrop.event,this._mutationDepth=0,this._origin="user",this._originDepth=0,this._onWillMutateLayout=new Q,this.onWillMutateLayout=this._onWillMutateLayout.event,this._onDidMutateLayout=new Q,this.onDidMutateLayout=this._onDidMutateLayout.event,this._onWillShowOverlay=new Q,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this._onDidRemovePanel=new Q,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new Q,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new Q,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new Q,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidAddPopoutGroup=new Q,this.onDidAddPopoutGroup=this._onDidAddPopoutGroup.event,this._onDidRemovePopoutGroup=new Q,this.onDidRemovePopoutGroup=this._onDidRemovePopoutGroup.event,this._onDidOpenPopoutWindowFail=new Q,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new Q({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new Q,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidCreateTabGroup=new Q,this.onDidCreateTabGroup=this._onDidCreateTabGroup.event,this._onDidDestroyTabGroup=new Q,this.onDidDestroyTabGroup=this._onDidDestroyTabGroup.event,this._onDidAddPanelToTabGroup=new Q,this.onDidAddPanelToTabGroup=this._onDidAddPanelToTabGroup.event,this._onDidRemovePanelFromTabGroup=new Q,this.onDidRemovePanelFromTabGroup=this._onDidRemovePanelFromTabGroup.event,this._onDidTabGroupChange=new Q,this.onDidTabGroupChange=this._onDidTabGroupChange.event,this._onDidTabGroupCollapsedChange=new Q,this.onDidTabGroupCollapsedChange=this._onDidTabGroupCollapsedChange.event,this._onDidMaximizedGroupChange=new Q,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._inShellLayout=!1,this._onDidRemoveGroup=new Q,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new Q,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new Q,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=t,this._tabGroupColorPalette=p_(t);const l=t.modules,u=l??[...e_,...Rv()];for(const b of u)this._moduleRegistry.register(b);this._moduleRegistry.initialize(this);const d=this._popoutWindowService;d&&this.addDisposables(d.onDidRemove(b=>{this._onDidRemovePopoutGroup.fire({id:b.popoutGroup.id,group:b.popoutGroup,window:b.getWindow()})})),f_(),this.popupService=new fu(this.element),this._api=new rh(this),this.disableResizing=!0,e.removeChild(this.element),this._shellManager=new u_(e,this.element,(b,C)=>this._layoutFromShell(b,C),(w=(h=t.theme)===null||h===void 0?void 0:h.gap)!==null&&w!==void 0?w:0,(a=t.theme)===null||a===void 0?void 0:a.edgeGroupCollapsedSize),this.popupService.updateRoot(this._shellManager.element),this._shellThemeClassnames=new Oo(this._shellManager.element),this.rootDropTargetContainer=new mu(this._shellManager.element,{disabled:!0}),this.overlayRenderContainer=new pu(this._shellManager.element,this),this._floatingOverlayHost=document.createElement("div"),this._floatingOverlayHost.className="dv-floating-overlay-host",this._shellManager.element.appendChild(this._floatingOverlayHost),we(this.gridview.element,"dv-dockview",!0),we(this.element,"dv-debug",!!t.debug),this.updateTheme(),t.debug&&this.addDisposables(new o_(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onWillMutateLayout,this._onDidMutateLayout,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOver,this._onDidMaximizedGroupChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidAddPopoutGroup,this._onDidRemovePopoutGroup,this._onDidOpenPopoutWindowFail,this._onDidCreateTabGroup,this._onDidDestroyTabGroup,this._onDidAddPanelToTabGroup,this._onDidRemovePanelFromTabGroup,this._onDidTabGroupChange,this._onDidTabGroupCollapsedChange,ri.any(this.onDidPopoutGroupSizeChange,this.onDidPopoutGroupPositionChange,this.onDidCreateTabGroup,this.onDidDestroyTabGroup,this.onDidAddPanelToTabGroup,this.onDidRemovePanelFromTabGroup,this.onDidTabGroupChange,this.onDidTabGroupCollapsedChange)(()=>{this.fireLayoutChange()}),this._onDidOptionsChange,this.onDidAdd(b=>{this._moving||this._onDidAddGroup.fire(b)}),this.onDidRemove(b=>{this._moving||this._onDidRemoveGroup.fire(b)}),this.onDidActiveChange(b=>{this._moving||this._onDidActiveGroupChange.fire(b)}),this.onDidMaximizedChange(b=>{this._onDidMaximizedGroupChange.fire({group:b.panel,isMaximized:b.isMaximized})}),ri.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidRemoveGroup,this.onDidMovePanel,this.onDidActivePanelChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Ve.from(()=>{var b;this._moduleRegistry.dispose(),(b=this._shellManager)===null||b===void 0||b.dispose()}));const c=this._rootDropTargetService;c&&this.addDisposables(c.onWillShowOverlay(b=>{this.gridview.length>0&&b.position==="center"||this._onWillShowOverlay.fire(new hr(b,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:it}))}),c.onDrop(b=>{var C;const S=new Tp({nativeEvent:b.nativeEvent,position:b.position,panel:void 0,api:this._api,group:void 0,getData:it,kind:"edge"});if(this._onWillDrop.fire(S),S.defaultPrevented)return;const y=it();y?this.moveGroupOrPanel({from:{groupId:y.groupId,panelId:(C=y.panelId)!==null&&C!==void 0?C:void 0},to:{group:this.orthogonalize(b.position),position:"center"}}):this._onDidDrop.fire(new dh({nativeEvent:b.nativeEvent,position:b.position,panel:void 0,api:this._api,group:void 0,getData:it}))})),this._moduleRegistry.postConstruct(this)}setVisible(e,t){switch(e.api.location.type){case"grid":super.setVisible(e,t);break;case"floating":{const n=this.floatingGroups.find(o=>o.group===e);n&&(n.overlay.setVisible(t),e.api._onDidVisibilityChange.fire({isVisible:t}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}getPopupServiceForGroup(e){var t,n;return(n=(t=this._popoutWindowService)===null||t===void 0?void 0:t.getPopupService(e.id))!==null&&n!==void 0?n:this.popupService}addPopoutGroup(e,t){return this.mutation("popout",()=>this._doAddPopoutGroup(e,t))}getPopouts(){var e,t;return(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.entries.map(n=>({id:n.popoutGroup.id,group:n.popoutGroup,window:n.getWindow()})))!==null&&t!==void 0?t:[]}_doAddPopoutGroup(e,t){var n,o,h,w,a;const l=Ns(this._popoutWindowService,"PopoutWindow","api.addPopoutGroup");if(!l||e instanceof So&&e.model.location.type==="edge")return Promise.resolve(!1);if(e instanceof pn&&e.group.size===1)return this.addPopoutGroup(e.group,t);const u=mg(this.gridview.element),d=this.element;function c(){return t!=null&&t.position?t.position:e instanceof So?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():d.getBoundingClientRect()}const b=c(),C=(o=(n=t==null?void 0:t.overridePopoutGroup)===null||n===void 0?void 0:n.id)!==null&&o!==void 0?o:this.getNextGroupId(),S=(h=t==null?void 0:t.popoutUrl)!==null&&h!==void 0?h:(w=this.options)===null||w===void 0?void 0:w.popoutUrl,y=new r_(`${this.id}-${C}`,u??"",{url:S??"/popout.html",left:window.screenX+b.left,top:window.screenY+b.top,width:b.width,height:b.height,onDidOpen:t==null?void 0:t.onDidOpen,onWillClose:t==null?void 0:t.onWillClose,nonce:(a=this.options)===null||a===void 0?void 0:a.nonce}),g=new Se(y,y.onDidClose(()=>{g.dispose()}));return y.open().then(_=>{var m,v,D;if(y.isDisposed)return!1;const P=t!=null&&t.referenceGroup?t.referenceGroup:e instanceof pn?e.group:e,T=e.api.location.type,A=P.element.parentElement!==null;let E;if(t!=null&&t.overridePopoutGridview?E=(m=t.overridePopoutGroup)!==null&&m!==void 0?m:P:A?t!=null&&t.overridePopoutGroup?E=t.overridePopoutGroup:(E=this.createGroup({id:C}),_&&this._onDidAddGroup.fire(E)):E=P,_===null)return this.handleBlockedPopout({group:E,referenceGroup:P,options:t,popoutWindowDisposable:g}),!1;const I=document.createElement("div");I.className="dv-overlay-render-container";const B=new pu(I,this);E.model.renderContainer=B;const N=(v=t==null?void 0:t.overridePopoutGridview)!==null&&v!==void 0?v:this.createNestedGridview();t!=null&&t.overridePopoutGridview||N.addView(E,Wt.Distribute,[0]),N.element.style.width="100%",N.element.style.height="100%",N.layout(y.window.innerWidth,y.window.innerHeight);let W=!1;const F=()=>{W||(W=!0,N.dispose())};let q;if(!(t!=null&&t.overridePopoutGroup)&&!(t!=null&&t.overridePopoutGridview)&&A)if(e instanceof pn)this.movingLock(()=>{const X=P.model.removePanel(e);E.model.openPanel(X)});else switch(this.movingLock(()=>xo({from:P,to:E})),T){case"grid":P.api.setVisible(!1);break;case"floating":case"popout":q=(D=this.floatingGroups.find(X=>X.group.api.id===e.api.id))===null||D===void 0?void 0:D.overlay.toJSON(),this.removeGroup(P);break}_.classList.add("dv-dockview"),_.style.overflow="hidden",_.appendChild(I),_.appendChild(N.element);const V=document.createElement("div"),K=new mu(V,{disabled:this.rootDropTargetContainer.disabled});_.appendChild(V),E.model.dropTargetContainer=K;const ie=new fu(_,y.window);if(l.setPopupService(E.id,ie),g.addDisposables(ie,Ve.from(()=>{l.deletePopupService(E.id)})),E.model.location={type:"popout",getWindow:()=>y.window,popoutUrl:S},t!=null&&t.overridePopoutGridview){const X=this.groups.filter(oe=>N.element.contains(oe.element));for(const oe of X)oe.model.renderContainer=B,oe.model.dropTargetContainer=K,oe.model.location={type:"popout",getWindow:()=>y.window,popoutUrl:S}}A&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(E);const Z=l.observeGridviewSize(y,N,B);Z&&g.addDisposables(Z),g.addDisposables(E.api.onDidActiveChange(X=>{var oe;X.isActive&&((oe=y.window)===null||oe===void 0||oe.focus())}),E.api.onWillFocus(()=>{var X;(X=y.window)===null||X===void 0||X.focus()}));const L={},H=A&&P&&this.getPanel(P.id),R={window:y,popoutGroup:E,gridview:N,overlayRenderContainer:B,dropTargetContainer:K,getWindow:()=>y.window,popoutUrl:S,referenceGroup:H?P.id:void 0,disposable:{dispose:()=>(g.dispose(),L.returnedGroup)}},G=gg(y.window);return g.addDisposables(G,vg(y.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:y.window.innerWidth,height:y.window.innerHeight,group:E})}),G.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:y.window.screenX,screenY:y.window.screenX,group:E})}),be(y.window,"resize",()=>{N.layout(y.window.innerWidth,y.window.innerHeight)}),B,Ve.from(()=>this.disposePopoutWindow({group:E,referenceGroup:P,popoutGridview:N,isGroupAddedToDom:A,floatingBox:q,disposePopoutGridview:F,closeResult:L}))),l.add(R),this._onDidAddPopoutGroup.fire({id:R.popoutGroup.id,group:R.popoutGroup,window:R.getWindow()}),!0}).catch(_=>(console.error("dockview: failed to create popout.",_),!1))}handleBlockedPopout(e){const{group:t,referenceGroup:n,options:o,popoutWindowDisposable:h}=e;if(console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),h.dispose(),this._onDidOpenPopoutWindowFail.fire(),o!=null&&o.overridePopoutGridview){const w=o.overridePopoutGridview,a=this.groups.filter(l=>w.element.contains(l.element));for(const l of a)this.movingLock(()=>{w.remove(l),this.redockGroupToMainGrid(l)});w.dispose(),n&&!n.api.isVisible&&n.api.setVisible(!0);return}t===n?this.gridview.element.contains(t.element)||(this.movingLock(()=>this.doAddGroup(t,[0])),t.model.location={type:"grid"}):(this.movingLock(()=>xo({from:t,to:n})),t.model.size===0&&this._groups.has(t.id)&&(t.dispose(),this._groups.delete(t.id),this._onDidRemoveGroup.fire(t))),n.api.isVisible||n.api.setVisible(!0)}redockGroupToMainGrid(e){e.model.renderContainer=this.overlayRenderContainer,e.model.dropTargetContainer=this.rootDropTargetContainer,e.model.location={type:"grid"},this.doAddGroup(e,[0])}disposePopoutWindow(e){var t;const{group:n,referenceGroup:o,popoutGridview:h,isGroupAddedToDom:w,floatingBox:a,disposePopoutGridview:l,closeResult:u}=e;if(this.isDisposed){l();return}const d=!!(!((t=this._popoutWindowService)===null||t===void 0)&&t.entries.find(S=>S.gridview===h)),c=this.groups.filter(S=>h.element.contains(S.element)),b=c.includes(n),C=b&&c.length===1;if(d)for(const S of c)S!==n&&this.movingLock(()=>{this.doRemoveGroup(S,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),this.redockGroupToMainGrid(S)});if(b&&w&&this.getPanel(o.id))this.movingLock(()=>xo({from:n,to:o})),o.api.isVisible||o.api.setVisible(!0),this.getPanel(n.id)&&this.doRemoveGroup(n,{skipPopoutAssociated:!0});else if(b&&this.getPanel(n.id)){if(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,u.returnedGroup=n,!d){l();return}a&&C?this.addFloatingGroup(n,{height:a.height,width:a.width,position:a}):(this.doRemoveGroup(n,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),n.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(n,[0])})),this.doSetGroupAndPanelActive(n)}l()}addFloatingGroup(e,t){this.mutation("float",()=>this._doAddFloatingGroup(e,t))}_doAddFloatingGroup(e,t){var n;if(!Ns(this._floatingGroupService,"FloatingGroup","api.addFloatingGroup")||e instanceof So&&e.model.location.type==="edge")return;let h;if(e instanceof pn)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const u=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findReferenceGroupId(h),d=u?this.getPanel(u):void 0;typeof(t==null?void 0:t.skipRemoveGroup)=="boolean"&&t.skipRemoveGroup||(d?(this.movingLock(()=>xo({from:e,to:d})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(d,{skipDispose:!0}),h=d):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function w(){if(t!=null&&t.position){const u={};return"left"in t.position?u.left=Math.max(t.position.left,0):"right"in t.position?u.right=Math.max(t.position.right,0):u.left=ms.left,"top"in t.position?u.top=Math.max(t.position.top,0):"bottom"in t.position?u.bottom=Math.max(t.position.bottom,0):u.top=ms.top,typeof t.width=="number"?u.width=Math.max(t.width,0):u.width=ms.width,typeof t.height=="number"?u.height=Math.max(t.height,0):u.height=ms.height,u}return{left:typeof(t==null?void 0:t.x)=="number"?Math.max(t.x,0):ms.left,top:typeof(t==null?void 0:t.y)=="number"?Math.max(t.y,0):ms.top,width:typeof(t==null?void 0:t.width)=="number"?Math.max(t.width,0):ms.width,height:typeof(t==null?void 0:t.height)=="number"?Math.max(t.height,0):ms.height}}const a=w(),l=this.createNestedGridview();l.addView(h,Wt.Distribute,[0]),this.mountFloatingWindow(l,h,[h],a,{dragHandle:t==null?void 0:t.dragHandle,inDragMode:t==null?void 0:t.inDragMode,skipActiveGroup:t==null?void 0:t.skipActiveGroup})}createNestedGridview(e=Pe.HORIZONTAL){var t,n;return new lp(!0,this.options.hideBorders?{separatorBorder:"transparent"}:void 0,e,!1,(n=(t=this.options.theme)===null||t===void 0?void 0:t.gap)!==null&&n!==void 0?n:0)}mountFloatingWindow(e,t,n,o,h){var w,a,l,u,d,c,b,C;const S=Ns(this._floatingGroupService,"FloatingGroup","api.addFloatingGroup");if(!S)return;const g=((a=(w=h==null?void 0:h.dragHandle)!==null&&w!==void 0?w:this.options.floatingGroupDragHandle)!==null&&a!==void 0?a:"titlebar")==="titlebar"?new Av(this,t):void 0,_=new Pi(Object.assign(Object.assign({container:(l=this._floatingOverlayHost)!==null&&l!==void 0?l:this.gridview.element,content:e.element,header:g==null?void 0:g.element},o),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(u=this.options.floatingGroupBounds)===null||u===void 0?void 0:u.minimumWidthWithinViewport)!==null&&d!==void 0?d:Ro,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(b=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&b!==void 0?b:Ro,transformDragPosition:this.options.transformFloatingGroupDrag?D=>this.options.transformFloatingGroupDrag({group:t,proposed:D.proposed,container:D.container,others:D.others}):void 0,getSiblingBoxes:()=>this._gatherFloatingGroupBoxes(t)})),m=(C=g==null?void 0:g.element)!==null&&C!==void 0?C:t.element.querySelector(".dv-void-container");if(!m)throw new Error("dockview: failed to find drag handle");_.setupDrag(m,{inDragMode:typeof(h==null?void 0:h.inDragMode)=="boolean"?h.inDragMode:!1});const v=S.add(t,_,e);g&&(v.setTitleBar(g),v.addDisposables(g,Ve.from(()=>v.setTitleBar(void 0)),g.onDragStart(D=>{this._onWillDragGroup.fire({nativeEvent:D,group:v.group})})));for(const D of n)D.model.location={type:"floating"};h!=null&&h.skipActiveGroup||this.doSetGroupAndPanelActive(t)}orthogonalize(e,t){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===Pe.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===Pe.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,t);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,t);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var t,n,o,h,w;super.updateOptions(e),(t=this._floatingGroupService)===null||t===void 0||t.updateBounds(e),(n=this._rootDropTargetService)===null||n===void 0||n.setOptions(e);const a=this.options.disableDnd,l=this.options.dndStrategy;this._options=Object.assign(Object.assign({},this.options),e);const u=this.options.disableDnd,d=this.options.dndStrategy;if((a!==u||l!==d)&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),("createRightHeaderActionComponent"in e||"createLeftHeaderActionComponent"in e||"createPrefixHeaderActionComponent"in e)&&((o=this.headerActionsService)===null||o===void 0||o.refreshAll()),"createWatermarkComponent"in e){(h=this._watermarkService)===null||h===void 0||h.refresh();for(const c of this.groups)c.model.refreshWatermark()}if("tabGroupColors"in e||"tabGroupAccent"in e){this._tabGroupColorPalette.setEntries((w=this._options.tabGroupColors)!==null&&w!==void 0?w:lh),this._tabGroupColorPalette.enabled=this._options.tabGroupAccent!=="off";for(const c of this.groups)c.model.refreshTabGroupAccent()}this._onDidOptionsChange.fire(),this._layoutFromShell(this.gridview.width,this.gridview.height)}layout(e,t,n){var o,h;this._shellManager&&!this._inShellLayout?this._shellManager.layout(e,t):super.layout(e,t,n),this._syncFloatingOverlayHost(),(h=(o=this._moduleRegistry)===null||o===void 0?void 0:o.services.floatingGroupService)===null||h===void 0||h.constrainBounds()}_syncFloatingOverlayHost(){if(!this._floatingOverlayHost||!this._shellManager)return;const e=this._shellManager.element.getBoundingClientRect(),t=this.element.getBoundingClientRect(),n=this._floatingOverlayHost;n.style.left=`${t.left-e.left}px`,n.style.top=`${t.top-e.top}px`,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`}_layoutFromShell(e,t){this._inShellLayout=!0,this.layout(e,t,!0),this._inShellLayout=!1}forceRelayout(){this._shellManager?this._layoutFromShell(this.width,this.height):super.forceRelayout()}addEdgeGroup(e,t){const n=Ns(this._edgeGroupService,"EdgeGroup","api.addEdgeGroup");if(!n)throw new Error("dockview: EdgeGroup module is not registered");if(n.has(e))throw new Error(`dockview: edge group already exists at position '${e}'`);return this.mutation("add",()=>{const o=this.createGroup({id:t.id});o.model.location={type:"edge",position:e},o.model.headerPosition=e;const h=o.model.onDidRemovePanel(()=>{o.model.isEmpty&&this.setEdgeGroupCollapsed(o,!0)});return n.add(e,o,h),this._onDidAddGroup.fire(o),this._shellManager.addEdgeView(e,t,o),o.api})}getEdgeGroup(e){var t,n;return(n=(t=this._edgeGroupService)===null||t===void 0?void 0:t.get(e))===null||n===void 0?void 0:n.api}setEdgeGroupVisible(e,t){this._shellManager.setEdgeGroupVisible(e,t)}isEdgeGroupVisible(e){return this._shellManager.isEdgeGroupVisible(e)}removeEdgeGroup(e){const t=Ns(this._edgeGroupService,"EdgeGroup","api.removeEdgeGroup");if(!t)return;const n=t.get(e);if(!n)throw new Error(`dockview: no edge group exists at position '${e}'`);this.mutation("remove",()=>{for(const o of[...n.panels])this.removePanel(o,{removeEmptyGroup:!1,skipDispose:!1});this._shellManager.removeEdgeView(e),t.remove(e),n.dispose(),this._groups.delete(n.id),this._onDidRemoveGroup.fire(n)})}setEdgeGroupCollapsed(e,t){var n;const o=(n=this._edgeGroupService)===null||n===void 0?void 0:n.findPositionOf(e);o&&this._shellManager.isEdgeGroupCollapsed(o)!==t&&(this._shellManager.setEdgeGroupCollapsed(o,t),e.api._onDidCollapsedChange.fire({isCollapsed:t}))}isEdgeGroupCollapsed(e){var t;const n=(t=this._edgeGroupService)===null||t===void 0?void 0:t.findPositionOf(e);return n?this._shellManager.isEdgeGroupCollapsed(n):!1}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(t=>t.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const n=Je(e.group.element),o=(t=this.gridview.next(n))===null||t===void 0?void 0:t.view;this.doSetGroupAndPanelActive(o)}moveToPrevious(e={}){var t;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const n=Je(e.group.element),o=(t=this.gridview.previous(n))===null||t===void 0?void 0:t.view;o&&this.doSetGroupAndPanelActive(o)}toJSON(){var e,t,n,o,h,w,a,l;const u=this.gridview.serialize(),d=this.panels.reduce((y,g)=>(y[g.id]=g.toJSON(),y),{}),c=(t=(e=this._floatingGroupService)===null||e===void 0?void 0:e.serialize())!==null&&t!==void 0?t:[],b=(o=(n=this._popoutWindowService)===null||n===void 0?void 0:n.serialize())!==null&&o!==void 0?o:[],C={grid:u,panels:d,activeGroup:(h=this.activeGroup)===null||h===void 0?void 0:h.id};c.length>0&&(C.floatingGroups=c),b.length>0&&(C.popoutGroups=b);const S=(a=(w=this._edgeGroupService)===null||w===void 0?void 0:w.entries())!==null&&a!==void 0?a:[];if(!((l=this._edgeGroupService)===null||l===void 0)&&l.hasAny()){const y=this._shellManager.toJSON();for(const[g,_]of S){const m=y[g];m&&(m.group=_.toJSON())}C.edgeGroups=y}return C}fromJSON(e,t){this.mutation("load",()=>this._doFromJSON(e,t))}_doFromJSON(e,t){var n,o,h,w,a,l,u;(n=this._popoutWindowService)===null||n===void 0||n.cancelPendingRestorations();const d=new Map;let c;if(t!=null&&t.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const y=Object.keys(e.panels);for(const g of this.panels)y.includes(g.api.id)&&d.set(g.api.id,g);this.movingLock(()=>{Array.from(d.values()).forEach(g=>{this.moveGroupOrPanel({from:{groupId:g.api.group.api.id,panelId:g.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:b,panels:C,activeGroup:S}=e;if(b.root.type!=="branch"||!Array.isArray(b.root.data))throw new Error("dockview: root must be of type branch");try{const y=this.width,g=this.height,_=v=>{const{id:D,locked:P,hideHeader:T,headerPosition:A,views:E,activeView:I}=v;if(typeof D!="string")throw new Error("dockview: group id must be of type string");const B=this.createGroup({id:D,locked:!!P,hideHeader:!!T,headerPosition:A});this._onDidAddGroup.fire(B);const N=[];for(const W of E){const F=d.get(W);if(c&&F)this.movingLock(()=>{c.model.removePanel(F)}),N.push(F),F.updateFromStateModel(C[W]);else{const q=this._deserializer.fromJSON(C[W],B);N.push(q)}}for(let W=0;W<E.length;W++){const F=N[W],q=typeof I=="string"&&I===F.id;d.has(F.api.id)?this.movingLock(()=>{B.model.openPanel(F,{skipSetActive:!q,skipSetGroupActive:!0})}):B.model.openPanel(F,{skipSetActive:!q,skipSetGroupActive:!0})}return v.tabGroups&&v.tabGroups.length>0&&B.model.restoreTabGroups(v.tabGroups),!B.activePanel&&B.panels.length>0&&B.model.openPanel(B.panels[B.panels.length-1],{skipSetGroupActive:!0}),B};this.gridview.deserialize(b,{fromJSON:v=>_(v.data)}),this._layoutFromShell(y,g),e.edgeGroups&&this.deserializeEdgeGroups(e.edgeGroups,C),this.deserializeFloatingWindows((o=e.floatingGroups)!==null&&o!==void 0?o:[],_);const m=this.deserializePopoutWindows((h=e.popoutGroups)!==null&&h!==void 0?h:[],_);if((w=this._popoutWindowService)===null||w===void 0||w.finishRestoration(m),(a=this._floatingGroupService)===null||a===void 0||a.constrainBounds(),typeof S=="string"){const v=this.getPanel(S);v&&this.doSetGroupAndPanelActive(v)}(l=this._watermarkService)===null||l===void 0||l.update()}catch(y){console.error("dockview: failed to deserialize layout. Reverting changes",y);for(const g of this.groups)for(const _ of g.panels)this.removePanel(_,{removeEmptyGroup:!1,skipDispose:!1});for(const g of this.groups)g.dispose(),this._groups.delete(g.id),this._onDidRemoveGroup.fire(g);throw(u=this._floatingGroupService)===null||u===void 0||u.disposeAll(),this.clear(),y}this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}deserializeNestedGridview(e,t){const n=this.createNestedGridview(e.orientation),o=[];return n.deserialize(e,{fromJSON:h=>{const w=t(h.data);return o.push(w),w}}),{gridview:n,members:o}}deserializeEdgeGroups(e,t){var n;const o=Ns(this._edgeGroupService,"EdgeGroup","fromJSON edge restoration");if(o){for(const h of["top","bottom","left","right"]){const w=e[h];if(w&&!o.has(h)){const a=w.group,l=(n=a==null?void 0:a.id)!==null&&n!==void 0?n:`${h}-group`;this.addEdgeGroup(h,{id:l})}}for(const[h,w]of o.entries()){const a=e[h],l=a==null?void 0:a.group;if(l){const{views:u,activeView:d}=l,c=[];for(const b of u)if(t[b]){const C=this._deserializer.fromJSON(t[b],w);c.push(C)}for(let b=0;b<c.length;b++){const C=c[b],S=d===C.id;w.model.openPanel(C,{skipSetActive:!S,skipSetGroupActive:!0})}l.tabGroups&&l.tabGroups.length>0&&w.model.restoreTabGroups(l.tabGroups),!w.activePanel&&w.panels.length>0&&w.model.openPanel(w.panels[w.panels.length-1],{skipSetGroupActive:!0})}}this._shellManager.fromJSON(e)}}deserializeFloatingWindows(e,t){for(const n of e){const{data:o,grid:h,position:w}=n;if(h){const{gridview:a,members:l}=this.deserializeNestedGridview(h,t);if(l.length===0)continue;this.mountFloatingWindow(a,l[0],l,w,{inDragMode:!1})}else if(o){const a=t(o);this.addFloatingGroup(a,{position:w,width:w.width,height:w.height,skipRemoveGroup:!0,inDragMode:!1})}}}deserializePopoutWindows(e,t){const n=e.length>0?Ns(this._popoutWindowService,"PopoutWindow","fromJSON popout restoration"):this._popoutWindowService;return n?e.flatMap((o,h)=>{const{data:w,grid:a,position:l,gridReferenceGroup:u,url:d}=o;let c,b=[];if(a){const S=this.deserializeNestedGridview(a,t);if(c=S.gridview,b=S.members,b.length===0)return c.dispose(),[]}const C=a?b[0]:t(w);return n.scheduleRestoration(h*Gv,()=>{this.addPopoutGroup(C,{position:l??void 0,overridePopoutGroup:u?C:void 0,overridePopoutGridview:c,referenceGroup:u?this.getPanel(u):void 0,popoutUrl:d})},()=>{for(const S of b.length>0?b:[C])if(!this.isDisposed&&this._groups.has(S.id)&&S.element.parentElement===null){for(const y of[...S.panels])this.removePanel(y,{removeEmptyGroup:!1});S.dispose(),this._groups.delete(S.id),this._onDidRemoveGroup.fire(S)}})}):[]}clear(){this.mutation("clear",()=>this._doClear())}_doClear(){var e;const t=Array.from(this._groups.values()).map(o=>o.value),n=!!this.activeGroup;for(const o of t){if(!((e=this._edgeGroupService)===null||e===void 0)&&e.includes(o)){const h=[...o.panels];for(const w of h)this.removePanel(w,{removeEmptyGroup:!1});continue}this.removeGroup(o,{skipActive:!0})}n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){this.mutation("remove",()=>{for(const e of this._groups.entries()){const[t,n]=e;n.value.model.closeAllPanels()}})}addPanel(e){return this.mutation("add",()=>this._doAddPanel(e))}_doAddPanel(e){var t,n;if(this.panels.find(l=>l.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let o;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const h={width:e.initialWidth,height:e.initialHeight};let w;if(e.position)if(fv(e.position)){const l=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(w=e.position.index,!l)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);o=this.findGroup(l)}else if(mv(e.position)){if(o=typeof e.position.referenceGroup=="string"?(t=this._groups.get(e.position.referenceGroup))===null||t===void 0?void 0:t.value:e.position.referenceGroup,w=e.position.index,!o)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const l=this.orthogonalize(ou(e.position.direction)),u=this.createPanel(e,l);return l.model.openPanel(u,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(l),l.api.setSize({height:h==null?void 0:h.height,width:h==null?void 0:h.width}),u}else o=this.activeGroup;let a;if(o){const l=Lo(((n=e.position)===null||n===void 0?void 0:n.direction)||"within");if(e.floating){const u=this.createGroup();this._onDidAddGroup.fire(u);const d=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(u,Object.assign(Object.assign({},d),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),a=this.createPanel(e,u),u.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w})}else if(o.api.location.type==="floating"||o.api.location.type==="edge"||l==="center")a=this.createPanel(e,o),o.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),o.api.setSize({width:h==null?void 0:h.width,height:h==null?void 0:h.height}),e.inactive||this.doSetGroupAndPanelActive(o);else{const u=Je(o.element),d=si(this.gridview.orientation,u,l),c=this.createGroupAtLocation(d,this.orientationAtLocation(d)===Pe.VERTICAL?h==null?void 0:h.height:h==null?void 0:h.width);a=this.createPanel(e,c),c.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(c)}}else if(e.floating){const l=this.createGroup();this._onDidAddGroup.fire(l);const u=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(l,Object.assign(Object.assign({},u),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),a=this.createPanel(e,l),l.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w})}else{const l=this.createGroupAtLocation([0],this.gridview.orientation===Pe.VERTICAL?h==null?void 0:h.height:h==null?void 0:h.width);a=this.createPanel(e,l),l.model.openPanel(a,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:w}),e.inactive||this.doSetGroupAndPanelActive(l)}return a}removePanel(e,t={removeEmptyGroup:!0}){this.mutation("remove",()=>this._doRemovePanel(e,t))}_doRemovePanel(e,t={removeEmptyGroup:!0}){const n=e.group;if(!n)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);n.model.removePanel(e,{skipSetActiveGroup:t.skipSetActiveGroup}),t.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),n.size===0&&t.removeEmptyGroup&&this.removeGroup(n,{skipActive:t.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new Pv}addGroup(e){return this.mutation("add",()=>this._doAddGroup(e))}_doAddGroup(e){var t;if(e){let n;if(gv(e)){const u=typeof e.referencePanel=="string"?this.panels.find(d=>d.id===e.referencePanel):e.referencePanel;if(!u)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(n=this.findGroup(u),!n)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(vv(e)){if(n=typeof e.referenceGroup=="string"?(t=this._groups.get(e.referenceGroup))===null||t===void 0?void 0:t.value:e.referenceGroup,!n)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const u=this.orthogonalize(ou(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(u),u}const o=Lo(e.direction||"within"),h=Je(n.element),w=si(this.gridview.orientation,h,o),a=this.createGroup(e),l=this.getLocationOrientation(w)===Pe.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(a,w,l),e.skipSetActive||this.doSetGroupAndPanelActive(a),a}else{const n=this.createGroup(e);return this.doAddGroup(n),this.doSetGroupAndPanelActive(n),n}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===Pe.HORIZONTAL?Pe.HORIZONTAL:Pe.VERTICAL}removeGroup(e,t){this.mutation("remove",()=>this.doRemoveGroup(e,t))}detachFromNestedWindow(e){var t,n;const o=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(e);if(o){const w=this.nestedWindowMembers(e);return w.length<=1?!1:(o.gridview.remove(e),o.group===e&&o.setAnchorGroup(w.find(a=>a!==e)),!0)}const h=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(e);if(h){const w=this.nestedWindowMembers(e);return w.length<=1?!1:(h.gridview.remove(e),h.popoutGroup===e&&(h.popoutGroup=w.find(a=>a!==e)),!0)}return!1}disposeGroupRecord(e){e.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}activateFallbackGroupIfRemoved(e,t){if(!t&&this._activeGroup===e){const n=Array.from(this._groups.values());this.doSetGroupAndPanelActive(n.length>0?n[0].value:void 0)}}doRemoveGroup(e,t){var n,o,h,w,a;if(!((n=this._edgeGroupService)===null||n===void 0)&&n.includes(e))return e;const l=[...e.panels];if(!(t!=null&&t.skipDispose))for(const c of l)this.removePanel(c,{removeEmptyGroup:!1,skipDispose:(o=t==null?void 0:t.skipDispose)!==null&&o!==void 0?o:!1});const u=this.activePanel;if(e.api.location.type==="floating"){const c=(h=this._floatingGroupService)===null||h===void 0?void 0:h.findByGroup(e);if(!c)throw new Error("dockview: failed to find floating group");return this.detachFromNestedWindow(e)?(t!=null&&t.skipDispose?e.model.location={type:"grid"}:this.disposeGroupRecord(e),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e):(t!=null&&t.skipDispose||this.disposeGroupRecord(e),c.dispose(),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e)}if(e.api.location.type==="popout"){const c=(w=this._popoutWindowService)===null||w===void 0?void 0:w.findByGroup(e);if(!c)throw new Error("dockview: failed to find popout group");if(this.detachFromNestedWindow(e))return t!=null&&t.skipDispose?e.model.location={type:"grid"}:this.disposeGroupRecord(e),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e;if(!(t!=null&&t.skipDispose)){if(!(t!=null&&t.skipPopoutAssociated)){const C=c.referenceGroup?this.getPanel(c.referenceGroup):void 0;C&&C.panels.length===0&&this.removeGroup(C)}c.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}(a=this._popoutWindowService)===null||a===void 0||a.remove(c);const b=c.disposable.dispose();return!(t!=null&&t.skipPopoutReturn)&&b&&(this.doAddGroup(b,[0]),this.doSetGroupAndPanelActive(b)),this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),c.popoutGroup}if(!this.gridview.element.contains(e.element)){if(!(t!=null&&t.skipDispose)){const c=this._groups.get(e.id);c==null||c.disposable.dispose(),this.disposeGroupRecord(e)}return this.activateFallbackGroupIfRemoved(e,t==null?void 0:t.skipActive),e}const d=super.doRemoveGroup(e,t);return t!=null&&t.skipActive||this.activePanel!==u&&this.fireActivePanelChange(this.activePanel),d}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{var e,t;this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions();for(const n of(t=(e=this._popoutWindowService)===null||e===void 0?void 0:e.entries)!==null&&t!==void 0?t:[])n.overlayRenderContainer.updateAllPositions()})}movingLock(e){const t=this._moving;try{return this._moving=!0,e()}finally{this._moving=t}}mutation(e,t){const n=this._mutationDepth===0,o=this._origin;n&&this._onWillMutateLayout.fire({kind:e,origin:o}),this._mutationDepth++;try{return t()}finally{this._mutationDepth--,n&&this._onDidMutateLayout.fire({kind:e,origin:o})}}currentOrigin(){return this._origin}withOrigin(e,t){if(this._originDepth>0||this._mutationDepth>0)return t();const n=this._origin;this._origin=e,this._originDepth++;try{return t()}finally{this._originDepth--,this._origin=n}}fireActivePanelChange(e){this._onDidActivePanelChange.fire({panel:e,origin:this._origin})}moveGroupOrPanel(e){this.mutation("move",()=>this._doMoveGroupOrPanel(e))}_doMoveGroupOrPanel(e){var t,n;const o=e.to.group,h=e.from.groupId,w=e.from.panelId,a=e.to.position,l=e.to.index,u=h?(t=this._groups.get(h))===null||t===void 0?void 0:t.value:void 0;if(!u)throw new Error(`dockview: Failed to find group id ${h}`);if(w===void 0){e.from.tabGroupId?this.moveTabGroupToGroup({sourceGroup:u,tabGroupId:e.from.tabGroupId,destinationGroup:o,destinationTarget:a,destinationIndex:l,skipSetActive:e.skipSetActive,keepEmptyGroups:e.keepEmptyGroups}):this.moveGroup({from:{group:u},to:{group:o,position:a},skipSetActive:e.skipSetActive});return}if(!a||a==="center"){const d=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!d)throw new Error(`dockview: No panel with id ${w}`);!e.keepEmptyGroups&&u.model.size===0&&this.doRemoveGroup(u,{skipActive:!0});const c=o.model.size===0;this.movingLock(()=>{var b;return o.model.openPanel(d,{index:l,skipSetActive:((b=e.skipSetActive)!==null&&b!==void 0?b:!1)&&!c,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(o),this._onDidMovePanel.fire({panel:d,from:u})}else{const d=this.getGridviewForGroup(o),c=Je(o.element),b=si(d.orientation,c,a);if(u.size<2){const[C,S]=ji(b);if(u.api.location.type==="grid"&&d===this.gridview){const m=Je(u.element),[v,D]=ji(m);if(rp(v,C)){this.gridview.moveView(v,D,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u});return}}if(u.api.location.type==="popout"&&this.nestedWindowMembers(u).length<=1){const m=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(u);if(!m)return;const v=this.movingLock(()=>m.popoutGroup.model.removePanel(m.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(u,{skipActive:!0});const D=si(d.orientation,Je(o.element),a),P=this.createGroupAtLocation(D,void 0,void 0,d);this.movingLock(()=>P.model.openPanel(v,{skipSetActive:!0})),this.doSetGroupAndPanelActive(P),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u});return}if(u.api.location.type==="edge"){const m=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${w}`);const v=this.createGroupAtLocation(b,void 0,void 0,d);this.movingLock(()=>v.model.openPanel(m,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(v),this._onDidMovePanel.fire({panel:m,from:u});return}const y=this.movingLock(()=>this.doRemoveGroup(u,{skipActive:!0,skipDispose:!0})),g=Je(o.element),_=si(d.orientation,g,a);this.movingLock(()=>this.doAddGroup(y,_,void 0,d)),this.setGroupLocationForRoot(y,d),this.doSetGroupAndPanelActive(y),this._onDidMovePanel.fire({panel:this.getGroupPanel(w),from:u})}else{const C=this.movingLock(()=>u.model.removePanel(w,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!C)throw new Error(`dockview: No panel with id ${w}`);const S=si(d.orientation,c,a),y=this.createGroupAtLocation(S,void 0,void 0,d);this.movingLock(()=>y.model.openPanel(C,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(y),this._onDidMovePanel.fire({panel:C,from:u})}}}moveTabGroupToGroup(e){const{sourceGroup:t,tabGroupId:n,destinationGroup:o,destinationTarget:h,destinationIndex:w}=e,a=t.model.getTabGroups().find(_=>_.id===n);if(!a||a.panelIds.length===0)return;const l=a.label,u=a.color,d=a.collapsed,c=a.componentParams,b=[...a.panelIds],C=h&&h!=="center"?Je(o.element):void 0,S=this.movingLock(()=>b.map(_=>t.model.removePanel(_,{skipSetActive:!1,skipSetActiveGroup:!0})).filter(_=>_!==void 0));if(S.length===0)return;const y=_=>{this.movingLock(()=>{for(const v of S)_.model.openPanel(v,{index:w,skipSetActive:!0,skipSetGroupActive:!0})});const m=_.model.createTabGroup({label:l,color:u,collapsed:d,componentParams:c});for(const v of S)_.model.addPanelToTabGroup(m.id,v.id);e.skipSetActive||this.doSetGroupAndPanelActive(_);for(const v of S)this._onDidMovePanel.fire({panel:v,from:t})};let g;if(!h||h==="center"||!C)g=o;else{const _=si(this.gridview.orientation,C,h);g=this.createGroupAtLocation(_)}!e.keepEmptyGroups&&t.model.size===0&&t!==g&&this.doRemoveGroup(t,{skipActive:!0}),y(g)}moveGroup(e){this.mutation("move",()=>this._doMoveGroup(e))}maximizeGroup(e){this.mutation("maximize",()=>super.maximizeGroup(e))}exitMaximizedGroup(){this.mutation("maximize",()=>super.exitMaximizedGroup())}_doMoveGroup(e){var t,n,o;const h=e.from.group,w=e.to.group,a=e.to.position;let l=h;if(a==="center"){const u=h.activePanel,d=h.model.getTabGroups().map(b=>({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams,panelIds:[...b.panelIds]})),c=this.movingLock(()=>[...h.panels].map(b=>h.model.removePanel(b.id,{skipSetActive:!0})));(h==null?void 0:h.model.size)===0&&this.doRemoveGroup(h,{skipActive:!0}),this.movingLock(()=>{for(const b of c)w.model.openPanel(b,{skipSetActive:b!==u,skipSetGroupActive:!0})});for(const b of d){const C=w.model.createTabGroup({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams});for(const S of b.panelIds)w.model.addPanelToTabGroup(C.id,S)}e.skipSetActive!==!0?this.doSetGroupAndPanelActive(w):this.activePanel||this.doSetGroupAndPanelActive(w)}else{if(h.api.location.type==="edge"){const u=h.activePanel,d=h.model.getTabGroups().map(b=>({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams,panelIds:[...b.panelIds]})),c=this.movingLock(()=>[...h.panels].map(b=>h.model.removePanel(b.id,{skipSetActive:!0})));l=this.createGroup(),this._onDidAddGroup.fire(l),this.movingLock(()=>{for(const b of c)l.model.openPanel(b,{skipSetActive:b!==u,skipSetGroupActive:!0})});for(const b of d){const C=l.model.createTabGroup({label:b.label,color:b.color,collapsed:b.collapsed,componentParams:b.componentParams});for(const S of b.panelIds)l.model.addPanelToTabGroup(C.id,S)}}else switch(h.api.location.type){case"grid":this.gridview.removeView(Je(h.element));break;case"floating":{const u=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(h);if(!u)throw new Error("dockview: failed to find floating group");this.detachFromNestedWindow(h)||u.dispose();break}case"popout":{const u=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(h);if(!u)throw new Error("dockview: failed to find popout group");if(this.detachFromNestedWindow(h))break;if((o=this._popoutWindowService)===null||o===void 0||o.remove(u),u.referenceGroup){const d=this.getPanel(u.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}u.window.dispose();break}}if(w.api.location.type==="grid"||w.api.location.type==="floating"||w.api.location.type==="popout"){const u=this.getGridviewForGroup(w),d=Je(w.element),c=si(u.orientation,d,a);let b;switch(u.orientation){case Pe.VERTICAL:b=d.length%2==0?h.api.width:h.api.height;break;case Pe.HORIZONTAL:b=d.length%2==0?h.api.height:h.api.width;break}u.addView(l,b,c),this.setGroupLocationForRoot(l,u)}}if(l.panels.forEach(u=>{this._onDidMovePanel.fire({panel:u,from:h})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const u=w??h;this.doSetGroupAndPanelActive(u)}else l!==h&&e.skipSetActive!==!0&&this.doSetGroupAndPanelActive(l)}doSetGroupActive(e){var t;super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==((t=this._onDidActivePanelChange.value)===null||t===void 0?void 0:t.panel)&&this.fireActivePanelChange(n)}doSetGroupAndPanelActive(e){var t;super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==((t=this._onDidActivePanelChange.value)===null||t===void 0?void 0:t.panel)&&this.fireActivePanelChange(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let t=e==null?void 0:e.id;if(t&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),t=void 0),!t)for(t=this.nextGroupId.next();this._groups.has(t);)t=this.nextGroupId.next();const n=new So(this,t,e);if(n.init({params:{},accessor:this}),!this._groups.has(n.id)){const o=new Se(n.model.onTabDragStart(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDragPanel(h)}),n.model.onGroupDragStart(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDragGroup(h)}),n.model.onMove(h=>{const{groupId:w,itemId:a,target:l,index:u,tabGroupId:d}=h;this.moveGroupOrPanel({from:{groupId:w,panelId:a,tabGroupId:d},to:{group:n,position:l,index:u}})}),n.model.onDidDrop(h=>{this._onDidDrop.fire(h)}),n.model.onWillDrop(h=>{var w;(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillDrop(h)}),n.model.onWillShowOverlay(h=>{var w;if(this.options.disableDnd){h.preventDefault();return}(w=this._advancedDnDService)===null||w===void 0||w.dispatchWillShowOverlay(h)}),n.model.onUnhandledDragOver(h=>{this._onUnhandledDragOver.fire(h)}),n.model.onDidAddPanel(h=>{this._moving||this._onDidAddPanel.fire(h.panel)}),n.model.onDidRemovePanel(h=>{this._moving||this._onDidRemovePanel.fire(h.panel)}),n.model.onDidActivePanelChange(h=>{var w;this._moving||h.panel===this.activePanel&&((w=this._onDidActivePanelChange.value)===null||w===void 0?void 0:w.panel)!==h.panel&&this.fireActivePanelChange(h.panel)}),ri.any(n.model.onDidPanelTitleChange,n.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(n.id,{value:n,disposable:o})}return n.initialize(),n}createPanel(e,t){var n,o,h;const w=e.component,a=(n=e.tabComponent)!==null&&n!==void 0?n:this.options.defaultTabComponent,l=new Ip(this,e.id,w,a),u=new pn(e.id,w,a,this,this._api,t,l,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return u.init({title:(o=e.title)!==null&&o!==void 0?o:e.id,params:(h=e==null?void 0:e.params)!==null&&h!==void 0?h:{}}),u}createGroupAtLocation(e,t,n,o=this.gridview){const h=this.createGroup(n);return this.doAddGroup(h,e,t,o),this.setGroupLocationForRoot(h,o),h}setGroupLocationForRoot(e,t){var n;const o=(n=this._popoutWindowService)===null||n===void 0?void 0:n.entries.find(h=>h.gridview===t);if(o){e.model.renderContainer!==o.overlayRenderContainer&&(e.model.renderContainer=o.overlayRenderContainer),e.model.dropTargetContainer=o.dropTargetContainer,e.model.location={type:"popout",getWindow:o.getWindow,popoutUrl:o.popoutUrl};return}e.model.renderContainer!==this.overlayRenderContainer&&(e.model.renderContainer=this.overlayRenderContainer),e.model.dropTargetContainer=this.rootDropTargetContainer,e.model.location=t===this.gridview?{type:"grid"}:{type:"floating"}}getGridviewForGroup(e){var t,n;const o=(t=this._floatingGroupService)===null||t===void 0?void 0:t.findByGroup(e);if(o)return o.gridview;const h=(n=this._popoutWindowService)===null||n===void 0?void 0:n.findByGroup(e);return h?h.gridview:this.gridview}nestedWindowMembers(e){const t=this.getGridviewForGroup(e);return t===this.gridview?[]:this.groups.filter(n=>t.element.contains(n.element))}findGroup(e){var t;return(t=Array.from(this._groups.values()).find(n=>n.value.model.containsPanel(e)))===null||t===void 0?void 0:t.value}orientationAtLocation(e){const t=this.gridview.orientation;return e.length%2==1?t:Ti(t)}updateTheme(){var e,t,n,o,h,w,a,l,u,d;const c=(e=this._options.theme)!==null&&e!==void 0?e:Dv;(t=this._shellThemeClassnames)===null||t===void 0||t.setClassNames(c.className);const b=(n=c.gap)!==null&&n!==void 0?n:0;this.gridview.margin=b;for(const S of this.floatingGroups)S.gridview.margin=b;for(const S of(h=(o=this._popoutWindowService)===null||o===void 0?void 0:o.entries)!==null&&h!==void 0?h:[])S.gridview.margin=b;switch((w=this._shellManager)===null||w===void 0||w.updateTheme(b,(a=c.edgeGroupCollapsedSize)!==null&&a!==void 0?a:35),c.dndOverlayBorder!==void 0?(this.element.style.setProperty("--dv-drag-over-border",c.dndOverlayBorder),(l=this._shellManager)===null||l===void 0||l.element.style.setProperty("--dv-drag-over-border",c.dndOverlayBorder)):(this.element.style.removeProperty("--dv-drag-over-border"),(u=this._shellManager)===null||u===void 0||u.element.style.removeProperty("--dv-drag-over-border")),c.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}const C=((d=c.tabGroupIndicator)!==null&&d!==void 0?d:"wrap")==="none";we(this.element,"dv-tab-group-indicator-none",C),this._shellManager&&we(this._shellManager.element,"dv-tab-group-indicator-none",C);for(const S of this.groups)S.model.updateTabGroups()}}class g_ extends hp{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,t){var n;super(e,{proportionalLayout:(n=t.proportionalLayout)!==null&&n!==void 0?n:!0,orientation:t.orientation,styles:t.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:t.disableAutoResizing,className:t.className}),this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new Q,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new Q,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new Q,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=t,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(o=>{this._onDidAddGroup.fire(o)}),this.onDidRemove(o=>{this._onDidRemoveGroup.fire(o)}),this.onDidActiveChange(o=>{this._onDidActiveGroupChange.fire(o)}))}updateOptions(e){super.updateOptions(e);const t=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),t&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,t){this.gridview.setViewVisible(Je(e.element),t)}setActive(e){this._groups.forEach((t,n)=>{t.value.setActive(e===t.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:t,activePanel:n}=e;try{const o=[],h=this.width,w=this.height;if(this.gridview.deserialize(t,{fromJSON:a=>{const{data:l}=a,u=this.options.createComponent({id:l.id,name:l.component});return o.push(()=>u.init({params:l.params,minimumWidth:l.minimumWidth,maximumWidth:l.maximumWidth,minimumHeight:l.minimumHeight,maximumHeight:l.maximumHeight,priority:l.priority,snap:!!l.snap,accessor:this,isVisible:a.visible})),this._onDidAddGroup.fire(u),this.registerPanel(u),u}}),this.layout(h,w,!0),o.forEach(a=>a()),typeof n=="string"){const a=this.getPanel(n);a&&this.doSetGroupActive(a)}}catch(o){for(const h of this.groups)h.dispose(),this._groups.delete(h.id),this._onDidRemoveGroup.fire(h);throw this.clear(),o}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,t=Array.from(this._groups.values());for(const n of t)n.disposable.dispose(),this.doRemoveGroup(n.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,t){var n;let o;const h=this.gridview.remove(e),w=(n=this._groups.get(t.reference))===null||n===void 0?void 0:n.value;if(!w)throw new Error(`reference group ${t.reference} does not exist`);const a=Lo(t.direction);if(a==="center")throw new Error(`${a} not supported as an option`);{const l=Je(w.element);o=si(this.gridview.orientation,l,a)}this.doAddGroup(h,o,t.size)}addPanel(e){var t,n,o,h;let w=(t=e.location)!==null&&t!==void 0?t:[0];if(!((n=e.position)===null||n===void 0)&&n.referencePanel){const l=(o=this._groups.get(e.position.referencePanel))===null||o===void 0?void 0:o.value;if(!l)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const u=Lo(e.position.direction);if(u==="center")throw new Error(`${u} not supported as an option`);{const d=Je(l.element);w=si(this.gridview.orientation,d,u)}}const a=this.options.createComponent({id:e.id,name:e.component});return a.init({params:(h=e.params)!==null&&h!==void 0?h:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(a,w,e.size),this.registerPanel(a),this.doSetGroupActive(a),a}registerPanel(e){const t=new Se(e.api.onDidFocusChange(n=>{n.isFocused&&this._groups.forEach(o=>{const h=o.value;h!==e?h.setActive(!1):h.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:t})}moveGroup(e,t,n){const o=this.getPanel(t);if(!o)throw new Error("invalid operation");const h=Je(e.element),w=si(this.gridview.orientation,h,n),[a,l]=ji(w),u=Je(o.element),[d,c]=ji(u);if(rp(d,a)){this.gridview.moveView(d,c,l);return}const b=this.doRemoveGroup(o,{skipActive:!0,skipDispose:!0}),C=Je(e.element),S=si(this.gridview.orientation,C,n);this.doAddGroup(b,S)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class v_ extends nh{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Se(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(t=>this._onDidAddView.fire(t)),this._splitview.onDidRemoveView(t=>this._onDidRemoveView.fire(t)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===Pe.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===Pe.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._splitviewChangeDisposable=new ft,this._panels=new Map,this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new Q,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this._options=t,this.splitview=new zs(this.element,t),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var t,n;"className"in e&&this._classNames.setClassNames((t=e.className)!==null&&t!==void 0?t:""),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,t){this.splitview.moveView(e,t)}setVisible(e,t){const n=this.panels.indexOf(e);this.splitview.setViewVisible(n,t)}setActive(e,t){this._activePanel=e,this.panels.filter(n=>n!==e).forEach(n=>{n.api._onDidActiveChange.fire({isActive:!1}),t||n.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),t||e.focus()}removePanel(e,t){const n=this._panels.get(e.id);if(!n)throw new Error(`unknown splitview panel ${e.id}`);n.dispose(),this._panels.delete(e.id);const o=this.panels.findIndex(a=>a===e);this.splitview.removeView(o,t).dispose();const w=this.panels;w.length>0&&this.setActive(w[w.length-1])}getPanel(e){return this.panels.find(t=>t.id===e)}addPanel(e){var t;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const n=this.options.createComponent({id:e.id,name:e.component});n.orientation=this.splitview.orientation,n.init({params:(t=e.params)!==null&&t!==void 0?t:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const o=typeof e.size=="number"?e.size:Wt.Distribute,h=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(n,o,h),this.doAddView(n),this.setActive(n),n}layout(e,t){const[n,o]=this.splitview.orientation===Pe.HORIZONTAL?[e,t]:[t,e];this.splitview.layout(n,o)}doAddView(e){const t=e.api.onDidFocusChange(n=>{n.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,t)}toJSON(){var e;return{views:this.splitview.getViews().map((n,o)=>({size:this.splitview.getViewSize(o),data:n.toJSON(),snap:!!n.snap,priority:n.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:t,orientation:n,size:o,activeView:h}=e,w=[],a=this.width,l=this.height;if(this.splitview=new zs(this.element,{orientation:n,proportionalLayout:this.options.proportionalLayout,descriptor:{size:o,views:t.map(u=>{const d=u.data;if(this._panels.has(d.id))throw new Error(`panel ${d.id} already exists`);const c=this.options.createComponent({id:d.id,name:d.component});return w.push(()=>{var b;c.init({params:(b=d.params)!==null&&b!==void 0?b:{},minimumSize:d.minimumSize,maximumSize:d.maximumSize,snap:u.snap,priority:u.priority,accessor:this})}),c.orientation=n,this.doAddView(c),setTimeout(()=>{this._onDidAddView.fire(c)},0),{size:u.size,view:c}})}}),this.layout(a,l),w.forEach(u=>u()),typeof h=="string"){const u=this.getPanel(h);u&&this.setActive(u)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,Wt.Distribute,!0).dispose()}dispose(){for(const t of this._panels.values())t.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const t of e)t.dispose();this.element.remove(),super.dispose()}}class vu extends Se{get element(){return this._element}constructor(){super(),this._expandedIcon=dv(),this._collapsedIcon=kp(),this.disposable=new ft,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const t=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);we(this._expander,"collapsed",!t),t?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const __=sh(),_u=22,wu=0,bu=Number.MAX_SAFE_INTEGER;class yu extends Kg{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class w_ extends nh{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Se(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(t=>this._onDidAddView.fire(t)),this._paneview.onDidRemoveView(t=>this._onDidRemoveView.fire(t)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===Pe.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===Pe.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,t){var n;super(document.createElement("div"),t.disableAutoResizing),this._id=__.next(),this._disposable=new ft,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new Q,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new Q,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new Q,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new Q,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new Q,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOver=new Q,this.onUnhandledDragOver=this._onUnhandledDragOver.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOver),this._classNames=new Oo(this.element),this._classNames.setClassNames((n=t.className)!==null&&n!==void 0?n:""),e.appendChild(this.element),this._options=t,this.paneview=new ru(this.element,{orientation:Pe.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,t){const n=this.panels.indexOf(e);this.paneview.setViewVisible(n,t)}focus(){}updateOptions(e){var t,n;"className"in e&&this._classNames.setClassNames((t=e.className)!==null&&t!==void 0?t:""),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var t,n;const o=this.options.createComponent({id:e.id,name:e.component});let h;e.headerComponent&&this.options.createHeaderComponent&&(h=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),h||(h=new vu);const w=new yu({id:e.id,component:e.component,headerComponent:e.headerComponent,header:h,body:o,orientation:Pe.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(t=e.headerSize)!==null&&t!==void 0?t:_u,minimumBodySize:wu,maximumBodySize:bu});this.doAddPanel(w);const a=typeof e.size=="number"?e.size:Wt.Distribute,l=typeof e.index=="number"?e.index:void 0;return w.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new lr(this),accessor:this}),this.paneview.addPane(w,a,l),w.orientation=this.paneview.orientation,w}removePanel(e){const n=this.panels.findIndex(o=>o===e);this.paneview.removePane(n),this.doRemovePanel(e)}movePanel(e,t){this.paneview.moveView(e,t)}getPanel(e){return this.panels.find(t=>t.id===e)}layout(e,t){const[n,o]=this.paneview.orientation===Pe.HORIZONTAL?[e,t]:[t,e];this.paneview.layout(n,o)}toJSON(){const e=o=>o===Number.MAX_SAFE_INTEGER||o===Number.POSITIVE_INFINITY?void 0:o,t=o=>o<=0?void 0:o;return{views:this.paneview.getPanes().map((o,h)=>({size:this.paneview.getViewSize(h),data:o.toJSON(),minimumSize:t(o.minimumBodySize),maximumSize:e(o.maximumBodySize),headerSize:o.headerSize,expanded:o.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:t,size:n}=e,o=[],h=this.width,w=this.height;this.paneview=new ru(this.element,{orientation:Pe.VERTICAL,descriptor:{size:n,views:t.map(a=>{var l,u,d;const c=a.data,b=this.options.createComponent({id:c.id,name:c.component});let C;c.headerComponent&&this.options.createHeaderComponent&&(C=this.options.createHeaderComponent({id:c.id,name:c.headerComponent})),C||(C=new vu);const S=new yu({id:c.id,component:c.component,headerComponent:c.headerComponent,header:C,body:b,orientation:Pe.VERTICAL,isExpanded:!!a.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(l=a.headerSize)!==null&&l!==void 0?l:_u,minimumBodySize:(u=a.minimumSize)!==null&&u!==void 0?u:wu,maximumBodySize:(d=a.maximumSize)!==null&&d!==void 0?d:bu});return this.doAddPanel(S),o.push(()=>{var y;S.init({params:(y=c.params)!==null&&y!==void 0?y:{},minimumBodySize:a.minimumSize,maximumBodySize:a.maximumSize,title:c.title,isExpanded:!!a.expanded,containerApi:new lr(this),accessor:this}),S.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(S)},0),{size:a.size,view:S}})}}),this.layout(h,w),o.forEach(a=>a()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const t=new Se(e.onDidDrop(n=>{this._onDidDrop.fire(n)}),e.onUnhandledDragOver(n=>{this._onUnhandledDragOver.fire(n)}));this._viewDisposables.set(e.id,t)}doRemovePanel(e){const t=this._viewDisposables.get(e.id);t&&(t.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,t]of this._viewDisposables.entries())t.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class b_ extends oh{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,t){super(e,t,new yp(e,t)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new Q,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(n=>{const{isVisible:o}=n,{accessor:h}=this._params;h.setVisible(this,o)}),this.api.onActiveChange(()=>{const{accessor:n}=this._params;n.setActive(this)}),this.api.onDidConstraintsChangeInternal(n=>{(typeof n.minimumSize=="number"||typeof n.minimumSize=="function")&&(this._minimumSize=n.minimumSize),(typeof n.maximumSize=="number"||typeof n.maximumSize=="function")&&(this._maximumSize=n.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,t){const[n,o]=this.orientation===Pe.HORIZONTAL?[e,t]:[t,e];super.layout(n,o)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=n=>n===Number.MAX_SAFE_INTEGER||n===Number.POSITIVE_INFINITY?void 0:n,t=n=>n<=0?void 0:n;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:t(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function y_(p,e){return new m_(p,e).api}function S_(p,e){const t=new v_(p,e);return new cp(t)}function C_(p,e){const t=new g_(p,e);return new dp(t)}function x_(p,e){const t=new w_(p,e);return new lr(t)}/**
46
46
  * dockview
47
47
  * @version 7.0.2
48
48
  * @link https://github.com/mathuo/dockview
@@ -52,20 +52,20 @@ Error generating stack: `+k.message+`
52
52
  * @version 7.0.2
53
53
  * @link https://github.com/mathuo/dockview
54
54
  * @license MIT
55
- */class x_{constructor(e){this._host=e}attachToGroup(e){return new Se(e.model.onDidCreateTabGroup(t=>{this._host.fireDidCreateTabGroup(t)}),e.model.onDidDestroyTabGroup(t=>{this._host.fireDidDestroyTabGroup(t)}),e.model.onDidAddPanelToTabGroup(t=>{this._host.fireDidAddPanelToTabGroup(t)}),e.model.onDidRemovePanelFromTabGroup(t=>{this._host.fireDidRemovePanelFromTabGroup(t)}),e.model.onDidTabGroupChange(t=>{this._host.fireDidTabGroupChange(t)}),e.model.onDidTabGroupCollapsedChange(t=>{this._host.fireDidTabGroupCollapsedChange(t)}))}dispose(){}}const D_=oi({name:"TabGroupChips",serviceKey:"tabGroupChipsService",create:p=>new x_(p),init:(p,e)=>{const t=new Map;return new Se(p.onDidAddGroup(n=>{t.set(n,e.attachToGroup(n))}),p.onDidRemoveGroup(n=>{var o;(o=t.get(n))===null||o===void 0||o.dispose(),t.delete(n)}),{dispose:()=>{for(const n of t.values())n.dispose();t.clear()}})}});function Su(p){if(!(p instanceof HTMLElement))return;const e=np(p);return e!=null&&e.style.zIndex?`calc(${e.style.zIndex} * 2)`:void 0}let E_=0;const k_=()=>`dv-ctx-menu-item-${E_++}`;function ir(p){return typeof p=="object"}function sr(p,e,t,n){const o=document.createElement("div");return o.className="dv-context-menu-item",o.setAttribute("role","menuitem"),n&&(o.classList.add("dv-context-menu-item--disabled"),o.setAttribute("aria-disabled","true")),o.textContent=p,n||o.addEventListener("click",()=>{t(),e()}),o}function Cu(){const p=document.createElement("div");return p.className="dv-context-menu-separator",p.setAttribute("role","separator"),p}function P_(){if(typeof window>"u"||!window.matchMedia)return!1;const p=window.matchMedia("(pointer: coarse)").matches,e=window.matchMedia("(pointer: fine)").matches;return p&&!e}function T_(p){const e=document.createElement("div");e.className="dv-context-menu-rename";const t=document.createElement("input");return t.className="dv-context-menu-rename-input",t.type="text",t.placeholder="Name This Group",t.value=p.label,t.addEventListener("input",()=>{p.setLabel(t.value)}),t.addEventListener("keydown",n=>{n.key!=="Escape"&&n.key!=="Enter"&&n.stopPropagation()}),t.addEventListener("click",n=>{n.stopPropagation()}),e.appendChild(t),P_()||requestAnimationFrame(()=>{t.focus(),t.select()}),e}function A_(p,e){const t=document.createElement("div");if(t.className="dv-context-menu-color-picker",!e.enabled)return t;for(const n of e.entries()){const o=document.createElement("div");o.className="dv-context-menu-color-swatch",o.style.setProperty("--dv-tab-group-color",n.value),n.label&&(o.title=n.label),p.color===n.id&&o.classList.add("dv-context-menu-color-swatch--selected"),o.addEventListener("click",()=>{p.setColor(n.id)}),t.appendChild(o)}return t}class I_{constructor(e){this.accessor=e}show(e,t,n){var o,h;if(!this.accessor.options.getTabContextMenuItems)return;const w=this.accessor.options.getTabContextMenuItems({panel:e,group:t,api:this.accessor.api,event:n});if(w.length===0)return;n.preventDefault();const a=this.accessor.getPopupServiceForGroup(t),l=()=>a.close(),u=document.createElement("div");u.className="dv-context-menu",u.setAttribute("role","menu");for(const d of w)if(d==="separator")u.appendChild(Cu());else if(d==="close")u.appendChild(sr("Close",l,()=>e.api.close()));else if(d==="closeOthers")u.appendChild(sr("Close Others",l,()=>{t.panels.filter(c=>c!==e).forEach(c=>c.api.close())}));else if(d==="closeAll")u.appendChild(sr("Close All",l,()=>{[...t.panels].forEach(c=>c.api.close())}));else if(ir(d)&&d.element)u.appendChild(d.element);else if(ir(d)&&d.component){const c=(h=(o=this.accessor.options).createContextMenuItemComponent)===null||h===void 0?void 0:h.call(o,{id:k_(),component:d.component});c&&(c.init({panel:e,group:t,api:this.accessor.api,close:l,componentProps:d.componentProps}),u.appendChild(c.element))}else ir(d)&&d.label&&u.appendChild(sr(d.label,l,()=>{var c;return(c=d.action)===null||c===void 0?void 0:c.call(d)},d.disabled));a.openPopover(u,{x:n.clientX,y:n.clientY,zIndex:Su(n.target)})}showForChip(e,t,n){if(!this.accessor.options.getTabGroupChipContextMenuItems)return;const o=this.accessor.options.getTabGroupChipContextMenuItems({tabGroup:e,group:t,api:this.accessor.api,event:n});if(o.length===0)return;n.preventDefault();const h=this.accessor.getPopupServiceForGroup(t),w=()=>h.close(),a=document.createElement("div");a.className="dv-context-menu",a.setAttribute("role","menu");for(const l of o)l==="separator"?a.appendChild(Cu()):l==="rename"?a.appendChild(T_(e)):l==="colorPicker"?a.appendChild(A_(e,this.accessor.tabGroupColorPalette)):ir(l)&&l.element?a.appendChild(l.element):ir(l)&&l.label&&a.appendChild(sr(l.label,w,()=>{var u;return(u=l.action)===null||u===void 0?void 0:u.call(l)},l.disabled));h.openPopover(a,{x:n.clientX,y:n.clientY,zIndex:Su(n.target)})}}const L_=oi({name:"ContextMenu",serviceKey:"contextMenuService",create:p=>new I_(p)}),R_=30,M_=-10;class O_{constructor(e){this.host=e}dispatchWillDragPanel(e){this.host.fireWillDragPanel(e)}dispatchWillDragGroup(e){this.host.fireWillDragGroup(e)}dispatchWillDrop(e){this.host.fireWillDrop(e)}dispatchWillShowOverlay(e){this.host.fireWillShowOverlay(e)}buildGroupDragGhost(e){const t=this.host.options.createGroupDragGhostComponent;if(!t)return;const n=t(e);return n.init({group:e,api:this.host.api}),{element:n.element,offsetX:R_,offsetY:M_,dispose:n.dispose?()=>{var o;return(o=n.dispose)===null||o===void 0?void 0:o.call(n)}:void 0}}resolveOverlayModel(e,t){var n,o;return(o=(n=this.host.options).dropOverlayModel)===null||o===void 0?void 0:o.call(n,{location:e,group:t})}showPreviewOverlay(e,t){const n=e.model.contentDropTarget;return n.showOverlay(t),Ve.from(()=>n.clearOverlay())}dispose(){}}const Op=oi({name:"AdvancedDnD",serviceKey:"advancedDnDService",create:p=>new O_(p)}),Kl="data-dv-kbd-moving";function Ai(p,e){const t=e.toLowerCase().split("+"),n=t[t.length-1],o=t.slice(0,-1);return p.ctrlKey===o.includes("ctrl")&&p.shiftKey===o.includes("shift")&&p.altKey===o.includes("alt")&&p.metaKey===(o.includes("meta")||o.includes("cmd"))&&p.key.toLowerCase()===n}function Yl(p){const e=p.keyboardNavigation;if(e)return e===!0?{}:e}const G_={nextTab:"ctrl+]",prevTab:"ctrl+[",focusNextGroup:"f6",focusPrevGroup:"shift+f6",focusTabs:"ctrl+shift+\\"};class N_ extends Se{constructor(e){super(),this.host=e,this._focusWasInside=!1;const t=e.rootElement.ownerDocument,n=w=>this._onKeyDown(w);t.addEventListener("keydown",n,!0);const o=w=>{const a=w.target;a instanceof HTMLElement&&this.host.rootElement.contains(a)&&!a.closest('[role="dialog"]')&&(this._lastNonFloatFocus=a)};t.addEventListener("focusin",o,!0);const h=w=>this._onFloatingEscape(w);t.addEventListener("keydown",h,!1),this.addDisposables({dispose:()=>t.removeEventListener("keydown",n,!0)},{dispose:()=>t.removeEventListener("focusin",o,!0)},{dispose:()=>t.removeEventListener("keydown",h,!1)},e.onWillMutateLayout(w=>{w.kind==="remove"&&this._nav&&(this._focusWasInside=this._isFocusInside())}),e.onDidMutateLayout(w=>{w.kind==="remove"&&this._nav&&this._focusWasInside&&!this._isFocusInside()&&this._restoreFocus()}))}get _moveActive(){return this.host.rootElement.hasAttribute(Kl)}_isFocusInside(){const e=this.host.rootElement.ownerDocument.activeElement;return e instanceof Node&&this.host.rootElement.contains(e)}_onFloatingEscape(e){if(!this._nav||this._moveActive||e.defaultPrevented||e.key!=="Escape")return;const t=e.target;if(!(t instanceof Element))return;const n=t.closest('[role="dialog"]');!n||!this.host.rootElement.contains(n)||(e.preventDefault(),e.stopPropagation(),this._returnFocusFromFloat())}_trapFloatTab(e){const t=e.target;if(!(t instanceof Element))return!1;const n=t.closest('[role="dialog"]');if(!n||!this.host.rootElement.contains(n))return!1;e.preventDefault();const o=this._tabbables(n);if(o.length===0)return!0;const h=n.ownerDocument.activeElement,w=h instanceof HTMLElement?o.indexOf(h):-1,a=o.length,l=w===-1?e.shiftKey?a-1:0:(w+(e.shiftKey?-1:1)+a)%a;return o[l].focus(),!0}_tabbables(e){const t=e.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]");return Array.from(t).filter(n=>n.tabIndex>=0)}_returnFocusFromFloat(){var e;const t=this._lastNonFloatFocus;if(t&&t.isConnected&&this.host.rootElement.contains(t)&&!t.closest('[role="dialog"]')){t.focus();return}(e=this.host.groups.find(n=>n.api.location.type==="grid"))===null||e===void 0||e.model.focusContent()}get _nav(){return Yl(this.host.options)}get _keymap(){var e;return Object.assign(Object.assign({},G_),(e=this._nav)===null||e===void 0?void 0:e.keymap)}_onKeyDown(e){if(!this._nav||this._moveActive||!(e.target instanceof Node)||!this.host.rootElement.contains(e.target)||e.key==="Tab"&&this._trapFloatTab(e))return;const t=this._keymap;Ai(e,t.nextTab)?(this._consume(e),this._switchTab(!1)):Ai(e,t.prevTab)?(this._consume(e),this._switchTab(!0)):Ai(e,t.focusNextGroup)?(this._consume(e),this._cycleGroup(!1)):Ai(e,t.focusPrevGroup)?(this._consume(e),this._cycleGroup(!0)):Ai(e,t.focusTabs)&&(this._consume(e),this._focusTabs())}_focusTabs(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusActiveTab()}_switchTab(e){const t=this.host.activeGroup;t&&(e?t.model.moveToPrevious():t.model.moveToNext(),t.model.focusContent())}_cycleGroup(e){const t=this.host.activeGroup,n=t?this.host.adjacentGroup(t,e):this.host.groups[0];this._focusGroup(n)}_focusGroup(e){e&&(e.api.setActive(),e.model.focusContent())}_restoreFocus(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusContent()}_consume(e){e.preventDefault(),e.stopPropagation()}}const z_=oi({name:"Accessibility",serviceKey:"accessibilityService",create:p=>new N_(p)}),B_={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"top",ArrowDown:"bottom"},nr={focusGroupLeft:"ctrl+shift+arrowleft",focusGroupRight:"ctrl+shift+arrowright",focusGroupUp:"ctrl+shift+arrowup",focusGroupDown:"ctrl+shift+arrowdown",dock:"ctrl+m"};class H_ extends Se{constructor(e){super(),this.host=e,this._move=null;const t=e.rootElement.ownerDocument,n=o=>this._onKeyDown(o);t.addEventListener("keydown",n,!0),this.addDisposables({dispose:()=>this._exit()},{dispose:()=>t.removeEventListener("keydown",n,!0)})}get _enabled(){return!!Yl(this.host.options)}get _keymap(){var e,t,n,o,h,w,a;const l=(t=(e=Yl(this.host.options))===null||e===void 0?void 0:e.keymap)!==null&&t!==void 0?t:{};return{focusGroupLeft:(n=l.focusGroupLeft)!==null&&n!==void 0?n:nr.focusGroupLeft,focusGroupRight:(o=l.focusGroupRight)!==null&&o!==void 0?o:nr.focusGroupRight,focusGroupUp:(h=l.focusGroupUp)!==null&&h!==void 0?h:nr.focusGroupUp,focusGroupDown:(w=l.focusGroupDown)!==null&&w!==void 0?w:nr.focusGroupDown,dock:(a=l.dock)!==null&&a!==void 0?a:nr.dock}}get _messages(){return Rp(this.host.options.messages)}_onKeyDown(e){if(!this._enabled)return;if(this._move){this._onMoveKey(e);return}if(!(e.target instanceof Node)||!this.host.rootElement.contains(e.target))return;const t=this._keymap;Ai(e,t.dock)?this._enterMoveMode(e):Ai(e,t.focusGroupLeft)?(this._consume(e),this._focusGroupInDirection("left")):Ai(e,t.focusGroupRight)?(this._consume(e),this._focusGroupInDirection("right")):Ai(e,t.focusGroupUp)?(this._consume(e),this._focusGroupInDirection("up")):Ai(e,t.focusGroupDown)&&(this._consume(e),this._focusGroupInDirection("down"))}_focusGroupInDirection(e){const t=this.host.activeGroup;t&&this._focusGroup(this.host.adjacentGroupInDirection(t,e))}_focusGroup(e){e&&(e.api.setActive(),e.model.focusContent())}_restoreFocus(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusContent()}_enterMoveMode(e){const t=this.host.activePanel,n=this.host.groups;if(!t||n.length===0)return;e.preventDefault(),e.stopPropagation();const o=Math.max(0,n.indexOf(t.group));this._move={source:t,groups:n,groupIndex:o,phase:"target",position:"center"},this.host.rootElement.setAttribute(Kl,""),this._render()}_onMoveKey(e){const t=this._move;if(e.key==="Escape"){this._consume(e),t.phase==="edge"?(t.phase="target",t.position="center",this._render()):(this._exit(),this.host.announce(this._messages.moveCancelled()),this._restoreFocus());return}if(e.key==="Enter"){this._consume(e),t.phase==="target"?(t.phase="edge",t.position="center",this._render()):this._commit();return}if(t.phase==="target"){const o=t.groups.length;e.key==="ArrowRight"||e.key==="ArrowDown"?(this._consume(e),t.groupIndex=(t.groupIndex+1)%o,this._render()):(e.key==="ArrowLeft"||e.key==="ArrowUp")&&(this._consume(e),t.groupIndex=(t.groupIndex-1+o)%o,this._render());return}const n=B_[e.key];n?(this._consume(e),t.position=n,this._render()):(e.key===" "||e.key==="c"||e.key==="C")&&(this._consume(e),t.position="center",this._render())}_render(){var e,t;const n=this._move,o=n.groups[n.groupIndex];this._clearPreview(),this._preview=this.host.showDropPreview(o,n.position);const h=(t=(e=o.activePanel)===null||e===void 0?void 0:e.title)!==null&&t!==void 0?t:o.id,w=this._messages;n.phase==="target"?this.host.announce(w.movePickTarget(this._label(n.source),h,n.groupIndex+1,n.groups.length)):this.host.announce(w.movePickEdge(n.position,h))}_commit(){var e,t;const n=this._move,o=n.groups[n.groupIndex],h=n.position,w=n.source,a=(t=(e=o.activePanel)===null||e===void 0?void 0:e.title)!==null&&t!==void 0?t:o.id,l=this._messages;this._exit();try{this.host.dockPanel(w,o,h),this.host.announce(l.moveCommitted(this._label(w),a,h))}catch{this.host.announce(l.moveNotAllowed())}this._restoreFocus()}_exit(){this._clearPreview(),this._move=null,this.host.rootElement.removeAttribute(Kl)}_clearPreview(){var e;(e=this._preview)===null||e===void 0||e.dispose(),this._preview=void 0}_consume(e){e.preventDefault(),e.stopPropagation()}_label(e){var t;return(t=e.title)!==null&&t!==void 0?t:e.id}}oi({name:"KeyboardDocking",serviceKey:"keyboardDockingService",create:p=>new H_(p),dependsOn:[Op,Mp]});const F_=[D_,L_,Op,z_];Iv(F_);Rv();var W_=$u();const V_=eh(W_);/**
55
+ */class D_{constructor(e){this._host=e}attachToGroup(e){return new Se(e.model.onDidCreateTabGroup(t=>{this._host.fireDidCreateTabGroup(t)}),e.model.onDidDestroyTabGroup(t=>{this._host.fireDidDestroyTabGroup(t)}),e.model.onDidAddPanelToTabGroup(t=>{this._host.fireDidAddPanelToTabGroup(t)}),e.model.onDidRemovePanelFromTabGroup(t=>{this._host.fireDidRemovePanelFromTabGroup(t)}),e.model.onDidTabGroupChange(t=>{this._host.fireDidTabGroupChange(t)}),e.model.onDidTabGroupCollapsedChange(t=>{this._host.fireDidTabGroupCollapsedChange(t)}))}dispose(){}}const E_=ai({name:"TabGroupChips",serviceKey:"tabGroupChipsService",create:p=>new D_(p),init:(p,e)=>{const t=new Map;return new Se(p.onDidAddGroup(n=>{t.set(n,e.attachToGroup(n))}),p.onDidRemoveGroup(n=>{var o;(o=t.get(n))===null||o===void 0||o.dispose(),t.delete(n)}),{dispose:()=>{for(const n of t.values())n.dispose();t.clear()}})}});function Su(p){if(!(p instanceof HTMLElement))return;const e=np(p);return e!=null&&e.style.zIndex?`calc(${e.style.zIndex} * 2)`:void 0}let k_=0;const P_=()=>`dv-ctx-menu-item-${k_++}`;function ir(p){return typeof p=="object"}function sr(p,e,t,n){const o=document.createElement("div");return o.className="dv-context-menu-item",o.setAttribute("role","menuitem"),n&&(o.classList.add("dv-context-menu-item--disabled"),o.setAttribute("aria-disabled","true")),o.textContent=p,n||o.addEventListener("click",()=>{t(),e()}),o}function Cu(){const p=document.createElement("div");return p.className="dv-context-menu-separator",p.setAttribute("role","separator"),p}function T_(){if(typeof window>"u"||!window.matchMedia)return!1;const p=window.matchMedia("(pointer: coarse)").matches,e=window.matchMedia("(pointer: fine)").matches;return p&&!e}function A_(p){const e=document.createElement("div");e.className="dv-context-menu-rename";const t=document.createElement("input");return t.className="dv-context-menu-rename-input",t.type="text",t.placeholder="Name This Group",t.value=p.label,t.addEventListener("input",()=>{p.setLabel(t.value)}),t.addEventListener("keydown",n=>{n.key!=="Escape"&&n.key!=="Enter"&&n.stopPropagation()}),t.addEventListener("click",n=>{n.stopPropagation()}),e.appendChild(t),T_()||requestAnimationFrame(()=>{t.focus(),t.select()}),e}function I_(p,e){const t=document.createElement("div");if(t.className="dv-context-menu-color-picker",!e.enabled)return t;for(const n of e.entries()){const o=document.createElement("div");o.className="dv-context-menu-color-swatch",o.style.setProperty("--dv-tab-group-color",n.value),n.label&&(o.title=n.label),p.color===n.id&&o.classList.add("dv-context-menu-color-swatch--selected"),o.addEventListener("click",()=>{p.setColor(n.id)}),t.appendChild(o)}return t}class L_{constructor(e){this.accessor=e}show(e,t,n){var o,h;if(!this.accessor.options.getTabContextMenuItems)return;const w=this.accessor.options.getTabContextMenuItems({panel:e,group:t,api:this.accessor.api,event:n});if(w.length===0)return;n.preventDefault();const a=this.accessor.getPopupServiceForGroup(t),l=()=>a.close(),u=document.createElement("div");u.className="dv-context-menu",u.setAttribute("role","menu");for(const d of w)if(d==="separator")u.appendChild(Cu());else if(d==="close")u.appendChild(sr("Close",l,()=>e.api.close()));else if(d==="closeOthers")u.appendChild(sr("Close Others",l,()=>{t.panels.filter(c=>c!==e).forEach(c=>c.api.close())}));else if(d==="closeAll")u.appendChild(sr("Close All",l,()=>{[...t.panels].forEach(c=>c.api.close())}));else if(ir(d)&&d.element)u.appendChild(d.element);else if(ir(d)&&d.component){const c=(h=(o=this.accessor.options).createContextMenuItemComponent)===null||h===void 0?void 0:h.call(o,{id:P_(),component:d.component});c&&(c.init({panel:e,group:t,api:this.accessor.api,close:l,componentProps:d.componentProps}),u.appendChild(c.element))}else ir(d)&&d.label&&u.appendChild(sr(d.label,l,()=>{var c;return(c=d.action)===null||c===void 0?void 0:c.call(d)},d.disabled));a.openPopover(u,{x:n.clientX,y:n.clientY,zIndex:Su(n.target)})}showForChip(e,t,n){if(!this.accessor.options.getTabGroupChipContextMenuItems)return;const o=this.accessor.options.getTabGroupChipContextMenuItems({tabGroup:e,group:t,api:this.accessor.api,event:n});if(o.length===0)return;n.preventDefault();const h=this.accessor.getPopupServiceForGroup(t),w=()=>h.close(),a=document.createElement("div");a.className="dv-context-menu",a.setAttribute("role","menu");for(const l of o)l==="separator"?a.appendChild(Cu()):l==="rename"?a.appendChild(A_(e)):l==="colorPicker"?a.appendChild(I_(e,this.accessor.tabGroupColorPalette)):ir(l)&&l.element?a.appendChild(l.element):ir(l)&&l.label&&a.appendChild(sr(l.label,w,()=>{var u;return(u=l.action)===null||u===void 0?void 0:u.call(l)},l.disabled));h.openPopover(a,{x:n.clientX,y:n.clientY,zIndex:Su(n.target)})}}const R_=ai({name:"ContextMenu",serviceKey:"contextMenuService",create:p=>new L_(p)}),M_=30,O_=-10;class G_{constructor(e){this.host=e}dispatchWillDragPanel(e){this.host.fireWillDragPanel(e)}dispatchWillDragGroup(e){this.host.fireWillDragGroup(e)}dispatchWillDrop(e){this.host.fireWillDrop(e)}dispatchWillShowOverlay(e){this.host.fireWillShowOverlay(e)}buildGroupDragGhost(e){const t=this.host.options.createGroupDragGhostComponent;if(!t)return;const n=t(e);return n.init({group:e,api:this.host.api}),{element:n.element,offsetX:M_,offsetY:O_,dispose:n.dispose?()=>{var o;return(o=n.dispose)===null||o===void 0?void 0:o.call(n)}:void 0}}resolveOverlayModel(e,t){var n,o;return(o=(n=this.host.options).dropOverlayModel)===null||o===void 0?void 0:o.call(n,{location:e,group:t})}showPreviewOverlay(e,t){const n=e.model.contentDropTarget;return n.showOverlay(t),Ve.from(()=>n.clearOverlay())}dispose(){}}const Op=ai({name:"AdvancedDnD",serviceKey:"advancedDnDService",create:p=>new G_(p)}),Kl="data-dv-kbd-moving";function Ai(p,e){const t=e.toLowerCase().split("+"),n=t[t.length-1],o=t.slice(0,-1);return p.ctrlKey===o.includes("ctrl")&&p.shiftKey===o.includes("shift")&&p.altKey===o.includes("alt")&&p.metaKey===(o.includes("meta")||o.includes("cmd"))&&p.key.toLowerCase()===n}function Yl(p){const e=p.keyboardNavigation;if(e)return e===!0?{}:e}const N_={nextTab:"ctrl+]",prevTab:"ctrl+[",focusNextGroup:"f6",focusPrevGroup:"shift+f6",focusTabs:"ctrl+shift+\\"};class z_ extends Se{constructor(e){super(),this.host=e,this._focusWasInside=!1;const t=e.rootElement.ownerDocument,n=w=>this._onKeyDown(w);t.addEventListener("keydown",n,!0);const o=w=>{const a=w.target;a instanceof HTMLElement&&this.host.rootElement.contains(a)&&!a.closest('[role="dialog"]')&&(this._lastNonFloatFocus=a)};t.addEventListener("focusin",o,!0);const h=w=>this._onFloatingEscape(w);t.addEventListener("keydown",h,!1),this.addDisposables({dispose:()=>t.removeEventListener("keydown",n,!0)},{dispose:()=>t.removeEventListener("focusin",o,!0)},{dispose:()=>t.removeEventListener("keydown",h,!1)},e.onWillMutateLayout(w=>{w.kind==="remove"&&this._nav&&(this._focusWasInside=this._isFocusInside())}),e.onDidMutateLayout(w=>{w.kind==="remove"&&this._nav&&this._focusWasInside&&!this._isFocusInside()&&this._restoreFocus()}))}get _moveActive(){return this.host.rootElement.hasAttribute(Kl)}_isFocusInside(){const e=this.host.rootElement.ownerDocument.activeElement;return e instanceof Node&&this.host.rootElement.contains(e)}_onFloatingEscape(e){if(!this._nav||this._moveActive||e.defaultPrevented||e.key!=="Escape")return;const t=e.target;if(!(t instanceof Element))return;const n=t.closest('[role="dialog"]');!n||!this.host.rootElement.contains(n)||(e.preventDefault(),e.stopPropagation(),this._returnFocusFromFloat())}_trapFloatTab(e){const t=e.target;if(!(t instanceof Element))return!1;const n=t.closest('[role="dialog"]');if(!n||!this.host.rootElement.contains(n))return!1;e.preventDefault();const o=this._tabbables(n);if(o.length===0)return!0;const h=n.ownerDocument.activeElement,w=h instanceof HTMLElement?o.indexOf(h):-1,a=o.length,l=w===-1?e.shiftKey?a-1:0:(w+(e.shiftKey?-1:1)+a)%a;return o[l].focus(),!0}_tabbables(e){const t=e.querySelectorAll("a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]");return Array.from(t).filter(n=>n.tabIndex>=0)}_returnFocusFromFloat(){var e;const t=this._lastNonFloatFocus;if(t&&t.isConnected&&this.host.rootElement.contains(t)&&!t.closest('[role="dialog"]')){t.focus();return}(e=this.host.groups.find(n=>n.api.location.type==="grid"))===null||e===void 0||e.model.focusContent()}get _nav(){return Yl(this.host.options)}get _keymap(){var e;return Object.assign(Object.assign({},N_),(e=this._nav)===null||e===void 0?void 0:e.keymap)}_onKeyDown(e){if(!this._nav||this._moveActive||!(e.target instanceof Node)||!this.host.rootElement.contains(e.target)||e.key==="Tab"&&this._trapFloatTab(e))return;const t=this._keymap;Ai(e,t.nextTab)?(this._consume(e),this._switchTab(!1)):Ai(e,t.prevTab)?(this._consume(e),this._switchTab(!0)):Ai(e,t.focusNextGroup)?(this._consume(e),this._cycleGroup(!1)):Ai(e,t.focusPrevGroup)?(this._consume(e),this._cycleGroup(!0)):Ai(e,t.focusTabs)&&(this._consume(e),this._focusTabs())}_focusTabs(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusActiveTab()}_switchTab(e){const t=this.host.activeGroup;t&&(e?t.model.moveToPrevious():t.model.moveToNext(),t.model.focusContent())}_cycleGroup(e){const t=this.host.activeGroup,n=t?this.host.adjacentGroup(t,e):this.host.groups[0];this._focusGroup(n)}_focusGroup(e){e&&(e.api.setActive(),e.model.focusContent())}_restoreFocus(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusContent()}_consume(e){e.preventDefault(),e.stopPropagation()}}const B_=ai({name:"Accessibility",serviceKey:"accessibilityService",create:p=>new z_(p)}),H_={ArrowLeft:"left",ArrowRight:"right",ArrowUp:"top",ArrowDown:"bottom"},nr={focusGroupLeft:"ctrl+shift+arrowleft",focusGroupRight:"ctrl+shift+arrowright",focusGroupUp:"ctrl+shift+arrowup",focusGroupDown:"ctrl+shift+arrowdown",dock:"ctrl+m"};class F_ extends Se{constructor(e){super(),this.host=e,this._move=null;const t=e.rootElement.ownerDocument,n=o=>this._onKeyDown(o);t.addEventListener("keydown",n,!0),this.addDisposables({dispose:()=>this._exit()},{dispose:()=>t.removeEventListener("keydown",n,!0)})}get _enabled(){return!!Yl(this.host.options)}get _keymap(){var e,t,n,o,h,w,a;const l=(t=(e=Yl(this.host.options))===null||e===void 0?void 0:e.keymap)!==null&&t!==void 0?t:{};return{focusGroupLeft:(n=l.focusGroupLeft)!==null&&n!==void 0?n:nr.focusGroupLeft,focusGroupRight:(o=l.focusGroupRight)!==null&&o!==void 0?o:nr.focusGroupRight,focusGroupUp:(h=l.focusGroupUp)!==null&&h!==void 0?h:nr.focusGroupUp,focusGroupDown:(w=l.focusGroupDown)!==null&&w!==void 0?w:nr.focusGroupDown,dock:(a=l.dock)!==null&&a!==void 0?a:nr.dock}}get _messages(){return Rp(this.host.options.messages)}_onKeyDown(e){if(!this._enabled)return;if(this._move){this._onMoveKey(e);return}if(!(e.target instanceof Node)||!this.host.rootElement.contains(e.target))return;const t=this._keymap;Ai(e,t.dock)?this._enterMoveMode(e):Ai(e,t.focusGroupLeft)?(this._consume(e),this._focusGroupInDirection("left")):Ai(e,t.focusGroupRight)?(this._consume(e),this._focusGroupInDirection("right")):Ai(e,t.focusGroupUp)?(this._consume(e),this._focusGroupInDirection("up")):Ai(e,t.focusGroupDown)&&(this._consume(e),this._focusGroupInDirection("down"))}_focusGroupInDirection(e){const t=this.host.activeGroup;t&&this._focusGroup(this.host.adjacentGroupInDirection(t,e))}_focusGroup(e){e&&(e.api.setActive(),e.model.focusContent())}_restoreFocus(){var e;(e=this.host.activeGroup)===null||e===void 0||e.model.focusContent()}_enterMoveMode(e){const t=this.host.activePanel,n=this.host.groups;if(!t||n.length===0)return;e.preventDefault(),e.stopPropagation();const o=Math.max(0,n.indexOf(t.group));this._move={source:t,groups:n,groupIndex:o,phase:"target",position:"center"},this.host.rootElement.setAttribute(Kl,""),this._render()}_onMoveKey(e){const t=this._move;if(e.key==="Escape"){this._consume(e),t.phase==="edge"?(t.phase="target",t.position="center",this._render()):(this._exit(),this.host.announce(this._messages.moveCancelled()),this._restoreFocus());return}if(e.key==="Enter"){this._consume(e),t.phase==="target"?(t.phase="edge",t.position="center",this._render()):this._commit();return}if(t.phase==="target"){const o=t.groups.length;e.key==="ArrowRight"||e.key==="ArrowDown"?(this._consume(e),t.groupIndex=(t.groupIndex+1)%o,this._render()):(e.key==="ArrowLeft"||e.key==="ArrowUp")&&(this._consume(e),t.groupIndex=(t.groupIndex-1+o)%o,this._render());return}const n=H_[e.key];n?(this._consume(e),t.position=n,this._render()):(e.key===" "||e.key==="c"||e.key==="C")&&(this._consume(e),t.position="center",this._render())}_render(){var e,t;const n=this._move,o=n.groups[n.groupIndex];this._clearPreview(),this._preview=this.host.showDropPreview(o,n.position);const h=(t=(e=o.activePanel)===null||e===void 0?void 0:e.title)!==null&&t!==void 0?t:o.id,w=this._messages;n.phase==="target"?this.host.announce(w.movePickTarget(this._label(n.source),h,n.groupIndex+1,n.groups.length)):this.host.announce(w.movePickEdge(n.position,h))}_commit(){var e,t;const n=this._move,o=n.groups[n.groupIndex],h=n.position,w=n.source,a=(t=(e=o.activePanel)===null||e===void 0?void 0:e.title)!==null&&t!==void 0?t:o.id,l=this._messages;this._exit();try{this.host.dockPanel(w,o,h),this.host.announce(l.moveCommitted(this._label(w),a,h))}catch{this.host.announce(l.moveNotAllowed())}this._restoreFocus()}_exit(){this._clearPreview(),this._move=null,this.host.rootElement.removeAttribute(Kl)}_clearPreview(){var e;(e=this._preview)===null||e===void 0||e.dispose(),this._preview=void 0}_consume(e){e.preventDefault(),e.stopPropagation()}_label(e){var t;return(t=e.title)!==null&&t!==void 0?t:e.id}}ai({name:"KeyboardDocking",serviceKey:"keyboardDockingService",create:p=>new F_(p),dependsOn:[Op,Mp]});const W_=[E_,R_,Op,B_];Lv(W_);Mv();var V_=$u();const j_=eh(V_);/**
56
56
  * dockview-react
57
57
  * @version 7.0.2
58
58
  * @link https://github.com/mathuo/dockview
59
59
  * @license MIT
60
- */const Gp=(p,e)=>{const[,t]=Te.useState(0),n=Te.useRef(p.componentProps);return Te.useImperativeHandle(e,()=>({update:o=>{n.current=Object.assign(Object.assign({},n.current),o),t(h=>h+1)}}),[]),Te.createElement(p.component,n.current)};Gp.displayName="DockviewReactJsBridge";const j_=(()=>{let p=1;return{next:()=>`dockview_react_portal_key_${(p++).toString()}`}})(),$_=Te.createContext({});class Li{constructor(e,t,n,o,h){this.parent=e,this.portalStore=t,this.component=n,this.parameters=o,this.context=h,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!U_(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=Te.createElement(Te.forwardRef(Gp),{component:this.component,componentProps:this.parameters,ref:o=>{this.componentInstance=o,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),t=this.context?Te.createElement($_.Provider,{value:this.context},e):e,n=V_.createPortal(t,this.parent,j_.next());this.ref={portal:n,disposable:this.portalStore.addPortal(n)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const No=()=>{const[p,e]=Te.useState([]);Te.useDebugValue(`Portal count: ${p.length}`);const t=Te.useCallback(n=>{e(h=>[...h,n]);let o=!1;return Ve.from(()=>{if(o)throw new Error("invalid operation: resource already disposed");o=!0,e(h=>h.filter(w=>w!==n))})},[]);return[p,t]};function U_(p){return typeof p=="function"||!!(p!=null&&p.$$typeof)}class xu{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var t;(t=this.part)===null||t===void 0||t.update({params:e.params})}layout(e,t){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Du{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var t;(t=this.part)===null||t===void 0||t.update({params:e.params})}layout(e,t){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Eu{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var t,n,o;this.parameters&&(this.parameters.params=e.params),(t=this.part)===null||t===void 0||t.update({params:(o=(n=this.parameters)===null||n===void 0?void 0:n.params)!==null&&o!==void 0?o:{}})}layout(e,t){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class K_{get element(){return this._element}get part(){return this._part}constructor(e,t,n){this.component=e,this.reactPortalStore=t,this._group=n,this.mutableDisposable=new ft,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Se(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()}),e.api.onDidLocationChange(t=>{this.updateLocation(t.location)})),this._part=new Li(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group,headerPosition:this._group.model.headerPosition,location:e.api.location})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var t;(t=this._part)===null||t===void 0||t.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}updateLocation(e){this.update({params:{location:e}})}}class Y_{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,e)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class ku{get element(){return this._element}constructor(e,t){this.component=e,this.reactPortalStore=t,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.display="inline-flex"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,{tabGroup:e.tabGroup,api:e.api})}update(e){var t;(t=this.part)===null||t===void 0||t.update({tabGroup:e.tabGroup})}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Pu{get element(){return this._element}constructor(e,t){this.component=e,this.reactPortalStore=t,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.display="inline-flex"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,{group:e.group,api:e.api})}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function un(p,e){return p?t=>new K_(p,e,t):void 0}const Do="props.defaultTabComponent";function X_(p){return $l.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const Np=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};$l.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},$l.map(a=>p[a])),Te.useEffect(()=>{var a;if(!t.current)return;const l=(a=p.tabComponents)!==null&&a!==void 0?a:{};p.defaultTabComponent&&(l[Do]=p.defaultTabComponent);const u={createLeftHeaderActionComponent:un(p.leftHeaderActionsComponent,{addPortal:h}),createRightHeaderActionComponent:un(p.rightHeaderActionsComponent,{addPortal:h}),createPrefixHeaderActionComponent:un(p.prefixHeaderActionsComponent,{addPortal:h}),createComponent:S=>new xu(S.id,p.components[S.name],{addPortal:h}),createTabComponent(S){return new Du(S.id,l[S.name],{addPortal:h})},createWatermarkComponent:p.watermarkComponent?()=>new Eu("watermark",p.watermarkComponent,{addPortal:h}):void 0,defaultTabComponent:p.defaultTabComponent?Do:void 0,createContextMenuItemComponent:S=>{if(S.component)return new Y_(S.id,S.component,{addPortal:h})}},d=X_(p);if(p.tabGroupChipComponent){const S=p.tabGroupChipComponent;d.createTabGroupChipComponent=()=>new ku(S,{addPortal:h})}if(p.groupDragGhostComponent){const S=p.groupDragGhostComponent;d.createGroupDragGhostComponent=()=>new Pu(S,{addPortal:h})}const c=b_(t.current,Object.assign(Object.assign({},d),u)),{clientWidth:b,clientHeight:C}=t.current;return c.layout(b,C),p.onReady&&p.onReady({api:c}),n.current=c,()=>{n.current=void 0,c.dispose()}},[]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onDidDrop(l=>{p.onDidDrop&&p.onDidDrop(l)});return()=>{a.dispose()}},[p.onDidDrop]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onWillDrop(l=>{p.onWillDrop&&p.onWillDrop(l)});return()=>{a.dispose()}},[p.onWillDrop]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createTabGroupChipComponent:p.tabGroupChipComponent?()=>new ku(p.tabGroupChipComponent,{addPortal:h}):void 0})},[p.tabGroupChipComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createGroupDragGhostComponent:p.groupDragGhostComponent?()=>new Pu(p.groupDragGhostComponent,{addPortal:h}):void 0})},[p.groupDragGhostComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new xu(a.id,p.components[a.name],{addPortal:h})})},[p.components]),Te.useEffect(()=>{var a;if(!n.current)return;const l=(a=p.tabComponents)!==null&&a!==void 0?a:{};p.defaultTabComponent&&(l[Do]=p.defaultTabComponent),n.current.updateOptions({defaultTabComponent:p.defaultTabComponent?Do:void 0,createTabComponent(u){return new Du(u.id,l[u.name],{addPortal:h})}})},[p.tabComponents,p.defaultTabComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createWatermarkComponent:p.watermarkComponent?()=>new Eu("watermark",p.watermarkComponent,{addPortal:h}):void 0})},[p.watermarkComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createRightHeaderActionComponent:un(p.rightHeaderActionsComponent,{addPortal:h})})},[p.rightHeaderActionsComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createLeftHeaderActionComponent:un(p.leftHeaderActionsComponent,{addPortal:h})})},[p.leftHeaderActionsComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createPrefixHeaderActionComponent:un(p.prefixHeaderActionsComponent,{addPortal:h})})},[p.prefixHeaderActionsComponent]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});Np.displayName="DockviewComponent";class Tu extends w_{constructor(e,t,n,o){super(e,t),this.reactComponent=n,this.reactPortalStore=o}getComponent(){var e,t;return new Li(this.element,this.reactPortalStore,this.reactComponent,{params:(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{},api:this.api,containerApi:new cp(this._params.accessor)})}}function q_(p){return zl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const J_=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};zl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},zl.map(a=>p[a])),Te.useEffect(()=>{if(!t.current)return()=>{};const a={createComponent:c=>new Tu(c.id,c.name,p.components[c.name],{addPortal:h})},l=y_(t.current,Object.assign(Object.assign({},q_(p)),a)),{clientWidth:u,clientHeight:d}=t.current;return l.layout(u,d),p.onReady&&p.onReady({api:l}),n.current=l,()=>{n.current=void 0,l.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Tu(a.id,a.name,p.components[a.name],{addPortal:h})})},[p.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});J_.displayName="SplitviewComponent";class Au extends Ap{constructor(e,t,n,o){super(e,t),this.reactComponent=n,this.reactPortalStore=o}getComponent(){var e,t;return new Li(this.element,this.reactPortalStore,this.reactComponent,{params:(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{},api:this.api,containerApi:new dp(this._params.accessor)})}}function Z_(p){return Wl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const Q_=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};Wl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},Wl.map(a=>p[a])),Te.useEffect(()=>{if(!t.current)return()=>{};const a={createComponent:c=>new Au(c.id,c.name,p.components[c.name],{addPortal:h})},l=S_(t.current,Object.assign(Object.assign({},Z_(p)),a)),{clientWidth:u,clientHeight:d}=t.current;return l.layout(u,d),p.onReady&&p.onReady({api:l}),n.current=l,()=>{n.current=void 0,l.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Au(a.id,a.name,p.components[a.name],{addPortal:h})})},[p.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});Q_.displayName="GridviewComponent";class Eo{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var t;(t=this.part)===null||t===void 0||t.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function e0(p){return jl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const t0=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};jl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},jl.map(a=>p[a])),Te.useEffect(()=>{var a;if(!t.current)return()=>{};const l=(a=p.headerComponents)!==null&&a!==void 0?a:{},u={createComponent:C=>new Eo(C.id,p.components[C.name],{addPortal:h}),createHeaderComponent:C=>new Eo(C.id,l[C.name],{addPortal:h})},d=C_(t.current,Object.assign(Object.assign({},e0(p)),u)),{clientWidth:c,clientHeight:b}=t.current;return d.layout(c,b),p.onReady&&p.onReady({api:d}),n.current=d,()=>{n.current=void 0,d.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Eo(a.id,p.components[a.name],{addPortal:h})})},[p.components]),Te.useEffect(()=>{var a;if(!n.current)return;const l=(a=p.headerComponents)!==null&&a!==void 0?a:{};n.current.updateOptions({createHeaderComponent:u=>new Eo(u.id,l[u.name],{addPortal:h})})},[p.headerComponents]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onDidDrop(l=>{p.onDidDrop&&p.onDidDrop(l)});return()=>{a.dispose()}},[p.onDidDrop]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});t0.displayName="PaneviewComponent";var Pl={exports:{}},Iu;function i0(){return Iu||(Iu=1,(function(p,e){(function(t,n){p.exports=n()})(globalThis,(()=>(()=>{var t={4567:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const c=l(9042),b=l(9924),C=l(844),S=l(4725),y=l(2585),g=l(3656);let _=a.AccessibilityManager=class extends C.Disposable{constructor(m,v,D,P){super(),this._terminal=m,this._coreBrowserService=D,this._renderService=P,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 T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 b.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
60
+ */const Gp=(p,e)=>{const[,t]=Te.useState(0),n=Te.useRef(p.componentProps);return Te.useImperativeHandle(e,()=>({update:o=>{n.current=Object.assign(Object.assign({},n.current),o),t(h=>h+1)}}),[]),Te.createElement(p.component,n.current)};Gp.displayName="DockviewReactJsBridge";const $_=(()=>{let p=1;return{next:()=>`dockview_react_portal_key_${(p++).toString()}`}})(),U_=Te.createContext({});class Li{constructor(e,t,n,o,h){this.parent=e,this.portalStore=t,this.component=n,this.parameters=o,this.context=h,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!K_(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=Te.createElement(Te.forwardRef(Gp),{component:this.component,componentProps:this.parameters,ref:o=>{this.componentInstance=o,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),t=this.context?Te.createElement(U_.Provider,{value:this.context},e):e,n=j_.createPortal(t,this.parent,$_.next());this.ref={portal:n,disposable:this.portalStore.addPortal(n)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const No=()=>{const[p,e]=Te.useState([]);Te.useDebugValue(`Portal count: ${p.length}`);const t=Te.useCallback(n=>{e(h=>[...h,n]);let o=!1;return Ve.from(()=>{if(o)throw new Error("invalid operation: resource already disposed");o=!0,e(h=>h.filter(w=>w!==n))})},[]);return[p,t]};function K_(p){return typeof p=="function"||!!(p!=null&&p.$$typeof)}class xu{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._onDidFocus=new Q,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new Q,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var t;(t=this.part)===null||t===void 0||t.update({params:e.params})}layout(e,t){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Du{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var t;(t=this.part)===null||t===void 0||t.update({params:e.params})}layout(e,t){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Eu{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var t,n,o;this.parameters&&(this.parameters.params=e.params),(t=this.part)===null||t===void 0||t.update({params:(o=(n=this.parameters)===null||n===void 0?void 0:n.params)!==null&&o!==void 0?o:{}})}layout(e,t){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Y_{get element(){return this._element}get part(){return this._part}constructor(e,t,n){this.component=e,this.reactPortalStore=t,this._group=n,this.mutableDisposable=new ft,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Se(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()}),e.api.onDidLocationChange(t=>{this.updateLocation(t.location)})),this._part=new Li(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group,headerPosition:this._group.model.headerPosition,location:e.api.location})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var t;(t=this._part)===null||t===void 0||t.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}updateLocation(e){this.update({params:{location:e}})}}class X_{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,e)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class ku{get element(){return this._element}constructor(e,t){this.component=e,this.reactPortalStore=t,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.display="inline-flex"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,{tabGroup:e.tabGroup,api:e.api})}update(e){var t;(t=this.part)===null||t===void 0||t.update({tabGroup:e.tabGroup})}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Pu{get element(){return this._element}constructor(e,t){this.component=e,this.reactPortalStore=t,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.display="inline-flex"}init(e){this.part=new Li(this._element,this.reactPortalStore,this.component,{group:e.group,api:e.api})}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function un(p,e){return p?t=>new Y_(p,e,t):void 0}const Do="props.defaultTabComponent";function q_(p){return $l.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const Np=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};$l.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},$l.map(a=>p[a])),Te.useEffect(()=>{var a;if(!t.current)return;const l=(a=p.tabComponents)!==null&&a!==void 0?a:{};p.defaultTabComponent&&(l[Do]=p.defaultTabComponent);const u={createLeftHeaderActionComponent:un(p.leftHeaderActionsComponent,{addPortal:h}),createRightHeaderActionComponent:un(p.rightHeaderActionsComponent,{addPortal:h}),createPrefixHeaderActionComponent:un(p.prefixHeaderActionsComponent,{addPortal:h}),createComponent:S=>new xu(S.id,p.components[S.name],{addPortal:h}),createTabComponent(S){return new Du(S.id,l[S.name],{addPortal:h})},createWatermarkComponent:p.watermarkComponent?()=>new Eu("watermark",p.watermarkComponent,{addPortal:h}):void 0,defaultTabComponent:p.defaultTabComponent?Do:void 0,createContextMenuItemComponent:S=>{if(S.component)return new X_(S.id,S.component,{addPortal:h})}},d=q_(p);if(p.tabGroupChipComponent){const S=p.tabGroupChipComponent;d.createTabGroupChipComponent=()=>new ku(S,{addPortal:h})}if(p.groupDragGhostComponent){const S=p.groupDragGhostComponent;d.createGroupDragGhostComponent=()=>new Pu(S,{addPortal:h})}const c=y_(t.current,Object.assign(Object.assign({},d),u)),{clientWidth:b,clientHeight:C}=t.current;return c.layout(b,C),p.onReady&&p.onReady({api:c}),n.current=c,()=>{n.current=void 0,c.dispose()}},[]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onDidDrop(l=>{p.onDidDrop&&p.onDidDrop(l)});return()=>{a.dispose()}},[p.onDidDrop]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onWillDrop(l=>{p.onWillDrop&&p.onWillDrop(l)});return()=>{a.dispose()}},[p.onWillDrop]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createTabGroupChipComponent:p.tabGroupChipComponent?()=>new ku(p.tabGroupChipComponent,{addPortal:h}):void 0})},[p.tabGroupChipComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createGroupDragGhostComponent:p.groupDragGhostComponent?()=>new Pu(p.groupDragGhostComponent,{addPortal:h}):void 0})},[p.groupDragGhostComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new xu(a.id,p.components[a.name],{addPortal:h})})},[p.components]),Te.useEffect(()=>{var a;if(!n.current)return;const l=(a=p.tabComponents)!==null&&a!==void 0?a:{};p.defaultTabComponent&&(l[Do]=p.defaultTabComponent),n.current.updateOptions({defaultTabComponent:p.defaultTabComponent?Do:void 0,createTabComponent(u){return new Du(u.id,l[u.name],{addPortal:h})}})},[p.tabComponents,p.defaultTabComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createWatermarkComponent:p.watermarkComponent?()=>new Eu("watermark",p.watermarkComponent,{addPortal:h}):void 0})},[p.watermarkComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createRightHeaderActionComponent:un(p.rightHeaderActionsComponent,{addPortal:h})})},[p.rightHeaderActionsComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createLeftHeaderActionComponent:un(p.leftHeaderActionsComponent,{addPortal:h})})},[p.leftHeaderActionsComponent]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createPrefixHeaderActionComponent:un(p.prefixHeaderActionsComponent,{addPortal:h})})},[p.prefixHeaderActionsComponent]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});Np.displayName="DockviewComponent";class Tu extends b_{constructor(e,t,n,o){super(e,t),this.reactComponent=n,this.reactPortalStore=o}getComponent(){var e,t;return new Li(this.element,this.reactPortalStore,this.reactComponent,{params:(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{},api:this.api,containerApi:new cp(this._params.accessor)})}}function J_(p){return zl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const Z_=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};zl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},zl.map(a=>p[a])),Te.useEffect(()=>{if(!t.current)return()=>{};const a={createComponent:c=>new Tu(c.id,c.name,p.components[c.name],{addPortal:h})},l=S_(t.current,Object.assign(Object.assign({},J_(p)),a)),{clientWidth:u,clientHeight:d}=t.current;return l.layout(u,d),p.onReady&&p.onReady({api:l}),n.current=l,()=>{n.current=void 0,l.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Tu(a.id,a.name,p.components[a.name],{addPortal:h})})},[p.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});Z_.displayName="SplitviewComponent";class Au extends Ap{constructor(e,t,n,o){super(e,t),this.reactComponent=n,this.reactPortalStore=o}getComponent(){var e,t;return new Li(this.element,this.reactPortalStore,this.reactComponent,{params:(t=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&t!==void 0?t:{},api:this.api,containerApi:new dp(this._params.accessor)})}}function Q_(p){return Wl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const e0=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};Wl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},Wl.map(a=>p[a])),Te.useEffect(()=>{if(!t.current)return()=>{};const a={createComponent:c=>new Au(c.id,c.name,p.components[c.name],{addPortal:h})},l=C_(t.current,Object.assign(Object.assign({},Q_(p)),a)),{clientWidth:u,clientHeight:d}=t.current;return l.layout(u,d),p.onReady&&p.onReady({api:l}),n.current=l,()=>{n.current=void 0,l.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Au(a.id,a.name,p.components[a.name],{addPortal:h})})},[p.components]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});e0.displayName="GridviewComponent";class Eo{get element(){return this._element}constructor(e,t,n){this.id=e,this.component=t,this.reactPortalStore=n,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new Li(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var t;(t=this.part)===null||t===void 0||t.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function t0(p){return jl.reduce((t,n)=>(n in p&&(t[n]=p[n]),t),{})}const i0=Te.forwardRef((p,e)=>{const t=Te.useRef(null),n=Te.useRef(void 0),[o,h]=No();Te.useImperativeHandle(e,()=>t.current,[]);const w=Te.useRef({});return Te.useEffect(()=>{const a={};jl.forEach(l=>{const u=l,d=p[u];u in p&&d!==w.current[u]&&(a[u]=d)}),n.current&&n.current.updateOptions(a),w.current=p},jl.map(a=>p[a])),Te.useEffect(()=>{var a;if(!t.current)return()=>{};const l=(a=p.headerComponents)!==null&&a!==void 0?a:{},u={createComponent:C=>new Eo(C.id,p.components[C.name],{addPortal:h}),createHeaderComponent:C=>new Eo(C.id,l[C.name],{addPortal:h})},d=x_(t.current,Object.assign(Object.assign({},t0(p)),u)),{clientWidth:c,clientHeight:b}=t.current;return d.layout(c,b),p.onReady&&p.onReady({api:d}),n.current=d,()=>{n.current=void 0,d.dispose()}},[]),Te.useEffect(()=>{n.current&&n.current.updateOptions({createComponent:a=>new Eo(a.id,p.components[a.name],{addPortal:h})})},[p.components]),Te.useEffect(()=>{var a;if(!n.current)return;const l=(a=p.headerComponents)!==null&&a!==void 0?a:{};n.current.updateOptions({createHeaderComponent:u=>new Eo(u.id,l[u.name],{addPortal:h})})},[p.headerComponents]),Te.useEffect(()=>{if(!n.current)return()=>{};const a=n.current.onDidDrop(l=>{p.onDidDrop&&p.onDidDrop(l)});return()=>{a.dispose()}},[p.onDidDrop]),Te.createElement("div",{style:{height:"100%",width:"100%"},ref:t},o)});i0.displayName="PaneviewComponent";var Pl={exports:{}},Iu;function s0(){return Iu||(Iu=1,(function(p,e){(function(t,n){p.exports=n()})(globalThis,(()=>(()=>{var t={4567:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const c=l(9042),b=l(9924),C=l(844),S=l(4725),y=l(2585),g=l(3656);let _=a.AccessibilityManager=class extends C.Disposable{constructor(m,v,D,P){super(),this._terminal=m,this._coreBrowserService=D,this._renderService=P,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 T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,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 b.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((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
61
61
  `)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(m){for(let v=0;v<m;v++)this._handleChar(" ")}_handleChar(m){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==m&&(this._charsToAnnounce+=m):this._charsToAnnounce+=m,m===`
62
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,v){this._liveRegionDebouncer.refresh(m,v,this._terminal.rows)}_renderRows(m,v){const D=this._terminal.buffer,P=D.lines.length.toString();for(let T=m;T<=v;T++){const A=D.lines.get(D.ydisp+T),E=[],I=(A==null?void 0:A.translateToString(!0,void 0,void 0,E))||"",z=(D.ydisp+T+1).toString(),H=this._rowElements[T];H&&(I.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=I,this._rowColumns.set(H,E)),H.setAttribute("aria-posinset",z),H.setAttribute("aria-setsize",P))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,v){const D=m.target,P=this._rowElements[v===0?1:this._rowElements.length-2];if(D.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==P)return;let T,A;if(v===0?(T=D,A=this._rowElements.pop(),this._rowContainer.removeChild(A)):(T=this._rowElements.shift(),A=D,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),A.removeEventListener("focus",this._bottomBoundaryFocusListener),v===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(v===0?-1:1),this._rowElements[v===0?1:this._rowElements.length-2].focus(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let v={node:m.anchorNode,offset:m.anchorOffset},D={node:m.focusNode,offset:m.focusOffset};if((v.node.compareDocumentPosition(D.node)&Node.DOCUMENT_POSITION_PRECEDING||v.node===D.node&&v.offset>D.offset)&&([v,D]=[D,v]),v.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(v={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(v.node))return;const P=this._rowElements.slice(-1)[0];if(D.node.compareDocumentPosition(P)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(D={node:P,offset:((I=P.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(D.node))return;const T=({node:z,offset:H})=>{const V=z instanceof Text?z.parentNode:z;let F=parseInt(V==null?void 0:V.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const q=this._rowColumns.get(V);if(!q)return console.warn("columns is null. Race condition?"),null;let W=H<q.length?q[H]:q.slice(-1)[0]+1;return W>=this._terminal.cols&&(++F,W=0),{row:F,column:W}},A=T(v),E=T(D);if(A&&E){if(A.row>E.row||A.row===E.row&&A.column>=E.column)throw new Error("invalid range");this._terminal.select(A.column,A.row,(E.row-A.row)*this._terminal.cols-A.column+E.column)}}_handleResize(m){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let v=this._rowContainer.children.length;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);for(;this._rowElements.length>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_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 m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=_=u([d(1,y.IInstantiationService),d(2,S.ICoreBrowserService),d(3,S.IRenderService)],_)},3614:(w,a)=>{function l(b){return b.replace(/\r?\n/g,"\r")}function u(b,C){return C?"\x1B[200~"+b+"\x1B[201~":b}function d(b,C,S,y){b=u(b=l(b),S.decPrivateModes.bracketedPasteMode&&y.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(b,!0),C.value=""}function c(b,C,S){const y=S.getBoundingClientRect(),g=b.clientX-y.left-10,_=b.clientY-y.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${g}px`,C.style.top=`${_}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=u,a.copyHandler=function(b,C){b.clipboardData&&b.clipboardData.setData("text/plain",C.selectionText),b.preventDefault()},a.handlePasteEvent=function(b,C,S,y){b.stopPropagation(),b.clipboardData&&d(b.clipboardData.getData("text/plain"),C,S,y)},a.paste=d,a.moveTextAreaUnderMouseCursor=c,a.rightClickHandler=function(b,C,S,y,g){c(b,C,S),g&&y.rightClickSelect(b),C.value=y.selectionText,C.select()}},7239:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const u=l(1505);a.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(d,c,b){this._css.set(d,c,b)}getCss(d,c){return this._css.get(d,c)}setColor(d,c,b){this._color.set(d,c,b)}getColor(d,c){return this._color.get(d,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,u,d,c){l.addEventListener(u,d,c);let b=!1;return{dispose:()=>{b||(b=!0,l.removeEventListener(u,d,c))}}}},3551:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const c=l(3656),b=l(8460),C=l(844),S=l(2585),y=l(4725);let g=a.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(_,m,v,D,P){super(),this._element=_,this._mouseService=m,this._renderService=v,this._bufferService=D,this._linkProviderService=P,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const m=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const v=_.composedPath();for(let D=0;D<v.length;D++){const P=v[D];if(P.classList.contains("xterm"))break;if(P.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,m){var D,P;this._activeProviderReplies&&m||((D=this._activeProviderReplies)==null||D.forEach((T=>{T==null||T.forEach((A=>{A.link.dispose&&A.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let v=!1;for(const[T,A]of this._linkProviderService.linkProviders.entries())m?(P=this._activeProviderReplies)!=null&&P.get(T)&&(v=this._checkLinkProviderResult(T,_,v)):A.provideLinks(_.y,(E=>{var z,H;if(this._isMouseOut)return;const I=E==null?void 0:E.map((V=>({link:V})));(z=this._activeProviderReplies)==null||z.set(T,I),v=this._checkLinkProviderResult(T,_,v),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,m){const v=new Set;for(let D=0;D<m.size;D++){const P=m.get(D);if(P)for(let T=0;T<P.length;T++){const A=P[T],E=A.link.range.start.y<_?0:A.link.range.start.x,I=A.link.range.end.y>_?this._bufferService.cols:A.link.range.end.x;for(let z=E;z<=I;z++){if(v.has(z)){P.splice(T--,1);break}v.add(z)}}}}_checkLinkProviderResult(_,m,v){var T;if(!this._activeProviderReplies)return v;const D=this._activeProviderReplies.get(_);let P=!1;for(let A=0;A<_;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(P=!0);if(!P&&D){const A=D.find((E=>this._linkAtPosition(E.link,m)));A&&(v=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!v)for(let A=0;A<this._activeProviderReplies.size;A++){const E=(T=this._activeProviderReplies.get(A))==null?void 0:T.find((I=>this._linkAtPosition(I.link,m)));if(E){v=!0,this._handleNewLink(E);break}}return v}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const m=this._positionFromMouseEvent(_,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,m){this._currentLink&&this._lastMouseEvent&&(!_||!m||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(_.link,m)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var v,D;return(D=(v=this._currentLink)==null?void 0:v.state)==null?void 0:D.decorations.pointerCursor},set:v=>{var D;(D=this._currentLink)!=null&&D.state&&this._currentLink.state.decorations.pointerCursor!==v&&(this._currentLink.state.decorations.pointerCursor=v,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",v))}},underline:{get:()=>{var v,D;return(D=(v=this._currentLink)==null?void 0:v.state)==null?void 0:D.decorations.underline},set:v=>{var D,P,T;(D=this._currentLink)!=null&&D.state&&((T=(P=this._currentLink)==null?void 0:P.state)==null?void 0:T.decorations.underline)!==v&&(this._currentLink.state.decorations.underline=v,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,v))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((v=>{if(!this._currentLink)return;const D=v.start===0?0:v.start+1+this._bufferService.buffer.ydisp,P=this._bufferService.buffer.ydisp+1+v.end;if(this._currentLink.link.range.start.y>=D&&this._currentLink.link.range.end.y<=P&&(this._clearCurrentLink(D,P),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(_,m,v){var D;(D=this._currentLink)!=null&&D.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(v,m.text)}_fireUnderlineEvent(_,m){const v=_.range,D=this._bufferService.buffer.ydisp,P=this._createLinkUnderlineEvent(v.start.x-1,v.start.y-D-1,v.end.x,v.end.y-D-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(P)}_linkLeave(_,m,v){var D;(D=this._currentLink)!=null&&D.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(v,m.text)}_linkAtPosition(_,m){const v=_.range.start.y*this._bufferService.cols+_.range.start.x,D=_.range.end.y*this._bufferService.cols+_.range.end.x,P=m.y*this._bufferService.cols+m.x;return v<=P&&P<=D}_positionFromMouseEvent(_,m,v){const D=v.getCoords(_,m,this._bufferService.cols,this._bufferService.rows);if(D)return{x:D[0],y:D[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,m,v,D,P){return{x1:_,y1:m,x2:v,y2:D,cols:this._bufferService.cols,fg:P}}};a.Linkifier=g=u([d(1,y.IMouseService),d(2,y.IRenderService),d(3,S.IBufferService),d(4,y.ILinkProviderService)],g)},9042:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const c=l(511),b=l(2585);let C=a.OscLinkProvider=class{constructor(y,g,_){this._bufferService=y,this._optionsService=g,this._oscLinkService=_}provideLinks(y,g){var I;const _=this._bufferService.buffer.lines.get(y-1);if(!_)return void g(void 0);const m=[],v=this._optionsService.rawOptions.linkHandler,D=new c.CellData,P=_.getTrimmedLength();let T=-1,A=-1,E=!1;for(let z=0;z<P;z++)if(A!==-1||_.hasContent(z)){if(_.loadCell(z,D),D.hasExtendedAttrs()&&D.extended.urlId){if(A===-1){A=z,T=D.extended.urlId;continue}E=D.extended.urlId!==T}else A!==-1&&(E=!0);if(E||A!==-1&&z===P-1){const H=(I=this._oscLinkService.getLinkData(T))==null?void 0:I.uri;if(H){const V={start:{x:A+1,y},end:{x:z+(E||z!==P-1?0:1),y}};let F=!1;if(!(v!=null&&v.allowNonHttpProtocols))try{const q=new URL(H);["http:","https:"].includes(q.protocol)||(F=!0)}catch{F=!0}F||m.push({text:H,range:V,activate:(q,W)=>v?v.activate(q,W,V):S(0,W),hover:(q,W)=>{var K;return(K=v==null?void 0:v.hover)==null?void 0:K.call(v,q,W,V)},leave:(q,W)=>{var K;return(K=v==null?void 0:v.leave)==null?void 0:K.call(v,q,W,V)}})}E=!1,D.hasExtendedAttrs()&&D.extended.urlId?(A=z,T=D.extended.urlId):(A=-1,T=-1)}}g(m)}};function S(y,g){if(confirm(`Do you want to navigate to ${g}?
62
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(m){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(m)||this._charsToConsume.push(m)}_refreshRows(m,v){this._liveRegionDebouncer.refresh(m,v,this._terminal.rows)}_renderRows(m,v){const D=this._terminal.buffer,P=D.lines.length.toString();for(let T=m;T<=v;T++){const A=D.lines.get(D.ydisp+T),E=[],I=(A==null?void 0:A.translateToString(!0,void 0,void 0,E))||"",B=(D.ydisp+T+1).toString(),N=this._rowElements[T];N&&(I.length===0?(N.innerText=" ",this._rowColumns.set(N,[0,1])):(N.textContent=I,this._rowColumns.set(N,E)),N.setAttribute("aria-posinset",B),N.setAttribute("aria-setsize",P))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(m,v){const D=m.target,P=this._rowElements[v===0?1:this._rowElements.length-2];if(D.getAttribute("aria-posinset")===(v===0?"1":`${this._terminal.buffer.lines.length}`)||m.relatedTarget!==P)return;let T,A;if(v===0?(T=D,A=this._rowElements.pop(),this._rowContainer.removeChild(A)):(T=this._rowElements.shift(),A=D,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),A.removeEventListener("focus",this._bottomBoundaryFocusListener),v===0){const E=this._createAccessibilityTreeNode();this._rowElements.unshift(E),this._rowContainer.insertAdjacentElement("afterbegin",E)}else{const E=this._createAccessibilityTreeNode();this._rowElements.push(E),this._rowContainer.appendChild(E)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(v===0?-1:1),this._rowElements[v===0?1:this._rowElements.length-2].focus(),m.preventDefault(),m.stopImmediatePropagation()}_handleSelectionChange(){var I;if(this._rowElements.length===0)return;const m=document.getSelection();if(!m)return;if(m.isCollapsed)return void(this._rowContainer.contains(m.anchorNode)&&this._terminal.clearSelection());if(!m.anchorNode||!m.focusNode)return void console.error("anchorNode and/or focusNode are null");let v={node:m.anchorNode,offset:m.anchorOffset},D={node:m.focusNode,offset:m.focusOffset};if((v.node.compareDocumentPosition(D.node)&Node.DOCUMENT_POSITION_PRECEDING||v.node===D.node&&v.offset>D.offset)&&([v,D]=[D,v]),v.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(v={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(v.node))return;const P=this._rowElements.slice(-1)[0];if(D.node.compareDocumentPosition(P)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(D={node:P,offset:((I=P.textContent)==null?void 0:I.length)??0}),!this._rowContainer.contains(D.node))return;const T=({node:B,offset:N})=>{const W=B instanceof Text?B.parentNode:B;let F=parseInt(W==null?void 0:W.getAttribute("aria-posinset"),10)-1;if(isNaN(F))return console.warn("row is invalid. Race condition?"),null;const q=this._rowColumns.get(W);if(!q)return console.warn("columns is null. Race condition?"),null;let V=N<q.length?q[N]:q.slice(-1)[0]+1;return V>=this._terminal.cols&&(++F,V=0),{row:F,column:V}},A=T(v),E=T(D);if(A&&E){if(A.row>E.row||A.row===E.row&&A.column>=E.column)throw new Error("invalid range");this._terminal.select(A.column,A.row,(E.row-A.row)*this._terminal.cols-A.column+E.column)}}_handleResize(m){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let v=this._rowContainer.children.length;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);for(;this._rowElements.length>m;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const m=this._coreBrowserService.mainDocument.createElement("div");return m.setAttribute("role","listitem"),m.tabIndex=-1,this._refreshRowDimensions(m),m}_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 m=0;m<this._terminal.rows;m++)this._refreshRowDimensions(this._rowElements[m])}}_refreshRowDimensions(m){m.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=_=u([d(1,y.IInstantiationService),d(2,S.ICoreBrowserService),d(3,S.IRenderService)],_)},3614:(w,a)=>{function l(b){return b.replace(/\r?\n/g,"\r")}function u(b,C){return C?"\x1B[200~"+b+"\x1B[201~":b}function d(b,C,S,y){b=u(b=l(b),S.decPrivateModes.bracketedPasteMode&&y.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(b,!0),C.value=""}function c(b,C,S){const y=S.getBoundingClientRect(),g=b.clientX-y.left-10,_=b.clientY-y.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${g}px`,C.style.top=`${_}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=l,a.bracketTextForPaste=u,a.copyHandler=function(b,C){b.clipboardData&&b.clipboardData.setData("text/plain",C.selectionText),b.preventDefault()},a.handlePasteEvent=function(b,C,S,y){b.stopPropagation(),b.clipboardData&&d(b.clipboardData.getData("text/plain"),C,S,y)},a.paste=d,a.moveTextAreaUnderMouseCursor=c,a.rightClickHandler=function(b,C,S,y,g){c(b,C,S),g&&y.rightClickSelect(b),C.value=y.selectionText,C.select()}},7239:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const u=l(1505);a.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(d,c,b){this._css.set(d,c,b)}getCss(d,c){return this._css.get(d,c)}setColor(d,c,b){this._color.set(d,c,b)}getColor(d,c){return this._color.get(d,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(l,u,d,c){l.addEventListener(u,d,c);let b=!1;return{dispose:()=>{b||(b=!0,l.removeEventListener(u,d,c))}}}},3551:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const c=l(3656),b=l(8460),C=l(844),S=l(2585),y=l(4725);let g=a.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(_,m,v,D,P){super(),this._element=_,this._mouseService=m,this._renderService=v,this._bufferService=D,this._linkProviderService=P,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new b.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new b.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{var T;this._lastMouseEvent=void 0,(T=this._activeProviderReplies)==null||T.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const m=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!m)return;this._isMouseOut=!1;const v=_.composedPath();for(let D=0;D<v.length;D++){const P=v[D];if(P.classList.contains("xterm"))break;if(P.classList.contains("xterm-hover"))return}this._lastBufferCell&&m.x===this._lastBufferCell.x&&m.y===this._lastBufferCell.y||(this._handleHover(m),this._lastBufferCell=m)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,m){var D,P;this._activeProviderReplies&&m||((D=this._activeProviderReplies)==null||D.forEach((T=>{T==null||T.forEach((A=>{A.link.dispose&&A.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let v=!1;for(const[T,A]of this._linkProviderService.linkProviders.entries())m?(P=this._activeProviderReplies)!=null&&P.get(T)&&(v=this._checkLinkProviderResult(T,_,v)):A.provideLinks(_.y,(E=>{var B,N;if(this._isMouseOut)return;const I=E==null?void 0:E.map((W=>({link:W})));(B=this._activeProviderReplies)==null||B.set(T,I),v=this._checkLinkProviderResult(T,_,v),((N=this._activeProviderReplies)==null?void 0:N.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,m){const v=new Set;for(let D=0;D<m.size;D++){const P=m.get(D);if(P)for(let T=0;T<P.length;T++){const A=P[T],E=A.link.range.start.y<_?0:A.link.range.start.x,I=A.link.range.end.y>_?this._bufferService.cols:A.link.range.end.x;for(let B=E;B<=I;B++){if(v.has(B)){P.splice(T--,1);break}v.add(B)}}}}_checkLinkProviderResult(_,m,v){var T;if(!this._activeProviderReplies)return v;const D=this._activeProviderReplies.get(_);let P=!1;for(let A=0;A<_;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(P=!0);if(!P&&D){const A=D.find((E=>this._linkAtPosition(E.link,m)));A&&(v=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!v)for(let A=0;A<this._activeProviderReplies.size;A++){const E=(T=this._activeProviderReplies.get(A))==null?void 0:T.find((I=>this._linkAtPosition(I.link,m)));if(E){v=!0,this._handleNewLink(E);break}}return v}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const m=this._positionFromMouseEvent(_,this._element,this._mouseService);m&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,m)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,m){this._currentLink&&this._lastMouseEvent&&(!_||!m||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=m)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const m=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);m&&this._linkAtPosition(_.link,m)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var v,D;return(D=(v=this._currentLink)==null?void 0:v.state)==null?void 0:D.decorations.pointerCursor},set:v=>{var D;(D=this._currentLink)!=null&&D.state&&this._currentLink.state.decorations.pointerCursor!==v&&(this._currentLink.state.decorations.pointerCursor=v,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",v))}},underline:{get:()=>{var v,D;return(D=(v=this._currentLink)==null?void 0:v.state)==null?void 0:D.decorations.underline},set:v=>{var D,P,T;(D=this._currentLink)!=null&&D.state&&((T=(P=this._currentLink)==null?void 0:P.state)==null?void 0:T.decorations.underline)!==v&&(this._currentLink.state.decorations.underline=v,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,v))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((v=>{if(!this._currentLink)return;const D=v.start===0?0:v.start+1+this._bufferService.buffer.ydisp,P=this._bufferService.buffer.ydisp+1+v.end;if(this._currentLink.link.range.start.y>=D&&this._currentLink.link.range.end.y<=P&&(this._clearCurrentLink(D,P),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(_,m,v){var D;(D=this._currentLink)!=null&&D.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),m.hover&&m.hover(v,m.text)}_fireUnderlineEvent(_,m){const v=_.range,D=this._bufferService.buffer.ydisp,P=this._createLinkUnderlineEvent(v.start.x-1,v.start.y-D-1,v.end.x,v.end.y-D-1,void 0);(m?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(P)}_linkLeave(_,m,v){var D;(D=this._currentLink)!=null&&D.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(m,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),m.leave&&m.leave(v,m.text)}_linkAtPosition(_,m){const v=_.range.start.y*this._bufferService.cols+_.range.start.x,D=_.range.end.y*this._bufferService.cols+_.range.end.x,P=m.y*this._bufferService.cols+m.x;return v<=P&&P<=D}_positionFromMouseEvent(_,m,v){const D=v.getCoords(_,m,this._bufferService.cols,this._bufferService.rows);if(D)return{x:D[0],y:D[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,m,v,D,P){return{x1:_,y1:m,x2:v,y2:D,cols:this._bufferService.cols,fg:P}}};a.Linkifier=g=u([d(1,y.IMouseService),d(2,y.IRenderService),d(3,S.IBufferService),d(4,y.ILinkProviderService)],g)},9042:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const c=l(511),b=l(2585);let C=a.OscLinkProvider=class{constructor(y,g,_){this._bufferService=y,this._optionsService=g,this._oscLinkService=_}provideLinks(y,g){var I;const _=this._bufferService.buffer.lines.get(y-1);if(!_)return void g(void 0);const m=[],v=this._optionsService.rawOptions.linkHandler,D=new c.CellData,P=_.getTrimmedLength();let T=-1,A=-1,E=!1;for(let B=0;B<P;B++)if(A!==-1||_.hasContent(B)){if(_.loadCell(B,D),D.hasExtendedAttrs()&&D.extended.urlId){if(A===-1){A=B,T=D.extended.urlId;continue}E=D.extended.urlId!==T}else A!==-1&&(E=!0);if(E||A!==-1&&B===P-1){const N=(I=this._oscLinkService.getLinkData(T))==null?void 0:I.uri;if(N){const W={start:{x:A+1,y},end:{x:B+(E||B!==P-1?0:1),y}};let F=!1;if(!(v!=null&&v.allowNonHttpProtocols))try{const q=new URL(N);["http:","https:"].includes(q.protocol)||(F=!0)}catch{F=!0}F||m.push({text:N,range:W,activate:(q,V)=>v?v.activate(q,V,W):S(0,V),hover:(q,V)=>{var K;return(K=v==null?void 0:v.hover)==null?void 0:K.call(v,q,V,W)},leave:(q,V)=>{var K;return(K=v==null?void 0:v.leave)==null?void 0:K.call(v,q,V,W)}})}E=!1,D.hasExtendedAttrs()&&D.extended.urlId?(A=B,T=D.extended.urlId):(A=-1,T=-1)}}g(m)}};function S(y,g){if(confirm(`Do you want to navigate to ${g}?
63
63
 
64
- WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=C=u([d(0,b.IBufferService),d(1,b.IOptionsService),d(2,b.IOscLinkService)],C)},6193:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,d){this._rowCount=d,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,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 l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const u=l(3614),d=l(3656),c=l(3551),b=l(9042),C=l(3730),S=l(1680),y=l(3107),g=l(5744),_=l(2950),m=l(1296),v=l(428),D=l(4269),P=l(5114),T=l(8934),A=l(3230),E=l(9312),I=l(4725),z=l(6731),H=l(8055),V=l(8969),F=l(8460),q=l(844),W=l(6114),K=l(8437),ie=l(2584),J=l(7399),L=l(5941),B=l(9074),R=l(2585),G=l(5435),X=l(4567),oe=l(779);class ae extends V.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($={}){super($),this.browser=W,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new q.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(B.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(oe.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((O,le)=>this.refresh(O,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((O=>this._reportWindowsOptions(O)))),this.register(this._inputHandler.onColor((O=>this._handleColorEvent(O)))),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((O=>this._afterResize(O.cols,O.rows)))),this.register((0,q.toDisposable)((()=>{var O,le;this._customKeyEventHandler=void 0,(le=(O=this.element)==null?void 0:O.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent($){if(this._themeService)for(const O of $){let le,se="";switch(O.index){case 256:le="foreground",se="10";break;case 257:le="background",se="11";break;case 258:le="cursor",se="12";break;default:le="ansi",se="4;"+O.index}switch(O.type){case 0:const ge=H.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${ie.C0.ESC}]${se};${(0,L.toRgbString)(ge)}${ie.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((fe=>fe.ansi[O.index]=H.channels.toColor(...O.color)));else{const fe=le;this._themeService.modifyColors((Me=>Me[fe]=H.channels.toColor(...O.color)))}break;case 2:this._themeService.restoreColor(O.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange($){$?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(X.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus($){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var $;return($=this.textarea)==null?void 0:$.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.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 $=this.buffer.ybase+this.buffer.y,O=this.buffer.lines.get($);if(!O)return;const le=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ge=O.getWidth(le),fe=this._renderService.dimensions.css.cell.width*ge,Me=this.buffer.y*this._renderService.dimensions.css.cell.height,We=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=We+"px",this.textarea.style.top=Me+"px",this.textarea.style.width=fe+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(O=>{this.hasSelection()&&(0,u.copyHandler)(O,this._selectionService)})));const $=O=>(0,u.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",$)),this.register((0,d.addDisposableDomListener)(this.element,"paste",$)),W.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(O=>{O.button===2&&(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(O=>{(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),W.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(O=>{O.button===1&&(0,u.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",($=>this._keyUp($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",($=>this._keyDown($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",($=>this._keyPress($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",($=>this._compositionHelper.compositionupdate($)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",($=>this._inputEvent($)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open($){var le;if(!$)throw new Error("Terminal requires a parent element.");if($.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=$.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"),$.appendChild(this.element);const O=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),O.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,d.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),O.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),W.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(P.CoreBrowserService,this.textarea,$.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(v.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(D.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(O);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((se=>this.scrollLines(se.amount,se.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(E.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(y.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),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(X.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const $=this,O=this.element;function le(fe){const Me=$._mouseService.getMouseReportCoords(fe,$.screenElement);if(!Me)return!1;let We,je;switch(fe.overrideType||fe.type){case"mousemove":je=32,fe.buttons===void 0?(We=3,fe.button!==void 0&&(We=fe.button<3?fe.button:3)):We=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":je=0,We=fe.button<3?fe.button:3;break;case"mousedown":je=1,We=fe.button<3?fe.button:3;break;case"wheel":if($._customWheelEventHandler&&$._customWheelEventHandler(fe)===!1||$.viewport.getLinesScrolled(fe)===0)return!1;je=fe.deltaY<0?0:1,We=4;break;default:return!1}return!(je===void 0||We===void 0||We>4)&&$.coreMouseService.triggerMouseEvent({col:Me.col,row:Me.row,x:Me.x,y:Me.y,button:We,action:je,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:fe=>(le(fe),fe.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(fe)),wheel:fe=>(le(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&le(fe)},mousemove:fe=>{fe.buttons||le(fe)}};this.register(this.coreMouseService.onProtocolChange((fe=>{fe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(fe)),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&fe?se.mousemove||(O.addEventListener("mousemove",ge.mousemove),se.mousemove=ge.mousemove):(O.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&fe?se.wheel||(O.addEventListener("wheel",ge.wheel,{passive:!1}),se.wheel=ge.wheel):(O.removeEventListener("wheel",se.wheel),se.wheel=null),2&fe?se.mouseup||(se.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&fe?se.mousedrag||(se.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(O,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return le(fe),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(fe)}))),this.register((0,d.addDisposableDomListener)(O,"wheel",(fe=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Me=this.viewport.getLinesScrolled(fe);if(Me===0)return;const We=ie.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let je="";for(let ot=0;ot<Math.abs(Me);ot++)je+=We;return this.coreService.triggerDataEvent(je,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(O,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(O,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh($,O){var le;(le=this._renderService)==null||le.refreshRows($,O)}updateCursorStyle($){var O;(O=this._selectionService)!=null&&O.shouldColumnSelect($)?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($,O,le=0){var se;le===1?(super.scrollLines($,O,le),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines($)}paste($){(0,u.paste)($,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler($){this._customKeyEventHandler=$}attachCustomWheelEventHandler($){this._customWheelEventHandler=$}registerLinkProvider($){return this._linkProviderService.registerLinkProvider($)}registerCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const O=this._characterJoinerService.register($);return this.refresh(0,this.rows-1),O}deregisterCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister($)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker($){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+$)}registerDecoration($){return this._decorationService.registerDecoration($)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select($,O,le){this._selectionService.setSelection($,O,le)}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 $;($=this._selectionService)==null||$.clearSelection()}selectAll(){var $;($=this._selectionService)==null||$.selectAll()}selectLines($,O){var le;(le=this._selectionService)==null||le.selectLines($,O)}_keyDown($){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&$.altKey;if(!O&&!this._compositionHelper.keydown($))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||$.key!=="Dead"&&$.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,J.evaluateKeyboardEvent)($,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle($),le.type===3||le.type===2){const se=this.rows-1;return this.scrollLines(le.type===2?-se:se),this.cancel($,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,$)||(le.cancel&&this.cancel($,!0),!le.key||!!($.key&&!$.ctrlKey&&!$.altKey&&!$.metaKey&&$.key.length===1&&$.key.charCodeAt(0)>=65&&$.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==ie.C0.ETX&&le.key!==ie.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||$.altKey||$.ctrlKey?this.cancel($,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift($,O){const le=$.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||$.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||$.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?le:le&&(!O.keyCode||O.keyCode>47)}_keyUp($){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1||((function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18})($)||this.focus(),this.updateCursorStyle($),this._keyPressHandled=!1)}_keyPress($){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;if(this.cancel($),$.charCode)O=$.charCode;else if($.which===null||$.which===void 0)O=$.keyCode;else{if($.which===0||$.charCode===0)return!1;O=$.which}return!(!O||($.altKey||$.ctrlKey||$.metaKey)&&!this._isThirdLevelShift(this.browser,$)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(O,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent($){if($.data&&$.inputType==="insertText"&&(!$.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const O=$.data;return this.coreService.triggerDataEvent(O,!0),this.cancel($),!0}return!1}resize($,O){$!==this.cols||O!==this.rows?super.resize($,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize($,O){var le,se;(le=this._charSizeService)==null||le.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var $;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 O=1;O<this.rows;O++)this.buffer.lines.push(this.buffer.getBlankLine(K.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),($=this.viewport)==null||$.reset(),this.refresh(0,this.rows-1)}}reset(){var O,le;this.options.rows=this.rows,this.options.cols=this.cols;const $=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(le=this.viewport)==null||le.reset(),this._customKeyEventHandler=$,this.refresh(0,this.rows-1)}clearTextureAtlas(){var $;($=this._renderService)==null||$.clearTextureAtlas()}_reportFocus(){var $;($=this.element)!=null&&$.classList.contains("focus")?this.coreService.triggerDataEvent(ie.C0.ESC+"[I"):this.coreService.triggerDataEvent(ie.C0.ESC+"[O")}_reportWindowsOptions($){if(this._renderService)switch($){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),le=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.C0.ESC}[4;${le};${O}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.C0.ESC}[6;${ge};${se}t`)}}cancel($,O){if(this.options.cancelEvents||O)return $.preventDefault(),$.stopPropagation(),!1}}a.Terminal=ae},9924:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,d){this._rowCount=d,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=c-this._lastRefreshMs,C=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const c=l(3656),b=l(4725),C=l(8460),S=l(844),y=l(2585);let g=a.Viewport=class extends S.Disposable{constructor(_,m,v,D,P,T,A,E){super(),this._viewportElement=_,this._scrollArea=m,this._bufferService=v,this._optionsService=D,this._charSizeService=P,this._renderService=T,this._coreBrowserService=A,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 C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(E.colors),this.register(E.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(_){this._viewportElement.style.backgroundColor=_.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(_){if(_)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 m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){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 m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(_,m){const v=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&v<this._lastRecordedBufferHeight)||(_.cancelable&&_.preventDefault(),!1)}handleWheel(_){const m=this._getPixelsScrolled(_);return m!==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+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(_,m))}scrollLines(_){if(_!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=_*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!1})}_getPixelsScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let m=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(_,m){var E;let v,D="";const P=[],T=m??this._bufferService.buffer.lines.length,A=this._bufferService.buffer.lines;for(let I=_;I<T;I++){const z=A.get(I);if(!z)continue;const H=(E=A.get(I+1))==null?void 0:E.isWrapped;if(D+=z.translateToString(!H),!H||I===A.length-1){const V=document.createElement("div");V.textContent=D,P.push(V),D.length>0&&(v=V),D=""}}return{bufferElements:P,cursorElement:v}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let m=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(_,m){const v=this._optionsService.rawOptions.fastScrollModifier;return v==="alt"&&m.altKey||v==="ctrl"&&m.ctrlKey||v==="shift"&&m.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const m=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(_,m))}};a.Viewport=g=u([d(2,y.IBufferService),d(3,y.IOptionsService),d(4,b.ICharSizeService),d(5,b.IRenderService),d(6,b.ICoreBrowserService),d(7,b.IThemeService)],g)},3107:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const c=l(4725),b=l(844),C=l(2585);let S=a.BufferDecorationRenderer=class extends b.Disposable{constructor(y,g,_,m,v){super(),this._screenElement=y,this._bufferService=g,this._coreBrowserService=_,this._decorationService=m,this._renderService=v,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((D=>this._removeDecoration(D)))),this.register((0,b.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 y of this._decorationService.decorations)this._renderDecoration(y);this._dimensionsChanged=!1}_renderDecoration(y){this._refreshStyle(y),this._dimensionsChanged&&this._refreshXPosition(y)}_createElement(y){var m;const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",((m=y==null?void 0:y.options)==null?void 0:m.layer)==="top"),g.style.width=`${Math.round((y.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(y.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(y.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=y.options.x??0;return _&&_>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(y,g),g}_refreshStyle(y){const g=y.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)y.element&&(y.element.style.display="none",y.onRenderEmitter.fire(y.element));else{let _=this._decorationElements.get(y);_||(_=this._createElement(y),y.element=_,this._decorationElements.set(y,_),this._container.appendChild(_),y.onDispose((()=>{this._decorationElements.delete(y),_.remove()}))),_.style.top=g*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",y.onRenderEmitter.fire(_)}}_refreshXPosition(y,g=y.element){if(!g)return;const _=y.options.x??0;(y.options.anchor||"left")==="right"?g.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(y){var g;(g=this._decorationElements.get(y))==null||g.remove(),this._decorationElements.delete(y),y.dispose()}};a.BufferDecorationRenderer=S=u([d(1,C.IBufferService),d(2,c.ICoreBrowserService),d(3,C.IDecorationService),d(4,c.IRenderService)],S)},5871:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.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(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,u){return u>=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,d){return u>=l.startBufferLine-this._linePadding[d||"full"]&&u<=l.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(w,a,l){var u=this&&this.__decorate||function(v,D,P,T){var A,E=arguments.length,I=E<3?D:T===null?T=Object.getOwnPropertyDescriptor(D,P):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(v,D,P,T);else for(var z=v.length-1;z>=0;z--)(A=v[z])&&(I=(E<3?A(I):E>3?A(D,P,I):A(D,P))||I);return E>3&&I&&Object.defineProperty(D,P,I),I},d=this&&this.__param||function(v,D){return function(P,T){D(P,T,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const c=l(5871),b=l(4725),C=l(844),S=l(2585),y={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let m=a.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(v,D,P,T,A,E,I){var H;super(),this._viewportElement=v,this._screenElement=D,this._bufferService=P,this._decorationService=T,this._renderService=A,this._optionsService=E,this._coreBrowserService=I,this._colorZoneStore=new c.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(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{var V;(V=this._canvas)==null||V.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 v=Math.floor(this._canvas.width/3),D=Math.ceil(this._canvas.width/3);g.full=this._canvas.width,g.left=v,g.center=D,g.right=v,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=g.left,_.right=g.left+g.center}_refreshDrawHeightConstants(){y.full=Math.round(2*this._coreBrowserService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,D=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowserService.dpr);y.left=D,y.center=D,y.right=D}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.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 D of this._decorationService.decorations)this._colorZoneStore.addDecoration(D);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const D of v)D.position!=="full"&&this._renderColorZone(D);for(const D of v)D.position==="full"&&this._renderColorZone(D);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(_[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-y[v.position||"full"]/2),g[v.position||"full"],Math.round((this._canvas.height-1)*((v.endBufferLine-v.startBufferLine)/this._bufferService.buffers.active.lines.length)+y[v.position||"full"]))}_queueRefresh(v,D){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=D||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=m=u([d(2,S.IBufferService),d(3,S.IDecorationService),d(4,b.IRenderService),d(5,S.IOptionsService),d(6,b.ICoreBrowserService)],m)},2950:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const c=l(4725),b=l(2585),C=l(2584);let S=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(y,g,_,m,v,D){this._textarea=y,this._compositionView=g,this._bufferService=_,this._optionsService=m,this._coreService=v,this._renderService=D,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(y){this._compositionView.textContent=y.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(y){if(this._isComposing||this._isSendingComposition){if(y.keyCode===229||y.keyCode===16||y.keyCode===17||y.keyCode===18)return!1;this._finalizeComposition(!1)}return y.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(y){if(this._compositionView.classList.remove("active"),this._isComposing=!1,y){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const y=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,_=g.replace(y,"");this._dataAlreadySent=_,g.length>y.length?this._coreService.triggerDataEvent(_,!0):g.length<y.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):g.length===y.length&&g!==y&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(y){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),_=this._renderService.dimensions.css.cell.height,m=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,v=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=v+"px",this._compositionView.style.top=m+"px",this._compositionView.style.height=_+"px",this._compositionView.style.lineHeight=_+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const D=this._compositionView.getBoundingClientRect();this._textarea.style.left=v+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(D.width,1)+"px",this._textarea.style.height=Math.max(D.height,1)+"px",this._textarea.style.lineHeight=D.height+"px"}y||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=S=u([d(2,b.IBufferService),d(3,b.IOptionsService),d(4,b.ICoreService),d(5,c.IRenderService)],S)},9806:(w,a)=>{function l(u,d,c){const b=c.getBoundingClientRect(),C=u.getComputedStyle(c),S=parseInt(C.getPropertyValue("padding-left")),y=parseInt(C.getPropertyValue("padding-top"));return[d.clientX-b.left-S,d.clientY-b.top-y]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,d,c,b,C,S,y,g,_){if(!S)return;const m=l(u,d,c);return m?(m[0]=Math.ceil((m[0]+(_?y/2:0))/y),m[1]=Math.ceil(m[1]/g),m[0]=Math.min(Math.max(m[0],1),b+(_?1:0)),m[1]=Math.min(Math.max(m[1],1),C),m):void 0}},9504:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function d(g,_,m,v){const D=g-c(g,m),P=_-c(_,m),T=Math.abs(D-P)-(function(A,E,I){let z=0;const H=A-c(A,I),V=E-c(E,I);for(let F=0;F<Math.abs(H-V);F++){const q=b(A,E)==="A"?-1:1,W=I.buffer.lines.get(H+q*F);W!=null&&W.isWrapped&&z++}return z})(g,_,m);return y(T,S(b(g,_),v))}function c(g,_){let m=0,v=_.buffer.lines.get(g),D=v==null?void 0:v.isWrapped;for(;D&&g>=0&&g<_.rows;)m++,v=_.buffer.lines.get(--g),D=v==null?void 0:v.isWrapped;return m}function b(g,_){return g>_?"A":"B"}function C(g,_,m,v,D,P){let T=g,A=_,E="";for(;T!==m||A!==v;)T+=D?1:-1,D&&T>P.cols-1?(E+=P.buffer.translateBufferLineToString(A,!1,g,T),T=0,g=0,A++):!D&&T<0&&(E+=P.buffer.translateBufferLineToString(A,!1,0,g+1),T=P.cols-1,g=T,A--);return E+P.buffer.translateBufferLineToString(A,!1,g,T)}function S(g,_){const m=_?"O":"[";return u.C0.ESC+m+g}function y(g,_){g=Math.floor(g);let m="";for(let v=0;v<g;v++)m+=_;return m}a.moveToCellSequence=function(g,_,m,v){const D=m.buffer.x,P=m.buffer.y;if(!m.buffer.hasScrollback)return(function(E,I,z,H,V,F){return d(I,H,V,F).length===0?"":y(C(E,I,E,I-c(I,V),!1,V).length,S("D",F))})(D,P,0,_,m,v)+d(P,_,m,v)+(function(E,I,z,H,V,F){let q;q=d(I,H,V,F).length>0?H-c(H,V):I;const W=H,K=(function(ie,J,L,B,R,G){let X;return X=d(L,B,R,G).length>0?B-c(B,R):J,ie<L&&X<=B||ie>=L&&X<B?"C":"D"})(E,I,z,H,V,F);return y(C(E,q,z,W,K==="C",V).length,S(K,F))})(D,P,g,_,m,v);let T;if(P===_)return T=D>g?"D":"C",y(Math.abs(D-g),S(T,v));T=P>_?"D":"C";const A=Math.abs(P-_);return y((function(E,I){return I.cols-E})(P>_?g:D,m)+(A-1)*m.cols+1+((P>_?D:g)-1),S(T,v))}},1296:function(w,a,l){var u=this&&this.__decorate||function(F,q,W,K){var ie,J=arguments.length,L=J<3?q:K===null?K=Object.getOwnPropertyDescriptor(q,W):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(F,q,W,K);else for(var B=F.length-1;B>=0;B--)(ie=F[B])&&(L=(J<3?ie(L):J>3?ie(q,W,L):ie(q,W))||L);return J>3&&L&&Object.defineProperty(q,W,L),L},d=this&&this.__param||function(F,q){return function(W,K){q(W,K,F)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const c=l(3787),b=l(2550),C=l(2223),S=l(6171),y=l(6052),g=l(4725),_=l(8055),m=l(8460),v=l(844),D=l(2585),P="xterm-dom-renderer-owner-",T="xterm-rows",A="xterm-fg-",E="xterm-bg-",I="xterm-focus",z="xterm-selection";let H=1,V=a.DomRenderer=class extends v.Disposable{constructor(F,q,W,K,ie,J,L,B,R,G,X,oe,ae){super(),this._terminal=F,this._document=q,this._element=W,this._screenElement=K,this._viewportElement=ie,this._helperContainer=J,this._linkifier2=L,this._charSizeService=R,this._optionsService=G,this._bufferService=X,this._coreBrowserService=oe,this._themeService=ae,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,y.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((me=>this._injectCss(me)))),this._injectCss(this._themeService.colors),this._rowFactory=B.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(P+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((me=>this._handleLinkHover(me)))),this.register(this._linkifier2.onHideLinkUnderline((me=>this._handleLinkLeave(me)))),this.register((0,v.toDisposable)((()=>{this._element.classList.remove(P+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new b.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 W of this._rowElements)W.style.width=`${this.dimensions.css.canvas.width}px`,W.style.height=`${this.dimensions.css.cell.height}px`,W.style.lineHeight=`${this.dimensions.css.cell.height}px`,W.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const q=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=q,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 q=`${this._terminalSelector} .${T} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;q+=`${this._terminalSelector} .${T} .xterm-dim { color: ${_.color.multiplyOpacity(F.foreground,.5).css};}`,q+=`${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 W=`blink_underline_${this._terminalClass}`,K=`blink_bar_${this._terminalClass}`,ie=`blink_block_${this._terminalClass}`;q+=`@keyframes ${W} { 50% { border-bottom-style: hidden; }}`,q+=`@keyframes ${K} { 50% { box-shadow: none; }}`,q+=`@keyframes ${ie} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,q+=`${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${W} 1s step-end infinite;}${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${ie} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,q+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[J,L]of F.ansi.entries())q+=`${this._terminalSelector} .${A}${J} { color: ${L.css}; }${this._terminalSelector} .${A}${J}.xterm-dim { color: ${_.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${E}${J} { background-color: ${L.css}; }`;q+=`${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque(F.background).css}; }${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${E}${C.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=q}_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,q){for(let W=this._rowElements.length;W<=q;W++){const K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}for(;this._rowElements.length>q;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,q){this._refreshRowElements(F,q),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,q,W){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,q,W),this.renderRows(0,this._bufferService.rows-1),!F||!q)return;this._selectionRenderModel.update(this._terminal,F,q,W);const K=this._selectionRenderModel.viewportStartRow,ie=this._selectionRenderModel.viewportEndRow,J=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(J>=this._bufferService.rows||L<0)return;const B=this._document.createDocumentFragment();if(W){const R=F[0]>q[0];B.appendChild(this._createSelectionElement(J,R?q[0]:F[0],R?F[0]:q[0],L-J+1))}else{const R=K===J?F[0]:0,G=J===ie?q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(J,R,G));const X=L-J-1;if(B.appendChild(this._createSelectionElement(J+1,0,this._bufferService.cols,X)),J!==L){const oe=ie===L?q[0]:this._bufferService.cols;B.appendChild(this._createSelectionElement(L,0,oe))}}this._selectionContainer.appendChild(B)}_createSelectionElement(F,q,W,K=1){const ie=this._document.createElement("div"),J=q*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(W-q);return J+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-J),ie.style.height=K*this.dimensions.css.cell.height+"px",ie.style.top=F*this.dimensions.css.cell.height+"px",ie.style.left=`${J}px`,ie.style.width=`${L}px`,ie}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,q){const W=this._bufferService.buffer,K=W.ybase+W.y,ie=Math.min(W.x,this._bufferService.cols-1),J=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,B=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=F;R<=q;R++){const G=R+W.ydisp,X=this._rowElements[R],oe=W.lines.get(G);if(!X||!oe)break;X.replaceChildren(...this._rowFactory.createRow(oe,G,G===K,L,B,ie,J,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${P}${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,q,W,K,ie,J){W<0&&(F=0),K<0&&(q=0);const L=this._bufferService.rows-1;W=Math.max(Math.min(W,L),0),K=Math.max(Math.min(K,L),0),ie=Math.min(ie,this._bufferService.cols);const B=this._bufferService.buffer,R=B.ybase+B.y,G=Math.min(B.x,ie-1),X=this._optionsService.rawOptions.cursorBlink,oe=this._optionsService.rawOptions.cursorStyle,ae=this._optionsService.rawOptions.cursorInactiveStyle;for(let me=W;me<=K;++me){const $=me+B.ydisp,O=this._rowElements[me],le=B.lines.get($);if(!O||!le)break;O.replaceChildren(...this._rowFactory.createRow(le,$,$===R,oe,ae,G,X,this.dimensions.css.cell.width,this._widthCache,J?me===W?F:0:-1,J?(me===K?q:ie)-1:-1))}}};a.DomRenderer=V=u([d(7,D.IInstantiationService),d(8,g.ICharSizeService),d(9,D.IOptionsService),d(10,D.IBufferService),d(11,g.ICoreBrowserService),d(12,g.IThemeService)],V)},3787:function(w,a,l){var u=this&&this.__decorate||function(T,A,E,I){var z,H=arguments.length,V=H<3?A:I===null?I=Object.getOwnPropertyDescriptor(A,E):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")V=Reflect.decorate(T,A,E,I);else for(var F=T.length-1;F>=0;F--)(z=T[F])&&(V=(H<3?z(V):H>3?z(A,E,V):z(A,E))||V);return H>3&&V&&Object.defineProperty(A,E,V),V},d=this&&this.__param||function(T,A){return function(E,I){A(E,I,T)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const c=l(2223),b=l(643),C=l(511),S=l(2585),y=l(8055),g=l(4725),_=l(4269),m=l(6171),v=l(3734);let D=a.DomRendererRowFactory=class{constructor(T,A,E,I,z,H,V){this._document=T,this._characterJoinerService=A,this._optionsService=E,this._coreBrowserService=I,this._coreService=z,this._decorationService=H,this._themeService=V,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,A,E){this._selectionStart=T,this._selectionEnd=A,this._columnSelectMode=E}createRow(T,A,E,I,z,H,V,F,q,W,K){const ie=[],J=this._characterJoinerService.getJoinedCharacters(A),L=this._themeService.colors;let B,R=T.getNoBgTrimmedLength();E&&R<H+1&&(R=H+1);let G=0,X="",oe=0,ae=0,me=0,$=!1,O=0,le=!1,se=0;const ge=[],fe=W!==-1&&K!==-1;for(let Me=0;Me<R;Me++){T.loadCell(Me,this._workCell);let We=this._workCell.getWidth();if(We===0)continue;let je=!1,ot=Me,Ae=this._workCell;if(J.length>0&&Me===J[0][0]){je=!0;const Ye=J.shift();Ae=new _.JoinedCellData(this._workCell,T.translateToString(!0,Ye[0],Ye[1]),Ye[1]-Ye[0]),ot=Ye[1]-1,We=Ae.getWidth()}const ve=this._isCellInSelection(Me,A),Ie=E&&Me===H,$e=fe&&Me>=W&&Me<=K;let st=!1;this._decorationService.forEachDecorationAtCell(Me,A,void 0,(Ye=>{st=!0}));let Dt=Ae.getChars()||b.WHITESPACE_CELL_CHAR;if(Dt===" "&&(Ae.isUnderline()||Ae.isOverline())&&(Dt=" "),se=We*F-q.get(Dt,Ae.isBold(),Ae.isItalic()),B){if(G&&(ve&&le||!ve&&!le&&Ae.bg===oe)&&(ve&&le&&L.selectionForeground||Ae.fg===ae)&&Ae.extended.ext===me&&$e===$&&se===O&&!Ie&&!je&&!st){Ae.isInvisible()?X+=b.WHITESPACE_CELL_CHAR:X+=Dt,G++;continue}G&&(B.textContent=X),B=this._document.createElement("span"),G=0,X=""}else B=this._document.createElement("span");if(oe=Ae.bg,ae=Ae.fg,me=Ae.extended.ext,$=$e,O=se,le=ve,je&&H>=Me&&H<=ot&&(H=Me),!this._coreService.isCursorHidden&&Ie&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)V&&ge.push("xterm-cursor-blink"),ge.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(Ae.isBold()&&ge.push("xterm-bold"),Ae.isItalic()&&ge.push("xterm-italic"),Ae.isDim()&&ge.push("xterm-dim"),X=Ae.isInvisible()?b.WHITESPACE_CELL_CHAR:Ae.getChars()||b.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(ge.push(`xterm-underline-${Ae.extended.underlineStyle}`),X===" "&&(X=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())B.style.textDecorationColor=`rgb(${v.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let Ye=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&Ye<8&&(Ye+=8),B.style.textDecorationColor=L.ansi[Ye].css}Ae.isOverline()&&(ge.push("xterm-overline"),X===" "&&(X=" ")),Ae.isStrikethrough()&&ge.push("xterm-strikethrough"),$e&&(B.style.textDecoration="underline");let Ne=Ae.getFgColor(),Si=Ae.getFgColorMode(),At=Ae.getBgColor(),mt=Ae.getBgColorMode();const ut=!!Ae.isInverse();if(ut){const Ye=Ne;Ne=At,At=Ye;const Bs=Si;Si=mt,mt=Bs}let Ke,ai,gt,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(Me,A,void 0,(Ye=>{Ye.options.layer!=="top"&&Rt||(Ye.backgroundColorRGB&&(mt=50331648,At=Ye.backgroundColorRGB.rgba>>8&16777215,Ke=Ye.backgroundColorRGB),Ye.foregroundColorRGB&&(Si=50331648,Ne=Ye.foregroundColorRGB.rgba>>8&16777215,ai=Ye.foregroundColorRGB),Rt=Ye.options.layer==="top")})),!Rt&&ve&&(Ke=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,At=Ke.rgba>>8&16777215,mt=50331648,Rt=!0,L.selectionForeground&&(Si=50331648,Ne=L.selectionForeground.rgba>>8&16777215,ai=L.selectionForeground)),Rt&&ge.push("xterm-decoration-top"),mt){case 16777216:case 33554432:gt=L.ansi[At],ge.push(`xterm-bg-${At}`);break;case 50331648:gt=y.channels.toColor(At>>16,At>>8&255,255&At),this._addStyle(B,`background-color:#${P((At>>>0).toString(16),"0",6)}`);break;default:ut?(gt=L.foreground,ge.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):gt=L.background}switch(Ke||Ae.isDim()&&(Ke=y.color.multiplyOpacity(gt,.5)),Si){case 16777216:case 33554432:Ae.isBold()&&Ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ne+=8),this._applyMinimumContrast(B,gt,L.ansi[Ne],Ae,Ke,void 0)||ge.push(`xterm-fg-${Ne}`);break;case 50331648:const Ye=y.channels.toColor(Ne>>16&255,Ne>>8&255,255&Ne);this._applyMinimumContrast(B,gt,Ye,Ae,Ke,ai)||this._addStyle(B,`color:#${P(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(B,gt,L.foreground,Ae,Ke,ai)||ut&&ge.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}ge.length&&(B.className=ge.join(" "),ge.length=0),Ie||je||st?B.textContent=X:G++,se!==this.defaultSpacing&&(B.style.letterSpacing=`${se}px`),ie.push(B),Me=ot}return B&&G&&(B.textContent=X),ie}_applyMinimumContrast(T,A,E,I,z,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const V=this._getContrastCache(I);let F;if(z||H||(F=V.getColor(A.rgba,E.rgba)),F===void 0){const q=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);F=y.color.ensureContrastRatio(z||A,H||E,q),V.setColor((z||A).rgba,(H||E).rgba,F??null)}return!!F&&(this._addStyle(T,`color:${F.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,A){T.setAttribute("style",`${T.getAttribute("style")||""}${A};`)}_isCellInSelection(T,A){const E=this._selectionStart,I=this._selectionEnd;return!(!E||!I)&&(this._columnSelectMode?E[0]<=I[0]?T>=E[0]&&A>=E[1]&&T<I[0]&&A<=I[1]:T<E[0]&&A>=E[1]&&T>=I[0]&&A<=I[1]:A>E[1]&&A<I[1]||E[1]===I[1]&&A===E[1]&&T>=E[0]&&T<I[0]||E[1]<I[1]&&A===I[1]&&T<I[0]||E[1]<I[1]&&A===E[1]&&T>=E[0])}};function P(T,A,E){for(;T.length<E;)T=A+T;return T}a.DomRendererRowFactory=D=u([d(1,g.ICharacterJoinerService),d(2,S.IOptionsService),d(3,g.ICoreBrowserService),d(4,S.ICoreService),d(5,S.IDecorationService),d(6,g.IThemeService)],D)},2550:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.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 d=l.createElement("span");d.classList.add("xterm-char-measure-element");const c=l.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const b=l.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const C=l.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[d,c,b,C],this._container.appendChild(d),this._container.appendChild(c),this._container.appendChild(b),this._container.appendChild(C),u.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(l,u,d,c){l===this._font&&u===this._fontSize&&d===this._weight&&c===this._weightBold||(this._font=l,this._fontSize=u,this._weight=d,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(l,u,d){let c=0;if(!u&&!d&&l.length===1&&(c=l.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const S=this._measure(l,0);return S>0&&(this._flat[c]=S),S}let b=l;u&&(b+="B"),d&&(b+="I");let C=this._holey.get(b);if(C===void 0){let S=0;u&&(S|=1),d&&(S|=2),C=this._measure(l,S),C>0&&this._holey.set(b,C)}return C}_measure(l,u){const d=this._measureElements[u];return d.textContent=l.repeat(32),d.offsetWidth/32}}},2223:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(w,a)=>{function l(d){return 57508<=d&&d<=57558}function u(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},a.isEmoji=u,a.allowRescaling=function(d,c,b,C){return c===1&&b>Math.ceil(1.5*C)&&d!==void 0&&d>255&&!u(d)&&!l(d)&&!(function(S){return 57344<=S&&S<=63743})(d)},a.treatGlyphAsBackgroundColor=function(d){return l(d)||(function(c){return 9472<=c&&c<=9631})(d)},a.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}}}},a.computeNextVariantOffset=function(d,c,b=0){return(d-(2*Math.round(c)-b))%(2*Math.round(c))}},6052:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{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,c,b,C=!1){if(this.selectionStart=c,this.selectionEnd=b,!c||!b||c[0]===b[0]&&c[1]===b[1])return void this.clear();const S=d.buffers.active.ydisp,y=c[1]-S,g=b[1]-S,_=Math.max(y,0),m=Math.min(g,d.rows-1);_>=d.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=y,this.viewportEndRow=g,this.viewportCappedStartRow=_,this.viewportCappedEndRow=m,this.startCol=c[0],this.endCol=b[0])}isCellSelected(d,c,b){return!!this.hasSelection&&(b-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&b>=this.viewportCappedStartRow&&c<this.endCol&&b<=this.viewportCappedEndRow:c<this.startCol&&b>=this.viewportCappedStartRow&&c>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&c>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,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 l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const c=l(2585),b=l(8460),C=l(844);let S=a.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,v,D){super(),this._optionsService=D,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new g(m,v,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};a.CharSizeService=S=u([d(2,c.IOptionsService)],S);class y extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(v,D){v!==void 0&&v>0&&D!==void 0&&D>0&&(this._result.width=v,this._result.height=D)}}class g extends y{constructor(v,D,P){super(),this._document=v,this._parentElement=D,this._optionsService=P,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 _ extends y{constructor(v){super(),this._optionsService=v,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const D=this._ctx.measureText("W");if(!("width"in D&&"fontBoundingBoxAscent"in D&&"fontBoundingBoxDescent"in D))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const v=this._ctx.measureText("W");return this._validateAndSet(v.width,v.fontBoundingBoxAscent+v.fontBoundingBoxDescent),this._result}}},4269:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const c=l(3734),b=l(643),C=l(511),S=l(2585);class y extends c.AttributeData{constructor(m,v,D){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=v,this._width=D}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=y;let g=a.CharacterJoinerService=class zp{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(m){const v={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(v),v.id}deregister(m){for(let v=0;v<this._characterJoiners.length;v++)if(this._characterJoiners[v].id===m)return this._characterJoiners.splice(v,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const v=this._bufferService.buffer.lines.get(m);if(!v||v.length===0)return[];const D=[],P=v.translateToString(!0);let T=0,A=0,E=0,I=v.getFg(0),z=v.getBg(0);for(let H=0;H<v.getTrimmedLength();H++)if(v.loadCell(H,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==z){if(H-T>1){const V=this._getJoinedRanges(P,E,A,v,T);for(let F=0;F<V.length;F++)D.push(V[F])}T=H,E=A,I=this._workCell.fg,z=this._workCell.bg}A+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const H=this._getJoinedRanges(P,E,A,v,T);for(let V=0;V<H.length;V++)D.push(H[V])}return D}_getJoinedRanges(m,v,D,P,T){const A=m.substring(v,D);let E=[];try{E=this._characterJoiners[0].handler(A)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const z=this._characterJoiners[I].handler(A);for(let H=0;H<z.length;H++)zp._mergeRanges(E,z[H])}catch(z){console.error(z)}return this._stringRangesToCellRanges(E,P,T),E}_stringRangesToCellRanges(m,v,D){let P=0,T=!1,A=0,E=m[P];if(E){for(let I=D;I<this._bufferService.cols;I++){const z=v.getWidth(I),H=v.getString(I).length||b.WHITESPACE_CELL_CHAR.length;if(z!==0){if(!T&&E[0]<=A&&(E[0]=I,T=!0),E[1]<=A){if(E[1]=I,E=m[++P],!E)break;E[0]<=A?(E[0]=I,T=!0):T=!1}A+=H}}E&&(E[1]=this._bufferService.cols)}}static _mergeRanges(m,v){let D=!1;for(let P=0;P<m.length;P++){const T=m[P];if(D){if(v[1]<=T[0])return m[P-1][1]=v[1],m;if(v[1]<=T[1])return m[P-1][1]=Math.max(v[1],T[1]),m.splice(P,1),m;m.splice(P,1),P--}else{if(v[1]<=T[0])return m.splice(P,0,v),m;if(v[1]<=T[1])return T[0]=Math.min(v[0],T[0]),m;v[0]<T[1]&&(T[0]=Math.min(v[0],T[0]),D=!0)}}return D?m[m.length-1][1]=v[1]:m.push(v),m}};a.CharacterJoinerService=g=u([d(0,S.IBufferService)],g)},5114:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),d=l(8460),c=l(3656);class b extends u.Disposable{constructor(y,g,_){super(),this._textarea=y,this._window=g,this.mainDocument=_,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((m=>this._screenDprMonitor.setWindow(m)))),this.register((0,d.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(y){this._window!==y&&(this._window=y,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}}a.CoreBrowserService=b;class C extends u.Disposable{constructor(y){super(),this._parentWindow=y,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(y){this._parentWindow=y,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var y;this._outerListener&&((y=this._resolutionMediaMatchList)==null||y.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:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const u=l(844);class d extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const C=this.linkProviders.indexOf(b);C!==-1&&this.linkProviders.splice(C,1)}}}}a.LinkProviderService=d},8934:function(w,a,l){var u=this&&this.__decorate||function(S,y,g,_){var m,v=arguments.length,D=v<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,y,g,_);else for(var P=S.length-1;P>=0;P--)(m=S[P])&&(D=(v<3?m(D):v>3?m(y,g,D):m(y,g))||D);return v>3&&D&&Object.defineProperty(y,g,D),D},d=this&&this.__param||function(S,y){return function(g,_){y(g,_,S)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const c=l(4725),b=l(9806);let C=a.MouseService=class{constructor(S,y){this._renderService=S,this._charSizeService=y}getCoords(S,y,g,_,m){return(0,b.getCoords)(window,S,y,g,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(S,y){const g=(0,b.getCoordsRelativeToElement)(window,S,y);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};a.MouseService=C=u([d(0,c.IRenderService),d(1,c.ICharSizeService)],C)},3230:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const c=l(6193),b=l(4725),C=l(8460),S=l(844),y=l(7226),g=l(2585);let _=a.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,v,D,P,T,A,E,I){super(),this._rowCount=m,this._charSizeService=P,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new y.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer(((z,H)=>this._renderRows(z,H)),E),this.register(this._renderDebouncer),this.register(E.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(A.onResize((()=>this._fullRefresh()))),this.register(A.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(D.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(D.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(A.cols,A.rows),this._fullRefresh()}))),this.register(D.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(A.buffer.y,A.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(E.window,v),this.register(E.onWindowChange((z=>this._registerIntersectionObserver(z,v))))}_registerIntersectionObserver(m,v){if("IntersectionObserver"in m){const D=new m.IntersectionObserver((P=>this._handleIntersectionChange(P[P.length-1])),{threshold:0});D.observe(v),this._observerDisposable.value=(0,S.toDisposable)((()=>D.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.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(m,v,D=!1){this._isPaused?this._needsFullRefresh=!0:(D||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,v,this._rowCount))}_renderRows(m,v){this._renderer.value&&(m=Math.min(m,this._rowCount-1),v=Math.min(v,this._rowCount-1),this._renderer.value.renderRows(m,v),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:m,end:v}),this._onRender.fire({start:m,end:v}),this._isNextRenderRedrawOnly=!0)}resize(m,v){this._rowCount=v,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(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((v=>this.refreshRows(v.start,v.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,v;this._renderer.value&&((v=(m=this._renderer.value).clearTextureAtlas)==null||v.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,v){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var D;return(D=this._renderer.value)==null?void 0:D.handleResize(m,v)})):this._renderer.value.handleResize(m,v),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,v,D){var P;this._selectionState.start=m,this._selectionState.end=v,this._selectionState.columnSelectMode=D,(P=this._renderer.value)==null||P.handleSelectionChanged(m,v,D)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};a.RenderService=_=u([d(2,g.IOptionsService),d(3,b.ICharSizeService),d(4,g.IDecorationService),d(5,g.IBufferService),d(6,b.ICoreBrowserService),d(7,b.IThemeService)],_)},9312:function(w,a,l){var u=this&&this.__decorate||function(E,I,z,H){var V,F=arguments.length,q=F<3?I:H===null?H=Object.getOwnPropertyDescriptor(I,z):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(E,I,z,H);else for(var W=E.length-1;W>=0;W--)(V=E[W])&&(q=(F<3?V(q):F>3?V(I,z,q):V(I,z))||q);return F>3&&q&&Object.defineProperty(I,z,q),q},d=this&&this.__param||function(E,I){return function(z,H){I(z,H,E)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const c=l(9806),b=l(9504),C=l(456),S=l(4725),y=l(8460),g=l(844),_=l(6114),m=l(4841),v=l(511),D=l(2585),P=" ",T=new RegExp(P,"g");let A=a.SelectionService=class extends g.Disposable{constructor(E,I,z,H,V,F,q,W,K){super(),this._element=E,this._screenElement=I,this._linkifier=z,this._bufferService=H,this._coreService=V,this._mouseService=F,this._optionsService=q,this._renderService=W,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new v.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new y.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new y.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new y.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=ie=>this._handleMouseMove(ie),this._mouseUpListener=ie=>this._handleMouseUp(ie),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((ie=>this._handleTrim(ie))),this.register(this._bufferService.buffers.onBufferActivate((ie=>this._handleBufferActivate(ie)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.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 E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!E||!I||E[0]===I[0]&&E[1]===I[1])}get selectionText(){const E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!E||!I)return"";const z=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(E[0]===I[0])return"";const V=E[0]<I[0]?E[0]:I[0],F=E[0]<I[0]?I[0]:E[0];for(let q=E[1];q<=I[1];q++){const W=z.translateBufferLineToString(q,!0,V,F);H.push(W)}}else{const V=E[1]===I[1]?I[0]:void 0;H.push(z.translateBufferLineToString(E[1],!0,E[0],V));for(let F=E[1]+1;F<=I[1]-1;F++){const q=z.lines.get(F),W=z.translateBufferLineToString(F,!0);q!=null&&q.isWrapped?H[H.length-1]+=W:H.push(W)}if(E[1]!==I[1]){const F=z.lines.get(I[1]),q=z.translateBufferLineToString(I[1],!0,0,I[0]);F&&F.isWrapped?H[H.length-1]+=q:H.push(q)}}return H.map((V=>V.replace(T," "))).join(_.isWindows?`\r
64
+ WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=g}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=C=u([d(0,b.IBufferService),d(1,b.IOptionsService),d(2,b.IOscLinkService)],C)},6193:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(l,u){this._renderCallback=l,this._coreBrowserService=u,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(l){return this._refreshCallbacks.push(l),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(l,u,d){this._rowCount=d,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u,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 l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const l of this._refreshCallbacks)l(0);this._refreshCallbacks=[]}}},3236:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const u=l(3614),d=l(3656),c=l(3551),b=l(9042),C=l(3730),S=l(1680),y=l(3107),g=l(5744),_=l(2950),m=l(1296),v=l(428),D=l(4269),P=l(5114),T=l(8934),A=l(3230),E=l(9312),I=l(4725),B=l(6731),N=l(8055),W=l(8969),F=l(8460),q=l(844),V=l(6114),K=l(8437),ie=l(2584),Z=l(7399),L=l(5941),H=l(9074),R=l(2585),G=l(5435),X=l(4567),oe=l(779);class ae extends W.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($={}){super($),this.browser=V,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new q.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(H.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(oe.LinkProviderService),this._instantiationService.setService(I.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((O,le)=>this.refresh(O,le)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((O=>this._reportWindowsOptions(O)))),this.register(this._inputHandler.onColor((O=>this._handleColorEvent(O)))),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((O=>this._afterResize(O.cols,O.rows)))),this.register((0,q.toDisposable)((()=>{var O,le;this._customKeyEventHandler=void 0,(le=(O=this.element)==null?void 0:O.parentNode)==null||le.removeChild(this.element)})))}_handleColorEvent($){if(this._themeService)for(const O of $){let le,se="";switch(O.index){case 256:le="foreground",se="10";break;case 257:le="background",se="11";break;case 258:le="cursor",se="12";break;default:le="ansi",se="4;"+O.index}switch(O.type){case 0:const ge=N.color.toColorRGB(le==="ansi"?this._themeService.colors.ansi[O.index]:this._themeService.colors[le]);this.coreService.triggerDataEvent(`${ie.C0.ESC}]${se};${(0,L.toRgbString)(ge)}${ie.C1_ESCAPED.ST}`);break;case 1:if(le==="ansi")this._themeService.modifyColors((fe=>fe.ansi[O.index]=N.channels.toColor(...O.color)));else{const fe=le;this._themeService.modifyColors((Me=>Me[fe]=N.channels.toColor(...O.color)))}break;case 2:this._themeService.restoreColor(O.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange($){$?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(X.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus($){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var $;return($=this.textarea)==null?void 0:$.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(ie.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 $=this.buffer.ybase+this.buffer.y,O=this.buffer.lines.get($);if(!O)return;const le=Math.min(this.buffer.x,this.cols-1),se=this._renderService.dimensions.css.cell.height,ge=O.getWidth(le),fe=this._renderService.dimensions.css.cell.width*ge,Me=this.buffer.y*this._renderService.dimensions.css.cell.height,We=le*this._renderService.dimensions.css.cell.width;this.textarea.style.left=We+"px",this.textarea.style.top=Me+"px",this.textarea.style.width=fe+"px",this.textarea.style.height=se+"px",this.textarea.style.lineHeight=se+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,d.addDisposableDomListener)(this.element,"copy",(O=>{this.hasSelection()&&(0,u.copyHandler)(O,this._selectionService)})));const $=O=>(0,u.handlePasteEvent)(O,this.textarea,this.coreService,this.optionsService);this.register((0,d.addDisposableDomListener)(this.textarea,"paste",$)),this.register((0,d.addDisposableDomListener)(this.element,"paste",$)),V.isFirefox?this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(O=>{O.button===2&&(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,d.addDisposableDomListener)(this.element,"contextmenu",(O=>{(0,u.rightClickHandler)(O,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),V.isLinux&&this.register((0,d.addDisposableDomListener)(this.element,"auxclick",(O=>{O.button===1&&(0,u.moveTextAreaUnderMouseCursor)(O,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,d.addDisposableDomListener)(this.textarea,"keyup",($=>this._keyUp($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keydown",($=>this._keyDown($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"keypress",($=>this._keyPress($)),!0)),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionupdate",($=>this._compositionHelper.compositionupdate($)))),this.register((0,d.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,d.addDisposableDomListener)(this.textarea,"input",($=>this._inputEvent($)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open($){var le;if(!$)throw new Error("Terminal requires a parent element.");if($.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((le=this.element)==null?void 0:le.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=$.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"),$.appendChild(this.element);const O=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),O.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,d.addDisposableDomListener)(this.screenElement,"mousemove",(se=>this.updateCursorStyle(se)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),O.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",b.promptLabel),V.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(P.CoreBrowserService,this.textarea,$.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(I.ICoreBrowserService,this._coreBrowserService),this.register((0,d.addDisposableDomListener)(this.textarea,"focus",(se=>this._handleTextAreaFocus(se)))),this.register((0,d.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(v.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(I.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(B.ThemeService),this._instantiationService.setService(I.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(D.CharacterJoinerService),this._instantiationService.setService(I.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(A.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(I.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((se=>this._onRender.fire(se)))),this.onResize((se=>this._renderService.resize(se.cols,se.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(T.MouseService),this._instantiationService.setService(I.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(O);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((se=>this.scrollLines(se.amount,se.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(E.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(I.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((se=>this.scrollLines(se.amount,se.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((se=>this._renderService.handleSelectionChanged(se.start,se.end,se.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((se=>{this.textarea.value=se,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((se=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,d.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(y.BufferDecorationRenderer,this.screenElement)),this.register((0,d.addDisposableDomListener)(this.element,"mousedown",(se=>this._selectionService.handleMouseDown(se)))),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(X.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(se=>this._handleScreenReaderModeOptionChange(se)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(se=>{!this._overviewRulerRenderer&&se&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(g.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(m.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const $=this,O=this.element;function le(fe){const Me=$._mouseService.getMouseReportCoords(fe,$.screenElement);if(!Me)return!1;let We,je;switch(fe.overrideType||fe.type){case"mousemove":je=32,fe.buttons===void 0?(We=3,fe.button!==void 0&&(We=fe.button<3?fe.button:3)):We=1&fe.buttons?0:4&fe.buttons?1:2&fe.buttons?2:3;break;case"mouseup":je=0,We=fe.button<3?fe.button:3;break;case"mousedown":je=1,We=fe.button<3?fe.button:3;break;case"wheel":if($._customWheelEventHandler&&$._customWheelEventHandler(fe)===!1||$.viewport.getLinesScrolled(fe)===0)return!1;je=fe.deltaY<0?0:1,We=4;break;default:return!1}return!(je===void 0||We===void 0||We>4)&&$.coreMouseService.triggerMouseEvent({col:Me.col,row:Me.row,x:Me.x,y:Me.y,button:We,action:je,ctrl:fe.ctrlKey,alt:fe.altKey,shift:fe.shiftKey})}const se={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:fe=>(le(fe),fe.buttons||(this._document.removeEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.removeEventListener("mousemove",se.mousedrag)),this.cancel(fe)),wheel:fe=>(le(fe),this.cancel(fe,!0)),mousedrag:fe=>{fe.buttons&&le(fe)},mousemove:fe=>{fe.buttons||le(fe)}};this.register(this.coreMouseService.onProtocolChange((fe=>{fe?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(fe)),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&fe?se.mousemove||(O.addEventListener("mousemove",ge.mousemove),se.mousemove=ge.mousemove):(O.removeEventListener("mousemove",se.mousemove),se.mousemove=null),16&fe?se.wheel||(O.addEventListener("wheel",ge.wheel,{passive:!1}),se.wheel=ge.wheel):(O.removeEventListener("wheel",se.wheel),se.wheel=null),2&fe?se.mouseup||(se.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",se.mouseup),se.mouseup=null),4&fe?se.mousedrag||(se.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",se.mousedrag),se.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,d.addDisposableDomListener)(O,"mousedown",(fe=>{if(fe.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(fe))return le(fe),se.mouseup&&this._document.addEventListener("mouseup",se.mouseup),se.mousedrag&&this._document.addEventListener("mousemove",se.mousedrag),this.cancel(fe)}))),this.register((0,d.addDisposableDomListener)(O,"wheel",(fe=>{if(!se.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(fe)===!1)return!1;if(!this.buffer.hasScrollback){const Me=this.viewport.getLinesScrolled(fe);if(Me===0)return;const We=ie.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(fe.deltaY<0?"A":"B");let je="";for(let ot=0;ot<Math.abs(Me);ot++)je+=We;return this.coreService.triggerDataEvent(je,!0),this.cancel(fe,!0)}return this.viewport.handleWheel(fe)?this.cancel(fe):void 0}}),{passive:!1})),this.register((0,d.addDisposableDomListener)(O,"touchstart",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(fe),this.cancel(fe)}),{passive:!0})),this.register((0,d.addDisposableDomListener)(O,"touchmove",(fe=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(fe)?void 0:this.cancel(fe)}),{passive:!1}))}refresh($,O){var le;(le=this._renderService)==null||le.refreshRows($,O)}updateCursorStyle($){var O;(O=this._selectionService)!=null&&O.shouldColumnSelect($)?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($,O,le=0){var se;le===1?(super.scrollLines($,O,le),this.refresh(0,this.rows-1)):(se=this.viewport)==null||se.scrollLines($)}paste($){(0,u.paste)($,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler($){this._customKeyEventHandler=$}attachCustomWheelEventHandler($){this._customWheelEventHandler=$}registerLinkProvider($){return this._linkProviderService.registerLinkProvider($)}registerCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const O=this._characterJoinerService.register($);return this.refresh(0,this.rows-1),O}deregisterCharacterJoiner($){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister($)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker($){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+$)}registerDecoration($){return this._decorationService.registerDecoration($)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select($,O,le){this._selectionService.setSelection($,O,le)}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 $;($=this._selectionService)==null||$.clearSelection()}selectAll(){var $;($=this._selectionService)==null||$.selectAll()}selectLines($,O){var le;(le=this._selectionService)==null||le.selectLines($,O)}_keyDown($){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;const O=this.browser.isMac&&this.options.macOptionIsMeta&&$.altKey;if(!O&&!this._compositionHelper.keydown($))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;O||$.key!=="Dead"&&$.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const le=(0,Z.evaluateKeyboardEvent)($,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle($),le.type===3||le.type===2){const se=this.rows-1;return this.scrollLines(le.type===2?-se:se),this.cancel($,!0)}return le.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,$)||(le.cancel&&this.cancel($,!0),!le.key||!!($.key&&!$.ctrlKey&&!$.altKey&&!$.metaKey&&$.key.length===1&&$.key.charCodeAt(0)>=65&&$.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(le.key!==ie.C0.ETX&&le.key!==ie.C0.CR||(this.textarea.value=""),this._onKey.fire({key:le.key,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(le.key,!0),!this.optionsService.rawOptions.screenReaderMode||$.altKey||$.ctrlKey?this.cancel($,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift($,O){const le=$.isMac&&!this.options.macOptionIsMeta&&O.altKey&&!O.ctrlKey&&!O.metaKey||$.isWindows&&O.altKey&&O.ctrlKey&&!O.metaKey||$.isWindows&&O.getModifierState("AltGraph");return O.type==="keypress"?le:le&&(!O.keyCode||O.keyCode>47)}_keyUp($){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler($)===!1||((function(O){return O.keyCode===16||O.keyCode===17||O.keyCode===18})($)||this.focus(),this.updateCursorStyle($),this._keyPressHandled=!1)}_keyPress($){let O;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler($)===!1)return!1;if(this.cancel($),$.charCode)O=$.charCode;else if($.which===null||$.which===void 0)O=$.keyCode;else{if($.which===0||$.charCode===0)return!1;O=$.which}return!(!O||($.altKey||$.ctrlKey||$.metaKey)&&!this._isThirdLevelShift(this.browser,$)||(O=String.fromCharCode(O),this._onKey.fire({key:O,domEvent:$}),this._showCursor(),this.coreService.triggerDataEvent(O,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent($){if($.data&&$.inputType==="insertText"&&(!$.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const O=$.data;return this.coreService.triggerDataEvent(O,!0),this.cancel($),!0}return!1}resize($,O){$!==this.cols||O!==this.rows?super.resize($,O):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize($,O){var le,se;(le=this._charSizeService)==null||le.measure(),(se=this.viewport)==null||se.syncScrollArea(!0)}clear(){var $;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 O=1;O<this.rows;O++)this.buffer.lines.push(this.buffer.getBlankLine(K.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),($=this.viewport)==null||$.reset(),this.refresh(0,this.rows-1)}}reset(){var O,le;this.options.rows=this.rows,this.options.cols=this.cols;const $=this._customKeyEventHandler;this._setup(),super.reset(),(O=this._selectionService)==null||O.reset(),this._decorationService.reset(),(le=this.viewport)==null||le.reset(),this._customKeyEventHandler=$,this.refresh(0,this.rows-1)}clearTextureAtlas(){var $;($=this._renderService)==null||$.clearTextureAtlas()}_reportFocus(){var $;($=this.element)!=null&&$.classList.contains("focus")?this.coreService.triggerDataEvent(ie.C0.ESC+"[I"):this.coreService.triggerDataEvent(ie.C0.ESC+"[O")}_reportWindowsOptions($){if(this._renderService)switch($){case G.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const O=this._renderService.dimensions.css.canvas.width.toFixed(0),le=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.C0.ESC}[4;${le};${O}t`);break;case G.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const se=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${ie.C0.ESC}[6;${ge};${se}t`)}}cancel($,O){if(this.options.cancelEvents||O)return $.preventDefault(),$.stopPropagation(),!1}}a.Terminal=ae},9924:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(l,u=1e3){this._renderCallback=l,this._debounceThresholdMS=u,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(l,u,d){this._rowCount=d,l=l!==void 0?l:0,u=u!==void 0?u:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,l):l,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,u):u;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const b=c-this._lastRefreshMs,C=this._debounceThresholdMS-b;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const l=Math.max(this._rowStart,0),u=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(l,u)}}},1680:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const c=l(3656),b=l(4725),C=l(8460),S=l(844),y=l(2585);let g=a.Viewport=class extends S.Disposable{constructor(_,m,v,D,P,T,A,E){super(),this._viewportElement=_,this._scrollArea=m,this._bufferService=v,this._optionsService=D,this._charSizeService=P,this._renderService=T,this._coreBrowserService=A,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 C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((I=>this._activeBuffer=I.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((I=>this._renderDimensions=I))),this._handleThemeChange(E.colors),this.register(E.onChangeColors((I=>this._handleThemeChange(I)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(_){this._viewportElement.style.backgroundColor=_.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(_){if(_)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 m=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==m&&(this._lastRecordedBufferHeight=m,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){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 m=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:m,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(_,m){const v=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(m<0&&this._viewportElement.scrollTop!==0||m>0&&v<this._lastRecordedBufferHeight)||(_.cancelable&&_.preventDefault(),!1)}handleWheel(_){const m=this._getPixelsScrolled(_);return m!==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+m:this._smoothScrollState.target+=m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=m,this._bubbleScroll(_,m))}scrollLines(_){if(_!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const m=_*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+m,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:_,suppressScrollEvent:!1})}_getPixelsScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let m=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_LINE?m*=this._currentRowHeight:_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._currentRowHeight*this._bufferService.rows),m}getBufferElements(_,m){var E;let v,D="";const P=[],T=m??this._bufferService.buffer.lines.length,A=this._bufferService.buffer.lines;for(let I=_;I<T;I++){const B=A.get(I);if(!B)continue;const N=(E=A.get(I+1))==null?void 0:E.isWrapped;if(D+=B.translateToString(!N),!N||I===A.length-1){const W=document.createElement("div");W.textContent=D,P.push(W),D.length>0&&(v=W),D=""}}return{bufferElements:P,cursorElement:v}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let m=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(m/=this._currentRowHeight+0,this._wheelPartialScroll+=m,m=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(m*=this._bufferService.rows),m}_applyScrollModifier(_,m){const v=this._optionsService.rawOptions.fastScrollModifier;return v==="alt"&&m.altKey||v==="ctrl"&&m.ctrlKey||v==="shift"&&m.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const m=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,m!==0&&(this._viewportElement.scrollTop+=m,this._bubbleScroll(_,m))}};a.Viewport=g=u([d(2,y.IBufferService),d(3,y.IOptionsService),d(4,b.ICharSizeService),d(5,b.IRenderService),d(6,b.ICoreBrowserService),d(7,b.IThemeService)],g)},3107:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferDecorationRenderer=void 0;const c=l(4725),b=l(844),C=l(2585);let S=a.BufferDecorationRenderer=class extends b.Disposable{constructor(y,g,_,m,v){super(),this._screenElement=y,this._bufferService=g,this._coreBrowserService=_,this._decorationService=m,this._renderService=v,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((D=>this._removeDecoration(D)))),this.register((0,b.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 y of this._decorationService.decorations)this._renderDecoration(y);this._dimensionsChanged=!1}_renderDecoration(y){this._refreshStyle(y),this._dimensionsChanged&&this._refreshXPosition(y)}_createElement(y){var m;const g=this._coreBrowserService.mainDocument.createElement("div");g.classList.add("xterm-decoration"),g.classList.toggle("xterm-decoration-top-layer",((m=y==null?void 0:y.options)==null?void 0:m.layer)==="top"),g.style.width=`${Math.round((y.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,g.style.height=(y.options.height||1)*this._renderService.dimensions.css.cell.height+"px",g.style.top=(y.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",g.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=y.options.x??0;return _&&_>this._bufferService.cols&&(g.style.display="none"),this._refreshXPosition(y,g),g}_refreshStyle(y){const g=y.marker.line-this._bufferService.buffers.active.ydisp;if(g<0||g>=this._bufferService.rows)y.element&&(y.element.style.display="none",y.onRenderEmitter.fire(y.element));else{let _=this._decorationElements.get(y);_||(_=this._createElement(y),y.element=_,this._decorationElements.set(y,_),this._container.appendChild(_),y.onDispose((()=>{this._decorationElements.delete(y),_.remove()}))),_.style.top=g*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",y.onRenderEmitter.fire(_)}}_refreshXPosition(y,g=y.element){if(!g)return;const _=y.options.x??0;(y.options.anchor||"left")==="right"?g.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":g.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(y){var g;(g=this._decorationElements.get(y))==null||g.remove(),this._decorationElements.delete(y),y.dispose()}};a.BufferDecorationRenderer=S=u([d(1,C.IBufferService),d(2,c.ICoreBrowserService),d(3,C.IDecorationService),d(4,c.IRenderService)],S)},5871:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorZoneStore=void 0,a.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(l){if(l.options.overviewRulerOptions){for(const u of this._zones)if(u.color===l.options.overviewRulerOptions.color&&u.position===l.options.overviewRulerOptions.position){if(this._lineIntersectsZone(u,l.marker.line))return;if(this._lineAdjacentToZone(u,l.marker.line,l.options.overviewRulerOptions.position))return void this._addLineToZone(u,l.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=l.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=l.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=l.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=l.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:l.options.overviewRulerOptions.color,position:l.options.overviewRulerOptions.position,startBufferLine:l.marker.line,endBufferLine:l.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(l){this._linePadding=l}_lineIntersectsZone(l,u){return u>=l.startBufferLine&&u<=l.endBufferLine}_lineAdjacentToZone(l,u,d){return u>=l.startBufferLine-this._linePadding[d||"full"]&&u<=l.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(l,u){l.startBufferLine=Math.min(l.startBufferLine,u),l.endBufferLine=Math.max(l.endBufferLine,u)}}},5744:function(w,a,l){var u=this&&this.__decorate||function(v,D,P,T){var A,E=arguments.length,I=E<3?D:T===null?T=Object.getOwnPropertyDescriptor(D,P):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(v,D,P,T);else for(var B=v.length-1;B>=0;B--)(A=v[B])&&(I=(E<3?A(I):E>3?A(D,P,I):A(D,P))||I);return E>3&&I&&Object.defineProperty(D,P,I),I},d=this&&this.__param||function(v,D){return function(P,T){D(P,T,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OverviewRulerRenderer=void 0;const c=l(5871),b=l(4725),C=l(844),S=l(2585),y={full:0,left:0,center:0,right:0},g={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let m=a.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(v,D,P,T,A,E,I){var N;super(),this._viewportElement=v,this._screenElement=D,this._bufferService=P,this._decorationService=T,this._renderService=A,this._optionsService=E,this._coreBrowserService=I,this._colorZoneStore=new c.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(),(N=this._viewportElement.parentElement)==null||N.insertBefore(this._canvas,this._viewportElement);const B=this._canvas.getContext("2d");if(!B)throw new Error("Ctx cannot be null");this._ctx=B,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{var W;(W=this._canvas)==null||W.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 v=Math.floor(this._canvas.width/3),D=Math.ceil(this._canvas.width/3);g.full=this._canvas.width,g.left=v,g.center=D,g.right=v,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=g.left,_.right=g.left+g.center}_refreshDrawHeightConstants(){y.full=Math.round(2*this._coreBrowserService.dpr);const v=this._canvas.height/this._bufferService.buffer.lines.length,D=Math.round(Math.max(Math.min(v,12),6)*this._coreBrowserService.dpr);y.left=D,y.center=D,y.right=D}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*y.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 D of this._decorationService.decorations)this._colorZoneStore.addDecoration(D);this._ctx.lineWidth=1;const v=this._colorZoneStore.zones;for(const D of v)D.position!=="full"&&this._renderColorZone(D);for(const D of v)D.position==="full"&&this._renderColorZone(D);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(v){this._ctx.fillStyle=v.color,this._ctx.fillRect(_[v.position||"full"],Math.round((this._canvas.height-1)*(v.startBufferLine/this._bufferService.buffers.active.lines.length)-y[v.position||"full"]/2),g[v.position||"full"],Math.round((this._canvas.height-1)*((v.endBufferLine-v.startBufferLine)/this._bufferService.buffers.active.lines.length)+y[v.position||"full"]))}_queueRefresh(v,D){this._shouldUpdateDimensions=v||this._shouldUpdateDimensions,this._shouldUpdateAnchor=D||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};a.OverviewRulerRenderer=m=u([d(2,S.IBufferService),d(3,S.IDecorationService),d(4,b.IRenderService),d(5,S.IOptionsService),d(6,b.ICoreBrowserService)],m)},2950:function(w,a,l){var u=this&&this.__decorate||function(y,g,_,m){var v,D=arguments.length,P=D<3?g:m===null?m=Object.getOwnPropertyDescriptor(g,_):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(y,g,_,m);else for(var T=y.length-1;T>=0;T--)(v=y[T])&&(P=(D<3?v(P):D>3?v(g,_,P):v(g,_))||P);return D>3&&P&&Object.defineProperty(g,_,P),P},d=this&&this.__param||function(y,g){return function(_,m){g(_,m,y)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CompositionHelper=void 0;const c=l(4725),b=l(2585),C=l(2584);let S=a.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(y,g,_,m,v,D){this._textarea=y,this._compositionView=g,this._bufferService=_,this._optionsService=m,this._coreService=v,this._renderService=D,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(y){this._compositionView.textContent=y.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(y){if(this._isComposing||this._isSendingComposition){if(y.keyCode===229||y.keyCode===16||y.keyCode===17||y.keyCode===18)return!1;this._finalizeComposition(!1)}return y.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(y){if(this._compositionView.classList.remove("active"),this._isComposing=!1,y){const g={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,g.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(g.start,g.end):this._textarea.value.substring(g.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const g=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(g,!0)}}_handleAnyTextareaChanges(){const y=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const g=this._textarea.value,_=g.replace(y,"");this._dataAlreadySent=_,g.length>y.length?this._coreService.triggerDataEvent(_,!0):g.length<y.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):g.length===y.length&&g!==y&&this._coreService.triggerDataEvent(g,!0)}}),0)}updateCompositionElements(y){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const g=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),_=this._renderService.dimensions.css.cell.height,m=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,v=g*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=v+"px",this._compositionView.style.top=m+"px",this._compositionView.style.height=_+"px",this._compositionView.style.lineHeight=_+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const D=this._compositionView.getBoundingClientRect();this._textarea.style.left=v+"px",this._textarea.style.top=m+"px",this._textarea.style.width=Math.max(D.width,1)+"px",this._textarea.style.height=Math.max(D.height,1)+"px",this._textarea.style.lineHeight=D.height+"px"}y||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};a.CompositionHelper=S=u([d(2,b.IBufferService),d(3,b.IOptionsService),d(4,b.ICoreService),d(5,c.IRenderService)],S)},9806:(w,a)=>{function l(u,d,c){const b=c.getBoundingClientRect(),C=u.getComputedStyle(c),S=parseInt(C.getPropertyValue("padding-left")),y=parseInt(C.getPropertyValue("padding-top"));return[d.clientX-b.left-S,d.clientY-b.top-y]}Object.defineProperty(a,"__esModule",{value:!0}),a.getCoords=a.getCoordsRelativeToElement=void 0,a.getCoordsRelativeToElement=l,a.getCoords=function(u,d,c,b,C,S,y,g,_){if(!S)return;const m=l(u,d,c);return m?(m[0]=Math.ceil((m[0]+(_?y/2:0))/y),m[1]=Math.ceil(m[1]/g),m[0]=Math.min(Math.max(m[0],1),b+(_?1:0)),m[1]=Math.min(Math.max(m[1],1),C),m):void 0}},9504:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.moveToCellSequence=void 0;const u=l(2584);function d(g,_,m,v){const D=g-c(g,m),P=_-c(_,m),T=Math.abs(D-P)-(function(A,E,I){let B=0;const N=A-c(A,I),W=E-c(E,I);for(let F=0;F<Math.abs(N-W);F++){const q=b(A,E)==="A"?-1:1,V=I.buffer.lines.get(N+q*F);V!=null&&V.isWrapped&&B++}return B})(g,_,m);return y(T,S(b(g,_),v))}function c(g,_){let m=0,v=_.buffer.lines.get(g),D=v==null?void 0:v.isWrapped;for(;D&&g>=0&&g<_.rows;)m++,v=_.buffer.lines.get(--g),D=v==null?void 0:v.isWrapped;return m}function b(g,_){return g>_?"A":"B"}function C(g,_,m,v,D,P){let T=g,A=_,E="";for(;T!==m||A!==v;)T+=D?1:-1,D&&T>P.cols-1?(E+=P.buffer.translateBufferLineToString(A,!1,g,T),T=0,g=0,A++):!D&&T<0&&(E+=P.buffer.translateBufferLineToString(A,!1,0,g+1),T=P.cols-1,g=T,A--);return E+P.buffer.translateBufferLineToString(A,!1,g,T)}function S(g,_){const m=_?"O":"[";return u.C0.ESC+m+g}function y(g,_){g=Math.floor(g);let m="";for(let v=0;v<g;v++)m+=_;return m}a.moveToCellSequence=function(g,_,m,v){const D=m.buffer.x,P=m.buffer.y;if(!m.buffer.hasScrollback)return(function(E,I,B,N,W,F){return d(I,N,W,F).length===0?"":y(C(E,I,E,I-c(I,W),!1,W).length,S("D",F))})(D,P,0,_,m,v)+d(P,_,m,v)+(function(E,I,B,N,W,F){let q;q=d(I,N,W,F).length>0?N-c(N,W):I;const V=N,K=(function(ie,Z,L,H,R,G){let X;return X=d(L,H,R,G).length>0?H-c(H,R):Z,ie<L&&X<=H||ie>=L&&X<H?"C":"D"})(E,I,B,N,W,F);return y(C(E,q,B,V,K==="C",W).length,S(K,F))})(D,P,g,_,m,v);let T;if(P===_)return T=D>g?"D":"C",y(Math.abs(D-g),S(T,v));T=P>_?"D":"C";const A=Math.abs(P-_);return y((function(E,I){return I.cols-E})(P>_?g:D,m)+(A-1)*m.cols+1+((P>_?D:g)-1),S(T,v))}},1296:function(w,a,l){var u=this&&this.__decorate||function(F,q,V,K){var ie,Z=arguments.length,L=Z<3?q:K===null?K=Object.getOwnPropertyDescriptor(q,V):K;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")L=Reflect.decorate(F,q,V,K);else for(var H=F.length-1;H>=0;H--)(ie=F[H])&&(L=(Z<3?ie(L):Z>3?ie(q,V,L):ie(q,V))||L);return Z>3&&L&&Object.defineProperty(q,V,L),L},d=this&&this.__param||function(F,q){return function(V,K){q(V,K,F)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRenderer=void 0;const c=l(3787),b=l(2550),C=l(2223),S=l(6171),y=l(6052),g=l(4725),_=l(8055),m=l(8460),v=l(844),D=l(2585),P="xterm-dom-renderer-owner-",T="xterm-rows",A="xterm-fg-",E="xterm-bg-",I="xterm-focus",B="xterm-selection";let N=1,W=a.DomRenderer=class extends v.Disposable{constructor(F,q,V,K,ie,Z,L,H,R,G,X,oe,ae){super(),this._terminal=F,this._document=q,this._element=V,this._screenElement=K,this._viewportElement=ie,this._helperContainer=Z,this._linkifier2=L,this._charSizeService=R,this._optionsService=G,this._bufferService=X,this._coreBrowserService=oe,this._themeService=ae,this._terminalClass=N++,this._rowElements=[],this._selectionRenderModel=(0,y.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new m.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(T),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(B),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((me=>this._injectCss(me)))),this._injectCss(this._themeService.colors),this._rowFactory=H.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(P+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((me=>this._handleLinkHover(me)))),this.register(this._linkifier2.onHideLinkUnderline((me=>this._handleLinkLeave(me)))),this.register((0,v.toDisposable)((()=>{this._element.classList.remove(P+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new b.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 V of this._rowElements)V.style.width=`${this.dimensions.css.canvas.width}px`,V.style.height=`${this.dimensions.css.cell.height}px`,V.style.lineHeight=`${this.dimensions.css.cell.height}px`,V.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const q=`${this._terminalSelector} .${T} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=q,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 q=`${this._terminalSelector} .${T} { color: ${F.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;q+=`${this._terminalSelector} .${T} .xterm-dim { color: ${_.color.multiplyOpacity(F.foreground,.5).css};}`,q+=`${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 V=`blink_underline_${this._terminalClass}`,K=`blink_bar_${this._terminalClass}`,ie=`blink_block_${this._terminalClass}`;q+=`@keyframes ${V} { 50% { border-bottom-style: hidden; }}`,q+=`@keyframes ${K} { 50% { box-shadow: none; }}`,q+=`@keyframes ${ie} { 0% { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css}; } 50% { background-color: inherit; color: ${F.cursor.css}; }}`,q+=`${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${T}.${I} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${ie} 1s step-end infinite;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block { background-color: ${F.cursor.css}; color: ${F.cursorAccent.css};}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${F.cursor.css} !important; color: ${F.cursorAccent.css} !important;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${F.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${F.cursor.css} inset;}${this._terminalSelector} .${T} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${F.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,q+=`${this._terminalSelector} .${B} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${B} div { position: absolute; background-color: ${F.selectionBackgroundOpaque.css};}${this._terminalSelector} .${B} div { position: absolute; background-color: ${F.selectionInactiveBackgroundOpaque.css};}`;for(const[Z,L]of F.ansi.entries())q+=`${this._terminalSelector} .${A}${Z} { color: ${L.css}; }${this._terminalSelector} .${A}${Z}.xterm-dim { color: ${_.color.multiplyOpacity(L,.5).css}; }${this._terminalSelector} .${E}${Z} { background-color: ${L.css}; }`;q+=`${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque(F.background).css}; }${this._terminalSelector} .${A}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque(F.background),.5).css}; }${this._terminalSelector} .${E}${C.INVERTED_DEFAULT_COLOR} { background-color: ${F.foreground.css}; }`,this._themeStyleElement.textContent=q}_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,q){for(let V=this._rowElements.length;V<=q;V++){const K=this._document.createElement("div");this._rowContainer.appendChild(K),this._rowElements.push(K)}for(;this._rowElements.length>q;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(F,q){this._refreshRowElements(F,q),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(I),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(I),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(F,q,V){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(F,q,V),this.renderRows(0,this._bufferService.rows-1),!F||!q)return;this._selectionRenderModel.update(this._terminal,F,q,V);const K=this._selectionRenderModel.viewportStartRow,ie=this._selectionRenderModel.viewportEndRow,Z=this._selectionRenderModel.viewportCappedStartRow,L=this._selectionRenderModel.viewportCappedEndRow;if(Z>=this._bufferService.rows||L<0)return;const H=this._document.createDocumentFragment();if(V){const R=F[0]>q[0];H.appendChild(this._createSelectionElement(Z,R?q[0]:F[0],R?F[0]:q[0],L-Z+1))}else{const R=K===Z?F[0]:0,G=Z===ie?q[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(Z,R,G));const X=L-Z-1;if(H.appendChild(this._createSelectionElement(Z+1,0,this._bufferService.cols,X)),Z!==L){const oe=ie===L?q[0]:this._bufferService.cols;H.appendChild(this._createSelectionElement(L,0,oe))}}this._selectionContainer.appendChild(H)}_createSelectionElement(F,q,V,K=1){const ie=this._document.createElement("div"),Z=q*this.dimensions.css.cell.width;let L=this.dimensions.css.cell.width*(V-q);return Z+L>this.dimensions.css.canvas.width&&(L=this.dimensions.css.canvas.width-Z),ie.style.height=K*this.dimensions.css.cell.height+"px",ie.style.top=F*this.dimensions.css.cell.height+"px",ie.style.left=`${Z}px`,ie.style.width=`${L}px`,ie}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,q){const V=this._bufferService.buffer,K=V.ybase+V.y,ie=Math.min(V.x,this._bufferService.cols-1),Z=this._optionsService.rawOptions.cursorBlink,L=this._optionsService.rawOptions.cursorStyle,H=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=F;R<=q;R++){const G=R+V.ydisp,X=this._rowElements[R],oe=V.lines.get(G);if(!X||!oe)break;X.replaceChildren(...this._rowFactory.createRow(oe,G,G===K,L,H,ie,Z,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${P}${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,q,V,K,ie,Z){V<0&&(F=0),K<0&&(q=0);const L=this._bufferService.rows-1;V=Math.max(Math.min(V,L),0),K=Math.max(Math.min(K,L),0),ie=Math.min(ie,this._bufferService.cols);const H=this._bufferService.buffer,R=H.ybase+H.y,G=Math.min(H.x,ie-1),X=this._optionsService.rawOptions.cursorBlink,oe=this._optionsService.rawOptions.cursorStyle,ae=this._optionsService.rawOptions.cursorInactiveStyle;for(let me=V;me<=K;++me){const $=me+H.ydisp,O=this._rowElements[me],le=H.lines.get($);if(!O||!le)break;O.replaceChildren(...this._rowFactory.createRow(le,$,$===R,oe,ae,G,X,this.dimensions.css.cell.width,this._widthCache,Z?me===V?F:0:-1,Z?(me===K?q:ie)-1:-1))}}};a.DomRenderer=W=u([d(7,D.IInstantiationService),d(8,g.ICharSizeService),d(9,D.IOptionsService),d(10,D.IBufferService),d(11,g.ICoreBrowserService),d(12,g.IThemeService)],W)},3787:function(w,a,l){var u=this&&this.__decorate||function(T,A,E,I){var B,N=arguments.length,W=N<3?A:I===null?I=Object.getOwnPropertyDescriptor(A,E):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(T,A,E,I);else for(var F=T.length-1;F>=0;F--)(B=T[F])&&(W=(N<3?B(W):N>3?B(A,E,W):B(A,E))||W);return N>3&&W&&Object.defineProperty(A,E,W),W},d=this&&this.__param||function(T,A){return function(E,I){A(E,I,T)}};Object.defineProperty(a,"__esModule",{value:!0}),a.DomRendererRowFactory=void 0;const c=l(2223),b=l(643),C=l(511),S=l(2585),y=l(8055),g=l(4725),_=l(4269),m=l(6171),v=l(3734);let D=a.DomRendererRowFactory=class{constructor(T,A,E,I,B,N,W){this._document=T,this._characterJoinerService=A,this._optionsService=E,this._coreBrowserService=I,this._coreService=B,this._decorationService=N,this._themeService=W,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(T,A,E){this._selectionStart=T,this._selectionEnd=A,this._columnSelectMode=E}createRow(T,A,E,I,B,N,W,F,q,V,K){const ie=[],Z=this._characterJoinerService.getJoinedCharacters(A),L=this._themeService.colors;let H,R=T.getNoBgTrimmedLength();E&&R<N+1&&(R=N+1);let G=0,X="",oe=0,ae=0,me=0,$=!1,O=0,le=!1,se=0;const ge=[],fe=V!==-1&&K!==-1;for(let Me=0;Me<R;Me++){T.loadCell(Me,this._workCell);let We=this._workCell.getWidth();if(We===0)continue;let je=!1,ot=Me,Ae=this._workCell;if(Z.length>0&&Me===Z[0][0]){je=!0;const Ye=Z.shift();Ae=new _.JoinedCellData(this._workCell,T.translateToString(!0,Ye[0],Ye[1]),Ye[1]-Ye[0]),ot=Ye[1]-1,We=Ae.getWidth()}const ve=this._isCellInSelection(Me,A),Ie=E&&Me===N,$e=fe&&Me>=V&&Me<=K;let st=!1;this._decorationService.forEachDecorationAtCell(Me,A,void 0,(Ye=>{st=!0}));let Dt=Ae.getChars()||b.WHITESPACE_CELL_CHAR;if(Dt===" "&&(Ae.isUnderline()||Ae.isOverline())&&(Dt=" "),se=We*F-q.get(Dt,Ae.isBold(),Ae.isItalic()),H){if(G&&(ve&&le||!ve&&!le&&Ae.bg===oe)&&(ve&&le&&L.selectionForeground||Ae.fg===ae)&&Ae.extended.ext===me&&$e===$&&se===O&&!Ie&&!je&&!st){Ae.isInvisible()?X+=b.WHITESPACE_CELL_CHAR:X+=Dt,G++;continue}G&&(H.textContent=X),H=this._document.createElement("span"),G=0,X=""}else H=this._document.createElement("span");if(oe=Ae.bg,ae=Ae.fg,me=Ae.extended.ext,$=$e,O=se,le=ve,je&&N>=Me&&N<=ot&&(N=Me),!this._coreService.isCursorHidden&&Ie&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)W&&ge.push("xterm-cursor-blink"),ge.push(I==="bar"?"xterm-cursor-bar":I==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(B)switch(B){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(Ae.isBold()&&ge.push("xterm-bold"),Ae.isItalic()&&ge.push("xterm-italic"),Ae.isDim()&&ge.push("xterm-dim"),X=Ae.isInvisible()?b.WHITESPACE_CELL_CHAR:Ae.getChars()||b.WHITESPACE_CELL_CHAR,Ae.isUnderline()&&(ge.push(`xterm-underline-${Ae.extended.underlineStyle}`),X===" "&&(X=" "),!Ae.isUnderlineColorDefault()))if(Ae.isUnderlineColorRGB())H.style.textDecorationColor=`rgb(${v.AttributeData.toColorRGB(Ae.getUnderlineColor()).join(",")})`;else{let Ye=Ae.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ae.isBold()&&Ye<8&&(Ye+=8),H.style.textDecorationColor=L.ansi[Ye].css}Ae.isOverline()&&(ge.push("xterm-overline"),X===" "&&(X=" ")),Ae.isStrikethrough()&&ge.push("xterm-strikethrough"),$e&&(H.style.textDecoration="underline");let Ne=Ae.getFgColor(),Si=Ae.getFgColorMode(),At=Ae.getBgColor(),mt=Ae.getBgColorMode();const ut=!!Ae.isInverse();if(ut){const Ye=Ne;Ne=At,At=Ye;const Bs=Si;Si=mt,mt=Bs}let Ke,li,gt,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(Me,A,void 0,(Ye=>{Ye.options.layer!=="top"&&Rt||(Ye.backgroundColorRGB&&(mt=50331648,At=Ye.backgroundColorRGB.rgba>>8&16777215,Ke=Ye.backgroundColorRGB),Ye.foregroundColorRGB&&(Si=50331648,Ne=Ye.foregroundColorRGB.rgba>>8&16777215,li=Ye.foregroundColorRGB),Rt=Ye.options.layer==="top")})),!Rt&&ve&&(Ke=this._coreBrowserService.isFocused?L.selectionBackgroundOpaque:L.selectionInactiveBackgroundOpaque,At=Ke.rgba>>8&16777215,mt=50331648,Rt=!0,L.selectionForeground&&(Si=50331648,Ne=L.selectionForeground.rgba>>8&16777215,li=L.selectionForeground)),Rt&&ge.push("xterm-decoration-top"),mt){case 16777216:case 33554432:gt=L.ansi[At],ge.push(`xterm-bg-${At}`);break;case 50331648:gt=y.channels.toColor(At>>16,At>>8&255,255&At),this._addStyle(H,`background-color:#${P((At>>>0).toString(16),"0",6)}`);break;default:ut?(gt=L.foreground,ge.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):gt=L.background}switch(Ke||Ae.isDim()&&(Ke=y.color.multiplyOpacity(gt,.5)),Si){case 16777216:case 33554432:Ae.isBold()&&Ne<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ne+=8),this._applyMinimumContrast(H,gt,L.ansi[Ne],Ae,Ke,void 0)||ge.push(`xterm-fg-${Ne}`);break;case 50331648:const Ye=y.channels.toColor(Ne>>16&255,Ne>>8&255,255&Ne);this._applyMinimumContrast(H,gt,Ye,Ae,Ke,li)||this._addStyle(H,`color:#${P(Ne.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(H,gt,L.foreground,Ae,Ke,li)||ut&&ge.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}ge.length&&(H.className=ge.join(" "),ge.length=0),Ie||je||st?H.textContent=X:G++,se!==this.defaultSpacing&&(H.style.letterSpacing=`${se}px`),ie.push(H),Me=ot}return H&&G&&(H.textContent=X),ie}_applyMinimumContrast(T,A,E,I,B,N){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,m.treatGlyphAsBackgroundColor)(I.getCode()))return!1;const W=this._getContrastCache(I);let F;if(B||N||(F=W.getColor(A.rgba,E.rgba)),F===void 0){const q=this._optionsService.rawOptions.minimumContrastRatio/(I.isDim()?2:1);F=y.color.ensureContrastRatio(B||A,N||E,q),W.setColor((B||A).rgba,(N||E).rgba,F??null)}return!!F&&(this._addStyle(T,`color:${F.css}`),!0)}_getContrastCache(T){return T.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(T,A){T.setAttribute("style",`${T.getAttribute("style")||""}${A};`)}_isCellInSelection(T,A){const E=this._selectionStart,I=this._selectionEnd;return!(!E||!I)&&(this._columnSelectMode?E[0]<=I[0]?T>=E[0]&&A>=E[1]&&T<I[0]&&A<=I[1]:T<E[0]&&A>=E[1]&&T>=I[0]&&A<=I[1]:A>E[1]&&A<I[1]||E[1]===I[1]&&A===E[1]&&T>=E[0]&&T<I[0]||E[1]<I[1]&&A===I[1]&&T<I[0]||E[1]<I[1]&&A===E[1]&&T>=E[0])}};function P(T,A,E){for(;T.length<E;)T=A+T;return T}a.DomRendererRowFactory=D=u([d(1,g.ICharacterJoinerService),d(2,S.IOptionsService),d(3,g.ICoreBrowserService),d(4,S.ICoreService),d(5,S.IDecorationService),d(6,g.IThemeService)],D)},2550:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WidthCache=void 0,a.WidthCache=class{constructor(l,u){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=l.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 d=l.createElement("span");d.classList.add("xterm-char-measure-element");const c=l.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const b=l.createElement("span");b.classList.add("xterm-char-measure-element"),b.style.fontStyle="italic";const C=l.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[d,c,b,C],this._container.appendChild(d),this._container.appendChild(c),this._container.appendChild(b),this._container.appendChild(C),u.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(l,u,d,c){l===this._font&&u===this._fontSize&&d===this._weight&&c===this._weightBold||(this._font=l,this._fontSize=u,this._weight=d,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${d}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${d}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(l,u,d){let c=0;if(!u&&!d&&l.length===1&&(c=l.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const S=this._measure(l,0);return S>0&&(this._flat[c]=S),S}let b=l;u&&(b+="B"),d&&(b+="I");let C=this._holey.get(b);if(C===void 0){let S=0;u&&(S|=1),d&&(S|=2),C=this._measure(l,S),C>0&&this._holey.set(b,C)}return C}_measure(l,u){const d=this._measureElements[u];return d.textContent=l.repeat(32),d.offsetWidth/32}}},2223:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TEXT_BASELINE=a.DIM_OPACITY=a.INVERTED_DEFAULT_COLOR=void 0;const u=l(6114);a.INVERTED_DEFAULT_COLOR=257,a.DIM_OPACITY=.5,a.TEXT_BASELINE=u.isFirefox||u.isLegacyEdge?"bottom":"ideographic"},6171:(w,a)=>{function l(d){return 57508<=d&&d<=57558}function u(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(a,"__esModule",{value:!0}),a.computeNextVariantOffset=a.createRenderDimensions=a.treatGlyphAsBackgroundColor=a.allowRescaling=a.isEmoji=a.isRestrictedPowerlineGlyph=a.isPowerlineGlyph=a.throwIfFalsy=void 0,a.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},a.isPowerlineGlyph=l,a.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},a.isEmoji=u,a.allowRescaling=function(d,c,b,C){return c===1&&b>Math.ceil(1.5*C)&&d!==void 0&&d>255&&!u(d)&&!l(d)&&!(function(S){return 57344<=S&&S<=63743})(d)},a.treatGlyphAsBackgroundColor=function(d){return l(d)||(function(c){return 9472<=c&&c<=9631})(d)},a.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}}}},a.computeNextVariantOffset=function(d,c,b=0){return(d-(2*Math.round(c)-b))%(2*Math.round(c))}},6052:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createSelectionRenderModel=void 0;class l{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,c,b,C=!1){if(this.selectionStart=c,this.selectionEnd=b,!c||!b||c[0]===b[0]&&c[1]===b[1])return void this.clear();const S=d.buffers.active.ydisp,y=c[1]-S,g=b[1]-S,_=Math.max(y,0),m=Math.min(g,d.rows-1);_>=d.rows||m<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=y,this.viewportEndRow=g,this.viewportCappedStartRow=_,this.viewportCappedEndRow=m,this.startCol=c[0],this.endCol=b[0])}isCellSelected(d,c,b){return!!this.hasSelection&&(b-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&b>=this.viewportCappedStartRow&&c<this.endCol&&b<=this.viewportCappedEndRow:c<this.startCol&&b>=this.viewportCappedStartRow&&c>=this.endCol&&b<=this.viewportCappedEndRow:b>this.viewportStartRow&&b<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&b===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&b===this.viewportStartRow&&c>=this.startCol)}}a.createSelectionRenderModel=function(){return new l}},456:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionModel=void 0,a.SelectionModel=class{constructor(l){this._bufferService=l,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 l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?l%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)-1]:[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[l,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const l=this.selectionStart[0]+this.selectionStartLength;return l>this._bufferService.cols?[l%this._bufferService.cols,this.selectionStart[1]+Math.floor(l/this._bufferService.cols)]:[Math.max(l,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const l=this.selectionStart,u=this.selectionEnd;return!(!l||!u)&&(l[1]>u[1]||l[1]===u[1]&&l[0]>u[0])}handleTrim(l){return this.selectionStart&&(this.selectionStart[1]-=l),this.selectionEnd&&(this.selectionEnd[1]-=l),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharSizeService=void 0;const c=l(2585),b=l(8460),C=l(844);let S=a.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(m,v,D){super(),this._optionsService=D,this.width=0,this.height=0,this._onCharSizeChange=this.register(new b.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new g(m,v,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const m=this._measureStrategy.measure();m.width===this.width&&m.height===this.height||(this.width=m.width,this.height=m.height,this._onCharSizeChange.fire())}};a.CharSizeService=S=u([d(2,c.IOptionsService)],S);class y extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(v,D){v!==void 0&&v>0&&D!==void 0&&D>0&&(this._result.width=v,this._result.height=D)}}class g extends y{constructor(v,D,P){super(),this._document=v,this._parentElement=D,this._optionsService=P,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 _ extends y{constructor(v){super(),this._optionsService=v,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const D=this._ctx.measureText("W");if(!("width"in D&&"fontBoundingBoxAscent"in D&&"fontBoundingBoxDescent"in D))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const v=this._ctx.measureText("W");return this._validateAndSet(v.width,v.fontBoundingBoxAscent+v.fontBoundingBoxDescent),this._result}}},4269:function(w,a,l){var u=this&&this.__decorate||function(_,m,v,D){var P,T=arguments.length,A=T<3?m:D===null?D=Object.getOwnPropertyDescriptor(m,v):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,m,v,D);else for(var E=_.length-1;E>=0;E--)(P=_[E])&&(A=(T<3?P(A):T>3?P(m,v,A):P(m,v))||A);return T>3&&A&&Object.defineProperty(m,v,A),A},d=this&&this.__param||function(_,m){return function(v,D){m(v,D,_)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CharacterJoinerService=a.JoinedCellData=void 0;const c=l(3734),b=l(643),C=l(511),S=l(2585);class y extends c.AttributeData{constructor(m,v,D){super(),this.content=0,this.combinedData="",this.fg=m.fg,this.bg=m.bg,this.combinedData=v,this._width=D}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(m){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.JoinedCellData=y;let g=a.CharacterJoinerService=class zp{constructor(m){this._bufferService=m,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(m){const v={id:this._nextCharacterJoinerId++,handler:m};return this._characterJoiners.push(v),v.id}deregister(m){for(let v=0;v<this._characterJoiners.length;v++)if(this._characterJoiners[v].id===m)return this._characterJoiners.splice(v,1),!0;return!1}getJoinedCharacters(m){if(this._characterJoiners.length===0)return[];const v=this._bufferService.buffer.lines.get(m);if(!v||v.length===0)return[];const D=[],P=v.translateToString(!0);let T=0,A=0,E=0,I=v.getFg(0),B=v.getBg(0);for(let N=0;N<v.getTrimmedLength();N++)if(v.loadCell(N,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==I||this._workCell.bg!==B){if(N-T>1){const W=this._getJoinedRanges(P,E,A,v,T);for(let F=0;F<W.length;F++)D.push(W[F])}T=N,E=A,I=this._workCell.fg,B=this._workCell.bg}A+=this._workCell.getChars().length||b.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-T>1){const N=this._getJoinedRanges(P,E,A,v,T);for(let W=0;W<N.length;W++)D.push(N[W])}return D}_getJoinedRanges(m,v,D,P,T){const A=m.substring(v,D);let E=[];try{E=this._characterJoiners[0].handler(A)}catch(I){console.error(I)}for(let I=1;I<this._characterJoiners.length;I++)try{const B=this._characterJoiners[I].handler(A);for(let N=0;N<B.length;N++)zp._mergeRanges(E,B[N])}catch(B){console.error(B)}return this._stringRangesToCellRanges(E,P,T),E}_stringRangesToCellRanges(m,v,D){let P=0,T=!1,A=0,E=m[P];if(E){for(let I=D;I<this._bufferService.cols;I++){const B=v.getWidth(I),N=v.getString(I).length||b.WHITESPACE_CELL_CHAR.length;if(B!==0){if(!T&&E[0]<=A&&(E[0]=I,T=!0),E[1]<=A){if(E[1]=I,E=m[++P],!E)break;E[0]<=A?(E[0]=I,T=!0):T=!1}A+=N}}E&&(E[1]=this._bufferService.cols)}}static _mergeRanges(m,v){let D=!1;for(let P=0;P<m.length;P++){const T=m[P];if(D){if(v[1]<=T[0])return m[P-1][1]=v[1],m;if(v[1]<=T[1])return m[P-1][1]=Math.max(v[1],T[1]),m.splice(P,1),m;m.splice(P,1),P--}else{if(v[1]<=T[0])return m.splice(P,0,v),m;if(v[1]<=T[1])return T[0]=Math.min(v[0],T[0]),m;v[0]<T[1]&&(T[0]=Math.min(v[0],T[0]),D=!0)}}return D?m[m.length-1][1]=v[1]:m.push(v),m}};a.CharacterJoinerService=g=u([d(0,S.IBufferService)],g)},5114:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreBrowserService=void 0;const u=l(844),d=l(8460),c=l(3656);class b extends u.Disposable{constructor(y,g,_){super(),this._textarea=y,this._window=g,this.mainDocument=_,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new d.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((m=>this._screenDprMonitor.setWindow(m)))),this.register((0,d.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(y){this._window!==y&&(this._window=y,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}}a.CoreBrowserService=b;class C extends u.Disposable{constructor(y){super(),this._parentWindow=y,this._windowResizeListener=this.register(new u.MutableDisposable),this._onDprChange=this.register(new d.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,u.toDisposable)((()=>this.clearListener())))}setWindow(y){this._parentWindow=y,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var y;this._outerListener&&((y=this._resolutionMediaMatchList)==null||y.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:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.LinkProviderService=void 0;const u=l(844);class d extends u.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,u.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(b){return this.linkProviders.push(b),{dispose:()=>{const C=this.linkProviders.indexOf(b);C!==-1&&this.linkProviders.splice(C,1)}}}}a.LinkProviderService=d},8934:function(w,a,l){var u=this&&this.__decorate||function(S,y,g,_){var m,v=arguments.length,D=v<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,g):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(S,y,g,_);else for(var P=S.length-1;P>=0;P--)(m=S[P])&&(D=(v<3?m(D):v>3?m(y,g,D):m(y,g))||D);return v>3&&D&&Object.defineProperty(y,g,D),D},d=this&&this.__param||function(S,y){return function(g,_){y(g,_,S)}};Object.defineProperty(a,"__esModule",{value:!0}),a.MouseService=void 0;const c=l(4725),b=l(9806);let C=a.MouseService=class{constructor(S,y){this._renderService=S,this._charSizeService=y}getCoords(S,y,g,_,m){return(0,b.getCoords)(window,S,y,g,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,m)}getMouseReportCoords(S,y){const g=(0,b.getCoordsRelativeToElement)(window,S,y);if(this._charSizeService.hasValidSize)return g[0]=Math.min(Math.max(g[0],0),this._renderService.dimensions.css.canvas.width-1),g[1]=Math.min(Math.max(g[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(g[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(g[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(g[0]),y:Math.floor(g[1])}}};a.MouseService=C=u([d(0,c.IRenderService),d(1,c.ICharSizeService)],C)},3230:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.RenderService=void 0;const c=l(6193),b=l(4725),C=l(8460),S=l(844),y=l(7226),g=l(2585);let _=a.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(m,v,D,P,T,A,E,I){super(),this._rowCount=m,this._charSizeService=P,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new y.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer(((B,N)=>this._renderRows(B,N)),E),this.register(this._renderDebouncer),this.register(E.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(A.onResize((()=>this._fullRefresh()))),this.register(A.buffers.onBufferActivate((()=>{var B;return(B=this._renderer.value)==null?void 0:B.clear()}))),this.register(D.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(T.onDecorationRegistered((()=>this._fullRefresh()))),this.register(T.onDecorationRemoved((()=>this._fullRefresh()))),this.register(D.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(A.cols,A.rows),this._fullRefresh()}))),this.register(D.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(A.buffer.y,A.buffer.y,!0)))),this.register(I.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(E.window,v),this.register(E.onWindowChange((B=>this._registerIntersectionObserver(B,v))))}_registerIntersectionObserver(m,v){if("IntersectionObserver"in m){const D=new m.IntersectionObserver((P=>this._handleIntersectionChange(P[P.length-1])),{threshold:0});D.observe(v),this._observerDisposable.value=(0,S.toDisposable)((()=>D.disconnect()))}}_handleIntersectionChange(m){this._isPaused=m.isIntersecting===void 0?m.intersectionRatio===0:!m.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(m,v,D=!1){this._isPaused?this._needsFullRefresh=!0:(D||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(m,v,this._rowCount))}_renderRows(m,v){this._renderer.value&&(m=Math.min(m,this._rowCount-1),v=Math.min(v,this._rowCount-1),this._renderer.value.renderRows(m,v),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:m,end:v}),this._onRender.fire({start:m,end:v}),this._isNextRenderRedrawOnly=!0)}resize(m,v){this._rowCount=v,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(m){this._renderer.value=m,this._renderer.value&&(this._renderer.value.onRequestRedraw((v=>this.refreshRows(v.start,v.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(m){return this._renderDebouncer.addRefreshCallback(m)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var m,v;this._renderer.value&&((v=(m=this._renderer.value).clearTextureAtlas)==null||v.call(m),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(m,v){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var D;return(D=this._renderer.value)==null?void 0:D.handleResize(m,v)})):this._renderer.value.handleResize(m,v),this._fullRefresh())}handleCharSizeChanged(){var m;(m=this._renderer.value)==null||m.handleCharSizeChanged()}handleBlur(){var m;(m=this._renderer.value)==null||m.handleBlur()}handleFocus(){var m;(m=this._renderer.value)==null||m.handleFocus()}handleSelectionChanged(m,v,D){var P;this._selectionState.start=m,this._selectionState.end=v,this._selectionState.columnSelectMode=D,(P=this._renderer.value)==null||P.handleSelectionChanged(m,v,D)}handleCursorMove(){var m;(m=this._renderer.value)==null||m.handleCursorMove()}clear(){var m;(m=this._renderer.value)==null||m.clear()}};a.RenderService=_=u([d(2,g.IOptionsService),d(3,b.ICharSizeService),d(4,g.IDecorationService),d(5,g.IBufferService),d(6,b.ICoreBrowserService),d(7,b.IThemeService)],_)},9312:function(w,a,l){var u=this&&this.__decorate||function(E,I,B,N){var W,F=arguments.length,q=F<3?I:N===null?N=Object.getOwnPropertyDescriptor(I,B):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(E,I,B,N);else for(var V=E.length-1;V>=0;V--)(W=E[V])&&(q=(F<3?W(q):F>3?W(I,B,q):W(I,B))||q);return F>3&&q&&Object.defineProperty(I,B,q),q},d=this&&this.__param||function(E,I){return function(B,N){I(B,N,E)}};Object.defineProperty(a,"__esModule",{value:!0}),a.SelectionService=void 0;const c=l(9806),b=l(9504),C=l(456),S=l(4725),y=l(8460),g=l(844),_=l(6114),m=l(4841),v=l(511),D=l(2585),P=" ",T=new RegExp(P,"g");let A=a.SelectionService=class extends g.Disposable{constructor(E,I,B,N,W,F,q,V,K){super(),this._element=E,this._screenElement=I,this._linkifier=B,this._bufferService=N,this._coreService=W,this._mouseService=F,this._optionsService=q,this._renderService=V,this._coreBrowserService=K,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new v.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new y.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new y.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new y.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new y.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=ie=>this._handleMouseMove(ie),this._mouseUpListener=ie=>this._handleMouseUp(ie),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((ie=>this._handleTrim(ie))),this.register(this._bufferService.buffers.onBufferActivate((ie=>this._handleBufferActivate(ie)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,g.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 E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;return!(!E||!I||E[0]===I[0]&&E[1]===I[1])}get selectionText(){const E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd;if(!E||!I)return"";const B=this._bufferService.buffer,N=[];if(this._activeSelectionMode===3){if(E[0]===I[0])return"";const W=E[0]<I[0]?E[0]:I[0],F=E[0]<I[0]?I[0]:E[0];for(let q=E[1];q<=I[1];q++){const V=B.translateBufferLineToString(q,!0,W,F);N.push(V)}}else{const W=E[1]===I[1]?I[0]:void 0;N.push(B.translateBufferLineToString(E[1],!0,E[0],W));for(let F=E[1]+1;F<=I[1]-1;F++){const q=B.lines.get(F),V=B.translateBufferLineToString(F,!0);q!=null&&q.isWrapped?N[N.length-1]+=V:N.push(V)}if(E[1]!==I[1]){const F=B.lines.get(I[1]),q=B.translateBufferLineToString(I[1],!0,0,I[0]);F&&F.isWrapped?N[N.length-1]+=q:N.push(q)}}return N.map((W=>W.replace(T," "))).join(_.isWindows?`\r
65
65
  `:`
66
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(E){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),_.isLinux&&E&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(E){const I=this._getMouseBufferCoords(E),z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(z&&H&&I)&&this._areCoordsInSelection(I,z,H)}isCellInSelection(E,I){const z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!z||!H)&&this._areCoordsInSelection([E,I],z,H)}_areCoordsInSelection(E,I,z){return E[1]>I[1]&&E[1]<z[1]||I[1]===z[1]&&E[1]===I[1]&&E[0]>=I[0]&&E[0]<z[0]||I[1]<z[1]&&E[1]===z[1]&&E[0]<z[0]||I[1]<z[1]&&E[1]===I[1]&&E[0]>=I[0]}_selectWordAtCursor(E,I){var V,F;const z=(F=(V=this._linkifier.currentLink)==null?void 0:V.link)==null?void 0:F.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(E);return!!H&&(this._selectWordAt(H,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(E,I){this._model.clearSelection(),E=Math.max(E,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,E],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(E){this._model.handleTrim(E)&&this.refresh()}_getMouseBufferCoords(E){const I=this._mouseService.getCoords(E,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(E){let I=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,E,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=z?0:(I>z&&(I-=z),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(E){return _.isMac?E.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:E.shiftKey}handleMouseDown(E){if(this._mouseDownTimeStamp=E.timeStamp,(E.button!==2||!this.hasSelection)&&E.button===0){if(!this._enabled){if(!this.shouldForceSelection(E))return;E.stopPropagation()}E.preventDefault(),this._dragScrollAmount=0,this._enabled&&E.shiftKey?this._handleIncrementalClick(E):E.detail===1?this._handleSingleClick(E):E.detail===2?this._handleDoubleClick(E):E.detail===3&&this._handleTripleClick(E),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),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(E){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(E))}_handleSingleClick(E){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(E)?3:0,this._model.selectionStart=this._getMouseBufferCoords(E),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(E){this._selectWordAtCursor(E,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(E){const I=this._getMouseBufferCoords(E);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(E){return E.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(E){if(E.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(E),!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(E),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]<z.lines.length){const H=z.lines.get(this._model.selectionEnd[1]);H&&H.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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 E=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(E.ydisp+this._bufferService.rows,E.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=E.ydisp),this.refresh()}}_handleMouseUp(E){const I=E.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&E.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(E,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const H=(0,b.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,z=!(!E||!I||E[0]===I[0]&&E[1]===I[1]);z?E&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&E[0]===this._oldSelectionStart[0]&&E[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(E,I,z)):this._oldHasSelection&&this._fireOnSelectionChange(E,I,z)}_fireOnSelectionChange(E,I,z){this._oldSelectionStart=E,this._oldSelectionEnd=I,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(E){this.clearSelection(),this._trimListener.dispose(),this._trimListener=E.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(E,I){let z=I;for(let H=0;I>=H;H++){const V=E.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:V>1&&I!==H&&(z+=V-1)}return z}setSelection(E,I,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[E,I],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(E){this._isClickInSelection(E)||(this._selectWordAtCursor(E,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(E,I,z=!0,H=!0){if(E[0]>=this._bufferService.cols)return;const V=this._bufferService.buffer,F=V.lines.get(E[1]);if(!F)return;const q=V.translateBufferLineToString(E[1],!1);let W=this._convertViewportColToCharacterIndex(F,E[0]),K=W;const ie=E[0]-W;let J=0,L=0,B=0,R=0;if(q.charAt(W)===" "){for(;W>0&&q.charAt(W-1)===" ";)W--;for(;K<q.length&&q.charAt(K+1)===" ";)K++}else{let oe=E[0],ae=E[0];F.getWidth(oe)===0&&(J++,oe--),F.getWidth(ae)===2&&(L++,ae++);const me=F.getString(ae).length;for(me>1&&(R+=me-1,K+=me-1);oe>0&&W>0&&!this._isCharWordSeparator(F.loadCell(oe-1,this._workCell));){F.loadCell(oe-1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===0?(J++,oe--):$>1&&(B+=$-1,W-=$-1),W--,oe--}for(;ae<F.length&&K+1<q.length&&!this._isCharWordSeparator(F.loadCell(ae+1,this._workCell));){F.loadCell(ae+1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,ae++):$>1&&(R+=$-1,K+=$-1),K++,ae++}}K++;let G=W+ie-J+B,X=Math.min(this._bufferService.cols,K-W+J+L-B-R);if(I||q.slice(W,K).trim()!==""){if(z&&G===0&&F.getCodePoint(0)!==32){const oe=V.lines.get(E[1]-1);if(oe&&F.isWrapped&&oe.getCodePoint(this._bufferService.cols-1)!==32){const ae=this._getWordAt([this._bufferService.cols-1,E[1]-1],!1,!0,!1);if(ae){const me=this._bufferService.cols-ae.start;G-=me,X+=me}}}if(H&&G+X===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const oe=V.lines.get(E[1]+1);if(oe!=null&&oe.isWrapped&&oe.getCodePoint(0)!==32){const ae=this._getWordAt([0,E[1]+1],!1,!1,!0);ae&&(X+=ae.length)}}return{start:G,length:X}}}_selectWordAt(E,I){const z=this._getWordAt(E,I);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,E[1]--;this._model.selectionStart=[z.start,E[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(E){const I=this._getWordAt(E,!0);if(I){let z=E[1];for(;I.start<0;)I.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,z]}}_isCharWordSeparator(E){return E.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(E.getChars())>=0}_selectLineAt(E){const I=this._bufferService.buffer.getWrappedRangeForLine(E),z={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,m.getRangeLength)(z,this._bufferService.cols)}};a.SelectionService=A=u([d(3,D.IBufferService),d(4,D.ICoreService),d(5,S.IMouseService),d(6,D.IOptionsService),d(7,S.IRenderService),d(8,S.ICoreBrowserService)],A)},4725:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const u=l(8343);a.ICharSizeService=(0,u.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),a.IMouseService=(0,u.createDecorator)("MouseService"),a.IRenderService=(0,u.createDecorator)("RenderService"),a.ISelectionService=(0,u.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,u.createDecorator)("ThemeService"),a.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(w,a,l){var u=this&&this.__decorate||function(A,E,I,z){var H,V=arguments.length,F=V<3?E:z===null?z=Object.getOwnPropertyDescriptor(E,I):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(A,E,I,z);else for(var q=A.length-1;q>=0;q--)(H=A[q])&&(F=(V<3?H(F):V>3?H(E,I,F):H(E,I))||F);return V>3&&F&&Object.defineProperty(E,I,F),F},d=this&&this.__param||function(A,E){return function(I,z){E(I,z,A)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const c=l(7239),b=l(8055),C=l(8460),S=l(844),y=l(2585),g=b.css.toColor("#ffffff"),_=b.css.toColor("#000000"),m=b.css.toColor("#ffffff"),v=b.css.toColor("#000000"),D={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const A=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],E=[0,95,135,175,215,255];for(let I=0;I<216;I++){const z=E[I/36%6|0],H=E[I/6%6|0],V=E[I%6];A.push({css:b.channels.toCss(z,H,V),rgba:b.channels.toRgba(z,H,V)})}for(let I=0;I<24;I++){const z=8+10*I;A.push({css:b.channels.toCss(z,z,z),rgba:b.channels.toRgba(z,z,z)})}return A})());let P=a.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:_,cursor:m,cursorAccent:v,selectionForeground:void 0,selectionBackgroundTransparent:D,selectionBackgroundOpaque:b.color.blend(_,D),selectionInactiveBackgroundTransparent:D,selectionInactiveBackgroundOpaque:b.color.blend(_,D),ansi:a.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(A={}){const E=this._colors;if(E.foreground=T(A.foreground,g),E.background=T(A.background,_),E.cursor=T(A.cursor,m),E.cursorAccent=T(A.cursorAccent,v),E.selectionBackgroundTransparent=T(A.selectionBackground,D),E.selectionBackgroundOpaque=b.color.blend(E.background,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundTransparent=T(A.selectionInactiveBackground,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundOpaque=b.color.blend(E.background,E.selectionInactiveBackgroundTransparent),E.selectionForeground=A.selectionForeground?T(A.selectionForeground,b.NULL_COLOR):void 0,E.selectionForeground===b.NULL_COLOR&&(E.selectionForeground=void 0),b.color.isOpaque(E.selectionBackgroundTransparent)&&(E.selectionBackgroundTransparent=b.color.opacity(E.selectionBackgroundTransparent,.3)),b.color.isOpaque(E.selectionInactiveBackgroundTransparent)&&(E.selectionInactiveBackgroundTransparent=b.color.opacity(E.selectionInactiveBackgroundTransparent,.3)),E.ansi=a.DEFAULT_ANSI_COLORS.slice(),E.ansi[0]=T(A.black,a.DEFAULT_ANSI_COLORS[0]),E.ansi[1]=T(A.red,a.DEFAULT_ANSI_COLORS[1]),E.ansi[2]=T(A.green,a.DEFAULT_ANSI_COLORS[2]),E.ansi[3]=T(A.yellow,a.DEFAULT_ANSI_COLORS[3]),E.ansi[4]=T(A.blue,a.DEFAULT_ANSI_COLORS[4]),E.ansi[5]=T(A.magenta,a.DEFAULT_ANSI_COLORS[5]),E.ansi[6]=T(A.cyan,a.DEFAULT_ANSI_COLORS[6]),E.ansi[7]=T(A.white,a.DEFAULT_ANSI_COLORS[7]),E.ansi[8]=T(A.brightBlack,a.DEFAULT_ANSI_COLORS[8]),E.ansi[9]=T(A.brightRed,a.DEFAULT_ANSI_COLORS[9]),E.ansi[10]=T(A.brightGreen,a.DEFAULT_ANSI_COLORS[10]),E.ansi[11]=T(A.brightYellow,a.DEFAULT_ANSI_COLORS[11]),E.ansi[12]=T(A.brightBlue,a.DEFAULT_ANSI_COLORS[12]),E.ansi[13]=T(A.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),E.ansi[14]=T(A.brightCyan,a.DEFAULT_ANSI_COLORS[14]),E.ansi[15]=T(A.brightWhite,a.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){const I=Math.min(E.ansi.length-16,A.extendedAnsi.length);for(let z=0;z<I;z++)E.ansi[z+16]=T(A.extendedAnsi[z],a.DEFAULT_ANSI_COLORS[z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){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[A]=this._restoreColors.ansi[A]}else for(let E=0;E<this._restoreColors.ansi.length;++E)this._colors.ansi[E]=this._restoreColors.ansi[E]}modifyColors(A){A(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 T(A,E){if(A!==void 0)try{return b.css.toColor(A)}catch{}return E}a.ThemeService=P=u([d(0,y.IOptionsService)],P)},6349:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),d=l(844);class c extends d.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.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(C){if(this._maxLength===C)return;const S=new Array(C);for(let y=0;y<Math.min(C,this.length);y++)S[y]=this._array[this._getCyclicIndex(y)];this._array=S,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let S=this._length;S<C;S++)this._array[S]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,S){this._array[this._getCyclicIndex(C)]=S}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,S,...y){if(S){for(let g=C;g<this._length-S;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+S)];this._length-=S,this.onDeleteEmitter.fire({index:C,amount:S})}for(let g=this._length-1;g>=C;g--)this._array[this._getCyclicIndex(g+y.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<y.length;g++)this._array[this._getCyclicIndex(C+g)]=y[g];if(y.length&&this.onInsertEmitter.fire({index:C,amount:y.length}),this._length+y.length>this._maxLength){const g=this._length+y.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=y.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,S,y){if(!(S<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+y<0)throw new Error("Cannot shift elements in list beyond index 0");if(y>0){for(let _=S-1;_>=0;_--)this.set(C+_+y,this.get(C+_));const g=C+S+y-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<S;g++)this.set(C+g+y,this.get(C+g))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}a.CircularList=c},1439:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(u,d=5){if(typeof u!="object")return u;const c=Array.isArray(u)?[]:{};for(const b in u)c[b]=d<=1?u[b]:u[b]&&l(u[b],d-1);return c}},8055:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,u=0,d=0,c=0;var b,C,S,y,g;function _(v){const D=v.toString(16);return D.length<2?"0"+D:D}function m(v,D){return v<D?(D+.05)/(v+.05):(v+.05)/(D+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(v){v.toCss=function(D,P,T,A){return A!==void 0?`#${_(D)}${_(P)}${_(T)}${_(A)}`:`#${_(D)}${_(P)}${_(T)}`},v.toRgba=function(D,P,T,A=255){return(D<<24|P<<16|T<<8|A)>>>0},v.toColor=function(D,P,T,A){return{css:v.toCss(D,P,T,A),rgba:v.toRgba(D,P,T,A)}}})(b||(a.channels=b={})),(function(v){function D(P,T){return c=Math.round(255*T),[l,u,d]=g.toChannels(P.rgba),{css:b.toCss(l,u,d,c),rgba:b.toRgba(l,u,d,c)}}v.blend=function(P,T){if(c=(255&T.rgba)/255,c===1)return{css:T.css,rgba:T.rgba};const A=T.rgba>>24&255,E=T.rgba>>16&255,I=T.rgba>>8&255,z=P.rgba>>24&255,H=P.rgba>>16&255,V=P.rgba>>8&255;return l=z+Math.round((A-z)*c),u=H+Math.round((E-H)*c),d=V+Math.round((I-V)*c),{css:b.toCss(l,u,d),rgba:b.toRgba(l,u,d)}},v.isOpaque=function(P){return(255&P.rgba)==255},v.ensureContrastRatio=function(P,T,A){const E=g.ensureContrastRatio(P.rgba,T.rgba,A);if(E)return b.toColor(E>>24&255,E>>16&255,E>>8&255)},v.opaque=function(P){const T=(255|P.rgba)>>>0;return[l,u,d]=g.toChannels(T),{css:b.toCss(l,u,d),rgba:T}},v.opacity=D,v.multiplyOpacity=function(P,T){return c=255&P.rgba,D(P,c*T/255)},v.toColorRGB=function(P){return[P.rgba>>24&255,P.rgba>>16&255,P.rgba>>8&255]}})(C||(a.color=C={})),(function(v){let D,P;try{const T=document.createElement("canvas");T.width=1,T.height=1;const A=T.getContext("2d",{willReadFrequently:!0});A&&(D=A,D.globalCompositeOperation="copy",P=D.createLinearGradient(0,0,1,1))}catch{}v.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return l=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),d=parseInt(T.slice(3,4).repeat(2),16),b.toColor(l,u,d);case 5:return l=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),d=parseInt(T.slice(3,4).repeat(2),16),c=parseInt(T.slice(4,5).repeat(2),16),b.toColor(l,u,d,c);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const A=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return l=parseInt(A[1]),u=parseInt(A[2]),d=parseInt(A[3]),c=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),b.toColor(l,u,d,c);if(!D||!P)throw new Error("css.toColor: Unsupported css format");if(D.fillStyle=P,D.fillStyle=T,typeof D.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(D.fillRect(0,0,1,1),[l,u,d,c]=D.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(l,u,d,c),css:T}}})(S||(a.css=S={})),(function(v){function D(P,T,A){const E=P/255,I=T/255,z=A/255;return .2126*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}v.relativeLuminance=function(P){return D(P>>16&255,P>>8&255,255&P)},v.relativeLuminance2=D})(y||(a.rgb=y={})),(function(v){function D(T,A,E){const I=T>>24&255,z=T>>16&255,H=T>>8&255;let V=A>>24&255,F=A>>16&255,q=A>>8&255,W=m(y.relativeLuminance2(V,F,q),y.relativeLuminance2(I,z,H));for(;W<E&&(V>0||F>0||q>0);)V-=Math.max(0,Math.ceil(.1*V)),F-=Math.max(0,Math.ceil(.1*F)),q-=Math.max(0,Math.ceil(.1*q)),W=m(y.relativeLuminance2(V,F,q),y.relativeLuminance2(I,z,H));return(V<<24|F<<16|q<<8|255)>>>0}function P(T,A,E){const I=T>>24&255,z=T>>16&255,H=T>>8&255;let V=A>>24&255,F=A>>16&255,q=A>>8&255,W=m(y.relativeLuminance2(V,F,q),y.relativeLuminance2(I,z,H));for(;W<E&&(V<255||F<255||q<255);)V=Math.min(255,V+Math.ceil(.1*(255-V))),F=Math.min(255,F+Math.ceil(.1*(255-F))),q=Math.min(255,q+Math.ceil(.1*(255-q))),W=m(y.relativeLuminance2(V,F,q),y.relativeLuminance2(I,z,H));return(V<<24|F<<16|q<<8|255)>>>0}v.blend=function(T,A){if(c=(255&A)/255,c===1)return A;const E=A>>24&255,I=A>>16&255,z=A>>8&255,H=T>>24&255,V=T>>16&255,F=T>>8&255;return l=H+Math.round((E-H)*c),u=V+Math.round((I-V)*c),d=F+Math.round((z-F)*c),b.toRgba(l,u,d)},v.ensureContrastRatio=function(T,A,E){const I=y.relativeLuminance(T>>8),z=y.relativeLuminance(A>>8);if(m(I,z)<E){if(z<I){const F=D(T,A,E),q=m(I,y.relativeLuminance(F>>8));if(q<E){const W=P(T,A,E);return q>m(I,y.relativeLuminance(W>>8))?F:W}return F}const H=P(T,A,E),V=m(I,y.relativeLuminance(H>>8));if(V<E){const F=D(T,A,E);return V>m(I,y.relativeLuminance(F>>8))?H:F}return H}},v.reduceLuminance=D,v.increaseLuminance=P,v.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(g||(a.rgba=g={})),a.toPaddedHex=_,a.contrastRatio=m},8969:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),d=l(2585),c=l(4348),b=l(7866),C=l(744),S=l(7302),y=l(6975),g=l(8460),_=l(1753),m=l(1480),v=l(7994),D=l(9282),P=l(5435),T=l(5981),A=l(2660);let E=!1;class I extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((H=>{var V;(V=this._onScrollApi)==null||V.fire(H.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(H){for(const V in H)this.optionsService.options[V]=H[V]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new S.OptionsService(H)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(y.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(v.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(A.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new P.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.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((V=>{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((V=>{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 T.WriteBuffer(((V,F)=>this._inputHandler.parse(V,F)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,V){this._writeBuffer.write(H,V)}writeSync(H,V){this._logService.logLevel<=d.LogLevelEnum.WARN&&!E&&(this._logService.warn("writeSync is unreliable and will be removed soon."),E=!0),this._writeBuffer.writeSync(H,V)}input(H,V=!0){this.coreService.triggerDataEvent(H,V)}resize(H,V){isNaN(H)||isNaN(V)||(H=Math.max(H,C.MINIMUM_COLS),V=Math.max(V,C.MINIMUM_ROWS),this._bufferService.resize(H,V))}scroll(H,V=!1){this._bufferService.scroll(H,V)}scrollLines(H,V,F){this._bufferService.scrollLines(H,V,F)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const V=H-this._bufferService.buffer.ydisp;V!==0&&this.scrollLines(V)}registerEscHandler(H,V){return this._inputHandler.registerEscHandler(H,V)}registerDcsHandler(H,V){return this._inputHandler.registerDcsHandler(H,V)}registerCsiHandler(H,V){return this._inputHandler.registerCsiHandler(H,V)}registerOscHandler(H,V){return this._inputHandler.registerOscHandler(H,V)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const V=this.optionsService.rawOptions.windowsPty;V&&V.buildNumber!==void 0&&V.buildNumber!==void 0?H=V.backend==="conpty"&&V.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(D.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,D.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const V of H)V.dispose()}))}}}a.CoreTerminal=I},8460:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const d=[];for(let c=0;c<this._listeners.length;c++)d.push(this._listeners[c]);for(let c=0;c<d.length;c++)d[c].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,u){return l((d=>u.fire(d)))},a.runAndSubscribe=function(l,u){return u(void 0),l((d=>u(d)))}},5435:function(w,a,l){var u=this&&this.__decorate||function(J,L,B,R){var G,X=arguments.length,oe=X<3?L:R===null?R=Object.getOwnPropertyDescriptor(L,B):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(J,L,B,R);else for(var ae=J.length-1;ae>=0;ae--)(G=J[ae])&&(oe=(X<3?G(oe):X>3?G(L,B,oe):G(L,B))||oe);return X>3&&oe&&Object.defineProperty(L,B,oe),oe},d=this&&this.__param||function(J,L){return function(B,R){L(B,R,J)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const c=l(2584),b=l(7116),C=l(2015),S=l(844),y=l(482),g=l(8437),_=l(8460),m=l(643),v=l(511),D=l(3734),P=l(2585),T=l(1480),A=l(6242),E=l(6351),I=l(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function V(J,L){if(J>24)return L.setWinLines||!1;switch(J){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var F;(function(J){J[J.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",J[J.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(a.WindowsOptionsReportType=F={}));let q=0;class W extends S.Disposable{getAttrData(){return this._curAttrData}constructor(L,B,R,G,X,oe,ae,me,$=new C.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=B,this._coreService=R,this._logService=G,this._optionsService=X,this._oscLinkService=oe,this._coreMouseService=ae,this._unicodeService=me,this._parser=$,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new y.StringToUtf32,this._utf8Decoder=new y.Utf8ToUtf32,this._workCell=new v.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.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((O=>this._activeBuffer=O.activeBuffer))),this._parser.setCsiHandlerFallback(((O,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:le.toArray()})})),this._parser.setEscHandlerFallback((O=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(O)})})),this._parser.setExecuteHandlerFallback((O=>{this._logService.debug("Unknown EXECUTE code: ",{code:O})})),this._parser.setOscHandlerFallback(((O,le,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:le,data:se})})),this._parser.setDcsHandlerFallback(((O,le,se)=>{le==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:le,payload:se})})),this._parser.setPrintHandler(((O,le,se)=>this.print(O,le,se))),this._parser.registerCsiHandler({final:"@"},(O=>this.insertChars(O))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(O=>this.scrollLeft(O))),this._parser.registerCsiHandler({final:"A"},(O=>this.cursorUp(O))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(O=>this.scrollRight(O))),this._parser.registerCsiHandler({final:"B"},(O=>this.cursorDown(O))),this._parser.registerCsiHandler({final:"C"},(O=>this.cursorForward(O))),this._parser.registerCsiHandler({final:"D"},(O=>this.cursorBackward(O))),this._parser.registerCsiHandler({final:"E"},(O=>this.cursorNextLine(O))),this._parser.registerCsiHandler({final:"F"},(O=>this.cursorPrecedingLine(O))),this._parser.registerCsiHandler({final:"G"},(O=>this.cursorCharAbsolute(O))),this._parser.registerCsiHandler({final:"H"},(O=>this.cursorPosition(O))),this._parser.registerCsiHandler({final:"I"},(O=>this.cursorForwardTab(O))),this._parser.registerCsiHandler({final:"J"},(O=>this.eraseInDisplay(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(O=>this.eraseInDisplay(O,!0))),this._parser.registerCsiHandler({final:"K"},(O=>this.eraseInLine(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(O=>this.eraseInLine(O,!0))),this._parser.registerCsiHandler({final:"L"},(O=>this.insertLines(O))),this._parser.registerCsiHandler({final:"M"},(O=>this.deleteLines(O))),this._parser.registerCsiHandler({final:"P"},(O=>this.deleteChars(O))),this._parser.registerCsiHandler({final:"S"},(O=>this.scrollUp(O))),this._parser.registerCsiHandler({final:"T"},(O=>this.scrollDown(O))),this._parser.registerCsiHandler({final:"X"},(O=>this.eraseChars(O))),this._parser.registerCsiHandler({final:"Z"},(O=>this.cursorBackwardTab(O))),this._parser.registerCsiHandler({final:"`"},(O=>this.charPosAbsolute(O))),this._parser.registerCsiHandler({final:"a"},(O=>this.hPositionRelative(O))),this._parser.registerCsiHandler({final:"b"},(O=>this.repeatPrecedingCharacter(O))),this._parser.registerCsiHandler({final:"c"},(O=>this.sendDeviceAttributesPrimary(O))),this._parser.registerCsiHandler({prefix:">",final:"c"},(O=>this.sendDeviceAttributesSecondary(O))),this._parser.registerCsiHandler({final:"d"},(O=>this.linePosAbsolute(O))),this._parser.registerCsiHandler({final:"e"},(O=>this.vPositionRelative(O))),this._parser.registerCsiHandler({final:"f"},(O=>this.hVPosition(O))),this._parser.registerCsiHandler({final:"g"},(O=>this.tabClear(O))),this._parser.registerCsiHandler({final:"h"},(O=>this.setMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(O=>this.setModePrivate(O))),this._parser.registerCsiHandler({final:"l"},(O=>this.resetMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(O=>this.resetModePrivate(O))),this._parser.registerCsiHandler({final:"m"},(O=>this.charAttributes(O))),this._parser.registerCsiHandler({final:"n"},(O=>this.deviceStatus(O))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(O=>this.deviceStatusPrivate(O))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(O=>this.softReset(O))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(O=>this.setCursorStyle(O))),this._parser.registerCsiHandler({final:"r"},(O=>this.setScrollRegion(O))),this._parser.registerCsiHandler({final:"s"},(O=>this.saveCursor(O))),this._parser.registerCsiHandler({final:"t"},(O=>this.windowOptions(O))),this._parser.registerCsiHandler({final:"u"},(O=>this.restoreCursor(O))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(O=>this.insertColumns(O))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(O=>this.deleteColumns(O))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(O=>this.selectProtected(O))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(O=>this.requestMode(O,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(O=>this.requestMode(O,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new A.OscHandler((O=>(this.setTitle(O),this.setIconName(O),!0)))),this._parser.registerOscHandler(1,new A.OscHandler((O=>this.setIconName(O)))),this._parser.registerOscHandler(2,new A.OscHandler((O=>this.setTitle(O)))),this._parser.registerOscHandler(4,new A.OscHandler((O=>this.setOrReportIndexedColor(O)))),this._parser.registerOscHandler(8,new A.OscHandler((O=>this.setHyperlink(O)))),this._parser.registerOscHandler(10,new A.OscHandler((O=>this.setOrReportFgColor(O)))),this._parser.registerOscHandler(11,new A.OscHandler((O=>this.setOrReportBgColor(O)))),this._parser.registerOscHandler(12,new A.OscHandler((O=>this.setOrReportCursorColor(O)))),this._parser.registerOscHandler(104,new A.OscHandler((O=>this.restoreIndexedColor(O)))),this._parser.registerOscHandler(110,new A.OscHandler((O=>this.restoreFgColor(O)))),this._parser.registerOscHandler(111,new A.OscHandler((O=>this.restoreBgColor(O)))),this._parser.registerOscHandler(112,new A.OscHandler((O=>this.restoreCursorColor(O)))),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 O in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:O},(()=>this.selectCharset("("+O))),this._parser.registerEscHandler({intermediates:")",final:O},(()=>this.selectCharset(")"+O))),this._parser.registerEscHandler({intermediates:"*",final:O},(()=>this.selectCharset("*"+O))),this._parser.registerEscHandler({intermediates:"+",final:O},(()=>this.selectCharset("+"+O))),this._parser.registerEscHandler({intermediates:"-",final:O},(()=>this.selectCharset("-"+O))),this._parser.registerEscHandler({intermediates:".",final:O},(()=>this.selectCharset("."+O))),this._parser.registerEscHandler({intermediates:"/",final:O},(()=>this.selectCharset("/"+O)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((O=>(this._logService.error("Parsing error: ",O),O))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((O,le)=>this.requestStatusString(O,le))))}_preserveStack(L,B,R,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=B,this._parseStack.decodedLength=R,this._parseStack.position=G}_logSlowResolvingAsync(L){this._logService.logLevel<=P.LogLevelEnum.WARN&&Promise.race([L,new Promise(((B,R)=>setTimeout((()=>R("#SLOW_TIMEOUT")),5e3)))]).catch((B=>{if(B!=="#SLOW_TIMEOUT")throw B;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,B){let R,G=this._activeBuffer.x,X=this._activeBuffer.y,oe=0;const ae=this._parseStack.paused;if(ae){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,B))return this._logSlowResolvingAsync(R),R;G=this._parseStack.cursorStartX,X=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>H&&(oe=this._parseStack.position+H)}if(this._logService.logLevel<=P.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(O=>String.fromCharCode(O))).join("")}"`),typeof L=="string"?L.split("").map((O=>O.charCodeAt(0))):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<H&&(this._parseBuffer=new Uint32Array(Math.min(L.length,H))),ae||this._dirtyRowTracker.clearRange(),L.length>H)for(let O=oe;O<L.length;O+=H){const le=O+H<L.length?O+H:L.length,se=typeof L=="string"?this._stringDecoder.decode(L.substring(O,le),this._parseBuffer):this._utf8Decoder.decode(L.subarray(O,le),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,se))return this._preserveStack(G,X,se,O),this._logSlowResolvingAsync(R),R}else if(!ae){const O=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,O))return this._preserveStack(G,X,O,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===G&&this._activeBuffer.y===X||this._onCursorMove.fire();const me=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),$=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);$<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min($,this._bufferService.rows-1),Math.min(me,this._bufferService.rows-1))}print(L,B,R){let G,X;const oe=this._charsetService.charset,ae=this._optionsService.rawOptions.screenReaderMode,me=this._bufferService.cols,$=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,le=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-B>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let ge=this._parser.precedingJoinState;for(let fe=B;fe<R;++fe){if(G=L[fe],G<127&&oe){const ot=oe[String.fromCharCode(G)];ot&&(G=ot.charCodeAt(0))}const Me=this._unicodeService.charProperties(G,ge);X=T.UnicodeService.extractWidth(Me);const We=T.UnicodeService.extractShouldJoin(Me),je=We?T.UnicodeService.extractWidth(ge):0;if(ge=Me,ae&&this._onA11yChar.fire((0,y.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+X-je>me){if($){const ot=se;let Ae=this._activeBuffer.x-je;for(this._activeBuffer.x=je,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),je>0&&se instanceof g.BufferLine&&se.copyCellsFrom(ot,Ae,0,je,!1);Ae<me;)ot.setCellFromCodepoint(Ae++,0,1,le)}else if(this._activeBuffer.x=me-1,X===2)continue}if(We&&this._activeBuffer.x){const ot=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-ot,G,X);for(let Ae=X-je;--Ae>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(O&&(se.insertCells(this._activeBuffer.x,X-je,this._activeBuffer.getNullCell(le)),se.getWidth(me-1)===2&&se.setCellFromCodepoint(me-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,le)),se.setCellFromCodepoint(this._activeBuffer.x++,G,X,le),X>0)for(;--X;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=ge,this._activeBuffer.x<me&&R-B>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,B){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,B):this._parser.registerCsiHandler(L,(R=>!V(R.params[0],this._optionsService.rawOptions.windowOptions)||B(R)))}registerDcsHandler(L,B){return this._parser.registerDcsHandler(L,new E.DcsHandler(B))}registerEscHandler(L,B){return this._parser.registerEscHandler(L,B)}registerOscHandler(L,B){return this._parser.registerOscHandler(L,new A.OscHandler(B))}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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,B){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+B):(this._activeBuffer.x=L,this._activeBuffer.y=B),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,B){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+B)}cursorUp(L){const B=this._activeBuffer.y-this._activeBuffer.scrollTop;return B>=0?this._moveCursor(0,-Math.min(B,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const B=this._activeBuffer.scrollBottom-this._activeBuffer.y;return B>=0?this._moveCursor(0,Math.min(B,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const B=L.params[0];return B===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:B===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=L.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let B=L.params[0]||1;for(;B--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const B=L.params[0];return B===1&&(this._curAttrData.bg|=536870912),B!==2&&B!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,B,R,G=!1,X=!1){const oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);oe.replaceCells(B,R,this._activeBuffer.getNullCell(this._eraseAttrData()),X),G&&(oe.isWrapped=!1)}_resetBufferLine(L,B=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),B),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),R.isWrapped=!1)}eraseInDisplay(L,B=!1){let R;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);R<this._bufferService.rows;R++)this._resetBufferLine(R,B);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,B),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,B);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,B);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(L,B=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,B);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,B);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,B)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let B=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,X=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;B--;)this._activeBuffer.lines.splice(X-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let B=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;B--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let B=L.params[0]||1;for(;B--;)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(L){let B=L.params[0]||1;for(;B--;)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(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.deleteCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.insertCells(0,B,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.insertCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.deleteCells(this._activeBuffer.x,B,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return B&&(B.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const B=this._parser.precedingJoinState;if(!B)return!0;const R=L.params[0]||1,G=T.UnicodeService.extractWidth(B),X=this._activeBuffer.x-G,oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(X),ae=new Uint32Array(oe.length*R);let me=0;for(let O=0;O<oe.length;){const le=oe.codePointAt(O)||0;ae[me++]=le,O+=le>65535?2:1}let $=me;for(let O=1;O<R;++O)ae.copyWithin($,0,me),$+=me;return this.print(ae,0,$),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let B=0;B<L.length;B++)switch(L.params[B]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let B=0;B<L.length;B++)switch(L.params[B]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.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(L){for(let B=0;B<L.length;B++)switch(L.params[B]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let B=0;B<L.length;B++)switch(L.params[B]){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(),L.params[B]===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(L,B){const R=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:X}=this._coreMouseService,oe=this._coreService,{buffers:ae,cols:me}=this._bufferService,{active:$,alt:O}=ae,le=this._optionsService.rawOptions,se=We=>We?1:2,ge=L.params[0];return fe=ge,Me=B?ge===2?4:ge===4?se(oe.modes.insertMode):ge===12?3:ge===20?se(le.convertEol):0:ge===1?se(R.applicationCursorKeys):ge===3?le.windowOptions.setWinLines?me===80?2:me===132?1:0:0:ge===6?se(R.origin):ge===7?se(R.wraparound):ge===8?3:ge===9?se(G==="X10"):ge===12?se(le.cursorBlink):ge===25?se(!oe.isCursorHidden):ge===45?se(R.reverseWraparound):ge===66?se(R.applicationKeypad):ge===67?4:ge===1e3?se(G==="VT200"):ge===1002?se(G==="DRAG"):ge===1003?se(G==="ANY"):ge===1004?se(R.sendFocus):ge===1005?4:ge===1006?se(X==="SGR"):ge===1015?4:ge===1016?se(X==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?se($===O):ge===2004?se(R.bracketedPasteMode):0,oe.triggerDataEvent(`${c.C0.ESC}[${B?"":"?"}${fe};${Me}$y`),!0;var fe,Me}_updateAttrColor(L,B,R,G,X){return B===2?(L|=50331648,L&=-16777216,L|=D.AttributeData.fromColorRGB([R,G,X])):B===5&&(L&=-50331904,L|=33554432|255&R),L}_extractColor(L,B,R){const G=[0,0,-1,0,0,0];let X=0,oe=0;do{if(G[oe+X]=L.params[B+oe],L.hasSubParams(B+oe)){const ae=L.getSubParams(B+oe);let me=0;do G[1]===5&&(X=1),G[oe+me+1+X]=ae[me];while(++me<ae.length&&me+oe+1+X<G.length);break}if(G[1]===5&&oe+X>=2||G[1]===2&&oe+X>=5)break;G[1]&&(X=1)}while(++oe+B<L.length&&oe+X<G.length);for(let ae=2;ae<G.length;++ae)G[ae]===-1&&(G[ae]=0);switch(G[0]){case 38:R.fg=this._updateAttrColor(R.fg,G[1],G[3],G[4],G[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,G[1],G[3],G[4],G[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,G[1],G[3],G[4],G[5])}return oe}_processUnderline(L,B){B.extended=B.extended.clone(),(!~L||L>5)&&(L=1),B.extended.underlineStyle=L,B.fg|=268435456,L===0&&(B.fg&=-268435457),B.updateExtended()}_processSGR0(L){L.fg=g.DEFAULT_ATTR_DATA.fg,L.bg=g.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const B=L.length;let R;const G=this._curAttrData;for(let X=0;X<B;X++)R=L.params[X],R>=30&&R<=37?(G.fg&=-50331904,G.fg|=16777216|R-30):R>=40&&R<=47?(G.bg&=-50331904,G.bg|=16777216|R-40):R>=90&&R<=97?(G.fg&=-50331904,G.fg|=16777224|R-90):R>=100&&R<=107?(G.bg&=-50331904,G.bg|=16777224|R-100):R===0?this._processSGR0(G):R===1?G.fg|=134217728:R===3?G.bg|=67108864:R===4?(G.fg|=268435456,this._processUnderline(L.hasSubParams(X)?L.getSubParams(X)[0]:1,G)):R===5?G.fg|=536870912:R===7?G.fg|=67108864:R===8?G.fg|=1073741824:R===9?G.fg|=2147483648:R===2?G.bg|=134217728:R===21?this._processUnderline(2,G):R===22?(G.fg&=-134217729,G.bg&=-134217729):R===23?G.bg&=-67108865:R===24?(G.fg&=-268435457,this._processUnderline(0,G)):R===25?G.fg&=-536870913:R===27?G.fg&=-67108865:R===28?G.fg&=-1073741825:R===29?G.fg&=2147483647:R===39?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):R===49?(G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?X+=this._extractColor(L,X,G):R===53?G.bg|=1073741824:R===55?G.bg&=-1073741825:R===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):R===100?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const B=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${B};${R}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const B=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${B};${R}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.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(L){const B=L.params[0]||1;switch(B){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 R=B%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(L){const B=L.params[0]||1;let R;return(L.length<2||(R=L.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>B&&(this._activeBuffer.scrollTop=B-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(L){if(!V(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const B=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:B!==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(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:B!==0&&B!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),B!==0&&B!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:B!==0&&B!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),B!==0&&B!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const B=[],R=L.split(";");for(;R.length>1;){const G=R.shift(),X=R.shift();if(/^\d+$/.exec(G)){const oe=parseInt(G);if(ie(oe))if(X==="?")B.push({type:0,index:oe});else{const ae=(0,I.parseColor)(X);ae&&B.push({type:1,index:oe,color:ae})}}}return B.length&&this._onColor.fire(B),!0}setHyperlink(L){const B=L.split(";");return!(B.length<2)&&(B[1]?this._createHyperlink(B[0],B[1]):!B[0]&&this._finishHyperlink())}_createHyperlink(L,B){this._getCurrentLinkId()&&this._finishHyperlink();const R=L.split(":");let G;const X=R.findIndex((oe=>oe.startsWith("id=")));return X!==-1&&(G=R[X].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:B}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,B){const R=L.split(";");for(let G=0;G<R.length&&!(B>=this._specialColors.length);++G,++B)if(R[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[B]}]);else{const X=(0,I.parseColor)(R[G]);X&&this._onColor.fire([{type:1,index:this._specialColors[B],color:X}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const B=[],R=L.split(";");for(let G=0;G<R.length;++G)if(/^\d+$/.exec(R[G])){const X=parseInt(R[G]);ie(X)&&B.push({type:2,index:X})}return B.length&&this._onColor.fire(B),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){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,b.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(z[L[0]],b.CHARSETS[L[1]]||b.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 L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new v.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let B=0;B<this._bufferService.rows;++B){const R=this._activeBuffer.ybase+this._activeBuffer.y+B,G=this._activeBuffer.lines.get(R);G&&(G.fill(L),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,B){const R=this._bufferService.buffer,G=this._optionsService.rawOptions;return(X=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${X}${c.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,B){this._dirtyRowTracker.markRangeDirty(L,B)}}a.InputHandler=W;let K=class{constructor(J){this._bufferService=J,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(J){J<this.start?this.start=J:J>this.end&&(this.end=J)}markRangeDirty(J,L){J>L&&(q=J,J=L,L=q),J<this.start&&(this.start=J),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function ie(J){return 0<=J&&J<256}K=u([d(0,P.IBufferService)],K)},844:(w,a)=>{function l(u){for(const d of u)d.dispose();u.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const d=this._disposables.indexOf(u);d!==-1&&this._disposables.splice(d,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var d;this._isDisposed||u===this._value||((d=this._value)==null||d.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},a.toDisposable=function(u){return{dispose:u}},a.disposeArray=l,a.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(d,c,b){this._data[d]||(this._data[d]={}),this._data[d][c]=b}get(d,c){return this._data[d]?this._data[d][c]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,d,c,b,C){this._data.get(u,d)||this._data.set(u,d,new l),this._data.get(u,d).set(c,b,C)}get(u,d,c,b){var C;return(C=this._data.get(u,d))==null?void 0:C.get(c,b)}clear(){this._data.clear()}}},6114:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,u=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const d=l.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),a.isIpad=u==="iPad",a.isIphone=u==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),a.isLinux=u.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const d=this._getKey(u);if(d===void 0||(l=this._search(d),l===-1)||this._getKey(this._array[l])!==d)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===d);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,d){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do d(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let d=0,c=this._array.length-1;for(;c>=d;){let b=d+c>>1;const C=this._getKey(this._array[b]);if(C>u)c=b-1;else{if(!(C<u)){for(;b>0&&this._getKey(this._array[b-1])===u;)b--;return b}d=b+1}}return d}}},7226:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const u=l(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let S=0,y=0,g=C.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),y=Math.max(S,y),_=C.timeRemaining(),1.5*y>_)return g-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-S))}ms`),void this._start();g=_}this.clear()}}class c extends d{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const S=Date.now()+C;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}a.PriorityTaskQueue=c,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:c,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const u=l(643);a.updateWindowsModeWrappedState=function(d){const c=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),b=c==null?void 0:c.get(d.cols-1),C=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);C&&b&&(C.isWrapped=b[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&b[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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}}a.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,b=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=b}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=u},9092:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const u=l(6349),d=l(7226),c=l(3734),b=l(8437),C=l(4634),S=l(511),y=l(643),g=l(4863),_=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(m,v,D){this._hasScrollback=m,this._optionsService=v,this._bufferService=D,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,y.NULL_CELL_CHAR,y.NULL_CELL_WIDTH,y.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,y.WHITESPACE_CELL_CHAR,y.WHITESPACE_CELL_WIDTH,y.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,v){return new b.BufferLine(this._bufferService.cols,this.getNullCell(m),v)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const v=m+this._optionsService.rawOptions.scrollback;return v>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:v}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=b.DEFAULT_ATTR_DATA);let v=this._rows;for(;v--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,v){const D=this.getNullCell(b.DEFAULT_ATTR_DATA);let P=0;const T=this._getCorrectBufferLength(v);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<m)for(let E=0;E<this.lines.length;E++)P+=+this.lines.get(E).resize(m,D);let A=0;if(this._rows<v)for(let E=this._rows;E<v;E++)this.lines.length<v+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(m,D)):this.ybase>0&&this.lines.length<=this.ybase+this.y+A+1?(this.ybase--,A++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(m,D)));else for(let E=this._rows;E>v;E--)this.lines.length>v+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T<this.lines.maxLength){const E=this.lines.length-T;E>0&&(this.lines.trimStart(E),this.ybase=Math.max(this.ybase-E,0),this.ydisp=Math.max(this.ydisp-E,0),this.savedY=Math.max(this.savedY-E,0)),this.lines.maxLength=T}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,v-1),A&&(this.y+=A),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=v-1,this._isReflowEnabled&&(this._reflow(m,v),this._cols>m))for(let A=0;A<this.lines.length;A++)P+=+this.lines.get(A).resize(m,D);this._cols=m,this._rows=v,this._memoryCleanupQueue.clear(),P>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let v=0;for(;this._memoryCleanupPosition<this.lines.length;)if(v+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),v>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,v){this._cols!==m&&(m>this._cols?this._reflowLarger(m,v):this._reflowSmaller(m,v))}_reflowLarger(m,v){const D=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(D.length>0){const P=(0,C.reflowLargerCreateNewLayout)(this.lines,D);(0,C.reflowLargerApplyNewLayout)(this.lines,P.layout),this._reflowLargerAdjustViewport(m,v,P.countRemoved)}}_reflowLargerAdjustViewport(m,v,D){const P=this.getNullCell(b.DEFAULT_ATTR_DATA);let T=D;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<v&&this.lines.push(new b.BufferLine(m,P))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-D,0)}_reflowSmaller(m,v){const D=this.getNullCell(b.DEFAULT_ATTR_DATA),P=[];let T=0;for(let A=this.lines.length-1;A>=0;A--){let E=this.lines.get(A);if(!E||!E.isWrapped&&E.getTrimmedLength()<=m)continue;const I=[E];for(;E.isWrapped&&A>0;)E=this.lines.get(--A),I.unshift(E);const z=this.ybase+this.y;if(z>=A&&z<A+I.length)continue;const H=I[I.length-1].getTrimmedLength(),V=(0,C.reflowSmallerGetNewLineLengths)(I,this._cols,m),F=V.length-I.length;let q;q=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 W=[];for(let R=0;R<F;R++){const G=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);W.push(G)}W.length>0&&(P.push({start:A+I.length+T,newLines:W}),T+=W.length),I.push(...W);let K=V.length-1,ie=V[K];ie===0&&(K--,ie=V[K]);let J=I.length-F-1,L=H;for(;J>=0;){const R=Math.min(L,ie);if(I[K]===void 0)break;if(I[K].copyCellsFrom(I[J],L-R,ie-R,R,!0),ie-=R,ie===0&&(K--,ie=V[K]),L-=R,L===0){J--;const G=Math.max(J,0);L=(0,C.getWrappedLineTrimmedLength)(I,G,this._cols)}}for(let R=0;R<I.length;R++)V[R]<m&&I[R].setCell(V[R],D);let B=F-q;for(;B-- >0;)this.ybase===0?this.y<v-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-v&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+v-1)}if(P.length>0){const A=[],E=[];for(let K=0;K<this.lines.length;K++)E.push(this.lines.get(K));const I=this.lines.length;let z=I-1,H=0,V=P[H];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let F=0;for(let K=Math.min(this.lines.maxLength-1,I+T-1);K>=0;K--)if(V&&V.start>z+F){for(let ie=V.newLines.length-1;ie>=0;ie--)this.lines.set(K--,V.newLines[ie]);K++,A.push({index:z+1,amount:V.newLines.length}),F+=V.newLines.length,V=P[++H]}else this.lines.set(K,E[z--]);let q=0;for(let K=A.length-1;K>=0;K--)A[K].index+=q,this.lines.onInsertEmitter.fire(A[K]),q+=A[K].amount;const W=Math.max(0,I+T-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(m,v,D=0,P){const T=this.lines.get(m);return T?T.translateToString(v,D,P):""}getWrappedRangeForLine(m){let v=m,D=m;for(;v>0&&this.lines.get(v).isWrapped;)v--;for(;D+1<this.lines.length&&this.lines.get(D+1).isWrapped;)D++;return{first:v,last:D}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].line===m&&(this.markers[v].dispose(),this.markers.splice(v--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const v=new g.Marker(m);return this.markers.push(v),v.register(this.lines.onTrim((D=>{v.line-=D,v.line<0&&v.dispose()}))),v.register(this.lines.onInsert((D=>{v.line>=D.index&&(v.line+=D.amount)}))),v.register(this.lines.onDelete((D=>{v.line>=D.index&&v.line<D.index+D.amount&&v.dispose(),v.line>D.index&&(v.line-=D.amount)}))),v.register(v.onDispose((()=>this._removeMarker(v)))),v}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const u=l(3734),d=l(511),c=l(643),b=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let C=0;class S{constructor(g,_,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const v=_||d.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let D=0;D<g;++D)this.setCell(D,v);this.length=g}get(g){const _=this._data[3*g+0],m=2097151&_;return[this._data[3*g+1],2097152&_?this._combined[g]:m?(0,b.stringFromCodePoint)(m):"",_>>22,2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):m]}set(g,_){this._data[3*g+1]=_[c.CHAR_DATA_ATTR_INDEX],_[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=_[1],this._data[3*g+0]=2097152|g|_[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=_[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&_}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g]:2097151&_?(0,b.stringFromCodePoint)(2097151&_):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,_){return C=3*g,_.content=this._data[C+0],_.fg=this._data[C+1],_.bg=this._data[C+2],2097152&_.content&&(_.combinedData=this._combined[g]),268435456&_.bg&&(_.extended=this._extendedAttrs[g]),_}setCell(g,_){2097152&_.content&&(this._combined[g]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[g]=_.extended),this._data[3*g+0]=_.content,this._data[3*g+1]=_.fg,this._data[3*g+2]=_.bg}setCellFromCodepoint(g,_,m,v){268435456&v.bg&&(this._extendedAttrs[g]=v.extended),this._data[3*g+0]=_|m<<22,this._data[3*g+1]=v.fg,this._data[3*g+2]=v.bg}addCodepointToCell(g,_,m){let v=this._data[3*g+0];2097152&v?this._combined[g]+=(0,b.stringFromCodePoint)(_):2097151&v?(this._combined[g]=(0,b.stringFromCodePoint)(2097151&v)+(0,b.stringFromCodePoint)(_),v&=-2097152,v|=2097152):v=_|4194304,m&&(v&=-12582913,v|=m<<22),this._data[3*g+0]=v}insertCells(g,_,m){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length-g){const v=new d.CellData;for(let D=this.length-g-_-1;D>=0;--D)this.setCell(g+_+D,this.loadCell(g+D,v));for(let D=0;D<_;++D)this.setCell(g+D,m)}else for(let v=g;v<this.length;++v)this.setCell(v,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(g,_,m){if(g%=this.length,_<this.length-g){const v=new d.CellData;for(let D=0;D<this.length-g-_;++D)this.setCell(g+D,this.loadCell(g+_+D,v));for(let D=this.length-_;D<this.length;++D)this.setCell(D,m)}else for(let v=g;v<this.length;++v)this.setCell(v,m);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,m)}replaceCells(g,_,m,v=!1){if(v)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,m);g<_&&g<this.length;)this.isProtected(g)||this.setCell(g,m),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,m);g<_&&g<this.length;)this.setCell(g++,m)}resize(g,_){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const v=new Uint32Array(m);v.set(this._data),this._data=v}for(let v=this.length;v<g;++v)this.setCell(v,_)}else{this._data=this._data.subarray(0,m);const v=Object.keys(this._combined);for(let P=0;P<v.length;P++){const T=parseInt(v[P],10);T>=g&&delete this._combined[T]}const D=Object.keys(this._extendedAttrs);for(let P=0;P<D.length;P++){const T=parseInt(D[P],10);T>=g&&delete this._extendedAttrs[T]}}return this.length=g,4*m*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,_=!1){if(_)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,g);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const _ in g._combined)this._combined[_]=g._combined[_];this._extendedAttrs={};for(const _ in g._extendedAttrs)this._extendedAttrs[_]=g._extendedAttrs[_];this.isWrapped=g.isWrapped}clone(){const g=new S(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const _ in this._combined)g._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)g._extendedAttrs[_]=this._extendedAttrs[_];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,_,m,v,D){const P=g._data;if(D)for(let A=v-1;A>=0;A--){for(let E=0;E<3;E++)this._data[3*(m+A)+E]=P[3*(_+A)+E];268435456&P[3*(_+A)+2]&&(this._extendedAttrs[m+A]=g._extendedAttrs[_+A])}else for(let A=0;A<v;A++){for(let E=0;E<3;E++)this._data[3*(m+A)+E]=P[3*(_+A)+E];268435456&P[3*(_+A)+2]&&(this._extendedAttrs[m+A]=g._extendedAttrs[_+A])}const T=Object.keys(g._combined);for(let A=0;A<T.length;A++){const E=parseInt(T[A],10);E>=_&&(this._combined[E-_+m]=g._combined[E])}}translateToString(g,_,m,v){_=_??0,m=m??this.length,g&&(m=Math.min(m,this.getTrimmedLength())),v&&(v.length=0);let D="";for(;_<m;){const P=this._data[3*_+0],T=2097151&P,A=2097152&P?this._combined[_]:T?(0,b.stringFromCodePoint)(T):c.WHITESPACE_CELL_CHAR;if(D+=A,v)for(let E=0;E<A.length;++E)v.push(_);_+=P>>22||1}return v&&v.push(_),D}}a.BufferLine=S},4841:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(w,a)=>{function l(u,d,c){if(d===u.length-1)return u[d].getTrimmedLength();const b=!u[d].hasContent(c-1)&&u[d].getWidth(c-1)===1,C=u[d+1].getWidth(0)===2;return b&&C?c-1:c}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,d,c,b,C){const S=[];for(let y=0;y<u.length-1;y++){let g=y,_=u.get(++g);if(!_.isWrapped)continue;const m=[u.get(y)];for(;g<u.length&&_.isWrapped;)m.push(_),_=u.get(++g);if(b>=y&&b<g){y+=m.length-1;continue}let v=0,D=l(m,v,d),P=1,T=0;for(;P<m.length;){const E=l(m,P,d),I=E-T,z=c-D,H=Math.min(I,z);m[v].copyCellsFrom(m[P],T,D,H,!1),D+=H,D===c&&(v++,D=0),T+=H,T===E&&(P++,T=0),D===0&&v!==0&&m[v-1].getWidth(c-1)===2&&(m[v].copyCellsFrom(m[v-1],c-1,D++,1,!1),m[v-1].setCell(c-1,C))}m[v].replaceCells(D,c,C);let A=0;for(let E=m.length-1;E>0&&(E>v||m[E].getTrimmedLength()===0);E--)A++;A>0&&(S.push(y+m.length-A),S.push(A)),y+=m.length-1}return S},a.reflowLargerCreateNewLayout=function(u,d){const c=[];let b=0,C=d[b],S=0;for(let y=0;y<u.length;y++)if(C===y){const g=d[++b];u.onDeleteEmitter.fire({index:y-S,amount:g}),y+=g-1,S+=g,C=d[++b]}else c.push(y);return{layout:c,countRemoved:S}},a.reflowLargerApplyNewLayout=function(u,d){const c=[];for(let b=0;b<d.length;b++)c.push(u.get(d[b]));for(let b=0;b<c.length;b++)u.set(b,c[b]);u.length=d.length},a.reflowSmallerGetNewLineLengths=function(u,d,c){const b=[],C=u.map(((_,m)=>l(u,m,d))).reduce(((_,m)=>_+m));let S=0,y=0,g=0;for(;g<C;){if(C-g<c){b.push(C-g);break}S+=c;const _=l(u,y,d);S>_&&(S-=_,y++);const m=u[y].getWidth(S-1)===2;m&&S--;const v=m?c-1:c;b.push(v),g+=v}return b},a.getWrappedLineTrimmedLength=l},5295:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),d=l(844),c=l(9092);class b extends d.Disposable{constructor(S,y){super(),this._optionsService=S,this._bufferService=y,this._onBufferActivate=this.register(new u.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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,y){this._normal.resize(S,y),this._alt.resize(S,y),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}a.BufferSet=b},511:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),d=l(643),c=l(3734);class b extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const y=new b;return y.setFromCharData(S),y}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let y=!1;if(S[d.CHAR_DATA_CHAR_INDEX].length>2)y=!0;else if(S[d.CHAR_DATA_CHAR_INDEX].length===2){const g=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const _=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(g-55296)+_-56320+65536|S[d.CHAR_DATA_WIDTH_INDEX]<<22:y=!0}else y=!0}else this.content=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22;y&&(this.combinedData=S[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=b},643:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const u=l(8460),d=l(844);class c{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}a.Marker=c,c._nextId=1},7116:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.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:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(w,a)=>{var l,u,d;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
67
- `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""})(l||(a.C0=l={})),(function(c){c.PAD="€",c.HOP="",c.BPH="‚",c.NBH="ƒ",c.IND="„",c.NEL="…",c.SSA="†",c.ESA="‡",c.HTS="ˆ",c.HTJ="‰",c.VTS="Š",c.PLD="‹",c.PLU="Œ",c.RI="",c.SS2="Ž",c.SS3="",c.DCS="",c.PU1="‘",c.PU2="’",c.STS="“",c.CCH="”",c.MW="•",c.SPA="–",c.EPA="—",c.SOS="˜",c.SGCI="™",c.SCI="š",c.CSI="›",c.ST="œ",c.OSC="",c.PM="ž",c.APC="Ÿ"})(u||(a.C1=u={})),(function(c){c.ST=`${l.ESC}\\`})(d||(a.C1_ESCAPED=d={}))},7399:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const u=l(2584),d={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:["'",'"']};a.evaluateKeyboardEvent=function(c,b,C,S){const y={type:0,cancel:!1,key:void 0},g=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?y.key=b?u.C0.ESC+"OA":u.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?y.key=b?u.C0.ESC+"OD":u.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?y.key=b?u.C0.ESC+"OC":u.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(y.key=b?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:y.key=c.ctrlKey?"\b":u.C0.DEL,c.altKey&&(y.key=u.C0.ESC+y.key);break;case 9:if(c.shiftKey){y.key=u.C0.ESC+"[Z";break}y.key=u.C0.HT,y.cancel=!0;break;case 13:y.key=c.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,y.cancel=!0;break;case 27:y.key=u.C0.ESC,c.altKey&&(y.key=u.C0.ESC+u.C0.ESC),y.cancel=!0;break;case 37:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"D",y.key===u.C0.ESC+"[1;3D"&&(y.key=u.C0.ESC+(C?"b":"[1;5D"))):y.key=b?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"C",y.key===u.C0.ESC+"[1;3C"&&(y.key=u.C0.ESC+(C?"f":"[1;5C"))):y.key=b?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"A",C||y.key!==u.C0.ESC+"[1;3A"||(y.key=u.C0.ESC+"[1;5A")):y.key=b?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"B",C||y.key!==u.C0.ESC+"[1;3B"||(y.key=u.C0.ESC+"[1;5B")):y.key=b?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(y.key=u.C0.ESC+"[2~");break;case 46:y.key=g?u.C0.ESC+"[3;"+(g+1)+"~":u.C0.ESC+"[3~";break;case 36:y.key=g?u.C0.ESC+"[1;"+(g+1)+"H":b?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:y.key=g?u.C0.ESC+"[1;"+(g+1)+"F":b?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:c.shiftKey?y.type=2:c.ctrlKey?y.key=u.C0.ESC+"[5;"+(g+1)+"~":y.key=u.C0.ESC+"[5~";break;case 34:c.shiftKey?y.type=3:c.ctrlKey?y.key=u.C0.ESC+"[6;"+(g+1)+"~":y.key=u.C0.ESC+"[6~";break;case 112:y.key=g?u.C0.ESC+"[1;"+(g+1)+"P":u.C0.ESC+"OP";break;case 113:y.key=g?u.C0.ESC+"[1;"+(g+1)+"Q":u.C0.ESC+"OQ";break;case 114:y.key=g?u.C0.ESC+"[1;"+(g+1)+"R":u.C0.ESC+"OR";break;case 115:y.key=g?u.C0.ESC+"[1;"+(g+1)+"S":u.C0.ESC+"OS";break;case 116:y.key=g?u.C0.ESC+"[15;"+(g+1)+"~":u.C0.ESC+"[15~";break;case 117:y.key=g?u.C0.ESC+"[17;"+(g+1)+"~":u.C0.ESC+"[17~";break;case 118:y.key=g?u.C0.ESC+"[18;"+(g+1)+"~":u.C0.ESC+"[18~";break;case 119:y.key=g?u.C0.ESC+"[19;"+(g+1)+"~":u.C0.ESC+"[19~";break;case 120:y.key=g?u.C0.ESC+"[20;"+(g+1)+"~":u.C0.ESC+"[20~";break;case 121:y.key=g?u.C0.ESC+"[21;"+(g+1)+"~":u.C0.ESC+"[21~";break;case 122:y.key=g?u.C0.ESC+"[23;"+(g+1)+"~":u.C0.ESC+"[23~";break;case 123:y.key=g?u.C0.ESC+"[24;"+(g+1)+"~":u.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(C&&!S||!c.altKey||c.metaKey)!C||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?y.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(y.key=u.C0.US),c.key==="@"&&(y.key=u.C0.NUL)):c.keyCode===65&&(y.type=1);else{const _=d[c.keyCode],m=_==null?void 0:_[c.shiftKey?1:0];if(m)y.key=u.C0.ESC+m;else if(c.keyCode>=65&&c.keyCode<=90){const v=c.ctrlKey?c.keyCode-64:c.keyCode+32;let D=String.fromCharCode(v);c.shiftKey&&(D=D.toUpperCase()),y.key=u.C0.ESC+D}else if(c.keyCode===32)y.key=u.C0.ESC+(c.ctrlKey?u.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let v=c.code.slice(3,4);c.shiftKey||(v=v.toLowerCase()),y.key=u.C0.ESC+v,y.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?y.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?y.key=u.C0.NUL:c.keyCode>=51&&c.keyCode<=55?y.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?y.key=u.C0.DEL:c.keyCode===219?y.key=u.C0.ESC:c.keyCode===220?y.key=u.C0.FS:c.keyCode===221&&(y.key=u.C0.GS)}return y}},482:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,u=0,d=l.length){let c="";for(let b=u;b<d;++b){let C=l[b];C>65535?(C-=65536,c+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):c+=String.fromCharCode(C)}return c},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const d=l.length;if(!d)return 0;let c=0,b=0;if(this._interim){const C=l.charCodeAt(b++);56320<=C&&C<=57343?u[c++]=1024*(this._interim-55296)+C-56320+65536:(u[c++]=this._interim,u[c++]=C),this._interim=0}for(let C=b;C<d;++C){const S=l.charCodeAt(C);if(55296<=S&&S<=56319){if(++C>=d)return this._interim=S,c;const y=l.charCodeAt(C);56320<=y&&y<=57343?u[c++]=1024*(S-55296)+y-56320+65536:(u[c++]=S,u[c++]=y)}else S!==65279&&(u[c++]=S)}return c}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const d=l.length;if(!d)return 0;let c,b,C,S,y=0,g=0,_=0;if(this.interim[0]){let D=!1,P=this.interim[0];P&=(224&P)==192?31:(240&P)==224?15:7;let T,A=0;for(;(T=63&this.interim[++A])&&A<4;)P<<=6,P|=T;const E=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=E-A;for(;_<I;){if(_>=d)return 0;if(T=l[_++],(192&T)!=128){_--,D=!0;break}this.interim[A++]=T,P<<=6,P|=63&T}D||(E===2?P<128?_--:u[y++]=P:E===3?P<2048||P>=55296&&P<=57343||P===65279||(u[y++]=P):P<65536||P>1114111||(u[y++]=P)),this.interim.fill(0)}const m=d-4;let v=_;for(;v<d;){for(;!(!(v<m)||128&(c=l[v])||128&(b=l[v+1])||128&(C=l[v+2])||128&(S=l[v+3]));)u[y++]=c,u[y++]=b,u[y++]=C,u[y++]=S,v+=4;if(c=l[v++],c<128)u[y++]=c;else if((224&c)==192){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(g=(31&c)<<6|63&b,g<128){v--;continue}u[y++]=g}else if((240&c)==224){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,y;if(C=l[v++],(192&C)!=128){v--;continue}if(g=(15&c)<<12|(63&b)<<6|63&C,g<2048||g>=55296&&g<=57343||g===65279)continue;u[y++]=g}else if((248&c)==240){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,y;if(C=l[v++],(192&C)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,this.interim[2]=C,y;if(S=l[v++],(192&S)!=128){v--;continue}if(g=(7&c)<<18|(63&b)<<12|(63&C)<<6|63&S,g<65536||g>1114111)continue;u[y++]=g}}return y}}},225:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const u=l(1480),d=[[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]],c=[[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 b;a.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let C=0;C<d.length;++C)b.fill(0,d[C][0],d[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?b[C]:(function(S,y){let g,_=0,m=y.length-1;if(S<y[0][0]||S>y[m][1])return!1;for(;m>=_;)if(g=_+m>>1,S>y[g][1])_=g+1;else{if(!(S<y[g][0]))return!0;m=g-1}return!1})(C,c)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,S){let y=this.wcwidth(C),g=y===0&&S!==0;if(g){const _=u.UnicodeService.extractWidth(S);_===0?g=!1:_>y&&(y=_)}return u.UnicodeService.createPropertyValue(0,y,g)}}},5981:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),d=l(844);class c extends d.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let y;for(this._isSyncWriting=!0;y=this._writeBuffer.shift();){this._action(y);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,S){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+=C.length,this._writeBuffer.push(C),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(S)}_innerWrite(C=0,S=!0){const y=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],_=this._action(g,S);if(_){const v=D=>Date.now()-y>=12?setTimeout((()=>this._innerWrite(0,D))):this._innerWrite(y,D);return void _.catch((D=>(queueMicrotask((()=>{throw D})),Promise.resolve(!1)))).then(v)}const m=this._callbacks[this._bufferOffset];if(m&&m(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-y>=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()}}a.WriteBuffer=c},5941:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\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})$/,u=/^[\da-f]+$/;function d(c,b){const C=c.toString(16),S=C.length<2?"0"+C:C;switch(b){case 4:return C[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}a.parseColor=function(c){if(!c)return;let b=c.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const C=l.exec(b);if(C){const S=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/S*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/S*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/S*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),u.exec(b)&&[3,6,9,12].includes(b.length))){const C=b.length/3,S=[0,0,0];for(let y=0;y<3;++y){const g=parseInt(b.slice(C*y,C*y+C),16);S[y]=C===1?g<<4:C===2?g:C===3?g>>4:g>>8}return S}},a.toRgbString=function(c,b=16){const[C,S,y]=c;return`rgb:${d(C,b)}/${d(S,b)}/${d(y,b)}`}},5770:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const u=l(482),d=l(8742),c=l(5770),b=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(S,y){this._handlers[S]===void 0&&(this._handlers[S]=[]);const g=this._handlers[S];return g.push(y),{dispose:()=>{const _=g.indexOf(y);_!==-1&&g.splice(_,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(S,y){if(this.reset(),this._ident=S,this._active=this._handlers[S]||b,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(y);else this._handlerFb(this._ident,"HOOK",y)}put(S,y,g){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(S,y,g);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(S,y,g))}unhook(S,y=!0){if(this._active.length){let g=!1,_=this._active.length-1,m=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,g=y,m=this._stack.fallThrough,this._stack.paused=!1),!m&&g===!1){for(;_>=0&&(g=this._active[_].unhook(S),g!==!0);_--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,g;_--}for(;_>=0;_--)if(g=this._active[_].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",S);this._active=b,this._ident=0}};const C=new d.Params;C.addParam(0),a.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=C,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():C,this._data="",this._hitLimit=!1}put(S,y,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(S,y,g),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let y=!1;if(this._hitLimit)y=!1;else if(S&&(y=this._handler(this._data,this._params),y instanceof Promise))return y.then((g=>(this._params=C,this._data="",this._hitLimit=!1,g)));return this._params=C,this._data="",this._hitLimit=!1,y}}},2015:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const u=l(844),d=l(8742),c=l(6242),b=l(6351);class C{constructor(_){this.table=new Uint8Array(_)}setDefault(_,m){this.table.fill(_<<4|m)}add(_,m,v,D){this.table[m<<8|_]=v<<4|D}addMany(_,m,v,D){for(let P=0;P<_.length;P++)this.table[m<<8|_[P]]=v<<4|D}}a.TransitionTable=C;const S=160;a.VT500_TRANSITION_TABLE=(function(){const g=new C(4095),_=Array.apply(null,Array(256)).map(((A,E)=>E)),m=(A,E)=>_.slice(A,E),v=m(32,127),D=m(0,24);D.push(25),D.push.apply(D,m(28,32));const P=m(0,14);let T;for(T in g.setDefault(1,0),g.addMany(v,0,2,0),P)g.addMany([24,26,153,154],T,3,0),g.addMany(m(128,144),T,3,0),g.addMany(m(144,152),T,3,0),g.add(156,T,0,0),g.add(27,T,11,1),g.add(157,T,4,8),g.addMany([152,158,159],T,0,7),g.add(155,T,11,3),g.add(144,T,11,9);return g.addMany(D,0,3,0),g.addMany(D,1,3,1),g.add(127,1,0,1),g.addMany(D,8,0,8),g.addMany(D,3,3,3),g.add(127,3,0,3),g.addMany(D,4,3,4),g.add(127,4,0,4),g.addMany(D,6,3,6),g.addMany(D,5,3,5),g.add(127,5,0,5),g.addMany(D,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(v,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(m(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(v,7,0,7),g.addMany(D,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(m(64,127),3,7,0),g.addMany(m(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(m(48,60),4,8,4),g.addMany(m(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(m(32,64),6,0,6),g.add(127,6,0,6),g.addMany(m(64,127),6,0,0),g.addMany(m(32,48),3,9,5),g.addMany(m(32,48),5,9,5),g.addMany(m(48,64),5,0,6),g.addMany(m(64,127),5,7,0),g.addMany(m(32,48),4,9,5),g.addMany(m(32,48),1,9,2),g.addMany(m(32,48),2,9,2),g.addMany(m(48,127),2,10,0),g.addMany(m(48,80),1,10,0),g.addMany(m(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(m(96,127),1,10,0),g.add(80,1,11,9),g.addMany(D,9,0,9),g.add(127,9,0,9),g.addMany(m(28,32),9,0,9),g.addMany(m(32,48),9,9,12),g.addMany(m(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(D,11,0,11),g.addMany(m(32,128),11,0,11),g.addMany(m(28,32),11,0,11),g.addMany(D,10,0,10),g.add(127,10,0,10),g.addMany(m(28,32),10,0,10),g.addMany(m(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(m(32,48),10,9,12),g.addMany(D,12,0,12),g.add(127,12,0,12),g.addMany(m(28,32),12,0,12),g.addMany(m(32,48),12,9,12),g.addMany(m(48,64),12,0,11),g.addMany(m(64,127),12,12,13),g.addMany(m(64,127),10,12,13),g.addMany(m(64,127),9,12,13),g.addMany(D,13,13,13),g.addMany(v,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(S,0,2,0),g.add(S,8,5,8),g.add(S,6,0,6),g.add(S,11,0,11),g.add(S,13,13,13),g})();class y extends u.Disposable{constructor(_=a.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(m,v,D)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,v)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,m=[64,126]){let v=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(v=_.prefix.charCodeAt(0),v&&60>v||v>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let P=0;P<_.intermediates.length;++P){const T=_.intermediates.charCodeAt(P);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");v<<=8,v|=T}}if(_.final.length!==1)throw new Error("final must be a single byte");const D=_.final.charCodeAt(0);if(m[0]>D||D>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return v<<=8,v|=D,v}identToString(_){const m=[];for(;_;)m.push(String.fromCharCode(255&_)),_>>=8;return m.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,m){const v=this._identifier(_,[48,126]);this._escHandlers[v]===void 0&&(this._escHandlers[v]=[]);const D=this._escHandlers[v];return D.push(m),{dispose:()=>{const P=D.indexOf(m);P!==-1&&D.splice(P,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,m){this._executeHandlers[_.charCodeAt(0)]=m}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,m){const v=this._identifier(_);this._csiHandlers[v]===void 0&&(this._csiHandlers[v]=[]);const D=this._csiHandlers[v];return D.push(m),{dispose:()=>{const P=D.indexOf(m);P!==-1&&D.splice(P,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,m){return this._dcsParser.registerHandler(this._identifier(_),m)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,m){return this._oscParser.registerHandler(_,m)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,m,v,D,P){this._parseStack.state=_,this._parseStack.handlers=m,this._parseStack.handlerPos=v,this._parseStack.transition=D,this._parseStack.chunkPos=P}parse(_,m,v){let D,P=0,T=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(v===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const E=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(v===!1&&I>-1){for(;I>=0&&(D=E[I](this._params),D!==!0);I--)if(D instanceof Promise)return this._parseStack.handlerPos=I,D}this._parseStack.handlers=[];break;case 4:if(v===!1&&I>-1){for(;I>=0&&(D=E[I](),D!==!0);I--)if(D instanceof Promise)return this._parseStack.handlerPos=I,D}this._parseStack.handlers=[];break;case 6:if(P=_[this._parseStack.chunkPos],D=this._dcsParser.unhook(P!==24&&P!==26,v),D)return D;P===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(P=_[this._parseStack.chunkPos],D=this._oscParser.end(P!==24&&P!==26,v),D)return D;P===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let E=A;E<m;++E){switch(P=_[E],T=this._transitions.table[this.currentState<<8|(P<160?P:S)],T>>4){case 2:for(let F=E+1;;++F){if(F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}}break;case 3:this._executeHandlers[P]?this._executeHandlers[P]():this._executeHandlerFb(P),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:E,code:P,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|P];let z=I?I.length-1:-1;for(;z>=0&&(D=I[z](this._params),D!==!0);z--)if(D instanceof Promise)return this._preserveStack(3,I,z,T,E),D;z<0&&this._csiHandlerFb(this._collect<<8|P,this._params),this.precedingJoinState=0;break;case 8:do switch(P){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(P-48)}while(++E<m&&(P=_[E])>47&&P<60);E--;break;case 9:this._collect<<=8,this._collect|=P;break;case 10:const H=this._escHandlers[this._collect<<8|P];let V=H?H.length-1:-1;for(;V>=0&&(D=H[V](),D!==!0);V--)if(D instanceof Promise)return this._preserveStack(4,H,V,T,E),D;V<0&&this._escHandlerFb(this._collect<<8|P),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|P,this._params);break;case 13:for(let F=E+1;;++F)if(F>=m||(P=_[F])===24||P===26||P===27||P>127&&P<S){this._dcsParser.put(_,E,F),E=F-1;break}break;case 14:if(D=this._dcsParser.unhook(P!==24&&P!==26),D)return this._preserveStack(6,[],0,T,E),D;P===27&&(T|=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=E+1;;F++)if(F>=m||(P=_[F])<32||P>127&&P<S){this._oscParser.put(_,E,F),E=F-1;break}break;case 6:if(D=this._oscParser.end(P!==24&&P!==26),D)return this._preserveStack(5,[],0,T,E),D;P===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}a.EscapeSequenceParser=y},6242:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const u=l(5770),d=l(482),c=[];a.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,C){this._handlers[b]===void 0&&(this._handlers[b]=[]);const S=this._handlers[b];return S.push(C),{dispose:()=>{const y=S.indexOf(C);y!==-1&&S.splice(y,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,C,S){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(b,C,S);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(b,C,S))}start(){this.reset(),this._state=1}put(b,C,S){if(this._state!==3){if(this._state===1)for(;C<S;){const y=b[C++];if(y===59){this._state=2,this._start();break}if(y<48||57<y)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+y-48}this._state===2&&S-C>0&&this._put(b,C,S)}}end(b,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,y=this._active.length-1,g=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,S=C,g=this._stack.fallThrough,this._stack.paused=!1),!g&&S===!1){for(;y>=0&&(S=this._active[y].end(b),S!==!0);y--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,S;y--}for(;y>=0;y--)if(S=this._active[y].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",b);this._active=c,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,C,S){this._hitLimit||(this._data+=(0,d.utf32ToString)(b,C,S),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let C=!1;if(this._hitLimit)C=!1;else if(b&&(C=this._handler(this._data),C instanceof Promise))return C.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,C}}},8742:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(c){const b=new u;if(!c.length)return b;for(let C=Array.isArray(c[0])?1:0;C<c.length;++C){const S=c[C];if(Array.isArray(S))for(let y=0;y<S.length;++y)b.addSubParam(S[y]);else b.addParam(S)}return b}constructor(c=32,b=32){if(this.maxLength=c,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new u(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let b=0;b<this.length;++b){c.push(this.params[b]);const C=this._subParamsIdx[b]>>8,S=255&this._subParamsIdx[b];S-C>0&&c.push(Array.prototype.slice.call(this._subParams,C,S))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const b=this._subParamsIdx[c]>>8,C=255&this._subParamsIdx[c];return C-b>0?this._subParams.subarray(b,C):null}getSubParamsAll(){const c={};for(let b=0;b<this.length;++b){const C=this._subParamsIdx[b]>>8,S=255&this._subParamsIdx[b];S-C>0&&(c[b]=this._subParams.slice(C,S))}return c}addDigit(c){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,S=C[b-1];C[b-1]=~S?Math.min(10*S+c,l):c}}a.Params=u},5741:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const d={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(d),u.dispose=()=>this._wrappedAddonDispose(d),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===l){u=d;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const u=l(3785),d=l(511);a.BufferApiView=class{constructor(c,b){this._buffer=c,this.type=b}init(c){return this._buffer=c,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(c){const b=this._buffer.lines.get(c);if(b)return new u.BufferLineApiView(b)}getNullCell(){return new d.CellData}}},3785:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const u=l(511);a.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,c){if(!(d<0||d>=this._line.length))return c?(this._line.loadCell(d,c),c):this._line.loadCell(d,new u.CellData)}translateToString(d,c,b){return this._line.translateToString(d,c,b)}}},8285:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),d=l(8460),c=l(844);class b extends c.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new d.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.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)}}a.BufferNamespaceApi=b},7975:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(d=>u(d.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((d,c)=>u(d,c.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(w,a,l){var u=this&&this.__decorate||function(g,_,m,v){var D,P=arguments.length,T=P<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(g,_,m,v);else for(var A=g.length-1;A>=0;A--)(D=g[A])&&(T=(P<3?D(T):P>3?D(_,m,T):D(_,m))||T);return P>3&&T&&Object.defineProperty(_,m,T),T},d=this&&this.__param||function(g,_){return function(m,v){_(m,v,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const c=l(8460),b=l(844),C=l(5295),S=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let y=a.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(g,this))}resize(g,_){this.cols=g,this.rows=_,this.buffers.resize(g,_),this._onResize.fire({cols:g,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,_=!1){const m=this.buffer;let v;v=this._cachedBlankLine,v&&v.length===this.cols&&v.getFg(0)===g.fg&&v.getBg(0)===g.bg||(v=m.getBlankLine(g,_),this._cachedBlankLine=v),v.isWrapped=_;const D=m.ybase+m.scrollTop,P=m.ybase+m.scrollBottom;if(m.scrollTop===0){const T=m.lines.isFull;P===m.lines.length-1?T?m.lines.recycle().copyFrom(v):m.lines.push(v.clone()):m.lines.splice(P+1,0,v.clone()),T?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const T=P-D+1;m.lines.shiftElements(D+1,T-1,-1),m.lines.set(P,v.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(g,_,m){const v=this.buffer;if(g<0){if(v.ydisp===0)return;this.isUserScrolling=!0}else g+v.ydisp>=v.ybase&&(this.isUserScrolling=!1);const D=v.ydisp;v.ydisp=Math.max(Math.min(v.ydisp+g,v.ybase),0),D!==v.ydisp&&(_||this._onScroll.fire(v.ydisp))}};a.BufferService=y=u([d(0,S.IOptionsService)],y)},7994:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(w,a,l){var u=this&&this.__decorate||function(v,D,P,T){var A,E=arguments.length,I=E<3?D:T===null?T=Object.getOwnPropertyDescriptor(D,P):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(v,D,P,T);else for(var z=v.length-1;z>=0;z--)(A=v[z])&&(I=(E<3?A(I):E>3?A(D,P,I):A(D,P))||I);return E>3&&I&&Object.defineProperty(D,P,I),I},d=this&&this.__param||function(v,D){return function(P,T){D(P,T,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const c=l(2585),b=l(8460),C=l(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:v=>v.button!==4&&v.action===1&&(v.ctrl=!1,v.alt=!1,v.shift=!1,!0)},VT200:{events:19,restrict:v=>v.action!==32},DRAG:{events:23,restrict:v=>v.action!==32||v.button!==3},ANY:{events:31,restrict:v=>!0}};function y(v,D){let P=(v.ctrl?16:0)|(v.shift?4:0)|(v.alt?8:0);return v.button===4?(P|=64,P|=v.action):(P|=3&v.button,4&v.button&&(P|=64),8&v.button&&(P|=128),v.action===32?P|=32:v.action!==0||D||(P|=3)),P}const g=String.fromCharCode,_={DEFAULT:v=>{const D=[y(v,!1)+32,v.col+32,v.row+32];return D[0]>255||D[1]>255||D[2]>255?"":`\x1B[M${g(D[0])}${g(D[1])}${g(D[2])}`},SGR:v=>{const D=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${y(v,!0)};${v.col};${v.row}${D}`},SGR_PIXELS:v=>{const D=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${y(v,!0)};${v.x};${v.y}${D}`}};let m=a.CoreMouseService=class extends C.Disposable{constructor(v,D){super(),this._bufferService=v,this._coreService=D,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const P of Object.keys(S))this.addProtocol(P,S[P]);for(const P of Object.keys(_))this.addEncoding(P,_[P]);this.reset()}addProtocol(v,D){this._protocols[v]=D}addEncoding(v,D){this._encodings[v]=D}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(v){if(!this._protocols[v])throw new Error(`unknown protocol "${v}"`);this._activeProtocol=v,this._onProtocolChange.fire(this._protocols[v].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(v){if(!this._encodings[v])throw new Error(`unknown encoding "${v}"`);this._activeEncoding=v}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(v){if(v.col<0||v.col>=this._bufferService.cols||v.row<0||v.row>=this._bufferService.rows||v.button===4&&v.action===32||v.button===3&&v.action!==32||v.button!==4&&(v.action===2||v.action===3)||(v.col++,v.row++,v.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,v,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(v))return!1;const D=this._encodings[this._activeEncoding](v);return D&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(D):this._coreService.triggerDataEvent(D,!0)),this._lastEvent=v,!0}explainEvents(v){return{down:!!(1&v),up:!!(2&v),drag:!!(4&v),move:!!(8&v),wheel:!!(16&v)}}_equalEvents(v,D,P){if(P){if(v.x!==D.x||v.y!==D.y)return!1}else if(v.col!==D.col||v.row!==D.row)return!1;return v.button===D.button&&v.action===D.action&&v.ctrl===D.ctrl&&v.alt===D.alt&&v.shift===D.shift}};a.CoreMouseService=m=u([d(0,c.IBufferService),d(1,c.ICoreService)],m)},6975:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const c=l(1439),b=l(8460),C=l(844),S=l(2585),y=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=a.CoreService=class extends C.Disposable{constructor(m,v,D){super(),this._bufferService=m,this._logService=v,this._optionsService=D,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(y),this.decPrivateModes=(0,c.clone)(g)}reset(){this.modes=(0,c.clone)(y),this.decPrivateModes=(0,c.clone)(g)}triggerDataEvent(m,v=!1){if(this._optionsService.rawOptions.disableStdin)return;const D=this._bufferService.buffer;v&&this._optionsService.rawOptions.scrollOnUserInput&&D.ybase!==D.ydisp&&this._onRequestScrollToBottom.fire(),v&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((P=>P.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((v=>v.charCodeAt(0))))),this._onBinary.fire(m))}};a.CoreService=_=u([d(0,S.IBufferService),d(1,S.ILogService),d(2,S.IOptionsService)],_)},9074:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),d=l(8460),c=l(844),b=l(6106);let C=0,S=0;class y extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((m=>m==null?void 0:m.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)((()=>this.reset())))}registerDecoration(m){if(m.marker.isDisposed)return;const v=new g(m);if(v){const D=v.marker.onDispose((()=>v.dispose()));v.onDispose((()=>{v&&(this._decorations.delete(v)&&this._onDecorationRemoved.fire(v),D.dispose())})),this._decorations.insert(v),this._onDecorationRegistered.fire(v)}return v}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,v,D){let P=0,T=0;for(const A of this._decorations.getKeyIterator(v))P=A.options.x??0,T=P+(A.options.width??1),m>=P&&m<T&&(!D||(A.options.layer??"bottom")===D)&&(yield A)}forEachDecorationAtCell(m,v,D,P){this._decorations.forEachByKey(v,(T=>{C=T.options.x??0,S=C+(T.options.width??1),m>=C&&m<S&&(!D||(T.options.layer??"bottom")===D)&&P(T)}))}}a.DecorationService=y;class g extends c.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=m.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const u=l(2585),d=l(8343);class c{constructor(...C){this._entries=new Map;for(const[S,y]of C)this.set(S,y)}set(C,S){const y=this._entries.get(C);return this._entries.set(C,S),y}forEach(C){for(const[S,y]of this._entries.entries())C(S,y)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}a.ServiceCollection=c,a.InstantiationService=class{constructor(){this._services=new c,this._services.set(u.IInstantiationService,this)}setService(b,C){this._services.set(b,C)}getService(b){return this._services.get(b)}createInstance(b,...C){const S=(0,d.getServiceDependencies)(b).sort(((_,m)=>_.index-m.index)),y=[];for(const _ of S){const m=this._services.get(_.id);if(!m)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${_.id}.`);y.push(m)}const g=S.length>0?S[0].index:C.length;if(C.length!==g)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${g+1} conflicts with ${C.length} static arguments`);return new b(...C,...y)}}},7866:function(w,a,l){var u=this&&this.__decorate||function(g,_,m,v){var D,P=arguments.length,T=P<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(g,_,m,v);else for(var A=g.length-1;A>=0;A--)(D=g[A])&&(T=(P<3?D(T):P>3?D(_,m,T):D(_,m))||T);return P>3&&T&&Object.defineProperty(_,m,T),T},d=this&&this.__param||function(g,_){return function(m,v){_(m,v,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const c=l(844),b=l(2585),C={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let S,y=a.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let _=0;_<g.length;_++)typeof g[_]=="function"&&(g[_]=g[_]())}_log(g,_,m){this._evalLazyOptionalParams(m),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...m)}trace(g,..._){var m;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,g,_)}debug(g,..._){var m;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,g,_)}info(g,..._){var m;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,g,_)}warn(g,..._){var m;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,g,_)}error(g,..._){var m;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,g,_)}};a.LogService=y=u([d(0,b.IOptionsService)],y),a.setTraceLogger=function(g){S=g},a.traceCall=function(g,_,m){if(typeof m.value!="function")throw new Error("not supported");const v=m.value;m.value=function(...D){if(S.logLevel!==b.LogLevelEnum.TRACE)return v.apply(this,D);S.trace(`GlyphRenderer#${v.name}(${D.map((T=>JSON.stringify(T))).join(", ")})`);const P=v.apply(this,D);return S.trace(`GlyphRenderer#${v.name} return`,P),P}}},7302:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const u=l(8460),d=l(844),c=l(6114);a.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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends d.Disposable{constructor(y){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...a.DEFAULT_OPTIONS};for(const _ in y)if(_ in g)try{const m=y[_];g[_]=this._sanitizeAndValidateOption(_,m)}catch(m){console.error(m)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,d.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(y,g){return this.onOptionChange((_=>{_===y&&g(this.rawOptions[y])}))}onMultipleOptionChange(y,g){return this.onOptionChange((_=>{y.indexOf(_)!==-1&&g()}))}_setupOptions(){const y=_=>{if(!(_ in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},g=(_,m)=>{if(!(_ in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);m=this._sanitizeAndValidateOption(_,m),this.rawOptions[_]!==m&&(this.rawOptions[_]=m,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const m={get:y.bind(this,_),set:g.bind(this,_)};Object.defineProperty(this.options,_,m)}}_sanitizeAndValidateOption(y,g){switch(y){case"cursorStyle":if(g||(g=a.DEFAULT_OPTIONS[y]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${y}`);break;case"wordSeparator":g||(g=a.DEFAULT_OPTIONS[y]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=b.includes(g)?g:a.DEFAULT_OPTIONS[y];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${y} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${y} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${y} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${y} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}a.OptionsService=C},2660:function(w,a,l){var u=this&&this.__decorate||function(C,S,y,g){var _,m=arguments.length,v=m<3?S:g===null?g=Object.getOwnPropertyDescriptor(S,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(C,S,y,g);else for(var D=C.length-1;D>=0;D--)(_=C[D])&&(v=(m<3?_(v):m>3?_(S,y,v):_(S,y))||v);return m>3&&v&&Object.defineProperty(S,y,v),v},d=this&&this.__param||function(C,S){return function(y,g){S(y,g,C)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const c=l(2585);let b=a.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const S=this._bufferService.buffer;if(C.id===void 0){const D=S.addMarker(S.ybase+S.y),P={data:C,id:this._nextId++,lines:[D]};return D.onDispose((()=>this._removeMarkerFromLink(P,D))),this._dataByLinkId.set(P.id,P),P.id}const y=C,g=this._getEntryIdKey(y),_=this._entriesWithId.get(g);if(_)return this.addLineToLink(_.id,S.ybase+S.y),_.id;const m=S.addMarker(S.ybase+S.y),v={id:this._nextId++,key:this._getEntryIdKey(y),data:y,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(v,m))),this._entriesWithId.set(v.key,v),this._dataByLinkId.set(v.id,v),v.id}addLineToLink(C,S){const y=this._dataByLinkId.get(C);if(y&&y.lines.every((g=>g.line!==S))){const g=this._bufferService.buffer.addMarker(S);y.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(y,g)))}}getLinkData(C){var S;return(S=this._dataByLinkId.get(C))==null?void 0:S.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,S){const y=C.lines.indexOf(S);y!==-1&&(C.lines.splice(y,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};a.OscLinkService=b=u([d(0,c.IBufferService)],b)},8343:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",u="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(d){return d[u]||[]},a.createDecorator=function(d){if(a.serviceRegistry.has(d))return a.serviceRegistry.get(d);const c=function(b,C,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(y,g,_){g[l]===g?g[u].push({id:y,index:_}):(g[u]=[{id:y,index:_}],g[l]=g)})(c,b,S)};return c.toString=()=>d,a.serviceRegistry.set(d,c),c}},2585:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const u=l(8343);var d;a.IBufferService=(0,u.createDecorator)("BufferService"),a.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),a.ICoreService=(0,u.createDecorator)("CoreService"),a.ICharsetService=(0,u.createDecorator)("CharsetService"),a.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(d||(a.LogLevelEnum=d={})),a.ILogService=(0,u.createDecorator)("LogService"),a.IOptionsService=(0,u.createDecorator)("OptionsService"),a.IOscLinkService=(0,u.createDecorator)("OscLinkService"),a.IUnicodeService=(0,u.createDecorator)("UnicodeService"),a.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const u=l(8460),d=l(225);class c{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,S,y=!1){return(16777215&C)<<3|(3&S)<<1|(y?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const C=new d.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let S=0,y=0;const g=C.length;for(let _=0;_<g;++_){let m=C.charCodeAt(_);if(55296<=m&&m<=56319){if(++_>=g)return S+this.wcwidth(m);const P=C.charCodeAt(_);56320<=P&&P<=57343?m=1024*(m-55296)+P-56320+65536:S+=this.wcwidth(P)}const v=this.charProperties(m,y);let D=c.extractWidth(v);c.extractShouldJoin(v)&&(D-=c.extractWidth(y)),S+=D,y=v}return S}charProperties(C,S){return this._activeProvider.charProperties(C,S)}}a.UnicodeService=c}},n={};function o(w){var a=n[w];if(a!==void 0)return a.exports;var l=n[w]={exports:{}};return t[w].call(l.exports,l,l.exports,o),l.exports}var h={};return(()=>{var w=h;Object.defineProperty(w,"__esModule",{value:!0}),w.Terminal=void 0;const a=o(9042),l=o(3236),u=o(844),d=o(5741),c=o(8285),b=o(7975),C=o(7090),S=["cols","rows"];class y extends u.Disposable{constructor(_){super(),this._core=this.register(new l.Terminal(_)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};const m=D=>this._core.options[D],v=(D,P)=>{this._checkReadonlyOptions(D),this._core.options[D]=P};for(const D in this._core.options){const P={get:m.bind(this,D),set:v.bind(this,D)};Object.defineProperty(this._publicOptions,D,P)}}_checkReadonlyOptions(_){if(S.includes(_))throw new Error(`Option "${_}" 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 b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.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 c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const m in _)this._publicOptions[m]=_[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,m=!0){this._core.input(_,m)}resize(_,m){this._verifyIntegers(_,m),this._core.resize(_,m)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,m,v){this._verifyIntegers(_,m,v),this._core.select(_,m,v)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,m){this._verifyIntegers(_,m),this._core.selectLines(_,m)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,m){this._core.write(_,m)}writeln(_,m){this._core.write(_),this._core.write(`\r
68
- `,m)}paste(_){this._core.paste(_)}refresh(_,m){this._verifyIntegers(_,m),this._core.refresh(_,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return a}_verifyIntegers(..._){for(const m of _)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const m of _)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}w.Terminal=y})(),h})()))})(Pl)),Pl.exports}var s0=i0(),Tl={exports:{}},Lu;function n0(){return Lu||(Lu=1,(function(p,e){(function(t,n){p.exports=n()})(self,(()=>(()=>{var t={};return(()=>{var n=t;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const h=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(h._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,h=o._renderService.dimensions;if(h.css.cell.width===0||h.css.cell.height===0)return;const w=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),u=Math.max(0,parseInt(a.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),c=l-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),b=u-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-w;return{cols:Math.max(2,Math.floor(b/h.css.cell.width)),rows:Math.max(1,Math.floor(c/h.css.cell.height))}}}})(),t})()))})(Tl)),Tl.exports}var r0=n0();/**
66
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(E){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),_.isLinux&&E&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(E){const I=this._getMouseBufferCoords(E),B=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!!(B&&N&&I)&&this._areCoordsInSelection(I,B,N)}isCellInSelection(E,I){const B=this._model.finalSelectionStart,N=this._model.finalSelectionEnd;return!(!B||!N)&&this._areCoordsInSelection([E,I],B,N)}_areCoordsInSelection(E,I,B){return E[1]>I[1]&&E[1]<B[1]||I[1]===B[1]&&E[1]===I[1]&&E[0]>=I[0]&&E[0]<B[0]||I[1]<B[1]&&E[1]===B[1]&&E[0]<B[0]||I[1]<B[1]&&E[1]===I[1]&&E[0]>=I[0]}_selectWordAtCursor(E,I){var W,F;const B=(F=(W=this._linkifier.currentLink)==null?void 0:W.link)==null?void 0:F.range;if(B)return this._model.selectionStart=[B.start.x-1,B.start.y-1],this._model.selectionStartLength=(0,m.getRangeLength)(B,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const N=this._getMouseBufferCoords(E);return!!N&&(this._selectWordAt(N,I),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(E,I){this._model.clearSelection(),E=Math.max(E,0),I=Math.min(I,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,E],this._model.selectionEnd=[this._bufferService.cols,I],this.refresh(),this._onSelectionChange.fire()}_handleTrim(E){this._model.handleTrim(E)&&this.refresh()}_getMouseBufferCoords(E){const I=this._mouseService.getCoords(E,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(I)return I[0]--,I[1]--,I[1]+=this._bufferService.buffer.ydisp,I}_getMouseEventScrollAmount(E){let I=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,E,this._screenElement)[1];const B=this._renderService.dimensions.css.canvas.height;return I>=0&&I<=B?0:(I>B&&(I-=B),I=Math.min(Math.max(I,-50),50),I/=50,I/Math.abs(I)+Math.round(14*I))}shouldForceSelection(E){return _.isMac?E.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:E.shiftKey}handleMouseDown(E){if(this._mouseDownTimeStamp=E.timeStamp,(E.button!==2||!this.hasSelection)&&E.button===0){if(!this._enabled){if(!this.shouldForceSelection(E))return;E.stopPropagation()}E.preventDefault(),this._dragScrollAmount=0,this._enabled&&E.shiftKey?this._handleIncrementalClick(E):E.detail===1?this._handleSingleClick(E):E.detail===2?this._handleDoubleClick(E):E.detail===3&&this._handleTripleClick(E),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),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(E){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(E))}_handleSingleClick(E){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(E)?3:0,this._model.selectionStart=this._getMouseBufferCoords(E),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const I=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);I&&I.length!==this._model.selectionStart[0]&&I.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(E){this._selectWordAtCursor(E,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(E){const I=this._getMouseBufferCoords(E);I&&(this._activeSelectionMode=2,this._selectLineAt(I[1]))}shouldColumnSelect(E){return E.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(E){if(E.stopImmediatePropagation(),!this._model.selectionStart)return;const I=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(E),!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(E),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const B=this._bufferService.buffer;if(this._model.selectionEnd[1]<B.lines.length){const N=B.lines.get(this._model.selectionEnd[1]);N&&N.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}I&&I[0]===this._model.selectionEnd[0]&&I[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 E=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(E.ydisp+this._bufferService.rows,E.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=E.ydisp),this.refresh()}}_handleMouseUp(E){const I=E.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&I<500&&E.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const B=this._mouseService.getCoords(E,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(B&&B[0]!==void 0&&B[1]!==void 0){const N=(0,b.moveToCellSequence)(B[0]-1,B[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(N,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const E=this._model.finalSelectionStart,I=this._model.finalSelectionEnd,B=!(!E||!I||E[0]===I[0]&&E[1]===I[1]);B?E&&I&&(this._oldSelectionStart&&this._oldSelectionEnd&&E[0]===this._oldSelectionStart[0]&&E[1]===this._oldSelectionStart[1]&&I[0]===this._oldSelectionEnd[0]&&I[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(E,I,B)):this._oldHasSelection&&this._fireOnSelectionChange(E,I,B)}_fireOnSelectionChange(E,I,B){this._oldSelectionStart=E,this._oldSelectionEnd=I,this._oldHasSelection=B,this._onSelectionChange.fire()}_handleBufferActivate(E){this.clearSelection(),this._trimListener.dispose(),this._trimListener=E.activeBuffer.lines.onTrim((I=>this._handleTrim(I)))}_convertViewportColToCharacterIndex(E,I){let B=I;for(let N=0;I>=N;N++){const W=E.loadCell(N,this._workCell).getChars().length;this._workCell.getWidth()===0?B--:W>1&&I!==N&&(B+=W-1)}return B}setSelection(E,I,B){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[E,I],this._model.selectionStartLength=B,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(E){this._isClickInSelection(E)||(this._selectWordAtCursor(E,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(E,I,B=!0,N=!0){if(E[0]>=this._bufferService.cols)return;const W=this._bufferService.buffer,F=W.lines.get(E[1]);if(!F)return;const q=W.translateBufferLineToString(E[1],!1);let V=this._convertViewportColToCharacterIndex(F,E[0]),K=V;const ie=E[0]-V;let Z=0,L=0,H=0,R=0;if(q.charAt(V)===" "){for(;V>0&&q.charAt(V-1)===" ";)V--;for(;K<q.length&&q.charAt(K+1)===" ";)K++}else{let oe=E[0],ae=E[0];F.getWidth(oe)===0&&(Z++,oe--),F.getWidth(ae)===2&&(L++,ae++);const me=F.getString(ae).length;for(me>1&&(R+=me-1,K+=me-1);oe>0&&V>0&&!this._isCharWordSeparator(F.loadCell(oe-1,this._workCell));){F.loadCell(oe-1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===0?(Z++,oe--):$>1&&(H+=$-1,V-=$-1),V--,oe--}for(;ae<F.length&&K+1<q.length&&!this._isCharWordSeparator(F.loadCell(ae+1,this._workCell));){F.loadCell(ae+1,this._workCell);const $=this._workCell.getChars().length;this._workCell.getWidth()===2?(L++,ae++):$>1&&(R+=$-1,K+=$-1),K++,ae++}}K++;let G=V+ie-Z+H,X=Math.min(this._bufferService.cols,K-V+Z+L-H-R);if(I||q.slice(V,K).trim()!==""){if(B&&G===0&&F.getCodePoint(0)!==32){const oe=W.lines.get(E[1]-1);if(oe&&F.isWrapped&&oe.getCodePoint(this._bufferService.cols-1)!==32){const ae=this._getWordAt([this._bufferService.cols-1,E[1]-1],!1,!0,!1);if(ae){const me=this._bufferService.cols-ae.start;G-=me,X+=me}}}if(N&&G+X===this._bufferService.cols&&F.getCodePoint(this._bufferService.cols-1)!==32){const oe=W.lines.get(E[1]+1);if(oe!=null&&oe.isWrapped&&oe.getCodePoint(0)!==32){const ae=this._getWordAt([0,E[1]+1],!1,!1,!0);ae&&(X+=ae.length)}}return{start:G,length:X}}}_selectWordAt(E,I){const B=this._getWordAt(E,I);if(B){for(;B.start<0;)B.start+=this._bufferService.cols,E[1]--;this._model.selectionStart=[B.start,E[1]],this._model.selectionStartLength=B.length}}_selectToWordAt(E){const I=this._getWordAt(E,!0);if(I){let B=E[1];for(;I.start<0;)I.start+=this._bufferService.cols,B--;if(!this._model.areSelectionValuesReversed())for(;I.start+I.length>this._bufferService.cols;)I.length-=this._bufferService.cols,B++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?I.start:I.start+I.length,B]}}_isCharWordSeparator(E){return E.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(E.getChars())>=0}_selectLineAt(E){const I=this._bufferService.buffer.getWrappedRangeForLine(E),B={start:{x:0,y:I.first},end:{x:this._bufferService.cols-1,y:I.last}};this._model.selectionStart=[0,I.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,m.getRangeLength)(B,this._bufferService.cols)}};a.SelectionService=A=u([d(3,D.IBufferService),d(4,D.ICoreService),d(5,S.IMouseService),d(6,D.IOptionsService),d(7,S.IRenderService),d(8,S.ICoreBrowserService)],A)},4725:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ILinkProviderService=a.IThemeService=a.ICharacterJoinerService=a.ISelectionService=a.IRenderService=a.IMouseService=a.ICoreBrowserService=a.ICharSizeService=void 0;const u=l(8343);a.ICharSizeService=(0,u.createDecorator)("CharSizeService"),a.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),a.IMouseService=(0,u.createDecorator)("MouseService"),a.IRenderService=(0,u.createDecorator)("RenderService"),a.ISelectionService=(0,u.createDecorator)("SelectionService"),a.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),a.IThemeService=(0,u.createDecorator)("ThemeService"),a.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(w,a,l){var u=this&&this.__decorate||function(A,E,I,B){var N,W=arguments.length,F=W<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,I):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")F=Reflect.decorate(A,E,I,B);else for(var q=A.length-1;q>=0;q--)(N=A[q])&&(F=(W<3?N(F):W>3?N(E,I,F):N(E,I))||F);return W>3&&F&&Object.defineProperty(E,I,F),F},d=this&&this.__param||function(A,E){return function(I,B){E(I,B,A)}};Object.defineProperty(a,"__esModule",{value:!0}),a.ThemeService=a.DEFAULT_ANSI_COLORS=void 0;const c=l(7239),b=l(8055),C=l(8460),S=l(844),y=l(2585),g=b.css.toColor("#ffffff"),_=b.css.toColor("#000000"),m=b.css.toColor("#ffffff"),v=b.css.toColor("#000000"),D={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};a.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const A=[b.css.toColor("#2e3436"),b.css.toColor("#cc0000"),b.css.toColor("#4e9a06"),b.css.toColor("#c4a000"),b.css.toColor("#3465a4"),b.css.toColor("#75507b"),b.css.toColor("#06989a"),b.css.toColor("#d3d7cf"),b.css.toColor("#555753"),b.css.toColor("#ef2929"),b.css.toColor("#8ae234"),b.css.toColor("#fce94f"),b.css.toColor("#729fcf"),b.css.toColor("#ad7fa8"),b.css.toColor("#34e2e2"),b.css.toColor("#eeeeec")],E=[0,95,135,175,215,255];for(let I=0;I<216;I++){const B=E[I/36%6|0],N=E[I/6%6|0],W=E[I%6];A.push({css:b.channels.toCss(B,N,W),rgba:b.channels.toRgba(B,N,W)})}for(let I=0;I<24;I++){const B=8+10*I;A.push({css:b.channels.toCss(B,B,B),rgba:b.channels.toRgba(B,B,B)})}return A})());let P=a.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:_,cursor:m,cursorAccent:v,selectionForeground:void 0,selectionBackgroundTransparent:D,selectionBackgroundOpaque:b.color.blend(_,D),selectionInactiveBackgroundTransparent:D,selectionInactiveBackgroundOpaque:b.color.blend(_,D),ansi:a.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(A={}){const E=this._colors;if(E.foreground=T(A.foreground,g),E.background=T(A.background,_),E.cursor=T(A.cursor,m),E.cursorAccent=T(A.cursorAccent,v),E.selectionBackgroundTransparent=T(A.selectionBackground,D),E.selectionBackgroundOpaque=b.color.blend(E.background,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundTransparent=T(A.selectionInactiveBackground,E.selectionBackgroundTransparent),E.selectionInactiveBackgroundOpaque=b.color.blend(E.background,E.selectionInactiveBackgroundTransparent),E.selectionForeground=A.selectionForeground?T(A.selectionForeground,b.NULL_COLOR):void 0,E.selectionForeground===b.NULL_COLOR&&(E.selectionForeground=void 0),b.color.isOpaque(E.selectionBackgroundTransparent)&&(E.selectionBackgroundTransparent=b.color.opacity(E.selectionBackgroundTransparent,.3)),b.color.isOpaque(E.selectionInactiveBackgroundTransparent)&&(E.selectionInactiveBackgroundTransparent=b.color.opacity(E.selectionInactiveBackgroundTransparent,.3)),E.ansi=a.DEFAULT_ANSI_COLORS.slice(),E.ansi[0]=T(A.black,a.DEFAULT_ANSI_COLORS[0]),E.ansi[1]=T(A.red,a.DEFAULT_ANSI_COLORS[1]),E.ansi[2]=T(A.green,a.DEFAULT_ANSI_COLORS[2]),E.ansi[3]=T(A.yellow,a.DEFAULT_ANSI_COLORS[3]),E.ansi[4]=T(A.blue,a.DEFAULT_ANSI_COLORS[4]),E.ansi[5]=T(A.magenta,a.DEFAULT_ANSI_COLORS[5]),E.ansi[6]=T(A.cyan,a.DEFAULT_ANSI_COLORS[6]),E.ansi[7]=T(A.white,a.DEFAULT_ANSI_COLORS[7]),E.ansi[8]=T(A.brightBlack,a.DEFAULT_ANSI_COLORS[8]),E.ansi[9]=T(A.brightRed,a.DEFAULT_ANSI_COLORS[9]),E.ansi[10]=T(A.brightGreen,a.DEFAULT_ANSI_COLORS[10]),E.ansi[11]=T(A.brightYellow,a.DEFAULT_ANSI_COLORS[11]),E.ansi[12]=T(A.brightBlue,a.DEFAULT_ANSI_COLORS[12]),E.ansi[13]=T(A.brightMagenta,a.DEFAULT_ANSI_COLORS[13]),E.ansi[14]=T(A.brightCyan,a.DEFAULT_ANSI_COLORS[14]),E.ansi[15]=T(A.brightWhite,a.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){const I=Math.min(E.ansi.length-16,A.extendedAnsi.length);for(let B=0;B<I;B++)E.ansi[B+16]=T(A.extendedAnsi[B],a.DEFAULT_ANSI_COLORS[B+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){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[A]=this._restoreColors.ansi[A]}else for(let E=0;E<this._restoreColors.ansi.length;++E)this._colors.ansi[E]=this._restoreColors.ansi[E]}modifyColors(A){A(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 T(A,E){if(A!==void 0)try{return b.css.toColor(A)}catch{}return E}a.ThemeService=P=u([d(0,y.IOptionsService)],P)},6349:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CircularList=void 0;const u=l(8460),d=l(844);class c extends d.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.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(C){if(this._maxLength===C)return;const S=new Array(C);for(let y=0;y<Math.min(C,this.length);y++)S[y]=this._array[this._getCyclicIndex(y)];this._array=S,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let S=this._length;S<C;S++)this._array[S]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,S){this._array[this._getCyclicIndex(C)]=S}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,S,...y){if(S){for(let g=C;g<this._length-S;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+S)];this._length-=S,this.onDeleteEmitter.fire({index:C,amount:S})}for(let g=this._length-1;g>=C;g--)this._array[this._getCyclicIndex(g+y.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<y.length;g++)this._array[this._getCyclicIndex(C+g)]=y[g];if(y.length&&this.onInsertEmitter.fire({index:C,amount:y.length}),this._length+y.length>this._maxLength){const g=this._length+y.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=y.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,S,y){if(!(S<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+y<0)throw new Error("Cannot shift elements in list beyond index 0");if(y>0){for(let _=S-1;_>=0;_--)this.set(C+_+y,this.get(C+_));const g=C+S+y-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<S;g++)this.set(C+g+y,this.get(C+g))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}a.CircularList=c},1439:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.clone=void 0,a.clone=function l(u,d=5){if(typeof u!="object")return u;const c=Array.isArray(u)?[]:{};for(const b in u)c[b]=d<=1?u[b]:u[b]&&l(u[b],d-1);return c}},8055:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.contrastRatio=a.toPaddedHex=a.rgba=a.rgb=a.css=a.color=a.channels=a.NULL_COLOR=void 0;let l=0,u=0,d=0,c=0;var b,C,S,y,g;function _(v){const D=v.toString(16);return D.length<2?"0"+D:D}function m(v,D){return v<D?(D+.05)/(v+.05):(v+.05)/(D+.05)}a.NULL_COLOR={css:"#00000000",rgba:0},(function(v){v.toCss=function(D,P,T,A){return A!==void 0?`#${_(D)}${_(P)}${_(T)}${_(A)}`:`#${_(D)}${_(P)}${_(T)}`},v.toRgba=function(D,P,T,A=255){return(D<<24|P<<16|T<<8|A)>>>0},v.toColor=function(D,P,T,A){return{css:v.toCss(D,P,T,A),rgba:v.toRgba(D,P,T,A)}}})(b||(a.channels=b={})),(function(v){function D(P,T){return c=Math.round(255*T),[l,u,d]=g.toChannels(P.rgba),{css:b.toCss(l,u,d,c),rgba:b.toRgba(l,u,d,c)}}v.blend=function(P,T){if(c=(255&T.rgba)/255,c===1)return{css:T.css,rgba:T.rgba};const A=T.rgba>>24&255,E=T.rgba>>16&255,I=T.rgba>>8&255,B=P.rgba>>24&255,N=P.rgba>>16&255,W=P.rgba>>8&255;return l=B+Math.round((A-B)*c),u=N+Math.round((E-N)*c),d=W+Math.round((I-W)*c),{css:b.toCss(l,u,d),rgba:b.toRgba(l,u,d)}},v.isOpaque=function(P){return(255&P.rgba)==255},v.ensureContrastRatio=function(P,T,A){const E=g.ensureContrastRatio(P.rgba,T.rgba,A);if(E)return b.toColor(E>>24&255,E>>16&255,E>>8&255)},v.opaque=function(P){const T=(255|P.rgba)>>>0;return[l,u,d]=g.toChannels(T),{css:b.toCss(l,u,d),rgba:T}},v.opacity=D,v.multiplyOpacity=function(P,T){return c=255&P.rgba,D(P,c*T/255)},v.toColorRGB=function(P){return[P.rgba>>24&255,P.rgba>>16&255,P.rgba>>8&255]}})(C||(a.color=C={})),(function(v){let D,P;try{const T=document.createElement("canvas");T.width=1,T.height=1;const A=T.getContext("2d",{willReadFrequently:!0});A&&(D=A,D.globalCompositeOperation="copy",P=D.createLinearGradient(0,0,1,1))}catch{}v.toColor=function(T){if(T.match(/#[\da-f]{3,8}/i))switch(T.length){case 4:return l=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),d=parseInt(T.slice(3,4).repeat(2),16),b.toColor(l,u,d);case 5:return l=parseInt(T.slice(1,2).repeat(2),16),u=parseInt(T.slice(2,3).repeat(2),16),d=parseInt(T.slice(3,4).repeat(2),16),c=parseInt(T.slice(4,5).repeat(2),16),b.toColor(l,u,d,c);case 7:return{css:T,rgba:(parseInt(T.slice(1),16)<<8|255)>>>0};case 9:return{css:T,rgba:parseInt(T.slice(1),16)>>>0}}const A=T.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return l=parseInt(A[1]),u=parseInt(A[2]),d=parseInt(A[3]),c=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),b.toColor(l,u,d,c);if(!D||!P)throw new Error("css.toColor: Unsupported css format");if(D.fillStyle=P,D.fillStyle=T,typeof D.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(D.fillRect(0,0,1,1),[l,u,d,c]=D.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:b.toRgba(l,u,d,c),css:T}}})(S||(a.css=S={})),(function(v){function D(P,T,A){const E=P/255,I=T/255,B=A/255;return .2126*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.7152*(I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4))+.0722*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))}v.relativeLuminance=function(P){return D(P>>16&255,P>>8&255,255&P)},v.relativeLuminance2=D})(y||(a.rgb=y={})),(function(v){function D(T,A,E){const I=T>>24&255,B=T>>16&255,N=T>>8&255;let W=A>>24&255,F=A>>16&255,q=A>>8&255,V=m(y.relativeLuminance2(W,F,q),y.relativeLuminance2(I,B,N));for(;V<E&&(W>0||F>0||q>0);)W-=Math.max(0,Math.ceil(.1*W)),F-=Math.max(0,Math.ceil(.1*F)),q-=Math.max(0,Math.ceil(.1*q)),V=m(y.relativeLuminance2(W,F,q),y.relativeLuminance2(I,B,N));return(W<<24|F<<16|q<<8|255)>>>0}function P(T,A,E){const I=T>>24&255,B=T>>16&255,N=T>>8&255;let W=A>>24&255,F=A>>16&255,q=A>>8&255,V=m(y.relativeLuminance2(W,F,q),y.relativeLuminance2(I,B,N));for(;V<E&&(W<255||F<255||q<255);)W=Math.min(255,W+Math.ceil(.1*(255-W))),F=Math.min(255,F+Math.ceil(.1*(255-F))),q=Math.min(255,q+Math.ceil(.1*(255-q))),V=m(y.relativeLuminance2(W,F,q),y.relativeLuminance2(I,B,N));return(W<<24|F<<16|q<<8|255)>>>0}v.blend=function(T,A){if(c=(255&A)/255,c===1)return A;const E=A>>24&255,I=A>>16&255,B=A>>8&255,N=T>>24&255,W=T>>16&255,F=T>>8&255;return l=N+Math.round((E-N)*c),u=W+Math.round((I-W)*c),d=F+Math.round((B-F)*c),b.toRgba(l,u,d)},v.ensureContrastRatio=function(T,A,E){const I=y.relativeLuminance(T>>8),B=y.relativeLuminance(A>>8);if(m(I,B)<E){if(B<I){const F=D(T,A,E),q=m(I,y.relativeLuminance(F>>8));if(q<E){const V=P(T,A,E);return q>m(I,y.relativeLuminance(V>>8))?F:V}return F}const N=P(T,A,E),W=m(I,y.relativeLuminance(N>>8));if(W<E){const F=D(T,A,E);return W>m(I,y.relativeLuminance(F>>8))?N:F}return N}},v.reduceLuminance=D,v.increaseLuminance=P,v.toChannels=function(T){return[T>>24&255,T>>16&255,T>>8&255,255&T]}})(g||(a.rgba=g={})),a.toPaddedHex=_,a.contrastRatio=m},8969:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CoreTerminal=void 0;const u=l(844),d=l(2585),c=l(4348),b=l(7866),C=l(744),S=l(7302),y=l(6975),g=l(8460),_=l(1753),m=l(1480),v=l(7994),D=l(9282),P=l(5435),T=l(5981),A=l(2660);let E=!1;class I extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((N=>{var W;(W=this._onScrollApi)==null||W.fire(N.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(N){for(const W in N)this.optionsService.options[W]=N[W]}constructor(N){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new S.OptionsService(N)),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(b.LogService)),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(y.CoreService)),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(m.UnicodeService)),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(v.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(A.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new P.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.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((W=>{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((W=>{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 T.WriteBuffer(((W,F)=>this._inputHandler.parse(W,F)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(N,W){this._writeBuffer.write(N,W)}writeSync(N,W){this._logService.logLevel<=d.LogLevelEnum.WARN&&!E&&(this._logService.warn("writeSync is unreliable and will be removed soon."),E=!0),this._writeBuffer.writeSync(N,W)}input(N,W=!0){this.coreService.triggerDataEvent(N,W)}resize(N,W){isNaN(N)||isNaN(W)||(N=Math.max(N,C.MINIMUM_COLS),W=Math.max(W,C.MINIMUM_ROWS),this._bufferService.resize(N,W))}scroll(N,W=!1){this._bufferService.scroll(N,W)}scrollLines(N,W,F){this._bufferService.scrollLines(N,W,F)}scrollPages(N){this.scrollLines(N*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(N){const W=N-this._bufferService.buffer.ydisp;W!==0&&this.scrollLines(W)}registerEscHandler(N,W){return this._inputHandler.registerEscHandler(N,W)}registerDcsHandler(N,W){return this._inputHandler.registerDcsHandler(N,W)}registerCsiHandler(N,W){return this._inputHandler.registerCsiHandler(N,W)}registerOscHandler(N,W){return this._inputHandler.registerOscHandler(N,W)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let N=!1;const W=this.optionsService.rawOptions.windowsPty;W&&W.buildNumber!==void 0&&W.buildNumber!==void 0?N=W.backend==="conpty"&&W.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(N=!0),N?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const N=[];N.push(this.onLineFeed(D.updateWindowsModeWrappedState.bind(null,this._bufferService))),N.push(this.registerCsiHandler({final:"H"},(()=>((0,D.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const W of N)W.dispose()}))}}}a.CoreTerminal=I},8460:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.runAndSubscribe=a.forwardEvent=a.EventEmitter=void 0,a.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const d=[];for(let c=0;c<this._listeners.length;c++)d.push(this._listeners[c]);for(let c=0;c<d.length;c++)d[c].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},a.forwardEvent=function(l,u){return l((d=>u.fire(d)))},a.runAndSubscribe=function(l,u){return u(void 0),l((d=>u(d)))}},5435:function(w,a,l){var u=this&&this.__decorate||function(Z,L,H,R){var G,X=arguments.length,oe=X<3?L:R===null?R=Object.getOwnPropertyDescriptor(L,H):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")oe=Reflect.decorate(Z,L,H,R);else for(var ae=Z.length-1;ae>=0;ae--)(G=Z[ae])&&(oe=(X<3?G(oe):X>3?G(L,H,oe):G(L,H))||oe);return X>3&&oe&&Object.defineProperty(L,H,oe),oe},d=this&&this.__param||function(Z,L){return function(H,R){L(H,R,Z)}};Object.defineProperty(a,"__esModule",{value:!0}),a.InputHandler=a.WindowsOptionsReportType=void 0;const c=l(2584),b=l(7116),C=l(2015),S=l(844),y=l(482),g=l(8437),_=l(8460),m=l(643),v=l(511),D=l(3734),P=l(2585),T=l(1480),A=l(6242),E=l(6351),I=l(5941),B={"(":0,")":1,"*":2,"+":3,"-":1,".":2},N=131072;function W(Z,L){if(Z>24)return L.setWinLines||!1;switch(Z){case 1:return!!L.restoreWin;case 2:return!!L.minimizeWin;case 3:return!!L.setWinPosition;case 4:return!!L.setWinSizePixels;case 5:return!!L.raiseWin;case 6:return!!L.lowerWin;case 7:return!!L.refreshWin;case 8:return!!L.setWinSizeChars;case 9:return!!L.maximizeWin;case 10:return!!L.fullscreenWin;case 11:return!!L.getWinState;case 13:return!!L.getWinPosition;case 14:return!!L.getWinSizePixels;case 15:return!!L.getScreenSizePixels;case 16:return!!L.getCellSizePixels;case 18:return!!L.getWinSizeChars;case 19:return!!L.getScreenSizeChars;case 20:return!!L.getIconTitle;case 21:return!!L.getWinTitle;case 22:return!!L.pushTitle;case 23:return!!L.popTitle;case 24:return!!L.setWinLines}return!1}var F;(function(Z){Z[Z.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Z[Z.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(F||(a.WindowsOptionsReportType=F={}));let q=0;class V extends S.Disposable{getAttrData(){return this._curAttrData}constructor(L,H,R,G,X,oe,ae,me,$=new C.EscapeSequenceParser){super(),this._bufferService=L,this._charsetService=H,this._coreService=R,this._logService=G,this._optionsService=X,this._oscLinkService=oe,this._coreMouseService=ae,this._unicodeService=me,this._parser=$,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new y.StringToUtf32,this._utf8Decoder=new y.Utf8ToUtf32,this._workCell=new v.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.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((O=>this._activeBuffer=O.activeBuffer))),this._parser.setCsiHandlerFallback(((O,le)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(O),params:le.toArray()})})),this._parser.setEscHandlerFallback((O=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(O)})})),this._parser.setExecuteHandlerFallback((O=>{this._logService.debug("Unknown EXECUTE code: ",{code:O})})),this._parser.setOscHandlerFallback(((O,le,se)=>{this._logService.debug("Unknown OSC code: ",{identifier:O,action:le,data:se})})),this._parser.setDcsHandlerFallback(((O,le,se)=>{le==="HOOK"&&(se=se.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(O),action:le,payload:se})})),this._parser.setPrintHandler(((O,le,se)=>this.print(O,le,se))),this._parser.registerCsiHandler({final:"@"},(O=>this.insertChars(O))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(O=>this.scrollLeft(O))),this._parser.registerCsiHandler({final:"A"},(O=>this.cursorUp(O))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(O=>this.scrollRight(O))),this._parser.registerCsiHandler({final:"B"},(O=>this.cursorDown(O))),this._parser.registerCsiHandler({final:"C"},(O=>this.cursorForward(O))),this._parser.registerCsiHandler({final:"D"},(O=>this.cursorBackward(O))),this._parser.registerCsiHandler({final:"E"},(O=>this.cursorNextLine(O))),this._parser.registerCsiHandler({final:"F"},(O=>this.cursorPrecedingLine(O))),this._parser.registerCsiHandler({final:"G"},(O=>this.cursorCharAbsolute(O))),this._parser.registerCsiHandler({final:"H"},(O=>this.cursorPosition(O))),this._parser.registerCsiHandler({final:"I"},(O=>this.cursorForwardTab(O))),this._parser.registerCsiHandler({final:"J"},(O=>this.eraseInDisplay(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(O=>this.eraseInDisplay(O,!0))),this._parser.registerCsiHandler({final:"K"},(O=>this.eraseInLine(O,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(O=>this.eraseInLine(O,!0))),this._parser.registerCsiHandler({final:"L"},(O=>this.insertLines(O))),this._parser.registerCsiHandler({final:"M"},(O=>this.deleteLines(O))),this._parser.registerCsiHandler({final:"P"},(O=>this.deleteChars(O))),this._parser.registerCsiHandler({final:"S"},(O=>this.scrollUp(O))),this._parser.registerCsiHandler({final:"T"},(O=>this.scrollDown(O))),this._parser.registerCsiHandler({final:"X"},(O=>this.eraseChars(O))),this._parser.registerCsiHandler({final:"Z"},(O=>this.cursorBackwardTab(O))),this._parser.registerCsiHandler({final:"`"},(O=>this.charPosAbsolute(O))),this._parser.registerCsiHandler({final:"a"},(O=>this.hPositionRelative(O))),this._parser.registerCsiHandler({final:"b"},(O=>this.repeatPrecedingCharacter(O))),this._parser.registerCsiHandler({final:"c"},(O=>this.sendDeviceAttributesPrimary(O))),this._parser.registerCsiHandler({prefix:">",final:"c"},(O=>this.sendDeviceAttributesSecondary(O))),this._parser.registerCsiHandler({final:"d"},(O=>this.linePosAbsolute(O))),this._parser.registerCsiHandler({final:"e"},(O=>this.vPositionRelative(O))),this._parser.registerCsiHandler({final:"f"},(O=>this.hVPosition(O))),this._parser.registerCsiHandler({final:"g"},(O=>this.tabClear(O))),this._parser.registerCsiHandler({final:"h"},(O=>this.setMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(O=>this.setModePrivate(O))),this._parser.registerCsiHandler({final:"l"},(O=>this.resetMode(O))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(O=>this.resetModePrivate(O))),this._parser.registerCsiHandler({final:"m"},(O=>this.charAttributes(O))),this._parser.registerCsiHandler({final:"n"},(O=>this.deviceStatus(O))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(O=>this.deviceStatusPrivate(O))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(O=>this.softReset(O))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(O=>this.setCursorStyle(O))),this._parser.registerCsiHandler({final:"r"},(O=>this.setScrollRegion(O))),this._parser.registerCsiHandler({final:"s"},(O=>this.saveCursor(O))),this._parser.registerCsiHandler({final:"t"},(O=>this.windowOptions(O))),this._parser.registerCsiHandler({final:"u"},(O=>this.restoreCursor(O))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(O=>this.insertColumns(O))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(O=>this.deleteColumns(O))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(O=>this.selectProtected(O))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(O=>this.requestMode(O,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(O=>this.requestMode(O,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new A.OscHandler((O=>(this.setTitle(O),this.setIconName(O),!0)))),this._parser.registerOscHandler(1,new A.OscHandler((O=>this.setIconName(O)))),this._parser.registerOscHandler(2,new A.OscHandler((O=>this.setTitle(O)))),this._parser.registerOscHandler(4,new A.OscHandler((O=>this.setOrReportIndexedColor(O)))),this._parser.registerOscHandler(8,new A.OscHandler((O=>this.setHyperlink(O)))),this._parser.registerOscHandler(10,new A.OscHandler((O=>this.setOrReportFgColor(O)))),this._parser.registerOscHandler(11,new A.OscHandler((O=>this.setOrReportBgColor(O)))),this._parser.registerOscHandler(12,new A.OscHandler((O=>this.setOrReportCursorColor(O)))),this._parser.registerOscHandler(104,new A.OscHandler((O=>this.restoreIndexedColor(O)))),this._parser.registerOscHandler(110,new A.OscHandler((O=>this.restoreFgColor(O)))),this._parser.registerOscHandler(111,new A.OscHandler((O=>this.restoreBgColor(O)))),this._parser.registerOscHandler(112,new A.OscHandler((O=>this.restoreCursorColor(O)))),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 O in b.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:O},(()=>this.selectCharset("("+O))),this._parser.registerEscHandler({intermediates:")",final:O},(()=>this.selectCharset(")"+O))),this._parser.registerEscHandler({intermediates:"*",final:O},(()=>this.selectCharset("*"+O))),this._parser.registerEscHandler({intermediates:"+",final:O},(()=>this.selectCharset("+"+O))),this._parser.registerEscHandler({intermediates:"-",final:O},(()=>this.selectCharset("-"+O))),this._parser.registerEscHandler({intermediates:".",final:O},(()=>this.selectCharset("."+O))),this._parser.registerEscHandler({intermediates:"/",final:O},(()=>this.selectCharset("/"+O)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((O=>(this._logService.error("Parsing error: ",O),O))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new E.DcsHandler(((O,le)=>this.requestStatusString(O,le))))}_preserveStack(L,H,R,G){this._parseStack.paused=!0,this._parseStack.cursorStartX=L,this._parseStack.cursorStartY=H,this._parseStack.decodedLength=R,this._parseStack.position=G}_logSlowResolvingAsync(L){this._logService.logLevel<=P.LogLevelEnum.WARN&&Promise.race([L,new Promise(((H,R)=>setTimeout((()=>R("#SLOW_TIMEOUT")),5e3)))]).catch((H=>{if(H!=="#SLOW_TIMEOUT")throw H;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(L,H){let R,G=this._activeBuffer.x,X=this._activeBuffer.y,oe=0;const ae=this._parseStack.paused;if(ae){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,H))return this._logSlowResolvingAsync(R),R;G=this._parseStack.cursorStartX,X=this._parseStack.cursorStartY,this._parseStack.paused=!1,L.length>N&&(oe=this._parseStack.position+N)}if(this._logService.logLevel<=P.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof L=="string"?` "${L}"`:` "${Array.prototype.map.call(L,(O=>String.fromCharCode(O))).join("")}"`),typeof L=="string"?L.split("").map((O=>O.charCodeAt(0))):L),this._parseBuffer.length<L.length&&this._parseBuffer.length<N&&(this._parseBuffer=new Uint32Array(Math.min(L.length,N))),ae||this._dirtyRowTracker.clearRange(),L.length>N)for(let O=oe;O<L.length;O+=N){const le=O+N<L.length?O+N:L.length,se=typeof L=="string"?this._stringDecoder.decode(L.substring(O,le),this._parseBuffer):this._utf8Decoder.decode(L.subarray(O,le),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,se))return this._preserveStack(G,X,se,O),this._logSlowResolvingAsync(R),R}else if(!ae){const O=typeof L=="string"?this._stringDecoder.decode(L,this._parseBuffer):this._utf8Decoder.decode(L,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,O))return this._preserveStack(G,X,O,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===G&&this._activeBuffer.y===X||this._onCursorMove.fire();const me=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),$=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);$<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min($,this._bufferService.rows-1),Math.min(me,this._bufferService.rows-1))}print(L,H,R){let G,X;const oe=this._charsetService.charset,ae=this._optionsService.rawOptions.screenReaderMode,me=this._bufferService.cols,$=this._coreService.decPrivateModes.wraparound,O=this._coreService.modes.insertMode,le=this._curAttrData;let se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-H>0&&se.getWidth(this._activeBuffer.x-1)===2&&se.setCellFromCodepoint(this._activeBuffer.x-1,0,1,le);let ge=this._parser.precedingJoinState;for(let fe=H;fe<R;++fe){if(G=L[fe],G<127&&oe){const ot=oe[String.fromCharCode(G)];ot&&(G=ot.charCodeAt(0))}const Me=this._unicodeService.charProperties(G,ge);X=T.UnicodeService.extractWidth(Me);const We=T.UnicodeService.extractShouldJoin(Me),je=We?T.UnicodeService.extractWidth(ge):0;if(ge=Me,ae&&this._onA11yChar.fire((0,y.stringFromCodePoint)(G)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+X-je>me){if($){const ot=se;let Ae=this._activeBuffer.x-je;for(this._activeBuffer.x=je,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),se=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),je>0&&se instanceof g.BufferLine&&se.copyCellsFrom(ot,Ae,0,je,!1);Ae<me;)ot.setCellFromCodepoint(Ae++,0,1,le)}else if(this._activeBuffer.x=me-1,X===2)continue}if(We&&this._activeBuffer.x){const ot=se.getWidth(this._activeBuffer.x-1)?1:2;se.addCodepointToCell(this._activeBuffer.x-ot,G,X);for(let Ae=X-je;--Ae>=0;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}else if(O&&(se.insertCells(this._activeBuffer.x,X-je,this._activeBuffer.getNullCell(le)),se.getWidth(me-1)===2&&se.setCellFromCodepoint(me-1,m.NULL_CELL_CODE,m.NULL_CELL_WIDTH,le)),se.setCellFromCodepoint(this._activeBuffer.x++,G,X,le),X>0)for(;--X;)se.setCellFromCodepoint(this._activeBuffer.x++,0,0,le)}this._parser.precedingJoinState=ge,this._activeBuffer.x<me&&R-H>0&&se.getWidth(this._activeBuffer.x)===0&&!se.hasContent(this._activeBuffer.x)&&se.setCellFromCodepoint(this._activeBuffer.x,0,1,le),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(L,H){return L.final!=="t"||L.prefix||L.intermediates?this._parser.registerCsiHandler(L,H):this._parser.registerCsiHandler(L,(R=>!W(R.params[0],this._optionsService.rawOptions.windowOptions)||H(R)))}registerDcsHandler(L,H){return this._parser.registerDcsHandler(L,new E.DcsHandler(H))}registerEscHandler(L,H){return this._parser.registerEscHandler(L,H)}registerOscHandler(L,H){return this._parser.registerOscHandler(L,new A.OscHandler(H))}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 L;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&&((L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&L.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);H.hasWidth(this._activeBuffer.x)&&!H.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const L=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-L),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(L=this._bufferService.cols-1){this._activeBuffer.x=Math.min(L,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(L,H){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=L,this._activeBuffer.y=this._activeBuffer.scrollTop+H):(this._activeBuffer.x=L,this._activeBuffer.y=H),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(L,H){this._restrictCursor(),this._setCursor(this._activeBuffer.x+L,this._activeBuffer.y+H)}cursorUp(L){const H=this._activeBuffer.y-this._activeBuffer.scrollTop;return H>=0?this._moveCursor(0,-Math.min(H,L.params[0]||1)):this._moveCursor(0,-(L.params[0]||1)),!0}cursorDown(L){const H=this._activeBuffer.scrollBottom-this._activeBuffer.y;return H>=0?this._moveCursor(0,Math.min(H,L.params[0]||1)):this._moveCursor(0,L.params[0]||1),!0}cursorForward(L){return this._moveCursor(L.params[0]||1,0),!0}cursorBackward(L){return this._moveCursor(-(L.params[0]||1),0),!0}cursorNextLine(L){return this.cursorDown(L),this._activeBuffer.x=0,!0}cursorPrecedingLine(L){return this.cursorUp(L),this._activeBuffer.x=0,!0}cursorCharAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(L){return this._setCursor(L.length>=2?(L.params[1]||1)-1:0,(L.params[0]||1)-1),!0}charPosAbsolute(L){return this._setCursor((L.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(L){return this._moveCursor(L.params[0]||1,0),!0}linePosAbsolute(L){return this._setCursor(this._activeBuffer.x,(L.params[0]||1)-1),!0}vPositionRelative(L){return this._moveCursor(0,L.params[0]||1),!0}hVPosition(L){return this.cursorPosition(L),!0}tabClear(L){const H=L.params[0];return H===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:H===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=L.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(L){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let H=L.params[0]||1;for(;H--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(L){const H=L.params[0];return H===1&&(this._curAttrData.bg|=536870912),H!==2&&H!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(L,H,R,G=!1,X=!1){const oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);oe.replaceCells(H,R,this._activeBuffer.getNullCell(this._eraseAttrData()),X),G&&(oe.isWrapped=!1)}_resetBufferLine(L,H=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+L);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),H),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+L),R.isWrapped=!1)}eraseInDisplay(L,H=!1){let R;switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);R<this._bufferService.rows;R++)this._resetBufferLine(R,H);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,H),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,H);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,H);this._dirtyRowTracker.markDirty(0);break;case 3:const G=this._activeBuffer.lines.length-this._bufferService.rows;G>0&&(this._activeBuffer.lines.trimStart(G),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-G,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-G,0),this._onScroll.fire(0))}return!0}eraseInLine(L,H=!1){switch(this._restrictCursor(this._bufferService.cols),L.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,H);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,H);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,H)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(L){this._restrictCursor();let H=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,X=this._bufferService.rows-1+this._activeBuffer.ybase-G+1;for(;H--;)this._activeBuffer.lines.splice(X-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(L){this._restrictCursor();let H=L.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let G;for(G=this._bufferService.rows-1-this._activeBuffer.scrollBottom,G=this._bufferService.rows-1+this._activeBuffer.ybase-G;H--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(G,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(L){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.insertCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(L){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.deleteCells(this._activeBuffer.x,L.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(L){let H=L.params[0]||1;for(;H--;)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(L){let H=L.params[0]||1;for(;H--;)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(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.deleteCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.insertCells(0,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.insertCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(L){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const H=L.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const G=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);G.deleteCells(this._activeBuffer.x,H,this._activeBuffer.getNullCell(this._eraseAttrData())),G.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(L){this._restrictCursor();const H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return H&&(H.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(L.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(L){const H=this._parser.precedingJoinState;if(!H)return!0;const R=L.params[0]||1,G=T.UnicodeService.extractWidth(H),X=this._activeBuffer.x-G,oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(X),ae=new Uint32Array(oe.length*R);let me=0;for(let O=0;O<oe.length;){const le=oe.codePointAt(O)||0;ae[me++]=le,O+=le>65535?2:1}let $=me;for(let O=1;O<R;++O)ae.copyWithin($,0,me),$+=me;return this.print(ae,0,$),!0}sendDeviceAttributesPrimary(L){return L.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(L){return L.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(L.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(L){return(this._optionsService.rawOptions.termName+"").indexOf(L)===0}setMode(L){for(let H=0;H<L.length;H++)switch(L.params[H]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(L){for(let H=0;H<L.length;H++)switch(L.params[H]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,b.DEFAULT_CHARSET),this._charsetService.setgCharset(1,b.DEFAULT_CHARSET),this._charsetService.setgCharset(2,b.DEFAULT_CHARSET),this._charsetService.setgCharset(3,b.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(L){for(let H=0;H<L.length;H++)switch(L.params[H]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(L){for(let H=0;H<L.length;H++)switch(L.params[H]){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(),L.params[H]===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(L,H){const R=this._coreService.decPrivateModes,{activeProtocol:G,activeEncoding:X}=this._coreMouseService,oe=this._coreService,{buffers:ae,cols:me}=this._bufferService,{active:$,alt:O}=ae,le=this._optionsService.rawOptions,se=We=>We?1:2,ge=L.params[0];return fe=ge,Me=H?ge===2?4:ge===4?se(oe.modes.insertMode):ge===12?3:ge===20?se(le.convertEol):0:ge===1?se(R.applicationCursorKeys):ge===3?le.windowOptions.setWinLines?me===80?2:me===132?1:0:0:ge===6?se(R.origin):ge===7?se(R.wraparound):ge===8?3:ge===9?se(G==="X10"):ge===12?se(le.cursorBlink):ge===25?se(!oe.isCursorHidden):ge===45?se(R.reverseWraparound):ge===66?se(R.applicationKeypad):ge===67?4:ge===1e3?se(G==="VT200"):ge===1002?se(G==="DRAG"):ge===1003?se(G==="ANY"):ge===1004?se(R.sendFocus):ge===1005?4:ge===1006?se(X==="SGR"):ge===1015?4:ge===1016?se(X==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?se($===O):ge===2004?se(R.bracketedPasteMode):0,oe.triggerDataEvent(`${c.C0.ESC}[${H?"":"?"}${fe};${Me}$y`),!0;var fe,Me}_updateAttrColor(L,H,R,G,X){return H===2?(L|=50331648,L&=-16777216,L|=D.AttributeData.fromColorRGB([R,G,X])):H===5&&(L&=-50331904,L|=33554432|255&R),L}_extractColor(L,H,R){const G=[0,0,-1,0,0,0];let X=0,oe=0;do{if(G[oe+X]=L.params[H+oe],L.hasSubParams(H+oe)){const ae=L.getSubParams(H+oe);let me=0;do G[1]===5&&(X=1),G[oe+me+1+X]=ae[me];while(++me<ae.length&&me+oe+1+X<G.length);break}if(G[1]===5&&oe+X>=2||G[1]===2&&oe+X>=5)break;G[1]&&(X=1)}while(++oe+H<L.length&&oe+X<G.length);for(let ae=2;ae<G.length;++ae)G[ae]===-1&&(G[ae]=0);switch(G[0]){case 38:R.fg=this._updateAttrColor(R.fg,G[1],G[3],G[4],G[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,G[1],G[3],G[4],G[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,G[1],G[3],G[4],G[5])}return oe}_processUnderline(L,H){H.extended=H.extended.clone(),(!~L||L>5)&&(L=1),H.extended.underlineStyle=L,H.fg|=268435456,L===0&&(H.fg&=-268435457),H.updateExtended()}_processSGR0(L){L.fg=g.DEFAULT_ATTR_DATA.fg,L.bg=g.DEFAULT_ATTR_DATA.bg,L.extended=L.extended.clone(),L.extended.underlineStyle=0,L.extended.underlineColor&=-67108864,L.updateExtended()}charAttributes(L){if(L.length===1&&L.params[0]===0)return this._processSGR0(this._curAttrData),!0;const H=L.length;let R;const G=this._curAttrData;for(let X=0;X<H;X++)R=L.params[X],R>=30&&R<=37?(G.fg&=-50331904,G.fg|=16777216|R-30):R>=40&&R<=47?(G.bg&=-50331904,G.bg|=16777216|R-40):R>=90&&R<=97?(G.fg&=-50331904,G.fg|=16777224|R-90):R>=100&&R<=107?(G.bg&=-50331904,G.bg|=16777224|R-100):R===0?this._processSGR0(G):R===1?G.fg|=134217728:R===3?G.bg|=67108864:R===4?(G.fg|=268435456,this._processUnderline(L.hasSubParams(X)?L.getSubParams(X)[0]:1,G)):R===5?G.fg|=536870912:R===7?G.fg|=67108864:R===8?G.fg|=1073741824:R===9?G.fg|=2147483648:R===2?G.bg|=134217728:R===21?this._processUnderline(2,G):R===22?(G.fg&=-134217729,G.bg&=-134217729):R===23?G.bg&=-67108865:R===24?(G.fg&=-268435457,this._processUnderline(0,G)):R===25?G.fg&=-536870913:R===27?G.fg&=-67108865:R===28?G.fg&=-1073741825:R===29?G.fg&=2147483647:R===39?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):R===49?(G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?X+=this._extractColor(L,X,G):R===53?G.bg|=1073741824:R===55?G.bg&=-1073741825:R===59?(G.extended=G.extended.clone(),G.extended.underlineColor=-1,G.updateExtended()):R===100?(G.fg&=-67108864,G.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,G.bg&=-67108864,G.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(L){switch(L.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const H=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${H};${R}R`)}return!0}deviceStatusPrivate(L){if(L.params[0]===6){const H=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${H};${R}R`)}return!0}softReset(L){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.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(L){const H=L.params[0]||1;switch(H){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 R=H%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(L){const H=L.params[0]||1;let R;return(L.length<2||(R=L.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>H&&(this._activeBuffer.scrollTop=H-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(L){if(!W(L.params[0],this._optionsService.rawOptions.windowOptions))return!0;const H=L.length>1?L.params[1]:0;switch(L.params[0]){case 14:H!==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(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:H!==0&&H!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),H!==0&&H!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:H!==0&&H!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),H!==0&&H!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(L){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(L){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(L){return this._windowTitle=L,this._onTitleChange.fire(L),!0}setIconName(L){return this._iconName=L,!0}setOrReportIndexedColor(L){const H=[],R=L.split(";");for(;R.length>1;){const G=R.shift(),X=R.shift();if(/^\d+$/.exec(G)){const oe=parseInt(G);if(ie(oe))if(X==="?")H.push({type:0,index:oe});else{const ae=(0,I.parseColor)(X);ae&&H.push({type:1,index:oe,color:ae})}}}return H.length&&this._onColor.fire(H),!0}setHyperlink(L){const H=L.split(";");return!(H.length<2)&&(H[1]?this._createHyperlink(H[0],H[1]):!H[0]&&this._finishHyperlink())}_createHyperlink(L,H){this._getCurrentLinkId()&&this._finishHyperlink();const R=L.split(":");let G;const X=R.findIndex((oe=>oe.startsWith("id=")));return X!==-1&&(G=R[X].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:G,uri:H}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(L,H){const R=L.split(";");for(let G=0;G<R.length&&!(H>=this._specialColors.length);++G,++H)if(R[G]==="?")this._onColor.fire([{type:0,index:this._specialColors[H]}]);else{const X=(0,I.parseColor)(R[G]);X&&this._onColor.fire([{type:1,index:this._specialColors[H],color:X}])}return!0}setOrReportFgColor(L){return this._setOrReportSpecialColor(L,0)}setOrReportBgColor(L){return this._setOrReportSpecialColor(L,1)}setOrReportCursorColor(L){return this._setOrReportSpecialColor(L,2)}restoreIndexedColor(L){if(!L)return this._onColor.fire([{type:2}]),!0;const H=[],R=L.split(";");for(let G=0;G<R.length;++G)if(/^\d+$/.exec(R[G])){const X=parseInt(R[G]);ie(X)&&H.push({type:2,index:X})}return H.length&&this._onColor.fire(H),!0}restoreFgColor(L){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(L){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(L){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,b.DEFAULT_CHARSET),!0}selectCharset(L){return L.length!==2?(this.selectDefaultCharset(),!0):(L[0]==="/"||this._charsetService.setgCharset(B[L[0]],b.CHARSETS[L[1]]||b.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 L=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,L,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=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(L){return this._charsetService.setgLevel(L),!0}screenAlignmentPattern(){const L=new v.CellData;L.content=4194373,L.fg=this._curAttrData.fg,L.bg=this._curAttrData.bg,this._setCursor(0,0);for(let H=0;H<this._bufferService.rows;++H){const R=this._activeBuffer.ybase+this._activeBuffer.y+H,G=this._activeBuffer.lines.get(R);G&&(G.fill(L),G.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(L,H){const R=this._bufferService.buffer,G=this._optionsService.rawOptions;return(X=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${X}${c.C0.ESC}\\`),!0))(L==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:L==='"p'?'P1$r61;1"p':L==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:L==="m"?"P1$r0m":L===" q"?`P1$r${{block:2,underline:4,bar:6}[G.cursorStyle]-(G.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(L,H){this._dirtyRowTracker.markRangeDirty(L,H)}}a.InputHandler=V;let K=class{constructor(Z){this._bufferService=Z,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Z){Z<this.start?this.start=Z:Z>this.end&&(this.end=Z)}markRangeDirty(Z,L){Z>L&&(q=Z,Z=L,L=q),Z<this.start&&(this.start=Z),L>this.end&&(this.end=L)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function ie(Z){return 0<=Z&&Z<256}K=u([d(0,P.IBufferService)],K)},844:(w,a)=>{function l(u){for(const d of u)d.dispose();u.length=0}Object.defineProperty(a,"__esModule",{value:!0}),a.getDisposeArrayDisposable=a.disposeArray=a.toDisposable=a.MutableDisposable=a.Disposable=void 0,a.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const d=this._disposables.indexOf(u);d!==-1&&this._disposables.splice(d,1)}},a.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){var d;this._isDisposed||u===this._value||((d=this._value)==null||d.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){var u;this._isDisposed=!0,(u=this._value)==null||u.dispose(),this._value=void 0}},a.toDisposable=function(u){return{dispose:u}},a.disposeArray=l,a.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FourKeyMap=a.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(d,c,b){this._data[d]||(this._data[d]={}),this._data[d][c]=b}get(d,c){return this._data[d]?this._data[d][c]:void 0}clear(){this._data={}}}a.TwoKeyMap=l,a.FourKeyMap=class{constructor(){this._data=new l}set(u,d,c,b,C){this._data.get(u,d)||this._data.set(u,d,new l),this._data.get(u,d).set(c,b,C)}get(u,d,c,b){var C;return(C=this._data.get(u,d))==null?void 0:C.get(c,b)}clear(){this._data.clear()}}},6114:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isChromeOS=a.isLinux=a.isWindows=a.isIphone=a.isIpad=a.isMac=a.getSafariVersion=a.isSafari=a.isLegacyEdge=a.isFirefox=a.isNode=void 0,a.isNode=typeof process<"u"&&"title"in process;const l=a.isNode?"node":navigator.userAgent,u=a.isNode?"node":navigator.platform;a.isFirefox=l.includes("Firefox"),a.isLegacyEdge=l.includes("Edge"),a.isSafari=/^((?!chrome|android).)*safari/i.test(l),a.getSafariVersion=function(){if(!a.isSafari)return 0;const d=l.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},a.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),a.isIpad=u==="iPad",a.isIphone=u==="iPhone",a.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),a.isLinux=u.indexOf("Linux")>=0,a.isChromeOS=/\bCrOS\b/.test(l)},6106:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SortedList=void 0;let l=0;a.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const d=this._getKey(u);if(d===void 0||(l=this._search(d),l===-1)||this._getKey(this._array[l])!==d)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===d);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,d){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do d(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let d=0,c=this._array.length-1;for(;c>=d;){let b=d+c>>1;const C=this._getKey(this._array[b]);if(C>u)c=b-1;else{if(!(C<u)){for(;b>0&&this._getKey(this._array[b-1])===u;)b--;return b}d=b+1}}return d}}},7226:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DebouncedIdleTask=a.IdleTaskQueue=a.PriorityTaskQueue=void 0;const u=l(6114);class d{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let S=0,y=0,g=C.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),y=Math.max(S,y),_=C.timeRemaining(),1.5*y>_)return g-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-S))}ms`),void this._start();g=_}this.clear()}}class c extends d{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const S=Date.now()+C;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}a.PriorityTaskQueue=c,a.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(b){return requestIdleCallback(b)}_cancelCallback(b){cancelIdleCallback(b)}}:c,a.DebouncedIdleTask=class{constructor(){this._queue=new a.IdleTaskQueue}set(b){this._queue.clear(),this._queue.enqueue(b)}flush(){this._queue.flush()}}},9282:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.updateWindowsModeWrappedState=void 0;const u=l(643);a.updateWindowsModeWrappedState=function(d){const c=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),b=c==null?void 0:c.get(d.cols-1),C=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);C&&b&&(C.isWrapped=b[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&b[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ExtendedAttrs=a.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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}}a.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,b=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=b}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}a.ExtendedAttrs=u},9092:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Buffer=a.MAX_BUFFER_SIZE=void 0;const u=l(6349),d=l(7226),c=l(3734),b=l(8437),C=l(4634),S=l(511),y=l(643),g=l(4863),_=l(7116);a.MAX_BUFFER_SIZE=4294967295,a.Buffer=class{constructor(m,v,D){this._hasScrollback=m,this._optionsService=v,this._bufferService=D,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=b.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,y.NULL_CELL_CHAR,y.NULL_CELL_WIDTH,y.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,y.WHITESPACE_CELL_CHAR,y.WHITESPACE_CELL_WIDTH,y.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new d.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(m){return m?(this._nullCell.fg=m.fg,this._nullCell.bg=m.bg,this._nullCell.extended=m.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(m){return m?(this._whitespaceCell.fg=m.fg,this._whitespaceCell.bg=m.bg,this._whitespaceCell.extended=m.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(m,v){return new b.BufferLine(this._bufferService.cols,this.getNullCell(m),v)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const m=this.ybase+this.y-this.ydisp;return m>=0&&m<this._rows}_getCorrectBufferLength(m){if(!this._hasScrollback)return m;const v=m+this._optionsService.rawOptions.scrollback;return v>a.MAX_BUFFER_SIZE?a.MAX_BUFFER_SIZE:v}fillViewportRows(m){if(this.lines.length===0){m===void 0&&(m=b.DEFAULT_ATTR_DATA);let v=this._rows;for(;v--;)this.lines.push(this.getBlankLine(m))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(m,v){const D=this.getNullCell(b.DEFAULT_ATTR_DATA);let P=0;const T=this._getCorrectBufferLength(v);if(T>this.lines.maxLength&&(this.lines.maxLength=T),this.lines.length>0){if(this._cols<m)for(let E=0;E<this.lines.length;E++)P+=+this.lines.get(E).resize(m,D);let A=0;if(this._rows<v)for(let E=this._rows;E<v;E++)this.lines.length<v+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new b.BufferLine(m,D)):this.ybase>0&&this.lines.length<=this.ybase+this.y+A+1?(this.ybase--,A++,this.ydisp>0&&this.ydisp--):this.lines.push(new b.BufferLine(m,D)));else for(let E=this._rows;E>v;E--)this.lines.length>v+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(T<this.lines.maxLength){const E=this.lines.length-T;E>0&&(this.lines.trimStart(E),this.ybase=Math.max(this.ybase-E,0),this.ydisp=Math.max(this.ydisp-E,0),this.savedY=Math.max(this.savedY-E,0)),this.lines.maxLength=T}this.x=Math.min(this.x,m-1),this.y=Math.min(this.y,v-1),A&&(this.y+=A),this.savedX=Math.min(this.savedX,m-1),this.scrollTop=0}if(this.scrollBottom=v-1,this._isReflowEnabled&&(this._reflow(m,v),this._cols>m))for(let A=0;A<this.lines.length;A++)P+=+this.lines.get(A).resize(m,D);this._cols=m,this._rows=v,this._memoryCleanupQueue.clear(),P>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let m=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,m=!1);let v=0;for(;this._memoryCleanupPosition<this.lines.length;)if(v+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),v>100)return!0;return m}get _isReflowEnabled(){const m=this._optionsService.rawOptions.windowsPty;return m&&m.buildNumber?this._hasScrollback&&m.backend==="conpty"&&m.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(m,v){this._cols!==m&&(m>this._cols?this._reflowLarger(m,v):this._reflowSmaller(m,v))}_reflowLarger(m,v){const D=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,m,this.ybase+this.y,this.getNullCell(b.DEFAULT_ATTR_DATA));if(D.length>0){const P=(0,C.reflowLargerCreateNewLayout)(this.lines,D);(0,C.reflowLargerApplyNewLayout)(this.lines,P.layout),this._reflowLargerAdjustViewport(m,v,P.countRemoved)}}_reflowLargerAdjustViewport(m,v,D){const P=this.getNullCell(b.DEFAULT_ATTR_DATA);let T=D;for(;T-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<v&&this.lines.push(new b.BufferLine(m,P))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-D,0)}_reflowSmaller(m,v){const D=this.getNullCell(b.DEFAULT_ATTR_DATA),P=[];let T=0;for(let A=this.lines.length-1;A>=0;A--){let E=this.lines.get(A);if(!E||!E.isWrapped&&E.getTrimmedLength()<=m)continue;const I=[E];for(;E.isWrapped&&A>0;)E=this.lines.get(--A),I.unshift(E);const B=this.ybase+this.y;if(B>=A&&B<A+I.length)continue;const N=I[I.length-1].getTrimmedLength(),W=(0,C.reflowSmallerGetNewLineLengths)(I,this._cols,m),F=W.length-I.length;let q;q=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 V=[];for(let R=0;R<F;R++){const G=this.getBlankLine(b.DEFAULT_ATTR_DATA,!0);V.push(G)}V.length>0&&(P.push({start:A+I.length+T,newLines:V}),T+=V.length),I.push(...V);let K=W.length-1,ie=W[K];ie===0&&(K--,ie=W[K]);let Z=I.length-F-1,L=N;for(;Z>=0;){const R=Math.min(L,ie);if(I[K]===void 0)break;if(I[K].copyCellsFrom(I[Z],L-R,ie-R,R,!0),ie-=R,ie===0&&(K--,ie=W[K]),L-=R,L===0){Z--;const G=Math.max(Z,0);L=(0,C.getWrappedLineTrimmedLength)(I,G,this._cols)}}for(let R=0;R<I.length;R++)W[R]<m&&I[R].setCell(W[R],D);let H=F-q;for(;H-- >0;)this.ybase===0?this.y<v-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+T)-v&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+F,this.ybase+v-1)}if(P.length>0){const A=[],E=[];for(let K=0;K<this.lines.length;K++)E.push(this.lines.get(K));const I=this.lines.length;let B=I-1,N=0,W=P[N];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+T);let F=0;for(let K=Math.min(this.lines.maxLength-1,I+T-1);K>=0;K--)if(W&&W.start>B+F){for(let ie=W.newLines.length-1;ie>=0;ie--)this.lines.set(K--,W.newLines[ie]);K++,A.push({index:B+1,amount:W.newLines.length}),F+=W.newLines.length,W=P[++N]}else this.lines.set(K,E[B--]);let q=0;for(let K=A.length-1;K>=0;K--)A[K].index+=q,this.lines.onInsertEmitter.fire(A[K]),q+=A[K].amount;const V=Math.max(0,I+T-this.lines.maxLength);V>0&&this.lines.onTrimEmitter.fire(V)}}translateBufferLineToString(m,v,D=0,P){const T=this.lines.get(m);return T?T.translateToString(v,D,P):""}getWrappedRangeForLine(m){let v=m,D=m;for(;v>0&&this.lines.get(v).isWrapped;)v--;for(;D+1<this.lines.length&&this.lines.get(D+1).isWrapped;)D++;return{first:v,last:D}}setupTabStops(m){for(m!=null?this.tabs[m]||(m=this.prevStop(m)):(this.tabs={},m=0);m<this._cols;m+=this._optionsService.rawOptions.tabStopWidth)this.tabs[m]=!0}prevStop(m){for(m==null&&(m=this.x);!this.tabs[--m]&&m>0;);return m>=this._cols?this._cols-1:m<0?0:m}nextStop(m){for(m==null&&(m=this.x);!this.tabs[++m]&&m<this._cols;);return m>=this._cols?this._cols-1:m<0?0:m}clearMarkers(m){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].line===m&&(this.markers[v].dispose(),this.markers.splice(v--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let m=0;m<this.markers.length;m++)this.markers[m].dispose(),this.markers.splice(m--,1);this._isClearing=!1}addMarker(m){const v=new g.Marker(m);return this.markers.push(v),v.register(this.lines.onTrim((D=>{v.line-=D,v.line<0&&v.dispose()}))),v.register(this.lines.onInsert((D=>{v.line>=D.index&&(v.line+=D.amount)}))),v.register(this.lines.onDelete((D=>{v.line>=D.index&&v.line<D.index+D.amount&&v.dispose(),v.line>D.index&&(v.line-=D.amount)}))),v.register(v.onDispose((()=>this._removeMarker(v)))),v}_removeMarker(m){this._isClearing||this.markers.splice(this.markers.indexOf(m),1)}}},8437:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLine=a.DEFAULT_ATTR_DATA=void 0;const u=l(3734),d=l(511),c=l(643),b=l(482);a.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let C=0;class S{constructor(g,_,m=!1){this.isWrapped=m,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const v=_||d.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let D=0;D<g;++D)this.setCell(D,v);this.length=g}get(g){const _=this._data[3*g+0],m=2097151&_;return[this._data[3*g+1],2097152&_?this._combined[g]:m?(0,b.stringFromCodePoint)(m):"",_>>22,2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):m]}set(g,_){this._data[3*g+1]=_[c.CHAR_DATA_ATTR_INDEX],_[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=_[1],this._data[3*g+0]=2097152|g|_[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=_[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&_}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g]:2097151&_?(0,b.stringFromCodePoint)(2097151&_):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,_){return C=3*g,_.content=this._data[C+0],_.fg=this._data[C+1],_.bg=this._data[C+2],2097152&_.content&&(_.combinedData=this._combined[g]),268435456&_.bg&&(_.extended=this._extendedAttrs[g]),_}setCell(g,_){2097152&_.content&&(this._combined[g]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[g]=_.extended),this._data[3*g+0]=_.content,this._data[3*g+1]=_.fg,this._data[3*g+2]=_.bg}setCellFromCodepoint(g,_,m,v){268435456&v.bg&&(this._extendedAttrs[g]=v.extended),this._data[3*g+0]=_|m<<22,this._data[3*g+1]=v.fg,this._data[3*g+2]=v.bg}addCodepointToCell(g,_,m){let v=this._data[3*g+0];2097152&v?this._combined[g]+=(0,b.stringFromCodePoint)(_):2097151&v?(this._combined[g]=(0,b.stringFromCodePoint)(2097151&v)+(0,b.stringFromCodePoint)(_),v&=-2097152,v|=2097152):v=_|4194304,m&&(v&=-12582913,v|=m<<22),this._data[3*g+0]=v}insertCells(g,_,m){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length-g){const v=new d.CellData;for(let D=this.length-g-_-1;D>=0;--D)this.setCell(g+_+D,this.loadCell(g+D,v));for(let D=0;D<_;++D)this.setCell(g+D,m)}else for(let v=g;v<this.length;++v)this.setCell(v,m);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,m)}deleteCells(g,_,m){if(g%=this.length,_<this.length-g){const v=new d.CellData;for(let D=0;D<this.length-g-_;++D)this.setCell(g+D,this.loadCell(g+_+D,v));for(let D=this.length-_;D<this.length;++D)this.setCell(D,m)}else for(let v=g;v<this.length;++v)this.setCell(v,m);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,m)}replaceCells(g,_,m,v=!1){if(v)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,m);g<_&&g<this.length;)this.isProtected(g)||this.setCell(g,m),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,m),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,m);g<_&&g<this.length;)this.setCell(g++,m)}resize(g,_){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const m=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*m)this._data=new Uint32Array(this._data.buffer,0,m);else{const v=new Uint32Array(m);v.set(this._data),this._data=v}for(let v=this.length;v<g;++v)this.setCell(v,_)}else{this._data=this._data.subarray(0,m);const v=Object.keys(this._combined);for(let P=0;P<v.length;P++){const T=parseInt(v[P],10);T>=g&&delete this._combined[T]}const D=Object.keys(this._extendedAttrs);for(let P=0;P<D.length;P++){const T=parseInt(D[P],10);T>=g&&delete this._extendedAttrs[T]}}return this.length=g,4*m*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,_=!1){if(_)for(let m=0;m<this.length;++m)this.isProtected(m)||this.setCell(m,g);else{this._combined={},this._extendedAttrs={};for(let m=0;m<this.length;++m)this.setCell(m,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const _ in g._combined)this._combined[_]=g._combined[_];this._extendedAttrs={};for(const _ in g._extendedAttrs)this._extendedAttrs[_]=g._extendedAttrs[_];this.isWrapped=g.isWrapped}clone(){const g=new S(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const _ in this._combined)g._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)g._extendedAttrs[_]=this._extendedAttrs[_];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,_,m,v,D){const P=g._data;if(D)for(let A=v-1;A>=0;A--){for(let E=0;E<3;E++)this._data[3*(m+A)+E]=P[3*(_+A)+E];268435456&P[3*(_+A)+2]&&(this._extendedAttrs[m+A]=g._extendedAttrs[_+A])}else for(let A=0;A<v;A++){for(let E=0;E<3;E++)this._data[3*(m+A)+E]=P[3*(_+A)+E];268435456&P[3*(_+A)+2]&&(this._extendedAttrs[m+A]=g._extendedAttrs[_+A])}const T=Object.keys(g._combined);for(let A=0;A<T.length;A++){const E=parseInt(T[A],10);E>=_&&(this._combined[E-_+m]=g._combined[E])}}translateToString(g,_,m,v){_=_??0,m=m??this.length,g&&(m=Math.min(m,this.getTrimmedLength())),v&&(v.length=0);let D="";for(;_<m;){const P=this._data[3*_+0],T=2097151&P,A=2097152&P?this._combined[_]:T?(0,b.stringFromCodePoint)(T):c.WHITESPACE_CELL_CHAR;if(D+=A,v)for(let E=0;E<A.length;++E)v.push(_);_+=P>>22||1}return v&&v.push(_),D}}a.BufferLine=S},4841:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getRangeLength=void 0,a.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(w,a)=>{function l(u,d,c){if(d===u.length-1)return u[d].getTrimmedLength();const b=!u[d].hasContent(c-1)&&u[d].getWidth(c-1)===1,C=u[d+1].getWidth(0)===2;return b&&C?c-1:c}Object.defineProperty(a,"__esModule",{value:!0}),a.getWrappedLineTrimmedLength=a.reflowSmallerGetNewLineLengths=a.reflowLargerApplyNewLayout=a.reflowLargerCreateNewLayout=a.reflowLargerGetLinesToRemove=void 0,a.reflowLargerGetLinesToRemove=function(u,d,c,b,C){const S=[];for(let y=0;y<u.length-1;y++){let g=y,_=u.get(++g);if(!_.isWrapped)continue;const m=[u.get(y)];for(;g<u.length&&_.isWrapped;)m.push(_),_=u.get(++g);if(b>=y&&b<g){y+=m.length-1;continue}let v=0,D=l(m,v,d),P=1,T=0;for(;P<m.length;){const E=l(m,P,d),I=E-T,B=c-D,N=Math.min(I,B);m[v].copyCellsFrom(m[P],T,D,N,!1),D+=N,D===c&&(v++,D=0),T+=N,T===E&&(P++,T=0),D===0&&v!==0&&m[v-1].getWidth(c-1)===2&&(m[v].copyCellsFrom(m[v-1],c-1,D++,1,!1),m[v-1].setCell(c-1,C))}m[v].replaceCells(D,c,C);let A=0;for(let E=m.length-1;E>0&&(E>v||m[E].getTrimmedLength()===0);E--)A++;A>0&&(S.push(y+m.length-A),S.push(A)),y+=m.length-1}return S},a.reflowLargerCreateNewLayout=function(u,d){const c=[];let b=0,C=d[b],S=0;for(let y=0;y<u.length;y++)if(C===y){const g=d[++b];u.onDeleteEmitter.fire({index:y-S,amount:g}),y+=g-1,S+=g,C=d[++b]}else c.push(y);return{layout:c,countRemoved:S}},a.reflowLargerApplyNewLayout=function(u,d){const c=[];for(let b=0;b<d.length;b++)c.push(u.get(d[b]));for(let b=0;b<c.length;b++)u.set(b,c[b]);u.length=d.length},a.reflowSmallerGetNewLineLengths=function(u,d,c){const b=[],C=u.map(((_,m)=>l(u,m,d))).reduce(((_,m)=>_+m));let S=0,y=0,g=0;for(;g<C;){if(C-g<c){b.push(C-g);break}S+=c;const _=l(u,y,d);S>_&&(S-=_,y++);const m=u[y].getWidth(S-1)===2;m&&S--;const v=m?c-1:c;b.push(v),g+=v}return b},a.getWrappedLineTrimmedLength=l},5295:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferSet=void 0;const u=l(8460),d=l(844),c=l(9092);class b extends d.Disposable{constructor(S,y){super(),this._optionsService=S,this._bufferService=y,this._onBufferActivate=this.register(new u.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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,y){this._normal.resize(S,y),this._alt.resize(S,y),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}a.BufferSet=b},511:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CellData=void 0;const u=l(482),d=l(643),c=l(3734);class b extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const y=new b;return y.setFromCharData(S),y}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let y=!1;if(S[d.CHAR_DATA_CHAR_INDEX].length>2)y=!0;else if(S[d.CHAR_DATA_CHAR_INDEX].length===2){const g=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const _=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(g-55296)+_-56320+65536|S[d.CHAR_DATA_WIDTH_INDEX]<<22:y=!0}else y=!0}else this.content=S[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[d.CHAR_DATA_WIDTH_INDEX]<<22;y&&(this.combinedData=S[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}a.CellData=b},643:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WHITESPACE_CELL_CODE=a.WHITESPACE_CELL_WIDTH=a.WHITESPACE_CELL_CHAR=a.NULL_CELL_CODE=a.NULL_CELL_WIDTH=a.NULL_CELL_CHAR=a.CHAR_DATA_CODE_INDEX=a.CHAR_DATA_WIDTH_INDEX=a.CHAR_DATA_CHAR_INDEX=a.CHAR_DATA_ATTR_INDEX=a.DEFAULT_EXT=a.DEFAULT_ATTR=a.DEFAULT_COLOR=void 0,a.DEFAULT_COLOR=0,a.DEFAULT_ATTR=256|a.DEFAULT_COLOR<<9,a.DEFAULT_EXT=0,a.CHAR_DATA_ATTR_INDEX=0,a.CHAR_DATA_CHAR_INDEX=1,a.CHAR_DATA_WIDTH_INDEX=2,a.CHAR_DATA_CODE_INDEX=3,a.NULL_CELL_CHAR="",a.NULL_CELL_WIDTH=1,a.NULL_CELL_CODE=0,a.WHITESPACE_CELL_CHAR=" ",a.WHITESPACE_CELL_WIDTH=1,a.WHITESPACE_CELL_CODE=32},4863:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Marker=void 0;const u=l(8460),d=l(844);class c{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,d.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}a.Marker=c,c._nextId=1},7116:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DEFAULT_CHARSET=a.CHARSETS=void 0,a.CHARSETS={},a.DEFAULT_CHARSET=a.CHARSETS.B,a.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:"≥","{":"π","|":"≠","}":"£","~":"·"},a.CHARSETS.A={"#":"£"},a.CHARSETS.B=void 0,a.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},a.CHARSETS.C=a.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},a.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},a.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},a.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},a.CHARSETS.E=a.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},a.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},a.CHARSETS.H=a.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},a.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(w,a)=>{var l,u,d;Object.defineProperty(a,"__esModule",{value:!0}),a.C1_ESCAPED=a.C1=a.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
67
+ `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""})(l||(a.C0=l={})),(function(c){c.PAD="€",c.HOP="",c.BPH="‚",c.NBH="ƒ",c.IND="„",c.NEL="…",c.SSA="†",c.ESA="‡",c.HTS="ˆ",c.HTJ="‰",c.VTS="Š",c.PLD="‹",c.PLU="Œ",c.RI="",c.SS2="Ž",c.SS3="",c.DCS="",c.PU1="‘",c.PU2="’",c.STS="“",c.CCH="”",c.MW="•",c.SPA="–",c.EPA="—",c.SOS="˜",c.SGCI="™",c.SCI="š",c.CSI="›",c.ST="œ",c.OSC="",c.PM="ž",c.APC="Ÿ"})(u||(a.C1=u={})),(function(c){c.ST=`${l.ESC}\\`})(d||(a.C1_ESCAPED=d={}))},7399:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.evaluateKeyboardEvent=void 0;const u=l(2584),d={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:["'",'"']};a.evaluateKeyboardEvent=function(c,b,C,S){const y={type:0,cancel:!1,key:void 0},g=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?y.key=b?u.C0.ESC+"OA":u.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?y.key=b?u.C0.ESC+"OD":u.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?y.key=b?u.C0.ESC+"OC":u.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(y.key=b?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:y.key=c.ctrlKey?"\b":u.C0.DEL,c.altKey&&(y.key=u.C0.ESC+y.key);break;case 9:if(c.shiftKey){y.key=u.C0.ESC+"[Z";break}y.key=u.C0.HT,y.cancel=!0;break;case 13:y.key=c.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,y.cancel=!0;break;case 27:y.key=u.C0.ESC,c.altKey&&(y.key=u.C0.ESC+u.C0.ESC),y.cancel=!0;break;case 37:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"D",y.key===u.C0.ESC+"[1;3D"&&(y.key=u.C0.ESC+(C?"b":"[1;5D"))):y.key=b?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"C",y.key===u.C0.ESC+"[1;3C"&&(y.key=u.C0.ESC+(C?"f":"[1;5C"))):y.key=b?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"A",C||y.key!==u.C0.ESC+"[1;3A"||(y.key=u.C0.ESC+"[1;5A")):y.key=b?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(c.metaKey)break;g?(y.key=u.C0.ESC+"[1;"+(g+1)+"B",C||y.key!==u.C0.ESC+"[1;3B"||(y.key=u.C0.ESC+"[1;5B")):y.key=b?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(y.key=u.C0.ESC+"[2~");break;case 46:y.key=g?u.C0.ESC+"[3;"+(g+1)+"~":u.C0.ESC+"[3~";break;case 36:y.key=g?u.C0.ESC+"[1;"+(g+1)+"H":b?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:y.key=g?u.C0.ESC+"[1;"+(g+1)+"F":b?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:c.shiftKey?y.type=2:c.ctrlKey?y.key=u.C0.ESC+"[5;"+(g+1)+"~":y.key=u.C0.ESC+"[5~";break;case 34:c.shiftKey?y.type=3:c.ctrlKey?y.key=u.C0.ESC+"[6;"+(g+1)+"~":y.key=u.C0.ESC+"[6~";break;case 112:y.key=g?u.C0.ESC+"[1;"+(g+1)+"P":u.C0.ESC+"OP";break;case 113:y.key=g?u.C0.ESC+"[1;"+(g+1)+"Q":u.C0.ESC+"OQ";break;case 114:y.key=g?u.C0.ESC+"[1;"+(g+1)+"R":u.C0.ESC+"OR";break;case 115:y.key=g?u.C0.ESC+"[1;"+(g+1)+"S":u.C0.ESC+"OS";break;case 116:y.key=g?u.C0.ESC+"[15;"+(g+1)+"~":u.C0.ESC+"[15~";break;case 117:y.key=g?u.C0.ESC+"[17;"+(g+1)+"~":u.C0.ESC+"[17~";break;case 118:y.key=g?u.C0.ESC+"[18;"+(g+1)+"~":u.C0.ESC+"[18~";break;case 119:y.key=g?u.C0.ESC+"[19;"+(g+1)+"~":u.C0.ESC+"[19~";break;case 120:y.key=g?u.C0.ESC+"[20;"+(g+1)+"~":u.C0.ESC+"[20~";break;case 121:y.key=g?u.C0.ESC+"[21;"+(g+1)+"~":u.C0.ESC+"[21~";break;case 122:y.key=g?u.C0.ESC+"[23;"+(g+1)+"~":u.C0.ESC+"[23~";break;case 123:y.key=g?u.C0.ESC+"[24;"+(g+1)+"~":u.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(C&&!S||!c.altKey||c.metaKey)!C||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?y.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(y.key=u.C0.US),c.key==="@"&&(y.key=u.C0.NUL)):c.keyCode===65&&(y.type=1);else{const _=d[c.keyCode],m=_==null?void 0:_[c.shiftKey?1:0];if(m)y.key=u.C0.ESC+m;else if(c.keyCode>=65&&c.keyCode<=90){const v=c.ctrlKey?c.keyCode-64:c.keyCode+32;let D=String.fromCharCode(v);c.shiftKey&&(D=D.toUpperCase()),y.key=u.C0.ESC+D}else if(c.keyCode===32)y.key=u.C0.ESC+(c.ctrlKey?u.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let v=c.code.slice(3,4);c.shiftKey||(v=v.toLowerCase()),y.key=u.C0.ESC+v,y.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?y.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?y.key=u.C0.NUL:c.keyCode>=51&&c.keyCode<=55?y.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?y.key=u.C0.DEL:c.keyCode===219?y.key=u.C0.ESC:c.keyCode===220?y.key=u.C0.FS:c.keyCode===221&&(y.key=u.C0.GS)}return y}},482:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Utf8ToUtf32=a.StringToUtf32=a.utf32ToString=a.stringFromCodePoint=void 0,a.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},a.utf32ToString=function(l,u=0,d=l.length){let c="";for(let b=u;b<d;++b){let C=l[b];C>65535?(C-=65536,c+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):c+=String.fromCharCode(C)}return c},a.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const d=l.length;if(!d)return 0;let c=0,b=0;if(this._interim){const C=l.charCodeAt(b++);56320<=C&&C<=57343?u[c++]=1024*(this._interim-55296)+C-56320+65536:(u[c++]=this._interim,u[c++]=C),this._interim=0}for(let C=b;C<d;++C){const S=l.charCodeAt(C);if(55296<=S&&S<=56319){if(++C>=d)return this._interim=S,c;const y=l.charCodeAt(C);56320<=y&&y<=57343?u[c++]=1024*(S-55296)+y-56320+65536:(u[c++]=S,u[c++]=y)}else S!==65279&&(u[c++]=S)}return c}},a.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const d=l.length;if(!d)return 0;let c,b,C,S,y=0,g=0,_=0;if(this.interim[0]){let D=!1,P=this.interim[0];P&=(224&P)==192?31:(240&P)==224?15:7;let T,A=0;for(;(T=63&this.interim[++A])&&A<4;)P<<=6,P|=T;const E=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,I=E-A;for(;_<I;){if(_>=d)return 0;if(T=l[_++],(192&T)!=128){_--,D=!0;break}this.interim[A++]=T,P<<=6,P|=63&T}D||(E===2?P<128?_--:u[y++]=P:E===3?P<2048||P>=55296&&P<=57343||P===65279||(u[y++]=P):P<65536||P>1114111||(u[y++]=P)),this.interim.fill(0)}const m=d-4;let v=_;for(;v<d;){for(;!(!(v<m)||128&(c=l[v])||128&(b=l[v+1])||128&(C=l[v+2])||128&(S=l[v+3]));)u[y++]=c,u[y++]=b,u[y++]=C,u[y++]=S,v+=4;if(c=l[v++],c<128)u[y++]=c;else if((224&c)==192){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(g=(31&c)<<6|63&b,g<128){v--;continue}u[y++]=g}else if((240&c)==224){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,y;if(C=l[v++],(192&C)!=128){v--;continue}if(g=(15&c)<<12|(63&b)<<6|63&C,g<2048||g>=55296&&g<=57343||g===65279)continue;u[y++]=g}else if((248&c)==240){if(v>=d)return this.interim[0]=c,y;if(b=l[v++],(192&b)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,y;if(C=l[v++],(192&C)!=128){v--;continue}if(v>=d)return this.interim[0]=c,this.interim[1]=b,this.interim[2]=C,y;if(S=l[v++],(192&S)!=128){v--;continue}if(g=(7&c)<<18|(63&b)<<12|(63&C)<<6|63&S,g<65536||g>1114111)continue;u[y++]=g}}return y}}},225:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeV6=void 0;const u=l(1480),d=[[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]],c=[[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 b;a.UnicodeV6=class{constructor(){if(this.version="6",!b){b=new Uint8Array(65536),b.fill(1),b[0]=0,b.fill(0,1,32),b.fill(0,127,160),b.fill(2,4352,4448),b[9001]=2,b[9002]=2,b.fill(2,11904,42192),b[12351]=1,b.fill(2,44032,55204),b.fill(2,63744,64256),b.fill(2,65040,65050),b.fill(2,65072,65136),b.fill(2,65280,65377),b.fill(2,65504,65511);for(let C=0;C<d.length;++C)b.fill(0,d[C][0],d[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?b[C]:(function(S,y){let g,_=0,m=y.length-1;if(S<y[0][0]||S>y[m][1])return!1;for(;m>=_;)if(g=_+m>>1,S>y[g][1])_=g+1;else{if(!(S<y[g][0]))return!0;m=g-1}return!1})(C,c)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,S){let y=this.wcwidth(C),g=y===0&&S!==0;if(g){const _=u.UnicodeService.extractWidth(S);_===0?g=!1:_>y&&(y=_)}return u.UnicodeService.createPropertyValue(0,y,g)}}},5981:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.WriteBuffer=void 0;const u=l(8460),d=l(844);class c extends d.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let y;for(this._isSyncWriting=!0;y=this._writeBuffer.shift();){this._action(y);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,S){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+=C.length,this._writeBuffer.push(C),this._callbacks.push(S),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(S)}_innerWrite(C=0,S=!0){const y=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],_=this._action(g,S);if(_){const v=D=>Date.now()-y>=12?setTimeout((()=>this._innerWrite(0,D))):this._innerWrite(y,D);return void _.catch((D=>(queueMicrotask((()=>{throw D})),Promise.resolve(!1)))).then(v)}const m=this._callbacks[this._bufferOffset];if(m&&m(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-y>=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()}}a.WriteBuffer=c},5941:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.toRgbString=a.parseColor=void 0;const l=/^([\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})$/,u=/^[\da-f]+$/;function d(c,b){const C=c.toString(16),S=C.length<2?"0"+C:C;switch(b){case 4:return C[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}a.parseColor=function(c){if(!c)return;let b=c.toLowerCase();if(b.indexOf("rgb:")===0){b=b.slice(4);const C=l.exec(b);if(C){const S=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/S*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/S*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/S*255)]}}else if(b.indexOf("#")===0&&(b=b.slice(1),u.exec(b)&&[3,6,9,12].includes(b.length))){const C=b.length/3,S=[0,0,0];for(let y=0;y<3;++y){const g=parseInt(b.slice(C*y,C*y+C),16);S[y]=C===1?g<<4:C===2?g:C===3?g>>4:g>>8}return S}},a.toRgbString=function(c,b=16){const[C,S,y]=c;return`rgb:${d(C,b)}/${d(S,b)}/${d(y,b)}`}},5770:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PAYLOAD_LIMIT=void 0,a.PAYLOAD_LIMIT=1e7},6351:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DcsHandler=a.DcsParser=void 0;const u=l(482),d=l(8742),c=l(5770),b=[];a.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=b,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=b}registerHandler(S,y){this._handlers[S]===void 0&&(this._handlers[S]=[]);const g=this._handlers[S];return g.push(y),{dispose:()=>{const _=g.indexOf(y);_!==-1&&g.splice(_,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=b,this._ident=0}hook(S,y){if(this.reset(),this._ident=S,this._active=this._handlers[S]||b,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(y);else this._handlerFb(this._ident,"HOOK",y)}put(S,y,g){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(S,y,g);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(S,y,g))}unhook(S,y=!0){if(this._active.length){let g=!1,_=this._active.length-1,m=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,g=y,m=this._stack.fallThrough,this._stack.paused=!1),!m&&g===!1){for(;_>=0&&(g=this._active[_].unhook(S),g!==!0);_--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,g;_--}for(;_>=0;_--)if(g=this._active[_].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",S);this._active=b,this._ident=0}};const C=new d.Params;C.addParam(0),a.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=C,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():C,this._data="",this._hitLimit=!1}put(S,y,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(S,y,g),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let y=!1;if(this._hitLimit)y=!1;else if(S&&(y=this._handler(this._data,this._params),y instanceof Promise))return y.then((g=>(this._params=C,this._data="",this._hitLimit=!1,g)));return this._params=C,this._data="",this._hitLimit=!1,y}}},2015:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.EscapeSequenceParser=a.VT500_TRANSITION_TABLE=a.TransitionTable=void 0;const u=l(844),d=l(8742),c=l(6242),b=l(6351);class C{constructor(_){this.table=new Uint8Array(_)}setDefault(_,m){this.table.fill(_<<4|m)}add(_,m,v,D){this.table[m<<8|_]=v<<4|D}addMany(_,m,v,D){for(let P=0;P<_.length;P++)this.table[m<<8|_[P]]=v<<4|D}}a.TransitionTable=C;const S=160;a.VT500_TRANSITION_TABLE=(function(){const g=new C(4095),_=Array.apply(null,Array(256)).map(((A,E)=>E)),m=(A,E)=>_.slice(A,E),v=m(32,127),D=m(0,24);D.push(25),D.push.apply(D,m(28,32));const P=m(0,14);let T;for(T in g.setDefault(1,0),g.addMany(v,0,2,0),P)g.addMany([24,26,153,154],T,3,0),g.addMany(m(128,144),T,3,0),g.addMany(m(144,152),T,3,0),g.add(156,T,0,0),g.add(27,T,11,1),g.add(157,T,4,8),g.addMany([152,158,159],T,0,7),g.add(155,T,11,3),g.add(144,T,11,9);return g.addMany(D,0,3,0),g.addMany(D,1,3,1),g.add(127,1,0,1),g.addMany(D,8,0,8),g.addMany(D,3,3,3),g.add(127,3,0,3),g.addMany(D,4,3,4),g.add(127,4,0,4),g.addMany(D,6,3,6),g.addMany(D,5,3,5),g.add(127,5,0,5),g.addMany(D,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(v,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(m(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(v,7,0,7),g.addMany(D,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(m(64,127),3,7,0),g.addMany(m(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(m(48,60),4,8,4),g.addMany(m(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(m(32,64),6,0,6),g.add(127,6,0,6),g.addMany(m(64,127),6,0,0),g.addMany(m(32,48),3,9,5),g.addMany(m(32,48),5,9,5),g.addMany(m(48,64),5,0,6),g.addMany(m(64,127),5,7,0),g.addMany(m(32,48),4,9,5),g.addMany(m(32,48),1,9,2),g.addMany(m(32,48),2,9,2),g.addMany(m(48,127),2,10,0),g.addMany(m(48,80),1,10,0),g.addMany(m(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(m(96,127),1,10,0),g.add(80,1,11,9),g.addMany(D,9,0,9),g.add(127,9,0,9),g.addMany(m(28,32),9,0,9),g.addMany(m(32,48),9,9,12),g.addMany(m(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(D,11,0,11),g.addMany(m(32,128),11,0,11),g.addMany(m(28,32),11,0,11),g.addMany(D,10,0,10),g.add(127,10,0,10),g.addMany(m(28,32),10,0,10),g.addMany(m(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(m(32,48),10,9,12),g.addMany(D,12,0,12),g.add(127,12,0,12),g.addMany(m(28,32),12,0,12),g.addMany(m(32,48),12,9,12),g.addMany(m(48,64),12,0,11),g.addMany(m(64,127),12,12,13),g.addMany(m(64,127),10,12,13),g.addMany(m(64,127),9,12,13),g.addMany(D,13,13,13),g.addMany(v,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(S,0,2,0),g.add(S,8,5,8),g.add(S,6,0,6),g.add(S,11,0,11),g.add(S,13,13,13),g})();class y extends u.Disposable{constructor(_=a.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new d.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(m,v,D)=>{},this._executeHandlerFb=m=>{},this._csiHandlerFb=(m,v)=>{},this._escHandlerFb=m=>{},this._errorHandlerFb=m=>m,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new b.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,m=[64,126]){let v=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(v=_.prefix.charCodeAt(0),v&&60>v||v>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let P=0;P<_.intermediates.length;++P){const T=_.intermediates.charCodeAt(P);if(32>T||T>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");v<<=8,v|=T}}if(_.final.length!==1)throw new Error("final must be a single byte");const D=_.final.charCodeAt(0);if(m[0]>D||D>m[1])throw new Error(`final must be in range ${m[0]} .. ${m[1]}`);return v<<=8,v|=D,v}identToString(_){const m=[];for(;_;)m.push(String.fromCharCode(255&_)),_>>=8;return m.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,m){const v=this._identifier(_,[48,126]);this._escHandlers[v]===void 0&&(this._escHandlers[v]=[]);const D=this._escHandlers[v];return D.push(m),{dispose:()=>{const P=D.indexOf(m);P!==-1&&D.splice(P,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,m){this._executeHandlers[_.charCodeAt(0)]=m}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,m){const v=this._identifier(_);this._csiHandlers[v]===void 0&&(this._csiHandlers[v]=[]);const D=this._csiHandlers[v];return D.push(m),{dispose:()=>{const P=D.indexOf(m);P!==-1&&D.splice(P,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,m){return this._dcsParser.registerHandler(this._identifier(_),m)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,m){return this._oscParser.registerHandler(_,m)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,m,v,D,P){this._parseStack.state=_,this._parseStack.handlers=m,this._parseStack.handlerPos=v,this._parseStack.transition=D,this._parseStack.chunkPos=P}parse(_,m,v){let D,P=0,T=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(v===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const E=this._parseStack.handlers;let I=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(v===!1&&I>-1){for(;I>=0&&(D=E[I](this._params),D!==!0);I--)if(D instanceof Promise)return this._parseStack.handlerPos=I,D}this._parseStack.handlers=[];break;case 4:if(v===!1&&I>-1){for(;I>=0&&(D=E[I](),D!==!0);I--)if(D instanceof Promise)return this._parseStack.handlerPos=I,D}this._parseStack.handlers=[];break;case 6:if(P=_[this._parseStack.chunkPos],D=this._dcsParser.unhook(P!==24&&P!==26,v),D)return D;P===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(P=_[this._parseStack.chunkPos],D=this._oscParser.end(P!==24&&P!==26,v),D)return D;P===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let E=A;E<m;++E){switch(P=_[E],T=this._transitions.table[this.currentState<<8|(P<160?P:S)],T>>4){case 2:for(let F=E+1;;++F){if(F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}if(++F>=m||(P=_[F])<32||P>126&&P<S){this._printHandler(_,E,F),E=F-1;break}}break;case 3:this._executeHandlers[P]?this._executeHandlers[P]():this._executeHandlerFb(P),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:E,code:P,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const I=this._csiHandlers[this._collect<<8|P];let B=I?I.length-1:-1;for(;B>=0&&(D=I[B](this._params),D!==!0);B--)if(D instanceof Promise)return this._preserveStack(3,I,B,T,E),D;B<0&&this._csiHandlerFb(this._collect<<8|P,this._params),this.precedingJoinState=0;break;case 8:do switch(P){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(P-48)}while(++E<m&&(P=_[E])>47&&P<60);E--;break;case 9:this._collect<<=8,this._collect|=P;break;case 10:const N=this._escHandlers[this._collect<<8|P];let W=N?N.length-1:-1;for(;W>=0&&(D=N[W](),D!==!0);W--)if(D instanceof Promise)return this._preserveStack(4,N,W,T,E),D;W<0&&this._escHandlerFb(this._collect<<8|P),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|P,this._params);break;case 13:for(let F=E+1;;++F)if(F>=m||(P=_[F])===24||P===26||P===27||P>127&&P<S){this._dcsParser.put(_,E,F),E=F-1;break}break;case 14:if(D=this._dcsParser.unhook(P!==24&&P!==26),D)return this._preserveStack(6,[],0,T,E),D;P===27&&(T|=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=E+1;;F++)if(F>=m||(P=_[F])<32||P>127&&P<S){this._oscParser.put(_,E,F),E=F-1;break}break;case 6:if(D=this._oscParser.end(P!==24&&P!==26),D)return this._preserveStack(5,[],0,T,E),D;P===27&&(T|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&T}}}a.EscapeSequenceParser=y},6242:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OscHandler=a.OscParser=void 0;const u=l(5770),d=l(482),c=[];a.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(b,C){this._handlers[b]===void 0&&(this._handlers[b]=[]);const S=this._handlers[b];return S.push(C),{dispose:()=>{const y=S.indexOf(C);y!==-1&&S.splice(y,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].start();else this._handlerFb(this._id,"START")}_put(b,C,S){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(b,C,S);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(b,C,S))}start(){this.reset(),this._state=1}put(b,C,S){if(this._state!==3){if(this._state===1)for(;C<S;){const y=b[C++];if(y===59){this._state=2,this._start();break}if(y<48||57<y)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+y-48}this._state===2&&S-C>0&&this._put(b,C,S)}}end(b,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,y=this._active.length-1,g=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,S=C,g=this._stack.fallThrough,this._stack.paused=!1),!g&&S===!1){for(;y>=0&&(S=this._active[y].end(b),S!==!0);y--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,S;y--}for(;y>=0;y--)if(S=this._active[y].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",b);this._active=c,this._id=-1,this._state=0}}},a.OscHandler=class{constructor(b){this._handler=b,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(b,C,S){this._hitLimit||(this._data+=(0,d.utf32ToString)(b,C,S),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(b){let C=!1;if(this._hitLimit)C=!1;else if(b&&(C=this._handler(this._data),C instanceof Promise))return C.then((S=>(this._data="",this._hitLimit=!1,S)));return this._data="",this._hitLimit=!1,C}}},8742:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Params=void 0;const l=2147483647;class u{static fromArray(c){const b=new u;if(!c.length)return b;for(let C=Array.isArray(c[0])?1:0;C<c.length;++C){const S=c[C];if(Array.isArray(S))for(let y=0;y<S.length;++y)b.addSubParam(S[y]);else b.addParam(S)}return b}constructor(c=32,b=32){if(this.maxLength=c,this.maxSubParamsLength=b,b>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(b),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new u(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let b=0;b<this.length;++b){c.push(this.params[b]);const C=this._subParamsIdx[b]>>8,S=255&this._subParamsIdx[b];S-C>0&&c.push(Array.prototype.slice.call(this._subParams,C,S))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const b=this._subParamsIdx[c]>>8,C=255&this._subParamsIdx[c];return C-b>0?this._subParams.subarray(b,C):null}getSubParamsAll(){const c={};for(let b=0;b<this.length;++b){const C=this._subParamsIdx[b]>>8,S=255&this._subParamsIdx[b];S-C>0&&(c[b]=this._subParams.slice(C,S))}return c}addDigit(c){let b;if(this._rejectDigits||!(b=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,S=C[b-1];C[b-1]=~S?Math.min(10*S+c,l):c}}a.Params=u},5741:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.AddonManager=void 0,a.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const d={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(d),u.dispose=()=>this._wrappedAddonDispose(d),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let d=0;d<this._addons.length;d++)if(this._addons[d]===l){u=d;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferApiView=void 0;const u=l(3785),d=l(511);a.BufferApiView=class{constructor(c,b){this._buffer=c,this.type=b}init(c){return this._buffer=c,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(c){const b=this._buffer.lines.get(c);if(b)return new u.BufferLineApiView(b)}getNullCell(){return new d.CellData}}},3785:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferLineApiView=void 0;const u=l(511);a.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,c){if(!(d<0||d>=this._line.length))return c?(this._line.loadCell(d,c),c):this._line.loadCell(d,new u.CellData)}translateToString(d,c,b){return this._line.translateToString(d,c,b)}}},8285:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BufferNamespaceApi=void 0;const u=l(8771),d=l(8460),c=l(844);class b extends c.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new d.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.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)}}a.BufferNamespaceApi=b},7975:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ParserApi=void 0,a.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(d=>u(d.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((d,c)=>u(d,c.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeApi=void 0,a.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(w,a,l){var u=this&&this.__decorate||function(g,_,m,v){var D,P=arguments.length,T=P<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(g,_,m,v);else for(var A=g.length-1;A>=0;A--)(D=g[A])&&(T=(P<3?D(T):P>3?D(_,m,T):D(_,m))||T);return P>3&&T&&Object.defineProperty(_,m,T),T},d=this&&this.__param||function(g,_){return function(m,v){_(m,v,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.BufferService=a.MINIMUM_ROWS=a.MINIMUM_COLS=void 0;const c=l(8460),b=l(844),C=l(5295),S=l(2585);a.MINIMUM_COLS=2,a.MINIMUM_ROWS=1;let y=a.BufferService=class extends b.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,a.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,a.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(g,this))}resize(g,_){this.cols=g,this.rows=_,this.buffers.resize(g,_),this._onResize.fire({cols:g,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,_=!1){const m=this.buffer;let v;v=this._cachedBlankLine,v&&v.length===this.cols&&v.getFg(0)===g.fg&&v.getBg(0)===g.bg||(v=m.getBlankLine(g,_),this._cachedBlankLine=v),v.isWrapped=_;const D=m.ybase+m.scrollTop,P=m.ybase+m.scrollBottom;if(m.scrollTop===0){const T=m.lines.isFull;P===m.lines.length-1?T?m.lines.recycle().copyFrom(v):m.lines.push(v.clone()):m.lines.splice(P+1,0,v.clone()),T?this.isUserScrolling&&(m.ydisp=Math.max(m.ydisp-1,0)):(m.ybase++,this.isUserScrolling||m.ydisp++)}else{const T=P-D+1;m.lines.shiftElements(D+1,T-1,-1),m.lines.set(P,v.clone())}this.isUserScrolling||(m.ydisp=m.ybase),this._onScroll.fire(m.ydisp)}scrollLines(g,_,m){const v=this.buffer;if(g<0){if(v.ydisp===0)return;this.isUserScrolling=!0}else g+v.ydisp>=v.ybase&&(this.isUserScrolling=!1);const D=v.ydisp;v.ydisp=Math.max(Math.min(v.ydisp+g,v.ybase),0),D!==v.ydisp&&(_||this._onScroll.fire(v.ydisp))}};a.BufferService=y=u([d(0,S.IOptionsService)],y)},7994:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.CharsetService=void 0,a.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(w,a,l){var u=this&&this.__decorate||function(v,D,P,T){var A,E=arguments.length,I=E<3?D:T===null?T=Object.getOwnPropertyDescriptor(D,P):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(v,D,P,T);else for(var B=v.length-1;B>=0;B--)(A=v[B])&&(I=(E<3?A(I):E>3?A(D,P,I):A(D,P))||I);return E>3&&I&&Object.defineProperty(D,P,I),I},d=this&&this.__param||function(v,D){return function(P,T){D(P,T,v)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreMouseService=void 0;const c=l(2585),b=l(8460),C=l(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:v=>v.button!==4&&v.action===1&&(v.ctrl=!1,v.alt=!1,v.shift=!1,!0)},VT200:{events:19,restrict:v=>v.action!==32},DRAG:{events:23,restrict:v=>v.action!==32||v.button!==3},ANY:{events:31,restrict:v=>!0}};function y(v,D){let P=(v.ctrl?16:0)|(v.shift?4:0)|(v.alt?8:0);return v.button===4?(P|=64,P|=v.action):(P|=3&v.button,4&v.button&&(P|=64),8&v.button&&(P|=128),v.action===32?P|=32:v.action!==0||D||(P|=3)),P}const g=String.fromCharCode,_={DEFAULT:v=>{const D=[y(v,!1)+32,v.col+32,v.row+32];return D[0]>255||D[1]>255||D[2]>255?"":`\x1B[M${g(D[0])}${g(D[1])}${g(D[2])}`},SGR:v=>{const D=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${y(v,!0)};${v.col};${v.row}${D}`},SGR_PIXELS:v=>{const D=v.action===0&&v.button!==4?"m":"M";return`\x1B[<${y(v,!0)};${v.x};${v.y}${D}`}};let m=a.CoreMouseService=class extends C.Disposable{constructor(v,D){super(),this._bufferService=v,this._coreService=D,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new b.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const P of Object.keys(S))this.addProtocol(P,S[P]);for(const P of Object.keys(_))this.addEncoding(P,_[P]);this.reset()}addProtocol(v,D){this._protocols[v]=D}addEncoding(v,D){this._encodings[v]=D}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(v){if(!this._protocols[v])throw new Error(`unknown protocol "${v}"`);this._activeProtocol=v,this._onProtocolChange.fire(this._protocols[v].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(v){if(!this._encodings[v])throw new Error(`unknown encoding "${v}"`);this._activeEncoding=v}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(v){if(v.col<0||v.col>=this._bufferService.cols||v.row<0||v.row>=this._bufferService.rows||v.button===4&&v.action===32||v.button===3&&v.action!==32||v.button!==4&&(v.action===2||v.action===3)||(v.col++,v.row++,v.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,v,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(v))return!1;const D=this._encodings[this._activeEncoding](v);return D&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(D):this._coreService.triggerDataEvent(D,!0)),this._lastEvent=v,!0}explainEvents(v){return{down:!!(1&v),up:!!(2&v),drag:!!(4&v),move:!!(8&v),wheel:!!(16&v)}}_equalEvents(v,D,P){if(P){if(v.x!==D.x||v.y!==D.y)return!1}else if(v.col!==D.col||v.row!==D.row)return!1;return v.button===D.button&&v.action===D.action&&v.ctrl===D.ctrl&&v.alt===D.alt&&v.shift===D.shift}};a.CoreMouseService=m=u([d(0,c.IBufferService),d(1,c.ICoreService)],m)},6975:function(w,a,l){var u=this&&this.__decorate||function(m,v,D,P){var T,A=arguments.length,E=A<3?v:P===null?P=Object.getOwnPropertyDescriptor(v,D):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(m,v,D,P);else for(var I=m.length-1;I>=0;I--)(T=m[I])&&(E=(A<3?T(E):A>3?T(v,D,E):T(v,D))||E);return A>3&&E&&Object.defineProperty(v,D,E),E},d=this&&this.__param||function(m,v){return function(D,P){v(D,P,m)}};Object.defineProperty(a,"__esModule",{value:!0}),a.CoreService=void 0;const c=l(1439),b=l(8460),C=l(844),S=l(2585),y=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=a.CoreService=class extends C.Disposable{constructor(m,v,D){super(),this._bufferService=m,this._logService=v,this._optionsService=D,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new b.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new b.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(y),this.decPrivateModes=(0,c.clone)(g)}reset(){this.modes=(0,c.clone)(y),this.decPrivateModes=(0,c.clone)(g)}triggerDataEvent(m,v=!1){if(this._optionsService.rawOptions.disableStdin)return;const D=this._bufferService.buffer;v&&this._optionsService.rawOptions.scrollOnUserInput&&D.ybase!==D.ydisp&&this._onRequestScrollToBottom.fire(),v&&this._onUserInput.fire(),this._logService.debug(`sending data "${m}"`,(()=>m.split("").map((P=>P.charCodeAt(0))))),this._onData.fire(m)}triggerBinaryEvent(m){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${m}"`,(()=>m.split("").map((v=>v.charCodeAt(0))))),this._onBinary.fire(m))}};a.CoreService=_=u([d(0,S.IBufferService),d(1,S.ILogService),d(2,S.IOptionsService)],_)},9074:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.DecorationService=void 0;const u=l(8055),d=l(8460),c=l(844),b=l(6106);let C=0,S=0;class y extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new b.SortedList((m=>m==null?void 0:m.marker.line)),this._onDecorationRegistered=this.register(new d.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new d.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)((()=>this.reset())))}registerDecoration(m){if(m.marker.isDisposed)return;const v=new g(m);if(v){const D=v.marker.onDispose((()=>v.dispose()));v.onDispose((()=>{v&&(this._decorations.delete(v)&&this._onDecorationRemoved.fire(v),D.dispose())})),this._decorations.insert(v),this._onDecorationRegistered.fire(v)}return v}reset(){for(const m of this._decorations.values())m.dispose();this._decorations.clear()}*getDecorationsAtCell(m,v,D){let P=0,T=0;for(const A of this._decorations.getKeyIterator(v))P=A.options.x??0,T=P+(A.options.width??1),m>=P&&m<T&&(!D||(A.options.layer??"bottom")===D)&&(yield A)}forEachDecorationAtCell(m,v,D,P){this._decorations.forEachByKey(v,(T=>{C=T.options.x??0,S=C+(T.options.width??1),m>=C&&m<S&&(!D||(T.options.layer??"bottom")===D)&&P(T)}))}}a.DecorationService=y;class g extends c.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(m){super(),this.options=m,this.onRenderEmitter=this.register(new d.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new d.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=m.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.InstantiationService=a.ServiceCollection=void 0;const u=l(2585),d=l(8343);class c{constructor(...C){this._entries=new Map;for(const[S,y]of C)this.set(S,y)}set(C,S){const y=this._entries.get(C);return this._entries.set(C,S),y}forEach(C){for(const[S,y]of this._entries.entries())C(S,y)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}a.ServiceCollection=c,a.InstantiationService=class{constructor(){this._services=new c,this._services.set(u.IInstantiationService,this)}setService(b,C){this._services.set(b,C)}getService(b){return this._services.get(b)}createInstance(b,...C){const S=(0,d.getServiceDependencies)(b).sort(((_,m)=>_.index-m.index)),y=[];for(const _ of S){const m=this._services.get(_.id);if(!m)throw new Error(`[createInstance] ${b.name} depends on UNKNOWN service ${_.id}.`);y.push(m)}const g=S.length>0?S[0].index:C.length;if(C.length!==g)throw new Error(`[createInstance] First service dependency of ${b.name} at position ${g+1} conflicts with ${C.length} static arguments`);return new b(...C,...y)}}},7866:function(w,a,l){var u=this&&this.__decorate||function(g,_,m,v){var D,P=arguments.length,T=P<3?_:v===null?v=Object.getOwnPropertyDescriptor(_,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(g,_,m,v);else for(var A=g.length-1;A>=0;A--)(D=g[A])&&(T=(P<3?D(T):P>3?D(_,m,T):D(_,m))||T);return P>3&&T&&Object.defineProperty(_,m,T),T},d=this&&this.__param||function(g,_){return function(m,v){_(m,v,g)}};Object.defineProperty(a,"__esModule",{value:!0}),a.traceCall=a.setTraceLogger=a.LogService=void 0;const c=l(844),b=l(2585),C={trace:b.LogLevelEnum.TRACE,debug:b.LogLevelEnum.DEBUG,info:b.LogLevelEnum.INFO,warn:b.LogLevelEnum.WARN,error:b.LogLevelEnum.ERROR,off:b.LogLevelEnum.OFF};let S,y=a.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=b.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),S=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let _=0;_<g.length;_++)typeof g[_]=="function"&&(g[_]=g[_]())}_log(g,_,m){this._evalLazyOptionalParams(m),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...m)}trace(g,..._){var m;this._logLevel<=b.LogLevelEnum.TRACE&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.trace.bind(this._optionsService.options.logger))??console.log,g,_)}debug(g,..._){var m;this._logLevel<=b.LogLevelEnum.DEBUG&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.debug.bind(this._optionsService.options.logger))??console.log,g,_)}info(g,..._){var m;this._logLevel<=b.LogLevelEnum.INFO&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.info.bind(this._optionsService.options.logger))??console.info,g,_)}warn(g,..._){var m;this._logLevel<=b.LogLevelEnum.WARN&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.warn.bind(this._optionsService.options.logger))??console.warn,g,_)}error(g,..._){var m;this._logLevel<=b.LogLevelEnum.ERROR&&this._log(((m=this._optionsService.options.logger)==null?void 0:m.error.bind(this._optionsService.options.logger))??console.error,g,_)}};a.LogService=y=u([d(0,b.IOptionsService)],y),a.setTraceLogger=function(g){S=g},a.traceCall=function(g,_,m){if(typeof m.value!="function")throw new Error("not supported");const v=m.value;m.value=function(...D){if(S.logLevel!==b.LogLevelEnum.TRACE)return v.apply(this,D);S.trace(`GlyphRenderer#${v.name}(${D.map((T=>JSON.stringify(T))).join(", ")})`);const P=v.apply(this,D);return S.trace(`GlyphRenderer#${v.name} return`,P),P}}},7302:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.OptionsService=a.DEFAULT_OPTIONS=void 0;const u=l(8460),d=l(844),c=l(6114);a.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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const b=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends d.Disposable{constructor(y){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...a.DEFAULT_OPTIONS};for(const _ in y)if(_ in g)try{const m=y[_];g[_]=this._sanitizeAndValidateOption(_,m)}catch(m){console.error(m)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,d.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(y,g){return this.onOptionChange((_=>{_===y&&g(this.rawOptions[y])}))}onMultipleOptionChange(y,g){return this.onOptionChange((_=>{y.indexOf(_)!==-1&&g()}))}_setupOptions(){const y=_=>{if(!(_ in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},g=(_,m)=>{if(!(_ in a.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);m=this._sanitizeAndValidateOption(_,m),this.rawOptions[_]!==m&&(this.rawOptions[_]=m,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const m={get:y.bind(this,_),set:g.bind(this,_)};Object.defineProperty(this.options,_,m)}}_sanitizeAndValidateOption(y,g){switch(y){case"cursorStyle":if(g||(g=a.DEFAULT_OPTIONS[y]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${y}`);break;case"wordSeparator":g||(g=a.DEFAULT_OPTIONS[y]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=b.includes(g)?g:a.DEFAULT_OPTIONS[y];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${y} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${y} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${y} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${y} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}a.OptionsService=C},2660:function(w,a,l){var u=this&&this.__decorate||function(C,S,y,g){var _,m=arguments.length,v=m<3?S:g===null?g=Object.getOwnPropertyDescriptor(S,y):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(C,S,y,g);else for(var D=C.length-1;D>=0;D--)(_=C[D])&&(v=(m<3?_(v):m>3?_(S,y,v):_(S,y))||v);return m>3&&v&&Object.defineProperty(S,y,v),v},d=this&&this.__param||function(C,S){return function(y,g){S(y,g,C)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkService=void 0;const c=l(2585);let b=a.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const S=this._bufferService.buffer;if(C.id===void 0){const D=S.addMarker(S.ybase+S.y),P={data:C,id:this._nextId++,lines:[D]};return D.onDispose((()=>this._removeMarkerFromLink(P,D))),this._dataByLinkId.set(P.id,P),P.id}const y=C,g=this._getEntryIdKey(y),_=this._entriesWithId.get(g);if(_)return this.addLineToLink(_.id,S.ybase+S.y),_.id;const m=S.addMarker(S.ybase+S.y),v={id:this._nextId++,key:this._getEntryIdKey(y),data:y,lines:[m]};return m.onDispose((()=>this._removeMarkerFromLink(v,m))),this._entriesWithId.set(v.key,v),this._dataByLinkId.set(v.id,v),v.id}addLineToLink(C,S){const y=this._dataByLinkId.get(C);if(y&&y.lines.every((g=>g.line!==S))){const g=this._bufferService.buffer.addMarker(S);y.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(y,g)))}}getLinkData(C){var S;return(S=this._dataByLinkId.get(C))==null?void 0:S.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,S){const y=C.lines.indexOf(S);y!==-1&&(C.lines.splice(y,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};a.OscLinkService=b=u([d(0,c.IBufferService)],b)},8343:(w,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createDecorator=a.getServiceDependencies=a.serviceRegistry=void 0;const l="di$target",u="di$dependencies";a.serviceRegistry=new Map,a.getServiceDependencies=function(d){return d[u]||[]},a.createDecorator=function(d){if(a.serviceRegistry.has(d))return a.serviceRegistry.get(d);const c=function(b,C,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(y,g,_){g[l]===g?g[u].push({id:y,index:_}):(g[u]=[{id:y,index:_}],g[l]=g)})(c,b,S)};return c.toString=()=>d,a.serviceRegistry.set(d,c),c}},2585:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.IDecorationService=a.IUnicodeService=a.IOscLinkService=a.IOptionsService=a.ILogService=a.LogLevelEnum=a.IInstantiationService=a.ICharsetService=a.ICoreService=a.ICoreMouseService=a.IBufferService=void 0;const u=l(8343);var d;a.IBufferService=(0,u.createDecorator)("BufferService"),a.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),a.ICoreService=(0,u.createDecorator)("CoreService"),a.ICharsetService=(0,u.createDecorator)("CharsetService"),a.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(d||(a.LogLevelEnum=d={})),a.ILogService=(0,u.createDecorator)("LogService"),a.IOptionsService=(0,u.createDecorator)("OptionsService"),a.IOscLinkService=(0,u.createDecorator)("OscLinkService"),a.IUnicodeService=(0,u.createDecorator)("UnicodeService"),a.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(w,a,l)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.UnicodeService=void 0;const u=l(8460),d=l(225);class c{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,S,y=!1){return(16777215&C)<<3|(3&S)<<1|(y?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const C=new d.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let S=0,y=0;const g=C.length;for(let _=0;_<g;++_){let m=C.charCodeAt(_);if(55296<=m&&m<=56319){if(++_>=g)return S+this.wcwidth(m);const P=C.charCodeAt(_);56320<=P&&P<=57343?m=1024*(m-55296)+P-56320+65536:S+=this.wcwidth(P)}const v=this.charProperties(m,y);let D=c.extractWidth(v);c.extractShouldJoin(v)&&(D-=c.extractWidth(y)),S+=D,y=v}return S}charProperties(C,S){return this._activeProvider.charProperties(C,S)}}a.UnicodeService=c}},n={};function o(w){var a=n[w];if(a!==void 0)return a.exports;var l=n[w]={exports:{}};return t[w].call(l.exports,l,l.exports,o),l.exports}var h={};return(()=>{var w=h;Object.defineProperty(w,"__esModule",{value:!0}),w.Terminal=void 0;const a=o(9042),l=o(3236),u=o(844),d=o(5741),c=o(8285),b=o(7975),C=o(7090),S=["cols","rows"];class y extends u.Disposable{constructor(_){super(),this._core=this.register(new l.Terminal(_)),this._addonManager=this.register(new d.AddonManager),this._publicOptions={...this._core.options};const m=D=>this._core.options[D],v=(D,P)=>{this._checkReadonlyOptions(D),this._core.options[D]=P};for(const D in this._core.options){const P={get:m.bind(this,D),set:v.bind(this,D)};Object.defineProperty(this._publicOptions,D,P)}}_checkReadonlyOptions(_){if(S.includes(_))throw new Error(`Option "${_}" 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 b.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.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 c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=this._core.coreService.decPrivateModes;let m="none";switch(this._core.coreMouseService.activeProtocol){case"X10":m="x10";break;case"VT200":m="vt200";break;case"DRAG":m="drag";break;case"ANY":m="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:m,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const m in _)this._publicOptions[m]=_[m]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,m=!0){this._core.input(_,m)}resize(_,m){this._verifyIntegers(_,m),this._core.resize(_,m)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,m,v){this._verifyIntegers(_,m,v),this._core.select(_,m,v)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,m){this._verifyIntegers(_,m),this._core.selectLines(_,m)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,m){this._core.write(_,m)}writeln(_,m){this._core.write(_),this._core.write(`\r
68
+ `,m)}paste(_){this._core.paste(_)}refresh(_,m){this._verifyIntegers(_,m),this._core.refresh(_,m)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return a}_verifyIntegers(..._){for(const m of _)if(m===1/0||isNaN(m)||m%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const m of _)if(m&&(m===1/0||isNaN(m)||m%1!=0||m<0))throw new Error("This API only accepts positive integers")}}w.Terminal=y})(),h})()))})(Pl)),Pl.exports}var n0=s0(),Tl={exports:{}},Lu;function r0(){return Lu||(Lu=1,(function(p,e){(function(t,n){p.exports=n()})(self,(()=>(()=>{var t={};return(()=>{var n=t;Object.defineProperty(n,"__esModule",{value:!0}),n.FitAddon=void 0,n.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const h=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(h._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,h=o._renderService.dimensions;if(h.css.cell.width===0||h.css.cell.height===0)return;const w=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,a=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(a.getPropertyValue("height")),u=Math.max(0,parseInt(a.getPropertyValue("width"))),d=window.getComputedStyle(this._terminal.element),c=l-(parseInt(d.getPropertyValue("padding-top"))+parseInt(d.getPropertyValue("padding-bottom"))),b=u-(parseInt(d.getPropertyValue("padding-right"))+parseInt(d.getPropertyValue("padding-left")))-w;return{cols:Math.max(2,Math.floor(b/h.css.cell.width)),rows:Math.max(1,Math.floor(c/h.css.cell.height))}}}})(),t})()))})(Tl)),Tl.exports}var o0=r0();/**
69
69
  * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
70
70
  * @license MIT
71
71
  *
@@ -76,6 +76,6 @@ WARNING: This link could potentially be dangerous`)){const _=window.open();if(_)
76
76
  * Fabrice Bellard's javascript vt100 for jslinux:
77
77
  * http://bellard.org/jslinux/
78
78
  * Copyright (c) 2011 Fabrice Bellard
79
- */var o0=class{constructor(p,e,t,n={}){this._terminal=p,this._regex=e,this._handler=t,this._options=n}provideLinks(p,e){let t=l0.computeLink(p,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(p){return p.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:o}=e;this._options.hover(t,n,o)}},e))}};function a0(p){try{let e=new URL(p),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return p.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}var l0=class Po{static computeLink(e,t,n,o){let h=new RegExp(t.source,(t.flags||"")+"g"),[w,a]=Po._getWindowedLineStrings(e-1,n),l=w.join(""),u,d=[];for(;u=h.exec(l);){let c=u[0];if(!a0(c))continue;let[b,C]=Po._mapStrIdx(n,a,0,u.index),[S,y]=Po._mapStrIdx(n,b,C,c.length);if(b===-1||C===-1||S===-1||y===-1)continue;let g={start:{x:C+1,y:b+1},end:{x:y,y:S+1}};d.push({range:g,text:c,activate:o})}return d}static _getWindowedLineStrings(e,t){let n,o=e,h=e,w=0,a="",l=[];if(n=t.buffer.active.getLine(e)){let u=n.translateToString(!0);if(n.isWrapped&&u[0]!==" "){for(w=0;(n=t.buffer.active.getLine(--o))&&w<2048&&(a=n.translateToString(!0),w+=a.length,l.push(a),!(!n.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(u),w=0;(n=t.buffer.active.getLine(++h))&&n.isWrapped&&w<2048&&(a=n.translateToString(!0),w+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,o]}static _mapStrIdx(e,t,n,o){let h=e.buffer.active,w=h.getNullCell(),a=n;for(;o;){let l=h.getLine(t);if(!l)return[-1,-1];for(let u=a;u<l.length;++u){l.getCell(u,w);let d=w.getChars();if(w.getWidth()&&(o-=d.length||1,u===l.length-1&&d==="")){let c=h.getLine(t+1);c&&c.isWrapped&&(c.getCell(0,w),w.getWidth()===2&&(o+=1))}if(o<0)return[t,u]}t++,a=0}return[t,a]}},h0=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c0(p,e){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var d0=class{constructor(p=c0,e={}){this._handler=p,this._options=e}activate(p){this._terminal=p;let e=this._options,t=e.urlRegex||h0;this._linkProvider=this._terminal.registerLinkProvider(new o0(this._terminal,t,this._handler,e))}dispose(){var p;(p=this._linkProvider)==null||p.dispose()}};const ph="garage-settings",To=Object.freeze({focusDim:!1,theme:"light",pet:"off",notifyBrowser:!1});function Bp(){try{const p=localStorage.getItem(ph);if(!p)return{...To};const e=JSON.parse(p);return{...To,...e}}catch{return{...To}}}let fn=Bp();const Xl=new Set;function Hp(){for(const p of Xl)p()}typeof window<"u"&&window.addEventListener("storage",p=>{p.key!==null&&p.key!==ph||(fn=Bp(),Hp())});function u0(p){return Xl.add(p),()=>Xl.delete(p)}function p0(){return fn}function f0(p){const e=typeof p=="function"?p(fn):p;fn={...fn,...e};try{localStorage.setItem(ph,JSON.stringify(fn))}catch{}Hp()}function mn(){return[Z.useSyncExternalStore(u0,p0,()=>To),f0]}const Ru=[{value:"light",label:"light",description:"the default — white ground, ink text"},{value:"dark",label:"dark",description:"neutral zinc dark"},{value:"system",label:"system",description:"follow the OS — light ⇄ dark"}],Mu={garage:"dark","claude-dark":"dark","claude-light":"light"};function Al(p){return p==="light"||p==="dark"?p:p in Mu?Mu[p]:p==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fh(p){const[e,t]=Z.useState(()=>Al(p));return Z.useEffect(()=>{if(t(Al(p)),p!=="system")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>t(Al("system"));return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[p]),e}function m0(){const[p]=mn(),e=fh(p.theme);return Z.useEffect(()=>{document.documentElement.dataset.theme=e},[e]),e}const g0='"Google Sans Code", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace';function Ou(p){const e=[];for(const[t,n]of Object.entries(p))e[Number(t)-16]=n;return e}const Gu={light:{background:"#ffffff",foreground:"#27272a",cursor:"#27272a",cursorAccent:"#ffffff",selectionBackground:"#e4e4e7",black:"#27272a",red:"#b91c1c",green:"#15803d",yellow:"#a16207",blue:"#1d4ed8",magenta:"#7e22ce",cyan:"#0e7490",white:"#52525b",brightBlack:"#71717a",brightRed:"#991b1b",brightGreen:"#166534",brightYellow:"#854d0e",brightBlue:"#1e40af",brightMagenta:"#6b21a8",brightCyan:"#155e75",brightWhite:"#18181b",extendedAnsi:Ou({22:"#dcfce7",28:"#bbf7d0",194:"#dcfce7",52:"#fee2e2",88:"#fecaca",224:"#fee2e2"})},dark:{background:"#09090b",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#09090b",selectionBackground:"#27272a",black:"#131316",red:"#f87171",green:"#4ade80",yellow:"#f59e0b",blue:"#a1a1aa",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#e4e4e7",brightBlack:"#71717a",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fbbf24",brightBlue:"#d4d4d8",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#fafafa",extendedAnsi:Ou({22:"#14291c",28:"#1a3524",65:"#234a30",52:"#2c1a1a",88:"#3a2222",124:"#4a2a2a"})}};function Nu(p){return Gu[p]??Gu.light}const v0=500,_0=8e3,w0=/(?:\.{1,2}\/|~\/|\/)?[\w.@+-]+(?:\/[\w.@+-]+)+(?::\d+(?::\d+)?)?|[\w@+-]+\.[A-Za-z0-9]{1,8}:\d+(?::\d+)?/g;function b0(p){const e=p.match(/^(.*?):(\d+)(?::\d+)?$/);return e?{file:e[1],line:Number(e[2])}:{file:p,line:1}}function y0({id:p,onConnectionChange:e,reconnectSignal:t=0}){const n=Z.useRef(null),o=Z.useRef(null),h=Z.useRef(e);Z.useEffect(()=>{h.current=e},[e]);const[w]=mn(),a=fh(w.theme),l=Z.useRef(null),u=Z.useRef(a);return Z.useEffect(()=>{u.current=a},[a]),Z.useEffect(()=>{var I;const d=new s0.Terminal({fontFamily:g0,fontSize:13,cursorBlink:!0,theme:Nu(u.current)});l.current=d;const c=new r0.FitAddon;d.loadAddon(c),d.loadAddon(new d0((z,H)=>{(z.metaKey||z.ctrlKey)&&window.open(H,"_blank","noopener")}));let b;const C=async z=>{var F;const{file:H,line:V}=b0(z);try{if(b===void 0&&(b=((F=(await Ao()).find(W=>W.id===p))==null?void 0:F.workspace)??null),!b)return;await ko(b,H.replace(/^~\//,""),V)}catch(q){console.warn(`open-editor link failed: ${q.message}`)}},S=d.registerLinkProvider({provideLinks(z,H){const V=d.buffer.active.getLine(z-1);if(!V)return H(void 0);const F=V.translateToString(!0),q=[];for(const W of F.matchAll(w0))q.push({text:W[0],range:{start:{x:W.index+1,y:z},end:{x:W.index+W[0].length,y:z}},activate(K,ie){(K.metaKey||K.ctrlKey)&&C(ie)}});H(q.length?q:void 0)}});d.open(n.current),c.fit(),(I=document.fonts)!=null&&I.ready&&document.fonts.ready.then(()=>{g||(c.fit(),v())}),d.attachCustomKeyEventHandler(z=>{var H;return z.type==="keydown"&&z.ctrlKey&&z.key==="`"?((H=document.activeElement)==null||H.blur(),!1):z.key==="Enter"&&z.shiftKey&&!z.ctrlKey&&!z.metaKey?(z.type==="keydown"&&y&&y.readyState===WebSocket.OPEN&&y.send(D.encode("\\\r")),!1):!0});let y=null,g=!1,_=0,m=null;const v=()=>{y&&y.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"resize",cols:d.cols,rows:d.rows}))},D=new TextEncoder,P=d.onData(z=>{y&&y.readyState===WebSocket.OPEN&&y.send(D.encode(z))});function T(){if(g)return;const z=location.protocol==="https:"?"wss":"ws";y=new WebSocket(`${z}://${location.host}/term/${encodeURIComponent(p)}`),y.binaryType="arraybuffer",y.onopen=()=>{var H;_=0,(H=h.current)==null||H.call(h,!0),v()},y.onmessage=H=>d.write(new Uint8Array(H.data)),y.onclose=()=>{var H;g||((H=h.current)==null||H.call(h,!1),A())}}function A(){const z=Math.min(_0,v0*2**_);_+=1,clearTimeout(m),m=setTimeout(async()=>{if(!g){try{const H=await Ao();if(g||!H.some(V=>V.id===p))return}catch{}T()}},z)}o.current={reconnectNow(){g||y&&(y.readyState===WebSocket.OPEN||y.readyState===WebSocket.CONNECTING)||(clearTimeout(m),_=0,T())}},T();const E=new ResizeObserver(()=>{c.fit(),v()});return E.observe(n.current),()=>{g=!0,clearTimeout(m),o.current=null,l.current=null,E.disconnect(),P.dispose(),S.dispose(),y&&y.close(),d.dispose()}},[p]),Z.useEffect(()=>{l.current&&(l.current.options.theme=Nu(a))},[a]),Z.useEffect(()=>{var d;t>0&&((d=o.current)==null||d.reconnectNow())},[t]),N.jsx("div",{ref:n,style:{height:"100%",width:"100%"}})}const S0="garage-layout:",Fp="terminal";function mh(p){return`${S0}${p}`}function C0(p){try{const e=localStorage.getItem(mh(p));return e?JSON.parse(e):null}catch{return null}}function x0(p,e){try{localStorage.setItem(mh(p),JSON.stringify(e.toJSON()))}catch{}}function D0(p){try{localStorage.removeItem(mh(p))}catch{}}const E0=1e4,ql=new Map;function k0(p,e,t){ql.set(p,{referencePanel:e,direction:t,at:Date.now()})}function P0(p,e){const t=ql.get(e);return!t||(ql.delete(e),Date.now()-t.at>E0)||!p.getPanel(t.referencePanel)?null:t}function T0(p){let e=null,t=-1;for(const n of p.panels){const o=(n.api.width||0)*(n.api.height||0);o>t&&(t=o,e=n)}return e}function Wp(p,e){const t=Math.ceil(Math.sqrt(e.length));e.forEach((n,o)=>{let h;o>0&&o<t?h={referencePanel:e[o-1],direction:"right"}:o>=t&&(h={referencePanel:e[o-t],direction:"below"}),p.addPanel({id:n,component:Fp,position:h})})}function Vp(p,e){const t=new Set(e);for(const o of[...p.panels])if(!t.has(o.id))try{p.removePanel(o)}catch{}const n=new Set(p.panels.map(o=>o.id));for(const o of e){if(n.has(o))continue;const h=P0(p,o);let w;if(h)w={referencePanel:h.referencePanel,direction:h.direction};else{const a=T0(p);if(a){const l=(a.api.width||0)>=(a.api.height||0);w={referencePanel:a.id,direction:l?"right":"below"}}}p.addPanel({id:o,component:Fp,position:w})}}function zu(p,e,t){const n=C0(e);if(n)try{p.fromJSON(n),Vp(p,t);return}catch{}p.clear(),Wp(p,t)}function A0(p,e,t){D0(e),p.clear(),Wp(p,t)}const I0=300,L0={...Cv,tabGroupIndicator:"none"},R0={...Sv,tabGroupIndicator:"none"};function M0(p){const e=new Set(p.map(n=>n.label));let t=1;for(;e.has(`claude-${t}`);)t++;return`claude-${t}`}const gh=Z.createContext(null);function O0({group:p,focusedSessionId:e,onFocusCell:t,onBlurChrome:n,onSessionsRestored:o,hiddenIds:h,onHideCell:w,columnActive:a,onActivateColumn:l,onAddWorkspace:u,gridActionsRef:d,views:c=[],focusedView:b,viewAssignments:C={},activeViewIds:S,onSelectView:y,onDetachCell:g,onRejoinCell:_,onAssignNewSession:m}){const[v]=mn(),P=fh(v.theme)==="dark"?R0:L0,T=p?b&&b!=="main"?`${p.name}::${b}`:p.name:null,[A,E]=Z.useState(()=>new Set),[I,z]=Z.useState(null),[H,V]=Z.useState(null),[F,q]=Z.useState(!1),W=Z.useRef(null);Z.useEffect(()=>{if(!H)return;const ve=setTimeout(()=>V(null),5e3);return()=>clearTimeout(ve)},[H]),Z.useEffect(()=>{if(!F)return;function ve(Ie){W.current&&!W.current.contains(Ie.target)&&q(!1)}return document.addEventListener("mousedown",ve),()=>document.removeEventListener("mousedown",ve)},[F]);const[K,ie]=Z.useState(null),J=Z.useRef(null);Z.useEffect(()=>()=>clearTimeout(J.current),[]);const L=Z.useCallback((ve,Ie)=>{Ie&&ie({sessionId:ve.id,label:ve.label,worktree:Ie,busy:!1,error:null,discardArmed:!1})},[]);async function B(ve){if(!(!K||K.busy)){ie(Ie=>Ie&&{...Ie,busy:!0,error:null});try{await tg(K.worktree,ve),ie(null),o==null||o()}catch(Ie){ie($e=>$e&&{...$e,busy:!1,error:Ie.message})}}}function R(){if(!(!K||K.busy)){if(!K.discardArmed){ie(ve=>ve&&{...ve,discardArmed:!0}),clearTimeout(J.current),J.current=setTimeout(()=>{ie(ve=>ve&&{...ve,discardArmed:!1})},3e3);return}clearTimeout(J.current),ie(ve=>ve&&{...ve,discardArmed:!1}),B("discard")}}function G(){ie(null),o==null||o()}const X=Z.useRef(null),oe=Z.useRef(null),ae=Z.useRef(null);async function me(ve){E(Ie=>new Set(Ie).add(ve)),z(null);try{await Ol({id:ve}),o==null||o()}catch(Ie){z(Ie.message)}finally{E(Ie=>{const $e=new Set(Ie);return $e.delete(ve),$e})}}const $=Z.useCallback(async(ve,Ie,{worktree:$e=!1}={})=>{if(!p)return;const st=M0(p.sessions),Dt=`garage/${p.name}/${st}`;ve&&k0(Dt,ve,Ie);try{await Ju(p.name,st,$e?{worktree:!0}:{}),m==null||m(p.name,Dt),await(o==null?void 0:o()),t(Dt)}catch(Ne){V(Ne.message)}},[p,o,t,m]),O=Z.useCallback(()=>{const ve=X.current;if(!ve)return;if(ve.hasMaximizedGroup()){ve.exitMaximizedGroup();return}const Ie=e?ve.getPanel(e):null;Ie&&ve.maximizeGroup(Ie)},[e]);Z.useEffect(()=>{if(d)return d.current={toggleMaximize:O,splitFocused:ve=>{e&&$(e,ve)}},()=>{d.current=null}},[d,O,$,e]);const le=Z.useMemo(()=>((p==null?void 0:p.sessions)??[]).filter(ve=>!(h!=null&&h.has(ve.id))&&(!S||S.has(ve.id))),[p,h,S]),se=Z.useMemo(()=>{const ve=new Map;for(const Ie of le)ve.set(Ie.id,Ie);return ve},[le]),ge=Z.useMemo(()=>({sessionsById:se,focusedSessionId:e,restoringIds:A,restoreError:I,columnActive:a,onFocusCell:t,onHideCell:w,onSessionsRestored:o,restoreOne:me,splitFrom:$,onSessionClosed:L,viewAssignments:C,hasMultipleViews:c.length>1,onDetachCell:ve=>g==null?void 0:g(p==null?void 0:p.name,ve),onRejoinCell:ve=>_==null?void 0:_(p==null?void 0:p.name,ve)}),[se,e,A,I,a,t,w,o,$,L,C,c,g,_,p==null?void 0:p.name]),fe=Z.useMemo(()=>le.map(ve=>ve.id),[le]),Me=fe.join(","),We=Z.useCallback(()=>{!oe.current||!X.current||(clearTimeout(ae.current),ae.current=setTimeout(()=>{X.current&&oe.current&&x0(oe.current,X.current)},I0))},[]);function je(ve){const Ie=ve.api;if(X.current=Ie,oe.current=T,zu(Ie,T,fe),e){const $e=Ie.getPanel(e);$e&&$e.api.setActive()}Ie.onDidLayoutChange(We),Ie.onDidActivePanelChange($e=>{$e.origin==="user"&&$e.panel&&t($e.panel.id)})}Z.useEffect(()=>{const ve=X.current;if(!(!ve||!p)&&(oe.current!==T?(ve.hasMaximizedGroup()&&ve.exitMaximizedGroup(),oe.current=T,zu(ve,T,fe)):Vp(ve,fe),e)){const Ie=ve.getPanel(e);Ie&&!Ie.api.isActive&&Ie.api.setActive()}},[T,Me]),Z.useEffect(()=>{const ve=X.current;if(!ve||!e)return;const Ie=ve.getPanel(e);Ie&&(ve.hasMaximizedGroup()&&!Ie.group.api.isMaximized()&&ve.exitMaximizedGroup(),Ie.api.isActive||Ie.api.setActive())},[e]),Z.useEffect(()=>()=>clearTimeout(ae.current),[]);const ot=Z.useCallback(()=>{const ve=X.current;!ve||!T||(ve.hasMaximizedGroup()&&ve.exitMaximizedGroup(),A0(ve,T,fe))},[T,fe]),Ae=K&&N.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-2 rounded-lg border border-garage-line bg-garage-bg px-3 py-2 text-xs text-garage-ink shadow-sm",children:[N.jsx("span",{className:"text-garage-dim",children:"worktree for"}),N.jsx("span",{className:"font-semibold text-garage-ink",children:K.label}),N.jsx("span",{className:"text-garage-line",children:":"}),N.jsx("button",{type:"button",onClick:()=>B("merge"),disabled:K.busy,className:"rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"merge"}),N.jsx("button",{type:"button",onClick:R,disabled:K.busy,className:`rounded-md px-2 py-1 text-xs disabled:opacity-40 ${K.discardArmed?"text-garage-red":"text-garage-dim hover:bg-garage-sel hover:text-garage-red"}`,children:K.discardArmed?"discard branch?":"discard"}),N.jsx("button",{type:"button",onClick:G,disabled:K.busy,className:"rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"keep"}),K.discardArmed&&!K.error&&N.jsxs("span",{className:"max-w-[16rem] truncate text-garage-red",children:["click again — deletes unmerged work on ",K.worktree.branch]}),K.error&&N.jsxs("span",{className:"max-w-[14rem] truncate text-garage-red",title:K.error,children:["· ",K.error]})]});return p?p.sessions.length===0?N.jsxs(N.Fragment,{children:[N.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg text-xs text-garage-dim",children:N.jsxs("span",{children:["no sessions in ",p.name," yet — spawn one with the"," ",N.jsx("span",{className:"font-mono text-garage-ink",children:"+"})," next to its name in the rail"]})}),Ae]}):le.length===0?N.jsxs(N.Fragment,{children:[N.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg text-xs text-garage-dim",children:"every session in this workspace is hidden — click one in the rail to bring it back"}),Ae]}):N.jsxs("div",{onMouseDown:n,onMouseDownCapture:l,className:"flex min-h-0 flex-col overflow-hidden bg-garage-bg",children:[N.jsxs("div",{className:"flex h-10 flex-none items-center gap-2 border-b border-garage-line bg-garage-panel px-3 text-[13px]",children:[N.jsx("span",{className:"font-medium text-garage-ink",children:p.name}),N.jsxs("div",{ref:W,className:"relative flex items-center gap-1",children:[N.jsxs("button",{type:"button",onClick:()=>q(ve=>!ve),title:`new session in ${p.name}`,"aria-haspopup":"menu","aria-expanded":F,className:"rounded-md px-2 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:["+ ",N.jsx("span",{className:"text-xs text-garage-faint",children:"▾"})]}),F&&N.jsxs("div",{role:"menu",className:"absolute left-0 top-full z-20 mt-1 w-64 rounded-lg border border-garage-line bg-garage-bg p-1 shadow-sm",children:[N.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{q(!1),$(e,"right")},className:"flex w-full flex-col rounded-md px-3 py-2 text-left hover:bg-garage-sel",children:[N.jsx("span",{className:"text-[13px] text-garage-ink",children:"new session"}),N.jsx("span",{className:"text-xs text-garage-faint",children:"spawns beside the focused cell — same directory"})]}),N.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{q(!1),$(e,"right",{worktree:!0})},className:"flex w-full flex-col rounded-md px-3 py-2 text-left hover:bg-garage-sel",children:[N.jsx("span",{className:"text-[13px] text-garage-ink",children:"new worktree session"}),N.jsx("span",{className:"text-xs text-garage-faint",children:"isolated git worktree on branch garage/<label>"})]})]}),N.jsx("button",{type:"button",onClick:()=>e&&$(e,"right"),disabled:!e,title:"split focused cell right (\\)",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"◫"}),N.jsx("button",{type:"button",onClick:()=>e&&$(e,"below"),disabled:!e,title:"split focused cell down",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"⬒"}),N.jsx("button",{type:"button",onClick:O,disabled:!e,title:"maximize focused cell — toggle (m)",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"⛶"})]}),H&&N.jsx("span",{className:"max-w-[18rem] truncate text-[11px] text-garage-red",title:H,children:H}),N.jsx("button",{type:"button",onClick:ot,title:"Discard the custom layout and restore the default grid",className:"ml-auto rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"reset layout"})]}),c.length>1&&N.jsx("div",{className:"flex flex-none items-center gap-1 border-b border-garage-line bg-garage-panel px-3 py-1.5 text-xs",children:c.map(ve=>{const Ie=ve.name===b;return N.jsxs("button",{type:"button",onClick:()=>y==null?void 0:y(p.name,ve.name),title:`show view "${ve.name}" (${ve.sessions.length} session${ve.sessions.length===1?"":"s"})`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 ${Ie?"bg-garage-sel text-garage-ink":"text-garage-dim hover:bg-garage-sel"}`,children:[ve.needsCount>0&&N.jsx("span",{className:"text-garage-amber",children:"●"}),ve.name,N.jsxs("span",{className:"text-garage-faint",children:[ve.sessions.length,"×"]})]},ve.name)})}),N.jsx("div",{className:"min-h-0 flex-1 p-2",children:N.jsx(gh.Provider,{value:ge,children:N.jsx(Np,{className:"garage-dock",theme:P,components:{terminal:N0},defaultTabComponent:G0,singleTabMode:"fullwidth",onReady:je})})}),Ae]}):N.jsxs(N.Fragment,{children:[N.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg p-6",children:N.jsxs("div",{className:"max-w-md space-y-4 rounded-xl border border-garage-line bg-garage-panel px-8 py-7",children:[N.jsx("h2",{className:"text-[15px] font-semibold text-garage-ink",children:"your pit wall is empty"}),N.jsx("p",{className:"text-[13px] text-garage-dim",children:"claude-garage runs several Claude Code sessions side by side and tells you the moment one needs you."}),N.jsxs("ol",{className:"list-decimal space-y-1.5 pl-5 text-[13px] text-garage-dim",children:[N.jsxs("li",{children:[N.jsx("span",{className:"font-semibold text-garage-ink",children:"add a workspace"})," — point it at a project folder"]}),N.jsxs("li",{children:[N.jsx("span",{className:"font-semibold text-garage-ink",children:"spawn sessions"})," — the"," ",N.jsx("span",{className:"font-mono text-garage-ink",children:"+"})," next to the workspace name in the rail"]}),N.jsxs("li",{children:[N.jsx("span",{className:"font-semibold text-garage-ink",children:"triage"})," — amber"," ",N.jsx("span",{className:"text-garage-amber",children:"●"})," means Claude is waiting; press"," ",N.jsx("span",{className:"font-mono text-garage-ink",children:"a"})," to jump there"]})]}),N.jsx("button",{type:"button",onClick:()=>u==null?void 0:u(),className:"rounded-md bg-garage-ink px-4 py-2 text-[13px] font-medium text-garage-bg hover:opacity-90",children:"+ add your first workspace"}),N.jsxs("p",{className:"text-[11px] text-garage-faint",children:["press ",N.jsx("span",{className:"font-mono text-garage-ink",children:"?"})," anytime for keybindings & the status legend"]})]})}),Ae]})}function G0({api:p}){var g;const e=Z.useContext(gh),t=p.id,n=e.sessionsById.get(t),[o,h]=Z.useState(!1),[w,a]=Z.useState(!1),[l,u]=Z.useState(null),d=Z.useRef(null),c=Z.useRef(null);if(Z.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(c.current)},[]),qu(),!n)return null;const b=t===e.focusedSessionId,C=n.status!=="restorable",S=n.status==="needs-input";async function y(){var _;if(!o){h(!0),clearTimeout(d.current),d.current=setTimeout(()=>h(!1),3e3);return}clearTimeout(d.current),h(!1),a(!0),u(null);try{const m=await eg(t);m!=null&&m.worktree&&((_=e.onSessionClosed)==null||_.call(e,n,m.worktree)),setTimeout(()=>{var v;return(v=e.onSessionsRestored)==null?void 0:v.call(e)},0)}catch(m){u(m.message),clearTimeout(c.current),c.current=setTimeout(()=>u(null),4e3)}finally{a(!1)}}return N.jsxs("div",{"data-dim-zone":"",className:`group/cell flex h-9 w-full items-center gap-2 border-b border-garage-line bg-garage-panel px-3 ${S?"bg-garage-amber/5":""} ${S?"dim-exempt":""} ${e.columnActive?"dim-focused":""}`,children:[N.jsx("span",{className:Yu(n.status),title:Ku(n.status),children:Uu(n.status)}),N.jsx("span",{className:`text-[13px] tracking-tight text-garage-ink ${b?"font-semibold":"font-medium"}`,children:n.label}),n.branch&&N.jsxs("span",{className:"max-w-[90px] shrink-0 truncate font-mono text-[11px] text-garage-faint",title:n.branch,children:["⎇ ",n.branch]}),N.jsx("span",{className:`ml-auto font-mono text-xs tabular-nums ${S?"font-semibold text-garage-amber":"text-garage-faint"}`,children:Xu(n.since)}),l&&N.jsx("span",{className:"max-w-[9rem] truncate text-garage-red",title:l,children:l}),N.jsx("span",{className:"text-garage-faint transition-opacity group-hover/cell:opacity-0 group-focus-within/cell:opacity-0","aria-hidden":"true",children:"⋯"}),N.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/cell:opacity-100",children:[C&&N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{var m;_.stopPropagation(),(m=e.splitFrom)==null||m.call(e,t,"right")},title:"split right — new session beside this one",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"◫"}),C&&N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{var m;_.stopPropagation(),(m=e.splitFrom)==null||m.call(e,t,"below")},title:"split down — new session below this one",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"⬒"}),C&&((((g=e.viewAssignments)==null?void 0:g[t])??"main")!=="main"?N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{var m;_.stopPropagation(),(m=e.onRejoinCell)==null||m.call(e,t)},title:"rejoin the main view — back into the group",className:"rounded-md bg-garage-sel p-1 text-garage-ink hover:bg-garage-sel",children:"◱"}):N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{var m;_.stopPropagation(),(m=e.onDetachCell)==null||m.call(e,t)},title:"standalone — move this session to its own view (switch back anytime from the rail or view strip)",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"◲"})),N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{var m;_.stopPropagation(),(m=e.onHideCell)==null||m.call(e,t)},title:"Hide this cell for this page run (rail keeps it — click there to bring it back)",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"–"}),C&&N.jsx("button",{type:"button",onMouseDown:_=>_.stopPropagation(),onClick:_=>{_.stopPropagation(),y()},disabled:w,title:o?"click again to close — kills the tmux session":"close this session — kills the tmux session",className:`rounded-md p-1 disabled:opacity-40 ${o?"text-garage-red":"text-garage-faint hover:bg-garage-sel hover:text-garage-red"}`,children:o?"sure?":"✕"})]})]})}function N0({api:p}){const e=Z.useContext(gh),t=p.id,n=e.sessionsById.get(t),[o,h]=Z.useState(!0),[w,a]=Z.useState(0);if(!n)return null;const l=t===e.focusedSessionId,u=n.status==="restorable",d=e.restoringIds.has(t);return N.jsx("div",{onMouseDown:c=>{c.stopPropagation(),e.onFocusCell(t)},onFocus:()=>e.onFocusCell(t),"data-dim-zone":"","data-session-id":t,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border ${n.status==="needs-input"?"border-garage-amber":l?"cell-border-focused":"border-garage-line"} ${u?"opacity-70":""} ${n.status==="needs-input"?"dim-exempt":""} ${e.columnActive?"dim-focused":""}`,children:N.jsx("div",{className:"relative min-h-0 flex-1 p-1",children:u?N.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-garage-dim",children:[N.jsx("span",{className:"text-2xl",children:"⟳"}),N.jsx("span",{className:"text-xs",children:"no live terminal — session needs to be restored"}),N.jsx("button",{type:"button",onClick:()=>e.restoreOne(t),disabled:d,className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore"}),e.restoreError&&N.jsx("span",{className:"max-w-[80%] text-center text-[11px] text-garage-red",children:e.restoreError})]}):N.jsxs(N.Fragment,{children:[N.jsx(y0,{id:t,onConnectionChange:h,reconnectSignal:w}),!o&&N.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-garage-bg/90 p-3 text-center",children:[N.jsx("span",{className:"text-xs text-garage-red",children:"connection to daemon lost"}),N.jsx("span",{className:"text-[11px] text-garage-dim",children:"the tmux session is still alive — only this view is detached"}),N.jsx("button",{type:"button",onClick:()=>a(c=>c+1),className:"rounded-md bg-garage-ink px-3 py-1 text-xs text-garage-bg hover:opacity-90",children:"reconnect now"})]})]})})})}const Bu="garage.hooksBannerDismissed",z0=6e4,B0=4e3;function H0({sessions:p}){const[e,t]=Z.useState(()=>{try{return localStorage.getItem(Bu)==="1"}catch{return!1}}),[n,o]=Z.useState(!0),[h,w]=Z.useState({state:"idle",error:null,backup:null});if(Z.useEffect(()=>{const d=setTimeout(()=>o(!1),z0);return()=>clearTimeout(d)},[]),Z.useEffect(()=>{if(h.state!=="done")return;const d=setTimeout(()=>l(),B0);return()=>clearTimeout(d)},[h.state]),e||h.state!=="done"&&!n||p.length===0)return null;const a=p.every(d=>d.status==="working"||d.status==="idle");if(h.state==="idle"&&!a)return null;function l(){t(!0);try{localStorage.setItem(Bu,"1")}catch{}}async function u(){w({state:"busy",error:null,backup:null});try{const d=await Jm();w({state:"done",error:null,backup:d.backup??null})}catch(d){w({state:"idle",error:d.message,backup:null})}}return h.state==="done"?N.jsxs("div",{className:"flex flex-none items-center gap-3 bg-garage-sel px-4 py-2 text-xs text-garage-dim",children:[N.jsxs("span",{className:"text-garage-green",children:["✓ hooks installed — needs-input detection is now instant",h.backup&&N.jsx("span",{className:"text-garage-dim",children:" (backup saved next to settings.json)"})]}),N.jsx("button",{onClick:l,className:"ml-auto rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-line hover:text-garage-ink",children:"dismiss ×"})]}):N.jsxs("div",{className:"flex flex-none flex-wrap items-center gap-3 bg-garage-sel px-4 py-2 text-xs text-garage-dim",children:[N.jsx("span",{children:"Hooks make needs-input detection instant (without them, status lags the poller)."}),N.jsx("button",{onClick:u,disabled:h.state==="busy",className:"rounded-md bg-garage-panel px-3 py-1.5 text-[13px] text-garage-ink hover:bg-garage-line disabled:opacity-40",children:h.state==="busy"?"installing…":"install hooks for me"}),N.jsx("a",{href:"/api/hooks/snippet",target:"_blank",rel:"noreferrer",className:"text-garage-dim underline hover:text-garage-ink",children:"view the snippet instead"}),h.error&&N.jsx("span",{className:"max-w-[24rem] truncate text-garage-red",title:h.error,children:h.error}),N.jsx("button",{onClick:l,className:"ml-auto rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-line hover:text-garage-ink",children:"dismiss ×"})]})}function F0({onClose:p,onCreated:e,existingNames:t}){const[n,o]=Z.useState("picking"),[h,w]=Z.useState(""),[a,l]=Z.useState(""),[u,d]=Z.useState(null),[c,b]=Z.useState(!1),C=Z.useRef(!1);Z.useEffect(()=>{if(C.current)return;C.current=!0;let _=!1;return Xm().then(m=>{if(!_){if(m!=null&&m.cancelled){p();return}w(m.dir),l(W0(m.dir,t)),o("confirm")}}).catch(()=>{_||o("manual")}),()=>{_=!0}},[]);function S(_){_.stopPropagation(),_.key==="Escape"&&p()}async function y(_,m){const v=_.trim(),D=m.trim();if(!(!v||!D||c)){b(!0),d(null);try{await Km(v,D),e()}catch(P){d(P.message),b(!1)}}}function g(){d(null),o("manual")}return n==="picking"?N.jsxs("div",{onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-72 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[N.jsx("p",{className:"text-xs text-garage-dim",children:"opening folder picker…"}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("button",{type:"button",onClick:g,className:"rounded-md px-2 py-1 text-xs text-garage-dim underline hover:bg-garage-sel hover:text-garage-ink",children:"type a path instead"}),N.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"})]})]}):n==="confirm"?N.jsxs("form",{onSubmit:_=>{_.preventDefault(),y(a,h)},onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-80 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[N.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["name",N.jsx("input",{autoFocus:!0,value:a,onChange:_=>l(_.target.value),className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),N.jsx("p",{className:"truncate text-xs text-garage-faint",title:h,children:h}),u&&N.jsx("p",{className:"text-xs text-garage-red",children:u}),N.jsxs("div",{className:"flex items-center justify-between",children:[N.jsx("button",{type:"button",onClick:g,className:"rounded-md px-2 py-1 text-xs text-garage-dim underline hover:bg-garage-sel hover:text-garage-ink",children:"type a path instead"}),N.jsxs("div",{className:"flex gap-2",children:[N.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"}),N.jsx("button",{type:"submit",disabled:c||!a.trim()||!h.trim(),className:"rounded-md bg-garage-ink px-3 py-1.5 text-[13px] text-garage-bg hover:opacity-90 disabled:opacity-40",children:"save"})]})]})]}):N.jsxs("form",{onSubmit:_=>{_.preventDefault(),y(a,h)},onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-72 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[N.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["name",N.jsx("input",{autoFocus:!0,value:a,onChange:_=>l(_.target.value),placeholder:"kowboy",className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),N.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["dir",N.jsx("input",{value:h,onChange:_=>w(_.target.value),placeholder:"/Users/me/dev/kowboy",className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),u&&N.jsx("p",{className:"text-xs text-garage-red",children:u}),N.jsxs("div",{className:"flex justify-end gap-2",children:[N.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"}),N.jsx("button",{type:"submit",disabled:c||!a.trim()||!h.trim(),className:"rounded-md bg-garage-ink px-3 py-1.5 text-[13px] text-garage-bg hover:opacity-90 disabled:opacity-40",children:"register"})]})]})}function W0(p,e){const t=e instanceof Set?e:new Set(e??[]);let o=((p??"").split("/").filter(Boolean).pop()??"workspace").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(o||(o="workspace"),!t.has(o))return o;let h=2;for(;t.has(`${o}-${h}`);)h++;return`${o}-${h}`}var Il,Hu;function V0(){if(Hu)return Il;Hu=1,Il=d=>{if(!d)return[];if(typeof d!="string"||d.match(/^\s+$/))return[];const c=d.split(`
80
- `);if(c.length===0)return[];const b=[];let C=null,S=null,y=0,g=0,_=null;const m=G=>{S==null||S.changes.push({type:"normal",normal:!0,ln1:y++,ln2:g++,content:G}),_.oldLines--,_.newLines--},v=G=>{const[X,oe]=t(G)??[];C={chunks:[],deletions:0,additions:0,from:X,to:oe},b.push(C)},D=()=>{(!C||C.chunks.length)&&v()},P=(G,X)=>{D(),C.new=!0,C.newMode=X[1],C.from="/dev/null"},T=(G,X)=>{D(),C.deleted=!0,C.oldMode=X[1],C.to="/dev/null"},A=(G,X)=>{D(),C.oldMode=X[1]},E=(G,X)=>{D(),C.newMode=X[1]},I=(G,X)=>{D(),C.index=G.split(" ").slice(1),X[1]&&(C.oldMode=C.newMode=X[1].trim())},z=G=>{D(),C.from=o(G)},H=G=>{D(),C.to=o(G)},V=G=>+(G||1),F=(G,X)=>{C||v(G);const[oe,ae,me,$]=X.slice(1);y=+oe,g=+me,S={content:G,changes:[],oldStart:+oe,oldLines:V(ae),newStart:+me,newLines:V($)},_={oldLines:V(ae),newLines:V($)},C.chunks.push(S)},q=G=>{S&&(S.changes.push({type:"del",del:!0,ln:y++,content:G}),C.deletions++,_.oldLines--)},W=G=>{S&&(S.changes.push({type:"add",add:!0,ln:g++,content:G}),C.additions++,_.newLines--)},K=G=>{if(!S)return;const[X]=S.changes.slice(-1);S.changes.push({type:X.type,[X.type]:!0,ln1:X.ln1,ln2:X.ln2,ln:X.ln,content:G})},ie=[[/^diff\s/,v],[/^new file mode (\d+)$/,P],[/^deleted file mode (\d+)$/,T],[/^old mode (\d+)$/,A],[/^new mode (\d+)$/,E],[/^index\s[\da-zA-Z]+\.\.[\da-zA-Z]+(\s(\d+))?$/,I],[/^---\s/,z],[/^\+\+\+\s/,H],[/^@@\s+-(\d+),?(\d+)?\s+\+(\d+),?(\d+)?\s@@/,F],[/^\$/,K]],J=[[/^\$/,K],[/^-/,q],[/^\+/,W],[/^\s*/,m]],L=G=>{for(const[X,oe]of J){const ae=G.match(X);if(ae){oe(G,ae);break}}_.oldLines===0&&_.newLines===0&&(_=null)},B=G=>{for(const[X,oe]of ie){const ae=G.match(X);if(ae){oe(G,ae);break}}},R=G=>{_?L(G):B(G)};for(const G of c)R(G);return b};const p=/(a|i|w|c|o|1|2)\/.*(?=["']? ["']?(b|i|w|c|o|1|2)\/)|(b|i|w|c|o|1|2)\/.*$/g,e=/^(a|b|i|w|c|o|1|2)\//,t=d=>{var c;return(c=d==null?void 0:d.match(p))==null?void 0:c.map(b=>b.replace(e,"").replace(/("|')$/,""))},n=/^\\?['"]|\\?['"]$/g,o=d=>{let c=h(d,"-+").trim();return c=a(c),c.replace(n,"").replace(e,"")},h=(d,c)=>{d=u(d);const b=l(c);return d.replace(new RegExp(`^${b}+`),"")},w=/\t.*|\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d(.\d+)?\s(\+|-)\d\d\d\d/,a=d=>{const c=w.exec(d);return c&&(d=d.substring(0,c.index).trim()),d},l=d=>d instanceof RegExp?d.source:`[${u(d).replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}]`,u=d=>`${d??""}`;return Il}var j0=V0();const jp=eh(j0);function $0(p){if(!p)return[];let e;try{e=jp(p)}catch{return[]}const t=e[0];return!t||!t.chunks?[]:t.chunks.map(n=>({header:n.content,lines:n.changes.map(o=>({type:o.type,content:o.content,lineNumber:U0(o)}))}))}function U0(p){return p.type==="add"||p.type==="del"?p.ln:p.ln2??p.ln1}function K0(p){var n,o;if(!p)return 1;let e;try{e=jp(p)}catch{return 1}const t=(o=(n=e[0])==null?void 0:n.chunks)==null?void 0:o[0];return t&&(t.newStart||t.oldStart)||1}function Y0({file:p}){if(!p)return null;if(p.binary)return N.jsx("div",{className:"rounded-lg border border-garage-line px-3 py-2 text-xs text-garage-dim",children:"binary file"});const e=$0(p.diff);return N.jsxs("div",{className:"overflow-hidden rounded-lg border border-garage-line font-mono text-xs leading-relaxed",children:[p.truncated&&N.jsx("div",{className:"border-b border-garage-line bg-garage-sel px-3 py-1.5 text-garage-dim",children:'diff truncated — press "o" to open the full file in your editor'}),e.length===0&&N.jsx("div",{className:"px-3 py-2 text-garage-dim",children:"no diff content"}),e.map((t,n)=>N.jsxs("div",{children:[N.jsx("div",{className:"bg-garage-sel px-3 py-1.5 text-[11px] text-garage-dim",children:t.header}),t.lines.map((o,h)=>N.jsxs("div",{className:`flex px-3 ${X0(o.type)}`,children:[N.jsx("span",{className:"mr-3 w-8 shrink-0 select-none text-right tabular-nums text-garage-faint",children:o.lineNumber??""}),N.jsx("span",{className:"whitespace-pre-wrap break-all",children:o.content})]},h))]},n))]})}function X0(p){return p==="add"?"bg-garage-green/10 text-garage-ink":p==="del"?"bg-garage-red/10 text-garage-ink":"text-garage-dim"}function $p({files:p,selectedPath:e,emptyMessage:t="no changes"}){const n=Z.useRef({});return Z.useEffect(()=>{const o=n.current[e];o&&o.scrollIntoView({block:"nearest"})},[e]),p.length===0?N.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:t}):N.jsx("div",{children:p.map(o=>N.jsxs("div",{ref:h=>{n.current[o.path]=h},children:[N.jsx("div",{className:`sticky top-0 z-10 truncate border-b border-t border-garage-line bg-garage-panel px-3 py-1.5 font-mono text-xs ${o.path===e?"text-garage-ink":"text-garage-dim"}`,children:o.renamedFrom||o.oldPath?`${o.oldPath??o.renamedFrom} → ${o.path}`:o.path}),N.jsx(Y0,{file:o})]},o.path))})}const Up="garage-pane-sizes",Ll={railW:240,paneW:360,paneSplit:.4};function vh(){try{const p=localStorage.getItem(Up);if(!p)return{...Ll};const e=JSON.parse(p);return{...Ll,...e}}catch{return{...Ll}}}function Mo(p){try{const e={...vh(),...p};localStorage.setItem(Up,JSON.stringify(e))}catch{}}function Jl(p,{onMove:e,onEnd:t}={}){p.preventDefault();const n=p.clientX,o=p.clientY,h=document.body.style.userSelect;document.body.style.userSelect="none";function w(l){const u=l.clientX-n,d=l.clientY-o;e==null||e(u,d)}function a(){window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",a),document.body.style.userSelect=h,t==null||t()}window.addEventListener("mousemove",w),window.addEventListener("mouseup",a)}const q0={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"?"};function J0({workspace:p,branch:e,files:t,truncated:n,loading:o,error:h,collapsed:w,onToggleCollapse:a,emphasis:l,selectedPath:u,onSelectFile:d,onRefresh:c,onBlurChrome:b,columnActive:C,onActivateColumn:S,onEnterReview:y}){const[g,_]=Z.useState(()=>vh().paneSplit),m=Z.useRef(g);Z.useEffect(()=>{m.current=g},[g]);const v=Z.useRef(!0);Z.useEffect(()=>{if(v.current){v.current=!1;return}const E=l==="diff"?.25:.65;_(E),Mo({paneSplit:E})},[l]);const D=Z.useRef(null),[P,T]=Z.useState(!1),A=Z.useCallback(E=>{var V;E.stopPropagation();const I=((V=D.current)==null?void 0:V.getBoundingClientRect().height)||1,z=m.current;T(!0);let H=z;Jl(E,{onMove:(F,q)=>{H=Math.min(.85,Math.max(.15,z+q/I)),_(H)},onEnd:()=>{T(!1),Mo({paneSplit:H})}})},[]);return w?N.jsxs("button",{type:"button",onClick:a,onMouseDownCapture:S,title:"expand changes pane","aria-label":"expand changes pane",className:"flex h-full w-full flex-col items-center gap-2 border-l border-garage-line bg-garage-panel py-2 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:[N.jsx("span",{"aria-hidden":"true",children:"«"}),N.jsx("span",{className:"[writing-mode:vertical-rl]",children:"changes"})]}):N.jsxs("div",{onMouseDown:b,onMouseDownCapture:S,"data-dim-zone":!0,className:`flex h-full min-h-0 flex-col border-l border-garage-line bg-garage-panel ${C?"dim-focused":""}`,children:[N.jsxs("div",{className:"flex h-10 flex-none items-center gap-2 border-b border-garage-line px-3",children:[N.jsx("span",{className:"truncate text-[13px] font-medium text-garage-ink",children:p??"—"}),e&&N.jsxs("span",{className:"shrink-0 truncate font-mono text-[11px] text-garage-faint",title:e,children:["⎇ ",e]}),N.jsx("button",{type:"button",onClick:y,title:"full-screen review mode (r)",className:"ml-auto rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"review"}),N.jsx("button",{type:"button",onClick:c,title:"refresh diff",className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"↻"}),N.jsx("button",{type:"button",onClick:a,title:"collapse changes pane",className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"»"})]}),h&&N.jsx("div",{className:"flex-none border-b border-garage-line px-3 py-1 text-[11px] text-garage-red",children:h}),n&&N.jsx("div",{className:"flex-none border-b border-garage-line bg-garage-sel px-3 py-1 text-[11px] text-garage-dim",children:"response truncated — some files show stats only"}),N.jsxs("div",{ref:D,className:"flex min-h-0 flex-1 flex-col",children:[N.jsxs("div",{className:"min-h-0 overflow-y-auto",style:{flexBasis:`${g*100}%`,flexGrow:0,flexShrink:0},children:[o&&t.length===0&&N.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"loading…"}),!o&&t.length===0&&N.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no changes"}),t.map(E=>N.jsxs("button",{type:"button",onClick:()=>d(E.path),className:`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-2 rounded-md px-3 py-1.5 text-left text-[13px] ${E.path===u?"bg-garage-sel":"hover:bg-garage-sel"}`,children:[N.jsx("span",{className:"font-mono text-[11px] text-garage-faint",children:q0[E.changeType]??"?"}),N.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-garage-dim",children:E.path}),E.binary&&N.jsx("span",{className:"shrink-0 text-xs text-garage-faint",children:"bin"}),E.truncated&&N.jsx("span",{className:"shrink-0 text-xs text-garage-dim",children:"trunc"}),!E.binary&&N.jsxs("span",{className:"shrink-0 font-mono text-xs tabular-nums",children:[N.jsxs("span",{className:"text-garage-green",children:["+",E.additions??0]})," ",N.jsxs("span",{className:"text-garage-red",children:["−",E.deletions??0]})]})]},E.path))]}),N.jsx("div",{role:"separator","aria-orientation":"horizontal",className:`row-divider ${P?"is-dragging":""}`,onMouseDown:A}),N.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:N.jsx($p,{files:t,selectedPath:u})})]})]})}const Z0="garage-viewed:";function Zl(p){let e=5381;const t=p??"";for(let n=0;n<t.length;n++)e=e*33^t.charCodeAt(n);return(e>>>0).toString(36)}function Kp(p){return`${Z0}${p}`}function _h(p){if(!p)return{};try{const e=localStorage.getItem(Kp(p));return e?JSON.parse(e):{}}catch{return{}}}function Yp(p,e){try{localStorage.setItem(Kp(p),JSON.stringify(e))}catch{}}function Q0(p,e,t){if(!p)return{};const n=_h(p);return n[e]=t,Yp(p,n),n}function ew(p,e){if(!p)return;const t=_h(p),n=new Set(e);let o=!1;for(const h of Object.keys(t))n.has(h)||(delete t[h],o=!0);o&&Yp(p,t)}function Fu(p,e){return!e||!p?!1:p[e.path]===Zl(e.diff??"")}function tw({workspace:p,files:e,truncated:t,selectedPath:n,onSelectFile:o,viewedMap:h,onOpenRoot:w}){const a=e.filter(l=>Fu(h,l)).length;return N.jsxs("div",{className:"fixed inset-0 z-50 flex bg-garage-bg font-mono text-sm text-garage-ink",children:[N.jsxs("div",{className:"flex w-[280px] flex-none flex-col border-r border-garage-line bg-garage-panel",children:[N.jsxs("div",{className:"flex h-12 flex-none items-center gap-2 border-b border-garage-line px-4",children:[N.jsx("span",{className:"truncate text-[15px] font-semibold text-garage-ink",children:p}),N.jsx("button",{type:"button",onClick:()=>w(p),title:"open workspace root in editor",className:"ml-auto shrink-0 rounded-md px-2 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"⧉"})]}),N.jsxs("div",{className:"flex-none border-b border-garage-line px-3 py-1.5 text-xs text-garage-dim",children:[a,"/",e.length," viewed",t&&N.jsx("span",{className:"ml-2 text-garage-dim",children:"(response truncated)"})]}),N.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[e.length===0&&N.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no changes"}),e.map(l=>{const u=Fu(h,l),d=l.path===n;return N.jsxs("button",{type:"button",onClick:()=>o(l.path),className:`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-2 rounded-md px-3 py-1.5 text-left text-[13px] ${d?"bg-garage-sel":"hover:bg-garage-sel"} ${u?"opacity-60":""}`,children:[N.jsx("span",{className:u?"text-garage-green":"text-garage-faint",children:u?"✓":"·"}),N.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-garage-dim",children:l.path})]},l.path)})]}),N.jsx("div",{className:"flex-none border-t border-garage-line px-3 py-1.5 font-mono text-[11px] text-garage-dim",children:"j/k files · v viewed · o editor · Esc exit"})]}),N.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:N.jsx($p,{files:e,selectedPath:n,emptyMessage:"no changes to review"})})]})}const iw=[{label:"workspace",items:[{keys:"1 – 9",action:"switch focused workspace to the Nth in rail order"},{keys:"a",action:"jump to a session that needs input (any workspace)"}]},{label:"grid",items:[{keys:"[ / ]",action:"cycle focused terminal within the current workspace"},{keys:"\\",action:"split the focused cell right (spawns a new session there)"},{keys:"m",action:"maximize the focused cell ⇄ restore the grid"},{keys:"Ctrl + `",action:"release keys from the focused terminal → back to garage"}]},{label:"review",items:[{keys:"Tab",action:"changes pane: toggle list ⇄ diff emphasis"},{keys:"j / k",action:"next / previous changed file"},{keys:"r",action:"enter full-screen review mode"},{keys:"v",action:"review mode: mark file viewed, advance to next unviewed"},{keys:"o",action:"open selected file — or the workspace root if none — in the editor"}]},{label:"general",items:[{keys:"?",action:"toggle this help overlay"},{keys:"Esc",action:"close this help, else exit review mode"}]}],sw=[{status:"needs-input",name:"needs input",meaning:"Claude is waiting on you — permission prompt, question, or plan approval"},{status:"working",name:"running",meaning:"Claude is working — nothing to do yet"},{status:"done",name:"responded",meaning:"finished its turn since you last looked at it"},{status:"idle",name:"idle",meaning:"waiting for your next prompt"},{status:"restorable",name:"restorable",meaning:"tmux session died (e.g. reboot) — the conversation can be resumed"}];function nw({onClose:p}){return N.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/20",onMouseDown:e=>{e.target===e.currentTarget&&p()},children:N.jsxs("div",{className:"max-h-[92vh] w-[560px] max-w-[90vw] overflow-y-auto rounded-xl border border-garage-line bg-garage-bg p-6 shadow-sm",children:[N.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[N.jsx("span",{className:"text-[15px] font-semibold text-garage-ink",children:"keybindings"}),N.jsx("span",{className:"text-xs text-garage-dim",children:"? or Esc to close"}),N.jsx("button",{type:"button",onClick:p,className:"ml-auto rounded-md px-2 py-1 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"×"})]}),iw.map(e=>N.jsxs("div",{className:"mb-5 last:mb-0",children:[N.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-wider text-garage-faint",children:e.label}),N.jsx("dl",{className:"grid grid-cols-[auto_1fr] items-baseline gap-x-5 gap-y-2",children:e.items.map(t=>N.jsxs(Te.Fragment,{children:[N.jsx("dt",{children:N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:t.keys})}),N.jsx("dd",{className:"text-[13px] text-garage-ink",children:t.action})]},t.keys))})]},e.label)),N.jsxs("div",{className:"mt-6 border-t border-garage-line pt-5",children:[N.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-wider text-garage-faint",children:"status legend"}),N.jsx("div",{className:"flex flex-col gap-2.5",children:sw.map(e=>N.jsxs("div",{className:"flex items-start gap-3",children:[N.jsx("span",{className:`w-4 shrink-0 text-center text-[13px] ${Ml[e.status]}`,children:Rl[e.status]}),N.jsx("span",{className:"w-24 shrink-0 text-[13px] font-medium text-garage-ink",children:e.name}),N.jsx("span",{className:"text-xs text-garage-dim",children:e.meaning})]},e.status))})]})]})})}const rw={cat:"Arthur",duck:"Papito",pup:"Segan"},Wu=[{value:"off",label:"no pet",description:"the strip stays empty"},{value:"cat",label:"Arthur the shop cat",description:"aloof; saunters over when you're needed, kneads when all clear"},{value:"duck",label:"Papito the rubber duck",description:"deadpan; waddles, and alerts with a single motionless stare"},{value:"pup",label:"Segan the pit pup",description:"eager; sprints to problems, zoomies when the wall is clear"}],ow={cat:{speed:10,frameEvery:2,alertBounce:"bounce-small",waddle:!1,deadpan:!1,aloof:.4,zoomies:!1,celebrateMs:3e3},duck:{speed:6,frameEvery:3,alertBounce:null,waddle:!0,deadpan:!0,aloof:0,zoomies:!1,celebrateMs:1100},pup:{speed:20,frameEvery:1,alertBounce:"bounce-big",waddle:!1,deadpan:!1,aloof:0,zoomies:!0,celebrateMs:3400}},aw={cat:{sleep:[[" /\\_/\\ ","( -.- ) z ",' (")_(") '],[" /\\_/\\ ","( -.- ) z",' (")_(") ']],watch:[[" /\\_/\\ ","( o.o )"," > ^ < "],[" /\\_/\\ ","( o.o )"," > ^ <"]],alert:[[" /\\_/\\ ","( O_O )"," /| |\\ "],[" /\\_/\\ ","( O_O )"," /|_|\\ "]],box:[["┌─────┐","│ -.- │","└─────┘"],["┌─────┐","│ o.o │","└─────┘"]],celebrate:[[" /\\_/\\ ","( ^.^ )"," >^ ^< "],[" /\\_/\\ ","( ^.^ )"," >^^ < "]]},duck:{sleep:[[" __ "," <(- )___ z"," `-----' "],[" __ "," <(- )___ "," `-----' z"]],watch:[[" __ "," <(o )___ "," `-----' "],[" __ "," <(- )___ "," `-----' "]],alert:[[" __ "," <(O )___ "," `-----' "]],box:[["┌─────┐","│ (o )>│","└─────┘"]],celebrate:[[" \\ __ / "," <(o )___ "," `-----' "],[" \\__/ "," <(o )___ "," `-----' "]]},pup:{sleep:[[" ∧_∧ "," (-ᴥ-) z"," |u u| "],[" ∧_∧ "," (-ᴥ-) "," |u u| z"]],watch:[[" ∧_∧ "," (·ᴥ·) "," |u u|"],[" ∧_∧ "," (·ᴥ·)/ "," |u u|"]],alert:[[" ∧ ∧ "," (°ᴥ°) "," |U U|"],[" ∧ ∧ "," (°ᴥ°) "," /|U U|"]],box:[["┌─────┐","│ ·ᴥ· │","└─────┘"]],celebrate:[["\\ ∧_∧ /"," (^ᴥ^) "," |u u|"],[" \\∧_∧/ "," (^ᴥ^) "," |u u|"]]}};function Vu({sessions:p,connState:e}){return e!=="live"?"box":p.length===0?"sleep":p.some(t=>t.status==="needs-input")?"alert":p.some(t=>t.status==="working")?"watch":"sleep"}const lw=300;function hw({sessions:p,connState:e,onJump:t}){const[n]=mn(),o=n.pet??"off",h=Z.useRef(null),w=Z.useRef(null),a=Z.useRef({sessions:p,connState:e});Z.useEffect(()=>{a.current={sessions:p,connState:e}},[p,e]);const l=Z.useRef(t);Z.useEffect(()=>{l.current=t},[t]);const u=Z.useRef({x:460,target:460,frame:0,tick:0,celebrateUntil:0,prevNeeds:0});return Z.useEffect(()=>{if(o==="off")return;const d=ow[o],c=aw[o],b=u.current;function C(){const y=h.current,g=w.current;if(!y||!g)return;b.tick++;const{sessions:_,connState:m}=a.current,v=Date.now(),D=_.filter(H=>H.status==="needs-input").length;b.prevNeeds>0&&D===0&&_.length>0&&(b.celebrateUntil=v+d.celebrateMs),b.prevNeeds=D;const P=v<b.celebrateUntil?"celebrate":Vu({sessions:_,connState:m}),T=Math.max(120,window.innerWidth-160);if(P==="alert")b.target=16;else if(P==="celebrate"&&d.zoomies)b.tick%3===0&&(b.target=b.target<T/2?T-40:40);else if(P!=="box"&&P!=="celebrate"&&Math.random()<.05){const H=80+Math.random()*(T-80);Math.random()>=(d.aloof||0)&&(b.target=H)}const A=P==="celebrate"&&d.zoomies?d.speed*2:d.speed;b.x+=Math.max(-A,Math.min(A,b.target-b.x)),b.x=Math.max(8,Math.min(T,b.x)),y.style.left=`${Math.round(b.x)}px`;const E=Math.abs(b.target-b.x)>6;b.tick%d.frameEvery===0&&b.frame++;const I=c[P]??c.watch;g.textContent=I[b.frame%I.length].join(`
81
- `),y.classList.toggle("alert",P==="alert"),y.classList.toggle("deadpan",!!d.deadpan),y.classList.toggle("waddle",!!d.waddle&&E),y.classList.toggle("bounce-big",d.alertBounce==="bounce-big"&&(P==="alert"||P==="celebrate"&&d.zoomies)),y.classList.toggle("bounce-small",d.alertBounce==="bounce-small"&&P==="alert");const z=rw[o]??"pit pet";y.title=P==="alert"?`${D} session${D===1?"":"s"} need${D===1?"s":""} input — click to jump`:`${z} — ${P==="box"?"hiding until the daemon is back":P==="celebrate"?"all clear!":`${P}ing`}`}const S=setInterval(C,lw);return C(),()=>clearInterval(S)},[o]),o==="off"?null:N.jsxs("div",{ref:h,role:"button","aria-label":"pit pet — click to jump to a session that needs input",className:"pit-pet",onClick:()=>{var b;const{sessions:d,connState:c}=a.current;Vu({sessions:d,connState:c})==="alert"?(b=l.current)==null||b.call(l):u.current.celebrateUntil=Date.now()+1200},children:[N.jsx("span",{className:"pit-pet-bubble",children:"!"}),N.jsx("pre",{ref:w})]})}function cw(p,e){const t=new Map;for(const o of p??[])t.set(o.name,{name:o.name,dir:o.dir,branch:o.branch??null,registered:!0,sessions:[]});for(const o of e??[]){let h=t.get(o.workspace);h||(h={name:o.workspace,dir:o.dir,registered:!1,sessions:[]},t.set(o.workspace,h)),h.sessions.push(o)}const n=[...t.values()];return n.sort((o,h)=>gs(Ql(o))-gs(Ql(h))),n.map(o=>({...o,sessions:[...o.sessions].sort((h,w)=>gs(h.status==="needs-input")-gs(w.status==="needs-input"))}))}function Ql(p){return p.sessions.some(e=>e.status==="needs-input")}function gs(p){return p?0:1}function dw(p,e){const t=cw(p,e),n=new Map(t.map(c=>[c.name,c])),o=new Map;for(const c of t){if(!c.dir)continue;let b=null;for(const C of t)C===c||!C.dir||uw(c.dir,C.dir)&&(!b||C.dir.length>b.dir.length)&&(b=C);b&&o.set(c.name,b.name)}const h=new Map;for(const c of t){const b=o.get(c.name);b&&(h.has(b)||h.set(b,[]),h.get(b).push(c))}function w(c){const b=n.get(c);return b&&Ql(b)?!0:(h.get(c)??[]).some(C=>w(C.name))}function a(c,b){const C=[...h.get(c.name)??[]].sort((S,y)=>gs(w(S.name))-gs(w(y.name)));return{...c,depth:b,children:C.map(S=>a(S,b+1))}}const u=t.filter(c=>!o.has(c.name)).sort((c,b)=>gs(w(c.name))-gs(w(b.name))).map(c=>a(c,0)),d=[];return(function c(b){for(const C of b)d.push(C),c(C.children)})(u),{tree:u,flattenedGroups:d}}function uw(p,e){if(!p||!e||p===e)return!1;const t=e.endsWith("/")?e:`${e}/`;return p.startsWith(t)}const ju=[{key:"focusDim",label:"focus dimming",description:"dim everything except the focused surface; needs-input never dims"},{key:"notifyBrowser",label:"browser notifications",description:"notify when a session needs input while this tab is hidden — clicking jumps to it",onEnable:()=>{typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission().catch(()=>{})}}];function pw(){const[p,e]=Z.useState(!1),[t,n]=mn(),o=Z.useRef(null);return Z.useEffect(()=>{if(!p)return;function h(a){o.current&&!o.current.contains(a.target)&&e(!1)}function w(a){a.key==="Escape"&&(a.stopPropagation(),e(!1))}return document.addEventListener("mousedown",h),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",w)}},[p]),N.jsxs("div",{ref:o,className:"relative",children:[N.jsx("button",{type:"button",onClick:()=>e(h=>!h),title:"settings","aria-label":"settings","aria-expanded":p,className:"rounded-md px-2 py-1 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"⚙"}),p&&N.jsxs("div",{role:"menu","aria-label":"settings",className:"absolute right-0 top-full z-10 mt-2 w-80 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[N.jsx("p",{className:"px-1 pb-1.5 text-[11px] uppercase tracking-wider text-garage-faint",children:"settings"}),ju.map((h,w)=>{const a=!!t[h.key];return N.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":a,onClick:()=>{var l;a||(l=h.onEnable)==null||l.call(h),n({[h.key]:!a})},className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<ju.length-1?"border-b border-garage-line":""}`,children:[N.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"[x]":"[ ]"}),N.jsxs("span",{className:"flex flex-col gap-0.5",children:[N.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),N.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.key)}),N.jsx("p",{className:"px-1 pb-1.5 pt-4 text-[11px] uppercase tracking-wider text-garage-faint",children:"theme"}),Ru.map((h,w)=>{const a=(t.theme??"light")===h.value;return N.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a,onClick:()=>n({theme:h.value}),className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<Ru.length-1?"border-b border-garage-line":""}`,children:[N.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"(•)":"( )"}),N.jsxs("span",{className:"flex flex-col gap-0.5",children:[N.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),N.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.value)}),N.jsx("p",{className:"px-1 pb-1.5 pt-4 text-[11px] uppercase tracking-wider text-garage-faint",children:"pit pet"}),Wu.map((h,w)=>{const a=(t.pet??"off")===h.value;return N.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a,onClick:()=>n({pet:h.value}),className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<Wu.length-1?"border-b border-garage-line":""}`,children:[N.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"(•)":"( )"}),N.jsxs("span",{className:"flex flex-col gap-0.5",children:[N.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),N.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.value)})]})]})}const Xp="garage-views:",vi="main";function fw(p){try{const e=localStorage.getItem(`${Xp}${p}`),t=e?JSON.parse(e):null;return{assignments:(t==null?void 0:t.assignments)??{},focused:(t==null?void 0:t.focused)??vi}}catch{return{assignments:{},focused:vi}}}function rr(p,e){try{localStorage.setItem(`${Xp}${p}`,JSON.stringify(e))}catch{}}function mw(p,e){const t=new Map;t.set(vi,[]);for(const o of p){const h=e[o.id]??vi;t.has(h)||t.set(h,[]),t.get(h).push(o)}const n=[];for(const[o,h]of t)h.length!==0&&n.push({name:o,sessions:h,needsCount:h.filter(w=>w.status==="needs-input").length});return n}function gw(p,e){return p[e]??vi}function vw(p,e){const t=new Set(e),n=p||"view";if(n!==vi&&!t.has(n))return n;let o=2;for(;t.has(`${n}-${o}`)||`${n}-${o}`===vi;)o++;return`${n}-${o}`}const _w=crypto.randomUUID(),ww=3e4,bw=3e3;function yw(){var pr;const[p,e]=Z.useState([]),[t,n]=Z.useState([]),[o,h]=Z.useState(null),[w,a]=Z.useState(null),[l,u]=Z.useState(null),[d,c]=Z.useState(!1),[b,C]=Z.useState("reconnecting"),[S,y]=Z.useState(null),[g,_]=Z.useState(null),m=Z.useRef(null),[v,D]=Z.useState("grid"),P=Z.useCallback(()=>D("rail"),[]),T=Z.useCallback(()=>D("grid"),[]),A=Z.useCallback(()=>D("pane"),[]),[E,I]=Z.useState(()=>vh()),{railW:z,paneW:H}=E,V=Z.useRef(E);Z.useEffect(()=>{V.current=E},[E]);const[F,q]=Z.useState(null),W=Z.useCallback(ne=>{ne.stopPropagation();const he=V.current.railW;q("rail");let ue=he;Jl(ne,{onMove:De=>{ue=Math.min(420,Math.max(160,he+De)),I(Oe=>({...Oe,railW:ue}))},onEnd:()=>{q(null),Mo({railW:ue})}})},[]),K=Z.useCallback(ne=>{ne.stopPropagation();const he=V.current.paneW;q("pane");let ue=he;Jl(ne,{onMove:De=>{ue=Math.min(680,Math.max(240,he-De)),I(Oe=>({...Oe,paneW:ue}))},onEnd:()=>{q(null),Mo({paneW:ue})}})},[]),[ie,J]=Z.useState([]),[L,B]=Z.useState(!1),[R,G]=Z.useState(!1),[X,oe]=Z.useState(null),[ae,me]=Z.useState(null),[$,O]=Z.useState(!1),[le,se]=Z.useState("list"),[ge,fe]=Z.useState(null),[Me,We]=Z.useState(!1),[je,ot]=Z.useState({}),[Ae,ve]=Z.useState(null),[Ie,$e]=Z.useState(!1),[st,Dt]=Z.useState(()=>new Set),{flattenedGroups:Ne}=Z.useMemo(()=>dw(p,t),[p,t]),[Si,At]=Z.useState(0),mt=Z.useCallback(()=>At(ne=>ne+1),[]),ut=Z.useMemo(()=>{var he;const ne={};for(const ue of Ne){const De=fw(ue.name),Oe=mw(ue.sessions,De.assignments),Be=Oe.some(Xe=>Xe.name===De.focused)?De.focused:((he=Oe[0])==null?void 0:he.name)??vi;ne[ue.name]={views:Oe,focused:Be,assignments:De.assignments}}return ne},[Ne,Si]),Ke=w?ut[w]:null,ai=(Ke==null?void 0:Ke.focused)??vi,gt=Z.useMemo(()=>{if(!Ke||Ke.views.length<=1)return null;const ne=Ke.views.find(he=>he.name===ai);return ne?new Set(ne.sessions.map(he=>he.id)):null},[Ke,ai]),Rt=Z.useCallback((ne,he)=>{const ue=ut[ne];if(!ue)return;rr(ne,{assignments:ue.assignments,focused:he}),mt(),a(ne);const De=ue.views.find(Oe=>Oe.name===he);De!=null&&De.sessions[0]&&u(De.sessions[0].id)},[ut,mt]),Ye=Z.useCallback((ne,he)=>{var jt;const ue=ut[ne];if(!ue)return;const De=Ne.find(Ot=>Ot.name===ne),Oe=((jt=De==null?void 0:De.sessions.find(Ot=>Ot.id===he))==null?void 0:jt.label)??"view",Be=vw(Oe,ue.views.map(Ot=>Ot.name)),Xe={...ue.assignments,[he]:Be};rr(ne,{assignments:Xe,focused:Be}),mt(),u(he)},[ut,Ne,mt]),Bs=Z.useCallback((ne,he)=>{const ue=ut[ne];if(!ue)return;const De={...ue.assignments};delete De[he],rr(ne,{assignments:De,focused:vi}),mt(),u(he)},[ut,mt]),dr=Z.useCallback((ne,he)=>{const ue=ut[ne];if(!ue||ue.focused===vi)return;const De={...ue.assignments,[he]:ue.focused};rr(ne,{assignments:De,focused:ue.focused}),mt()},[ut,mt]);Z.useEffect(()=>{if(!w||!l)return;const ne=ut[w];if(!ne||ne.views.length<=1)return;const he=gw(ne.assignments,l);he!==ne.focused&&ne.views.some(ue=>ue.name===he)&&(rr(w,{assignments:ne.assignments,focused:he}),mt())},[w,l,ut,mt]);const[gn]=mn();m0(),Z.useEffect(()=>{let ne=!1,he;async function ue(){try{const[De,Oe]=await Promise.all([eu(),Ao()]);if(ne)return;e(De),n(Oe),h(null)}catch(De){if(ne)return;h(De.message),he=setTimeout(ue,bw)}}return ue(),()=>{ne=!0,clearTimeout(he)}},[]);const li=Z.useCallback(()=>Ao().then(n).catch(ne=>h(ne.message)),[]),Hs=Z.useCallback(()=>{eu().then(e).catch(ne=>h(ne.message))},[]),_s=Z.useRef(w);Z.useEffect(()=>{_s.current=w},[w]);const ws=Z.useRef(t);Z.useEffect(()=>{ws.current=t},[t]);const Fs=Z.useRef(l);Z.useEffect(()=>{Fs.current=l},[l]);const Mt=Z.useCallback(ne=>{ne&&(G(!0),Ym(ne,Fs.current).then(he=>{const ue=he.files??[];J(ue),B(!!he.truncated),oe(null),me(he.branch??null),ew(ne,ue.map(De=>De.path))}).catch(he=>{oe(he.message),J([]),me(null)}).finally(()=>G(!1)))},[]);Z.useEffect(()=>{w&&Mt(w)},[w,l,Mt]),Z.useEffect(()=>{const ne=new EventSource("/api/events");let he=!1;return ne.addEventListener("open",()=>{C("live"),he&&li(),he=!0}),ne.addEventListener("error",()=>C("reconnecting")),ne.addEventListener("status",ue=>{let De;try{De=JSON.parse(ue.data)}catch{return}const{id:Oe,status:Be,since:Xe}=De;if(Be==="done"){const jt=ws.current.find(Ot=>Ot.id===Oe);jt&&jt.workspace===_s.current&&Mt(_s.current)}n(jt=>jt.map(Ot=>Ot.id===Oe?{...Ot,status:Be,since:Xe??Ot.since}:Ot))}),ne.addEventListener("sessions",li),()=>ne.close()},[li,Mt]),Z.useEffect(()=>{const ne=()=>Zm(_w,document.visibilityState==="visible");ne(),document.addEventListener("visibilitychange",ne);const he=setInterval(()=>{document.visibilityState==="visible"&&ne()},ww);return()=>{document.removeEventListener("visibilitychange",ne),clearInterval(he)}},[]),Z.useEffect(()=>{let ne;const he=()=>{clearTimeout(ne),ne=setTimeout(()=>{const ue=document.activeElement,De=ue&&ue.closest?ue.closest(".xterm"):null,Oe=De?De.closest("[data-session-id]"):null;y((Oe==null?void 0:Oe.dataset.sessionId)??null)},0)};return window.addEventListener("focusin",he),window.addEventListener("focusout",he),he(),()=>{clearTimeout(ne),window.removeEventListener("focusin",he),window.removeEventListener("focusout",he)}},[]),Z.useEffect(()=>{if(!S){_(null);return}const ne=ws.current.find(ue=>ue.id===S);_({label:(ne==null?void 0:ne.label)??S.split("/").pop()});const he=setTimeout(()=>_(null),4200);return()=>clearTimeout(he)},[S]);const Vt=Z.useMemo(()=>t.filter(ne=>ne.status==="needs-input").length,[t]);Z.useEffect(()=>{document.title=Vt>0?`(${Vt}) claude-garage`:"claude-garage"},[Vt]);const vn=Z.useRef(new Set),bs=Z.useRef(null);Z.useEffect(()=>{var Be;const ne=new Set(t.filter(Xe=>Xe.status==="needs-input").map(Xe=>Xe.id)),he=vn.current;if(vn.current=ne,!gn.notifyBrowser||typeof Notification>"u"||Notification.permission!=="granted"||document.visibilityState!=="hidden")return;const ue=[...ne].filter(Xe=>!he.has(Xe));if(ue.length===0)return;const De=((Be=t.find(Xe=>Xe.id===ue[0]))==null?void 0:Be.label)??ue[0],Oe=ue.length===1?`${De} needs input`:`${ue.length} sessions need input`;try{const Xe=new Notification("claude-garage",{body:Oe,tag:"garage-needs-input"});Xe.onclick=()=>{var jt;window.focus(),(jt=bs.current)==null||jt.call(bs),Xe.close()}}catch{}},[t,gn.notifyBrowser]);const _n=Z.useRef(!1),Yi=Z.useRef(null);Z.useEffect(()=>{const ne=window.matchMedia("(max-width: 1080px)"),he=()=>{ne.matches?Yi.current===null&&(Yi.current=_n.current,O(!0)):Yi.current!==null&&(O(Yi.current),Yi.current=null)};return he(),ne.addEventListener("change",he),()=>ne.removeEventListener("change",he)},[]),Z.useEffect(()=>{_n.current=$},[$]),Z.useEffect(()=>{if(!(w&&Ne.some(ne=>ne.name===w))&&Ne.length>0){const ne=Oe=>Oe&&Ne.some(Be=>Be.name===Oe),he=new URLSearchParams(window.location.search).get("ws");let ue=null;try{ue=localStorage.getItem("garage-last-workspace")}catch{}const De=ne(he)?he:ne(ue)?ue:Ne[0].name;a(De)}},[Ne,w]),Z.useEffect(()=>{if(!w)return;try{localStorage.setItem("garage-last-workspace",w)}catch{}const ne=new URLSearchParams(window.location.search);ne.get("ws")!==w&&(ne.set("ws",w),window.history.replaceState(null,"",`?${ne.toString()}`))},[w]),Z.useEffect(()=>{var he;const ne=Ne.find(ue=>ue.name===w);if(ne&&!ne.sessions.some(ue=>ue.id===l)){const ue=ne.sessions.find(De=>!st.has(De.id)&&(!gt||gt.has(De.id)))??ne.sessions.find(De=>!st.has(De.id));u((ue==null?void 0:ue.id)??((he=ne.sessions[0])==null?void 0:he.id)??null)}},[Ne,w,l,st,gt]);const Ws=Z.useCallback(ne=>{a(ne)},[]),wn=Z.useCallback((ne,he)=>{a(ne),u(he),Dt(ue=>{if(!ue.has(he))return ue;const De=new Set(ue);return De.delete(he),De})},[]),ur=Z.useCallback(ne=>{Dt(he=>{if(he.has(ne))return he;const ue=new Set(he);return ue.add(ne),ue}),u(he=>{if(he!==ne)return he;const ue=Ne.find(Oe=>Oe.sessions.some(Be=>Be.id===ne));if(!ue)return he;const De=ue.sessions.findIndex(Oe=>Oe.id===ne);for(let Oe=1;Oe<=ue.sessions.length;Oe++){const Be=ue.sessions[(De+Oe)%ue.sessions.length];if(Be.id!==ne&&!st.has(Be.id))return Be.id}return null})},[Ne,st]),Ri=Z.useCallback(ne=>{const he=Ne.find(Be=>Be.name===w);if(!he||he.sessions.length===0)return;const ue=he.sessions.filter(Be=>!st.has(Be.id));if(ue.length===0)return;const Oe=(ue.findIndex(Be=>Be.id===l)+ne+ue.length)%ue.length;u(ue[Oe].id)},[Ne,w,l,st]);Z.useEffect(()=>{bs.current=Mi});const Mi=Z.useCallback(()=>{for(const ne of Ne){const he=ne.sessions.find(ue=>ue.status==="needs-input");if(he){a(ne.name),u(he.id),Dt(ue=>{if(!ue.has(he.id))return ue;const De=new Set(ue);return De.delete(he.id),De});return}}},[Ne]),Xt=Z.useCallback(()=>{const ne=document.activeElement;ne&&ne.closest(".xterm")&&ne.blur()},[]);Z.useEffect(()=>{if(ie.length===0){fe(null);return}ie.some(ne=>ne.path===ge)||fe(ie[0].path)},[ie,ge]),Z.useEffect(()=>{ot(_h(w))},[w,ie]);const bn=Z.useCallback(ne=>{if(ie.length===0)return;const he=ie.findIndex(De=>De.path===ge),ue=he===-1?0:(he+ne+ie.length)%ie.length;fe(ie[ue].path)},[ie,ge]),Xi=Z.useCallback(()=>{if(!w||!ge)return;const ne=ie.findIndex(Oe=>Oe.path===ge);if(ne===-1)return;const he=ie[ne],ue=Zl(he.diff??""),De=Q0(w,ge,ue);ot(De);for(let Oe=1;Oe<ie.length;Oe++){const Be=ie[(ne+Oe)%ie.length];if(De[Be.path]!==Zl(Be.diff??"")){fe(Be.path);return}}},[w,ge,ie]),ys=Z.useCallback(()=>{if(!w)return;const ne=ge?ie.find(he=>he.path===ge):null;if(!ne){ko(w).catch(he=>ve(he.message));return}ko(w,ne.path,K0(ne.diff)).catch(he=>ve(he.message))},[w,ge,ie]),Ss=Z.useCallback(ne=>{ko(ne).catch(he=>ve(he.message))},[]),Cs=Z.useCallback(()=>{w&&(Xt(),Mt(w),We(!0))},[w,Xt,Mt]);Z.useEffect(()=>{if(!Ae)return;const ne=setTimeout(()=>ve(null),5e3);return()=>clearTimeout(ne)},[Ae]),Z.useEffect(()=>{function ne(he){var ue,De,Oe,Be;if(!(he.metaKey||he.ctrlKey||he.altKey)&&!(document.activeElement&&document.activeElement.closest(".xterm"))){if(/^[1-9]$/.test(he.key)){const Xe=Number(he.key)-1;Ne[Xe]&&(he.preventDefault(),Ws(Ne[Xe].name),D("grid"));return}if(he.key==="]"){he.preventDefault(),Ri(1),D("grid");return}if(he.key==="["){he.preventDefault(),Ri(-1),D("grid");return}if(he.key==="a"){he.preventDefault(),Mi(),D("grid");return}if(he.key==="Tab"){!Me&&!$&&(he.preventDefault(),se(Xe=>Xe==="list"?"diff":"list")),$||D("pane");return}if(he.key==="j"){he.preventDefault(),bn(1),$||D("pane");return}if(he.key==="k"){he.preventDefault(),bn(-1),$||D("pane");return}if(he.key==="r"){he.preventDefault(),Cs();return}if(he.key==="\\"){he.preventDefault(),(De=(ue=m.current)==null?void 0:ue.splitFocused)==null||De.call(ue,"right");return}if(he.key==="m"){he.preventDefault(),(Be=(Oe=m.current)==null?void 0:Oe.toggleMaximize)==null||Be.call(Oe);return}if(he.key==="Escape"){if(Ie){he.preventDefault(),$e(!1);return}Me&&(he.preventDefault(),We(!1));return}if(he.key==="?"){he.preventDefault(),$e(Xe=>!Xe);return}if(he.key==="v"){Me&&(he.preventDefault(),Xi());return}he.key==="o"&&(he.preventDefault(),ys())}}return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[Ne,Ws,Ri,Mi,Me,Ie,$,bn,Xi,ys,Cs]);const zo=Ne.find(ne=>ne.name===w)??null,Bo=S?((pr=t.find(ne=>ne.id===S))==null?void 0:pr.label)??S.split("/").pop():null;return N.jsxs("main",{className:`flex h-screen flex-col bg-garage-bg font-sans text-[13px] text-garage-ink ${gn.focusDim?"focus-dim":""}`,children:[N.jsxs("header",{onMouseDown:Xt,className:"flex h-12 flex-none items-center gap-3 border-b border-garage-line bg-garage-panel px-4",children:[N.jsx("span",{className:"text-[15px] font-semibold tracking-tight text-garage-ink",children:"claude-garage"}),b!=="live"&&N.jsxs("span",{title:"daemon connection state",className:"flex items-center gap-1.5 text-xs text-garage-dim",children:[N.jsx("span",{children:"↻"}),"reconnecting…"]}),N.jsxs("div",{className:"relative ml-auto flex items-center gap-2",children:[Vt>0&&N.jsxs("button",{type:"button",onClick:Mi,title:"jump to a session that needs input (same as pressing a)",className:"flex items-center gap-1.5 rounded-md bg-garage-amber/10 px-3 py-1.5 text-[13px] font-semibold text-garage-amber hover:bg-garage-amber/15",children:[N.jsx("span",{children:"●"}),Vt," need",Vt===1?"s":""," input"]}),N.jsx(pw,{}),N.jsx("button",{type:"button",onClick:()=>c(ne=>!ne),className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"+ Add workspace"}),d&&N.jsx(F0,{onClose:()=>c(!1),existingNames:p.map(ne=>ne.name),onCreated:()=>{Hs(),c(!1)}})]})]}),o&&N.jsxs("div",{className:"flex-none px-4 py-2 text-xs text-garage-red bg-garage-panel",children:[o," — retrying…"]}),N.jsx(H0,{sessions:t}),N.jsxs("div",{className:"grid min-h-0 flex-1",style:{gridTemplateColumns:$?`${z}px 4px 1fr 32px`:`${z}px 4px 1fr 4px ${H}px`},children:[N.jsx(ng,{groups:Ne,focusedWorkspace:w,focusedSessionId:l,onSelectWorkspace:Ws,onSelectSession:wn,onSessionCreated:li,onOpenRoot:Ss,onBlurChrome:Xt,onSessionsRestored:li,onWorkspaceRenamed:()=>{Hs(),li()},hiddenIds:st,columnActive:v==="rail",onActivateColumn:P,viewsByWorkspace:ut,onSelectView:Rt}),N.jsx("div",{role:"separator","aria-orientation":"vertical",className:`col-divider ${F==="rail"?"is-dragging":""}`,onMouseDown:W}),N.jsx(O0,{group:zo,focusedSessionId:l,onFocusCell:u,onBlurChrome:Xt,onSessionsRestored:li,hiddenIds:st,onHideCell:ur,columnActive:v==="grid",onActivateColumn:T,onAddWorkspace:()=>c(!0),gridActionsRef:m,views:(Ke==null?void 0:Ke.views)??[],focusedView:ai,viewAssignments:(Ke==null?void 0:Ke.assignments)??{},activeViewIds:gt,onSelectView:Rt,onDetachCell:Ye,onRejoinCell:Bs,onAssignNewSession:dr}),!$&&N.jsx("div",{role:"separator","aria-orientation":"vertical",className:`col-divider ${F==="pane"?"is-dragging":""}`,onMouseDown:K}),N.jsx(J0,{workspace:w,branch:ae,files:ie,truncated:L,loading:R,error:X,collapsed:$,onToggleCollapse:()=>O(ne=>!ne),emphasis:le,selectedPath:ge,onSelectFile:fe,onRefresh:()=>Mt(w),onBlurChrome:Xt,columnActive:v==="pane",onActivateColumn:A,onEnterReview:Cs})]}),N.jsxs("div",{"aria-hidden":"true",className:"flex h-9 flex-none flex-wrap items-center gap-5 border-t border-garage-line bg-garage-panel px-4 text-xs text-garage-faint",children:[N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"?"})," help"]}),N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"a"})," needs-input"]}),N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"1–9"})," workspace"]}),N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"\\"})," split"]}),N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"m"})," maximize"]}),N.jsxs("span",{children:[N.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"r"})," review"]}),N.jsx("span",{className:`ml-auto ${S?"text-garage-ink font-medium":"text-garage-faint"}`,children:S?`keys go to ${Bo} — Ctrl+\` to return`:"keys go to garage"})]}),Me&&N.jsx(tw,{workspace:w,files:ie,truncated:L,selectedPath:ge,onSelectFile:fe,viewedMap:je,onOpenRoot:Ss}),N.jsx(hw,{sessions:t,connState:b,onJump:Mi}),Ie&&N.jsx(nw,{onClose:()=>$e(!1)}),g&&N.jsxs("div",{className:"fixed bottom-10 left-1/2 z-[60] -translate-x-1/2 rounded-lg border border-garage-line bg-garage-panel px-4 py-1.5 text-xs text-garage-dim shadow-sm",children:["keys now go to ",N.jsx("span",{className:"font-medium text-garage-ink",children:g.label})," ","— press ",N.jsx("span",{className:"font-medium text-garage-ink",children:"Ctrl+`"})," to return to garage"]}),Ae&&N.jsxs("div",{className:"fixed bottom-4 right-4 z-[60] flex max-w-sm items-start gap-2 rounded-lg border border-garage-line bg-garage-panel px-3 py-2 text-xs text-garage-red shadow-sm",children:[N.jsx("span",{children:Ae}),N.jsx("button",{type:"button",onClick:()=>ve(null),className:"ml-auto text-garage-dim hover:text-garage-ink",children:"×"})]})]})}Um.createRoot(document.getElementById("root")).render(N.jsx(yw,{}));
79
+ */var a0=class{constructor(p,e,t,n={}){this._terminal=p,this._regex=e,this._handler=t,this._options=n}provideLinks(p,e){let t=h0.computeLink(p,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(p){return p.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:o}=e;this._options.hover(t,n,o)}},e))}};function l0(p){try{let e=new URL(p),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return p.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}var h0=class Po{static computeLink(e,t,n,o){let h=new RegExp(t.source,(t.flags||"")+"g"),[w,a]=Po._getWindowedLineStrings(e-1,n),l=w.join(""),u,d=[];for(;u=h.exec(l);){let c=u[0];if(!l0(c))continue;let[b,C]=Po._mapStrIdx(n,a,0,u.index),[S,y]=Po._mapStrIdx(n,b,C,c.length);if(b===-1||C===-1||S===-1||y===-1)continue;let g={start:{x:C+1,y:b+1},end:{x:y,y:S+1}};d.push({range:g,text:c,activate:o})}return d}static _getWindowedLineStrings(e,t){let n,o=e,h=e,w=0,a="",l=[];if(n=t.buffer.active.getLine(e)){let u=n.translateToString(!0);if(n.isWrapped&&u[0]!==" "){for(w=0;(n=t.buffer.active.getLine(--o))&&w<2048&&(a=n.translateToString(!0),w+=a.length,l.push(a),!(!n.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(u),w=0;(n=t.buffer.active.getLine(++h))&&n.isWrapped&&w<2048&&(a=n.translateToString(!0),w+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,o]}static _mapStrIdx(e,t,n,o){let h=e.buffer.active,w=h.getNullCell(),a=n;for(;o;){let l=h.getLine(t);if(!l)return[-1,-1];for(let u=a;u<l.length;++u){l.getCell(u,w);let d=w.getChars();if(w.getWidth()&&(o-=d.length||1,u===l.length-1&&d==="")){let c=h.getLine(t+1);c&&c.isWrapped&&(c.getCell(0,w),w.getWidth()===2&&(o+=1))}if(o<0)return[t,u]}t++,a=0}return[t,a]}},c0=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function d0(p,e){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var u0=class{constructor(p=d0,e={}){this._handler=p,this._options=e}activate(p){this._terminal=p;let e=this._options,t=e.urlRegex||c0;this._linkProvider=this._terminal.registerLinkProvider(new a0(this._terminal,t,this._handler,e))}dispose(){var p;(p=this._linkProvider)==null||p.dispose()}};const ph="garage-settings",To=Object.freeze({focusDim:!1,theme:"light",pet:"off",notifyBrowser:!1});function Bp(){try{const p=localStorage.getItem(ph);if(!p)return{...To};const e=JSON.parse(p);return{...To,...e}}catch{return{...To}}}let fn=Bp();const Xl=new Set;function Hp(){for(const p of Xl)p()}typeof window<"u"&&window.addEventListener("storage",p=>{p.key!==null&&p.key!==ph||(fn=Bp(),Hp())});function p0(p){return Xl.add(p),()=>Xl.delete(p)}function f0(){return fn}function m0(p){const e=typeof p=="function"?p(fn):p;fn={...fn,...e};try{localStorage.setItem(ph,JSON.stringify(fn))}catch{}Hp()}function mn(){return[J.useSyncExternalStore(p0,f0,()=>To),m0]}const Ru=[{value:"light",label:"light",description:"the default — white ground, ink text"},{value:"dark",label:"dark",description:"neutral zinc dark"},{value:"system",label:"system",description:"follow the OS — light ⇄ dark"}],Mu={garage:"dark","claude-dark":"dark","claude-light":"light"};function Al(p){return p==="light"||p==="dark"?p:p in Mu?Mu[p]:p==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function fh(p){const[e,t]=J.useState(()=>Al(p));return J.useEffect(()=>{if(t(Al(p)),p!=="system")return;const n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>t(Al("system"));return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[p]),e}function g0(){const[p]=mn(),e=fh(p.theme);return J.useEffect(()=>{document.documentElement.dataset.theme=e},[e]),e}const v0='"Google Sans Code", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, monospace';function Ou(p){const e=[];for(const[t,n]of Object.entries(p))e[Number(t)-16]=n;return e}const Gu={light:{background:"#ffffff",foreground:"#27272a",cursor:"#27272a",cursorAccent:"#ffffff",selectionBackground:"#e4e4e7",black:"#27272a",red:"#b91c1c",green:"#15803d",yellow:"#a16207",blue:"#1d4ed8",magenta:"#7e22ce",cyan:"#0e7490",white:"#52525b",brightBlack:"#71717a",brightRed:"#991b1b",brightGreen:"#166534",brightYellow:"#854d0e",brightBlue:"#1e40af",brightMagenta:"#6b21a8",brightCyan:"#155e75",brightWhite:"#18181b",extendedAnsi:Ou({22:"#dcfce7",28:"#bbf7d0",194:"#dcfce7",52:"#fee2e2",88:"#fecaca",224:"#fee2e2"})},dark:{background:"#09090b",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#09090b",selectionBackground:"#27272a",black:"#131316",red:"#f87171",green:"#4ade80",yellow:"#f59e0b",blue:"#a1a1aa",magenta:"#c4b5fd",cyan:"#67e8f9",white:"#e4e4e7",brightBlack:"#71717a",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fbbf24",brightBlue:"#d4d4d8",brightMagenta:"#ddd6fe",brightCyan:"#a5f3fc",brightWhite:"#fafafa",extendedAnsi:Ou({22:"#14291c",28:"#1a3524",65:"#234a30",52:"#2c1a1a",88:"#3a2222",124:"#4a2a2a"})}};function Nu(p){return Gu[p]??Gu.light}const _0=500,w0=8e3,b0=/(?:\.{1,2}\/|~\/|\/)?[\w.@+-]+(?:\/[\w.@+-]+)+(?::\d+(?::\d+)?)?|[\w@+-]+\.[A-Za-z0-9]{1,8}:\d+(?::\d+)?/g;function y0(p){const e=p.match(/^(.*?):(\d+)(?::\d+)?$/);return e?{file:e[1],line:Number(e[2])}:{file:p,line:1}}function S0({id:p,onConnectionChange:e,reconnectSignal:t=0}){const n=J.useRef(null),o=J.useRef(null),h=J.useRef(e);J.useEffect(()=>{h.current=e},[e]);const[w]=mn(),a=fh(w.theme),l=J.useRef(null),u=J.useRef(a);return J.useEffect(()=>{u.current=a},[a]),J.useEffect(()=>{var I;const d=new n0.Terminal({fontFamily:v0,fontSize:13,cursorBlink:!0,theme:Nu(u.current)});l.current=d;const c=new o0.FitAddon;d.loadAddon(c),d.loadAddon(new u0((B,N)=>{(B.metaKey||B.ctrlKey)&&window.open(N,"_blank","noopener")}));let b;const C=async B=>{var F;const{file:N,line:W}=y0(B);try{if(b===void 0&&(b=((F=(await Ao()).find(V=>V.id===p))==null?void 0:F.workspace)??null),!b)return;await ko(b,N.replace(/^~\//,""),W)}catch(q){console.warn(`open-editor link failed: ${q.message}`)}},S=d.registerLinkProvider({provideLinks(B,N){const W=d.buffer.active.getLine(B-1);if(!W)return N(void 0);const F=W.translateToString(!0),q=[];for(const V of F.matchAll(b0))q.push({text:V[0],range:{start:{x:V.index+1,y:B},end:{x:V.index+V[0].length,y:B}},activate(K,ie){(K.metaKey||K.ctrlKey)&&C(ie)}});N(q.length?q:void 0)}});d.open(n.current),c.fit(),(I=document.fonts)!=null&&I.ready&&document.fonts.ready.then(()=>{g||(c.fit(),v())}),d.attachCustomKeyEventHandler(B=>{var N;return B.type==="keydown"&&B.ctrlKey&&B.key==="`"?((N=document.activeElement)==null||N.blur(),!1):B.key==="Enter"&&B.shiftKey&&!B.ctrlKey&&!B.metaKey?(B.type==="keydown"&&y&&y.readyState===WebSocket.OPEN&&y.send(D.encode("\\\r")),!1):!0});let y=null,g=!1,_=0,m=null;const v=()=>{y&&y.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"resize",cols:d.cols,rows:d.rows}))},D=new TextEncoder,P=d.onData(B=>{y&&y.readyState===WebSocket.OPEN&&y.send(D.encode(B))});function T(){if(g)return;const B=location.protocol==="https:"?"wss":"ws";y=new WebSocket(`${B}://${location.host}/term/${encodeURIComponent(p)}`),y.binaryType="arraybuffer",y.onopen=()=>{var N;_=0,(N=h.current)==null||N.call(h,!0),v()},y.onmessage=N=>d.write(new Uint8Array(N.data)),y.onclose=()=>{var N;g||((N=h.current)==null||N.call(h,!1),A())}}function A(){const B=Math.min(w0,_0*2**_);_+=1,clearTimeout(m),m=setTimeout(async()=>{if(!g){try{const N=await Ao();if(g||!N.some(W=>W.id===p))return}catch{}T()}},B)}o.current={reconnectNow(){g||y&&(y.readyState===WebSocket.OPEN||y.readyState===WebSocket.CONNECTING)||(clearTimeout(m),_=0,T())}},T();const E=new ResizeObserver(()=>{c.fit(),v()});return E.observe(n.current),()=>{g=!0,clearTimeout(m),o.current=null,l.current=null,E.disconnect(),P.dispose(),S.dispose(),y&&y.close(),d.dispose()}},[p]),J.useEffect(()=>{l.current&&(l.current.options.theme=Nu(a))},[a]),J.useEffect(()=>{var d;t>0&&((d=o.current)==null||d.reconnectNow())},[t]),z.jsx("div",{ref:n,style:{height:"100%",width:"100%"}})}const C0="garage-layout:",Fp="terminal";function mh(p){return`${C0}${p}`}function x0(p){try{const e=localStorage.getItem(mh(p));return e?JSON.parse(e):null}catch{return null}}function D0(p,e){try{localStorage.setItem(mh(p),JSON.stringify(e.toJSON()))}catch{}}function E0(p){try{localStorage.removeItem(mh(p))}catch{}}const k0=1e4,ql=new Map;function P0(p,e,t){ql.set(p,{referencePanel:e,direction:t,at:Date.now()})}function T0(p,e){const t=ql.get(e);return!t||(ql.delete(e),Date.now()-t.at>k0)||!p.getPanel(t.referencePanel)?null:t}function A0(p){let e=null,t=-1;for(const n of p.panels){const o=(n.api.width||0)*(n.api.height||0);o>t&&(t=o,e=n)}return e}function Wp(p,e){const t=Math.ceil(Math.sqrt(e.length));e.forEach((n,o)=>{let h;o>0&&o<t?h={referencePanel:e[o-1],direction:"right"}:o>=t&&(h={referencePanel:e[o-t],direction:"below"}),p.addPanel({id:n,component:Fp,position:h})})}function Vp(p,e){const t=new Set(e);for(const o of[...p.panels])if(!t.has(o.id))try{p.removePanel(o)}catch{}const n=new Set(p.panels.map(o=>o.id));for(const o of e){if(n.has(o))continue;const h=T0(p,o);let w;if(h)w={referencePanel:h.referencePanel,direction:h.direction};else{const a=A0(p);if(a){const l=(a.api.width||0)>=(a.api.height||0);w={referencePanel:a.id,direction:l?"right":"below"}}}p.addPanel({id:o,component:Fp,position:w})}}function zu(p,e,t){const n=x0(e);if(n)try{p.fromJSON(n),Vp(p,t);return}catch{}p.clear(),Wp(p,t)}function I0(p,e,t){E0(e),p.clear(),Wp(p,t)}const L0=300,R0={...xv,tabGroupIndicator:"none"},M0={...Cv,tabGroupIndicator:"none"};function O0(p){const e=new Set(p.map(n=>n.label));let t=1;for(;e.has(`claude-${t}`);)t++;return`claude-${t}`}const gh=J.createContext(null);function G0({group:p,focusedSessionId:e,onFocusCell:t,onBlurChrome:n,onSessionsRestored:o,hiddenIds:h,onHideCell:w,columnActive:a,onActivateColumn:l,onAddWorkspace:u,gridActionsRef:d,views:c=[],focusedView:b,viewAssignments:C={},activeViewIds:S,onSelectView:y,onDetachCell:g,onRejoinCell:_,onAssignNewSession:m}){const[v]=mn(),P=fh(v.theme)==="dark"?M0:R0,T=p?b&&b!=="main"?`${p.name}::${b}`:p.name:null,[A,E]=J.useState(()=>new Set),[I,B]=J.useState(null),[N,W]=J.useState(null),[F,q]=J.useState(!1),V=J.useRef(null);J.useEffect(()=>{if(!N)return;const ve=setTimeout(()=>W(null),5e3);return()=>clearTimeout(ve)},[N]),J.useEffect(()=>{if(!F)return;function ve(Ie){V.current&&!V.current.contains(Ie.target)&&q(!1)}return document.addEventListener("mousedown",ve),()=>document.removeEventListener("mousedown",ve)},[F]);const[K,ie]=J.useState(null),Z=J.useRef(null);J.useEffect(()=>()=>clearTimeout(Z.current),[]);const L=J.useCallback((ve,Ie)=>{Ie&&ie({sessionId:ve.id,label:ve.label,worktree:Ie,busy:!1,error:null,discardArmed:!1})},[]);async function H(ve){if(!(!K||K.busy)){ie(Ie=>Ie&&{...Ie,busy:!0,error:null});try{await ig(K.worktree,ve),ie(null),o==null||o()}catch(Ie){ie($e=>$e&&{...$e,busy:!1,error:Ie.message})}}}function R(){if(!(!K||K.busy)){if(!K.discardArmed){ie(ve=>ve&&{...ve,discardArmed:!0}),clearTimeout(Z.current),Z.current=setTimeout(()=>{ie(ve=>ve&&{...ve,discardArmed:!1})},3e3);return}clearTimeout(Z.current),ie(ve=>ve&&{...ve,discardArmed:!1}),H("discard")}}function G(){ie(null),o==null||o()}const X=J.useRef(null),oe=J.useRef(null),ae=J.useRef(null);async function me(ve){E(Ie=>new Set(Ie).add(ve)),B(null);try{await Ol({id:ve}),o==null||o()}catch(Ie){B(Ie.message)}finally{E(Ie=>{const $e=new Set(Ie);return $e.delete(ve),$e})}}const $=J.useCallback(async(ve,Ie,{worktree:$e=!1}={})=>{if(!p)return;const st=O0(p.sessions),Dt=`garage/${p.name}/${st}`;ve&&P0(Dt,ve,Ie);try{await Ju(p.name,st,$e?{worktree:!0}:{}),m==null||m(p.name,Dt),await(o==null?void 0:o()),t(Dt)}catch(Ne){W(Ne.message)}},[p,o,t,m]),O=J.useCallback(()=>{const ve=X.current;if(!ve)return;if(ve.hasMaximizedGroup()){ve.exitMaximizedGroup();return}const Ie=e?ve.getPanel(e):null;Ie&&ve.maximizeGroup(Ie)},[e]);J.useEffect(()=>{if(d)return d.current={toggleMaximize:O,splitFocused:ve=>{e&&$(e,ve)}},()=>{d.current=null}},[d,O,$,e]);const le=J.useMemo(()=>((p==null?void 0:p.sessions)??[]).filter(ve=>!(h!=null&&h.has(ve.id))&&(!S||S.has(ve.id))),[p,h,S]),se=J.useMemo(()=>{const ve=new Map;for(const Ie of le)ve.set(Ie.id,Ie);return ve},[le]),ge=J.useMemo(()=>({sessionsById:se,focusedSessionId:e,restoringIds:A,restoreError:I,columnActive:a,onFocusCell:t,onHideCell:w,onSessionsRestored:o,restoreOne:me,splitFrom:$,onSessionClosed:L,viewAssignments:C,hasMultipleViews:c.length>1,onDetachCell:ve=>g==null?void 0:g(p==null?void 0:p.name,ve),onRejoinCell:ve=>_==null?void 0:_(p==null?void 0:p.name,ve)}),[se,e,A,I,a,t,w,o,$,L,C,c,g,_,p==null?void 0:p.name]),fe=J.useMemo(()=>le.map(ve=>ve.id),[le]),Me=fe.join(","),We=J.useCallback(()=>{!oe.current||!X.current||(clearTimeout(ae.current),ae.current=setTimeout(()=>{X.current&&oe.current&&D0(oe.current,X.current)},L0))},[]);function je(ve){const Ie=ve.api;if(X.current=Ie,oe.current=T,zu(Ie,T,fe),e){const $e=Ie.getPanel(e);$e&&$e.api.setActive()}Ie.onDidLayoutChange(We),Ie.onDidActivePanelChange($e=>{$e.origin==="user"&&$e.panel&&t($e.panel.id)})}J.useEffect(()=>{const ve=X.current;if(!(!ve||!p)&&(oe.current!==T?(ve.hasMaximizedGroup()&&ve.exitMaximizedGroup(),oe.current=T,zu(ve,T,fe)):Vp(ve,fe),e)){const Ie=ve.getPanel(e);Ie&&!Ie.api.isActive&&Ie.api.setActive()}},[T,Me]),J.useEffect(()=>{const ve=X.current;if(!ve||!e)return;const Ie=ve.getPanel(e);Ie&&(ve.hasMaximizedGroup()&&!Ie.group.api.isMaximized()&&ve.exitMaximizedGroup(),Ie.api.isActive||Ie.api.setActive())},[e]),J.useEffect(()=>()=>clearTimeout(ae.current),[]);const ot=J.useCallback(()=>{const ve=X.current;!ve||!T||(ve.hasMaximizedGroup()&&ve.exitMaximizedGroup(),I0(ve,T,fe))},[T,fe]),Ae=K&&z.jsxs("div",{className:"fixed bottom-4 right-4 z-50 flex items-center gap-2 rounded-lg border border-garage-line bg-garage-bg px-3 py-2 text-xs text-garage-ink shadow-sm",children:[z.jsx("span",{className:"text-garage-dim",children:"worktree for"}),z.jsx("span",{className:"font-semibold text-garage-ink",children:K.label}),z.jsx("span",{className:"text-garage-line",children:":"}),z.jsx("button",{type:"button",onClick:()=>H("merge"),disabled:K.busy,className:"rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"merge"}),z.jsx("button",{type:"button",onClick:R,disabled:K.busy,className:`rounded-md px-2 py-1 text-xs disabled:opacity-40 ${K.discardArmed?"text-garage-red":"text-garage-dim hover:bg-garage-sel hover:text-garage-red"}`,children:K.discardArmed?"discard branch?":"discard"}),z.jsx("button",{type:"button",onClick:G,disabled:K.busy,className:"rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"keep"}),K.discardArmed&&!K.error&&z.jsxs("span",{className:"max-w-[16rem] truncate text-garage-red",children:["click again — deletes unmerged work on ",K.worktree.branch]}),K.error&&z.jsxs("span",{className:"max-w-[14rem] truncate text-garage-red",title:K.error,children:["· ",K.error]})]});return p?p.sessions.length===0?z.jsxs(z.Fragment,{children:[z.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg text-xs text-garage-dim",children:z.jsxs("span",{children:["no sessions in ",p.name," yet — spawn one with the"," ",z.jsx("span",{className:"font-mono text-garage-ink",children:"+"})," next to its name in the rail"]})}),Ae]}):le.length===0?z.jsxs(z.Fragment,{children:[z.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg text-xs text-garage-dim",children:"every session in this workspace is hidden — click one in the rail to bring it back"}),Ae]}):z.jsxs("div",{onMouseDown:n,onMouseDownCapture:l,className:"flex min-h-0 flex-col overflow-hidden bg-garage-bg",children:[z.jsxs("div",{className:"flex h-10 flex-none items-center gap-2 border-b border-garage-line bg-garage-panel px-3 text-[13px]",children:[z.jsx("span",{className:"font-medium text-garage-ink",children:p.name}),z.jsxs("div",{ref:V,className:"relative flex items-center gap-1",children:[z.jsxs("button",{type:"button",onClick:()=>q(ve=>!ve),title:`new session in ${p.name}`,"aria-haspopup":"menu","aria-expanded":F,className:"rounded-md px-2 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:["+ ",z.jsx("span",{className:"text-xs text-garage-faint",children:"▾"})]}),F&&z.jsxs("div",{role:"menu",className:"absolute left-0 top-full z-20 mt-1 w-64 rounded-lg border border-garage-line bg-garage-bg p-1 shadow-sm",children:[z.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{q(!1),$(e,"right")},className:"flex w-full flex-col rounded-md px-3 py-2 text-left hover:bg-garage-sel",children:[z.jsx("span",{className:"text-[13px] text-garage-ink",children:"new session"}),z.jsx("span",{className:"text-xs text-garage-faint",children:"spawns beside the focused cell — same directory"})]}),z.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{q(!1),$(e,"right",{worktree:!0})},className:"flex w-full flex-col rounded-md px-3 py-2 text-left hover:bg-garage-sel",children:[z.jsx("span",{className:"text-[13px] text-garage-ink",children:"new worktree session"}),z.jsx("span",{className:"text-xs text-garage-faint",children:"isolated git worktree on branch garage/<label>"})]})]}),z.jsx("button",{type:"button",onClick:()=>e&&$(e,"right"),disabled:!e,title:"split focused cell right (\\)",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"◫"}),z.jsx("button",{type:"button",onClick:()=>e&&$(e,"below"),disabled:!e,title:"split focused cell down",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"⬒"}),z.jsx("button",{type:"button",onClick:O,disabled:!e,title:"maximize focused cell — toggle (m)",className:"rounded-md px-1.5 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-30",children:"⛶"})]}),N&&z.jsx("span",{className:"max-w-[18rem] truncate text-[11px] text-garage-red",title:N,children:N}),z.jsx("button",{type:"button",onClick:ot,title:"Discard the custom layout and restore the default grid",className:"ml-auto rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"reset layout"})]}),c.length>1&&z.jsx("div",{className:"flex flex-none items-center gap-1 border-b border-garage-line bg-garage-panel px-3 py-1.5 text-xs",children:c.map(ve=>{const Ie=ve.name===b;return z.jsxs("button",{type:"button",onClick:()=>y==null?void 0:y(p.name,ve.name),title:`show view "${ve.name}" (${ve.sessions.length} session${ve.sessions.length===1?"":"s"})`,className:`flex items-center gap-1.5 rounded-md px-2.5 py-1 ${Ie?"bg-garage-sel text-garage-ink":"text-garage-dim hover:bg-garage-sel"}`,children:[ve.needsCount>0&&z.jsx("span",{className:"text-garage-amber",children:"●"}),ve.name,z.jsxs("span",{className:"text-garage-faint",children:[ve.sessions.length,"×"]})]},ve.name)})}),z.jsx("div",{className:"min-h-0 flex-1 p-2",children:z.jsx(gh.Provider,{value:ge,children:z.jsx(Np,{className:"garage-dock",theme:P,components:{terminal:z0},defaultTabComponent:N0,singleTabMode:"fullwidth",onReady:je})})}),Ae]}):z.jsxs(z.Fragment,{children:[z.jsx("div",{onMouseDown:n,onMouseDownCapture:l,className:"grid min-h-0 place-items-center bg-garage-bg p-6",children:z.jsxs("div",{className:"max-w-md space-y-4 rounded-xl border border-garage-line bg-garage-panel px-8 py-7",children:[z.jsx("h2",{className:"text-[15px] font-semibold text-garage-ink",children:"your pit wall is empty"}),z.jsx("p",{className:"text-[13px] text-garage-dim",children:"claude-garage runs several Claude Code sessions side by side and tells you the moment one needs you."}),z.jsxs("ol",{className:"list-decimal space-y-1.5 pl-5 text-[13px] text-garage-dim",children:[z.jsxs("li",{children:[z.jsx("span",{className:"font-semibold text-garage-ink",children:"add a workspace"})," — point it at a project folder"]}),z.jsxs("li",{children:[z.jsx("span",{className:"font-semibold text-garage-ink",children:"spawn sessions"})," — the"," ",z.jsx("span",{className:"font-mono text-garage-ink",children:"+"})," next to the workspace name in the rail"]}),z.jsxs("li",{children:[z.jsx("span",{className:"font-semibold text-garage-ink",children:"triage"})," — amber"," ",z.jsx("span",{className:"text-garage-amber",children:"●"})," means Claude is waiting; press"," ",z.jsx("span",{className:"font-mono text-garage-ink",children:"a"})," to jump there"]})]}),z.jsx("button",{type:"button",onClick:()=>u==null?void 0:u(),className:"rounded-md bg-garage-ink px-4 py-2 text-[13px] font-medium text-garage-bg hover:opacity-90",children:"+ add your first workspace"}),z.jsxs("p",{className:"text-[11px] text-garage-faint",children:["press ",z.jsx("span",{className:"font-mono text-garage-ink",children:"?"})," anytime for keybindings & the status legend"]})]})}),Ae]})}function N0({api:p}){var B;const e=J.useContext(gh),t=p.id,n=e.sessionsById.get(t),[o,h]=J.useState(!1),[w,a]=J.useState(!1),[l,u]=J.useState(null),d=J.useRef(null),c=J.useRef(null),[b,C]=J.useState(!1),[S,y]=J.useState(!1),[g,_]=J.useState(null),m=J.useRef(null),v=J.useRef(null);if(J.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(c.current),clearTimeout(m.current),clearTimeout(v.current)},[]),qu(),!n)return null;const D=t===e.focusedSessionId,P=n.status!=="restorable",T=n.status==="needs-input",A=n.status==="working"||n.status==="needs-input";async function E(){var N,W;if(!b){C(!0),clearTimeout(m.current),m.current=setTimeout(()=>C(!1),3e3);return}clearTimeout(m.current),C(!1),y(!0),_(null);try{const F=await tg(t,A);if((N=F.failed)!=null&&N.length)throw new Error(F.failed[0].error);if((W=F.skipped)!=null&&W.length)throw new Error(`still ${F.skipped[0].status} — try again`)}catch(F){_(F.message),clearTimeout(v.current),v.current=setTimeout(()=>_(null),4e3)}finally{y(!1)}}async function I(){var N;if(!o){h(!0),clearTimeout(d.current),d.current=setTimeout(()=>h(!1),3e3);return}clearTimeout(d.current),h(!1),a(!0),u(null);try{const W=await eg(t);W!=null&&W.worktree&&((N=e.onSessionClosed)==null||N.call(e,n,W.worktree)),setTimeout(()=>{var F;return(F=e.onSessionsRestored)==null?void 0:F.call(e)},0)}catch(W){u(W.message),clearTimeout(c.current),c.current=setTimeout(()=>u(null),4e3)}finally{a(!1)}}return z.jsxs("div",{"data-dim-zone":"",className:`group/cell flex h-9 w-full items-center gap-2 border-b border-garage-line bg-garage-panel px-3 ${T?"bg-garage-amber/5":""} ${T?"dim-exempt":""} ${e.columnActive?"dim-focused":""}`,children:[z.jsx("span",{className:Yu(n.status),title:Ku(n.status),children:Uu(n.status)}),z.jsx("span",{className:`text-[13px] tracking-tight text-garage-ink ${D?"font-semibold":"font-medium"}`,children:n.label}),n.branch&&z.jsxs("span",{className:"max-w-[90px] shrink-0 truncate font-mono text-[11px] text-garage-faint",title:n.branch,children:["⎇ ",n.branch]}),z.jsx("span",{className:`ml-auto font-mono text-xs tabular-nums ${T?"font-semibold text-garage-amber":"text-garage-faint"}`,children:Xu(n.since)}),l&&z.jsx("span",{className:"max-w-[9rem] truncate text-garage-red",title:l,children:l}),g&&z.jsx("span",{className:"max-w-[9rem] truncate text-garage-red",title:g,children:g}),z.jsx("span",{className:"text-garage-faint transition-opacity group-hover/cell:opacity-0 group-focus-within/cell:opacity-0","aria-hidden":"true",children:"⋯"}),z.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity focus-within:opacity-100 group-hover/cell:opacity-100",children:[P&&z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{var W;N.stopPropagation(),(W=e.splitFrom)==null||W.call(e,t,"right")},title:"split right — new session beside this one",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"◫"}),P&&z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{var W;N.stopPropagation(),(W=e.splitFrom)==null||W.call(e,t,"below")},title:"split down — new session below this one",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"⬒"}),P&&((((B=e.viewAssignments)==null?void 0:B[t])??"main")!=="main"?z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{var W;N.stopPropagation(),(W=e.onRejoinCell)==null||W.call(e,t)},title:"rejoin the main view — back into the group",className:"rounded-md bg-garage-sel p-1 text-garage-ink hover:bg-garage-sel",children:"◱"}):z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{var W;N.stopPropagation(),(W=e.onDetachCell)==null||W.call(e,t)},title:"standalone — move this session to its own view (switch back anytime from the rail or view strip)",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"◲"})),z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{var W;N.stopPropagation(),(W=e.onHideCell)==null||W.call(e,t)},title:"Hide this cell for this page run (rail keeps it — click there to bring it back)",className:"rounded-md p-1 text-garage-faint hover:bg-garage-sel hover:text-garage-ink",children:"–"}),P&&z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),E()},disabled:S,title:b?"click again to restart — resumes the conversation":A?`restart this session — it is ${n.status}; a second click will restart it anyway`:"restart this session — resumes the conversation via claude --resume",className:`rounded-md p-1 disabled:opacity-40 ${b?"text-garage-red":"text-garage-faint hover:bg-garage-sel hover:text-garage-ink"}`,children:b?"sure?":"↻"}),P&&z.jsx("button",{type:"button",onMouseDown:N=>N.stopPropagation(),onClick:N=>{N.stopPropagation(),I()},disabled:w,title:o?"click again to close — kills the tmux session":"close this session — kills the tmux session",className:`rounded-md p-1 disabled:opacity-40 ${o?"text-garage-red":"text-garage-faint hover:bg-garage-sel hover:text-garage-red"}`,children:o?"sure?":"✕"})]})]})}function z0({api:p}){const e=J.useContext(gh),t=p.id,n=e.sessionsById.get(t),[o,h]=J.useState(!0),[w,a]=J.useState(0);if(!n)return null;const l=t===e.focusedSessionId,u=n.status==="restorable",d=e.restoringIds.has(t);return z.jsx("div",{onMouseDown:c=>{c.stopPropagation(),e.onFocusCell(t)},onFocus:()=>e.onFocusCell(t),"data-dim-zone":"","data-session-id":t,className:`flex h-full min-h-0 flex-col overflow-hidden rounded-lg border ${n.status==="needs-input"?"border-garage-amber":l?"cell-border-focused":"border-garage-line"} ${u?"opacity-70":""} ${n.status==="needs-input"?"dim-exempt":""} ${e.columnActive?"dim-focused":""}`,children:z.jsx("div",{className:"relative min-h-0 flex-1 p-1",children:u?z.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-garage-dim",children:[z.jsx("span",{className:"text-2xl",children:"⟳"}),z.jsx("span",{className:"text-xs",children:"no live terminal — session needs to be restored"}),z.jsx("button",{type:"button",onClick:()=>e.restoreOne(t),disabled:d,className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink disabled:opacity-40",children:"restore"}),e.restoreError&&z.jsx("span",{className:"max-w-[80%] text-center text-[11px] text-garage-red",children:e.restoreError})]}):z.jsxs(z.Fragment,{children:[z.jsx(S0,{id:t,onConnectionChange:h,reconnectSignal:w}),!o&&z.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-garage-bg/90 p-3 text-center",children:[z.jsx("span",{className:"text-xs text-garage-red",children:"connection to daemon lost"}),z.jsx("span",{className:"text-[11px] text-garage-dim",children:"the tmux session is still alive — only this view is detached"}),z.jsx("button",{type:"button",onClick:()=>a(c=>c+1),className:"rounded-md bg-garage-ink px-3 py-1 text-xs text-garage-bg hover:opacity-90",children:"reconnect now"})]})]})})})}const Bu="garage.hooksBannerDismissed",B0=6e4,H0=4e3;function F0({sessions:p}){const[e,t]=J.useState(()=>{try{return localStorage.getItem(Bu)==="1"}catch{return!1}}),[n,o]=J.useState(!0),[h,w]=J.useState({state:"idle",error:null,backup:null});if(J.useEffect(()=>{const d=setTimeout(()=>o(!1),B0);return()=>clearTimeout(d)},[]),J.useEffect(()=>{if(h.state!=="done")return;const d=setTimeout(()=>l(),H0);return()=>clearTimeout(d)},[h.state]),e||h.state!=="done"&&!n||p.length===0)return null;const a=p.every(d=>d.status==="working"||d.status==="idle");if(h.state==="idle"&&!a)return null;function l(){t(!0);try{localStorage.setItem(Bu,"1")}catch{}}async function u(){w({state:"busy",error:null,backup:null});try{const d=await Jm();w({state:"done",error:null,backup:d.backup??null})}catch(d){w({state:"idle",error:d.message,backup:null})}}return h.state==="done"?z.jsxs("div",{className:"flex flex-none items-center gap-3 bg-garage-sel px-4 py-2 text-xs text-garage-dim",children:[z.jsxs("span",{className:"text-garage-green",children:["✓ hooks installed — needs-input detection is now instant",h.backup&&z.jsx("span",{className:"text-garage-dim",children:" (backup saved next to settings.json)"})]}),z.jsx("button",{onClick:l,className:"ml-auto rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-line hover:text-garage-ink",children:"dismiss ×"})]}):z.jsxs("div",{className:"flex flex-none flex-wrap items-center gap-3 bg-garage-sel px-4 py-2 text-xs text-garage-dim",children:[z.jsx("span",{children:"Hooks make needs-input detection instant (without them, status lags the poller)."}),z.jsx("button",{onClick:u,disabled:h.state==="busy",className:"rounded-md bg-garage-panel px-3 py-1.5 text-[13px] text-garage-ink hover:bg-garage-line disabled:opacity-40",children:h.state==="busy"?"installing…":"install hooks for me"}),z.jsx("a",{href:"/api/hooks/snippet",target:"_blank",rel:"noreferrer",className:"text-garage-dim underline hover:text-garage-ink",children:"view the snippet instead"}),h.error&&z.jsx("span",{className:"max-w-[24rem] truncate text-garage-red",title:h.error,children:h.error}),z.jsx("button",{onClick:l,className:"ml-auto rounded-md px-2 py-1 text-xs text-garage-dim hover:bg-garage-line hover:text-garage-ink",children:"dismiss ×"})]})}function W0({onClose:p,onCreated:e,existingNames:t}){const[n,o]=J.useState("picking"),[h,w]=J.useState(""),[a,l]=J.useState(""),[u,d]=J.useState(null),[c,b]=J.useState(!1),C=J.useRef(!1);J.useEffect(()=>{if(C.current)return;C.current=!0;let _=!1;return Xm().then(m=>{if(!_){if(m!=null&&m.cancelled){p();return}w(m.dir),l(V0(m.dir,t)),o("confirm")}}).catch(()=>{_||o("manual")}),()=>{_=!0}},[]);function S(_){_.stopPropagation(),_.key==="Escape"&&p()}async function y(_,m){const v=_.trim(),D=m.trim();if(!(!v||!D||c)){b(!0),d(null);try{await Km(v,D),e()}catch(P){d(P.message),b(!1)}}}function g(){d(null),o("manual")}return n==="picking"?z.jsxs("div",{onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-72 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[z.jsx("p",{className:"text-xs text-garage-dim",children:"opening folder picker…"}),z.jsxs("div",{className:"flex items-center justify-between",children:[z.jsx("button",{type:"button",onClick:g,className:"rounded-md px-2 py-1 text-xs text-garage-dim underline hover:bg-garage-sel hover:text-garage-ink",children:"type a path instead"}),z.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"})]})]}):n==="confirm"?z.jsxs("form",{onSubmit:_=>{_.preventDefault(),y(a,h)},onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-80 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[z.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["name",z.jsx("input",{autoFocus:!0,value:a,onChange:_=>l(_.target.value),className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),z.jsx("p",{className:"truncate text-xs text-garage-faint",title:h,children:h}),u&&z.jsx("p",{className:"text-xs text-garage-red",children:u}),z.jsxs("div",{className:"flex items-center justify-between",children:[z.jsx("button",{type:"button",onClick:g,className:"rounded-md px-2 py-1 text-xs text-garage-dim underline hover:bg-garage-sel hover:text-garage-ink",children:"type a path instead"}),z.jsxs("div",{className:"flex gap-2",children:[z.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"}),z.jsx("button",{type:"submit",disabled:c||!a.trim()||!h.trim(),className:"rounded-md bg-garage-ink px-3 py-1.5 text-[13px] text-garage-bg hover:opacity-90 disabled:opacity-40",children:"save"})]})]})]}):z.jsxs("form",{onSubmit:_=>{_.preventDefault(),y(a,h)},onKeyDown:S,className:"absolute right-0 top-full z-10 mt-2 flex w-72 flex-col gap-3 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[z.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["name",z.jsx("input",{autoFocus:!0,value:a,onChange:_=>l(_.target.value),placeholder:"kowboy",className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),z.jsxs("label",{className:"flex flex-col gap-1.5 text-xs text-garage-dim",children:["dir",z.jsx("input",{value:h,onChange:_=>w(_.target.value),placeholder:"/Users/me/dev/kowboy",className:"rounded-md border border-garage-line bg-garage-bg px-3 py-1.5 text-[13px] text-garage-ink focus:border-garage-dim focus:outline-none"})]}),u&&z.jsx("p",{className:"text-xs text-garage-red",children:u}),z.jsxs("div",{className:"flex justify-end gap-2",children:[z.jsx("button",{type:"button",onClick:p,className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"cancel"}),z.jsx("button",{type:"submit",disabled:c||!a.trim()||!h.trim(),className:"rounded-md bg-garage-ink px-3 py-1.5 text-[13px] text-garage-bg hover:opacity-90 disabled:opacity-40",children:"register"})]})]})}function V0(p,e){const t=e instanceof Set?e:new Set(e??[]);let o=((p??"").split("/").filter(Boolean).pop()??"workspace").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(o||(o="workspace"),!t.has(o))return o;let h=2;for(;t.has(`${o}-${h}`);)h++;return`${o}-${h}`}var Il,Hu;function j0(){if(Hu)return Il;Hu=1,Il=d=>{if(!d)return[];if(typeof d!="string"||d.match(/^\s+$/))return[];const c=d.split(`
80
+ `);if(c.length===0)return[];const b=[];let C=null,S=null,y=0,g=0,_=null;const m=G=>{S==null||S.changes.push({type:"normal",normal:!0,ln1:y++,ln2:g++,content:G}),_.oldLines--,_.newLines--},v=G=>{const[X,oe]=t(G)??[];C={chunks:[],deletions:0,additions:0,from:X,to:oe},b.push(C)},D=()=>{(!C||C.chunks.length)&&v()},P=(G,X)=>{D(),C.new=!0,C.newMode=X[1],C.from="/dev/null"},T=(G,X)=>{D(),C.deleted=!0,C.oldMode=X[1],C.to="/dev/null"},A=(G,X)=>{D(),C.oldMode=X[1]},E=(G,X)=>{D(),C.newMode=X[1]},I=(G,X)=>{D(),C.index=G.split(" ").slice(1),X[1]&&(C.oldMode=C.newMode=X[1].trim())},B=G=>{D(),C.from=o(G)},N=G=>{D(),C.to=o(G)},W=G=>+(G||1),F=(G,X)=>{C||v(G);const[oe,ae,me,$]=X.slice(1);y=+oe,g=+me,S={content:G,changes:[],oldStart:+oe,oldLines:W(ae),newStart:+me,newLines:W($)},_={oldLines:W(ae),newLines:W($)},C.chunks.push(S)},q=G=>{S&&(S.changes.push({type:"del",del:!0,ln:y++,content:G}),C.deletions++,_.oldLines--)},V=G=>{S&&(S.changes.push({type:"add",add:!0,ln:g++,content:G}),C.additions++,_.newLines--)},K=G=>{if(!S)return;const[X]=S.changes.slice(-1);S.changes.push({type:X.type,[X.type]:!0,ln1:X.ln1,ln2:X.ln2,ln:X.ln,content:G})},ie=[[/^diff\s/,v],[/^new file mode (\d+)$/,P],[/^deleted file mode (\d+)$/,T],[/^old mode (\d+)$/,A],[/^new mode (\d+)$/,E],[/^index\s[\da-zA-Z]+\.\.[\da-zA-Z]+(\s(\d+))?$/,I],[/^---\s/,B],[/^\+\+\+\s/,N],[/^@@\s+-(\d+),?(\d+)?\s+\+(\d+),?(\d+)?\s@@/,F],[/^\$/,K]],Z=[[/^\$/,K],[/^-/,q],[/^\+/,V],[/^\s*/,m]],L=G=>{for(const[X,oe]of Z){const ae=G.match(X);if(ae){oe(G,ae);break}}_.oldLines===0&&_.newLines===0&&(_=null)},H=G=>{for(const[X,oe]of ie){const ae=G.match(X);if(ae){oe(G,ae);break}}},R=G=>{_?L(G):H(G)};for(const G of c)R(G);return b};const p=/(a|i|w|c|o|1|2)\/.*(?=["']? ["']?(b|i|w|c|o|1|2)\/)|(b|i|w|c|o|1|2)\/.*$/g,e=/^(a|b|i|w|c|o|1|2)\//,t=d=>{var c;return(c=d==null?void 0:d.match(p))==null?void 0:c.map(b=>b.replace(e,"").replace(/("|')$/,""))},n=/^\\?['"]|\\?['"]$/g,o=d=>{let c=h(d,"-+").trim();return c=a(c),c.replace(n,"").replace(e,"")},h=(d,c)=>{d=u(d);const b=l(c);return d.replace(new RegExp(`^${b}+`),"")},w=/\t.*|\d{4}-\d\d-\d\d\s\d\d:\d\d:\d\d(.\d+)?\s(\+|-)\d\d\d\d/,a=d=>{const c=w.exec(d);return c&&(d=d.substring(0,c.index).trim()),d},l=d=>d instanceof RegExp?d.source:`[${u(d).replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}]`,u=d=>`${d??""}`;return Il}var $0=j0();const jp=eh($0);function U0(p){if(!p)return[];let e;try{e=jp(p)}catch{return[]}const t=e[0];return!t||!t.chunks?[]:t.chunks.map(n=>({header:n.content,lines:n.changes.map(o=>({type:o.type,content:o.content,lineNumber:K0(o)}))}))}function K0(p){return p.type==="add"||p.type==="del"?p.ln:p.ln2??p.ln1}function Y0(p){var n,o;if(!p)return 1;let e;try{e=jp(p)}catch{return 1}const t=(o=(n=e[0])==null?void 0:n.chunks)==null?void 0:o[0];return t&&(t.newStart||t.oldStart)||1}function X0({file:p}){if(!p)return null;if(p.binary)return z.jsx("div",{className:"rounded-lg border border-garage-line px-3 py-2 text-xs text-garage-dim",children:"binary file"});const e=U0(p.diff);return z.jsxs("div",{className:"overflow-hidden rounded-lg border border-garage-line font-mono text-xs leading-relaxed",children:[p.truncated&&z.jsx("div",{className:"border-b border-garage-line bg-garage-sel px-3 py-1.5 text-garage-dim",children:'diff truncated — press "o" to open the full file in your editor'}),e.length===0&&z.jsx("div",{className:"px-3 py-2 text-garage-dim",children:"no diff content"}),e.map((t,n)=>z.jsxs("div",{children:[z.jsx("div",{className:"bg-garage-sel px-3 py-1.5 text-[11px] text-garage-dim",children:t.header}),t.lines.map((o,h)=>z.jsxs("div",{className:`flex px-3 ${q0(o.type)}`,children:[z.jsx("span",{className:"mr-3 w-8 shrink-0 select-none text-right tabular-nums text-garage-faint",children:o.lineNumber??""}),z.jsx("span",{className:"whitespace-pre-wrap break-all",children:o.content})]},h))]},n))]})}function q0(p){return p==="add"?"bg-garage-green/10 text-garage-ink":p==="del"?"bg-garage-red/10 text-garage-ink":"text-garage-dim"}function $p({files:p,selectedPath:e,emptyMessage:t="no changes"}){const n=J.useRef({});return J.useEffect(()=>{const o=n.current[e];o&&o.scrollIntoView({block:"nearest"})},[e]),p.length===0?z.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:t}):z.jsx("div",{children:p.map(o=>z.jsxs("div",{ref:h=>{n.current[o.path]=h},children:[z.jsx("div",{className:`sticky top-0 z-10 truncate border-b border-t border-garage-line bg-garage-panel px-3 py-1.5 font-mono text-xs ${o.path===e?"text-garage-ink":"text-garage-dim"}`,children:o.renamedFrom||o.oldPath?`${o.oldPath??o.renamedFrom} → ${o.path}`:o.path}),z.jsx(X0,{file:o})]},o.path))})}const Up="garage-pane-sizes",Ll={railW:240,paneW:360,paneSplit:.4};function vh(){try{const p=localStorage.getItem(Up);if(!p)return{...Ll};const e=JSON.parse(p);return{...Ll,...e}}catch{return{...Ll}}}function Mo(p){try{const e={...vh(),...p};localStorage.setItem(Up,JSON.stringify(e))}catch{}}function Jl(p,{onMove:e,onEnd:t}={}){p.preventDefault();const n=p.clientX,o=p.clientY,h=document.body.style.userSelect;document.body.style.userSelect="none";function w(l){const u=l.clientX-n,d=l.clientY-o;e==null||e(u,d)}function a(){window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",a),document.body.style.userSelect=h,t==null||t()}window.addEventListener("mousemove",w),window.addEventListener("mouseup",a)}const J0={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"?"};function Z0({workspace:p,branch:e,files:t,truncated:n,loading:o,error:h,collapsed:w,onToggleCollapse:a,emphasis:l,selectedPath:u,onSelectFile:d,onRefresh:c,onBlurChrome:b,columnActive:C,onActivateColumn:S,onEnterReview:y}){const[g,_]=J.useState(()=>vh().paneSplit),m=J.useRef(g);J.useEffect(()=>{m.current=g},[g]);const v=J.useRef(!0);J.useEffect(()=>{if(v.current){v.current=!1;return}const E=l==="diff"?.25:.65;_(E),Mo({paneSplit:E})},[l]);const D=J.useRef(null),[P,T]=J.useState(!1),A=J.useCallback(E=>{var W;E.stopPropagation();const I=((W=D.current)==null?void 0:W.getBoundingClientRect().height)||1,B=m.current;T(!0);let N=B;Jl(E,{onMove:(F,q)=>{N=Math.min(.85,Math.max(.15,B+q/I)),_(N)},onEnd:()=>{T(!1),Mo({paneSplit:N})}})},[]);return w?z.jsxs("button",{type:"button",onClick:a,onMouseDownCapture:S,title:"expand changes pane","aria-label":"expand changes pane",className:"flex h-full w-full flex-col items-center gap-2 border-l border-garage-line bg-garage-panel py-2 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:[z.jsx("span",{"aria-hidden":"true",children:"«"}),z.jsx("span",{className:"[writing-mode:vertical-rl]",children:"changes"})]}):z.jsxs("div",{onMouseDown:b,onMouseDownCapture:S,"data-dim-zone":!0,className:`flex h-full min-h-0 flex-col border-l border-garage-line bg-garage-panel ${C?"dim-focused":""}`,children:[z.jsxs("div",{className:"flex h-10 flex-none items-center gap-2 border-b border-garage-line px-3",children:[z.jsx("span",{className:"truncate text-[13px] font-medium text-garage-ink",children:p??"—"}),e&&z.jsxs("span",{className:"shrink-0 truncate font-mono text-[11px] text-garage-faint",title:e,children:["⎇ ",e]}),z.jsx("button",{type:"button",onClick:y,title:"full-screen review mode (r)",className:"ml-auto rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"review"}),z.jsx("button",{type:"button",onClick:c,title:"refresh diff",className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"↻"}),z.jsx("button",{type:"button",onClick:a,title:"collapse changes pane",className:"rounded-md px-2.5 py-1 text-xs text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"»"})]}),h&&z.jsx("div",{className:"flex-none border-b border-garage-line px-3 py-1 text-[11px] text-garage-red",children:h}),n&&z.jsx("div",{className:"flex-none border-b border-garage-line bg-garage-sel px-3 py-1 text-[11px] text-garage-dim",children:"response truncated — some files show stats only"}),z.jsxs("div",{ref:D,className:"flex min-h-0 flex-1 flex-col",children:[z.jsxs("div",{className:"min-h-0 overflow-y-auto",style:{flexBasis:`${g*100}%`,flexGrow:0,flexShrink:0},children:[o&&t.length===0&&z.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"loading…"}),!o&&t.length===0&&z.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no changes"}),t.map(E=>z.jsxs("button",{type:"button",onClick:()=>d(E.path),className:`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-2 rounded-md px-3 py-1.5 text-left text-[13px] ${E.path===u?"bg-garage-sel":"hover:bg-garage-sel"}`,children:[z.jsx("span",{className:"font-mono text-[11px] text-garage-faint",children:J0[E.changeType]??"?"}),z.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-garage-dim",children:E.path}),E.binary&&z.jsx("span",{className:"shrink-0 text-xs text-garage-faint",children:"bin"}),E.truncated&&z.jsx("span",{className:"shrink-0 text-xs text-garage-dim",children:"trunc"}),!E.binary&&z.jsxs("span",{className:"shrink-0 font-mono text-xs tabular-nums",children:[z.jsxs("span",{className:"text-garage-green",children:["+",E.additions??0]})," ",z.jsxs("span",{className:"text-garage-red",children:["−",E.deletions??0]})]})]},E.path))]}),z.jsx("div",{role:"separator","aria-orientation":"horizontal",className:`row-divider ${P?"is-dragging":""}`,onMouseDown:A}),z.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:z.jsx($p,{files:t,selectedPath:u})})]})]})}const Q0="garage-viewed:";function Zl(p){let e=5381;const t=p??"";for(let n=0;n<t.length;n++)e=e*33^t.charCodeAt(n);return(e>>>0).toString(36)}function Kp(p){return`${Q0}${p}`}function _h(p){if(!p)return{};try{const e=localStorage.getItem(Kp(p));return e?JSON.parse(e):{}}catch{return{}}}function Yp(p,e){try{localStorage.setItem(Kp(p),JSON.stringify(e))}catch{}}function ew(p,e,t){if(!p)return{};const n=_h(p);return n[e]=t,Yp(p,n),n}function tw(p,e){if(!p)return;const t=_h(p),n=new Set(e);let o=!1;for(const h of Object.keys(t))n.has(h)||(delete t[h],o=!0);o&&Yp(p,t)}function Fu(p,e){return!e||!p?!1:p[e.path]===Zl(e.diff??"")}function iw({workspace:p,files:e,truncated:t,selectedPath:n,onSelectFile:o,viewedMap:h,onOpenRoot:w}){const a=e.filter(l=>Fu(h,l)).length;return z.jsxs("div",{className:"fixed inset-0 z-50 flex bg-garage-bg font-mono text-sm text-garage-ink",children:[z.jsxs("div",{className:"flex w-[280px] flex-none flex-col border-r border-garage-line bg-garage-panel",children:[z.jsxs("div",{className:"flex h-12 flex-none items-center gap-2 border-b border-garage-line px-4",children:[z.jsx("span",{className:"truncate text-[15px] font-semibold text-garage-ink",children:p}),z.jsx("button",{type:"button",onClick:()=>w(p),title:"open workspace root in editor",className:"ml-auto shrink-0 rounded-md px-2 py-1 text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"⧉"})]}),z.jsxs("div",{className:"flex-none border-b border-garage-line px-3 py-1.5 text-xs text-garage-dim",children:[a,"/",e.length," viewed",t&&z.jsx("span",{className:"ml-2 text-garage-dim",children:"(response truncated)"})]}),z.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[e.length===0&&z.jsx("p",{className:"px-3 py-2 text-xs text-garage-dim",children:"no changes"}),e.map(l=>{const u=Fu(h,l),d=l.path===n;return z.jsxs("button",{type:"button",onClick:()=>o(l.path),className:`mx-1.5 flex w-[calc(100%-0.75rem)] items-center gap-2 rounded-md px-3 py-1.5 text-left text-[13px] ${d?"bg-garage-sel":"hover:bg-garage-sel"} ${u?"opacity-60":""}`,children:[z.jsx("span",{className:u?"text-garage-green":"text-garage-faint",children:u?"✓":"·"}),z.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-garage-dim",children:l.path})]},l.path)})]}),z.jsx("div",{className:"flex-none border-t border-garage-line px-3 py-1.5 font-mono text-[11px] text-garage-dim",children:"j/k files · v viewed · o editor · Esc exit"})]}),z.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:z.jsx($p,{files:e,selectedPath:n,emptyMessage:"no changes to review"})})]})}const sw=[{label:"workspace",items:[{keys:"1 – 9",action:"switch focused workspace to the Nth in rail order"},{keys:"a",action:"jump to a session that needs input (any workspace)"}]},{label:"grid",items:[{keys:"[ / ]",action:"cycle focused terminal within the current workspace"},{keys:"\\",action:"split the focused cell right (spawns a new session there)"},{keys:"m",action:"maximize the focused cell ⇄ restore the grid"},{keys:"Ctrl + `",action:"release keys from the focused terminal → back to garage"}]},{label:"review",items:[{keys:"Tab",action:"changes pane: toggle list ⇄ diff emphasis"},{keys:"j / k",action:"next / previous changed file"},{keys:"r",action:"enter full-screen review mode"},{keys:"v",action:"review mode: mark file viewed, advance to next unviewed"},{keys:"o",action:"open selected file — or the workspace root if none — in the editor"}]},{label:"general",items:[{keys:"?",action:"toggle this help overlay"},{keys:"Esc",action:"close this help, else exit review mode"}]}],nw=[{status:"needs-input",name:"needs input",meaning:"Claude is waiting on you — permission prompt, question, or plan approval"},{status:"working",name:"running",meaning:"Claude is working — nothing to do yet"},{status:"done",name:"responded",meaning:"finished its turn since you last looked at it"},{status:"idle",name:"idle",meaning:"waiting for your next prompt"},{status:"restorable",name:"restorable",meaning:"tmux session died (e.g. reboot) — the conversation can be resumed"}];function rw({onClose:p}){return z.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/20",onMouseDown:e=>{e.target===e.currentTarget&&p()},children:z.jsxs("div",{className:"max-h-[92vh] w-[560px] max-w-[90vw] overflow-y-auto rounded-xl border border-garage-line bg-garage-bg p-6 shadow-sm",children:[z.jsxs("div",{className:"mb-5 flex items-center gap-3",children:[z.jsx("span",{className:"text-[15px] font-semibold text-garage-ink",children:"keybindings"}),z.jsx("span",{className:"text-xs text-garage-dim",children:"? or Esc to close"}),z.jsx("button",{type:"button",onClick:p,className:"ml-auto rounded-md px-2 py-1 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"×"})]}),sw.map(e=>z.jsxs("div",{className:"mb-5 last:mb-0",children:[z.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-wider text-garage-faint",children:e.label}),z.jsx("dl",{className:"grid grid-cols-[auto_1fr] items-baseline gap-x-5 gap-y-2",children:e.items.map(t=>z.jsxs(Te.Fragment,{children:[z.jsx("dt",{children:z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:t.keys})}),z.jsx("dd",{className:"text-[13px] text-garage-ink",children:t.action})]},t.keys))})]},e.label)),z.jsxs("div",{className:"mt-6 border-t border-garage-line pt-5",children:[z.jsx("p",{className:"mb-2 text-[11px] uppercase tracking-wider text-garage-faint",children:"status legend"}),z.jsx("div",{className:"flex flex-col gap-2.5",children:nw.map(e=>z.jsxs("div",{className:"flex items-start gap-3",children:[z.jsx("span",{className:`w-4 shrink-0 text-center text-[13px] ${Ml[e.status]}`,children:Rl[e.status]}),z.jsx("span",{className:"w-24 shrink-0 text-[13px] font-medium text-garage-ink",children:e.name}),z.jsx("span",{className:"text-xs text-garage-dim",children:e.meaning})]},e.status))})]})]})})}const ow={cat:"Arthur",duck:"Papito",pup:"Segan"},Wu=[{value:"off",label:"no pet",description:"the strip stays empty"},{value:"cat",label:"Arthur the shop cat",description:"aloof; saunters over when you're needed, kneads when all clear"},{value:"duck",label:"Papito the rubber duck",description:"deadpan; waddles, and alerts with a single motionless stare"},{value:"pup",label:"Segan the pit pup",description:"eager; sprints to problems, zoomies when the wall is clear"}],aw={cat:{speed:10,frameEvery:2,alertBounce:"bounce-small",waddle:!1,deadpan:!1,aloof:.4,zoomies:!1,celebrateMs:3e3},duck:{speed:6,frameEvery:3,alertBounce:null,waddle:!0,deadpan:!0,aloof:0,zoomies:!1,celebrateMs:1100},pup:{speed:20,frameEvery:1,alertBounce:"bounce-big",waddle:!1,deadpan:!1,aloof:0,zoomies:!0,celebrateMs:3400}},lw={cat:{sleep:[[" /\\_/\\ ","( -.- ) z ",' (")_(") '],[" /\\_/\\ ","( -.- ) z",' (")_(") ']],watch:[[" /\\_/\\ ","( o.o )"," > ^ < "],[" /\\_/\\ ","( o.o )"," > ^ <"]],alert:[[" /\\_/\\ ","( O_O )"," /| |\\ "],[" /\\_/\\ ","( O_O )"," /|_|\\ "]],box:[["┌─────┐","│ -.- │","└─────┘"],["┌─────┐","│ o.o │","└─────┘"]],celebrate:[[" /\\_/\\ ","( ^.^ )"," >^ ^< "],[" /\\_/\\ ","( ^.^ )"," >^^ < "]]},duck:{sleep:[[" __ "," <(- )___ z"," `-----' "],[" __ "," <(- )___ "," `-----' z"]],watch:[[" __ "," <(o )___ "," `-----' "],[" __ "," <(- )___ "," `-----' "]],alert:[[" __ "," <(O )___ "," `-----' "]],box:[["┌─────┐","│ (o )>│","└─────┘"]],celebrate:[[" \\ __ / "," <(o )___ "," `-----' "],[" \\__/ "," <(o )___ "," `-----' "]]},pup:{sleep:[[" ∧_∧ "," (-ᴥ-) z"," |u u| "],[" ∧_∧ "," (-ᴥ-) "," |u u| z"]],watch:[[" ∧_∧ "," (·ᴥ·) "," |u u|"],[" ∧_∧ "," (·ᴥ·)/ "," |u u|"]],alert:[[" ∧ ∧ "," (°ᴥ°) "," |U U|"],[" ∧ ∧ "," (°ᴥ°) "," /|U U|"]],box:[["┌─────┐","│ ·ᴥ· │","└─────┘"]],celebrate:[["\\ ∧_∧ /"," (^ᴥ^) "," |u u|"],[" \\∧_∧/ "," (^ᴥ^) "," |u u|"]]}};function Vu({sessions:p,connState:e}){return e!=="live"?"box":p.length===0?"sleep":p.some(t=>t.status==="needs-input")?"alert":p.some(t=>t.status==="working")?"watch":"sleep"}const hw=300;function cw({sessions:p,connState:e,onJump:t}){const[n]=mn(),o=n.pet??"off",h=J.useRef(null),w=J.useRef(null),a=J.useRef({sessions:p,connState:e});J.useEffect(()=>{a.current={sessions:p,connState:e}},[p,e]);const l=J.useRef(t);J.useEffect(()=>{l.current=t},[t]);const u=J.useRef({x:460,target:460,frame:0,tick:0,celebrateUntil:0,prevNeeds:0});return J.useEffect(()=>{if(o==="off")return;const d=aw[o],c=lw[o],b=u.current;function C(){const y=h.current,g=w.current;if(!y||!g)return;b.tick++;const{sessions:_,connState:m}=a.current,v=Date.now(),D=_.filter(N=>N.status==="needs-input").length;b.prevNeeds>0&&D===0&&_.length>0&&(b.celebrateUntil=v+d.celebrateMs),b.prevNeeds=D;const P=v<b.celebrateUntil?"celebrate":Vu({sessions:_,connState:m}),T=Math.max(120,window.innerWidth-160);if(P==="alert")b.target=16;else if(P==="celebrate"&&d.zoomies)b.tick%3===0&&(b.target=b.target<T/2?T-40:40);else if(P!=="box"&&P!=="celebrate"&&Math.random()<.05){const N=80+Math.random()*(T-80);Math.random()>=(d.aloof||0)&&(b.target=N)}const A=P==="celebrate"&&d.zoomies?d.speed*2:d.speed;b.x+=Math.max(-A,Math.min(A,b.target-b.x)),b.x=Math.max(8,Math.min(T,b.x)),y.style.left=`${Math.round(b.x)}px`;const E=Math.abs(b.target-b.x)>6;b.tick%d.frameEvery===0&&b.frame++;const I=c[P]??c.watch;g.textContent=I[b.frame%I.length].join(`
81
+ `),y.classList.toggle("alert",P==="alert"),y.classList.toggle("deadpan",!!d.deadpan),y.classList.toggle("waddle",!!d.waddle&&E),y.classList.toggle("bounce-big",d.alertBounce==="bounce-big"&&(P==="alert"||P==="celebrate"&&d.zoomies)),y.classList.toggle("bounce-small",d.alertBounce==="bounce-small"&&P==="alert");const B=ow[o]??"pit pet";y.title=P==="alert"?`${D} session${D===1?"":"s"} need${D===1?"s":""} input — click to jump`:`${B} — ${P==="box"?"hiding until the daemon is back":P==="celebrate"?"all clear!":`${P}ing`}`}const S=setInterval(C,hw);return C(),()=>clearInterval(S)},[o]),o==="off"?null:z.jsxs("div",{ref:h,role:"button","aria-label":"pit pet — click to jump to a session that needs input",className:"pit-pet",onClick:()=>{var b;const{sessions:d,connState:c}=a.current;Vu({sessions:d,connState:c})==="alert"?(b=l.current)==null||b.call(l):u.current.celebrateUntil=Date.now()+1200},children:[z.jsx("span",{className:"pit-pet-bubble",children:"!"}),z.jsx("pre",{ref:w})]})}function dw(p,e){const t=new Map;for(const o of p??[])t.set(o.name,{name:o.name,dir:o.dir,branch:o.branch??null,registered:!0,sessions:[]});for(const o of e??[]){let h=t.get(o.workspace);h||(h={name:o.workspace,dir:o.dir,registered:!1,sessions:[]},t.set(o.workspace,h)),h.sessions.push(o)}const n=[...t.values()];return n.sort((o,h)=>gs(Ql(o))-gs(Ql(h))),n.map(o=>({...o,sessions:[...o.sessions].sort((h,w)=>gs(h.status==="needs-input")-gs(w.status==="needs-input"))}))}function Ql(p){return p.sessions.some(e=>e.status==="needs-input")}function gs(p){return p?0:1}function uw(p,e){const t=dw(p,e),n=new Map(t.map(c=>[c.name,c])),o=new Map;for(const c of t){if(!c.dir)continue;let b=null;for(const C of t)C===c||!C.dir||pw(c.dir,C.dir)&&(!b||C.dir.length>b.dir.length)&&(b=C);b&&o.set(c.name,b.name)}const h=new Map;for(const c of t){const b=o.get(c.name);b&&(h.has(b)||h.set(b,[]),h.get(b).push(c))}function w(c){const b=n.get(c);return b&&Ql(b)?!0:(h.get(c)??[]).some(C=>w(C.name))}function a(c,b){const C=[...h.get(c.name)??[]].sort((S,y)=>gs(w(S.name))-gs(w(y.name)));return{...c,depth:b,children:C.map(S=>a(S,b+1))}}const u=t.filter(c=>!o.has(c.name)).sort((c,b)=>gs(w(c.name))-gs(w(b.name))).map(c=>a(c,0)),d=[];return(function c(b){for(const C of b)d.push(C),c(C.children)})(u),{tree:u,flattenedGroups:d}}function pw(p,e){if(!p||!e||p===e)return!1;const t=e.endsWith("/")?e:`${e}/`;return p.startsWith(t)}const ju=[{key:"focusDim",label:"focus dimming",description:"dim everything except the focused surface; needs-input never dims"},{key:"notifyBrowser",label:"browser notifications",description:"notify when a session needs input while this tab is hidden — clicking jumps to it",onEnable:()=>{typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission().catch(()=>{})}}];function fw(){const[p,e]=J.useState(!1),[t,n]=mn(),o=J.useRef(null);return J.useEffect(()=>{if(!p)return;function h(a){o.current&&!o.current.contains(a.target)&&e(!1)}function w(a){a.key==="Escape"&&(a.stopPropagation(),e(!1))}return document.addEventListener("mousedown",h),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",h),document.removeEventListener("keydown",w)}},[p]),z.jsxs("div",{ref:o,className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>e(h=>!h),title:"settings","aria-label":"settings","aria-expanded":p,className:"rounded-md px-2 py-1 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"⚙"}),p&&z.jsxs("div",{role:"menu","aria-label":"settings",className:"absolute right-0 top-full z-10 mt-2 w-80 rounded-xl border border-garage-line bg-garage-bg p-4 shadow-sm",children:[z.jsx("p",{className:"px-1 pb-1.5 text-[11px] uppercase tracking-wider text-garage-faint",children:"settings"}),ju.map((h,w)=>{const a=!!t[h.key];return z.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":a,onClick:()=>{var l;a||(l=h.onEnable)==null||l.call(h),n({[h.key]:!a})},className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<ju.length-1?"border-b border-garage-line":""}`,children:[z.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"[x]":"[ ]"}),z.jsxs("span",{className:"flex flex-col gap-0.5",children:[z.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),z.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.key)}),z.jsx("p",{className:"px-1 pb-1.5 pt-4 text-[11px] uppercase tracking-wider text-garage-faint",children:"theme"}),Ru.map((h,w)=>{const a=(t.theme??"light")===h.value;return z.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a,onClick:()=>n({theme:h.value}),className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<Ru.length-1?"border-b border-garage-line":""}`,children:[z.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"(•)":"( )"}),z.jsxs("span",{className:"flex flex-col gap-0.5",children:[z.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),z.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.value)}),z.jsx("p",{className:"px-1 pb-1.5 pt-4 text-[11px] uppercase tracking-wider text-garage-faint",children:"pit pet"}),Wu.map((h,w)=>{const a=(t.pet??"off")===h.value;return z.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":a,onClick:()=>n({pet:h.value}),className:`flex w-full items-start gap-3 rounded-md px-1 py-2 text-left hover:bg-garage-sel ${w<Wu.length-1?"border-b border-garage-line":""}`,children:[z.jsx("span",{className:`shrink-0 whitespace-nowrap font-mono text-[13px] ${a?"text-garage-ink":"text-garage-faint"}`,children:a?"(•)":"( )"}),z.jsxs("span",{className:"flex flex-col gap-0.5",children:[z.jsx("span",{className:"text-[13px] text-garage-ink",children:h.label}),z.jsx("span",{className:"text-xs text-garage-dim",children:h.description})]})]},h.value)})]})]})}const Xp="garage-views:",_i="main";function mw(p){try{const e=localStorage.getItem(`${Xp}${p}`),t=e?JSON.parse(e):null;return{assignments:(t==null?void 0:t.assignments)??{},focused:(t==null?void 0:t.focused)??_i}}catch{return{assignments:{},focused:_i}}}function rr(p,e){try{localStorage.setItem(`${Xp}${p}`,JSON.stringify(e))}catch{}}function gw(p,e){const t=new Map;t.set(_i,[]);for(const o of p){const h=e[o.id]??_i;t.has(h)||t.set(h,[]),t.get(h).push(o)}const n=[];for(const[o,h]of t)h.length!==0&&n.push({name:o,sessions:h,needsCount:h.filter(w=>w.status==="needs-input").length});return n}function vw(p,e){return p[e]??_i}function _w(p,e){const t=new Set(e),n=p||"view";if(n!==_i&&!t.has(n))return n;let o=2;for(;t.has(`${n}-${o}`)||`${n}-${o}`===_i;)o++;return`${n}-${o}`}const ww=crypto.randomUUID(),bw=3e4,yw=3e3;function Sw(){var pr;const[p,e]=J.useState([]),[t,n]=J.useState([]),[o,h]=J.useState(null),[w,a]=J.useState(null),[l,u]=J.useState(null),[d,c]=J.useState(!1),[b,C]=J.useState("reconnecting"),[S,y]=J.useState(null),[g,_]=J.useState(null),m=J.useRef(null),[v,D]=J.useState("grid"),P=J.useCallback(()=>D("rail"),[]),T=J.useCallback(()=>D("grid"),[]),A=J.useCallback(()=>D("pane"),[]),[E,I]=J.useState(()=>vh()),{railW:B,paneW:N}=E,W=J.useRef(E);J.useEffect(()=>{W.current=E},[E]);const[F,q]=J.useState(null),V=J.useCallback(ne=>{ne.stopPropagation();const he=W.current.railW;q("rail");let ue=he;Jl(ne,{onMove:De=>{ue=Math.min(420,Math.max(160,he+De)),I(Oe=>({...Oe,railW:ue}))},onEnd:()=>{q(null),Mo({railW:ue})}})},[]),K=J.useCallback(ne=>{ne.stopPropagation();const he=W.current.paneW;q("pane");let ue=he;Jl(ne,{onMove:De=>{ue=Math.min(680,Math.max(240,he-De)),I(Oe=>({...Oe,paneW:ue}))},onEnd:()=>{q(null),Mo({paneW:ue})}})},[]),[ie,Z]=J.useState([]),[L,H]=J.useState(!1),[R,G]=J.useState(!1),[X,oe]=J.useState(null),[ae,me]=J.useState(null),[$,O]=J.useState(!1),[le,se]=J.useState("list"),[ge,fe]=J.useState(null),[Me,We]=J.useState(!1),[je,ot]=J.useState({}),[Ae,ve]=J.useState(null),[Ie,$e]=J.useState(!1),[st,Dt]=J.useState(()=>new Set),{flattenedGroups:Ne}=J.useMemo(()=>uw(p,t),[p,t]),[Si,At]=J.useState(0),mt=J.useCallback(()=>At(ne=>ne+1),[]),ut=J.useMemo(()=>{var he;const ne={};for(const ue of Ne){const De=mw(ue.name),Oe=gw(ue.sessions,De.assignments),Be=Oe.some(Xe=>Xe.name===De.focused)?De.focused:((he=Oe[0])==null?void 0:he.name)??_i;ne[ue.name]={views:Oe,focused:Be,assignments:De.assignments}}return ne},[Ne,Si]),Ke=w?ut[w]:null,li=(Ke==null?void 0:Ke.focused)??_i,gt=J.useMemo(()=>{if(!Ke||Ke.views.length<=1)return null;const ne=Ke.views.find(he=>he.name===li);return ne?new Set(ne.sessions.map(he=>he.id)):null},[Ke,li]),Rt=J.useCallback((ne,he)=>{const ue=ut[ne];if(!ue)return;rr(ne,{assignments:ue.assignments,focused:he}),mt(),a(ne);const De=ue.views.find(Oe=>Oe.name===he);De!=null&&De.sessions[0]&&u(De.sessions[0].id)},[ut,mt]),Ye=J.useCallback((ne,he)=>{var jt;const ue=ut[ne];if(!ue)return;const De=Ne.find(Ot=>Ot.name===ne),Oe=((jt=De==null?void 0:De.sessions.find(Ot=>Ot.id===he))==null?void 0:jt.label)??"view",Be=_w(Oe,ue.views.map(Ot=>Ot.name)),Xe={...ue.assignments,[he]:Be};rr(ne,{assignments:Xe,focused:Be}),mt(),u(he)},[ut,Ne,mt]),Bs=J.useCallback((ne,he)=>{const ue=ut[ne];if(!ue)return;const De={...ue.assignments};delete De[he],rr(ne,{assignments:De,focused:_i}),mt(),u(he)},[ut,mt]),dr=J.useCallback((ne,he)=>{const ue=ut[ne];if(!ue||ue.focused===_i)return;const De={...ue.assignments,[he]:ue.focused};rr(ne,{assignments:De,focused:ue.focused}),mt()},[ut,mt]);J.useEffect(()=>{if(!w||!l)return;const ne=ut[w];if(!ne||ne.views.length<=1)return;const he=vw(ne.assignments,l);he!==ne.focused&&ne.views.some(ue=>ue.name===he)&&(rr(w,{assignments:ne.assignments,focused:he}),mt())},[w,l,ut,mt]);const[gn]=mn();g0(),J.useEffect(()=>{let ne=!1,he;async function ue(){try{const[De,Oe]=await Promise.all([eu(),Ao()]);if(ne)return;e(De),n(Oe),h(null)}catch(De){if(ne)return;h(De.message),he=setTimeout(ue,yw)}}return ue(),()=>{ne=!0,clearTimeout(he)}},[]);const hi=J.useCallback(()=>Ao().then(n).catch(ne=>h(ne.message)),[]),Hs=J.useCallback(()=>{eu().then(e).catch(ne=>h(ne.message))},[]),ws=J.useRef(w);J.useEffect(()=>{ws.current=w},[w]);const bs=J.useRef(t);J.useEffect(()=>{bs.current=t},[t]);const Fs=J.useRef(l);J.useEffect(()=>{Fs.current=l},[l]);const Mt=J.useCallback(ne=>{ne&&(G(!0),Ym(ne,Fs.current).then(he=>{const ue=he.files??[];Z(ue),H(!!he.truncated),oe(null),me(he.branch??null),tw(ne,ue.map(De=>De.path))}).catch(he=>{oe(he.message),Z([]),me(null)}).finally(()=>G(!1)))},[]);J.useEffect(()=>{w&&Mt(w)},[w,l,Mt]),J.useEffect(()=>{const ne=new EventSource("/api/events");let he=!1;return ne.addEventListener("open",()=>{C("live"),he&&hi(),he=!0}),ne.addEventListener("error",()=>C("reconnecting")),ne.addEventListener("status",ue=>{let De;try{De=JSON.parse(ue.data)}catch{return}const{id:Oe,status:Be,since:Xe}=De;if(Be==="done"){const jt=bs.current.find(Ot=>Ot.id===Oe);jt&&jt.workspace===ws.current&&Mt(ws.current)}n(jt=>jt.map(Ot=>Ot.id===Oe?{...Ot,status:Be,since:Xe??Ot.since}:Ot))}),ne.addEventListener("sessions",hi),()=>ne.close()},[hi,Mt]),J.useEffect(()=>{const ne=()=>Zm(ww,document.visibilityState==="visible");ne(),document.addEventListener("visibilitychange",ne);const he=setInterval(()=>{document.visibilityState==="visible"&&ne()},bw);return()=>{document.removeEventListener("visibilitychange",ne),clearInterval(he)}},[]),J.useEffect(()=>{let ne;const he=()=>{clearTimeout(ne),ne=setTimeout(()=>{const ue=document.activeElement,De=ue&&ue.closest?ue.closest(".xterm"):null,Oe=De?De.closest("[data-session-id]"):null;y((Oe==null?void 0:Oe.dataset.sessionId)??null)},0)};return window.addEventListener("focusin",he),window.addEventListener("focusout",he),he(),()=>{clearTimeout(ne),window.removeEventListener("focusin",he),window.removeEventListener("focusout",he)}},[]),J.useEffect(()=>{if(!S){_(null);return}const ne=bs.current.find(ue=>ue.id===S);_({label:(ne==null?void 0:ne.label)??S.split("/").pop()});const he=setTimeout(()=>_(null),4200);return()=>clearTimeout(he)},[S]);const Vt=J.useMemo(()=>t.filter(ne=>ne.status==="needs-input").length,[t]);J.useEffect(()=>{document.title=Vt>0?`(${Vt}) claude-garage`:"claude-garage"},[Vt]);const vn=J.useRef(new Set),ys=J.useRef(null);J.useEffect(()=>{var Be;const ne=new Set(t.filter(Xe=>Xe.status==="needs-input").map(Xe=>Xe.id)),he=vn.current;if(vn.current=ne,!gn.notifyBrowser||typeof Notification>"u"||Notification.permission!=="granted"||document.visibilityState!=="hidden")return;const ue=[...ne].filter(Xe=>!he.has(Xe));if(ue.length===0)return;const De=((Be=t.find(Xe=>Xe.id===ue[0]))==null?void 0:Be.label)??ue[0],Oe=ue.length===1?`${De} needs input`:`${ue.length} sessions need input`;try{const Xe=new Notification("claude-garage",{body:Oe,tag:"garage-needs-input"});Xe.onclick=()=>{var jt;window.focus(),(jt=ys.current)==null||jt.call(ys),Xe.close()}}catch{}},[t,gn.notifyBrowser]);const _n=J.useRef(!1),Yi=J.useRef(null);J.useEffect(()=>{const ne=window.matchMedia("(max-width: 1080px)"),he=()=>{ne.matches?Yi.current===null&&(Yi.current=_n.current,O(!0)):Yi.current!==null&&(O(Yi.current),Yi.current=null)};return he(),ne.addEventListener("change",he),()=>ne.removeEventListener("change",he)},[]),J.useEffect(()=>{_n.current=$},[$]),J.useEffect(()=>{if(!(w&&Ne.some(ne=>ne.name===w))&&Ne.length>0){const ne=Oe=>Oe&&Ne.some(Be=>Be.name===Oe),he=new URLSearchParams(window.location.search).get("ws");let ue=null;try{ue=localStorage.getItem("garage-last-workspace")}catch{}const De=ne(he)?he:ne(ue)?ue:Ne[0].name;a(De)}},[Ne,w]),J.useEffect(()=>{if(!w)return;try{localStorage.setItem("garage-last-workspace",w)}catch{}const ne=new URLSearchParams(window.location.search);ne.get("ws")!==w&&(ne.set("ws",w),window.history.replaceState(null,"",`?${ne.toString()}`))},[w]),J.useEffect(()=>{var he;const ne=Ne.find(ue=>ue.name===w);if(ne&&!ne.sessions.some(ue=>ue.id===l)){const ue=ne.sessions.find(De=>!st.has(De.id)&&(!gt||gt.has(De.id)))??ne.sessions.find(De=>!st.has(De.id));u((ue==null?void 0:ue.id)??((he=ne.sessions[0])==null?void 0:he.id)??null)}},[Ne,w,l,st,gt]);const Ws=J.useCallback(ne=>{a(ne)},[]),wn=J.useCallback((ne,he)=>{a(ne),u(he),Dt(ue=>{if(!ue.has(he))return ue;const De=new Set(ue);return De.delete(he),De})},[]),ur=J.useCallback(ne=>{Dt(he=>{if(he.has(ne))return he;const ue=new Set(he);return ue.add(ne),ue}),u(he=>{if(he!==ne)return he;const ue=Ne.find(Oe=>Oe.sessions.some(Be=>Be.id===ne));if(!ue)return he;const De=ue.sessions.findIndex(Oe=>Oe.id===ne);for(let Oe=1;Oe<=ue.sessions.length;Oe++){const Be=ue.sessions[(De+Oe)%ue.sessions.length];if(Be.id!==ne&&!st.has(Be.id))return Be.id}return null})},[Ne,st]),Ri=J.useCallback(ne=>{const he=Ne.find(Be=>Be.name===w);if(!he||he.sessions.length===0)return;const ue=he.sessions.filter(Be=>!st.has(Be.id));if(ue.length===0)return;const Oe=(ue.findIndex(Be=>Be.id===l)+ne+ue.length)%ue.length;u(ue[Oe].id)},[Ne,w,l,st]);J.useEffect(()=>{ys.current=Mi});const Mi=J.useCallback(()=>{for(const ne of Ne){const he=ne.sessions.find(ue=>ue.status==="needs-input");if(he){a(ne.name),u(he.id),Dt(ue=>{if(!ue.has(he.id))return ue;const De=new Set(ue);return De.delete(he.id),De});return}}},[Ne]),Xt=J.useCallback(()=>{const ne=document.activeElement;ne&&ne.closest(".xterm")&&ne.blur()},[]);J.useEffect(()=>{if(ie.length===0){fe(null);return}ie.some(ne=>ne.path===ge)||fe(ie[0].path)},[ie,ge]),J.useEffect(()=>{ot(_h(w))},[w,ie]);const bn=J.useCallback(ne=>{if(ie.length===0)return;const he=ie.findIndex(De=>De.path===ge),ue=he===-1?0:(he+ne+ie.length)%ie.length;fe(ie[ue].path)},[ie,ge]),Xi=J.useCallback(()=>{if(!w||!ge)return;const ne=ie.findIndex(Oe=>Oe.path===ge);if(ne===-1)return;const he=ie[ne],ue=Zl(he.diff??""),De=ew(w,ge,ue);ot(De);for(let Oe=1;Oe<ie.length;Oe++){const Be=ie[(ne+Oe)%ie.length];if(De[Be.path]!==Zl(Be.diff??"")){fe(Be.path);return}}},[w,ge,ie]),Ss=J.useCallback(()=>{if(!w)return;const ne=ge?ie.find(he=>he.path===ge):null;if(!ne){ko(w).catch(he=>ve(he.message));return}ko(w,ne.path,Y0(ne.diff)).catch(he=>ve(he.message))},[w,ge,ie]),Cs=J.useCallback(ne=>{ko(ne).catch(he=>ve(he.message))},[]),xs=J.useCallback(()=>{w&&(Xt(),Mt(w),We(!0))},[w,Xt,Mt]);J.useEffect(()=>{if(!Ae)return;const ne=setTimeout(()=>ve(null),5e3);return()=>clearTimeout(ne)},[Ae]),J.useEffect(()=>{function ne(he){var ue,De,Oe,Be;if(!(he.metaKey||he.ctrlKey||he.altKey)&&!(document.activeElement&&document.activeElement.closest(".xterm"))){if(/^[1-9]$/.test(he.key)){const Xe=Number(he.key)-1;Ne[Xe]&&(he.preventDefault(),Ws(Ne[Xe].name),D("grid"));return}if(he.key==="]"){he.preventDefault(),Ri(1),D("grid");return}if(he.key==="["){he.preventDefault(),Ri(-1),D("grid");return}if(he.key==="a"){he.preventDefault(),Mi(),D("grid");return}if(he.key==="Tab"){!Me&&!$&&(he.preventDefault(),se(Xe=>Xe==="list"?"diff":"list")),$||D("pane");return}if(he.key==="j"){he.preventDefault(),bn(1),$||D("pane");return}if(he.key==="k"){he.preventDefault(),bn(-1),$||D("pane");return}if(he.key==="r"){he.preventDefault(),xs();return}if(he.key==="\\"){he.preventDefault(),(De=(ue=m.current)==null?void 0:ue.splitFocused)==null||De.call(ue,"right");return}if(he.key==="m"){he.preventDefault(),(Be=(Oe=m.current)==null?void 0:Oe.toggleMaximize)==null||Be.call(Oe);return}if(he.key==="Escape"){if(Ie){he.preventDefault(),$e(!1);return}Me&&(he.preventDefault(),We(!1));return}if(he.key==="?"){he.preventDefault(),$e(Xe=>!Xe);return}if(he.key==="v"){Me&&(he.preventDefault(),Xi());return}he.key==="o"&&(he.preventDefault(),Ss())}}return window.addEventListener("keydown",ne),()=>window.removeEventListener("keydown",ne)},[Ne,Ws,Ri,Mi,Me,Ie,$,bn,Xi,Ss,xs]);const zo=Ne.find(ne=>ne.name===w)??null,Bo=S?((pr=t.find(ne=>ne.id===S))==null?void 0:pr.label)??S.split("/").pop():null;return z.jsxs("main",{className:`flex h-screen flex-col bg-garage-bg font-sans text-[13px] text-garage-ink ${gn.focusDim?"focus-dim":""}`,children:[z.jsxs("header",{onMouseDown:Xt,className:"flex h-12 flex-none items-center gap-3 border-b border-garage-line bg-garage-panel px-4",children:[z.jsx("span",{className:"text-[15px] font-semibold tracking-tight text-garage-ink",children:"claude-garage"}),b!=="live"&&z.jsxs("span",{title:"daemon connection state",className:"flex items-center gap-1.5 text-xs text-garage-dim",children:[z.jsx("span",{children:"↻"}),"reconnecting…"]}),z.jsxs("div",{className:"relative ml-auto flex items-center gap-2",children:[Vt>0&&z.jsxs("button",{type:"button",onClick:Mi,title:"jump to a session that needs input (same as pressing a)",className:"flex items-center gap-1.5 rounded-md bg-garage-amber/10 px-3 py-1.5 text-[13px] font-semibold text-garage-amber hover:bg-garage-amber/15",children:[z.jsx("span",{children:"●"}),Vt," need",Vt===1?"s":""," input"]}),z.jsx(fw,{}),z.jsx("button",{type:"button",onClick:()=>c(ne=>!ne),className:"rounded-md px-3 py-1.5 text-[13px] text-garage-dim hover:bg-garage-sel hover:text-garage-ink",children:"+ Add workspace"}),d&&z.jsx(W0,{onClose:()=>c(!1),existingNames:p.map(ne=>ne.name),onCreated:()=>{Hs(),c(!1)}})]})]}),o&&z.jsxs("div",{className:"flex-none px-4 py-2 text-xs text-garage-red bg-garage-panel",children:[o," — retrying…"]}),z.jsx(F0,{sessions:t}),z.jsxs("div",{className:"grid min-h-0 flex-1",style:{gridTemplateColumns:$?`${B}px 4px 1fr 32px`:`${B}px 4px 1fr 4px ${N}px`},children:[z.jsx(rg,{groups:Ne,focusedWorkspace:w,focusedSessionId:l,onSelectWorkspace:Ws,onSelectSession:wn,onSessionCreated:hi,onOpenRoot:Cs,onBlurChrome:Xt,onSessionsRestored:hi,onWorkspaceRenamed:()=>{Hs(),hi()},hiddenIds:st,columnActive:v==="rail",onActivateColumn:P,viewsByWorkspace:ut,onSelectView:Rt}),z.jsx("div",{role:"separator","aria-orientation":"vertical",className:`col-divider ${F==="rail"?"is-dragging":""}`,onMouseDown:V}),z.jsx(G0,{group:zo,focusedSessionId:l,onFocusCell:u,onBlurChrome:Xt,onSessionsRestored:hi,hiddenIds:st,onHideCell:ur,columnActive:v==="grid",onActivateColumn:T,onAddWorkspace:()=>c(!0),gridActionsRef:m,views:(Ke==null?void 0:Ke.views)??[],focusedView:li,viewAssignments:(Ke==null?void 0:Ke.assignments)??{},activeViewIds:gt,onSelectView:Rt,onDetachCell:Ye,onRejoinCell:Bs,onAssignNewSession:dr}),!$&&z.jsx("div",{role:"separator","aria-orientation":"vertical",className:`col-divider ${F==="pane"?"is-dragging":""}`,onMouseDown:K}),z.jsx(Z0,{workspace:w,branch:ae,files:ie,truncated:L,loading:R,error:X,collapsed:$,onToggleCollapse:()=>O(ne=>!ne),emphasis:le,selectedPath:ge,onSelectFile:fe,onRefresh:()=>Mt(w),onBlurChrome:Xt,columnActive:v==="pane",onActivateColumn:A,onEnterReview:xs})]}),z.jsxs("div",{"aria-hidden":"true",className:"flex h-9 flex-none flex-wrap items-center gap-5 border-t border-garage-line bg-garage-panel px-4 text-xs text-garage-faint",children:[z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"?"})," help"]}),z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"a"})," needs-input"]}),z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"1–9"})," workspace"]}),z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"\\"})," split"]}),z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"m"})," maximize"]}),z.jsxs("span",{children:[z.jsx("kbd",{className:"font-mono text-[11px] text-garage-dim",children:"r"})," review"]}),z.jsx("span",{className:`ml-auto ${S?"text-garage-ink font-medium":"text-garage-faint"}`,children:S?`keys go to ${Bo} — Ctrl+\` to return`:"keys go to garage"})]}),Me&&z.jsx(iw,{workspace:w,files:ie,truncated:L,selectedPath:ge,onSelectFile:fe,viewedMap:je,onOpenRoot:Cs}),z.jsx(cw,{sessions:t,connState:b,onJump:Mi}),Ie&&z.jsx(rw,{onClose:()=>$e(!1)}),g&&z.jsxs("div",{className:"fixed bottom-10 left-1/2 z-[60] -translate-x-1/2 rounded-lg border border-garage-line bg-garage-panel px-4 py-1.5 text-xs text-garage-dim shadow-sm",children:["keys now go to ",z.jsx("span",{className:"font-medium text-garage-ink",children:g.label})," ","— press ",z.jsx("span",{className:"font-medium text-garage-ink",children:"Ctrl+`"})," to return to garage"]}),Ae&&z.jsxs("div",{className:"fixed bottom-4 right-4 z-[60] flex max-w-sm items-start gap-2 rounded-lg border border-garage-line bg-garage-panel px-3 py-2 text-xs text-garage-red shadow-sm",children:[z.jsx("span",{children:Ae}),z.jsx("button",{type:"button",onClick:()=>ve(null),className:"ml-auto text-garage-dim hover:text-garage-ink",children:"×"})]})]})}Um.createRoot(document.getElementById("root")).render(z.jsx(Sw,{}));